diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-23 16:49:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-23 16:49:30 +0400 |
commit | 3ff3d1bc0fa6979d0745dbd7526cbb5c35c1fcbf (patch) | |
tree | 99df5ec67111abede3cb2e29b469bb7a1ff2b3ae /source/blender/imbuf/intern | |
parent | a5bc02194345de1eb21f843b73ce24799677aea1 (diff) |
replace use of strcat() where the string offset is known.
also correct bad logic with converting a textblock to 3d-text, bytes-vs-number of chars wasn't handled right.
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/thumbs.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 59b78109aaf..2e43e46f946 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -71,31 +71,36 @@ static int get_thumb_dir(char *dir, ThumbSize size) { + char *s = dir; #ifdef WIN32 wchar_t dir_16[MAX_PATH]; /* yes, applications shouldn't store data there, but so does GIMP :)*/ SHGetSpecialFolderPathW(0, dir_16, CSIDL_PROFILE, 0); conv_utf_16_to_8(dir_16, dir, FILE_MAX); - - + s += strlen(dir); #else const char *home = getenv("HOME"); + const char *subdir; if (!home) return 0; - BLI_strncpy(dir, home, FILE_MAX); + s += BLI_strncpy_rlen(s, home, FILE_MAX); #endif switch (size) { case THB_NORMAL: - strcat(dir, "/.thumbnails/normal/"); + subdir = "/.thumbnails/normal/"; break; case THB_LARGE: - strcat(dir, "/.thumbnails/large/"); + subdir = "/.thumbnails/large/"; break; case THB_FAIL: - strcat(dir, "/.thumbnails/fail/blender/"); + subdir = "/.thumbnails/fail/blender/"; break; default: return 0; /* unknown size */ } + + s += BLI_strncpy_rlen(s, subdir, FILE_MAX - (s - dir)); + (void)s; + return 1; } |