More OSX build fixery and printf/scanf cleanup for 64-bit systems

git-svn-id: https://svn.eduke32.com/eduke32@1791 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-02-12 13:25:24 +00:00
parent cf9e3fd3f6
commit 2428b11152
11 changed files with 48 additions and 44 deletions

View file

@ -113,15 +113,17 @@ endif
ifeq ($(PLATFORM),DARWIN)
ifeq (1,$(SDL_FRAMEWORK))
OURCFLAGS += -fno-pic -IApple/include -I/Library/Frameworks/SDL.framework/Headers \
-I-I/Library/Frameworks/SDL_mixer.framework/Headers
APPLE_INCLUDE_DIR=$(abspath Apple/include)
OURCFLAGS += -fno-pic -I$(APPLE_INCLUDE_DIR) -I/Library/Frameworks/SDL.framework/Headers \
-I/Library/Frameworks/SDL_mixer.framework/Headers
LIBS += -read_only_relocs suppress -LApple/lib -lvorbisfile -lvorbis -logg -lm \
-Wl,-framework,SDL -Wl,-framework,SDL_mixer Apple/lib/libSDLmain.a \
-Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \
-Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \
-Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL \
-Wl,-framework,QuickTime -lm
# I like to have the SDLMain.m from the OSX SDL package to be in this dir:
LIBS += $(realpath SDLMain.m)
else
OURCFLAGS += -fno-pic -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL
LIBS += -read_only_relocs suppress -lvorbisfile -lvorbis -logg -lm -lSDL_mixer \
@ -196,7 +198,7 @@ notice:
eduke32$(EXESUFFIX): $(GAMEOBJS) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(ENETDIR)/$(ENETLIB)
$(LINK_STATUS)
if $(CC) -o $@ $^ $(LIBS) $(STDCPPLIB) $(MISCLINKOPTS); then $(LINK_OK); else $(LINK_FAILED); fi
if $(CC) $(CFLAGS) $(OURCFLAGS) -o $@ $^ $(LIBS) $(STDCPPLIB) $(MISCLINKOPTS); then $(LINK_OK); else $(LINK_FAILED); fi
ifeq (1,$(RELEASE))
ifeq (0,$(DEBUGANYWAY))
$(STRIP) eduke32$(EXESUFFIX)
@ -282,7 +284,7 @@ $(OBJ)/%.$o: $(RSRC)/%.c
$(OBJ)/game_banner.$o: $(RSRC)/game_banner.c
$(COMPILE_STATUS)
if $(CC) $(CFLAGS) $(OURCFLAGS) -Wno-pointer-sign -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
$(OBJ)/editor_banner.$o: $(RSRC)/editor_banner.c
$(COMPILE_STATUS)
if $(CC) $(CFLAGS) $(OURCFLAGS) -Wno-pointer-sign -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi

View file

@ -3,14 +3,13 @@
## source/jaudiolib/Makefile
# Use colored output
PRETTY_OUTPUT = 1
PRETTY_OUTPUT ?= 1
# DirectX SDK location - if nonempty, overrides the DXROOTs of the individual
# Makefiles. Should be set to an absolute path since this Makefile is included
# at different directory levels
DXROOT_OVERRIDE:=
# Engine options
# SUPERBUILD - enables voxels
# POLYMOST - enables Polymost renderer
@ -88,9 +87,12 @@ ifneq (0,$(DEBUGANYWAY))
debug+=-ggdb
endif
W_NO_UNUSED_RESULT := $(shell echo '' | $(CC) -E -Wno-unused-result - 2>/dev/null && echo -Wno-unused-result)
W_NO_UNUSED_RESULT := $(findstring -Wno-unused-result,$(WNO_UNUSED_RESULT))
BASECFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -D_FORTIFY_SOURCE=2 \
$(F_JUMP_TABLES) -Wno-unused-result
$(F_JUMP_TABLES) $(W_NO_UNUSED_RESULT)
BASECXXFLAGS= -fno-exceptions -fno-rtti
BASEASFLAGS=-s #-g

View file

@ -6561,7 +6561,7 @@ int32_t loadnames(void)
}
else if (comment)continue;
badline:
initprintf("Error: Invalid statement found at character %d on line %d\n", (p-buffer), line-1);
initprintf("Error: Invalid statement found at character %d on line %d\n", (int32_t)(p-buffer), line-1);
}
initprintf("Read %d lines, loaded %d names.\n", line, syms);

View file

@ -10151,9 +10151,9 @@ int32_t CheckMapCorruption(int32_t printfromlev, int32_t tryfixing)
if (ns == i)
{
CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR is its own sector", j);
if (!bad)
{
CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR is its own sector", j);
if (tryfixing)
do_nextsector_correction(nw, j);
else if (4>=printfromlev)

View file

@ -1110,7 +1110,7 @@ static int32_t C_SetScriptSize(int32_t size)
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)) && !((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize])))
{
g_numCompilerErrors++;
initprintf("Internal compiler error at %d (0x%x)\n",i,i);
initprintf("Internal compiler error at %"PRIdPTR" (0x%"PRIxPTR")\n",i,i);
}
// if (bitptr[i] == 0 && ((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize])))
// initprintf("oh no!\n");
@ -1145,7 +1145,7 @@ static int32_t C_SetScriptSize(int32_t size)
//initprintf("offset: %d\n",(unsigned)(g_scriptPtr-script));
g_scriptSize = size;
initprintf("Resizing code buffer to %d*%d bytes\n",g_scriptSize, sizeof(intptr_t));
initprintf("Resizing code buffer to %d*%d bytes\n",g_scriptSize, (int32_t)sizeof(intptr_t));
newscript = (intptr_t *)Brealloc(script, g_scriptSize * sizeof(intptr_t));
@ -3108,7 +3108,7 @@ static int32_t C_ParseCommand(void)
i = *(g_scriptPtr-1);
*(g_scriptPtr-1) ^= 48;
C_ReportError(-1);
initprintf("%s:%d: warning: tried to set cstat %d, using %d instead.\n",g_szScriptFileName,g_lineNumber,i,*(g_scriptPtr-1));
initprintf("%s:%d: warning: tried to set cstat %d, using %d instead.\n",g_szScriptFileName,g_lineNumber,i,(int32_t)(*(g_scriptPtr-1)));
g_numCompilerWarnings++;
}
}
@ -5214,7 +5214,7 @@ repeatcase:
if (i >= (signed)sizeof(EpisodeNames[j])-1)
{
initprintf("%s:%d: warning: truncating volume name to %d characters.\n",
g_szScriptFileName,g_lineNumber,sizeof(EpisodeNames[j])-1);
g_szScriptFileName,g_lineNumber,(int32_t)sizeof(EpisodeNames[j])-1);
g_numCompilerWarnings++;
C_NextLine();
break;
@ -5301,7 +5301,7 @@ repeatcase:
if (i >= (signed)sizeof(SkillNames[j])-1)
{
initprintf("%s:%d: warning: truncating skill name to %d characters.\n",
g_szScriptFileName,g_lineNumber,sizeof(SkillNames[j])-1);
g_szScriptFileName,g_lineNumber,(int32_t)sizeof(SkillNames[j])-1);
g_numCompilerWarnings++;
C_NextLine();
break;
@ -5326,7 +5326,7 @@ repeatcase:
if (i >= (signed)sizeof(gamename)-1)
{
initprintf("%s:%d: warning: truncating game name to %d characters.\n",
g_szScriptFileName,g_lineNumber,sizeof(gamename)-1);
g_szScriptFileName,g_lineNumber,(int32_t)sizeof(gamename)-1);
g_numCompilerWarnings++;
C_NextLine();
break;
@ -5457,7 +5457,7 @@ repeatcase:
if (i >= (signed)sizeof(GametypeNames[j])-1)
{
initprintf("%s:%d: warning: truncating gametype name to %d characters.\n",
g_szScriptFileName,g_lineNumber,sizeof(GametypeNames[j])-1);
g_szScriptFileName,g_lineNumber,(int32_t)sizeof(GametypeNames[j])-1);
g_numCompilerWarnings++;
C_NextLine();
break;
@ -6327,11 +6327,11 @@ void C_Compile(const char *filenam)
C_SetScriptSize(g_scriptPtr-script+8);
initprintf("Script compiled in %dms, %ld*%db, version %s\n", getticks() - startcompiletime,
(unsigned long)(g_scriptPtr-script), sizeof(intptr_t), (g_scriptVersion == 14?"1.4+":"1.3D"));
(unsigned long)(g_scriptPtr-script), (int32_t)sizeof(intptr_t), (g_scriptVersion == 14?"1.4+":"1.3D"));
initprintf("%d/%d labels, %d/%d variables\n", g_numLabels,
min((MAXSECTORS * sizeof(sectortype)/sizeof(int32_t)),
MAXSPRITES * sizeof(spritetype)/(1<<6)),
(int32_t)min((MAXSECTORS * sizeof(sectortype)/sizeof(int32_t)),
MAXSPRITES * sizeof(spritetype)/(1<<6)),
g_gameVarCount, MAXGAMEVARS);
for (i=MAXQUOTES-1; i>=0; i--)

View file

@ -67,9 +67,9 @@ void VM_ScriptInfo(void)
for (p=insptr-20; p<insptr+20; p++)
{
if (*p>>12&&(*p&0xFFF)<CON_END)
initprintf("\n%5d: %5d %s ",p-script,*p>>12,keyw[*p&0xFFF]);
initprintf("\n%5d: %5d %s ",(int32_t)(p-script),(int32_t)(*p>>12),keyw[*p&0xFFF]);
else
initprintf(" %d",*p);
initprintf(" %d",(int32_t)*p);
}
initprintf("\n");
@ -1012,7 +1012,7 @@ skip_check:
insptr++;
if ((*insptr<0 || *insptr>=MAXSOUNDS))
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],*insptr++);
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr++);
continue;
}
if (!S_CheckSoundPlaying(vm.g_i,*insptr++))
@ -1039,7 +1039,7 @@ skip_check:
insptr++;
if ((*insptr<0 || *insptr>=MAXSOUNDS))
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],*insptr);
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr);
insptr++;
continue;
}
@ -1051,7 +1051,7 @@ skip_check:
insptr++;
if ((*insptr<0 || *insptr>=MAXSOUNDS))
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],*insptr);
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr);
insptr++;
continue;
}
@ -1081,7 +1081,7 @@ skip_check:
insptr++;
if ((*insptr<0 || *insptr>=MAXSOUNDS))
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],*insptr);
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr);
insptr++;
continue;
}
@ -1094,7 +1094,7 @@ skip_check:
insptr++;
if ((*insptr<0 || *insptr>=MAXSOUNDS))
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],*insptr);
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr);
insptr++;
continue;
}
@ -1208,7 +1208,7 @@ skip_check:
insptr++;
if ((*insptr<0 || *insptr>=MAX_WEAPONS))
{
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],*insptr);
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr);
insptr += 2; break;
}
if (g_player[vm.g_p].ps->ammo_amount[*insptr] >= g_player[vm.g_p].ps->max_ammo_amount[*insptr])
@ -1266,7 +1266,7 @@ skip_check:
insptr++;
if ((*insptr<0 ||*insptr>=MAX_WEAPONS))
{
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],*insptr);
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr);
insptr += 2;
continue;
}
@ -1291,7 +1291,7 @@ skip_check:
case CON_DEBUG:
insptr++;
initprintf("%d\n",*insptr++);
initprintf("%"PRIdPTR"\n",*insptr++);
continue;
case CON_ENDOFGAME:
@ -3019,7 +3019,7 @@ nullquote:
g_player[vm.g_p].ps->inv_amount[GET_BOOTS] = *insptr;
break;
default:
OSD_Printf(CON_ERROR "Invalid inventory ID %d\n",g_errorLineNum,keyw[g_tw],*(insptr-1));
OSD_Printf(CON_ERROR "Invalid inventory ID %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*(insptr-1));
break;
}
insptr++;
@ -4575,7 +4575,7 @@ nullquote:
if (g_player[vm.g_p].ps->inv_amount[GET_BOOTS] != *insptr) j = 1;
break;
default:
OSD_Printf(CON_ERROR "invalid inventory ID: %d\n",g_errorLineNum,keyw[g_tw],*(insptr-1));
OSD_Printf(CON_ERROR "invalid inventory ID: %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*(insptr-1));
}
VM_DoConditional(j);
@ -4633,14 +4633,14 @@ nullquote:
if ((ScriptQuotes[*insptr] == NULL))
{
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],*insptr);
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr);
insptr++;
continue;
}
if ((vm.g_p < 0 || vm.g_p >= MAXPLAYERS))
{
OSD_Printf(CON_ERROR "bad player for quote %d: (%d)\n",g_errorLineNum,keyw[g_tw],*insptr,vm.g_p);
OSD_Printf(CON_ERROR "bad player for quote %d: (%d)\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr,vm.g_p);
insptr++;
continue;
}

View file

@ -356,7 +356,7 @@ void Gv_DumpValues(void)
else if (aGameVars[i].dwFlags & (GAMEVAR_PERACTOR))
OSD_Printf(" GAMEVAR_PERACTOR");
else
OSD_Printf(" %d",aGameVars[i].dwFlags/* & (GAMEVAR_USER_MASK)*/);
OSD_Printf(" %"PRIdPTR,aGameVars[i].dwFlags/* & (GAMEVAR_USER_MASK)*/);
OSD_Printf(" // ");
if (aGameVars[i].dwFlags & (GAMEVAR_SYSTEM))

View file

@ -585,7 +585,7 @@ static int32_t C_SetScriptSize(int32_t size)
//initprintf("offset: %d\n",(unsigned)(g_scriptPtr-script));
g_scriptSize = size;
initprintf("Resizing code buffer to %d*%d bytes\n", g_scriptSize, sizeof(instype));
initprintf("Resizing code buffer to %d*%d bytes\n", g_scriptSize, (int32_t)sizeof(instype));
newscript = (instype *)Brealloc(script, g_scriptSize * sizeof(instype));
@ -3188,7 +3188,7 @@ repeatcase:
if (!ScriptQuotes[k])
{
Bsprintf(tempbuf,"Failed allocating %" PRIdPTR " byte quote text buffer.", MAXQUOTELEN);
Bsprintf(tempbuf,"Failed allocating %d byte quote text buffer.", MAXQUOTELEN);
g_numCompilerErrors++;
return 1;
}
@ -3205,7 +3205,7 @@ repeatcase:
ScriptQuoteRedefinitions[g_numQuoteRedefinitions] = Bcalloc(MAXQUOTELEN, sizeof(uint8_t));
if (!ScriptQuoteRedefinitions[g_numQuoteRedefinitions])
{
Bsprintf(tempbuf,"Failed allocating %" PRIdPTR " byte quote text buffer.", MAXQUOTELEN);
Bsprintf(tempbuf,"Failed allocating %d byte quote text buffer.", MAXQUOTELEN);
g_numCompilerErrors++;
return 1;
}
@ -3591,7 +3591,7 @@ void C_CompilationInfo(void)
int32_t j, k=0;
initprintf(" \n");
initprintf("Compiled code info: (size=%ld*%d bytes)\n",
(unsigned long)(g_scriptPtr-script), sizeof(instype));
(unsigned long)(g_scriptPtr-script), (int32_t)sizeof(instype));
initprintf(" %d/%d user labels, %d/65536 indirect constants,\n",
g_numLabels-g_numDefaultLabels, 65536-g_numDefaultLabels,
g_numSavedConstants);

View file

@ -120,7 +120,7 @@ void VM_ScriptInfo(void)
if (p==insptr) initprintf("<<");
if (*p>>12 && (*p&0xFFF)<CON_END)
initprintf("\n%5d: L%5d: %s ",p-script,*p>>12,keyw[*p&0xFFF]);
initprintf("\n%5d: L%5d: %s ",(int32_t)(p-script),(int32_t)(*p>>12),keyw[*p&0xFFF]);
else initprintf(" %d",*p);
if (p==insptr) initprintf(">>");

View file

@ -1210,7 +1210,7 @@ static int32_t osdcmd_kick(const osdfuncparm_t *parm)
if (currentPeer -> state != ENET_PEER_STATE_CONNECTED)
continue;
sscanf(parm->parms[0],"%" PRIxPTR "", &hexaddr);
sscanf(parm->parms[0],"%" SCNx32 "", &hexaddr);
if (currentPeer->address.host == hexaddr)
{
@ -1246,7 +1246,7 @@ static int32_t osdcmd_kickban(const osdfuncparm_t *parm)
if (currentPeer -> state != ENET_PEER_STATE_CONNECTED)
continue;
sscanf(parm->parms[0],"%" PRIxPTR "", &hexaddr);
sscanf(parm->parms[0],"%" SCNx32 "", &hexaddr);
// TODO: implement banning logic

View file

@ -1721,7 +1721,7 @@ int32_t sv_loadsnapshot(int32_t fil, int32_t *ret_hasdiffs, int32_t *ret_demotic
if (p != svsnapshot+svsnapsiz)
{
OSD_Printf("sv_loadsnapshot: internal error: p-(snapshot end)=%d!\n",
p-(svsnapshot+svsnapsiz));
(int32_t)(p-(svsnapshot+svsnapsiz)));
sv_freemem();
return 6;
}
@ -2042,7 +2042,7 @@ static void sv_restload()
#define SAVEWR(ptr, sz, cnt) do { if (fil) dfwrite(ptr,sz,cnt,fil); } while (0)
#define SAVEWRU(ptr, sz, cnt) do { if (fil) fwrite(ptr,sz,cnt,fil); } while (0)
#define PRINTSIZE(name) OSD_Printf(#name ": %d\n", mem-tmem), tmem=mem
#define PRINTSIZE(name) OSD_Printf(#name ": %d\n", (int32_t)(mem-tmem)), tmem=mem
static uint8_t *dosaveplayer2(int32_t spot, FILE *fil, uint8_t *mem)
{