Maelstrom: Fixed lots of warnings

https://github.com/libsdl-org/Maelstrom/commit/42a43d55a6d16b012de4bfcc186b9ff73f7a8c68

From 42a43d55a6d16b012de4bfcc186b9ff73f7a8c68 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 31 Oct 2011 06:33:54 -0400
Subject: [PATCH] Fixed lots of warnings

---
 MaelstromUI.cpp              |  4 ++--
 controls.cpp                 | 39 ------------------------------------
 fastrand.cpp                 |  2 ++
 load.h                       |  2 +-
 maclib/Mac_FontServ.cpp      |  4 +---
 maclib/Mac_Resource.h        |  2 +-
 maclib/applefile.h           |  8 ++++----
 main.cpp                     |  2 --
 myerror.cpp                  |  7 +------
 netlogic/game.cpp            |  4 +---
 netlogic/make.cpp            |  1 +
 screenlib/SDL_FrameBuf.cpp   |  1 -
 screenlib/UIArea.cpp         |  3 ---
 screenlib/UIDialogButton.cpp |  2 --
 screenlib/UIElementLabel.cpp |  3 ---
 screenlib/UIElementLine.cpp  |  2 --
 screenlib/UIElementRadio.cpp |  1 +
 screenlib/UIElementRect.cpp  |  3 ---
 screenlib/UIManager.cpp      |  2 +-
 screenlib/UIPanel.cpp        |  2 --
 screenlib/UITemplates.cpp    |  2 +-
 21 files changed, 17 insertions(+), 79 deletions(-)

diff --git a/MaelstromUI.cpp b/MaelstromUI.cpp
index 7e9294b0..88cba024 100644
--- a/MaelstromUI.cpp
+++ b/MaelstromUI.cpp
@@ -78,7 +78,7 @@ MaelstromUI::~MaelstromUI()
 MFont *
 MaelstromUI::GetFont(const char *fontName, int fontSize)
 {
-	char *key, *keycopy;
+	char *key;
 	int keysize;
 	MFont *font;
 
@@ -105,7 +105,7 @@ MaelstromUI::CreateText(const char *text, const char *fontName, int fontSize, UI
 {
 	MFont *font;
 	Uint8 style;
-	char *key, *keycopy;
+	char *key;
 	int keysize;
 	SDL_Texture *texture;
 
diff --git a/controls.cpp b/controls.cpp
index 21be2ab6..08b01e24 100644
--- a/controls.cpp
+++ b/controls.cpp
@@ -52,45 +52,6 @@ Uint8 gSoundLevel = 4;
 Uint8 gGammaCorrect = 3;
 
 
-/* Map a keycode to a key name */
-void KeyName(SDL_Keycode keycode, char *namebuf)
-{
-	const char *name;
-	char ch;
-	int starting;
-
-	/* Get the name of the key */
-	name = SDL_GetKeyName(keycode);
-
-	/* Add "arrow" to the arrow keys */
-	if ( strcmp(name, "up") == 0 ) {
-		name = "up arrow";
-	} else
-	if ( strcmp(name, "down") == 0 ) {
-		name = "down arrow";
-	} else
-	if ( strcmp(name, "right") == 0 ) {
-		name = "right arrow";
-	} else
-	if ( strcmp(name, "left") == 0 ) {
-		name = "left arrow";
-	}
-	/* Make the key names uppercased */
-	for ( starting = 1; *name; ++name ) {
-		ch = *name;
-		if ( starting ) {
-			if ( islower(ch) )
-				ch = toupper(ch);
-			starting = 0;
-		} else {
-			if ( ch == ' ' )
-				starting = 1;
-		}
-		*namebuf++ = ch;
-	}
-	*namebuf = '\0';
-}
-
 static FILE *OpenData(const char *mode, char **fname)
 {
 	static char datafile[BUFSIZ];
diff --git a/fastrand.cpp b/fastrand.cpp
index c0164918..9ead03f2 100644
--- a/fastrand.cpp
+++ b/fastrand.cpp
@@ -28,6 +28,8 @@
 
 #include "SDL_types.h"
 
+#include "fastrand.h"
+
 static Uint32 randomSeed;
 
 void SeedRandom(Uint32 Seed)
diff --git a/load.h b/load.h
index b1fc6459..351ba4c0 100644
--- a/load.h
+++ b/load.h
@@ -23,7 +23,7 @@
 #ifndef _load_h
 #define _load_h
 
-#include <physfs.h>
+#include "physfs.h"
 #include "utils/physfsrwops.h"
 
 #include "screenlib/SDL_FrameBuf.h"
diff --git a/maclib/Mac_FontServ.cpp b/maclib/Mac_FontServ.cpp
index 24cb73d9..f70ec9eb 100644
--- a/maclib/Mac_FontServ.cpp
+++ b/maclib/Mac_FontServ.cpp
@@ -100,7 +100,7 @@ FontServ:: NewFont(const char *fontname, int ptsize)
 	int nchars;		/* number of chars including 'missing char' */
 	int nwords;		/* bit image size, in words */
 	int i, swapfont;
-	MFont *prev, *font;
+	MFont *font;
 
 	/* Get the font family */
 	fond = fontres->Resource("FOND", fontname);
@@ -264,8 +264,6 @@ FontServ:: TextHeight(MFont *font)
 SDL_Texture *
 FontServ:: TextImage(const char *text, MFont *font, Uint8 style, SDL_Color fg)
 {
-	char *key, *keycopy;
-	int keysize;
 	int width, height;
 	SDL_Texture *image;
 	Uint32 *bitmap;
diff --git a/maclib/Mac_Resource.h b/maclib/Mac_Resource.h
index 35fc8368..60bd9058 100644
--- a/maclib/Mac_Resource.h
+++ b/maclib/Mac_Resource.h
@@ -31,7 +31,7 @@ Note: Most of the info in this file came from "Inside Macintosh"
 
 #include <stdio.h>
 #include <stdarg.h>
-#include <physfs.h>
+#include "physfs.h"
 
 /* The actual resources in the resource fork */
 typedef struct {
diff --git a/maclib/applefile.h b/maclib/applefile.h
index f9c3a24b..3c5076e2 100644
--- a/maclib/applefile.h
+++ b/maclib/applefile.h
@@ -75,12 +75,12 @@ typedef struct FInfo FInfo;
 
 #define F_fOnDesk       0x0001 /* file is on desktop (HFS only) */
 #define F_maskColor     0x000E /* color coding (3 bits) */
-/*                      0x0010 /* reserved (System 7) */
+//                      0x0010 /* reserved (System 7) */
 #define F_fSwitchLaunch 0x0020 /* reserved (System 7) */
 #define F_fShared       0x0040 /* appl available to multiple users */
 #define F_fNoINITs      0x0080 /* file contains no INIT resources */
 #define F_fBeenInited   0x0100 /* Finder has loaded bundle res. */
-/*                      0x0200  /* reserved (System 7) */
+//                      0x0200  /* reserved (System 7) */
 #define F_fCustomIcom   0x0400 /* file contains custom icon */
 #define F_fStationary   0x0800 /* file is a stationary pad */
 #define F_fNameLocked   0x1000 /* file can't be renamed by Finder */
@@ -139,7 +139,7 @@ typedef struct ASEntry ASEntry;
 #define AS_COMMENT      4 /* standard Mac comment */
 #define AS_ICONBW       5 /* Mac black & white icon */
 #define AS_ICONCOLOR    6 /* Mac color icon */
-        /*              7       /* not used */
+//			7       /* not used */
 #define AS_FILEDATES    8 /* file dates; create, modify, etc */
 #define AS_FINDERINFO   9 /* Mac Finder info & extended info */
 #define AS_MACINFO      10 /* Mac file info, attributes, etc */
@@ -330,7 +330,7 @@ struct AppleSingle /* format of disk file */
 {
     ASHeader header; /* AppleSingle header part */
     ASEntry  entry[1]; /* array of entry descriptors */
-/* Uint8   filedata[];          /* followed by rest of file */
+//  Uint8   filedata[];          /* followed by rest of file */
 }; /* AppleSingle */
 
 typedef struct AppleSingle AppleSingle;
diff --git a/main.cpp b/main.cpp
index 657a57c1..8b37bdc8 100644
--- a/main.cpp
+++ b/main.cpp
@@ -501,8 +501,6 @@ void Message(const char *message)
 // FIXME: This totally doesn't work anymore, but that may not matter if we're cutting network support.
 	int x, y;
 	SDL_Texture *textimage;
-	int width;
-
 	if (!message) {
 		return;
 	}
diff --git a/myerror.cpp b/myerror.cpp
index ab69be66..00cfea21 100644
--- a/myerror.cpp
+++ b/myerror.cpp
@@ -20,9 +20,6 @@
     slouken@libsdl.org
 */
 
-#ifndef _myerror_h
-#define _myerror_h
-
 /* Generic error message routines */
 
 #include <stdio.h>
@@ -30,6 +27,7 @@
 #include <string.h>
 #include <errno.h>
 
+#include "myerror.h"
 
 void error(const char *fmt, ...)
 {
@@ -63,6 +61,3 @@ void myperror(const char *msg)
 	} else
 		error((char *)strerror(errno));
 }
-
-#endif /* _myerror_h */
-
diff --git a/netlogic/game.cpp b/netlogic/game.cpp
index 3bd24328..cf7c29ad 100644
--- a/netlogic/game.cpp
+++ b/netlogic/game.cpp
@@ -424,7 +424,7 @@ GamePanelDelegate::DrawStatus(Bool first)
 	static int lastScores[MAX_PLAYERS], lastLife[MAX_PLAYERS];
 	int Score;
 	int MultFactor;
-	int i, x;
+	int i;
 	char numbuf[128];
 
 /* -- Draw the status display */
@@ -1023,8 +1023,6 @@ static void DoGameOver(void)
 		while ( screen->PollEvent(&event) ) /* Loop, flushing events */;
 		SDL_StartTextInput();
 		while ( label && !done ) {
-			bool updated = false;
-
 			screen->WaitEvent(&event);
 
 			if ( event.type == SDL_KEYUP ) {
diff --git a/netlogic/make.cpp b/netlogic/make.cpp
index 30fd2eae..b353f3d9 100644
--- a/netlogic/make.cpp
+++ b/netlogic/make.cpp
@@ -21,6 +21,7 @@
 */
 
 #include "../Maelstrom_Globals.h"
+#include "make.h"
 #include "netplay.h"
 #include "object.h"
 #include "player.h"
diff --git a/screenlib/SDL_FrameBuf.cpp b/screenlib/SDL_FrameBuf.cpp
index 1367ffa2..33ace8fb 100644
--- a/screenlib/SDL_FrameBuf.cpp
+++ b/screenlib/SDL_FrameBuf.cpp
@@ -212,7 +212,6 @@ FrameBuf:: LoadImage(int w, int h, Uint8 *pixels, Uint8 *mask)
 	int i, j, pad;
 	Uint8 *pix_mem;
 	Uint32 *art_mem;
-	int retval;
 
 	/* Assume 8-bit artwork using the current palette */
 	artwork = new Uint32[w*h];
diff --git a/screenlib/UIArea.cpp b/screenlib/UIArea.cpp
index 00c5aca1..afd43bee 100644
--- a/screenlib/UIArea.cpp
+++ b/screenlib/UIArea.cpp
@@ -58,8 +58,6 @@ UIArea::Load(rapidxml::xml_node<> *node)
 
 	child = node->first_node("anchor", 0, false);
 	if (child) {
-		int x, y;
-
 		attr = child->first_attribute("anchor", 0, false);
 		if (m_anchor.element) {
 			m_anchor.element->DelAnchoredArea(this);
@@ -235,7 +233,6 @@ UIArea::LoadColor(rapidxml::xml_node<> *node, const char *name, Uint32 &value)
 
 	child = node->first_node("color", 0, false);
 	if (child) {
-		rapidxml::xml_attribute<> *attr;
 		int r = 0xFF, g = 0xFF, b = 0xFF;
 
 		LoadNumber(child, "r", r);
diff --git a/screenlib/UIDialogButton.cpp b/screenlib/UIDialogButton.cpp
index 1dae61bd..5e1b2966 100644
--- a/screenlib/UIDialogButton.cpp
+++ b/screenlib/UIDialogButton.cpp
@@ -39,8 +39,6 @@ UIDialogButton::UIDialogButton(UIBaseElement *parent, const char *name) :
 bool
 UIDialogButton::Load(rapidxml::xml_node<> *node, const UITemplates *templates)
 {
-	rapidxml::xml_attribute<> *attr;
-
 	if (!UIElementButton::Load(node, templates)) {
 		return false;
 	}
diff --git a/screenlib/UIElementLabel.cpp b/screenlib/UIElementLabel.cpp
index 1a18a7a1..96b3cfd1 100644
--- a/screenlib/UIElementLabel.cpp
+++ b/screenlib/UIElementLabel.cpp
@@ -65,7 +65,6 @@ static UIFontStyle ParseStyle(const char *text)
 bool
 UIElementLabel::Load(rapidxml::xml_node<> *node, const UITemplates *templates)
 {
-	rapidxml::xml_node<> *child;
 	rapidxml::xml_attribute<> *attr;
 
 	if (!UIElement::Load(node, templates)) {
@@ -93,8 +92,6 @@ UIElementLabel::Load(rapidxml::xml_node<> *node, const UITemplates *templates)
 void
 UIElementLabel::SetText(const char *text)
 {
-	SDL_Texture *texture;
-
 	if (!m_fontName || !m_fontSize) {
 		SetError("You must set a font first");
 		return;
diff --git a/screenlib/UIElementLine.cpp b/screenlib/UIElementLine.cpp
index 92827894..388055a2 100644
--- a/screenlib/UIElementLine.cpp
+++ b/screenlib/UIElementLine.cpp
@@ -34,8 +34,6 @@ UIElementLine::UIElementLine(UIBaseElement *parent, const char *name) :
 bool
 UIElementLine::Load(rapidxml::xml_node<> *node, const UITemplates *templates)
 {
-	rapidxml::xml_node<> *child;
-
 	if (!UIElement::Load(node, templates)) {
 		return false;
 	}
diff --git a/screenlib/UIElementRadio.cpp b/screenlib/UIElementRadio.cpp
index 0715b2a3..ae836446 100644
--- a/screenlib/UIElementRadio.cpp
+++ b/screenlib/UIElementRadio.cpp
@@ -96,6 +96,7 @@ UIElementRadioButton::FinishLoading()
 			assert(!"Need code for labels on the left");
 		}
 	}
+	return true;
 }
 
 void
diff --git a/screenlib/UIElementRect.cpp b/screenlib/UIElementRect.cpp
index 55b67cab..f37b279f 100644
--- a/screenlib/UIElementRect.cpp
+++ b/screenlib/UIElementRect.cpp
@@ -35,9 +35,6 @@ UIElementRect::UIElementRect(UIBaseElement *parent, const char *name) :
 bool
 UIElementRect::Load(rapidxml::xml_node<> *node, const UITemplates *templates)
 {
-	rapidxml::xml_node<> *child;
-	rapidxml::xml_attribute<> *attr;
-
 	if (!UIElement::Load(node, templates)) {
 		return false;
 	}
diff --git a/screenlib/UIManager.cpp b/screenlib/UIManager.cpp
index 813cd4bf..ebee156d 100644
--- a/screenlib/UIManager.cpp
+++ b/screenlib/UIManager.cpp
@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#include <physfs.h>
+#include "physfs.h"
 
 #include "SDL_FrameBuf.h"
 #include "UIManager.h"
diff --git a/screenlib/UIPanel.cpp b/screenlib/UIPanel.cpp
index b9133f16..c309b573 100644
--- a/screenlib/UIPanel.cpp
+++ b/screenlib/UIPanel.cpp
@@ -52,8 +52,6 @@ UIPanel::~UIPanel()
 bool
 UIPanel::Load(rapidxml::xml_node<> *node, const UITemplates *templates)
 {
-	rapidxml::xml_attribute<> *attr;
-
 	if (!UIBaseElement::Load(node, templates)) {
 		return false;
 	}
diff --git a/screenlib/UITemplates.cpp b/screenlib/UITemplates.cpp
index f3f7fadf..bf5c616a 100644
--- a/screenlib/UITemplates.cpp
+++ b/screenlib/UITemplates.cpp
@@ -21,7 +21,7 @@
 
 #include <stdio.h>
 #include <strings.h>
-#include <physfs.h>
+#include "physfs.h"
 
 #include "UITemplates.h"