X-Git-Url: http://www.wagner.pp.ru/gitweb/?p=oss%2Fcatdoc.git;a=blobdiff_plain;f=src%2Fcharsets.c;h=5c58c7623c5ebd88eaa6b687a7371b9607284b86;hp=a81ceebe1a1bb6f8f7e1d38a1379a8c85e7fac77;hb=4c1c2b85914997dfaab4718b2723bdb5ba2ef779;hpb=7de410970cd2916482178d730b64aef013b0567a diff --git a/src/charsets.c b/src/charsets.c index a81ceeb..5c58c76 100644 --- a/src/charsets.c +++ b/src/charsets.c @@ -14,7 +14,7 @@ char *charset_path=CHARSETPATH; char *source_csname=SOURCE_CHARSET, *dest_csname=TARGET_CHARSET; -short int * source_charset; +uint16_t * source_charset; int unknown_as_hex=0; char bad_char[]=UNKNOWN_CHAR; CHARSET target_charset; @@ -22,7 +22,7 @@ CHARSET target_charset; /* Converts char in input charset into unicode representation */ /* Should be converted to macro */ /************************************************************************/ -int to_unicode (short int *charset, int c) { +int to_unicode (uint16_t *charset, int c) { return charset[c]; } /************************************************************************/ @@ -70,10 +70,10 @@ CHARSET make_reverse_map(short int *charset) { /* Reads charset file (as got from ftp.unicode.org) and returns array of*/ /* 256 short ints (malloced) mapping from charset t unicode */ /************************************************************************/ -short int * read_charset(const char *filename) { +uint16_t * read_charset(const char *filename) { char *path; FILE *f; - short int *new; + uint16_t *new; int c; long int uc; path= find_file(stradd(filename,CHARSET_EXT),charset_path); @@ -180,7 +180,7 @@ int get_utf8 (FILE *f,long *offset,long fileend) { return 0xfeff; /*skip corrupted sequebces*/ if (c <0xE0) { if (catdoc_read(buf+1, 1, 1, f)<=0) return EOF; - return ((c & 0x1F)<<6 | ((char)buf[1] & 0x3F)); + return (((c & 0x1F)<<6) | ((char)buf[1] & 0x3F)); } if (c <0xF0) { if (catdoc_read(buf+1, 1, 2, f)<=2) return (int)EOF; @@ -251,7 +251,7 @@ char *to_utf8(unsigned int uc) { } struct cp_map { - int codepage; + uint16_t codepage; char *charset_name; };