diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-12-06 02:50:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-12-06 02:50:55 +0300 |
commit | 2f366d1544ecc5618d7190b779ccc75f2f144d0a (patch) | |
tree | 699c5b52c7f8768bd46720b1824bee3565e2dff9 /source/blender/blenlib | |
parent | 9668c29ba00ed830109665ea132b6292cdfe9e2a (diff) |
use BLI_strnlen rather then strlen when comparing against fixed lengths.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 9be0690d95a..4cbd93ce0a1 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -418,8 +418,8 @@ void BLI_path_rel(char *file, const char *relfile) /* also bail out if relative path is not set */ if (relfile[0] == 0) return; -#ifdef WIN32 - if (strlen(relfile) > 2 && relfile[1] != ':') { +#ifdef WIN32 + if (BLI_strnlen(relfile, 3) > 2 && relfile[1] != ':') { char* ptemp; /* fix missing volume name in relative base, can happen with old recent-files.txt files */ @@ -433,7 +433,7 @@ void BLI_path_rel(char *file, const char *relfile) BLI_strncpy(temp, relfile, FILE_MAXDIR + FILE_MAXFILE); } - if (strlen(file) > 2) { + if (BLI_strnlen(file, 3) > 2) { if ( temp[1] == ':' && file[1] == ':' && temp[0] != file[0] ) return; } @@ -1181,8 +1181,9 @@ void BLI_setenv_if_new(const char *env, const char* val) void BLI_clean(char *path) { if(path==0) return; + #ifdef WIN32 - if(path && strlen(path)>2) { + if(path && BLI_strnlen(path, 3) > 2) { BLI_char_switch(path+2, '/', '\\'); } #else @@ -1271,7 +1272,7 @@ void BLI_make_file_string(const char *relabase, char *string, const char *dir, } #ifdef WIN32 else { - if (strlen(dir) >= 2 && dir[1] == ':' ) { + if (BLI_strnlen(dir, 3) >= 2 && dir[1] == ':' ) { BLI_strncpy(string, dir, 3); dir += 2; } |