ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/encoding.C
(Generate patch)

Comparing rxvt-unicode/src/encoding.C (file contents):
Revision 1.26 by ayin, Wed Oct 31 09:55:23 2007 UTC vs.
Revision 1.31 by root, Mon Feb 21 07:41:00 2011 UTC

1/*----------------------------------------------------------------------* 1/*----------------------------------------------------------------------*
2 * File: encoding.C 2 * File: encoding.C
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * 4 *
5 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com> 6 * Copyright (c) 2003-2006 Marc Lehmann <schmorp@schmorp.de>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
21 *----------------------------------------------------------------------*/ 21 *----------------------------------------------------------------------*/
22 22
23#include "../config.h" 23#include "../config.h"
24 24
25#include "encoding.h" 25#include "encoding.h"
26#include "rxvtutil.h"
26 27
27#include <cstdlib> 28#include <cstdlib>
28#include <cstring> 29#include <cstring>
29 30
30const struct n2cs { 31static const struct n2cs {
31 const char *name; 32 const char *name;
32 codeset cs; 33 codeset cs;
33} n2cs[] = { 34} n2cs[] = {
34 /* first one found is the normalized one */ 35 /* first one found is the normalized one */
35 { "ISO88591", CS_ISO8859_1 }, 36 { "ISO88591", CS_ISO8859_1 },
57 { "UTF8", CS_UNICODE }, 58 { "UTF8", CS_UNICODE },
58 59
59 { "ASCII", CS_US_ASCII }, 60 { "ASCII", CS_US_ASCII },
60 { "USASCII", CS_US_ASCII }, 61 { "USASCII", CS_US_ASCII },
61 { "ANSIX341968", CS_US_ASCII }, 62 { "ANSIX341968", CS_US_ASCII },
62 { "ISO646.1991-IRV", CS_US_ASCII }, // older versions used the currency sign 63 { "ISO6461991IRV", CS_US_ASCII }, // older versions used the currency sign
63 64
64 { "KOI8R*", CS_KOI8_R }, 65 { "KOI8R*", CS_KOI8_R },
65 { "GOST1976874*", CS_KOI8_R }, 66 { "GOST1976874*", CS_KOI8_R },
66 { "KOI8RU", CS_KOI8_U }, 67 { "KOI8RU", CS_KOI8_U },
67 { "KOI8U", CS_KOI8_U }, 68 { "KOI8U", CS_KOI8_U },
285 286
286unicode_t 287unicode_t
287rxvt_compose (unicode_t c1, unicode_t c2) 288rxvt_compose (unicode_t c1, unicode_t c2)
288{ 289{
289 int l = 0; 290 int l = 0;
290 int r = sizeof (rxvt_compose_table) / sizeof (rxvt_compose_entry) - 1; 291 int r = ARRAY_LENGTH(rxvt_compose_table) - 1;
291 int m; 292 int m;
292 293
293 while (r > l) 294 while (r >= l)
294 { 295 {
295 m = (l + r) / 2; 296 m = (l + r) / 2;
296 rxvt_compose_entry &c = rxvt_compose_table[m]; 297 rxvt_compose_entry &c = rxvt_compose_table[m];
297 298
298 if (c.c1 < c1 || (c.c1 == c1 && c.c2 < c2)) 299 if (c.c1 < c1 || (c.c1 == c1 && c.c2 < c2))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines