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; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 95a80df3e00..b6db799a443 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1589,7 +1589,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data) { if(but) { - if(ui_is_utf8_but(but)) { + if(!ui_is_utf8_but(but)) { int strip= BLI_utf8_invalid_strip(but->editstr, strlen(but->editstr)); /* not a file?, strip non utf-8 chars */ if(strip) {