900-iconv_size_hack.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. --- a/src/locale/iconv.c
  2. +++ b/src/locale/iconv.c
  3. @@ -48,6 +48,7 @@ static const unsigned char charmaps[] =
  4. "utf16\0\0\312"
  5. "ucs4\0utf32\0\0\313"
  6. "ucs2\0\0\314"
  7. +#ifdef FULL_ICONV
  8. "eucjp\0\0\320"
  9. "shiftjis\0sjis\0\0\321"
  10. "iso2022jp\0\0\322"
  11. @@ -56,6 +57,7 @@ static const unsigned char charmaps[] =
  12. "gb2312\0\0\332"
  13. "big5\0bigfive\0cp950\0big5hkscs\0\0\340"
  14. "euckr\0ksc5601\0ksx1001\0cp949\0\0\350"
  15. +#endif
  16. #include "codepages.h"
  17. ;
  18. @@ -66,6 +68,7 @@ static const unsigned short legacy_chars
  19. #include "legacychars.h"
  20. };
  21. +#ifdef FULL_ICONV
  22. static const unsigned short jis0208[84][94] = {
  23. #include "jis0208.h"
  24. };
  25. @@ -85,6 +88,7 @@ static const unsigned short hkscs[] = {
  26. static const unsigned short ksc[93][94] = {
  27. #include "ksc.h"
  28. };
  29. +#endif
  30. static const unsigned short rev_jis[] = {
  31. #include "revjis.h"
  32. @@ -205,6 +209,7 @@ static unsigned legacy_map(const unsigne
  33. return x < 256 ? x : legacy_chars[x-256];
  34. }
  35. +#ifdef FULL_ICONV
  36. static unsigned uni_to_jis(unsigned c)
  37. {
  38. unsigned nel = sizeof rev_jis / sizeof *rev_jis;
  39. @@ -223,6 +228,7 @@ static unsigned uni_to_jis(unsigned c)
  40. }
  41. }
  42. }
  43. +#endif
  44. size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restrict out, size_t *restrict outb)
  45. {
  46. @@ -319,6 +325,7 @@ size_t iconv(iconv_t cd, char **restrict
  47. }
  48. type = scd->state;
  49. continue;
  50. +#ifdef FULL_ICONV
  51. case SHIFT_JIS:
  52. if (c < 128) break;
  53. if (c-0xa1 <= 0xdf-0xa1) {
  54. @@ -518,6 +525,7 @@ size_t iconv(iconv_t cd, char **restrict
  55. c = ksc[c][d];
  56. if (!c) goto ilseq;
  57. break;
  58. +#endif
  59. default:
  60. if (!c) break;
  61. c = legacy_map(map, c);
  62. @@ -559,6 +567,7 @@ size_t iconv(iconv_t cd, char **restrict
  63. }
  64. }
  65. goto subst;
  66. +#ifdef FULL_ICONV
  67. case SHIFT_JIS:
  68. if (c < 128) goto revout;
  69. if (c == 0xa5) {
  70. @@ -632,6 +641,7 @@ size_t iconv(iconv_t cd, char **restrict
  71. *(*out)++ = 'B';
  72. *outb -= 8;
  73. break;
  74. +#endif
  75. case UCS2:
  76. totype = UCS2BE;
  77. case UCS2BE:
  78. --- a/src/locale/codepages.h
  79. +++ b/src/locale/codepages.h
  80. @@ -129,6 +129,7 @@
  81. "\340\204\43\316\100\344\34\144\316\71\350\244\243\316\72\354\264\343\316\73"
  82. "\21\361\44\317\74\364\30\145\17\124\146\345\243\317\76\374\134\304\327\77"
  83. +#ifdef FULL_ICONV
  84. "cp1250\0"
  85. "windows1250\0"
  86. "\0\40"
  87. @@ -239,6 +240,7 @@
  88. "\20\105\163\330\64\324\324\145\315\65\330\144\243\315\66\334\334\145\330\67"
  89. "\340\204\43\316\100\344\224\143\316\71\350\244\243\316\72\205\265\343\316\73"
  90. "\21\305\203\330\74\364\330\145\317\75\370\344\243\317\76\374\340\65\362\77"
  91. +#endif
  92. "koi8r\0"
  93. "\0\40"