break;
case 'm': {
char *endptr;
- wrap_margin = strtol(optarg,&endptr,0);
+ wrap_margin = (int)strtol(optarg,&endptr,0);
if (*endptr) {
fprintf(stderr,"Invalid wrap margin value `%s'\n",optarg);
exit(1);
extern int get_word8_char (FILE *f,long *offset,long fileend);
extern const char *charset_from_codepage(unsigned int codepage);
-extern short int *read_charset(const char *filename);
+extern uint16_t *read_charset(const char *filename);
extern CHARSET make_reverse_map (short int *charset);
-extern int to_unicode (short int *charset, int c) ;
+extern int to_unicode (uint16_t *charset, int c) ;
extern int from_unicode (CHARSET charset, int u) ;
/* 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];
}
/************************************************************************/
/************************************************************************/
/* 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) {
+/************************************************************************/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);
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;
}
struct cp_map {
- int codepage;
+ uint16_t codepage;
char *charset_name;
};
CC=tcc
TCDIR=c:\tc
LIB=$(TCDIR)\lib
-CFLAGS=-v -w -mc -DHAVE_LANGINFO -DHAVE_STRDUP -DCATDOC_VERSION="0.94.3"
+CFLAGS=-v -w -mc -DHAVE_LANGINFO -DHAVE_STRDUP -DCATDOC_VERSION="0.95"
OBJ=charsets.obj substmap.obj reader.obj writer.obj fileutil.obj langinfo.obj analyze.obj confutil.obj rtfread.obj numutils.obj sheet.obj xlsparse.obj ole.obj strftime.obj pptparse.obj
.c.obj:
$(CC) -v -c -mc -I../compat $(CFLAGS) $*
*/
if ((unsigned char)header[0]==0xFE && (unsigned char)header[1]==0xFF) {
get_unicode_char = get_utf16msb;
- fputs(convert_char(header[2]<<8|header[3]),stdout);
- fputs(convert_char(header[4]<<8|header[5]),stdout);
- fputs(convert_char(header[6]<<8|header[7]),stdout);
+ fputs(convert_char((header[2]<<8)|header[3]),stdout);
+ fputs(convert_char((header[4]<<8)|header[5]),stdout);
+ fputs(convert_char((header[6]<<8)|header[7]),stdout);
} else if ((unsigned char)header[0]!=0xFF ||
(unsigned char)header[1]!=0xFE) {
int c,j,d;
} else {
d=fgetc(f);
}
- c=c<<6 | (d & 0x3F);
+ c=(c<<6) | (d & 0x3F);
}
}
fputs (convert_char(c),stdout);
}
} else {
get_unicode_char = get_utf16lsb;
- fputs(convert_char(header[3]<<8|header[2]),stdout);
- fputs(convert_char(header[5]<<8|header[4]),stdout);
- fputs(convert_char(header[7]<<8|header[6]),stdout);
+ fputs(convert_char((header[3]<<8)|header[2]),stdout);
+ fputs(convert_char((header[5]<<8)|header[4]),stdout);
+ fputs(convert_char((header[7]<<8)|header[6]),stdout);
}
while (!catdoc_eof(f)) {
i=get_unicode_char(f,&offset,0x7FFFFFFF);
char s[256];
char stopchar;
int escaped, lineno=0, i;
- unsigned int uc;
+ int32_t uc;
path=find_file(filename,add_exe_path(map_path));
if (!path) {
free(map);