]> www.wagner.pp.ru Git - oss/catdoc.git/commitdiff
Merge branch 'master' of http://wagner.pp.ru/git/oss/catdoc
authorVictor Wagner <vitus@wagner.pp.ru>
Wed, 27 Apr 2016 12:22:20 +0000 (15:22 +0300)
committerVictor Wagner <vitus@wagner.pp.ru>
Wed, 27 Apr 2016 12:22:20 +0000 (15:22 +0300)
Conflicts:
src/fileutil.c

INSTALL.dos
README
src/catdoc.c
src/catdoc.h
src/charsets.c
src/fileutil.c
src/makefile.tc
src/reader.c
src/substmap.c

index cd5519a121e5627a947f83e60dd4062a029c6ce6..a2c78e0f6ac61c58588217da9b1bdb0cf4e44e62 100644 (file)
@@ -41,21 +41,21 @@ downloaded from http://community.borland.com/museum. You can get the
 same one. \r
 \r
 I've made some attempts to compile catdoc with Watcom C (16-bit),\r
-but haven't completely socceeded. If you do, let me know.   \r
+but haven't completely succeeded. If you do, let me know.   \r
 \r
-1. With 16-bit compilier, use COMPACT memory model\r
+1. With 16-bit compiler, use COMPACT memory model\r
    If you are using Turbo C make -fmakefile.tc in src directory\r
    should be enough.  If you have to change anything  in\r
    the makefile.tc, please let me know.\r
    \r
 2. If you are using compilier other than Turbo C /Borland C or\r
    Watcom,  you should take look on fileutil.c file and possible\r
-   add couple of #ifdefs  here. If your succed with it, send me a\r
+   add couple of #ifdefs  here. If your succeed with it, send me a\r
    patch  (or entire modified file, if you don't know how to make\r
    a good unix-like patch). \r
 \r
 \r
-3. With 32-bit compilier you are on your own. I don't think that\r
+3. With 32-bit compiler you are on your own. I don't think that\r
   small utilities like catdoc should require extender or DPMI host,\r
   so I've never tried to build 32-bit version of catdoc for DOS,\r
   But if you mix buffer sizes from UNIX version and file-name\r
@@ -66,11 +66,11 @@ but haven't completely socceeded. If you do, let me know.
    and unistd.h which is provided in compat directory.\r
    Compile getopt.c and add it to cc.lib and put unistd.h in\r
    your include directory. Later it might help you to port other\r
-   unix software. With other compilier you can also make use\r
+   unix software. With other compiler you can also make use\r
    of getopt.c in compat directory (which is from GNU), but I was\r
    unable to make it work with Watcom 10.0\r
 \r
 5. It is probably good idea to link wildargs.obj (or wildargv.obj)\r
-   with catdoc. I didn't do it myself becouse I use korn shell on\r
+   with catdoc. I didn't do it myself because I use korn shell on\r
    machine where I've developed catdoc, so I don't need to include\r
    parameter expansion in program.\r
diff --git a/README b/README
index 08986827795c73d349b25d0ac3ac6137b71d2382..d26bf3895f700feb14e01d10bd4b73f3b971a9d0 100644 (file)
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-CATDOC version 0.93
+CATDOC version 0.95
 
 CATDOC is program which reads MS-Word file and prints readable 
 ASCII text to stdout, just like Unix cat command.
@@ -6,7 +6,6 @@ It also able to produce correct escape sequences if some UNICODE
 charachers have to be represented specially in your typesetting system
 such as (La)TeX.
 
-This is completely new version of catdoc, rewritten from scratch. 
 It features runtime configuration, proper charset handling,
 user-definable output formats and support
 for Word97 files, which contain UNICODE internally.
@@ -21,7 +20,6 @@ such as pictures or equations.
 So, if you are looking for purely authomatic way to convert Word to LaTeX,
 you can better investigate word2x, wvware or LAOLA.
 
-
 Catdoc is distributed under GNU Public License version 2 or above.
 
 
@@ -31,7 +29,6 @@ There is also major work to do - define correct TeX commands
 for accented latin letters into tex.specchars file and commands
 for mathematical symbols (unicode 20xx-25xx). 
 
-
 Contributions are welcome.
 
 See files INSTALL and INSTALL.dos for information about  compiling and
index d8270fd886af186c4ae86cb20ff71b5a3ee20ea4..1ce8978cee1360efb05d69c3b038881ed892e17c 100644 (file)
@@ -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);
index bd8e52b92a0ee2a5866bab14cd78a07fd3cfc7c8..3a4010f03c628ffd3859c5e74989f4612bf70bdf 100644 (file)
@@ -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) ;
 
index 05118767815072f301bee1cd0f202d3249d55079..e64e24c07a267d13b223d46217a79ff51600d900 100644 (file)
@@ -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);
@@ -181,7 +181,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;
@@ -252,7 +252,7 @@ char *to_utf8(unsigned int uc) {
 }    
 
 struct cp_map {
-       int codepage;
+       uint16_t codepage;
        char *charset_name;
 };
 
index 5ae039f5cd603eb9f57b5338266af4c051b227d8..fc8e7f7bae850c9a28b328d1dd1c1f598b9fd616 100644 (file)
@@ -99,22 +99,19 @@ char *find_file(char *name, const char *path)
 /************************************************************************/
 int check_charset(char **filename,const char *charset) {
        char *tmppath;
+       if (charset == NULL ) {
+               return 0;
+       }
        if (!strncmp(charset,"utf-8",6)) {
                *filename=strdup("utf-8");
                return 1;
        }   
        tmppath=find_file(stradd(charset,CHARSET_EXT),charset_path);
-       /* Some compilers evalate both arguments of && before
-          applying, so let's not use && as in the shell */
-       if (tmppath) {
-           if (*tmppath) {
+       if (tmppath && *tmppath) {
                        *filename=strdup(charset);
                        free(tmppath);
                        return 1;
-               } else {
-                       free(tmppath);
-               }
-       }
+       } 
        return 0;
 }
 
index f1d7f3cb3b80b205fc56d8eb319916504dda535b..4555d8f4633bfd1cd377e8bbf9155b8cb13c663e 100644 (file)
@@ -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) $*
index 4db9ffb7ed49c0c39fb1ff89c12f59fec4148968..d28878b85c7857edf821e2b5a71edf10478fb85a 100644 (file)
@@ -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); 
index f29d62915c4f5bde1485031796fa7c5435823df4..ac9b9341f50a0ee1d934bdd2f00ddd1837ab9ae8 100644 (file)
@@ -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);