| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,9 +27,13 @@ | |||
| 27 | 27 | #define EXTENDED_CASE_MASK 0x4000 | |
| 28 | 28 | ||
| 29 | 29 | typedef struct { | |
| 30 | - const Py_UCS4 upper; | ||
| 31 | - const Py_UCS4 lower; | ||
| 32 | - const Py_UCS4 title; | ||
| 30 | + /* | ||
| 31 | + These are either deltas to the character or offsets in | ||
| 32 | + _PyUnicode_ExtendedCase. | ||
| 33 | + */ | ||
| 34 | + const int upper; | ||
| 35 | + const int lower; | ||
| 36 | + const int title; | ||
| 33 | 37 | const unsigned char decimal; | |
| 34 | 38 | const unsigned char digit; | |
| 35 | 39 | const unsigned short flags; | |
@@ -60,7 +64,7 @@ Py_UCS4 _PyUnicode_ToTitlecase(register Py_UCS4 ch) | |||
| 60 | 64 | { | |
| 61 | 65 | const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); | |
| 62 | 66 | ||
| 63 | - return ctype->title ? ctype->title : ch; | ||
| 67 | + return ch + ctype->title; | ||
| 64 | 68 | } | |
| 65 | 69 | ||
| 66 | 70 | /* Returns 1 for Unicode characters having the category 'Lt', 0 | |
@@ -186,7 +190,7 @@ Py_UCS4 _PyUnicode_ToUppercase(Py_UCS4 ch) | |||
| 186 | 190 | ||
| 187 | 191 | if (ctype->flags & EXTENDED_CASE_MASK) | |
| 188 | 192 | return _PyUnicode_ExtendedCase[ctype->upper & 0xFFFF]; | |
| 189 | - return ctype->upper ? ctype->upper : ch; | ||
| 193 | + return ch + ctype->upper; | ||
| 190 | 194 | } | |
| 191 | 195 | ||
| 192 | 196 | /* Returns the lowercase Unicode characters corresponding to ch or just | |
@@ -198,7 +202,7 @@ Py_UCS4 _PyUnicode_ToLowercase(Py_UCS4 ch) | |||
| 198 | 202 | ||
| 199 | 203 | if (ctype->flags & EXTENDED_CASE_MASK) | |
| 200 | 204 | return _PyUnicode_ExtendedCase[ctype->lower & 0xFFFF]; | |
| 201 | - return ctype->lower ? ctype->lower : ch; | ||
| 205 | + return ch + ctype->lower; | ||
| 202 | 206 | } | |
| 203 | 207 | ||
| 204 | 208 | int _PyUnicode_ToLowerFull(Py_UCS4 ch, Py_UCS4 *res) | |
@@ -213,7 +217,7 @@ int _PyUnicode_ToLowerFull(Py_UCS4 ch, Py_UCS4 *res) | |||
| 213 | 217 | res[i] = _PyUnicode_ExtendedCase[index + i]; | |
| 214 | 218 | return n; | |
| 215 | 219 | } | |
| 216 | - res[0] = ctype->lower ? ctype->lower : ch; | ||
| 220 | + res[0] = ch + ctype->lower; | ||
| 217 | 221 | return 1; | |
| 218 | 222 | } | |
| 219 | 223 | ||
@@ -229,7 +233,7 @@ int _PyUnicode_ToTitleFull(Py_UCS4 ch, Py_UCS4 *res) | |||
| 229 | 233 | res[i] = _PyUnicode_ExtendedCase[index + i]; | |
| 230 | 234 | return n; | |
| 231 | 235 | } | |
| 232 | - res[0] = ctype->title ? ctype->title : ch; | ||
| 236 | + res[0] = ch + ctype->title; | ||
| 233 | 237 | return 1; | |
| 234 | 238 | } | |
| 235 | 239 | ||
@@ -245,7 +249,7 @@ int _PyUnicode_ToUpperFull(Py_UCS4 ch, Py_UCS4 *res) | |||
| 245 | 249 | res[i] = _PyUnicode_ExtendedCase[index + i]; | |
| 246 | 250 | return n; | |
| 247 | 251 | } | |
| 248 | - res[0] = ctype->upper ? ctype->upper : ch; | ||
| 252 | + res[0] = ch + ctype->upper; | ||
| 249 | 253 | return 1; | |
| 250 | 254 | } | |
| 251 | 255 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments