diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-27 13:26:22 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-27 13:26:22 +0400 |
commit | 9c8721e1a14cc3b48ece136ae2be94d329f5b0d1 (patch) | |
tree | e93b60b925d467a8308a2cd302070035f18a36a6 /source/blender/imbuf/intern | |
parent | 09aadea2cc26f710a73ba524b076eebada8c93b5 (diff) |
code cleanup for thumbnails:
- use URI_MAX define
- replace strcat with BLI_snprintf.
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/thumbs.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 7266001e290..18268043a04 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -67,7 +67,7 @@ # include <unistd.h> #endif -#define URI_MAX FILE_MAX * 3 + 8 +#define URI_MAX (FILE_MAX * 3 + 8) static int get_thumb_dir(char *dir, ThumbSize size) { @@ -200,20 +200,20 @@ static int uri_from_filename(const char *path, char *uri) strcat(orig_uri, vol); dirstart += 2; } -#else - BLI_strncpy(orig_uri, "file://", FILE_MAX); -#endif strcat(orig_uri, dirstart); BLI_char_switch(orig_uri, '\\', '/'); +#else + BLI_snprintf(orig_uri, URI_MAX, "file://%s", dirstart); +#endif #ifdef WITH_ICONV { - char uri_utf8[FILE_MAX * 3 + 8]; - escape_uri_string(orig_uri, uri_utf8, FILE_MAX * 3 + 8, UNSAFE_PATH); + char uri_utf8[URI_MAX]; + escape_uri_string(orig_uri, uri_utf8, URI_MAX, UNSAFE_PATH); BLI_string_to_utf8(uri_utf8, uri, NULL); } #else - escape_uri_string(orig_uri, uri, FILE_MAX * 3 + 8, UNSAFE_PATH); + escape_uri_string(orig_uri, uri, URI_MAX, UNSAFE_PATH); #endif return 1; } @@ -401,7 +401,7 @@ ImBuf *IMB_thumb_create(const char *path, ThumbSize size, ThumbSource source, Im ImBuf *IMB_thumb_read(const char *path, ThumbSize size) { char thumb[FILE_MAX]; - char uri[FILE_MAX * 3 + 8]; + char uri[URI_MAX]; ImBuf *img = NULL; if (!uri_from_filename(path, uri)) { @@ -418,7 +418,7 @@ ImBuf *IMB_thumb_read(const char *path, ThumbSize size) void IMB_thumb_delete(const char *path, ThumbSize size) { char thumb[FILE_MAX]; - char uri[FILE_MAX * 3 + 8]; + char uri[URI_MAX]; if (!uri_from_filename(path, uri)) { return; @@ -438,7 +438,7 @@ void IMB_thumb_delete(const char *path, ThumbSize size) ImBuf *IMB_thumb_manage(const char *path, ThumbSize size, ThumbSource source) { char thumb[FILE_MAX]; - char uri[FILE_MAX * 3 + 8]; + char uri[URI_MAX]; struct stat st; ImBuf *img = NULL; |