Fixed compilation warnings

Automatically enable flags -Werror and -fno-exceptions in debug mode
This commit is contained in:
Pali Rohár 2010-10-17 14:16:57 +02:00
parent ae1515a1ab
commit 7b08dbe318
50 changed files with 152 additions and 139 deletions

View file

@ -22,7 +22,7 @@ PREFIX=@PREFIX@
PKGDATADIR=@PKGDATADIR@
CPPFLAGS=@DEFS@ @CPPFLAGS@ -DUSE_ZLIB -I$(TOPDIR) -I$(TOPDIR)/src/include -I$(TOPDIR)/src/guichan/include -DSTRATAGUS_LIB_PATH="\"@PKGDATADIR@\""
CXXFLAGS=@CXXFLAGS@ -Wextra -Wno-long-long -pedantic
CXXFLAGS=@CXXFLAGS@
LDFLAGS=@LDFLAGS@ -lpng -lz -lm
OBJDIR=@OBJDIR@

View file

@ -128,9 +128,9 @@ fi
AC_ARG_ENABLE(debug,
[ --enable-debug [Enable debug (default: no)]])
if test "$enable_debug" != "yes" -a "$enable_profile" != "yes"; then
CXXFLAGS="$CXXFLAGS -O2 -pipe -fsigned-char -fomit-frame-pointer -fexpensive-optimizations -ffast-math"
CXXFLAGS="$CXXFLAGS -O2 -pipe -pedantic -fsigned-char -fomit-frame-pointer -fexpensive-optimizations -ffast-math"
else
CXXFLAGS="$CXXFLAGS -O0 -g -fsigned-char -Wsign-compare -Werror -Wall"
CXXFLAGS="$CXXFLAGS -O0 -g -pedantic -fsigned-char -fno-exceptions -Wsign-compare -Wall -Wextra -Werror"
CPPFLAGS="$CPPFLAGS -DDEBUG"
fi

View file

@ -807,7 +807,7 @@ void CommandReturnGoods(CUnit *unit, CUnit *goal, int flush)
** @param type unit type to train.
** @param flush if true, flush command queue.
*/
void CommandTrainUnit(CUnit *unit, CUnitType *type, int flush)
void CommandTrainUnit(CUnit *unit, CUnitType *type, int)
{
COrderPtr order;

View file

@ -509,7 +509,7 @@ void AiInit(CPlayer *player)
ait = NULL;
DebugPrint("%d - %p - looking for class %s\n" _C_
player->Index _C_ player _C_ player->AiName.c_str());
player->Index _C_ (void *)player _C_ player->AiName.c_str());
//MAPTODO print the player name (player->Name) instead of the pointer
//
@ -1101,7 +1101,7 @@ void AiCanNotMove(CUnit *unit)
** @param unit Point to unit.
** @param what Pointer to unit-type.
*/
void AiNeedMoreSupply(const CUnit *unit, const CUnitType *what)
void AiNeedMoreSupply(const CUnit *unit, const CUnitType *)
{
Assert(unit->Player->Type != PlayerPerson);
unit->Player->Ai->NeedSupply = true;

View file

@ -1297,7 +1297,7 @@ static int CclDefineAiPlayer(lua_State *l)
++j;
Assert(i >= 0 && i <= PlayerMax);
DebugPrint("%p %d\n" _C_ Players[i].Ai _C_ Players[i].AiEnabled );
DebugPrint("%p %d\n" _C_ (void *)Players[i].Ai _C_ Players[i].AiEnabled );
// FIXME: lose this:
// Assert(!Players[i].Ai && Players[i].AiEnabled);

View file

@ -135,7 +135,7 @@ static gcn::Slider *editorSlider;
class EditorUnitSliderListener : public gcn::ActionListener
{
public:
virtual void action(const std::string &eventId) {
virtual void action(const std::string &) {
int iconsPerStep = VisibleUnitIcons;
int steps = (Editor.ShownUnitTypes.size() + iconsPerStep - 1) / iconsPerStep;
double value = editorUnitSlider->getValue();
@ -153,7 +153,7 @@ static EditorUnitSliderListener *editorUnitSliderListener;
class EditorSliderListener : public gcn::ActionListener
{
public:
virtual void action(const std::string &eventId) {
virtual void action(const std::string &) {
int iconsPerStep = VisibleTileIcons;
int steps = (Editor.ShownTileTypes.size() + iconsPerStep - 1) / iconsPerStep;
double value = editorSlider->getValue();
@ -1577,7 +1577,7 @@ static void EditorCallbackKeyUp(unsigned key, unsigned keychar)
/**
** Callback for input.
*/
static void EditorCallbackKeyRepeated(unsigned key, unsigned keychar)
static void EditorCallbackKeyRepeated(unsigned key, unsigned)
{
switch (key) {
case 'z':

View file

@ -90,7 +90,7 @@ GameResults GameResult; /// Outcome of the game
** @param mapname map filename
** @param map map loaded
*/
static void LoadStratagusMap(const std::string &smpname, const std::string &mapname, CMap *map)
static void LoadStratagusMap(const std::string &smpname, const std::string &mapname, CMap *)
{
char mapfull[PATH_MAX];
CFile file;
@ -163,7 +163,7 @@ static void LoadStratagusMap(const std::string &smpname, const std::string &mapn
// Write the map presentation file
static int WriteMapPresentation(const std::string &mapname, CMap *map, char *mapsetup)
static int WriteMapPresentation(const std::string &mapname, CMap *map, char *)
{
FileWriter *f = NULL;
int i;
@ -176,7 +176,9 @@ static int WriteMapPresentation(const std::string &mapname, CMap *map, char *map
numplayers = 0;
topplayer = PlayerMax - 2;
#ifndef DEBUG
try {
#endif
f = CreateFileWriter(mapname);
f->printf("-- Stratagus Map Presentation\n");
f->printf("-- File generated by the stratagus builtin editor.\n");
@ -204,11 +206,13 @@ static int WriteMapPresentation(const std::string &mapname, CMap *map, char *map
// mapsetupname = mapsetup;
// }
// f->printf("DefineMapSetup(GetCurrentLuaPath()..\"%s\")\n", mapsetupname);
#ifndef DEBUG
} catch (const FileException &) {
fprintf(stderr, "ERROR: cannot write the map presentation\n");
delete f;
return -1;
}
#endif
delete f;
return 1;
@ -227,7 +231,9 @@ int WriteMapSetup(const char *mapSetup, CMap *map, int writeTerrain)
FileWriter *f = NULL;
int i, j;
#ifndef DEBUG
try {
#endif
f = CreateFileWriter(mapSetup);
f->printf("-- Stratagus Map Setup\n");
@ -287,11 +293,13 @@ int WriteMapSetup(const char *mapSetup, CMap *map, int writeTerrain)
}
}
f->printf("\n\n");
#ifndef DEBUG
} catch (const FileException &) {
fprintf(stderr,"Can't save map setup : `%s' \n", mapSetup);
delete f;
return -1;
}
#endif
delete f;
return 1;

View file

@ -71,7 +71,7 @@ namespace gcn
return 8*text.size();
}
int DefaultFont::drawGlyph(Graphics* graphics, unsigned char glyph, int x, int y)
int DefaultFont::drawGlyph(Graphics* graphics, unsigned char, int x, int y)
{
graphics->drawRectangle( Rectangle(x, y, 8, 8));

View file

@ -87,17 +87,17 @@ namespace gcn
*
* @param key the key pressed.
*/
virtual bool keyPress(const Key& key) { return false; }
virtual bool keyPress(const Key&) { return false; }
/**
* Called if a key is released when the widget has keyboard focus.
*
* @param key the key released.
*/
virtual bool keyRelease(const Key& key) { return false; }
virtual bool keyRelease(const Key&) { return false; }
virtual void hotKeyPress(const Key& key) { }
virtual void hotKeyRelease(const Key& key) { }
virtual void hotKeyPress(const Key&) { }
virtual void hotKeyRelease(const Key&) { }
protected:
/**

View file

@ -101,7 +101,7 @@ namespace gcn
* itself.
* @param button the button pressed.
*/
virtual void mousePress(int x, int y, int button) { }
virtual void mousePress(int, int, int) { }
/**
* Called when a mouse button is released when the mouse is in the
@ -114,7 +114,7 @@ namespace gcn
* itself.
* @param button the button released.
*/
virtual void mouseRelease(int x, int y, int button) { }
virtual void mouseRelease(int, int, int) { }
/**
@ -129,7 +129,7 @@ namespace gcn
* @param button the button clicked.
* @param count the number of clicks.
*/
virtual void mouseClick(int x, int y, int button, int count) { }
virtual void mouseClick(int, int, int, int) { }
/**
* Called on a mouse wheel up when the mouse is in the Widget
@ -140,7 +140,7 @@ namespace gcn
* @param y the y coordinate of the mouse relative to the Widget
* itself.
*/
virtual void mouseWheelUp(int x, int y) { }
virtual void mouseWheelUp(int, int) { }
/**
* Called on a mouse wheel down when the mouse is in the Widget
@ -151,7 +151,7 @@ namespace gcn
* @param y the y coordinate of the mouse relative to the Widget
* itself.
*/
virtual void mouseWheelDown(int x, int y) { }
virtual void mouseWheelDown(int, int) { }
/**
* Called when the mouse moves and the mouse is in the Widget
@ -162,7 +162,7 @@ namespace gcn
* @param y the y coordinate of the mouse relative to the Widget
* itself.
*/
virtual void mouseMotion(int x, int y) { }
virtual void mouseMotion(int, int) { }
protected:
/**

View file

@ -124,7 +124,7 @@ namespace gcn
*
* @param graphics a Graphics object to draw with.
*/
virtual void drawBorder(Graphics* graphics) { }
virtual void drawBorder(Graphics*) { }
/**
* Called for all Widgets in the gui each time Gui::logic is called.

View file

@ -228,7 +228,7 @@ namespace gcn
return (hasMouse() && mMouseDown) || mKeyDown || mHotKeyDown;
}
void Button::mouseClick(int x, int y, int button, int count)
void Button::mouseClick(int, int, int button, int)
{
if (button == MouseInput::LEFT)
{
@ -236,7 +236,7 @@ namespace gcn
}
}
void Button::mousePress(int x, int y, int button)
void Button::mousePress(int, int, int button)
{
if (button == MouseInput::LEFT && hasMouse())
{
@ -244,7 +244,7 @@ namespace gcn
}
}
void Button::mouseRelease(int x, int y, int button)
void Button::mouseRelease(int, int, int button)
{
if (button == MouseInput::LEFT)
{

View file

@ -190,7 +190,7 @@ namespace gcn
return false;
}
void CheckBox::mouseClick(int x, int y, int button, int count)
void CheckBox::mouseClick(int, int, int button, int)
{
if (button == MouseInput::LEFT)
{

View file

@ -381,7 +381,7 @@ namespace gcn
return false;
}
void DropDown::mousePress(int x, int y, int button)
void DropDown::mousePress(int, int y, int button)
{
if (button == MouseInput::LEFT && hasMouse() && !mDroppedDown)
{
@ -400,7 +400,7 @@ namespace gcn
}
}
void DropDown::mouseRelease(int x, int y, int button)
void DropDown::mouseRelease(int, int, int button)
{
if (button == MouseInput::LEFT)
{
@ -599,7 +599,7 @@ namespace gcn
foldUp();
}
void DropDown::moveToTop(Widget* widget)
void DropDown::moveToTop(Widget*)
{
if (getParent())
{
@ -607,7 +607,7 @@ namespace gcn
}
}
void DropDown::moveToBottom(Widget* widget)
void DropDown::moveToBottom(Widget*)
{
if (getParent())
{
@ -628,7 +628,7 @@ namespace gcn
}
}
void DropDown::action(const std::string& eventId)
void DropDown::action(const std::string&)
{
foldUp();
generateAction();

View file

@ -219,7 +219,7 @@ namespace gcn
return ret;
}
void ListBox::mousePress(int x, int y, int button)
void ListBox::mousePress(int, int y, int button)
{
if (button == MouseInput::LEFT && hasMouse())
{

View file

@ -249,7 +249,7 @@ namespace gcn
return false;
}
void RadioButton::mouseClick(int x, int y, int button, int count)
void RadioButton::mouseClick(int, int, int button, int)
{
if (button == MouseInput::LEFT)
{

View file

@ -335,7 +335,7 @@ namespace gcn
BasicContainer::_mouseOutMessage();
}
void ScrollArea::mousePress(int x, int y, int button)
void ScrollArea::mousePress(int x, int y, int)
{
if (getUpButtonDimension().isPointInRect(x, y))
{
@ -369,7 +369,7 @@ namespace gcn
}
}
void ScrollArea::mouseRelease(int x, int y, int button)
void ScrollArea::mouseRelease(int, int, int)
{
mUpButtonPressed = false;
mDownButtonPressed = false;
@ -1278,7 +1278,7 @@ namespace gcn
}
}
void ScrollArea::mouseWheelUp(int x, int y)
void ScrollArea::mouseWheelUp(int, int)
{
if (hasMouse())
{
@ -1286,7 +1286,7 @@ namespace gcn
}
}
void ScrollArea::mouseWheelDown(int x, int y)
void ScrollArea::mouseWheelDown(int, int)
{
if (hasMouse())
{

View file

@ -232,7 +232,7 @@ namespace gcn
}
}
void Slider::mouseRelease(int x, int y, int button)
void Slider::mouseRelease(int, int, int)
{
mMouseDrag = false;
}

View file

@ -179,7 +179,7 @@ namespace gcn
graphics->drawLine(x, getHeight() - 2, x, 1);
}
void TextField::mousePress(int x, int y, int button)
void TextField::mousePress(int x, int, int button)
{
if (hasMouse() && button == MouseInput::LEFT)
{
@ -199,7 +199,7 @@ namespace gcn
}
}
void TextField::mouseMotion(int x, int y)
void TextField::mouseMotion(int x, int)
{
if (isDragged() && mClickButton == MouseInput::LEFT)
{

View file

@ -131,7 +131,7 @@ namespace gcn
return mTitleBarHeight;
}
void Window:: _announceDeath(Widget *widget)
void Window:: _announceDeath(Widget *)
{
mContent = NULL;
}
@ -326,7 +326,7 @@ namespace gcn
}
}
void Window::mouseRelease(int x, int y, int button)
void Window::mouseRelease(int, int, int button)
{
if (button == 1)
{

View file

@ -54,7 +54,7 @@ public:
Transparent(false), UpdateCache(false) {}
void UpdateXY(int tx, int ty);
void UpdateSeenXY(int tx, int ty) {}
void UpdateSeenXY(int, int) {}
void Update(void);
void Create(void);
void FreeOpenGL(void);

View file

@ -94,7 +94,7 @@ public:
virtual ~CParticle() {}
virtual void draw() {}
virtual void update(int ticks) {}
virtual void update(int) {}
inline void destroy() { destroyed = true; }
inline bool isDestroyed() { return destroyed; }

View file

@ -622,7 +622,7 @@ static void DrawEvents(void)
/**
** Draw the minimap on the screen
*/
void CMinimap::Draw(int vx, int vy)
void CMinimap::Draw(int, int)
{
if (!UseOpenGL) {
SDL_Rect drect = {X, Y, 0, 0};

View file

@ -1500,7 +1500,7 @@ static void ClientParseStarted(const CInitMessage *msg)
**
** @param msg message received
*/
static void ClientParseAreYouThere(const CInitMessage *msg)
static void ClientParseAreYouThere(const CInitMessage *)
{
CInitMessage message;
@ -1514,7 +1514,7 @@ static void ClientParseAreYouThere(const CInitMessage *msg)
**
** @param msg message received
*/
static void ClientParseBadMap(const CInitMessage *msg)
static void ClientParseBadMap(const CInitMessage *)
{
int i;
CInitMessage message;

View file

@ -567,7 +567,7 @@ static inline int AStarAddNode(int x, int y, int o, int costs)
** Can be further optimised knowing that the new cost MUST BE LOWER
** than the old one.
*/
static void AStarReplaceNode(int pos, int costs)
static void AStarReplaceNode(int pos, int)
{
ProfileBegin("AStarReplaceNode");
@ -955,8 +955,8 @@ static int AStarSavePath(int startX, int startY, int endX, int endY, char *path,
** Check if we're at the goal or if it's 1 tile away
*/
static int AStarFindSimplePath(int sx, int sy, int gx, int gy, int gw, int gh,
int tilesizex, int tilesizey, int minrange, int maxrange,
char *path, int pathlen, void *data)
int, int, int minrange, int maxrange,
char *path, int, void *data)
{
ProfileBegin("AStarFindSimplePath");
// At exact destination point already

View file

@ -80,29 +80,29 @@ public:
-- Functions
----------------------------------------------------------------------------*/
static BOOL Seek(struct MREADER *mreader, long off, int whence)
static BOOL Seek(struct MREADER *, long off, int whence)
{
return CurrentFile->seek(off, whence);
}
static long Tell(struct MREADER *mreader)
static long Tell(struct MREADER *)
{
return CurrentFile->tell();
}
static BOOL Read(struct MREADER *mreader, void *buf, size_t len)
static BOOL Read(struct MREADER *, void *buf, size_t len)
{
return CurrentFile->read(buf, len);
}
static int Get(struct MREADER *mreader)
static int Get(struct MREADER *)
{
char c;
CurrentFile->read(&c, 1);
return c;
}
static BOOL Eof(struct MREADER *mreader)
static BOOL Eof(struct MREADER *)
{
return 0;
}

View file

@ -81,6 +81,7 @@ GameSound GameSounds
{ SoundConfig("rescue (human) UNUSED"),
SoundConfig("rescue (orc) UNUSED"),
},
SoundConfig("click"),
}
#endif
;

View file

@ -336,7 +336,7 @@ static void MixIntoBuffer(void *buffer, int samples)
** @param stream pointer to buffer you want to fill with information.
** @param len is length of audio buffer in bytes.
*/
static void FillAudio(void *udata, Uint8 *stream, int len)
static void FillAudio(void *, Uint8 *stream, int len)
{
len >>= 1;
MixIntoBuffer(stream, len);

View file

@ -113,7 +113,7 @@ static int gzseek(CFile *file, unsigned offset, int whence)
** @param offset Seek position
** @param whence How to seek
*/
static void bzseek(BZFILE *file, unsigned offset, int whence)
static void bzseek(BZFILE *file, unsigned offset, int)
{
char buf[32];

View file

@ -908,7 +908,7 @@ void DebugPlayers(void)
** @note The parameter type, isn't yet used.
** @todo FIXME: We must also notfiy allied players.
*/
void CPlayer::Notify(int type, int x, int y, const char *fmt, ...) const
void CPlayer::Notify(int, int x, int y, const char *fmt, ...) const
{
char temp[128];
va_list va;

View file

@ -509,7 +509,7 @@ bool LuaToBoolean(lua_State *l, int narg)
**
** @param fast set this flag to disable slow GC (during game)
*/
void CclGarbageCollect(int fast)
void CclGarbageCollect(int)
{
#if LUA_VERSION_NUM >= 501
DebugPrint("Garbage collect (before): %d\n" _C_
@ -1187,7 +1187,7 @@ std::string EvalString(const StringDesc *s)
**
** @param unitdesc struct to free
*/
void FreeUnitDesc(UnitDesc *unitdesc)
void FreeUnitDesc(UnitDesc *)
{
#if 0 // Nothing to free mow.
if (!unitdesc) {

View file

@ -930,7 +930,7 @@ int SelectGroundUnitsInRectangle(int sx0, int sy0, int sx1, int sy1)
}
int DoSelectAirUnitsInRectangle(int sx0, int sy0, int sx1, int sy1,
CUnit**table, int num_units = UnitMax)
CUnit**table)
{
CUnit *unit;
int r;

View file

@ -91,8 +91,8 @@ std::vector<SpellType*> SpellTypeTable;
**
** @return =!0 if spell should be repeated, 0 if not
*/
int Demolish::Cast(CUnit *caster, const SpellType *spell,
CUnit *target, int x, int y)
int Demolish::Cast(CUnit *caster, const SpellType *,
CUnit *, int x, int y)
{
int xmin;
int ymin;
@ -162,8 +162,8 @@ int Demolish::Cast(CUnit *caster, const SpellType *spell,
**
** @return =!0 if spell should be repeated, 0 if not
*/
int SpawnPortal::Cast(CUnit *caster, const SpellType *spell,
CUnit *target, int x, int y)
int SpawnPortal::Cast(CUnit *caster, const SpellType *,
CUnit *, int x, int y)
{
// FIXME: vladi: cop should be placed only on explored land
CUnit *portal;
@ -252,8 +252,8 @@ int AreaAdjustVitals::Cast(CUnit *caster, const SpellType *spell,
** @internal: vladi: blizzard differs than original in this way:
** original: launches 50 shards at 5 random spots x 10 for 25 mana.
*/
int AreaBombardment::Cast(CUnit *caster, const SpellType *spell,
CUnit *target, int x, int y)
int AreaBombardment::Cast(CUnit *caster, const SpellType *,
CUnit *, int x, int y)
{
int fields;
int shards;
@ -351,7 +351,7 @@ static void EvaluateMissileLocation(const SpellActionMissileLocation *location,
**
** @return =!0 if spell should be repeated, 0 if not
*/
int SpawnMissile::Cast(CUnit *caster, const SpellType *spell,
int SpawnMissile::Cast(CUnit *caster, const SpellType *,
CUnit *target, int x, int y)
{
::Missile *missile;
@ -390,8 +390,8 @@ int SpawnMissile::Cast(CUnit *caster, const SpellType *spell,
**
** @return =!0 if spell should be repeated, 0 if not
*/
int AdjustVariable::Cast(CUnit *caster, const SpellType *spell,
CUnit *target, int x, int y)
int AdjustVariable::Cast(CUnit *caster, const SpellType *,
CUnit *target, int, int)
{
for (unsigned int i = 0; i < UnitTypeVar.GetNumberVariable(); ++i) {
CUnit *unit = (this->Var[i].TargetIsCaster) ? caster : target;
@ -447,7 +447,7 @@ int AdjustVariable::Cast(CUnit *caster, const SpellType *spell,
** @return =!0 if spell should be repeated, 0 if not
*/
int AdjustVitals::Cast(CUnit *caster, const SpellType *spell,
CUnit *target, int x, int y)
CUnit *target, int, int)
{
int castcount;
int diffHP;
@ -603,7 +603,7 @@ int Polymorph::Cast(CUnit *caster, const SpellType *spell,
** @return =!0 if spell should be repeated, 0 if not
*/
int Capture::Cast(CUnit *caster, const SpellType *spell,
CUnit *target, int x, int y)
CUnit *target, int, int)
{
if (!target || caster->Player == target->Player) {
return 0;
@ -772,7 +772,7 @@ static Target *NewTargetPosition(int x, int y)
** @return true if passed, false otherwise.
*/
static bool PassCondition(const CUnit *caster, const SpellType *spell, const CUnit *target,
int x, int y, const ConditionInfo *condition)
int, int, const ConditionInfo *condition)
{
if (caster->Variable[MANA_INDEX].Value < spell->ManaCost) { // Check caster mana.
return false;

View file

@ -558,7 +558,7 @@ static void PrintHeader(void)
** @param argc Number of arguments.
** @param argv Vector of arguments.
*/
static int main1(int argc, char **argv)
static int main1(int, char **)
{
PrintHeader();
printf(

View file

@ -43,7 +43,7 @@ static bool WaitNoEvent; /// Flag got an event
/**
** Callback for input.
*/
static void WaitCallbackButtonPressed(unsigned dummy)
static void WaitCallbackButtonPressed(unsigned)
{
WaitNoEvent = false;
}
@ -51,14 +51,14 @@ static void WaitCallbackButtonPressed(unsigned dummy)
/**
** Callback for input.
*/
static void WaitCallbackButtonReleased(unsigned dummy)
static void WaitCallbackButtonReleased(unsigned)
{
}
/**
** Callback for input.
*/
static void WaitCallbackKeyPressed(unsigned dummy1, unsigned dummy2)
static void WaitCallbackKeyPressed(unsigned, unsigned)
{
WaitNoEvent = false;
}
@ -66,21 +66,21 @@ static void WaitCallbackKeyPressed(unsigned dummy1, unsigned dummy2)
/**
** Callback for input.
*/
static void WaitCallbackKeyReleased(unsigned dummy1, unsigned dummy2)
static void WaitCallbackKeyReleased(unsigned, unsigned)
{
}
/**
** Callback for input.
*/
static void WaitCallbackKeyRepeated(unsigned dummy1, unsigned dummy2)
static void WaitCallbackKeyRepeated(unsigned, unsigned)
{
}
/**
** Callback for input.
*/
static void WaitCallbackMouse(int x, int y)
static void WaitCallbackMouse(int, int)
{
}

View file

@ -308,7 +308,7 @@ TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def,
}
TOLUA_API int tolua_isvaluearray
(lua_State* L, int lo, int dim, int def, tolua_Error* err)
(lua_State* L, int lo, int, int def, tolua_Error* err)
{
if (!tolua_istable(L,lo,def,err))
return 0;

View file

@ -122,7 +122,7 @@ TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def)
return v;
}
TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def)
TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int)
{
int v;
lua_pushnumber(L,index);

View file

@ -59,7 +59,7 @@
**
** @return True if enabled.
*/
bool ButtonCheckTrue(const CUnit *unit, const ButtonAction *button)
bool ButtonCheckTrue(const CUnit *, const ButtonAction *)
{
return true;
}
@ -73,7 +73,7 @@ bool ButtonCheckTrue(const CUnit *unit, const ButtonAction *button)
**
** @return True if enabled.
*/
bool ButtonCheckFalse(const CUnit *unit, const ButtonAction *button)
bool ButtonCheckFalse(const CUnit *, const ButtonAction *)
{
return false;
}
@ -151,7 +151,7 @@ bool ButtonCheckUnitsAnd(const CUnit *unit, const ButtonAction *button)
**
** @note: this check could also be moved into intialisation.
*/
bool ButtonCheckNetwork(const CUnit *unit, const ButtonAction *button)
bool ButtonCheckNetwork(const CUnit *, const ButtonAction *)
{
return IsNetworkGame();
}
@ -166,7 +166,7 @@ bool ButtonCheckNetwork(const CUnit *unit, const ButtonAction *button)
**
** @note: this check could also be moved into intialisation.
*/
bool ButtonCheckNoNetwork(const CUnit *unit, const ButtonAction *button)
bool ButtonCheckNoNetwork(const CUnit *, const ButtonAction *)
{
return !IsNetworkGame();
}
@ -180,7 +180,7 @@ bool ButtonCheckNoNetwork(const CUnit *unit, const ButtonAction *button)
**
** @return True if enabled.
*/
bool ButtonCheckNoWork(const CUnit *unit, const ButtonAction *button)
bool ButtonCheckNoWork(const CUnit *unit, const ButtonAction *)
{
int action = unit->CurrentAction();
return action != UnitActionTrain &&
@ -196,7 +196,7 @@ bool ButtonCheckNoWork(const CUnit *unit, const ButtonAction *button)
**
** @return True if enabled.
*/
bool ButtonCheckNoResearch(const CUnit *unit, const ButtonAction *button)
bool ButtonCheckNoResearch(const CUnit *unit, const ButtonAction *)
{
int action = unit->CurrentAction();
return action != UnitActionUpgradeTo &&
@ -228,7 +228,7 @@ bool ButtonCheckUpgradeTo(const CUnit *unit, const ButtonAction *button)
**
** @return True if enabled.
*/
bool ButtonCheckAttack(const CUnit *unit, const ButtonAction *button)
bool ButtonCheckAttack(const CUnit *unit, const ButtonAction *)
{
return unit->Type->CanAttack;
}

View file

@ -198,7 +198,7 @@ void CIcon::DrawIcon(const CPlayer *player, int x, int y) const
** @param y Y display pixel position
** @param text Optional text to display
*/
void CIcon::DrawUnitIcon(const CPlayer *player, ButtonStyle *style,
void CIcon::DrawUnitIcon(const CPlayer *, ButtonStyle *style,
unsigned flags, int x, int y, const std::string &text) const
{
ButtonStyle s(*style);

View file

@ -966,7 +966,7 @@ static void Screenshot(void)
**
** @return 1 if modifier found, 0 otherwise
*/
int HandleKeyModifiersDown(unsigned key, unsigned keychar)
int HandleKeyModifiersDown(unsigned key, unsigned)
{
switch (key) {
case SDLK_LSHIFT:
@ -1012,7 +1012,7 @@ int HandleKeyModifiersDown(unsigned key, unsigned keychar)
**
** @return 1 if modifier found, 0 otherwise
*/
int HandleKeyModifiersUp(unsigned key, unsigned keychar)
int HandleKeyModifiersUp(unsigned key, unsigned)
{
switch (key) {
case SDLK_LSHIFT:
@ -1141,7 +1141,7 @@ void HandleKeyUp(unsigned key, unsigned keychar)
** @param key Key scancode.
** @param keychar Character code.
*/
void HandleKeyRepeat(unsigned key, unsigned keychar)
void HandleKeyRepeat(unsigned, unsigned keychar)
{
if (KeyState == KeyStateInput && keychar) {
InputKey(keychar);
@ -1401,7 +1401,7 @@ void InputMouseMove(const EventCallback *callbacks,
** @param ticks Denotes time-stamp of video-system
**
*/
void InputMouseExit(const EventCallback *callbacks, unsigned ticks)
void InputMouseExit(const EventCallback *callbacks, unsigned)
{
// FIXME: should we do anything here with ticks? don't know, but conform others
// JOHNS: called by callback HandleMouseExit();

View file

@ -468,7 +468,7 @@ void CContentTypeFormattedText2::Draw(const CUnit *unit, CFont *defaultfont) con
** @param unit unit with icon to show.
** @param defaultfont unused.
*/
void CContentTypeIcon::Draw(const CUnit *unit, CFont *defaultfont) const
void CContentTypeIcon::Draw(const CUnit *unit, CFont *) const
{
Assert(unit);
unit = GetUnitRef(unit, this->UnitRef);
@ -486,7 +486,7 @@ void CContentTypeIcon::Draw(const CUnit *unit, CFont *defaultfont) const
**
** @todo Color and percent value Parametrisation.
*/
void CContentTypeLifeBar::Draw(const CUnit *unit, CFont *defaultfont) const
void CContentTypeLifeBar::Draw(const CUnit *unit, CFont *) const
{
Assert(unit);
Assert((unsigned int) this->Index < UnitTypeVar.GetNumberVariable());
@ -524,7 +524,7 @@ void CContentTypeLifeBar::Draw(const CUnit *unit, CFont *defaultfont) const
**
** @todo Color and percent value Parametrisation.
*/
void CContentTypeCompleteBar::Draw(const CUnit *unit, CFont *defaultfont) const
void CContentTypeCompleteBar::Draw(const CUnit *unit, CFont *) const
{
Assert(unit);
Assert((unsigned int) this->Index < UnitTypeVar.GetNumberVariable());

View file

@ -1263,7 +1263,7 @@ static void SendCommand(int sx, int sy)
** @param num Button number.
** @param button Mouse Button pressed.
*/
static void DoSelectionButtons(int num, unsigned button)
static void DoSelectionButtons(int num, unsigned)
{
if (GameObserve || GamePaused) {
return;
@ -1309,7 +1309,7 @@ static void DoSelectionButtons(int num, unsigned button)
**
** @param button Button pressed down.
*/
static void UISelectStateButtonDown(unsigned button)
static void UISelectStateButtonDown(unsigned)
{
if (GameObserve || GamePaused) {
return;

View file

@ -62,10 +62,10 @@ static std::stack<MenuScreen *> MenuStack;
----------------------------------------------------------------------------*/
static void MenuHandleButtonDown(unsigned buttons)
static void MenuHandleButtonDown(unsigned)
{
}
static void MenuHandleButtonUp(unsigned buttons)
static void MenuHandleButtonUp(unsigned)
{
}
static void MenuHandleMouseMove(int x, int y)
@ -149,11 +149,15 @@ void handleInput(const SDL_Event *event)
{
if (event) {
if (Input) {
#ifndef DEBUG
try {
#endif
Input->pushInput(*event);
#ifndef DEBUG
} catch (const gcn::Exception &) {
// ignore unhandled buttons
}
#endif
}
} else {
if (Gui) {
@ -493,7 +497,7 @@ void ImageRadioButton::draw(gcn::Graphics *graphics)
/**
** Mouse button pressed callback
*/
void ImageRadioButton::mousePress(int x, int y, int button)
void ImageRadioButton::mousePress(int, int, int button)
{
if (button == gcn::MouseInput::LEFT && hasMouse()) {
mMouseDown = true;
@ -503,7 +507,7 @@ void ImageRadioButton::mousePress(int x, int y, int button)
/**
** Mouse button released callback
*/
void ImageRadioButton::mouseRelease(int x, int y, int button)
void ImageRadioButton::mouseRelease(int, int, int button)
{
if (button == gcn::MouseInput::LEFT) {
mMouseDown = false;
@ -513,7 +517,7 @@ void ImageRadioButton::mouseRelease(int x, int y, int button)
/**
** Mouse clicked callback
*/
void ImageRadioButton::mouseClick(int x, int y, int button, int count)
void ImageRadioButton::mouseClick(int, int, int button, int)
{
if (button == gcn::MouseInput::LEFT) {
setMarked(true);
@ -629,7 +633,7 @@ void ImageCheckBox::drawBox(gcn::Graphics *graphics)
/**
** Mouse button pressed callback
*/
void ImageCheckBox::mousePress(int x, int y, int button)
void ImageCheckBox::mousePress(int, int, int button)
{
if (button == gcn::MouseInput::LEFT && hasMouse()) {
mMouseDown = true;
@ -639,7 +643,7 @@ void ImageCheckBox::mousePress(int x, int y, int button)
/**
** Mouse button released callback
*/
void ImageCheckBox::mouseRelease(int x, int y, int button)
void ImageCheckBox::mouseRelease(int, int, int button)
{
if (button == gcn::MouseInput::LEFT) {
mMouseDown = false;
@ -649,7 +653,7 @@ void ImageCheckBox::mouseRelease(int x, int y, int button)
/**
** Mouse clicked callback
*/
void ImageCheckBox::mouseClick(int x, int y, int button, int count)
void ImageCheckBox::mouseClick(int, int, int button, int)
{
if (button == gcn::MouseInput::LEFT) {
toggle();

View file

@ -102,7 +102,7 @@ bool CBuildRestrictionAnd::Check(const CUnitType *type, int x, int y, CUnit *&on
/**
** Check Distance Restriction
*/
bool CBuildRestrictionDistance::Check(const CUnitType *type, int x, int y, CUnit *&ontoptarget) const
bool CBuildRestrictionDistance::Check(const CUnitType *type, int x, int y, CUnit *&) const
{
CUnit *table[UnitMax];
int n;
@ -180,7 +180,7 @@ inline bool CBuildRestrictionAddOn::functor::operator() (const CUnit *const unit
/**
** Check AddOn Restriction
*/
bool CBuildRestrictionAddOn::Check(const CUnitType *type, int x, int y, CUnit *&ontoptarget) const
bool CBuildRestrictionAddOn::Check(const CUnitType *, int x, int y, CUnit *&) const
{
int x1;
int y1;
@ -216,7 +216,7 @@ inline bool CBuildRestrictionOnTop::functor::operator() (CUnit *const unit)
return true;
}
bool CBuildRestrictionOnTop::Check(const CUnitType *type, int x, int y, CUnit *&ontoptarget) const
bool CBuildRestrictionOnTop::Check(const CUnitType *, int x, int y, CUnit *&ontoptarget) const
{
#if 0
CUnit *table[UnitMax];

View file

@ -440,7 +440,7 @@ static int CclDefineDependency(lua_State *l)
*/
static int CclGetDependency(lua_State *l)
{
DebugPrint("FIXME: write this %p\n" _C_ l);
DebugPrint("FIXME: write this %p\n" _C_ (void*)l);
return 0;
}
@ -454,7 +454,7 @@ static int CclGetDependency(lua_State *l)
*/
static int CclCheckDependency(lua_State *l)
{
DebugPrint("FIXME: write this %p\n" _C_ l);
DebugPrint("FIXME: write this %p\n" _C_ (void *)l);
return 0;
}

View file

@ -1266,7 +1266,7 @@ static int CclSetUnitTypeName(lua_State *l)
/**
** Add a label
*/
static void AddLabel(lua_State *l, CAnimation *anim, const std::string &name)
static void AddLabel(lua_State *, CAnimation *anim, const std::string &name)
{
LabelsStruct label;
label.Anim = anim;
@ -1291,7 +1291,7 @@ static CAnimation *FindLabel(lua_State *l, const std::string &name)
/**
** Find a label later
*/
static void FindLabelLater(lua_State *l, CAnimation **anim, const std::string &name)
static void FindLabelLater(lua_State *, CAnimation **anim, const std::string &name)
{
LabelsLaterStruct label;
label.Anim = anim;

View file

@ -190,8 +190,8 @@ void DrawUnitSelection(const CViewport *vp, const CUnit *unit)
** @param x1,y1 Coordinates of the top left corner.
** @param x2,y2 Coordinates of the bottom right corner.
*/
void DrawSelectionNone(Uint32 color, int x1, int y1,
int x2, int y2)
void DrawSelectionNone(Uint32, int, int,
int, int)
{
}
@ -483,7 +483,7 @@ void CDecoVarBar::Draw(int x, int y,
** @todo fix font/color configuration.
*/
void CDecoVarText::Draw(int x, int y,
const CUnitType *Type, const CVariable &Variable) const
const CUnitType *, const CVariable &Variable) const
{
if (this->IsCenteredInX) {
x -= 2; // GameFont->Width(buf) / 2, with buf = str(Value)
@ -503,7 +503,7 @@ void CDecoVarText::Draw(int x, int y,
** @todo fix sprite configuration.
*/
void CDecoVarSpriteBar::Draw(int x, int y,
const CUnitType *Type, const CVariable &Variable) const
const CUnitType *, const CVariable &Variable) const
{
int n; // frame of the sprite to show.
CGraphic *sprite; // the sprite to show.
@ -539,7 +539,7 @@ void CDecoVarSpriteBar::Draw(int x, int y,
** @todo fix sprite configuration configuration.
*/
void CDecoVarStaticSprite::Draw(int x, int y,
const CUnitType *Type, const CVariable &Variable) const
const CUnitType *, const CVariable &) const
{
CGraphic *sprite; // the sprite to show.
Decoration *decosprite; // Info on the sprite.

View file

@ -529,7 +529,7 @@ void DrawLineClip(Uint32 color, int sx, int sy, int dx, int dy)
** Draw a transparent line
*/
void DrawTransLine(Uint32 color, int sx, int sy,
int dx, int dy, unsigned char alpha)
int dx, int dy, unsigned char)
{
// FIXME: trans
DrawLine(color, sx, sy, dx, dy);
@ -539,7 +539,7 @@ void DrawTransLine(Uint32 color, int sx, int sy,
** Draw a transparent line clipped
*/
void DrawTransLineClip(Uint32 color, int sx, int sy,
int dx, int dy, unsigned char alpha)
int dx, int dy, unsigned char)
{
// FIXME: trans
DrawLineClip(color, sx, sy, dx, dy);
@ -1437,7 +1437,7 @@ void DrawLineClip(Uint32 color, int x1, int y1, int x2, int y2)
** Draw a transparent line
*/
void DrawTransLine(Uint32 color, int sx, int sy,
int dx, int dy, unsigned char alpha)
int dx, int dy, unsigned char)
{
// FIXME: trans
DrawLine(color, sx, sy, dx, dy);
@ -1447,7 +1447,7 @@ void DrawTransLine(Uint32 color, int sx, int sy,
** Draw a transparent line clipped
*/
void DrawTransLineClip(Uint32 color, int sx, int sy,
int dx, int dy, unsigned char alpha)
int dx, int dy, unsigned char)
{
// FIXME: trans
DrawLineClip(color, sx, sy, dx, dy);

View file

@ -71,30 +71,30 @@ static int MovieStop;
** Callbacks for movie input.
*/
static void MovieCallbackButtonPressed(unsigned dummy)
static void MovieCallbackButtonPressed(unsigned)
{
MovieStop = 1;
}
static void MovieCallbackButtonReleased(unsigned dummy)
static void MovieCallbackButtonReleased(unsigned)
{
}
static void MovieCallbackKeyPressed(unsigned dummya, unsigned dummyb)
static void MovieCallbackKeyPressed(unsigned, unsigned)
{
MovieStop = 1;
}
static void MovieCallbackKeyReleased(unsigned dummya, unsigned dummyb)
static void MovieCallbackKeyReleased(unsigned, unsigned)
{
}
static void MovieCallbackKeyRepeated(unsigned dummya, unsigned dummyb)
static void MovieCallbackKeyRepeated(unsigned, unsigned)
{
}
static void MovieCallbackMouseMove(int dummya, int dummyb)
static void MovieCallbackMouseMove(int, int)
{
}

View file

@ -212,19 +212,19 @@ static void InitOpenGLExtensions()
if (IsExtensionSupported("GL_ARB_texture_compression"))
{
glCompressedTexImage3DARB =
(PFNGLCOMPRESSEDTEXIMAGE3DARBPROC)SDL_GL_GetProcAddress("glCompressedTexImage3DARB");
(PFNGLCOMPRESSEDTEXIMAGE3DARBPROC)(uintptr_t)SDL_GL_GetProcAddress("glCompressedTexImage3DARB");
glCompressedTexImage2DARB =
(PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)SDL_GL_GetProcAddress("glCompressedTexImage2DARB");
(PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)(uintptr_t)SDL_GL_GetProcAddress("glCompressedTexImage2DARB");
glCompressedTexImage1DARB =
(PFNGLCOMPRESSEDTEXIMAGE1DARBPROC)SDL_GL_GetProcAddress("glCompressedTexImage1DARB");
(PFNGLCOMPRESSEDTEXIMAGE1DARBPROC)(uintptr_t)SDL_GL_GetProcAddress("glCompressedTexImage1DARB");
glCompressedTexSubImage3DARB =
(PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC)SDL_GL_GetProcAddress("glCompressedTexSubImage3DARB");
(PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC)(uintptr_t)SDL_GL_GetProcAddress("glCompressedTexSubImage3DARB");
glCompressedTexSubImage2DARB =
(PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC)SDL_GL_GetProcAddress("glCompressedTexSubImage2DARB");
(PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC)(uintptr_t)SDL_GL_GetProcAddress("glCompressedTexSubImage2DARB");
glCompressedTexSubImage1DARB =
(PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC)SDL_GL_GetProcAddress("glCompressedTexSubImage1DARB");
(PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC)(uintptr_t)SDL_GL_GetProcAddress("glCompressedTexSubImage1DARB");
glGetCompressedTexImageARB =
(PFNGLGETCOMPRESSEDTEXIMAGEARBPROC)SDL_GL_GetProcAddress("glGetCompressedTexImageARB");
(PFNGLGETCOMPRESSEDTEXIMAGEARBPROC)(uintptr_t)SDL_GL_GetProcAddress("glGetCompressedTexImageARB");
if (glCompressedTexImage3DARB && glCompressedTexImage2DARB &&
glCompressedTexImage1DARB && glCompressedTexSubImage3DARB &&
@ -319,7 +319,7 @@ void ReloadOpenGL()
}
#if defined(DEBUG) && !defined(USE_WIN32)
static void CleanExit(int signum)
static void CleanExit(int)
{
// Clean SDL
SDL_Quit();