fix [#26656] video sequence editor rendering stops at frame 9999
authorCampbell Barton <ideasman42@gmail.com>
Tue, 29 Mar 2011 14:07:07 +0000 (14:07 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 29 Mar 2011 14:07:07 +0000 (14:07 +0000)
source/blender/blenlib/intern/path_util.c

index 0dc0960..e9efc63 100644 (file)
@@ -587,20 +587,7 @@ int BLI_path_frame(char *path, int frame, int digits)
 
        if (stringframe_chars(path, &ch_sta, &ch_end)) { /* warning, ch_end is the last # +1 */
                char tmp[FILE_MAX];
-#if 0  // neat but breaks on non ascii strings.
-               char format[64];
-               sprintf(format, "%%.%ds%%.%dd%%s", ch_sta, ch_end-ch_sta); /* example result: "%.12s%.5d%s" */
-               sprintf(tmp, format, path, frame, path+ch_end);
-#else
-               char format[8];
-               char *p;
-               sprintf(format, "%%.%dd", ch_end-ch_sta); /* example result: "%.5d" */
-               memcpy(tmp, path, sizeof(char) * ch_sta);
-               p= tmp + ch_sta;
-               p += sprintf(p, format, frame);
-               memcpy(p, path + ch_end, strlen(path + ch_end));
-               *(tmp+strlen(path)) = '\0';
-#endif
+               sprintf(tmp, "%.*s%.*d%s", ch_sta, path, digits, frame, path+ch_end);
                strcpy(path, tmp);
                return 1;
        }
@@ -615,19 +602,9 @@ int BLI_path_frame_range(char *path, int sta, int end, int digits)
                ensure_digits(path, digits);
 
        if (stringframe_chars(path, &ch_sta, &ch_end)) { /* warning, ch_end is the last # +1 */
-               char tmp[FILE_MAX], format[64];
-#if 0  // neat but breaks on non ascii strings.
-               sprintf(format, "%%.%ds%%.%dd_%%.%dd%%s", ch_sta, ch_end-ch_sta, ch_end-ch_sta); /* example result: "%.12s%.5d-%.5d%s" */
-               sprintf(tmp, format, path, sta, end, path+ch_end);
+               char tmp[FILE_MAX];
+               sprintf(tmp, "%.*s%.*d-%.*d%s", ch_sta, path, digits, sta, digits, end, path+ch_end);
                strcpy(path, tmp);
-#else
-               char *tmp_pt;
-               BLI_snprintf(format, sizeof(format), "%%.%dd-%%.%dd%%s", digits, digits);
-               memcpy(tmp, path, ch_sta * sizeof(char));
-               tmp_pt = &tmp[ch_sta];
-               tmp_pt += BLI_snprintf(tmp_pt, sizeof(tmp)-ch_sta, format, sta, end, &path[ch_end]);
-               memcpy(path, tmp, (int)(tmp_pt - tmp) + 1);
-#endif
                return 1;
        }
        return 0;