1
0
forked from 0ad/0ad

Fix some more GCC warnings

This was SVN commit r7045.
This commit is contained in:
Ykkrosh 2009-07-28 09:27:56 +00:00
parent 38782c4606
commit cdfb58a62f
14 changed files with 35 additions and 27 deletions

View File

@ -180,8 +180,6 @@ bool CObjectBase::Load(const char* filename)
float pos = CStr(ae.Value).ToFloat();
anim.m_ActionPos2 = clamp(pos, 0.f, 1.f);
}
else
; // unrecognised element
}
currentVariant->m_Anims.push_back(anim);
}
@ -200,14 +198,10 @@ bool CObjectBase::Load(const char* filename)
prop.m_PropPointName = pe.Value;
else if (pe.Name == at_actor)
prop.m_ModelName = pe.Value;
else
; // unrecognised element
}
currentVariant->m_Props.push_back(prop);
}
}
else
; // unrecognised element
}
++currentVariant;
@ -232,10 +226,6 @@ bool CObjectBase::Load(const char* filename)
{
m_Material = "art/materials/" + CStr(child.GetText());
}
else
; // unrecognised element
// TODO: castshadow, etc
}
return true;

View File

@ -365,7 +365,7 @@ void CTerrain::Resize(ssize_t size)
for (ssize_t n=0;n<size-m_MapSizePatches;n++) {
for (ssize_t m=0;m<PATCH_SIZE;m++) {
CMiniPatch& src=m_Patches[j*m_MapSizePatches+m_MapSizePatches-1].m_MiniPatches[m][15];
for (size_t k=0;k<PATCH_SIZE;k++) {
for (ssize_t k=0;k<PATCH_SIZE;k++) {
CMiniPatch& dst=newPatches[j*size+m_MapSizePatches+n].m_MiniPatches[m][k];
dst.Tex1=src.Tex1;
dst.Tex1Priority=src.Tex1Priority;

View File

@ -48,9 +48,15 @@ DrawCalls::~DrawCalls()
clear();
}
// Never copy anything (to avoid losing track of who owns various pointers):
// DrawCalls needs to be copyable, so it can be used in other copyable types.
// But actually copying data is hard, since we'd need to avoid losing track of
// who owns various pointers, so instead we just return an empty list.
// The list should get filled in again (by GUIRenderer::UpdateDrawCallCache)
// before it's used for rendering. (TODO: Is this class actually used safely
// in practice?)
DrawCalls::DrawCalls(const DrawCalls&)
: std::vector<SDrawCall>()
{
}

View File

@ -58,9 +58,10 @@ namespace GUIRenderer
public:
void clear();
DrawCalls();
~DrawCalls();
// Copy/assignment results in an empty list, not an actual copy
DrawCalls(const DrawCalls&);
const DrawCalls& operator=(const DrawCalls&);
~DrawCalls();
};
}

View File

@ -250,7 +250,7 @@ bool CNetClient::OnError( void* pContext, CFsmEvent* pEvent )
if ( !pEvent || !pContext ) return false;
// Error event?
if ( pEvent->GetType() != NMT_ERROR ) return true;
if ( pEvent->GetType() != (uint)NMT_ERROR ) return true;
CNetClient* pClient = ( CNetClient* )( ( FsmActionCtx* )pContext )->pHost;
assert( pClient );
@ -364,7 +364,7 @@ bool CNetClient::OnAuthenticate( void* pContext, CFsmEvent* pEvent )
assert( pClient );
assert( pSession );
if ( pEvent->GetType() == NMT_ERROR )
if ( pEvent->GetType() == (uint)NMT_ERROR )
{
// return CNetClient::OnError( pContext, pEvent );
}

View File

@ -392,7 +392,7 @@ bool CNetServer::OnError( void* pContext, CFsmEvent* pEvent )
if ( !pContext || !pEvent ) return false;
// Error event?
if ( pEvent->GetType() != NMT_ERROR ) return true;
if ( pEvent->GetType() != (uint)NMT_ERROR ) return true;
CNetServer* pServer = ( CNetServer* )( ( FsmActionCtx* )pContext )->pHost;
UNUSED2(pServer);

View File

@ -168,7 +168,7 @@ void CLogger::LogUsingMethod(ELogMethod method, const char* message)
}
// -- This function has not been removed because the build would break.
void CLogger::Log(ELogMethod method, const char* category, const char *fmt, ...)
void CLogger::Log(ELogMethod method, const char* UNUSED(category), const char *fmt, ...)
{
va_list argp;
char buffer[512];
@ -185,7 +185,7 @@ void CLogger::Log(ELogMethod method, const char* category, const char *fmt, ...)
}
// -- This function has not been removed because the build would break.
void CLogger::LogOnce(ELogMethod method, const char* category, const char *fmt, ...)
void CLogger::LogOnce(ELogMethod method, const char* UNUSED(category), const char *fmt, ...)
{
va_list argp;
char buffer[512];

View File

@ -554,7 +554,7 @@ bool CParserLine::ParseString(const CParser& Parser, const std::string &strLine)
// --- New node is set!
// Make sure they are large enough
if ((int)LastValidProgress.size() < Lane+1)
if (LastValidProgress.size() < Lane+1)
{
LastValidProgress.resize(Lane+1);
LastValidMatch.resize(Lane+1);
@ -602,7 +602,7 @@ bool CParserLine::ParseString(const CParser& Parser, const std::string &strLine)
++Progress;
// Check length
if (Progress >= (int)Segments.size())
if (Progress >= Segments.size())
{
break;
}
@ -654,7 +654,7 @@ bool CParserLine::ParseString(const CParser& Parser, const std::string &strLine)
// that invalidates the match
// String end?
if (Progress >= (int)Segments.size())
if (Progress >= Segments.size())
{
Match = false;
}
@ -790,7 +790,7 @@ bool CParserLine::ParseString(const CParser& Parser, const std::string &strLine)
// if _minus is found as argument, remove it and add "-" to the one after that
// note, it's easier if std::iterator isn't used here
for (i=1; i<(int)GetArgCount(); ++i)
for (i=1; i<GetArgCount(); ++i)
{
if (m_Arguments[i-1].m_String == "_minus")
{

View File

@ -429,7 +429,7 @@ void PriQueue::promote( AStarNode *node )
}
std::vector<AStarNode*>::iterator ind, first;
for( ind = c.begin(); ind!=c.end() && !((*ind)->equals(*node)); ind++ );
for( ind = c.begin(); ind!=c.end() && !((*ind)->equals(*node)); ind++ ) { }
if (ind == c.end())
{
push(node);

View File

@ -64,7 +64,7 @@ friend class CHandle;
std::bitset<MAX_HANDLES> m_refd;
std::vector<CEntity*> m_reaper;
std::vector<CEntity*>* m_collisionPatches;
int m_nextalloc;
size_t m_nextalloc;
static bool m_extant;
bool m_death;
int m_collisionPatchesPerSide;

View File

@ -496,7 +496,9 @@ namespace
JSClass global_class = {
"global", 0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL
};
void ErrorReporter(JSContext* WXUNUSED(cx), const char* message, JSErrorReport* report)

View File

@ -47,17 +47,23 @@ bool DragCommand::Do()
AtObj srcData = m_Ctrl->m_ListData.at(m_Src);
if (m_Tgt > m_Src)
{
std::copy(
m_Ctrl->m_ListData.begin()+(m_Src+1),
m_Ctrl->m_ListData.begin()+(m_Tgt+1),
m_Ctrl->m_ListData.begin()+ m_Src);
}
else if (m_Tgt < m_Src)
{
std::copy_backward(
m_Ctrl->m_ListData.begin()+ m_Tgt,
m_Ctrl->m_ListData.begin()+ m_Src,
m_Ctrl->m_ListData.begin()+(m_Src+1));
}
else // m_Tgt == m_Src
; // do nothing - this item was just dragged onto itself
{
// do nothing - this item was just dragged onto itself
}
m_Ctrl->m_ListData.at(m_Tgt) = srcData;

View File

@ -39,6 +39,9 @@
#include "wx/debugrpt.h"
#include "wx/file.h"
// wx and libxml both want to define ATTRIBUTE_PRINTF (with similar
// meanings), so undef it to avoid a warning
#undef ATTRIBUTE_PRINTF
#include <libxml/parser.h>
#ifndef LIBXML_THREAD_ENABLED

View File

@ -1046,7 +1046,7 @@ void TriggerSpecText::onTextEnter(wxCommandEvent& WXUNUSED(evt))
wxBell();
}
TriggerSpecChoice::TriggerSpecChoice(TriggerBottomBar* parent, std::wstring label, const wxPoint& pos,
TriggerSpecChoice::TriggerSpecChoice(TriggerBottomBar* parent, std::wstring WXUNUSED(label), const wxPoint& pos,
const wxSize& size, const wxArrayString& strings, int parameter, callback func, void* data)
: wxChoice(parent, wxID_ANY, pos, size, strings), m_Callback(func), m_Data(data),
m_Parent(parent), m_Parameter(parameter)