diff --git a/cole/cole.c b/cole/cole.c index decd6da..72a6ba2 100644 --- a/cole/cole.c +++ b/cole/cole.c @@ -20,12 +20,8 @@ Arturo Tena */ -#if !(defined( __BORLANDC__ ) || defined( __WIN32__ )) #include "config.h" #include "cole.h" -#else -#include "cole.h.in" -#endif #include "internal.h" #include @@ -193,7 +189,7 @@ cole_umount (COLEFS *colefilesystem, COLERRNO *colerrno) if (colerrno != NULL) *colerrno = COLE_ECLOSEFILE; ret = 1; } -#if defined(__WIN32__) || (__BORLANDC__) +#if defined(WIN32) if (remove (colefilesystem->sbfilename) && !ret) { if (colerrno != NULL) *colerrno = COLE_EREMOVE; ret = 1; @@ -247,6 +243,9 @@ __cole_print_tree_indir(COLEDIR *cd, void *info, COLERRNO *colerrno) * Modify colerrno comment in the functions that call it, * ie. cole_print_tree(). */ + (void) cd; /*UNUSED*/ + (void) colerrno; /*UNUSED*/ + (*((long*)info))++; return 0; } @@ -259,6 +258,9 @@ __cole_print_tree_outdir(COLEDIR *cd, void *info, COLERRNO *colerrno) * Modify colerrno comment in the functions that call it, * ie. cole_print_tree(). */ + (void) cd; /*UNUSED*/ + (void) colerrno; /*UNUSED*/ + (*((long*)info))--; return 0; } @@ -273,6 +275,9 @@ __cole_print_tree_inroot(COLEDIR *cd, void *info, COLERRNO *colerrno) */ char *entry_name; + (void) info; /*UNUSED*/ + (void) colerrno; /*UNUSED*/ + printf ("DIR "); printf (" %7zu", cole_dir_getsize (cd)); printf (" %08lx-%08lx %08lx-%08lx", @@ -301,6 +306,8 @@ __cole_print_tree_indirentry(COLEDIRENT *cde, void *info, COLERRNO *colerrno) long level; long i; + (void) colerrno; /*UNUSED*/ + level = *((long*)info); for (i = 0; i < level; i++) { if (i == level - 1) @@ -405,6 +412,8 @@ cole_opendir_direntry (COLEDIRENT *coledirentry, COLERRNO *colerrno) int cole_closedir (COLEDIR *coledir, COLERRNO *colerrno) { + (void) colerrno; /*UNUSED*/ + free (coledir); return 0; @@ -1136,6 +1145,8 @@ cole_locate_filename (COLEFS *colefilesystem, char *filename, static int __cole_locate_filename_visitdir (COLEDIR *cd, void *info) { + (void) cd; /*UNUSED*/ + return ((struct __cole_locate_filenameinfo *)info)->visitdir; } diff --git a/cole/internal.c b/cole/internal.c index f22ba37..42ab50c 100644 --- a/cole/internal.c +++ b/cole/internal.c @@ -23,7 +23,7 @@ #include #include #include -#if !(defined( __WIN32__ ) || defined( __BORLANDC__ )) +#if !defined(WIN32) #include #endif @@ -45,7 +45,7 @@ __cole_extract_file (FILE **file, char **filename, U32 size, U32 pps_start, long FilePos; size_t bytes_to_copy; U8 Block[0x0200]; -#if defined( __WIN32__ ) || defined( __BORLANDC__ ) +#if defined(WIN32) FILE *ret; *filename = (char *)malloc (TMPNAM_LEN); diff --git a/cole/internal.h b/cole/internal.h index 1ef90a4..2efba0f 100644 --- a/cole/internal.h +++ b/cole/internal.h @@ -33,7 +33,7 @@ extern "C" { #include "support.h" #endif -#if defined( __WIN32__ ) || defined( __BORLANDC__ ) +#if defined(WIN32) #define TMPNAM_LEN L_tmpnam #else #define TMPNAM_LEN 18 /* /tmp/xlHtmlXXXXXX + NULL */ diff --git a/cole/olecod.c b/cole/olecod.c index 2dc34d7..8d8c7e9 100644 --- a/cole/olecod.c +++ b/cole/olecod.c @@ -25,11 +25,7 @@ #include #include -#if !(defined( __BORLANDC__ ) || defined( __WIN32__ )) #include "cole.h" -#else -#include "cole.h.in" -#endif #include "support.h" #include "internal.h" @@ -537,6 +533,8 @@ nextff_##var=&##var; nextff (cff); #endif + (void) size; /*UNUSED*/ + verbose ("calling: add_MY_FILE_entry ()"); #ifdef VERBOSE diff --git a/cole/oledecod.c b/cole/oledecod.c index 4d0f314..8652977 100644 --- a/cole/oledecod.c +++ b/cole/oledecod.c @@ -43,12 +43,10 @@ #include #include -#if !(defined( __BORLANDC__ ) || defined( __WIN32__ )) #include "cole.h" #include "config.h" +#if !defined(WIN32) #include /* for unlink() */ -#else -#include "cole.h.in" #endif /* FIXME: replace all VERBOSE with COLE_VERBOSE */ #ifdef COLE_VERBOSE @@ -475,7 +473,7 @@ int __OLEdecode (char *OLEfilename, pps_entry ** stream_list, U32 * root, test_exitf (OLEfile != NULL, 7, ends ()); verboseS (sbfilename); */ -#if defined( __WIN32__ ) || defined( __BORLANDC__ ) +#if defined(WIN32) *_sbfilename = (U8 *)malloc (TMPNAM_LEN); test_exitf (*_sbfilename != NULL, 10, ends ()); tmpnam (*_sbfilename); @@ -508,7 +506,7 @@ int __OLEdecode (char *OLEfilename, pps_entry ** stream_list, U32 * root, /* other entry, save in a file */ { /* this branch is never executed now */ -#if defined( __WIN32__ ) || defined( __BORLANDC__ ) +#if defined(WIN32) tmpnam (pps_list[i].filename); test_exitf (pps_list[i].filename[0], 7, ends ()); verbose(pps_list[i].name + (!isprint(pps_list[i].name[0]) ? 1 : 0)); diff --git a/cole/support.h b/cole/support.h index 2f7b113..b47beb9 100644 --- a/cole/support.h +++ b/cole/support.h @@ -37,9 +37,23 @@ extern "C" { #include #include -#if !(defined( __BORLANDC__ ) || defined( __WIN32__ )) #include "config.h" +#if defined(WIN32) +#define SIZEOF_FLOAT 4 +#define SIZEOF_DOUBLE 8 +#define SIZEOF_UNSIGNED_CHAR 1 +#define SIZEOF_UNSIGNED_SHORT 2 +#define SIZEOF_UNSIGNED_LONG 4 +/* compile time checks for good measure */ +#define COMPILE_TIME_CHECK(tag,expr) \ + typedef char tag##_CHECK[ (expr) ? 1 : -1 ] +COMPILE_TIME_CHECK( FLOAT, sizeof(float) == SIZEOF_FLOAT ); +COMPILE_TIME_CHECK( DOUBLE, sizeof(double) == SIZEOF_DOUBLE ); +COMPILE_TIME_CHECK( CHAR, sizeof(char) == SIZEOF_UNSIGNED_CHAR ); +COMPILE_TIME_CHECK( SHORT, sizeof(short) == SIZEOF_UNSIGNED_SHORT ); +COMPILE_TIME_CHECK( LONG, sizeof(long) == SIZEOF_UNSIGNED_LONG ); +#endif /* F32 */ #if SIZEOF_FLOAT == 4 @@ -114,19 +128,6 @@ extern "C" { #error No 4 byte length type found. #endif -#else - -/* Borland or Wintel constants */ -#define F32 float -#define F64 double -#define U8 unsigned char -#define U16 unsigned short -#define S16 signed short -#define U32 unsigned long -#define S32 signed long - -#endif - U16 fil_sreadU16 (U8 * in); U32 fil_sreadU32 (U8 * in); F64 fil_sreadF64 (U8 * in); diff --git a/cole/version.c.in b/cole/version.c.in index d5246ac..26afb1a 100644 --- a/cole/version.c.in +++ b/cole/version.c.in @@ -1,13 +1,5 @@ -#ifndef __BORLANDC__ int cole_major_version = @COLE_MAJOR@; int cole_minor_version = @COLE_MINOR@; int cole_micro_version = @COLE_MICRO@; char * cole_version = "@COLE_MAJOR@.@COLE_MINOR@.@COLE_MICRO@"; char * cole_host_info = "@HOST_ALIAS_NAME@ (@HOST_CANONICAL_NAME@): @HOST_CPU@, @HOST_VENDOR@, @HOST_OS@"; -#else -int cole_major_version = 2; -int cole_minor_version = 0; -int cole_micro_version = 1; -char * cole_version = "2.0.1"; -char * cole_host_info = "BORLANDC (Windows): i386, GPL, Win32"; -#endif diff --git a/ppthtml/pptdump.c b/ppthtml/pptdump.c index 61783af..d2d4c1c 100644 --- a/ppthtml/pptdump.c +++ b/ppthtml/pptdump.c @@ -17,17 +17,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#if !(defined( __BORLANDC__ ) || defined( __WIN32__ )) #include "config.h" /* Created by ./configure script */ #include "support.h" /* Needs to be before internal.h */ #include "internal.h" /* Needs to be before cole */ #include "cole.h" -#else -#include "config.h.in" /* Created by ./configure script */ -#include "support.h" /* Needs to be before internal.h */ -#include "internal.h" /* Needs to be before cole */ -#include "cole.h.in" -#endif #include #include @@ -108,6 +101,8 @@ void dump_file(COLEDIRENT *cde, void *_info) COLEFILE *cf; COLERRNO err; + (void) _info; /*UNUSED*/ + cf = cole_fopen_direntry(cde, &err); /* Ouput Header */ diff --git a/ppthtml/ppthtml.c b/ppthtml/ppthtml.c index 634d450..611f9af 100644 --- a/ppthtml/ppthtml.c +++ b/ppthtml/ppthtml.c @@ -17,17 +17,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#if !(defined( __BORLANDC__ ) || defined( __WIN32__ )) #include "config.h" /* Created by ./configure script */ #include "support.h" /* Needs to be before internal.h */ #include "internal.h" /* Needs to be before cole */ #include "cole.h" -#else -#include "config.h.in" /* Created by ./configure script */ -#include "support.h" /* Needs to be before internal.h */ -#include "internal.h" /* Needs to be before cole */ -#include "cole.h.in" -#include +#if defined(WIN32) +#include /* _chdrive() */ #endif @@ -38,7 +33,7 @@ #define PRGNAME "pptHtml" -#if !(defined( __WIN32__ ) || defined( __BORLANDC__ )) +#if defined(VERSION) #define PRGVER VERSION #else #define PRGVER "0.4" @@ -82,24 +77,13 @@ int main (int argc, char **argv) else { strncpy(filename, argv[1], 124); -#if defined( __WIN32__ ) || defined( __BORLANDC__ ) +#if 1 && defined(WIN32) + if( 0 != filename[0] && ':' == filename[1] ) { - char *ptr = strchr(filename, ':'); - if (ptr) - { - int len; - char new_drive[MAXPATH]; - fnsplit(filename, new_drive, 0, 0, 0); - if (new_drive[0] >= 'a') - setdisk(new_drive[0] - 'a'); - else - setdisk(new_drive[0] - 'A'); - ptr++; /* Get past the colon */ - len = strlen(ptr); - memmove(filename, ptr, len); - filename[len] = 0; - } - } + _chdrive(tolower((unsigned char)filename[0]) - 'a' + 1); + /* cut the drive from the filename */ + memmove(filename,filename+2,strlen(filename+2)+1); + } #endif cfs = cole_mount (filename, &colerrno); if (cfs == NULL) @@ -139,6 +123,8 @@ void dump_file(COLEDIRENT *cde, void *_info) COLEFILE *cf; COLERRNO err; + (void) _info; /*UNUSED*/ + cf = cole_fopen_direntry(cde, &err); /* Ouput Header */ diff --git a/xlhtml/support.c b/xlhtml/support.c index d9c33b6..45565f5 100644 --- a/xlhtml/support.c +++ b/xlhtml/support.c @@ -28,6 +28,7 @@ #include +int DatesR1904 = 0; /*!< Flag that the dates are based on McIntosh Dates system */ void print_version(void) { @@ -167,8 +168,6 @@ void NumToDate(long num, int *year, int *month, int *day) const int ldays[]={31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; const int ndays[]={31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; - extern int DatesR1904; - int t, i, y = 0; num = num%36525L; /* Trim century */ diff --git a/xlhtml/support.h b/xlhtml/support.h index a02b26a..2bc8695 100644 --- a/xlhtml/support.h +++ b/xlhtml/support.h @@ -14,4 +14,6 @@ extern void FracToTime(U8 *cnum, int *hr, int *minut, int *sec, int *msec); extern S32 getLong(U8 *ptr); extern void RKtoDouble(S32 n, F64 *d); +extern int DatesR1904; + #endif diff --git a/xlhtml/xlcdump.c b/xlhtml/xlcdump.c index c9d0ae9..c23d479 100644 --- a/xlhtml/xlcdump.c +++ b/xlhtml/xlcdump.c @@ -17,14 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#if !(defined( __BORLANDC__ ) || defined( __WIN32__ )) #include "config.h" /* Created by ./configure script */ #include "cole.h" -#else -#include "config.h.in" /* Created by ./configure script */ -#include "cole.h.in" -#include /* for umask */ -#endif #include #include #include /* for strcpy() */ @@ -51,6 +45,8 @@ static void output_opcode_string(int); /* Global data */ static char filename[128]; +int aggressive = 0; /*!< Aggressive html optimization */ + int main (int argc, char **argv) { @@ -102,6 +98,8 @@ void dump_file(COLEDIRENT *cde, void *_info) unsigned char buf[16]; COLEFILE *cf; COLERRNO err; + + (void) _info; /*UNUSED*/ cf = cole_fopen_direntry(cde, &err); diff --git a/xlhtml/xldump.c b/xlhtml/xldump.c index 402c284..e675645 100644 --- a/xlhtml/xldump.c +++ b/xlhtml/xldump.c @@ -17,14 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#if !(defined( __BORLANDC__ ) || defined( __WIN32__ )) #include "config.h" /* Created by ./configure script */ #include "cole.h" -#else -#include "config.h.in" /* Created by ./configure script */ -#include "cole.h.in" -#include /* for umask */ -#endif #include #include #include /* for strcpy() */ @@ -52,6 +46,8 @@ static void output_opcode_string(int); /* Global data */ static char filename[128]; +int aggressive = 0; /*!< Aggressive html optimization */ + int main (int argc, char **argv) { @@ -104,6 +100,8 @@ void dump_file(COLEDIRENT *cde, void *_info) COLEFILE *cf; COLERRNO err; + (void) _info; /*UNUSED*/ + cf = cole_fopen_direntry(cde, &err); /* Ouput Header */ diff --git a/xlhtml/xlhtml.c b/xlhtml/xlhtml.c index 4f7c8c9..ba9b136 100644 --- a/xlhtml/xlhtml.c +++ b/xlhtml/xlhtml.c @@ -110,8 +110,6 @@ char colorTab[MAX_COLORS][8] = "FFFFFF" /* 0x40 */ }; -int DatesR1904 = 0; /*!< Flag that the dates are based on McIntosh Dates system */ - /* FIXME: Support major languages here...not just English */ const char month_abbr[12][5] = { "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec" }; @@ -395,25 +393,15 @@ int main (int argc, char **argv) uni_string_clear(&default_font); umask(GLOBAL_UMASK); -#if defined( __WIN32__ ) || defined( __BORLANDC__ ) +#if 1 && defined(WIN32) + if( 0 != filename[0] && ':' == filename[1] ) { - char *ptr = strchr(filename, ':'); - if (ptr) - { - int len; - char new_drive[MAXPATH]; - fnsplit(filename, new_drive, 0, 0, 0); - if (new_drive[0] >= 'a') - setdisk(new_drive[0] - 'a'); - else - setdisk(new_drive[0] - 'A'); - ptr++; /* Get past the colon */ - len = strlen(ptr); - memmove(filename, ptr, len); - filename[len] = 0; - } + _chdrive(tolower((unsigned char)filename[0]) - 'a' + 1); + /* cut the drive from the filename */ + memmove(filename,filename+2,strlen(filename+2)+1); } #endif + /* If successful, this calls scan_file to extract the work book... */ cfs = cole_mount(filename, &colerrno); if (cfs == NULL) @@ -533,6 +521,8 @@ void scan_file(COLEDIRENT *cde, void *_info) COLEFILE *cf; COLERRNO err; + (void) _info; /*UNUSED*/ + cf = cole_fopen_direntry(cde, &err); if (cf == 0) { /* error abort processing */ diff --git a/xlhtml/xlhtml.h b/xlhtml/xlhtml.h index 0ffec97..e31da0a 100644 --- a/xlhtml/xlhtml.h +++ b/xlhtml/xlhtml.h @@ -26,18 +26,13 @@ -#if !(defined( __BORLANDC__ ) || defined( __WIN32__ )) #include "config.h" /* Created by ./configure script */ #include "support.h" /* Needs to be before internal.h */ #include "internal.h" /* Needs to be before cole */ #include "cole.h" -#else -#include "config.h.in" /* Created by ./configure script */ -#include "support.h" /* Needs to be before internal.h */ -#include "internal.h" /* Needs to be before cole */ -#include "cole.h.in" +#if defined(WIN32) #include /* for umask */ -#include +#include /* _chdrive() */ #endif #include /* For atof(), calloc() */ #include /* For string functions */ @@ -60,11 +55,11 @@ #define MAX_COLORS 65 /*!< This is the size of the built-in color table */ #define EXCEL95 0x500 /*!< This is the file stamp for biff7 - Excel 5 & 95 */ #define EXCEL97 0x600 /*!< This is the file stamp for biff8 - Excel 97 & 2000 */ -#if !(defined( __WIN32__ ) || defined( __BORLANDC__ )) #include -#define GLOBAL_UMASK (S_IXUSR|S_IWGRP|S_IRGRP|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH) +#if !defined(S_IWGRP) && !defined(S_IWOTH) && defined(S_IEXEC) +#define GLOBAL_UMASK S_IEXEC #else -#define GLOBAL_UMASK (2) +#define GLOBAL_UMASK (S_IXUSR|S_IWGRP|S_IRGRP|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH) #endif /*! \brief This encapsulates the Unicode String */