diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-11-01 04:46:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-11-01 04:46:26 +0300 |
commit | d9a7358b4cd09980e35ea8e51e77d487c8c99444 (patch) | |
tree | b9194640bcbe329d23c5f7aff956f180fb5d6469 /source/blender/blenlib | |
parent | 29bcda37fd506ed70b955c631f009307ea2e1ebc (diff) |
bugfix [#24462] UV Layouts saved as PNG results in two files (one is 0 KB, other has corrupted filename)
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 8a6f6205eac..91558d4806e 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -543,9 +543,20 @@ int BLI_path_frame(char *path, int frame, 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]; + 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)); +#endif strcpy(path, tmp); return 1; } |