forked from blender/blender
index-of-nearest-104619 #2
@ -596,7 +596,7 @@ bool BLI_path_suffix(char *string, size_t maxlen, const char *suffix, const char
|
||||
if (string_len + sep_len + suffix_len >= maxlen) {
|
||||
return false;
|
||||
}
|
||||
BLI_strncpy(extension_copy, string + string_end, sizeof(extension));
|
||||
BLI_strncpy(extension_copy, string + string_end, sizeof(extension_copy));
|
||||
BLI_sprintf(string + string_end, "%s%s%s", sep, suffix, extension_copy);
|
||||
return true;
|
||||
}
|
||||
|
@ -1010,6 +1010,11 @@ TEST(path_util, PathSuffix)
|
||||
PATH_SUFFIX("", FILE_MAX, "_", "123", true, "_123");
|
||||
/* Empty input/output. */
|
||||
PATH_SUFFIX("", FILE_MAX, "", "", true, "");
|
||||
|
||||
/* Long suffix. */
|
||||
PATH_SUFFIX("file.txt", FILE_MAX, "_", "1234567890", true, "file_1234567890.txt");
|
||||
/* Long extension. */
|
||||
PATH_SUFFIX("file.txt1234567890", FILE_MAX, "_", "123", true, "file_123.txt1234567890");
|
||||
}
|
||||
|
||||
#undef PATH_SUFFIX
|
||||
|
Loading…
Reference in New Issue
Block a user