Commit 06cfbf2a authored by deuce's avatar deuce
Browse files

Remove trailing blanks and add typecasts to declared arg types

(ie: PDWORD)to satisfy MinGW
parent 8a7d6d3d
......@@ -74,7 +74,7 @@
#if defined(__WATCOMC__)
#include <dos.h>
#endif
#include <sys/types.h> /* _dev_t */
#include <sys/stat.h> /* struct stat */
......@@ -97,9 +97,9 @@ char* DLLCALL getfname(const char* path)
bslash=strrchr(path,'\\');
if(bslash>fname)
fname=bslash;
if(fname!=NULL)
if(fname!=NULL)
fname++;
else
else
fname=(char*)path;
return((char*)fname);
}
......@@ -114,7 +114,7 @@ char* DLLCALL getfext(const char* path)
fname=getfname(path);
fext=strrchr(fname,'.');
if(fext==NULL || fext==fname)
if(fext==NULL || fext==fname)
return(NULL);
return(fext);
}
......@@ -264,8 +264,8 @@ int DLLCALL glob(const char *pattern, int flags, void* unused, glob_t* glob)
}
if(_findnext(ff_handle, &ff)!=0) {
_findclose(ff_handle);
ff_handle=-1;
}
ff_handle=-1;
}
}
if(found==0)
......@@ -437,7 +437,7 @@ off_t DLLCALL flength(const char *filename)
return(f.size);
#else
#else
struct stat st;
......@@ -497,7 +497,7 @@ BOOL DLLCALL fexist(const char *filespec)
return(found);
#else /* Unix or OS/2 */
/* portion by cmartin */
glob_t g;
......@@ -523,7 +523,7 @@ BOOL DLLCALL fexist(const char *filespec)
return TRUE;
}
}
globfree(&g);
return FALSE;
......@@ -565,7 +565,7 @@ BOOL DLLCALL fexistcase(char *path)
char *p;
int i;
glob_t glb;
if(path[0]==0) /* work around glibc bug 574274 */
return FALSE;
......@@ -592,7 +592,7 @@ BOOL DLLCALL fexistcase(char *path)
if(glob(globme,GLOB_MARK,NULL,&glb) != 0)
return(FALSE);
if(glb.gl_pathc>0) {
for(i=0;i<glb.gl_pathc;i++) {
if(*lastchar(glb.gl_pathv[i]) != '/')
......@@ -607,7 +607,7 @@ BOOL DLLCALL fexistcase(char *path)
globfree(&glb);
return FALSE;
#endif
}
......@@ -731,7 +731,7 @@ ulong DLLCALL delfiles(const char *inpath, const char *spec)
/****************************************************************************/
#if defined(_WIN32)
typedef BOOL(WINAPI * GetDiskFreeSpaceEx_t)
(LPCTSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER);
(LPCTSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER);
static int bit_num(ulong val)
{
......@@ -761,9 +761,9 @@ static ulong getdiskspace(const char* path, ulong unit, BOOL freespace)
if(hK32 == NULL)
hK32 = LoadLibrary("KERNEL32");
GetDiskFreeSpaceEx
GetDiskFreeSpaceEx
= (GetDiskFreeSpaceEx_t)GetProcAddress(hK32,"GetDiskFreeSpaceExA");
if (GetDiskFreeSpaceEx!=NULL) { /* Windows 95-OSR2 or later */
if(!GetDiskFreeSpaceEx(
path, /* pointer to the directory name */
......@@ -796,10 +796,10 @@ static ulong getdiskspace(const char* path, ulong unit, BOOL freespace)
sprintf(root,"%.3s",path);
if(!GetDiskFreeSpace(
root, /* pointer to root path */
&SectorsPerCluster, /* pointer to sectors per cluster */
&BytesPerSector, /* pointer to bytes per sector */
&NumberOfFreeClusters, /* pointer to number of free clusters */
&TotalNumberOfClusters /* pointer to total number of clusters */
(PDWORD)&SectorsPerCluster, /* pointer to sectors per cluster */
(PDWORD)&BytesPerSector, /* pointer to bytes per sector */
(PDWORD)&NumberOfFreeClusters, /* pointer to number of free clusters */
(PDWORD)&TotalNumberOfClusters /* pointer to total number of clusters */
))
return(0);
......@@ -826,7 +826,7 @@ static ulong getdiskspace(const char* path, ulong unit, BOOL freespace)
if(unit>1)
blocks/=unit;
return fs.f_bsize * blocks;
/* statfs is also used under FreeBSD (Though it *supports* statvfs() now too) */
#elif defined(__GLIBC__) || defined(BSD)
......@@ -844,7 +844,7 @@ static ulong getdiskspace(const char* path, ulong unit, BOOL freespace)
if(unit>1)
blocks/=unit;
return fs.f_bsize * blocks;
#else
fprintf(stderr,"\n*** !Missing getfreediskspace implementation ***\n");
......@@ -901,7 +901,7 @@ char * DLLCALL _fullpath(char *target, const char *path, size_t size) {
}
}
strncat(target,path,size-1);
/* if(stat(target,&sb))
return(NULL);
if(sb.st_mode&S_IFDIR)
......@@ -966,7 +966,7 @@ BOOL DLLCALL isabspath(const char *filename)
/****************************************************************************/
BOOL DLLCALL isfullpath(const char* filename)
{
return(filename[0]=='/'
return(filename[0]=='/'
#ifdef WIN32
|| filename[0]=='\\' || filename[1]==':'
#endif
......
......@@ -477,7 +477,7 @@ char* DLLCALL truncsp(char* str)
if(str!=NULL) {
i=len=strlen(str);
while(i && isspace((unsigned char)str[i-1]))
while(i && isspace((unsigned char)str[i-1]))
i--;
if(i!=len)
str[i]=0; /* truncate */
......@@ -499,8 +499,8 @@ char* DLLCALL truncsp_lines(char* dst)
for(sp=src, dp=dst; *sp!=0; sp++) {
if(*sp=='\n')
while(dp!=dst
&& (*(dp-1)==' ' || *(dp-1)=='\t' || *(dp-1)=='\r') && *(dp-1)!='\n')
while(dp!=dst
&& (*(dp-1)==' ' || *(dp-1)=='\t' || *(dp-1)=='\r') && *(dp-1)!='\n')
dp--;
*(dp++)=*sp;
}
......@@ -519,7 +519,7 @@ char* DLLCALL truncnl(char* str)
if(str!=NULL) {
i=len=strlen(str);
while(i && (str[i-1]=='\r' || str[i-1]=='\n'))
while(i && (str[i-1]=='\r' || str[i-1]=='\n'))
i--;
if(i!=len)
str[i]=0; /* truncate */
......@@ -584,7 +584,7 @@ BOOL DLLCALL check_pid(pid_t pid)
if((h=OpenProcess(PROCESS_QUERY_INFORMATION,/* inheritable: */FALSE, pid)) != NULL) {
DWORD code;
if(GetExitCodeProcess(h,&code)==TRUE && code==STILL_ACTIVE)
if(GetExitCodeProcess(h,(PDWORD)&code)==TRUE && code==STILL_ACTIVE)
result=TRUE;
CloseHandle(h);
}
......
......@@ -65,7 +65,7 @@ void iniSetDefaultStyle(ini_style_t style)
}
/* These correlate with the LOG_* definitions in syslog.h/gen_defs.h */
static char* logLevelStringList[]
static char* logLevelStringList[]
= {"Emergency", "Alert", "Critical", "Error", "Warning", "Notice", "Informational", "Debugging", NULL};
str_list_t iniLogLevelStringList(void)
......@@ -187,7 +187,7 @@ static char* key_name(char* p, char** vp)
char* colon;
*vp=NULL;
if(p==NULL)
return(NULL);
......@@ -214,9 +214,9 @@ static char* key_name(char* p, char** vp)
/* Parse value */
(*vp)++;
SKIP_WHITESPACE(*vp);
if(colon!=NULL)
if(colon!=NULL)
truncnl(*vp); /* "key : value" - truncate new-line chars only */
else
else
truncsp(*vp); /* "key = value" - truncate all white-space chars */
return(p);
......@@ -609,7 +609,7 @@ char* iniSetEnum(str_list_t* list, const char* section, const char* key, str_lis
return iniSetLongInt(list, section, key, value, style);
}
char* iniSetEnumList(str_list_t* list, const char* section, const char* key
char* iniSetEnumList(str_list_t* list, const char* section, const char* key
,const char* sep, str_list_t names, unsigned* val_list, unsigned count, ini_style_t* style)
{
char value[INI_MAX_VALUE_LEN];
......@@ -729,7 +729,7 @@ char* iniGetString(str_list_t list, const char* section, const char* key, const
char* iniPopKey(str_list_t* list, const char* section, const char* key, char* value)
{
size_t i;
if(list==NULL || *list==NULL)
return NULL;
......@@ -1278,7 +1278,7 @@ int iniGetSocketOptions(str_list_t list, const char* section, SOCKET sock
len=sizeof(linger);
}
if((result=setsockopt(sock,level,option,vp,len)) != 0) {
if((result=setsockopt(sock,level,option,(const char *)vp,len)) != 0) {
safe_snprintf(error,errlen,"%d setting socket option (%s, %d) to %d"
,ERROR_VALUE, name, option, value);
return(result);
......@@ -1361,7 +1361,7 @@ char* iniFileName(char* dest, size_t maxlen, const char* indir, const char* infn
safe_snprintf(dest,maxlen,"%s%s.%s%s",dir,fname,PLATFORM_DESC,ext);
if(fexistcase(dest)) /* path/file.platform.ini */
return(dest);
safe_snprintf(dest,maxlen,"%s%s%s",dir,fname,ext);
fexistcase(dest); /* path/file.ini */
return(dest);
......@@ -1421,7 +1421,7 @@ BOOL iniGetBool(str_list_t list, const char* section, const char* key, BOOL defl
static BOOL validDate(struct tm* tm)
{
return(tm->tm_mon && tm->tm_mon<=12
return(tm->tm_mon && tm->tm_mon<=12
&& tm->tm_mday && tm->tm_mday<=31);
}
......@@ -1473,7 +1473,7 @@ static time_t parseDateTime(const char* value)
/* Use current month and year as default */
t=time(NULL);
if(localtime_r(&t,&curr_tm)!=NULL) {
if(localtime_r(&t,&curr_tm)!=NULL) {
tm.tm_mon=curr_tm.tm_mon+1; /* convert to one-based (reversed later) */
tm.tm_year=curr_tm.tm_year;
}
......@@ -1529,7 +1529,7 @@ static time_t parseDateTime(const char* value)
&& (tm.tm_mon=getMonth(month))!=0
&& validDate(&tm))
return(fixedDateTime(&tm,tstr,0));
return(strtoul(value,NULL,0));
}
......@@ -1573,7 +1573,7 @@ static unsigned parseEnum(const char* value, str_list_t names)
if((count=strListCount(names)) == 0)
return 0;
/* Look for exact matches first */
for(i=0; i<count; i++)
if(stricmp(names[i],val)==0)
......@@ -1810,7 +1810,7 @@ static ulong parseBitField(char* value, ini_bitdesc_t* bitdesc)
return(v);
}
ulong iniReadBitField(FILE* fp, const char* section, const char* key,
ulong iniReadBitField(FILE* fp, const char* section, const char* key,
ini_bitdesc_t* bitdesc, ulong deflt)
{
char* value;
......@@ -1822,7 +1822,7 @@ ulong iniReadBitField(FILE* fp, const char* section, const char* key,
return(parseBitField(value,bitdesc));
}
ulong iniGetBitField(str_list_t list, const char* section, const char* key,
ulong iniGetBitField(str_list_t list, const char* section, const char* key,
ini_bitdesc_t* bitdesc, ulong deflt)
{
char* vp=NULL;;
......@@ -1859,7 +1859,7 @@ str_list_t iniReadFile(FILE* fp)
size_t inc_counter=0;
str_list_t list;
FILE* insert_fp=NULL;
if(fp!=NULL)
rewind(fp);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment