Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-03-26 19:52:43 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-03-26 19:52:43 +0400
commitbd69bd65d64aa9264d4dd8a5a64d3bf06760fec6 (patch)
tree807668b54448741e9883f6d7c5fd4eeca056f354
parent22000aa2fc74c3ebd8a9469fe52cff6006e0e52d (diff)
Fix regression introduced by svn rev55545
After this revision BLI_stringdec worked incorrect in cases there's no digits in original file name, making head one character shorter than it should be. Time to cover BLI with unit-tests?
-rw-r--r--source/blender/blenlib/intern/path_util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index bcba2715740..6b9b371a4f3 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -135,7 +135,10 @@ int BLI_stringdec(const char *string, char *head, char *tail, unsigned short *nu
else {
if (tail) strcpy(tail, string + name_end);
if (head) {
- BLI_strncpy(head, string, name_end);
+ /* name_end points to last character of head,
+ * make it +1 so null-terminator is nicely placed
+ */
+ BLI_strncpy(head, string, name_end + 1);
}
if (numlen) *numlen = 0;
return 0;