Revision: 36912 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36912 Author: blendix Date: 2011-05-26 09:58:22 +0000 (Thu, 26 May 2011) Log Message: ----------- Fix #27445: various operators missing with some non-english system languages.
In the case of this bug e.g. material.new became MATERiAL_OT_new, due to different capitalization of "i" in Turkish. Fixed by not using the locale dependent toupper/tolower functions. Modified Paths: -------------- trunk/blender/source/blender/blenlib/BLI_string.h trunk/blender/source/blender/blenlib/intern/string.c trunk/blender/source/blender/windowmanager/intern/wm_operators.c Modified: trunk/blender/source/blender/blenlib/BLI_string.h =================================================================== --- trunk/blender/source/blender/blenlib/BLI_string.h 2011-05-26 09:46:51 UTC (rev 36911) +++ trunk/blender/source/blender/blenlib/BLI_string.h 2011-05-26 09:58:22 UTC (rev 36912) @@ -147,6 +147,9 @@ int BLI_utf8_invalid_byte(const char *str, int length); int BLI_utf8_invalid_strip(char *str, int length); +void BLI_ascii_strtolower(char *str, int len); +void BLI_ascii_strtoupper(char *str, int len); + #ifdef __cplusplus } #endif Modified: trunk/blender/source/blender/blenlib/intern/string.c =================================================================== --- trunk/blender/source/blender/blenlib/intern/string.c 2011-05-26 09:46:51 UTC (rev 36911) +++ trunk/blender/source/blender/blenlib/intern/string.c 2011-05-26 09:58:22 UTC (rev 36912) @@ -469,3 +469,21 @@ return tot; } +void BLI_ascii_strtolower(char *str, int len) +{ + int i; + + for(i=0; i<len; i++) + if(str[i] >= 'A' && str[i] <= 'Z') + str[i] += 'a' - 'A'; +} + +void BLI_ascii_strtoupper(char *str, int len) +{ + int i; + + for(i=0; i<len; i++) + if(str[i] >= 'a' && str[i] <= 'z') + str[i] -= 'a' - 'A'; +} + Modified: trunk/blender/source/blender/windowmanager/intern/wm_operators.c =================================================================== --- trunk/blender/source/blender/windowmanager/intern/wm_operators.c 2011-05-26 09:46:51 UTC (rev 36911) +++ trunk/blender/source/blender/windowmanager/intern/wm_operators.c 2011-05-26 09:58:22 UTC (rev 36912) @@ -56,6 +56,7 @@ #include "BLI_blenlib.h" #include "BLI_dynstr.h" /*for WM_operator_pystring */ #include "BLI_math.h" +#include "BLI_string.h" #include "BLI_utildefines.h" #include "BLO_readfile.h" @@ -441,11 +442,13 @@ { char *sep= strstr(from, "_OT_"); if(sep) { - int i, ofs= (sep-from); + int ofs= (sep-from); + + /* note, we use ascii tolower instead of system tolower, because the + latter depends on the locale, and can lead to idname mistmatch */ + memcpy(to, from, sizeof(char)*ofs); + BLI_ascii_strtolower(to, ofs); - for(i=0; i<ofs; i++) - to[i]= tolower(from[i]); - to[ofs] = '.'; BLI_strncpy(to+(ofs+1), sep+4, OP_MAX_TYPENAME); } @@ -462,10 +465,10 @@ char *sep= strchr(from, '.'); if(sep) { - int i, ofs= (sep-from); + int ofs= (sep-from); - for(i=0; i<ofs; i++) - to[i]= toupper(from[i]); + memcpy(to, from, sizeof(char)*ofs); + BLI_ascii_strtoupper(to, ofs); BLI_strncpy(to+ofs, "_OT_", OP_MAX_TYPENAME); BLI_strncpy(to+(ofs+4), sep+1, OP_MAX_TYPENAME); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs