X11 build fixups
- fixed -Werror=misleading-indentation warning - fixed -Werror=nonnull-compare warning on xll and QT builds - PNG_LIBPNG_VER backward compatibily changes - giflib backward compatibily changes - resolved some undefs for X11 build - silenced some small compile warnings in JGE Makefile - added -DTIXML_USE_STL to remaining build types (PSP had it added) - fixed x11 Boost incompatibility issue part of #548 - reworked PrecompiledHeader.h platforms used
This commit is contained in:
@@ -16,9 +16,14 @@ User folder is the only one that is really needed to guarantee both read and wri
|
||||
The content that users should not be touching.
|
||||
*/
|
||||
|
||||
#ifndef PSP
|
||||
#if defined (ANDROID)
|
||||
#include "PrecompiledHeader.h"
|
||||
#endif //PSP
|
||||
#endif //ANDROID
|
||||
|
||||
#if defined (LINUX)
|
||||
#include "../../projects/mtg/include/PrecompiledHeader.h"
|
||||
#endif //LINUX
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning(disable : 4786)
|
||||
|
||||
+3
-1
@@ -249,6 +249,7 @@ u32 JGE::BindKey(LocalKeySym sym, JButton button)
|
||||
u32 JGE::UnbindKey(LocalKeySym sym, JButton button)
|
||||
{
|
||||
for (keycodes_it it = keyBinds.begin(); it != keyBinds.end(); )
|
||||
{
|
||||
if (sym == it->first && button == it->second)
|
||||
{
|
||||
keycodes_it er = it;
|
||||
@@ -256,7 +257,8 @@ u32 JGE::UnbindKey(LocalKeySym sym, JButton button)
|
||||
keyBinds.erase(er);
|
||||
}
|
||||
else ++it;
|
||||
return keyBinds.size();
|
||||
}
|
||||
return keyBinds.size();
|
||||
}
|
||||
|
||||
u32 JGE::UnbindKey(LocalKeySym sym)
|
||||
|
||||
+4
-4
@@ -185,9 +185,9 @@ static const int doubleBufferAttributes[] = {
|
||||
GLX_RED_SIZE, 1, /* the maximum number of bits per component */
|
||||
GLX_GREEN_SIZE, 1,
|
||||
GLX_BLUE_SIZE, 1,
|
||||
None
|
||||
0L /* None */
|
||||
};
|
||||
static Bool WaitForNotify(Display *dpy, XEvent *event, XPointer arg)
|
||||
static int WaitForNotify(Display *dpy, XEvent *event, XPointer arg)
|
||||
{
|
||||
return (event->type == MapNotify) && (event->xmap.window == (Window) arg);
|
||||
}
|
||||
@@ -387,13 +387,13 @@ int main(int argc, char* argv[])
|
||||
if (XCheckWindowEvent(gXDisplay, gXWindow, KeyPressMask | KeyReleaseMask | StructureNotifyMask, &event))
|
||||
switch (event.type)
|
||||
{
|
||||
case KeyPress:
|
||||
case 2: /* KeyPress */
|
||||
{
|
||||
const KeySym sym = XKeycodeToKeysym(gXDisplay, event.xkey.keycode, 1);
|
||||
g_engine->HoldKey_NoRepeat(sym);
|
||||
}
|
||||
break;
|
||||
case KeyRelease:
|
||||
case 3: /* KeyRelease */
|
||||
g_engine->ReleaseKey(XKeycodeToKeysym(gXDisplay, event.xkey.keycode, 1));
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
|
||||
+53
-6
@@ -1804,7 +1804,7 @@ static void PNGCustomReadDataFn(png_structp png_ptr, png_bytep data, png_size_t
|
||||
{
|
||||
png_size_t check;
|
||||
|
||||
JFileSystem *fileSystem = (JFileSystem*)png_ptr->io_ptr;
|
||||
JFileSystem *fileSystem = (JFileSystem*)png_get_io_ptr(png_ptr);
|
||||
|
||||
check = fileSystem->ReadFile(data, length);
|
||||
|
||||
@@ -1887,7 +1887,7 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char *filename, int mode
|
||||
//fclose(fp);
|
||||
fileSystem->CloseFile();
|
||||
|
||||
png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
|
||||
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
||||
|
||||
return JGE_ERR_PNG;
|
||||
}
|
||||
@@ -1896,11 +1896,15 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char *filename, int mode
|
||||
|
||||
png_set_sig_bytes(png_ptr, sig_read);
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, int_p_NULL, int_p_NULL);
|
||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL);
|
||||
png_set_strip_16(png_ptr);
|
||||
png_set_packing(png_ptr);
|
||||
if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png_ptr);
|
||||
#if PNG_LIBPNG_VER >= 10400
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr);
|
||||
#else
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_gray_1_2_4_to_8(png_ptr);
|
||||
#endif
|
||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
|
||||
png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
|
||||
|
||||
@@ -1910,7 +1914,7 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char *filename, int mode
|
||||
//fclose(fp);
|
||||
fileSystem->CloseFile();
|
||||
|
||||
png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
|
||||
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
||||
return JGE_ERR_MALLOC_FAILED;
|
||||
}
|
||||
|
||||
@@ -1932,7 +1936,7 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char *filename, int mode
|
||||
|
||||
for (y = 0; y < (int)height; y++)
|
||||
{
|
||||
png_read_row(png_ptr, (BYTE*) line, png_bytep_NULL);
|
||||
png_read_row(png_ptr, (BYTE*) line, NULL);
|
||||
for (x = 0; x < (int)width; x++)
|
||||
{
|
||||
DWORD color32 = line[x];
|
||||
@@ -1955,7 +1959,7 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char *filename, int mode
|
||||
free (line);
|
||||
|
||||
png_read_end(png_ptr, info_ptr);
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
|
||||
fileSystem->CloseFile();
|
||||
|
||||
@@ -1998,8 +2002,15 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
|
||||
GifFileType *GifFileIn = NULL;
|
||||
ColorMapObject *palette;
|
||||
int ExtCode;
|
||||
|
||||
#if GIFLIB_MAJOR >= 5
|
||||
if ((GifFileIn = DGifOpen(handle, readFunc, NULL)) == NULL)
|
||||
return 1;
|
||||
#else
|
||||
if ((GifFileIn = DGifOpen(handle, readFunc)) == NULL)
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
*bgcolor = 0;
|
||||
textureInfo.mWidth = 0;
|
||||
textureInfo.mHeight = 0;
|
||||
@@ -2008,7 +2019,11 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
|
||||
do {
|
||||
if (DGifGetRecordType(GifFileIn, &RecordType) == GIF_ERROR)
|
||||
{
|
||||
#if GIFLIB_MAJOR >= 5
|
||||
DGifCloseFile(GifFileIn, NULL);
|
||||
#else
|
||||
DGifCloseFile(GifFileIn);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2017,12 +2032,20 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
|
||||
{
|
||||
if (DGifGetImageDesc(GifFileIn) == GIF_ERROR)
|
||||
{
|
||||
#if GIFLIB_MAJOR >= 5
|
||||
DGifCloseFile(GifFileIn, NULL);
|
||||
#else
|
||||
DGifCloseFile(GifFileIn);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
if((palette = (GifFileIn->SColorMap != NULL) ? GifFileIn->SColorMap : GifFileIn->Image.ColorMap) == NULL)
|
||||
{
|
||||
#if GIFLIB_MAJOR >= 5
|
||||
DGifCloseFile(GifFileIn, NULL);
|
||||
#else
|
||||
DGifCloseFile(GifFileIn);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
textureInfo.mWidth = GifFileIn->Image.Width;
|
||||
@@ -2030,7 +2053,11 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
|
||||
*bgcolor = gif_color32(GifFileIn->SBackGroundColor);
|
||||
if((LineIn = (GifRowType) malloc(GifFileIn->Image.Width * sizeof(GifPixelType))) == NULL)
|
||||
{
|
||||
#if GIFLIB_MAJOR >= 5
|
||||
DGifCloseFile(GifFileIn, NULL);
|
||||
#else
|
||||
DGifCloseFile(GifFileIn);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
textureInfo.mTexWidth = getNextPower2(GifFileIn->Image.Width);
|
||||
@@ -2040,7 +2067,11 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
|
||||
if((p32 = (DWORD *)malloc(sizeof(PIXEL_TYPE) * textureInfo.mTexWidth * textureInfo.mTexHeight)) == NULL)
|
||||
{
|
||||
free((void *)LineIn);
|
||||
#if GIFLIB_MAJOR >= 5
|
||||
DGifCloseFile(GifFileIn, NULL);
|
||||
#else
|
||||
DGifCloseFile(GifFileIn);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
DWORD * curr = p32;
|
||||
@@ -2052,7 +2083,11 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
|
||||
{
|
||||
free((void *)p32);
|
||||
free((void *)LineIn);
|
||||
#if GIFLIB_MAJOR >= 5
|
||||
DGifCloseFile(GifFileIn, NULL);
|
||||
#else
|
||||
DGifCloseFile(GifFileIn);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
for (GifWord j = 0; j < GifFileIn->Image.Width; j ++)
|
||||
@@ -2081,7 +2116,11 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
|
||||
}
|
||||
if(LineIn != NULL)
|
||||
free((void *)LineIn);
|
||||
#if GIFLIB_MAJOR >= 5
|
||||
DGifCloseFile(GifFileIn, NULL);
|
||||
#else
|
||||
DGifCloseFile(GifFileIn);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
while (Extension != NULL) {
|
||||
@@ -2094,7 +2133,11 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
|
||||
}
|
||||
if(LineIn != NULL)
|
||||
free((void *)LineIn);
|
||||
#if GIFLIB_MAJOR >= 5
|
||||
DGifCloseFile(GifFileIn, NULL);
|
||||
#else
|
||||
DGifCloseFile(GifFileIn);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -2109,7 +2152,11 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
|
||||
|
||||
if(LineIn != NULL)
|
||||
free((void *)LineIn);
|
||||
#if GIFLIB_MAJOR >= 5
|
||||
DGifCloseFile(GifFileIn, NULL);
|
||||
#else
|
||||
DGifCloseFile(GifFileIn);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -631,8 +631,8 @@ streamoff filesystem::CentralDirZipped(std::istream & File, std::streamoff begin
|
||||
std::streamoff eof = begin + size;
|
||||
|
||||
// Look for the "end of central dir" header. Start minimum 22 bytes before end.
|
||||
if (! File.seekg(eof - 22, ios::beg))
|
||||
return -1;
|
||||
if (! File.seekg(eof - 22, ios::beg))
|
||||
return -1;
|
||||
|
||||
streamoff EndPos;
|
||||
streamoff StartPos = File.tellg();
|
||||
|
||||
@@ -258,8 +258,8 @@ inline void izfstream::open(const char * FilePath, filesystem * pFS) {
|
||||
if (pFS)
|
||||
m_pFS = pFS;
|
||||
|
||||
if (m_pFS != NULL)
|
||||
m_pFS->Open(* this, FilePath);
|
||||
if (m_pFS != NULL)
|
||||
m_pFS->Open(* this, FilePath);
|
||||
}
|
||||
|
||||
inline void izfstream::close() {
|
||||
|
||||
@@ -76,8 +76,8 @@ bool zbuffer::use(std::streamoff Offset, std::streamoff Size)
|
||||
return false;
|
||||
|
||||
//Don't use a buffer already used;
|
||||
if (m_Used)
|
||||
return false;
|
||||
if (m_Used)
|
||||
return false;
|
||||
|
||||
// adjust file position
|
||||
if (! m_ZipFile.seekg(Offset, ios::beg))
|
||||
|
||||
Reference in New Issue
Block a user