entering non utf8 text in filepaths in the file selector would get incorrectly stripped.
authorCampbell Barton <ideasman42@gmail.com>
Tue, 10 May 2011 05:07:24 +0000 (05:07 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 10 May 2011 05:07:24 +0000 (05:07 +0000)
source/blender/editors/interface/interface_handlers.c

index ae5af18..e2910d3 100644 (file)
@@ -262,14 +262,12 @@ static int ui_is_a_warp_but(uiBut *but)
 static int ui_is_utf8_but(uiBut *but)
 {
        if (but->rnaprop) {
-               int subtype= RNA_property_subtype(but->rnaprop);
-               
-               if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
-                       return TRUE;
-               }
+               const int subtype= RNA_property_subtype(but->rnaprop);
+               return !(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME));
+       }
+       else {
+               return !(but->flag & UI_BUT_NO_UTF8);
        }
-
-       return !(but->flag & UI_BUT_NO_UTF8);
 }
 
 /* ********************** button apply/revert ************************/
@@ -1679,7 +1677,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) {