Commit: 1572c1b99020d37f1d38ba46084432adc714de20
Author: Dalai Felinto
Date:   Sat Apr 26 10:21:34 2014 -0300
https://developer.blender.org/rB1572c1b99020d37f1d38ba46084432adc714de20

changes to b2ffdf99 (BLI_path_suffix()) - to be squashed

===================================================================

M       source/blender/blenlib/intern/path_util.c

===================================================================

diff --git a/source/blender/blenlib/intern/path_util.c 
b/source/blender/blenlib/intern/path_util.c
index 938b95b..b956ffb 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -720,21 +720,25 @@ bool BLI_path_suffix(char *string, size_t maxlen, const 
char *suffix, const char
        const size_t sep_len = strlen(sep);
        ssize_t a;
        char extension[FILE_MAX];
+       bool has_extension = false;
 
        if (string_len + sep_len + suffix_len >= maxlen)
                return false;
 
        for (a = string_len - 1; a >= 0; a--) {
-               if (ELEM3(string[a], '.', '/', '\\')) {
+               if (string[a] == '.') {
+                       has_extension = true;
+                       break;
+               }
+               else if (ELEM(string[a], '/', '\\')) {
                        break;
                }
        }
 
-       if ((a < 0) || (string[a] != '.')) {
+       if (!has_extension)
                a = string_len;
-       }
 
-       strcpy(extension, string + a);
+       BLI_strncpy(extension, string + a, sizeof(extension));
        sprintf(string + a, "%s%s%s", sep, suffix, extension);
        return true;
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to