--- rxvt-unicode/src/encoding.C 2006/02/20 22:42:00 1.25 +++ rxvt-unicode/src/encoding.C 2014/05/22 18:54:32 1.34 @@ -3,11 +3,11 @@ *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. - * Copyright (c) 2003-2006 Marc Lehmann + * Copyright (c) 2003-2006 Marc Lehmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -23,11 +23,12 @@ #include "../config.h" #include "encoding.h" +#include "rxvtutil.h" -#include -#include +#include +#include -const struct n2cs { +static const struct n2cs { const char *name; codeset cs; } n2cs[] = { @@ -49,25 +50,25 @@ { "ISO885915", CS_ISO8859_15 }, { "FCD885915", CS_ISO8859_15 }, { "ISO885916", CS_ISO8859_16 }, - + { "TIS620*", CS_ISO8859_11 }, // close enough { "ISO10646*", CS_UNICODE }, { "UNICODE", CS_UNICODE }, { "UTF8", CS_UNICODE }, - + { "ASCII", CS_US_ASCII }, { "USASCII", CS_US_ASCII }, { "ANSIX341968", CS_US_ASCII }, - { "ISO646.1991-IRV", CS_US_ASCII }, // older versions used the currency sign - + { "ISO6461991IRV", CS_US_ASCII }, // older versions used the currency sign + { "KOI8R*", CS_KOI8_R }, { "GOST1976874*", CS_KOI8_R }, { "KOI8RU", CS_KOI8_U }, { "KOI8U", CS_KOI8_U }, { "VISCII*", CS_VISCII }, - + { "JISX0201*", CS_JIS0201_1976_0 }, { "JISC6226*", CS_JIS0208_1990_0 }, // also wrongly matches -1987-0? (check Encode::JP) { "JISX0208*", CS_JIS0208_1990_0 }, // also wrongly matches -1987-0? (check Encode::JP) @@ -75,11 +76,11 @@ { "JISX021320001", CS_JIS0213_1 }, { "JISX021320002", CS_JIS0213_2 }, { "JISX0221*", CS_UNICODE }, // _very_ close - + { "KSC5601*", CS_KSC5601_1987_0 }, { "KSX1001*", CS_KSC5601_1987_0 }, { "KSC5700*", CS_UNICODE }, // unicode plus extensions - + { "BIG5P*", CS_BIG5_PLUS }, { "BIG5ETEN*", CS_BIG5_EXT }, { "BIG5*", CS_BIG5 }, @@ -220,7 +221,7 @@ #else # define ENC(base) { cs_ ## base ## _from_unicode } #endif - + // order must match table in encoding.h(!) const rxvt_codeset_conv rxvt_codeset[NUM_CODESETS] = { @@ -287,10 +288,10 @@ rxvt_compose (unicode_t c1, unicode_t c2) { int l = 0; - int r = sizeof (rxvt_compose_table) / sizeof (rxvt_compose_entry) - 1; + int r = ecb_array_length (rxvt_compose_table) - 1; int m; - while (r > l) + while (r >= l) { m = (l + r) / 2; rxvt_compose_entry &c = rxvt_compose_table[m];