Fixes for compiling with -Wall -Werror on unix (tested with gcc-3.3)

svn path=/trunk/; revision=6699
This commit is contained in:
Vizzini 2003-11-19 05:43:15 +00:00
parent 11529b1abe
commit 3a1972736a
11 changed files with 45 additions and 11 deletions

View file

@ -139,13 +139,16 @@ unsigned long CCFDATAStorage::Create(char* FileName)
return CAB_STATUS_CANNOT_CREATE; return CAB_STATUS_CANNOT_CREATE;
} }
#else /* !WIN32 */ #else /* !WIN32 */
if (tmpnam(FullName) == NULL) /*if (tmpnam(FullName) == NULL)*/
if ((FileHandle = tmpfile()) == NULL)
return CAB_STATUS_CANNOT_CREATE; return CAB_STATUS_CANNOT_CREATE;
/*
FileHandle = fopen(FullName, "w+b"); FileHandle = fopen(FullName, "w+b");
if (FileHandle == NULL) { if (FileHandle == NULL) {
DPRINT(MID_TRACE, ("ERROR '%d'.\n", (unsigned int)errno)); DPRINT(MID_TRACE, ("ERROR '%d'.\n", (unsigned int)errno));
return CAB_STATUS_CANNOT_CREATE; return CAB_STATUS_CANNOT_CREATE;
} }
*/
#endif #endif
FileCreated = true; FileCreated = true;
@ -1021,7 +1024,7 @@ unsigned long CCabinet::ExtractFile(char* FileName)
BytesToRead = CFData.CompSize; BytesToRead = CFData.CompSize;
DPRINT(MAX_TRACE, ("Read: (0x%lX,0x%lX).\n", DPRINT(MAX_TRACE, ("Read: (0x%lX,0x%lX).\n",
(DWORD)CurrentBuffer, (DWORD)Buffer)); (unsigned)CurrentBuffer, (unsigned)Buffer));
if (((Status = ReadBlock(CurrentBuffer, BytesToRead, &BytesRead)) != if (((Status = ReadBlock(CurrentBuffer, BytesToRead, &BytesRead)) !=
CAB_STATUS_SUCCESS) || (BytesToRead != BytesRead)) { CAB_STATUS_SUCCESS) || (BytesToRead != BytesRead)) {

View file

@ -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 /* CD-ROM Maker
by Philip J. Erdelsky by Philip J. Erdelsky
pje@acm.org pje@acm.org
@ -29,6 +29,7 @@
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h> #include <dirent.h>
#include <unistd.h>
#endif #endif
#include <ctype.h> #include <ctype.h>
#include <setjmp.h> #include <setjmp.h>
@ -559,9 +560,11 @@ new_directory_record (struct dirent *entry,
PDIR_RECORD parent) PDIR_RECORD parent)
{ {
PDIR_RECORD d; PDIR_RECORD d;
/*
char *s; char *s;
char *t; char *t;
char *n; char *n;
*/
d = malloc(sizeof(DIR_RECORD)); d = malloc(sizeof(DIR_RECORD));
if (d == NULL) if (d == NULL)

View file

@ -10,6 +10,8 @@
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h> #include <dirent.h>
#include <unistd.h>
#include <string.h>
#endif #endif
#ifndef WIN32 #ifndef WIN32
#ifndef MAX_PATH #ifndef MAX_PATH
@ -48,7 +50,9 @@ char* convert_path(char* origpath)
char* newpath; char* newpath;
int i; int i;
newpath = strdup(origpath); //newpath = strdup(origpath);
newpath = malloc(strlen(origpath)+1);
strcpy(newpath, origpath);
i = 0; i = 0;
while (newpath[i] != 0) while (newpath[i] != 0)
@ -173,10 +177,10 @@ copy_directory (char *path1, char *path2)
{ {
DIR *dirp; DIR *dirp;
struct dirent *entry; struct dirent *entry;
char *old_end_source;
struct stat stbuf; struct stat stbuf;
char buf[MAX_PATH]; char buf[MAX_PATH];
char tobuf[MAX_PATH]; char tobuf[MAX_PATH];
char err[400];
dirp = opendir(path1); dirp = opendir(path1);

View file

@ -18,6 +18,7 @@
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h> #include <dirent.h>
#include <unistd.h>
#endif #endif
#include <ctype.h> #include <ctype.h>
#ifndef WIN32 #ifndef WIN32
@ -40,7 +41,10 @@ char* convert_path(char* origpath)
char* newpath; char* newpath;
int i; 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; i = 0;
while (newpath[i] != 0) while (newpath[i] != 0)

View file

@ -18,6 +18,7 @@
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h> #include <dirent.h>
#include <unistd.h>
#endif #endif
#include <ctype.h> #include <ctype.h>
#ifndef WIN32 #ifndef WIN32

View file

@ -2,7 +2,13 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#ifdef _MSC_VER
#include <direct.h> #include <direct.h>
#else
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#endif
#ifdef UNIX_PATHS #ifdef UNIX_PATHS
#define DIR_SEPARATOR_CHAR '/' #define DIR_SEPARATOR_CHAR '/'
@ -19,7 +25,9 @@ char* convert_path(char* origpath)
char* newpath; char* newpath;
int i; int i;
newpath = strdup(origpath); //newpath = strdup(origpath);
newpath=malloc(strlen(origpath)+1);
strcpy(newpath,origpath);
i = 0; i = 0;
while (newpath[i] != 0) while (newpath[i] != 0)

View file

@ -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 * COPYRIGHT: See COPYING in the top level directory
* PROGRAMMER: Rex Jolliff (rex@lvcablemodem.com) * PROGRAMMER: Rex Jolliff (rex@lvcablemodem.com)
* Casper S. Hornstrup (chorns@users.sourceforge.net) * Casper S. Hornstrup (chorns@users.sourceforge.net)
@ -11,6 +11,9 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
void void
convertPath (char * pathToConvert) convertPath (char * pathToConvert)

View file

@ -6,6 +6,7 @@
#include <time.h> #include <time.h>
#else #else
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h>
#endif #endif
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -18,7 +19,9 @@ char* convert_path(char* origpath)
char* newpath; char* newpath;
int i; int i;
newpath = (char *)strdup(origpath); //newpath = (char *)strdup(origpath);
newpath=malloc(strlen(origpath)+1);
strcpy(newpath,origpath);
i = 0; i = 0;
while (newpath[i] != 0) while (newpath[i] != 0)

View file

@ -22,6 +22,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <assert.h> #include <assert.h>
#include <string.h>
#include "config.h" #include "config.h"

View file

@ -130,7 +130,11 @@ char *dup_basename(const char *name, const char *ext)
/* +4 for later extension and +1 for '\0' */ /* +4 for later extension and +1 for '\0' */
base = (char *)xmalloc(namelen +4 +1); base = (char *)xmalloc(namelen +4 +1);
strcpy(base, name); strcpy(base, name);
#ifdef _MSC_VER
if(!stricmp(name + namelen-extlen, ext)) if(!stricmp(name + namelen-extlen, ext))
#else
if(!strcasecmp(name + namelen-extlen, ext))
#endif
{ {
base[namelen - extlen] = '\0'; base[namelen - extlen] = '\0';
} }

View file

@ -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;
case '"': *cptr++ = '\\'; *cptr++ = '"'; b += 2; break; case '"': *cptr++ = '\\'; *cptr++ = '"'; b += 2; break;
default: default:
n = sprintf(cptr, "\\x%04x", *uc & 0xffff); n = sprintf(cptr, "\\x%04x", (unsigned)*uc & 0xffff);
cptr += n; cptr += n;
b += n; b += n;
} }
@ -356,7 +356,7 @@ static char *make_string(WCHAR *uc, int len, int codepage)
} }
else else
{ {
n = sprintf(cptr, "\\x%04x", *uc & 0xffff); n = sprintf(cptr, "\\x%04x", (unsigned)*uc & 0xffff);
cptr += n; cptr += n;
b += n; b += n;
} }