index-of-nearest-104619 #2

Merged
Iliya Katushenock merged 62 commits from HooglyBoogly/blender:index-of-nearest-104619 into index_of_nearest 2023-04-20 21:19:53 +02:00
2 changed files with 6 additions and 1 deletions
Showing only changes of commit 80edd10168 - Show all commits

View File

@ -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;
}

View File

@ -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