Patch from aaronl to make linux port compile with -Wall

This commit is contained in:
theoddone33
2001-04-28 06:53:35 +00:00
parent fca60c6b67
commit e9fba43a85
11 changed files with 106 additions and 119 deletions

View File

@@ -5,3 +5,4 @@ Steven "relnev" Fuller
Andrew "prometheus" Henderson
Dan "theoddone33" Olson
Shawn "EvilTypeGuy" Walker
Aaron Lehmann

View File

@@ -125,7 +125,7 @@ double tanval;
double c4x,c4y,c4z;
double c4x2,c4y2,c4z2;
C4TransfWireFrame()
void C4TransfWireFrame()
{
c4x=(double)C4WFXVal;
c4y=(double)C4WFYVal;
@@ -151,7 +151,7 @@ C4TransfWireFrame()
C4WFYVal=(short)(c4y*C4WFScale/(0x90*(c4z+0x95))*0x95);
}
C4TransfWireFrame2()
void C4TransfWireFrame2()
{
c4x=(double)C4WFXVal;
c4y=(double)C4WFYVal;
@@ -177,7 +177,7 @@ C4TransfWireFrame2()
C4WFYVal=(short)(c4y*C4WFScale/0x100);
}
C4CalcWireFrame()
void C4CalcWireFrame()
{
C4WFXVal=C4WFX2Val-C4WFXVal;
C4WFYVal=C4WFY2Val-C4WFYVal;
@@ -203,7 +203,7 @@ short C41FAngleRes;
short C41FDist;
short C41FDistVal;
C4Op1F()
void C4Op1F()
{
if (C41FXVal == 0) {
if (C41FYVal>0) C41FAngleRes=0x80;
@@ -218,14 +218,14 @@ C4Op1F()
}
}
C4Op15()
void C4Op15()
{
tanval=sqrt(((double)C41FYVal)*((double)C41FYVal)+((double)C41FXVal)*
((double)C41FXVal));
C41FDist=(short)tanval;
}
C4Op0D()
void C4Op0D()
{
tanval=sqrt(((double)C41FYVal)*((double)C41FYVal)+((double)C41FXVal)*
((double)C41FXVal));
@@ -252,7 +252,7 @@ short Op00Multiplicand;
short Op00Multiplier;
short Op00Result;
DSPOp00()
void DSPOp00()
{
Op00Result=Op00Multiplicand*Op00Multiplier/32768;
#ifdef DebugDSP1
@@ -266,7 +266,7 @@ signed short Op10CoefficientR;
signed short Op10ExponentR;
float Op10Temp;
DSPOp10()
void DSPOp10()
{
Op10ExponentR=-Op10Exponent;
Op10Temp = Op10Coefficient / 32768.0;
@@ -296,7 +296,7 @@ unsigned short Op04Radius;
short Op04Sin;
short Op04Cos;
DSPOp04()
void DSPOp04()
{
Op04Sin=SinTable2[(Op04Angle/256)&255]*Op04Radius/65536;
Op04Cos=CosTable2[(Op04Angle/256)&255]*Op04Radius/65536;
@@ -323,7 +323,7 @@ short Op0CY1;
short Op0CX2;
short Op0CY2;
DSPOp0C()
void DSPOp0C()
{
Op0CX2=(Op0CX1*CosTable2[(Op0CA/256)&255]+Op0CY1*SinTable2[(Op0CA/256)&255])/65536;
Op0CY2=(Op0CX1*-SinTable2[(Op0CA/256)&255]+Op0CY1*CosTable2[(Op0CA/256)&255])/65536;
@@ -582,7 +582,7 @@ double ObjPZ2;
double DivideOp06;
int Temp;
DSPOp06()
void DSPOp06()
{
/* ObjPX=(Op06X-CenterX);
@@ -710,7 +710,7 @@ short Op21Xr;
short Op21Yr;
double sc,sc2,sc3;
DSPOp01()
void DSPOp01()
{
double zr,yr,xr;
@@ -745,7 +745,7 @@ DSPOp01()
#endif
}
DSPOp11()
void DSPOp11()
{
double zr,yr,xr;
@@ -779,7 +779,7 @@ DSPOp11()
#endif
}
DSPOp21()
void DSPOp21()
{
double zr,yr,xr;
@@ -973,7 +973,7 @@ void DSPOp13()
#endif
}
DSPOp23()
void DSPOp23()
{
double F,L,U;
F=Op23F; L=Op23L; U=Op23U;
@@ -996,7 +996,7 @@ short Op14Xrr;
short Op14Yrr;
double Op14Temp;
DSPOp14()
void DSPOp14()
{
Op14Temp=(Op14Zr*6.2832/65536.0)+(1/cos(Op14Xr*6.2832/65536.0))*((Op14U*6.2832/65536.0)*cos(Op14Yr*6.2832/65536.0)-(Op14F*6.2832/65536.0)*sin(Op14Yr*6.2832/65536.0));
Op14Zrr=(short)(Op14Temp*65536.0/6.2832);
@@ -1015,7 +1015,7 @@ short Op0EV;
short Op0EX;
short Op0EY;
DSPOp0E()
void DSPOp0E()
{
// screen Directions UP
@@ -1100,7 +1100,7 @@ short Op28Y;
short Op28Z;
short Op28R;
DSPOp28()
void DSPOp28()
{
Op28R=(short)sqrt(Op28X*Op28X+Op28Y*Op28Y+Op28Z*Op28Z);
#ifdef DebugDSP1

View File

@@ -59,7 +59,7 @@ EXTSYM keyboardhit
EXTSYM GUIkeydelay2
;EXTSYM _kbhit
;EXTSYM _getch
EXTSYM _chdrive
;EXTSYM _chdrive
EXTSYM ZFileMKDir,ZFileCHDir,ZFileRMDir,CHPath,MKPath,RMPath
EXTSYM ZFileGetDir,DriveNumber,DirName
EXTSYM _getdrive
@@ -799,11 +799,11 @@ KeyConvTableS
NEWSYM Change_Drive
; change to drive in dl (0 = A, 1 = B, etc.)
and edx,0FFh
add edx,1
push edx
call _chdrive
pop edx
;and edx,0FFh
;add edx,1
;push edx
;call _chdrive
;pop edx
; mov ah,0Eh
; int 21h
ret

View File

@@ -411,7 +411,6 @@ int ReInitSound(void)
BOOL InitJoystickInput(void)
{
int i;
SDL_Event *event;
// STUB_FUNCTION;
@@ -498,10 +497,10 @@ int startgame(void)
surface = SDL_SetVideoMode(WindowWidth, WindowHeight, BitDepth, flags);
if (surface == NULL) {
if (BitDepth)
fprintf (stderr, "Could not set %dx%dx%d video mode.\n",
fprintf (stderr, "Could not set %ld%ld%ld video mode.\n",
WindowWidth,WindowHeight,BitDepth);
else
fprintf (stderr, "Could not set %dx%d video mode.\n",WindowWidth,
fprintf (stderr, "Could not set %ldx%ld video mode.\n",WindowWidth,
WindowHeight);
return FALSE;
}
@@ -1027,7 +1026,6 @@ extern unsigned char newengen;
void clearwin()
{
DWORD i,j,color32;
DWORD *SURFDW;
Temp1=LockSurface();
@@ -1475,21 +1473,6 @@ void LinuxExit (void)
}
extern char fulladdtab[65536*2];
extern WORD vesa2_usbit;
extern WORD vesa2_clbit;
extern WORD vesa2_rpos;
extern WORD vesa2_rfull;
extern WORD vesa2_rtrcl;
extern WORD vesa2_rtrcla;
extern WORD vesa2_gpos;
extern WORD vesa2_gfull;
extern WORD vesa2_gtrcl;
extern WORD vesa2_gtrcla;
extern WORD vesa2_bpos;
extern WORD vesa2_bfull;
extern WORD vesa2_btrcl;
extern WORD vesa2_btrcla;
extern WORD nojoystickpoll;
extern void SwitchFullScreen(void);
@@ -1532,8 +1515,6 @@ void WinUpdateDevices()
// keys[1]=keys[16];
keys[0]=0;
// if (nojoystickpoll) return;
for(i=0;i<4;i++)
{
if(JoystickInput[i])

View File

@@ -17,6 +17,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <zlib.h>
@@ -171,7 +173,6 @@ DWORD ZCloseFile()
DWORD ZFileSeek()
{
int res = 0;
int mode = 0;
if (ZFileSeekMode==0)
mode = SEEK_SET;
@@ -319,7 +320,7 @@ DWORD ZFileFindNext()
stat ( globbuf.gl_pathv[globcur], &filetype );
if(ZFileFindATTRIB&0x10 && !S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
if((ZFileFindATTRIB&0x10==0) && S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
if(((ZFileFindATTRIB&0x10)==0) && S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
if ( S_ISDIR ( filetype.st_mode ))
*(char *)(DTALocPos + 0x15) = 0x10;
@@ -362,7 +363,7 @@ DWORD ZFileFindFirst()
stat ( globbuf.gl_pathv[globcur], &filetype );
if(ZFileFindATTRIB&0x10 && !S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
if((ZFileFindATTRIB&0x10==0) && S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
if(((ZFileFindATTRIB&0x10)==0) && S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
if ( S_ISDIR ( filetype.st_mode ))
*(char *)(DTALocPos + 0x15) = 0x10;
@@ -441,14 +442,6 @@ DWORD GetDate()
}
#ifdef __LINUX__
int _chdrive( int drive )
{
// STUB_FUNCTION;
}
int _getdrive( void )
{
// STUB_FUNCTION;
}
extern char SRAMDir;
extern char InitDir;

View File

@@ -22,6 +22,8 @@ Initial Linux Command Line Parsing by EvilTypeGuy (drevil@warpcore.org) April 20
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#define STUB_FUNCTION fprintf(stderr,"STUB: %s at " __FILE__ ", line %d, thread %d\n",__FUNCTION__,__LINE__,getpid())
#define DWORD unsigned long
@@ -76,8 +78,23 @@ char ucase(char ch){
return(ch);
}
int my_atoi(char *nptr) {
int p,c;
c = 0;
for(p = 0; nptr[p]; p++) {
if ( !isdigit(nptr[p]) ) c += 1;
}
if (c) return -1;
return atoi(nptr);
}
extern void UnProtectMemory (void);
int main (int argc, char *argv[]) {
int opt,hasroom,p,pp,arg;
int opt,hasroom,p,pp;
char *fvar;
@@ -342,22 +359,12 @@ int main (int argc, char *argv[]) {
}
zstart();
return 0;
}
int my_atoi(char *nptr) {
int p,c;
c = 0;
for(p = 0; nptr[p]; p++) {
if ( !isdigit(nptr[p]) ) c += 1;
}
if (c) return -1;
else
return atoi(nptr);
int pccmdline(void) {
return 0;
}
@@ -389,7 +396,3 @@ void ccmdline(void) {
printf("cmdline returned %i\n",p);
DosExit();
}
int pccmdline(void) {
return 0;
}

View File

@@ -81,6 +81,7 @@
// In-game chat will be moved to a separate packet in TCP/IP
#include <stdio.h>
#include <string.h>
#include <time.h>
#ifdef __LINUX__
#include <sys/time.h>
@@ -234,7 +235,6 @@ void DeInitTCP()
void GetUDPStatus() {
int retval;
char NoSend = 0;
UDPEnable=UDPConfig;
@@ -268,7 +268,6 @@ void GetUDPStatus() {
int isipval(char *name){
int i;
int tcperr;
i=0;
while(name[i]!=0){
if (!((name[i]=='.') || ((name[i]>='0') && (name[i]<='9'))))
@@ -283,7 +282,6 @@ int ConnectServer(char *servername, unsigned int port)
char blah[255];
int retval,i;
LPHOSTENT host1;
unsigned long addr1;
int yesip;
#ifndef __LINUX__
WSADATA wsadata;
@@ -451,7 +449,7 @@ int WaitForServer(){
int i;
if (UDPEnable){
if (i=GetData(1,blah)){
if ((i=GetData(1,blah))){
if ((i==1) && (blah[0]==1))
return(1);
}
@@ -492,7 +490,7 @@ void Disconnect()
int StartServerCycle(unsigned short port)
{
int retval,sizet,i;
int retval,i;
portval = port;
packetnum = 0;
@@ -621,10 +619,6 @@ int StartServerCycle(unsigned short port)
int acceptzuser()
{
int retval,r,i;
LPHOSTENT host1;
int yesip;
if (UDPEnable)
{
return(0);
@@ -724,6 +718,32 @@ void StopServer()
}
int GetLeftUDP()
{
#ifdef __LINUX__
fd_set zrf;
#else
FD_SET zrf;
#endif
struct timeval nto;
int r;
nto.tv_sec=0;
nto.tv_usec=0; /* return immediately */
FD_ZERO(&zrf);
FD_SET(userversocket,&zrf);
r=select(userversocket+1,&zrf,0,0,&nto);
if (r == SOCKET_ERROR)
{
closesocket(userversocket);
return(-1);
}
return(r);
}
/**********************************************************\
* Send data *
* - parameters : *
@@ -887,7 +907,6 @@ extern void UpdateVFrame(void);
int SendData(int dsize,unsigned char *dptr)
{
int retval;
char message1[256];
if (UDPEnable){
/* retval = sendto(ugamesocket,dptr,dsize,0,(struct sockaddr *)&ugameaddress,sizeof(ugameaddress));
@@ -1105,32 +1124,6 @@ int GetLeft()
return(tempsize);
}
int GetLeftUDP()
{
#ifdef __LINUX__
fd_set zrf;
#else
FD_SET zrf;
#endif
struct timeval nto;
int r;
int tempsize;
nto.tv_sec=0;
nto.tv_usec=0; /* return immediately */
FD_ZERO(&zrf);
FD_SET(userversocket,&zrf);
r=select(userversocket+1,&zrf,0,0,&nto);
if (r == SOCKET_ERROR)
{
closesocket(userversocket);
return(-1);
}
return(r);
}
/**********************************************************\
* Receive data *

View File

@@ -57,8 +57,10 @@ ZIPOBJ=${ZIPDIR}/zzip.o ${ZIPDIR}/unzip.o
MAINOBJ=cfgload.o endmem.o fixsin.o init.o ui.o vcache.o water.o
OBJS=${CHIPSOBJ} ${CPUOBJ} ${WINOBJ} ${WINDOSOBJ} ${GUIOBJ} ${VIDEOBJ} ${ZIPOBJ} ${MAINOBJ}
LIBS=`sdl-config --libs` -lz
CFLAGS=-g -D__LINUX__ `sdl-config --cflags`
SDLLIBS := $(shell sdl-config --libs)
SDLCFLAGS := $(shell sdl-config --cflags)
LIBS=${SDLLIBS} -lz
CFLAGS=-g -Wall -D__LINUX__ ${SDLCFLAGS}
ASM=nasm
ASMFLAGS=-f elf -D__LINUX__ -g -w-orphan-labels
CC=gcc

View File

@@ -69,7 +69,7 @@ MAINOBJ=cfgload.obj endmem.obj fixsin.obj init.obj ui.obj vcache.obj water.obj
OBJS=${CHIPSOBJ} ${CPUOBJ} ${WINOBJ} ${GUIOBJ} ${VIDEOBJ} ${ZIPOBJ} ${MAINOBJ} ${WINDOSOBJ}
LIBS=
CFLAGS=/c /D__WIN32__
CFLAGS=/c /Wall /D__WIN32__
ASM=nasm
ASMFLAGS=-f win32 -D__WIN32__
CC=cl

View File

@@ -536,10 +536,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
/* we check the magic */
if (err==UNZ_OK)
{
if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
err=UNZ_ERRNO;
else if (uMagic!=0x02014b50)
err=UNZ_BADZIPFILE;
}
if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK)
err=UNZ_ERRNO;
@@ -616,10 +618,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
uSizeRead = extraFieldBufferSize;
if (lSeek!=0)
{
if (fseek(s->file,lSeek,SEEK_CUR)==0)
lSeek=0;
else
err=UNZ_ERRNO;
}
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
if (fread(extraField,(uInt)uSizeRead,1,s->file)!=1)
err=UNZ_ERRNO;
@@ -641,10 +645,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
uSizeRead = commentBufferSize;
if (lSeek!=0)
{
if (fseek(s->file,lSeek,SEEK_CUR)==0)
lSeek=0;
else
err=UNZ_ERRNO;
}
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
if (fread(szComment,(uInt)uSizeRead,1,s->file)!=1)
err=UNZ_ERRNO;
@@ -825,10 +831,12 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
if (err==UNZ_OK)
{
if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
err=UNZ_ERRNO;
else if (uMagic!=0x04034b50)
err=UNZ_BADZIPFILE;
}
if (unzlocal_getShort(s->file,&uData) != UNZ_OK)
err=UNZ_ERRNO;
@@ -1267,7 +1275,6 @@ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
char *szComment;
uLong uSizeBuf;
{
int err=UNZ_OK;
unz_s* s;
uLong uReadThis ;
if (file==NULL)

View File

@@ -20,6 +20,11 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#ifdef __LINUX__
#include <utime.h>
#include <sys/stat.h>
#include <sys/types.h>
#endif
#include <errno.h>
#include <fcntl.h>
@@ -37,10 +42,12 @@ unsigned int ZipError=0;
// 5 : Error opening file
// 6 : Error Writing file
#ifndef __LINUX__
struct utimbuf {
time_t actime;
time_t modtime;
};
#endif
void change_file_date(const char *filename,uLong dosdate,tm_unz tmu_date)
{
@@ -64,9 +71,11 @@ void change_file_date(const char *filename,uLong dosdate,tm_unz tmu_date)
int mymkdir(const char *dirname)
{
int ret=0;
ret = mkdir (dirname);
return ret;
#ifdef __LINUX__
return(mkdir(dirname, (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)));
#else
return(mkdir(dirname));
#endif
}
int makedir (char *newdir)
@@ -129,7 +138,6 @@ int do_extract_currentfile(unzFile uf,
uInt size_buf;
unz_file_info file_info;
uLong ratio=0;
err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
if (err!=UNZ_OK)
@@ -263,7 +271,6 @@ int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite)
uLong i;
unz_global_info gi;
int err;
FILE* fout=NULL;
err = unzGetGlobalInfo (uf,&gi);
if (err!=UNZ_OK)