| OLD | NEW |
| 1 /* Copyright 2013 Google Inc. All Rights Reserved. | 1 /* Copyright 2013 Google Inc. All Rights Reserved. |
| 2 | 2 |
| 3 Distributed under MIT license. | 3 Distributed under MIT license. |
| 4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT | 4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* Transformations on dictionary words. */ | 7 /* Transformations on dictionary words. */ |
| 8 | 8 |
| 9 #ifndef BROTLI_DEC_TRANSFORM_H_ | 9 #ifndef BROTLI_DEC_TRANSFORM_H_ |
| 10 #define BROTLI_DEC_TRANSFORM_H_ | 10 #define BROTLI_DEC_TRANSFORM_H_ |
| 11 | 11 |
| 12 #include <brotli/types.h> |
| 12 #include "./port.h" | 13 #include "./port.h" |
| 13 #include "./types.h" | |
| 14 | 14 |
| 15 #if defined(__cplusplus) || defined(c_plusplus) | 15 #if defined(__cplusplus) || defined(c_plusplus) |
| 16 extern "C" { | 16 extern "C" { |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 enum WordTransformType { | 19 enum WordTransformType { |
| 20 kIdentity = 0, | 20 kIdentity = 0, |
| 21 kOmitLast1 = 1, | 21 kOmitLast1 = 1, |
| 22 kOmitLast2 = 2, | 22 kOmitLast2 = 2, |
| 23 kOmitLast3 = 3, | 23 kOmitLast3 = 3, |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 240 |
| 241 static const int kNumTransforms = sizeof(kTransforms) / sizeof(kTransforms[0]); | 241 static const int kNumTransforms = sizeof(kTransforms) / sizeof(kTransforms[0]); |
| 242 | 242 |
| 243 static int ToUpperCase(uint8_t* p) { | 243 static int ToUpperCase(uint8_t* p) { |
| 244 if (p[0] < 0xc0) { | 244 if (p[0] < 0xc0) { |
| 245 if (p[0] >= 'a' && p[0] <= 'z') { | 245 if (p[0] >= 'a' && p[0] <= 'z') { |
| 246 p[0] ^= 32; | 246 p[0] ^= 32; |
| 247 } | 247 } |
| 248 return 1; | 248 return 1; |
| 249 } | 249 } |
| 250 /* An overly simplified uppercasing model for utf-8. */ | 250 /* An overly simplified uppercasing model for UTF-8. */ |
| 251 if (p[0] < 0xe0) { | 251 if (p[0] < 0xe0) { |
| 252 p[1] ^= 32; | 252 p[1] ^= 32; |
| 253 return 2; | 253 return 2; |
| 254 } | 254 } |
| 255 /* An arbitrary transform for three byte characters. */ | 255 /* An arbitrary transform for three byte characters. */ |
| 256 p[2] ^= 5; | 256 p[2] ^= 5; |
| 257 return 3; | 257 return 3; |
| 258 } | 258 } |
| 259 | 259 |
| 260 static BROTLI_NOINLINE int TransformDictionaryWord( | 260 static BROTLI_NOINLINE int TransformDictionaryWord( |
| (...skipping 30 matching lines...) Expand all Loading... |
| 291 while (*suffix) { dst[idx++] = (uint8_t)*suffix++; } | 291 while (*suffix) { dst[idx++] = (uint8_t)*suffix++; } |
| 292 return idx; | 292 return idx; |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 | 295 |
| 296 #if defined(__cplusplus) || defined(c_plusplus) | 296 #if defined(__cplusplus) || defined(c_plusplus) |
| 297 } /* extern "C" */ | 297 } /* extern "C" */ |
| 298 #endif | 298 #endif |
| 299 | 299 |
| 300 #endif /* BROTLI_DEC_TRANSFORM_H_ */ | 300 #endif /* BROTLI_DEC_TRANSFORM_H_ */ |
| OLD | NEW |