Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #include <wctype.h> | 1 #include <wctype.h> |
| 2 #include "libc.h" | 2 #include "libc.h" |
| 3 | 3 |
| 4 #define CASEMAP(u1,u2,l) { (u1), (l)-(u1), (u2)-(u1)+1 } | 4 #define CASEMAP(u1,u2,l) { (u1), (l)-(u1), (u2)-(u1)+1 } |
| 5 #define CASELACE(u1,u2) CASEMAP((u1),(u2),(u1)+1) | 5 #define CASELACE(u1,u2) CASEMAP((u1),(u2),(u1)+1) |
| 6 | 6 |
| 7 static const struct { | 7 static const struct { |
| 8 unsigned short upper; | 8 unsigned short upper; |
| 9 signed char lower; | 9 signed char lower; |
| 10 unsigned char len; | 10 unsigned char len; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 int i; | 225 int i; |
| 226 int lmul = 2*lower-1; | 226 int lmul = 2*lower-1; |
| 227 int lmask = lower-1; | 227 int lmask = lower-1; |
| 228 /* no letters with case in these large ranges */ | 228 /* no letters with case in these large ranges */ |
| 229 if (!iswalpha(wc) | 229 if (!iswalpha(wc) |
| 230 || (unsigned)wc - 0x0600 <= 0x0fff-0x0600 | 230 || (unsigned)wc - 0x0600 <= 0x0fff-0x0600 |
| 231 || (unsigned)wc - 0x2e00 <= 0xa63f-0x2e00 | 231 || (unsigned)wc - 0x2e00 <= 0xa63f-0x2e00 |
| 232 || (unsigned)wc - 0xa800 <= 0xfeff-0xa800) | 232 || (unsigned)wc - 0xa800 <= 0xfeff-0xa800) |
| 233 return wc; | 233 return wc; |
| 234 /* special case because the diff between upper/lower is too big */ | 234 /* special case because the diff between upper/lower is too big */ |
| 235 » if (lower && (unsigned)wc - 0x10a0 < 0x2e) | 235 » if (lower && (unsigned)wc - 0x10a0 < 0x2e) { |
| 236 if (wc>0x10c5 && wc != 0x10c7 && wc != 0x10cd) return wc; | 236 if (wc>0x10c5 && wc != 0x10c7 && wc != 0x10cd) return wc; |
| 237 else return wc + 0x2d00 - 0x10a0; | 237 else return wc + 0x2d00 - 0x10a0; |
| 238 » if (!lower && (unsigned)wc - 0x2d00 < 0x26) | 238 » } |
| 239 » if (!lower && (unsigned)wc - 0x2d00 < 0x26) { | |
| 239 if (wc>0x2d25 && wc != 0x2d27 && wc != 0x2d2d) return wc; | 240 if (wc>0x2d25 && wc != 0x2d27 && wc != 0x2d2d) return wc; |
| 240 else return wc + 0x10a0 - 0x2d00; | 241 else return wc + 0x10a0 - 0x2d00; |
| 242 } | |
|
viettrungluu
2016/01/12 16:47:50
"Should" this be a hard tab? (Or is this just a ri
| |
| 241 for (i=0; casemaps[i].len; i++) { | 243 for (i=0; casemaps[i].len; i++) { |
| 242 int base = casemaps[i].upper + (lmask & casemaps[i].lower); | 244 int base = casemaps[i].upper + (lmask & casemaps[i].lower); |
| 243 if ((unsigned)wc-base < casemaps[i].len) { | 245 if ((unsigned)wc-base < casemaps[i].len) { |
| 244 if (casemaps[i].lower == 1) | 246 if (casemaps[i].lower == 1) |
| 245 return wc + lower - ((wc-casemaps[i].upper)&1); | 247 return wc + lower - ((wc-casemaps[i].upper)&1); |
| 246 return wc + lmul*casemaps[i].lower; | 248 return wc + lmul*casemaps[i].lower; |
| 247 } | 249 } |
| 248 } | 250 } |
| 249 for (i=0; pairs[i][1-lower]; i++) { | 251 for (i=0; pairs[i][1-lower]; i++) { |
| 250 if (pairs[i][1-lower] == wc) | 252 if (pairs[i][1-lower] == wc) |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 270 return towupper(c); | 272 return towupper(c); |
| 271 } | 273 } |
| 272 | 274 |
| 273 wint_t __towlower_l(wint_t c, locale_t l) | 275 wint_t __towlower_l(wint_t c, locale_t l) |
| 274 { | 276 { |
| 275 return towlower(c); | 277 return towlower(c); |
| 276 } | 278 } |
| 277 | 279 |
| 278 weak_alias(__towupper_l, towupper_l); | 280 weak_alias(__towupper_l, towupper_l); |
| 279 weak_alias(__towlower_l, towlower_l); | 281 weak_alias(__towlower_l, towlower_l); |
| OLD | NEW |