[openjk] 104/130: SG: Fix compiling errors and warnings
Simon McVittie
smcv at debian.org
Fri Oct 28 11:09:25 UTC 2016
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository openjk.
commit 91bcc2897ee08dab0f250520d03c0594b8a2d4bb
Author: bibendovsky <bibendovsky at hotmail.com>
Date: Sun Oct 9 13:04:48 2016 +0300
SG: Fix compiling errors and warnings
---
code/game/G_Timer.cpp | 4 ++--
code/game/Q3_Interface.cpp | 10 +++++-----
code/game/g_roff.cpp | 4 ++--
code/game/g_savegame.cpp | 4 ++--
code/game/g_vehicles.h | 4 ++--
code/icarus/IcarusImplementation.cpp | 2 +-
code/qcommon/ojk_saved_game.cpp | 2 +-
code/qcommon/ojk_saved_game_helper.h | 2 --
code/qcommon/ojk_saved_game_helper_fwd.h | 4 ++--
code/rd-vanilla/G2_misc.cpp | 5 +++++
code/server/sv_savegame.cpp | 6 +++---
codeJK2/game/G_Timer.cpp | 4 ++--
codeJK2/game/Q3_Registers.cpp | 10 +++++-----
codeJK2/game/g_roff.cpp | 2 +-
codeJK2/game/g_savegame.cpp | 4 ++--
codeJK2/icarus/Instance.cpp | 10 +++++-----
codeJK2/icarus/Sequence.cpp | 12 +++++++++---
codeJK2/icarus/Sequencer.cpp | 4 ++--
codeJK2/icarus/TaskManager.cpp | 14 +++++++-------
shared/sys/sys_win32.cpp | 2 +-
20 files changed, 59 insertions(+), 50 deletions(-)
diff --git a/code/game/G_Timer.cpp b/code/game/G_Timer.cpp
index 90f2e87..d72f525 100644
--- a/code/game/G_Timer.cpp
+++ b/code/game/G_Timer.cpp
@@ -222,7 +222,7 @@ void TIMER_Load( void )
for ( j = 0, ent = &g_entities[0]; j < MAX_GENTITIES; j++, ent++ )
{
- unsigned char numTimers;
+ unsigned char numTimers = 0;
saved_game.read_chunk<uint8_t>(
INT_ID('T', 'I', 'M', 'E'),
@@ -231,7 +231,7 @@ void TIMER_Load( void )
//Read back all entries
for ( int i = 0; i < numTimers; i++ )
{
- int time;
+ int time = 0;
char tempBuffer[1024]; // Still ugly. Setting ourselves up for 007 AUF all over again. =)
assert (sizeof(g_timers[0]->time) == sizeof(time) );//make sure we're reading the same size as we wrote
diff --git a/code/game/Q3_Interface.cpp b/code/game/Q3_Interface.cpp
index d589472..56feeeb 100644
--- a/code/game/Q3_Interface.cpp
+++ b/code/game/Q3_Interface.cpp
@@ -7308,7 +7308,7 @@ VariableLoadFloats
void CQuake3GameInterface::VariableLoadFloats( varFloat_m &fmap )
{
- int numFloats;
+ int numFloats = 0;
char tempBuffer[1024];
ojk::SavedGameHelper saved_game(
@@ -7320,7 +7320,7 @@ void CQuake3GameInterface::VariableLoadFloats( varFloat_m &fmap )
for ( int i = 0; i < numFloats; i++ )
{
- int idSize;
+ int idSize = 0;
saved_game.read_chunk<int32_t>(
INT_ID('F', 'I', 'D', 'L'),
@@ -7333,7 +7333,7 @@ void CQuake3GameInterface::VariableLoadFloats( varFloat_m &fmap )
tempBuffer[ idSize ] = 0;
- float val;
+ float val = 0.0F;
saved_game.read_chunk<float>(
INT_ID('F', 'V', 'A', 'L'),
@@ -7352,7 +7352,7 @@ VariableLoadStrings
void CQuake3GameInterface::VariableLoadStrings( int type, varString_m &fmap )
{
- int numFloats;
+ int numFloats = 0;
char tempBuffer[1024];
char tempBuffer2[1024];
@@ -7365,7 +7365,7 @@ void CQuake3GameInterface::VariableLoadStrings( int type, varString_m &fmap )
for ( int i = 0; i < numFloats; i++ )
{
- int idSize;
+ int idSize = 0;
saved_game.read_chunk<int32_t>(
INT_ID('S', 'I', 'D', 'L'),
diff --git a/code/game/g_roff.cpp b/code/game/g_roff.cpp
index 84e2599..fe1f79f 100644
--- a/code/game/g_roff.cpp
+++ b/code/game/g_roff.cpp
@@ -649,7 +649,7 @@ void G_Roff( gentity_t *ent )
void G_SaveCachedRoffs()
{
- int i, len;
+ int i, len = 0;
ojk::SavedGameHelper saved_game(
::gi.saved_game);
@@ -685,7 +685,7 @@ void G_SaveCachedRoffs()
void G_LoadCachedRoffs()
{
- int i, count, len;
+ int i, count = 0, len = 0;
char buffer[MAX_QPATH];
ojk::SavedGameHelper saved_game(
diff --git a/code/game/g_savegame.cpp b/code/game/g_savegame.cpp
index 24b5d78..ca27583 100644
--- a/code/game/g_savegame.cpp
+++ b/code/game/g_savegame.cpp
@@ -989,7 +989,7 @@ static void WriteGEntities(qboolean qbAutosave)
static void ReadGEntities(qboolean qbAutosave)
{
- int iCount;
+ int iCount = 0;
int i;
ojk::SavedGameHelper saved_game(
@@ -1002,7 +1002,7 @@ static void ReadGEntities(qboolean qbAutosave)
int iPreviousEntRead = -1;
for (i=0; i<iCount; i++)
{
- int iEntIndex;
+ int iEntIndex = 0;
saved_game.read_chunk<int32_t>(
INT_ID('E', 'D', 'N', 'M'),
diff --git a/code/game/g_vehicles.h b/code/game/g_vehicles.h
index 3c74a1f..6296e0d 100644
--- a/code/game/g_vehicles.h
+++ b/code/game/g_vehicles.h
@@ -693,7 +693,7 @@ struct Vehicle_t
float m_safeJumpMountRightDot;
- void Vehicle_t::sg_export(
+ void sg_export(
ojk::SavedGameHelper& saved_game) const
{
saved_game.write<int32_t>(m_pPilot);
@@ -740,7 +740,7 @@ struct Vehicle_t
saved_game.write<float>(m_safeJumpMountRightDot);
}
- void Vehicle_t::sg_import(
+ void sg_import(
ojk::SavedGameHelper& saved_game)
{
saved_game.read<int32_t>(m_pPilot);
diff --git a/code/icarus/IcarusImplementation.cpp b/code/icarus/IcarusImplementation.cpp
index ad66f77..26004b3 100644
--- a/code/icarus/IcarusImplementation.cpp
+++ b/code/icarus/IcarusImplementation.cpp
@@ -695,7 +695,7 @@ int CIcarus::Load()
Free();
//Check to make sure we're at the ICARUS save block
- double version;
+ double version = 0.0;
saved_game.read_chunk<double>(
INT_ID('I', 'C', 'A', 'R'),
diff --git a/code/qcommon/ojk_saved_game.cpp b/code/qcommon/ojk_saved_game.cpp
index 79704a0..bd27599 100644
--- a/code/qcommon/ojk_saved_game.cpp
+++ b/code/qcommon/ojk_saved_game.cpp
@@ -340,7 +340,7 @@ bool SavedGame::read_chunk(
ref_chunk_size += sizeof(loaded_magic_value);
#endif
- if (loaded_chunk_size != ref_chunk_size)
+ if (loaded_chunk_size != static_cast<int>(ref_chunk_size))
{
is_failed_ = true;
diff --git a/code/qcommon/ojk_saved_game_helper.h b/code/qcommon/ojk_saved_game_helper.h
index bab0227..280cd0e 100644
--- a/code/qcommon/ojk_saved_game_helper.h
+++ b/code/qcommon/ojk_saved_game_helper.h
@@ -312,8 +312,6 @@ bool SavedGameHelper::try_read(
TDst& dst_value,
BooleanTag)
{
- constexpr int src_size = static_cast<int>(sizeof(TSrc));
-
TSrc src_value;
if (!saved_game_->read(
diff --git a/code/qcommon/ojk_saved_game_helper_fwd.h b/code/qcommon/ojk_saved_game_helper_fwd.h
index 6c06559..b36b674 100644
--- a/code/qcommon/ojk_saved_game_helper_fwd.h
+++ b/code/qcommon/ojk_saved_game_helper_fwd.h
@@ -302,7 +302,7 @@ public:
static_cast<void>(saved_game);
static_cast<void>(instance);
- static_assert(false, "Not implemented.");
+ throw "Not implemented.";
}
static void sg_import(
@@ -312,7 +312,7 @@ public:
static_cast<void>(saved_game);
static_cast<void>(instance);
- static_assert(false, "Not implemented.");
+ throw "Not implemented.";
}
};
diff --git a/code/rd-vanilla/G2_misc.cpp b/code/rd-vanilla/G2_misc.cpp
index 5d0b0fa..9a6162f 100644
--- a/code/rd-vanilla/G2_misc.cpp
+++ b/code/rd-vanilla/G2_misc.cpp
@@ -573,7 +573,10 @@ void G2_TransformModel(CGhoul2Info_v &ghoul2, const int frameNum, vec3_t scale,
{
int i, lod;
vec3_t correctScale;
+
+#if !defined(JK2_MODE) || defined(_G2_GORE)
qboolean firstModelOnly = qfalse;
+#endif // !JK2_MODE || _G2_GORE
#ifndef JK2_MODE
if ( cg_g2MarksAllModels == NULL )
@@ -1560,7 +1563,9 @@ void G2_TraceModels(CGhoul2Info_v &ghoul2, vec3_t rayStart, vec3_t rayEnd, CColl
int i, lod;
skin_t *skin;
shader_t *cust_shader;
+#if !defined(JK2_MODE) || defined(_G2_GORE)
qboolean firstModelOnly = qfalse;
+#endif // !JK2_MODE || _G2_GORE
int firstModel = 0;
#ifndef JK2_MODE
diff --git a/code/server/sv_savegame.cpp b/code/server/sv_savegame.cpp
index 053196d..1f49def 100644
--- a/code/server/sv_savegame.cpp
+++ b/code/server/sv_savegame.cpp
@@ -574,7 +574,7 @@ void SG_WriteCvars(void)
void SG_ReadCvars()
{
- int iCount;
+ int iCount = 0;
std::string psName;
const char* psValue;
@@ -668,7 +668,7 @@ void SG_ReadServerConfigStrings( void )
// now read the replacement ones...
//
- int iCount;
+ int iCount = 0;
ojk::SavedGameHelper saved_game(
&ojk::SavedGame::get_instance());
@@ -681,7 +681,7 @@ void SG_ReadServerConfigStrings( void )
for (int i = 0; i<iCount; i++)
{
- int iIndex;
+ int iIndex = 0;
const char *psName;
saved_game.read_chunk<int32_t>(
diff --git a/codeJK2/game/G_Timer.cpp b/codeJK2/game/G_Timer.cpp
index 36d6341..b074b6a 100644
--- a/codeJK2/game/G_Timer.cpp
+++ b/codeJK2/game/G_Timer.cpp
@@ -232,7 +232,7 @@ void TIMER_Load( void )
for ( j = 0, ent = &g_entities[0]; j < MAX_GENTITIES; j++, ent++ )
{
- int numTimers;
+ int numTimers = 0;
saved_game.read_chunk<int32_t>(
INT_ID('T', 'I', 'M', 'E'),
@@ -245,7 +245,7 @@ void TIMER_Load( void )
//Read back all entries
for ( int i = 0; i < numTimers; i++ )
{
- int length, time;
+ int length = 0, time = 0;
char tempBuffer[1024]; // Still ugly. Setting ourselves up for 007 AUF all over again. =)
assert (sizeof(g_timers[0]->time) == sizeof(time) );//make sure we're reading the same size as we wrote
diff --git a/codeJK2/game/Q3_Registers.cpp b/codeJK2/game/Q3_Registers.cpp
index c91e73a..7797b5f 100644
--- a/codeJK2/game/Q3_Registers.cpp
+++ b/codeJK2/game/Q3_Registers.cpp
@@ -390,7 +390,7 @@ Q3_VariableLoadFloats
void Q3_VariableLoadFloats( varFloat_m &fmap )
{
- int numFloats;
+ int numFloats = 0;
char tempBuffer[1024];
ojk::SavedGameHelper saved_game(
@@ -402,7 +402,7 @@ void Q3_VariableLoadFloats( varFloat_m &fmap )
for ( int i = 0; i < numFloats; i++ )
{
- int idSize;
+ int idSize = 0;
saved_game.read_chunk<int32_t>(
INT_ID('F', 'I', 'D', 'L'),
@@ -415,7 +415,7 @@ void Q3_VariableLoadFloats( varFloat_m &fmap )
tempBuffer[ idSize ] = 0;
- float val;
+ float val = 0.0F;
saved_game.read_chunk<float>(
INT_ID('F', 'V', 'A', 'L'),
@@ -434,7 +434,7 @@ Q3_VariableLoadStrings
void Q3_VariableLoadStrings( int type, varString_m &fmap )
{
- int numFloats;
+ int numFloats = 0;
char tempBuffer[1024];
char tempBuffer2[1024];
@@ -447,7 +447,7 @@ void Q3_VariableLoadStrings( int type, varString_m &fmap )
for ( int i = 0; i < numFloats; i++ )
{
- int idSize;
+ int idSize = 0;
saved_game.read_chunk<int32_t>(
INT_ID('S', 'I', 'D', 'L'),
diff --git a/codeJK2/game/g_roff.cpp b/codeJK2/game/g_roff.cpp
index 24fe2ac..7eb1bd1 100644
--- a/codeJK2/game/g_roff.cpp
+++ b/codeJK2/game/g_roff.cpp
@@ -660,7 +660,7 @@ void G_SaveCachedRoffs()
void G_LoadCachedRoffs()
{
- int i, count, len;
+ int i, count = 0, len = 0;
char buffer[MAX_QPATH];
ojk::SavedGameHelper saved_game(
diff --git a/codeJK2/game/g_savegame.cpp b/codeJK2/game/g_savegame.cpp
index 200f4f1..672f6de 100644
--- a/codeJK2/game/g_savegame.cpp
+++ b/codeJK2/game/g_savegame.cpp
@@ -762,7 +762,7 @@ static void WriteGEntities(qboolean qbAutosave)
static void ReadGEntities(qboolean qbAutosave)
{
- int iCount;
+ int iCount = 0;
int i;
ojk::SavedGameHelper saved_game(
@@ -775,7 +775,7 @@ static void ReadGEntities(qboolean qbAutosave)
int iPreviousEntRead = -1;
for (i=0; i<iCount; i++)
{
- int iEntIndex;
+ int iEntIndex = 0;
saved_game.read_chunk<int32_t>(
INT_ID('E', 'D', 'N', 'M'),
diff --git a/codeJK2/icarus/Instance.cpp b/codeJK2/icarus/Instance.cpp
index 7f84f77..7aec690 100644
--- a/codeJK2/icarus/Instance.cpp
+++ b/codeJK2/icarus/Instance.cpp
@@ -473,7 +473,7 @@ LoadSignals
int ICARUS_Instance::LoadSignals( void )
{
- int numSignals;
+ int numSignals = 0;
ojk::SavedGameHelper saved_game(
m_interface->saved_game);
@@ -485,7 +485,7 @@ int ICARUS_Instance::LoadSignals( void )
for ( int i = 0; i < numSignals; i++ )
{
char buffer[1024];
- int length;
+ int length = 0;
//Get the size of the string
saved_game.read_chunk<int32_t>(
@@ -536,7 +536,7 @@ LoadSequence
int ICARUS_Instance::LoadSequences( void )
{
CSequence *sequence;
- int numSequences;
+ int numSequences = 0;
ojk::SavedGameHelper saved_game(
m_interface->saved_game);
@@ -588,7 +588,7 @@ LoadSequencers
int ICARUS_Instance::LoadSequencers( void )
{
CSequencer *sequencer;
- int numSequencers;
+ int numSequencers = 0;
ojk::SavedGameHelper saved_game(
m_interface->saved_game);
@@ -624,7 +624,7 @@ int ICARUS_Instance::Load( void )
Free();
//Check to make sure we're at the ICARUS save block
- double version;
+ double version = 0.0;
ojk::SavedGameHelper saved_game(
m_interface->saved_game);
diff --git a/codeJK2/icarus/Sequence.cpp b/codeJK2/icarus/Sequence.cpp
index 5f3a03a..325984e 100644
--- a/codeJK2/icarus/Sequence.cpp
+++ b/codeJK2/icarus/Sequence.cpp
@@ -473,10 +473,10 @@ Load
int CSequence::Load( void )
{
- unsigned char flags;
+ unsigned char flags = 0;
CSequence *sequence;
CBlock *block;
- int id, numMembers;
+ int id = 0, numMembers = 0;
int i;
int bID, bSize;
@@ -560,6 +560,8 @@ int CSequence::Load( void )
block->SetFlags( flags );
+ numMembers = 0;
+
//Get the number of block members
saved_game.read_chunk<int32_t>(
INT_ID('B', 'N', 'U', 'M'),
@@ -567,11 +569,15 @@ int CSequence::Load( void )
for ( int j = 0; j < numMembers; j++ )
{
+ bID = 0;
+
//Get the member ID
saved_game.read_chunk<int32_t>(
INT_ID('B', 'M', 'I', 'D'),
bID);
-
+
+ bSize = 0;
+
//Get the member size
saved_game.read_chunk<int32_t>(
INT_ID('B', 'S', 'I', 'Z'),
diff --git a/codeJK2/icarus/Sequencer.cpp b/codeJK2/icarus/Sequencer.cpp
index 22edc5a..fb6f3db 100644
--- a/codeJK2/icarus/Sequencer.cpp
+++ b/codeJK2/icarus/Sequencer.cpp
@@ -2424,7 +2424,7 @@ int CSequencer::Load( void )
CTaskGroup *taskGroup;
CSequence *seq;
- int numSequences, seqID, taskID, numTasks;
+ int numSequences = 0, seqID = 0, taskID = 0, numTasks = 0;
//Get the number of sequences to read
saved_game.read_chunk<int32_t>(
@@ -2482,7 +2482,7 @@ int CSequencer::Load( void )
m_taskSequences[ taskGroup ] = seq;
}
- int curGroupID;
+ int curGroupID = 0;
//Get the current task group
saved_game.read_chunk<int32_t>(
diff --git a/codeJK2/icarus/TaskManager.cpp b/codeJK2/icarus/TaskManager.cpp
index 83ea256..feb0014 100644
--- a/codeJK2/icarus/TaskManager.cpp
+++ b/codeJK2/icarus/TaskManager.cpp
@@ -1876,15 +1876,15 @@ Load
void CTaskManager::Load( void )
{
- unsigned char flags;
+ unsigned char flags = 0;
CTaskGroup *taskGroup;
CBlock *block;
CTask *task;
- uint32_t timeStamp;
- bool completed;
+ uint32_t timeStamp = 0;
+ bool completed = false;
void *bData;
- int id, numTasks, numMembers;
- int bID, bSize;
+ int id = 0, numTasks = 0, numMembers = 0;
+ int bID = 0, bSize = 0;
int i;
ojk::SavedGameHelper saved_game(
@@ -2018,7 +2018,7 @@ void CTaskManager::Load( void )
}
//Load the task groups
- int numTaskGroups;
+ int numTaskGroups = 0;
saved_game.read_chunk<int32_t>(
INT_ID('T', 'G', '#', 'G'),
@@ -2101,7 +2101,7 @@ void CTaskManager::Load( void )
for ( i = 0; i < numTaskGroups; i++ )
{
char name[1024];
- int length;
+ int length = 0;
//Get the size of the string
saved_game.read_chunk<int32_t>(
diff --git a/shared/sys/sys_win32.cpp b/shared/sys/sys_win32.cpp
index 23b79c7..53ca529 100644
--- a/shared/sys/sys_win32.cpp
+++ b/shared/sys/sys_win32.cpp
@@ -167,7 +167,7 @@ char *Sys_DefaultHomePath( void )
if( !SUCCEEDED( SHGetFolderPath( NULL, CSIDL_PERSONAL, NULL, 0, homeDirectory ) ) )
{
Com_Printf( "Unable to determine your home directory.\n" );
- return false;
+ return NULL;
}
Com_sprintf( homePath, sizeof( homePath ), "%s%cMy Games%c", homeDirectory, PATH_SEP, PATH_SEP );
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/openjk.git
More information about the Pkg-games-commits
mailing list