From: Victor Wagner Date: Tue, 26 Apr 2016 17:59:31 +0000 (+0300) Subject: Fix some warnings from Turbo C 2.0 X-Git-Tag: REL_0_95~7 X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=666a23f1c6f51c09f4aa4ad7e863bf901025a82f;p=oss%2Fcatdoc.git Fix some warnings from Turbo C 2.0 --- diff --git a/src/catdoc.c b/src/catdoc.c index d8270fd..1ce8978 100644 --- a/src/catdoc.c +++ b/src/catdoc.c @@ -88,7 +88,7 @@ int main(int argc, char **argv) { 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); diff --git a/src/catdoc.h b/src/catdoc.h index bd8e52b..3a4010f 100644 --- a/src/catdoc.h +++ b/src/catdoc.h @@ -205,10 +205,10 @@ extern int get_8bit_char (FILE *f,long *offset,long fileend); 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) ; diff --git a/src/charsets.c b/src/charsets.c index 49875e3..eda5cb4 100644 --- a/src/charsets.c +++ b/src/charsets.c @@ -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]; } /************************************************************************/ @@ -69,11 +69,11 @@ 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) { +/************************************************************************/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; }; diff --git a/src/makefile.tc b/src/makefile.tc index f1d7f3c..4555d8f 100644 --- a/src/makefile.tc +++ b/src/makefile.tc @@ -1,7 +1,7 @@ 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) $* diff --git a/src/reader.c b/src/reader.c index 4db9ffb..d28878b 100644 --- a/src/reader.c +++ b/src/reader.c @@ -31,9 +31,9 @@ void copy_out (FILE *f,char *header) { */ 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; @@ -57,16 +57,16 @@ void copy_out (FILE *f,char *header) { } 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); diff --git a/src/substmap.c b/src/substmap.c index f29d629..ac9b934 100644 --- a/src/substmap.c +++ b/src/substmap.c @@ -39,7 +39,7 @@ SUBSTMAP read_substmap(char* filename) { 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);