summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2017-01-13 11:07:06 +0000
committerJose Fonseca <jfonseca@vmware.com>2017-01-13 11:07:06 +0000
commit7a9a12198c6e0e4d110dd9cbe6b407b49f8270d7 (patch)
tree9efe357f4d18ec1b9f969a11174775df2306695a
parent0d41e4b4a114c0af3d0ae7964c251aee00f63fc3 (diff)
downloadmesa-demos-7a9a12198c6e0e4d110dd9cbe6b407b49f8270d7.zip
mesa-demos-7a9a12198c6e0e4d110dd9cbe6b407b49f8270d7.tar.xz
wgl/rotex: Address compiler warnings.
Ensure we preserve the const-ness of static string constants. Trivial.
-rw-r--r--src/wgl/rtotex/image.cpp20
-rw-r--r--src/wgl/rtotex/image.h22
-rw-r--r--src/wgl/rtotex/log.cpp11
-rw-r--r--src/wgl/rtotex/log.h8
-rw-r--r--src/wgl/rtotex/window.cpp2
-rw-r--r--src/wgl/rtotex/window.h6
6 files changed, 33 insertions, 36 deletions
diff --git a/src/wgl/rtotex/image.cpp b/src/wgl/rtotex/image.cpp
index 7598b5f..c6561d3 100644
--- a/src/wgl/rtotex/image.cpp
+++ b/src/wgl/rtotex/image.cpp
@@ -16,7 +16,7 @@
extern LOG errorLog;
//Load - load a texture from a file
-bool IMAGE::Load(char * filename)
+bool IMAGE::Load(const char * filename)
{
//Clear the data if already used
if(data)
@@ -47,7 +47,7 @@ bool IMAGE::Load(char * filename)
-bool IMAGE::LoadBMP(char * filename)
+bool IMAGE::LoadBMP(const char * filename)
{
FILE * file; //the texture file
BITMAPFILEHEADER fileHeader; //bitmap file header
@@ -90,7 +90,7 @@ bool IMAGE::LoadBMP(char * filename)
//Load24BitBMP - load a 24 bit bitmap file
-bool IMAGE::Load24BitBMP(char * filename)
+bool IMAGE::Load24BitBMP(const char * filename)
{
errorLog.OutputSuccess("Loading %s in Load24bitBMP()", filename);
@@ -172,7 +172,7 @@ bool IMAGE::Load24BitBMP(char * filename)
}
//Load8BitBMP - load an 8 bit paletted bitmap file
-bool IMAGE::Load8BitBMP(char * filename)
+bool IMAGE::Load8BitBMP(const char * filename)
{
errorLog.OutputSuccess("Loading %s in Load8bitBMP()", filename);
@@ -274,7 +274,7 @@ bool IMAGE::Load8BitBMP(char * filename)
//LoadPCX - load a .pcx texture - 256 color, paletted
-bool IMAGE::LoadPCX(char * filename)
+bool IMAGE::LoadPCX(const char * filename)
{
errorLog.OutputSuccess("Loading %s in LoadPCX()", filename);
@@ -406,7 +406,7 @@ bool IMAGE::LoadPCX(char * filename)
//Load a TGA texture
-bool IMAGE::LoadTGA(char * filename)
+bool IMAGE::LoadTGA(const char * filename)
{
unsigned char UncompressedTGAHeader[12]={0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0};
unsigned char CompressedTGAHeader[12]={0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0};
@@ -448,7 +448,7 @@ bool IMAGE::LoadTGA(char * filename)
}
//load an 8 bit uncompressed paletted TGA
-bool IMAGE::LoadUncompressed8BitTGA(char * filename)
+bool IMAGE::LoadUncompressed8BitTGA(const char * filename)
{
unsigned char TGAHeader[12]={0, 1, 1, 0, 0, 0, 1, 24, 0, 0, 0, 0};
unsigned char TGAcompare[12]; //Used to compare TGA header
@@ -544,7 +544,7 @@ bool IMAGE::LoadUncompressed8BitTGA(char * filename)
//load an uncompressed TGA texture (24 or 32 bpp)
-bool IMAGE::LoadUncompressedTrueColorTGA(char * filename)
+bool IMAGE::LoadUncompressedTrueColorTGA(const char * filename)
{
unsigned char TGAheader[12]={0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0}; //Uncompressed TGA header
unsigned char TGAcompare[12]; //Used to compare TGA header
@@ -632,7 +632,7 @@ bool IMAGE::LoadUncompressedTrueColorTGA(char * filename)
//load a compressed TGA texture (24 or 32 bpp)
-bool IMAGE::LoadCompressedTrueColorTGA(char * filename)
+bool IMAGE::LoadCompressedTrueColorTGA(const char * filename)
{
unsigned char TGAheader[12]={0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0}; //Compressed TGA header
unsigned char TGAcompare[12]; //Used to compare TGA header
@@ -820,7 +820,7 @@ bool IMAGE::LoadCompressedTrueColorTGA(char * filename)
//load in an 8 bit greyscale TGA as an alpha channel
-bool IMAGE::LoadAlphaTGA(char * filename)
+bool IMAGE::LoadAlphaTGA(const char * filename)
{
unsigned char TGAHeader[12]={0, 1, 1, 0, 0, 0, 1, 24, 0, 0, 0, 0};
unsigned char TGAcompare[12]; //Used to compare TGA header
diff --git a/src/wgl/rtotex/image.h b/src/wgl/rtotex/image.h
index e56d542..bbd2b1a 100644
--- a/src/wgl/rtotex/image.h
+++ b/src/wgl/rtotex/image.h
@@ -27,21 +27,21 @@ public:
data=NULL;
}
- bool Load(char * filename); //load a texture from a file
+ bool Load(const char * filename); //load a texture from a file
- bool LoadBMP(char * filename); //Load BMP
- bool Load24BitBMP(char * filename);
- bool Load8BitBMP(char * filename);
+ bool LoadBMP(const char * filename); //Load BMP
+ bool Load24BitBMP(const char * filename);
+ bool Load8BitBMP(const char * filename);
- bool LoadPCX(char * filename); //Load PCX
+ bool LoadPCX(const char * filename); //Load PCX
- bool LoadTGA(char * filename); //Load TGA
- bool LoadUncompressed8BitTGA(char * filename);
- bool LoadUncompressedTrueColorTGA(char * filename);
- bool LoadCompressedTrueColorTGA(char * filename);
+ bool LoadTGA(const char * filename); //Load TGA
+ bool LoadUncompressed8BitTGA(const char * filename);
+ bool LoadUncompressedTrueColorTGA(const char * filename);
+ bool LoadCompressedTrueColorTGA(const char * filename);
//load an uncompressed greyscale TGA for alpha channel
- bool LoadAlphaTGA(char * filename);
+ bool LoadAlphaTGA(const char * filename);
//Alter the image
void FlipVertically();
@@ -57,4 +57,4 @@ public:
//Universal bitmap identifier
const DWORD BITMAP_ID=0x4D42;
-#endif //TEXTURE_IMAGE_H \ No newline at end of file
+#endif //TEXTURE_IMAGE_H
diff --git a/src/wgl/rtotex/log.cpp b/src/wgl/rtotex/log.cpp
index 9251165..afbdf76 100644
--- a/src/wgl/rtotex/log.cpp
+++ b/src/wgl/rtotex/log.cpp
@@ -11,9 +11,8 @@
#include "log.h"
-//bool LOG::Init()
//Initiates log. Dont call, it is in the constructor
-bool LOG::Init(char * filename)
+bool LOG::Init(const char * filename)
{
//Clear the log file contents
if((logfile=fopen(filename, "wb"))==NULL)
@@ -25,7 +24,6 @@ bool LOG::Init(char * filename)
}
-//bool LOG::Shutdown()
//Shuts down log, in the destructor.
bool LOG::Shutdown()
{
@@ -51,8 +49,7 @@ void LOG::OutputNewline()
}
-//void LOG::OutputError(char * text,...)
-void LOG::OutputError(char * text,...)
+void LOG::OutputError(const char * text,...)
{
va_list arg_list;
@@ -79,7 +76,7 @@ void LOG::OutputError(char * text,...)
}
-void LOG::OutputSuccess(char * text,...)
+void LOG::OutputSuccess(const char * text,...)
{
va_list arg_list;
@@ -98,4 +95,4 @@ void LOG::OutputSuccess(char * text,...)
//Close the file
fclose(logfile);
va_end(arg_list);
-} \ No newline at end of file
+}
diff --git a/src/wgl/rtotex/log.h b/src/wgl/rtotex/log.h
index 7ab4397..76e52c8 100644
--- a/src/wgl/rtotex/log.h
+++ b/src/wgl/rtotex/log.h
@@ -23,15 +23,15 @@ protected:
bool Shutdown(void);
public:
- bool Init(char * filename);
+ bool Init(const char * filename);
//Output to log
void OutputNewline();
- void OutputError(char * text, ...);
- void OutputSuccess(char * text, ...);
+ void OutputError(const char * text, ...);
+ void OutputSuccess(const char * text, ...);
LOG() {}
~LOG(){ Shutdown(); }
};
-#endif \ No newline at end of file
+#endif
diff --git a/src/wgl/rtotex/window.cpp b/src/wgl/rtotex/window.cpp
index ce2c817..0221281 100644
--- a/src/wgl/rtotex/window.cpp
+++ b/src/wgl/rtotex/window.cpp
@@ -20,7 +20,7 @@
extern LOG errorLog;
-bool WINDOW::Init(char * windowTitle,
+bool WINDOW::Init(const char * windowTitle,
int newWidth, int newHeight,
int newColorBits, int newDepthBits, int newStencilBits,
int fullscreenflag)
diff --git a/src/wgl/rtotex/window.h b/src/wgl/rtotex/window.h
index 0a0de02..ce30d43 100644
--- a/src/wgl/rtotex/window.h
+++ b/src/wgl/rtotex/window.h
@@ -20,12 +20,12 @@ public:
HWND hWnd; //Holds window handle
HINSTANCE hInstance; //Holds application instance
MSG msg; //message structure, to see if any pending messages
- char * title; //Window Title
+ const char * title; //Window Title
int width, height; //window size
int colorBits, depthBits, stencilBits; //window bpp
bool fullscreen; //fullscreen?
- bool Init( char * windowTitle,
+ bool Init(const char * windowTitle,
int newWidth, int newHeight,
int newColorBits, int newDepthBits, int newStencilBits,
int fullscreenflag);
@@ -119,4 +119,4 @@ public:
#define FULL_SCREEN 1
#define CHOOSE_SCREEN 2
-#endif //WINDOW_H \ No newline at end of file
+#endif //WINDOW_H