OLD | NEW |
1 #include <iconv.h> | 1 #include <iconv.h> |
2 #include <errno.h> | 2 #include <errno.h> |
3 #include <wchar.h> | 3 #include <wchar.h> |
4 #include <string.h> | 4 #include <string.h> |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 #include <limits.h> | 6 #include <limits.h> |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include "locale_impl.h" | 8 #include "locale_impl.h" |
9 | 9 |
10 #define UTF_32BE 0300 | 10 #define UTF_32BE 0300 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 break; | 332 break; |
333 case EUC_KR: | 333 case EUC_KR: |
334 l = 2; | 334 l = 2; |
335 if (*inb < 2) goto starved; | 335 if (*inb < 2) goto starved; |
336 d = *((unsigned char *)*in + 1); | 336 d = *((unsigned char *)*in + 1); |
337 c -= 0xa1; | 337 c -= 0xa1; |
338 d -= 0xa1; | 338 d -= 0xa1; |
339 if (c >= 93 || d >= 94) { | 339 if (c >= 93 || d >= 94) { |
340 c += (0xa1-0x81); | 340 c += (0xa1-0x81); |
341 d += 0xa1; | 341 d += 0xa1; |
342 » » » » if (c >= 93 || c>=0xc6-0x81 && d>0x52) | 342 » » » » if (c >= 93 || (c>=0xc6-0x81 && d>0x52)) |
343 goto ilseq; | 343 goto ilseq; |
344 if (d-'A'<26) d = d-'A'; | 344 if (d-'A'<26) d = d-'A'; |
345 else if (d-'a'<26) d = d-'a'+26; | 345 else if (d-'a'<26) d = d-'a'+26; |
346 else if (d-0x81<0xff-0x81) d = d-0x81+52; | 346 else if (d-0x81<0xff-0x81) d = d-0x81+52; |
347 else goto ilseq; | 347 else goto ilseq; |
348 if (c < 0x20) c = 178*c + d; | 348 if (c < 0x20) c = 178*c + d; |
349 else c = 178*0x20 + 84*(c-0x20) + d; | 349 else c = 178*0x20 + 84*(c-0x20) + d; |
350 c += 0xac00; | 350 c += 0xac00; |
351 for (d=0xac00; d<=c; ) { | 351 for (d=0xac00; d<=c; ) { |
352 k = 0; | 352 k = 0; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 x = -1; | 446 x = -1; |
447 goto end; | 447 goto end; |
448 starved: | 448 starved: |
449 err = EINVAL; | 449 err = EINVAL; |
450 x = -1; | 450 x = -1; |
451 end: | 451 end: |
452 errno = err; | 452 errno = err; |
453 *ploc = loc; | 453 *ploc = loc; |
454 return x; | 454 return x; |
455 } | 455 } |
OLD | NEW |