diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-11-16 11:53:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-11-16 11:53:55 +0300 |
commit | 7f968521767ec0e99d26650047d16736126aaf53 (patch) | |
tree | 8bca971fe0f2567254952327b4afb0b51bc6dc7e /source/blender/blenlib | |
parent | f48f8d3bbc943525ce1b4db9d58e0d2cc76b5995 (diff) |
fix for creating movie paths with non utf8 names.
button test if non utf8 chars are allowed was inverted.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index a496e6c50e9..b6d4d700684 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -615,9 +615,18 @@ int BLI_path_frame_range(char *path, int sta, int end, int 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); 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; |