OLD | NEW |
1 This patch removes the usage of tolower() in fts code, which is not locale | 1 This patch removes the usage of tolower() in fts code, which is not locale |
2 neutral and causes problem in some locales such as Turkish. | 2 neutral and causes problem in some locales such as Turkish. |
3 See http://crbug.com/15261 for details. | 3 See http://crbug.com/15261 for details. |
4 An upstream ticket was also created for this issue: | 4 An upstream ticket was also created for this issue: |
5 http://www.sqlite.org/src/tktview/991789d9f3136a0460dc83a33e815c1aa9757c26 | 5 http://www.sqlite.org/src/tktview/991789d9f3136a0460dc83a33e815c1aa9757c26 |
6 | 6 |
7 Index: ext/fts3/fts3.c | 7 Index: ext/fts3/fts3.c |
8 =================================================================== | 8 =================================================================== |
9 --- ext/fts3/fts3.c 2009-09-04 13:37:41.000000000 -0700 | 9 --- ext/fts3/fts3.c 2009-09-04 13:37:41.000000000 -0700 |
10 +++ ext/fts3/fts3.c 2009-09-14 18:17:45.000000000 -0700 | 10 +++ ext/fts3/fts3.c 2009-09-14 18:17:45.000000000 -0700 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 static int safe_tolower(char c){ | 66 static int safe_tolower(char c){ |
67 - return (c&0x80)==0 ? tolower(c) : c; | 67 - return (c&0x80)==0 ? tolower(c) : c; |
68 + return (c>='A' && c<='Z') ? (c-'A'+'a') : c; | 68 + return (c>='A' && c<='Z') ? (c-'A'+'a') : c; |
69 } | 69 } |
70 static int safe_isalnum(char c){ | 70 static int safe_isalnum(char c){ |
71 return (c&0x80)==0 ? isalnum(c) : 0; | 71 return (c&0x80)==0 ? isalnum(c) : 0; |
72 Index: ext/fts2/fts2.c | 72 Index: ext/fts2/fts2.c |
73 =================================================================== | 73 =================================================================== |
74 --- ext/fts2/fts2.c 2009-09-04 13:37:41.000000000 -0700 | 74 --- ext/fts2/fts2.c 2009-09-04 13:37:41.000000000 -0700 |
75 +++ ext/fts2/fts2.c 2009-09-14 18:17:02.000000000 -0700 | 75 +++ ext/fts2/fts2.c 2009-09-14 18:17:02.000000000 -0700 |
76 @@ -348,7 +372,7 @@ | 76 @@ -372,7 +372,7 @@ |
77 return (c&0x80)==0 ? isspace(c) : 0; | 77 return (c&0x80)==0 ? isspace(c) : 0; |
78 } | 78 } |
79 static int safe_tolower(char c){ | 79 static int safe_tolower(char c){ |
80 - return (c&0x80)==0 ? tolower(c) : c; | 80 - return (c&0x80)==0 ? tolower(c) : c; |
81 + return (c>='A' && c<='Z') ? (c-'A'+'a') : c; | 81 + return (c>='A' && c<='Z') ? (c-'A'+'a') : c; |
82 } | 82 } |
83 static int safe_isalnum(char c){ | 83 static int safe_isalnum(char c){ |
84 return (c&0x80)==0 ? isalnum(c) : 0; | 84 return (c&0x80)==0 ? isalnum(c) : 0; |
85 Index: ext/fts2/fts2_tokenizer1.c | 85 Index: ext/fts2/fts2_tokenizer1.c |
86 =================================================================== | 86 =================================================================== |
87 --- ext/fts2/fts2_tokenizer1.c 2009-09-03 13:32:06.000000000 -0700 | 87 --- ext/fts2/fts2_tokenizer1.c 2009-09-03 13:32:06.000000000 -0700 |
88 +++ ext/fts2/fts2_tokenizer1.c 2009-09-02 11:40:21.000000000 -0700 | 88 +++ ext/fts2/fts2_tokenizer1.c 2009-09-02 11:40:21.000000000 -0700 |
89 @@ -191,7 +191,7 @@ | 89 @@ -191,7 +191,7 @@ |
90 ** case-insensitivity. | 90 ** case-insensitivity. |
91 */ | 91 */ |
92 unsigned char ch = p[iStartOffset+i]; | 92 unsigned char ch = p[iStartOffset+i]; |
93 - c->pToken[i] = ch<0x80 ? tolower(ch) : ch; | 93 - c->pToken[i] = ch<0x80 ? tolower(ch) : ch; |
94 + c->pToken[i] = (ch>='A' && ch<='Z') ? (ch-'A'+'a') : ch; | 94 + c->pToken[i] = (ch>='A' && ch<='Z') ? (ch-'A'+'a') : ch; |
95 } | 95 } |
96 *ppToken = c->pToken; | 96 *ppToken = c->pToken; |
97 *pnBytes = n; | 97 *pnBytes = n; |
OLD | NEW |