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?
This commit is contained in:
Sergey Sharybin
2013-03-26 15:52:43 +00:00
parent 22000aa2fc
commit bd69bd65d6

View File

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