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;
}
#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)) {

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
by Philip J. Erdelsky
pje@acm.org
@ -29,6 +29,7 @@
#include <errno.h>
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#endif
#include <ctype.h>
#include <setjmp.h>
@ -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)

View file

@ -10,6 +10,8 @@
#include <errno.h>
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#include <string.h>
#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);

View file

@ -18,6 +18,7 @@
#include <errno.h>
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#endif
#include <ctype.h>
#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)

View file

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

View file

@ -2,7 +2,13 @@
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#ifdef _MSC_VER
#include <direct.h>
#else
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#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)

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

View file

@ -6,6 +6,7 @@
#include <time.h>
#else
#include <sys/time.h>
#include <unistd.h>
#endif
#include <stdlib.h>
#include <string.h>
@ -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)

View file

@ -22,6 +22,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#include <string.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' */
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';
}

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;
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;
}