From 3a1972736a3917caa2083a56e18c20b908dc9ed7 Mon Sep 17 00:00:00 2001 From: Vizzini Date: Wed, 19 Nov 2003 05:43:15 +0000 Subject: [PATCH] Fixes for compiling with -Wall -Werror on unix (tested with gcc-3.3) svn path=/trunk/; revision=6699 --- reactos/tools/cabman/cabinet.cxx | 7 +++++-- reactos/tools/cdmake/cdmake.c | 5 ++++- reactos/tools/rcopy.c | 8 ++++++-- reactos/tools/regtests.c | 6 +++++- reactos/tools/rgenstat/rgenstat.c | 1 + reactos/tools/rmkdir.c | 10 +++++++++- reactos/tools/rrmdir.c | 5 ++++- reactos/tools/rtouch.c | 5 ++++- reactos/tools/wmc/mcl.c | 1 + reactos/tools/wmc/utils.c | 4 ++++ reactos/tools/wmc/write.c | 4 ++-- 11 files changed, 45 insertions(+), 11 deletions(-) diff --git a/reactos/tools/cabman/cabinet.cxx b/reactos/tools/cabman/cabinet.cxx index ca96dc71944..01bc899d8ed 100755 --- a/reactos/tools/cabman/cabinet.cxx +++ b/reactos/tools/cabman/cabinet.cxx @@ -139,13 +139,16 @@ unsigned long CCFDATAStorage::Create(char* FileName) return CAB_STATUS_CANNOT_CREATE; } #else /* !WIN32 */ - if (tmpnam(FullName) == NULL) + /*if (tmpnam(FullName) == NULL)*/ + if ((FileHandle = tmpfile()) == NULL) return CAB_STATUS_CANNOT_CREATE; + /* FileHandle = fopen(FullName, "w+b"); if (FileHandle == NULL) { DPRINT(MID_TRACE, ("ERROR '%d'.\n", (unsigned int)errno)); return CAB_STATUS_CANNOT_CREATE; } + */ #endif FileCreated = true; @@ -1021,7 +1024,7 @@ unsigned long CCabinet::ExtractFile(char* FileName) BytesToRead = CFData.CompSize; DPRINT(MAX_TRACE, ("Read: (0x%lX,0x%lX).\n", - (DWORD)CurrentBuffer, (DWORD)Buffer)); + (unsigned)CurrentBuffer, (unsigned)Buffer)); if (((Status = ReadBlock(CurrentBuffer, BytesToRead, &BytesRead)) != CAB_STATUS_SUCCESS) || (BytesToRead != BytesRead)) { diff --git a/reactos/tools/cdmake/cdmake.c b/reactos/tools/cdmake/cdmake.c index b63494deccd..6016c964aef 100644 --- a/reactos/tools/cdmake/cdmake.c +++ b/reactos/tools/cdmake/cdmake.c @@ -1,4 +1,4 @@ -/* $Id: cdmake.c,v 1.8 2003/11/18 17:40:46 ekohl Exp $ */ +/* $Id: cdmake.c,v 1.9 2003/11/19 05:43:14 vizzini Exp $ */ /* CD-ROM Maker by Philip J. Erdelsky pje@acm.org @@ -29,6 +29,7 @@ #include #include #include +#include #endif #include #include @@ -559,9 +560,11 @@ new_directory_record (struct dirent *entry, PDIR_RECORD parent) { PDIR_RECORD d; + /* char *s; char *t; char *n; + */ d = malloc(sizeof(DIR_RECORD)); if (d == NULL) diff --git a/reactos/tools/rcopy.c b/reactos/tools/rcopy.c index 3270a26a1ca..e1d504aab80 100644 --- a/reactos/tools/rcopy.c +++ b/reactos/tools/rcopy.c @@ -10,6 +10,8 @@ #include #include #include +#include +#include #endif #ifndef WIN32 #ifndef MAX_PATH @@ -48,7 +50,9 @@ char* convert_path(char* origpath) char* newpath; int i; - newpath = strdup(origpath); + //newpath = strdup(origpath); + newpath = malloc(strlen(origpath)+1); + strcpy(newpath, origpath); i = 0; while (newpath[i] != 0) @@ -173,10 +177,10 @@ copy_directory (char *path1, char *path2) { DIR *dirp; struct dirent *entry; - char *old_end_source; struct stat stbuf; char buf[MAX_PATH]; char tobuf[MAX_PATH]; + char err[400]; dirp = opendir(path1); diff --git a/reactos/tools/regtests.c b/reactos/tools/regtests.c index d7aa38cb83b..e4477c99e6b 100755 --- a/reactos/tools/regtests.c +++ b/reactos/tools/regtests.c @@ -18,6 +18,7 @@ #include #include #include +#include #endif #include #ifndef WIN32 @@ -40,7 +41,10 @@ char* convert_path(char* origpath) char* newpath; int i; - newpath = strdup(origpath); + /* for no good reason, i'm having trouble getting gcc to link strdup */ + //newpath = strdup(origpath); + newpath = malloc(strlen(origpath)+1); + strcpy(newpath, origpath); i = 0; while (newpath[i] != 0) diff --git a/reactos/tools/rgenstat/rgenstat.c b/reactos/tools/rgenstat/rgenstat.c index 802a3ed4415..12f6893221c 100755 --- a/reactos/tools/rgenstat/rgenstat.c +++ b/reactos/tools/rgenstat/rgenstat.c @@ -18,6 +18,7 @@ #include #include #include +#include #endif #include #ifndef WIN32 diff --git a/reactos/tools/rmkdir.c b/reactos/tools/rmkdir.c index fe9be2f81f4..4a597f39aaf 100644 --- a/reactos/tools/rmkdir.c +++ b/reactos/tools/rmkdir.c @@ -2,7 +2,13 @@ #include #include #include +#ifdef _MSC_VER #include +#else +#include +#include +#include +#endif #ifdef UNIX_PATHS #define DIR_SEPARATOR_CHAR '/' @@ -19,7 +25,9 @@ char* convert_path(char* origpath) char* newpath; int i; - newpath = strdup(origpath); + //newpath = strdup(origpath); + newpath=malloc(strlen(origpath)+1); + strcpy(newpath,origpath); i = 0; while (newpath[i] != 0) diff --git a/reactos/tools/rrmdir.c b/reactos/tools/rrmdir.c index eddf64417a4..5172c0ea1af 100644 --- a/reactos/tools/rrmdir.c +++ b/reactos/tools/rrmdir.c @@ -1,4 +1,4 @@ -/* $Id: rrmdir.c,v 1.2 2003/11/10 19:29:24 mf Exp $ +/* $Id: rrmdir.c,v 1.3 2003/11/19 05:43:14 vizzini Exp $ * COPYRIGHT: See COPYING in the top level directory * PROGRAMMER: Rex Jolliff (rex@lvcablemodem.com) * Casper S. Hornstrup (chorns@users.sourceforge.net) @@ -11,6 +11,9 @@ #include #include #include +#ifndef _MSC_VER +#include +#endif void convertPath (char * pathToConvert) diff --git a/reactos/tools/rtouch.c b/reactos/tools/rtouch.c index 8c13e73ff87..45a2c3dfc34 100755 --- a/reactos/tools/rtouch.c +++ b/reactos/tools/rtouch.c @@ -6,6 +6,7 @@ #include #else #include +#include #endif #include #include @@ -18,7 +19,9 @@ char* convert_path(char* origpath) char* newpath; int i; - newpath = (char *)strdup(origpath); + //newpath = (char *)strdup(origpath); + newpath=malloc(strlen(origpath)+1); + strcpy(newpath,origpath); i = 0; while (newpath[i] != 0) diff --git a/reactos/tools/wmc/mcl.c b/reactos/tools/wmc/mcl.c index 41dd4abdf2f..23883053d75 100644 --- a/reactos/tools/wmc/mcl.c +++ b/reactos/tools/wmc/mcl.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "config.h" diff --git a/reactos/tools/wmc/utils.c b/reactos/tools/wmc/utils.c index 125aa64e983..b812f42acb6 100644 --- a/reactos/tools/wmc/utils.c +++ b/reactos/tools/wmc/utils.c @@ -130,7 +130,11 @@ char *dup_basename(const char *name, const char *ext) /* +4 for later extension and +1 for '\0' */ base = (char *)xmalloc(namelen +4 +1); strcpy(base, name); +#ifdef _MSC_VER if(!stricmp(name + namelen-extlen, ext)) +#else + if(!strcasecmp(name + namelen-extlen, ext)) +#endif { base[namelen - extlen] = '\0'; } diff --git a/reactos/tools/wmc/write.c b/reactos/tools/wmc/write.c index 57371a5c9ee..a919cd904bd 100644 --- a/reactos/tools/wmc/write.c +++ b/reactos/tools/wmc/write.c @@ -348,7 +348,7 @@ static char *make_string(WCHAR *uc, int len, int codepage) case '\\': *cptr++ = '\\'; *cptr++ = '\\'; b += 2; break; case '"': *cptr++ = '\\'; *cptr++ = '"'; b += 2; break; default: - n = sprintf(cptr, "\\x%04x", *uc & 0xffff); + n = sprintf(cptr, "\\x%04x", (unsigned)*uc & 0xffff); cptr += n; b += n; } @@ -356,7 +356,7 @@ static char *make_string(WCHAR *uc, int len, int codepage) } else { - n = sprintf(cptr, "\\x%04x", *uc & 0xffff); + n = sprintf(cptr, "\\x%04x", (unsigned)*uc & 0xffff); cptr += n; b += n; }