Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-05-26 13:58:22 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-05-26 13:58:22 +0400
commit042a3ff3822254e33371e1dd782dd721ce3d0ec9 (patch)
tree7228056b9d14520964a5eb88edeafbd80acaf53b /source
parent686859afadb71c19381774b6eac28f2454a0ab49 (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/BLI_string.h3
-rw-r--r--source/blender/blenlib/intern/string.c18
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c17
3 files changed, 31 insertions, 7 deletions
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index 635c38e1d13..69702f72026 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -147,6 +147,9 @@ void BLI_timestr(double _time, char *str); /* time var is global */
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
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index ee5bd17c901..11de8a3d45c 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -469,3 +469,21 @@ int BLI_utf8_invalid_strip(char *str, int length)
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';
+}
+
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 8ac7a3d7eb6..78610d48a92 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -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,10 +442,12 @@ void WM_operator_py_idname(char *to, const char *from)
{
char *sep= strstr(from, "_OT_");
if(sep) {
- int i, ofs= (sep-from);
-
- for(i=0; i<ofs; i++)
- to[i]= tolower(from[i]);
+ 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);
to[ofs] = '.';
BLI_strncpy(to+(ofs+1), sep+4, OP_MAX_TYPENAME);
@@ -462,10 +465,10 @@ void WM_operator_bl_idname(char *to, const char *from)
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);