Merge "emulator/opengl: Fix GCC 4.8 warnings." into idea133
Auto-merge: ebb41cc
* commit 'ebb41cc357ba8e04dd6aab48766a16540f084b42':
emulator/opengl: Fix GCC 4.8 warnings.
diff --git a/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp b/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp
index c245ba5..5b48fcb 100644
--- a/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp
+++ b/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp
@@ -20,8 +20,7 @@
#include <stdio.h>
#define IS_TRUE(a) \
- if(a != true) return false;
-
+ if(a != true) return NULL;
struct DisplayInfo{
DisplayInfo():dc(NULL),hwnd(NULL),isPixelFormatSet(false){};
@@ -48,9 +47,7 @@
class WinDisplay{
public:
- typedef enum {
- DEFAULT_DISPLAY = 0
- };
+ enum { DEFAULT_DISPLAY = 0 };
WinDisplay(){};
DisplayInfo& getInfo(int configurationIndex){ return getTLS()->m_map[configurationIndex];}
HDC getDC(int configId){return getTLS()->m_map[configId].dc;}
diff --git a/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp b/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp
index 7ab177f..3443f59 100644
--- a/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp
+++ b/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp
@@ -2230,10 +2230,12 @@
GLint viewport[4];
z = (z>1 ? 1 : (z<0 ? 0 : z));
- T vertices[4*3] = {x , y, z,
- x , y+height, z,
- x+width, y+height, z,
- x+width, y, z};
+ T vertices[4*3] = {
+ x , y, z,
+ x , static_cast<T>(y+height), z,
+ static_cast<T>(x+width), static_cast<T>(y+height), z,
+ static_cast<T>(x+width), y, z
+ };
GLfloat texels[ctx->getMaxTexUnits()][4*2];
memset((void*)texels, 0, ctx->getMaxTexUnits()*4*2*sizeof(GLfloat));
diff --git a/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp b/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp
index c0e3c5c..7b217fd 100644
--- a/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp
+++ b/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp
@@ -45,25 +45,26 @@
return ret;
}
-#define LOAD_GL_FUNC(name) { void * funcAddrs = NULL; \
- if(name == NULL){ \
- funcAddrs = (void *)getGLFuncAddress(#name); \
- if(funcAddrs){ \
- *(void**)(void*)(&name) = funcAddrs; \
- } else { \
- fprintf(stderr,"could not load func %s\n",#name); \
- *(void**)(void*)(&name) = (void *)dummy_##name; \
- } \
- } \
- }
+#define LOAD_GL_FUNC(name) do { \
+ if (!name) { \
+ void* funcAddress = (void *)getGLFuncAddress(#name); \
+ if (funcAddress) { \
+ name = (__typeof__(name))(funcAddress); \
+ } else { \
+ fprintf(stderr, "Could not load func %s\n", #name); \
+ name = (__typeof__(name))(dummy_##name); \
+ } \
+ } \
+ } while (0)
-#define LOAD_GLEXT_FUNC(name) { void * funcAddrs = NULL; \
- if(name == NULL){ \
- funcAddrs = (void *)getGLFuncAddress(#name); \
- if(funcAddrs) \
- *(void**)(void*)(&name) = funcAddrs; \
- } \
- }
+#define LOAD_GLEXT_FUNC(name) do { \
+ if (!name) { \
+ void* funcAddress = (void *)getGLFuncAddress(#name); \
+ if (funcAddress) { \
+ name = (__typeof__(name))(funcAddress); \
+ } \
+ } \
+ } while (0)
/* initializing static GLDispatch members*/
diff --git a/emulator/opengl/shared/emugl/common/sockets.cpp b/emulator/opengl/shared/emugl/common/sockets.cpp
index feb6d38..2a13d72 100644
--- a/emulator/opengl/shared/emugl/common/sockets.cpp
+++ b/emulator/opengl/shared/emugl/common/sockets.cpp
@@ -27,6 +27,7 @@
#endif
#include <stddef.h>
+#include <stdint.h>
#include <string.h>
#include <unistd.h>
@@ -36,7 +37,7 @@
static void socketSetReuseAddress(int s) {
#ifdef _WIN32
- // The default behaviour on WIndows is equivalent to SO_REUSEADDR
+ // The default behaviour on Windows is equivalent to SO_REUSEADDR
// so we don't need to set this option. Moreover, one should never
// set this option with WinSock because it's badly implemented and
// generates a huge security issue. See:
diff --git a/emulator/opengl/tests/translator_tests/GLES_CM/triangleCM.cpp b/emulator/opengl/tests/translator_tests/GLES_CM/triangleCM.cpp
index 60118b7..0e86166 100644
--- a/emulator/opengl/tests/translator_tests/GLES_CM/triangleCM.cpp
+++ b/emulator/opengl/tests/translator_tests/GLES_CM/triangleCM.cpp
@@ -279,17 +279,17 @@
#define MIN_T 0
GLbyte byteVertices[] = { -1,-1,0, // Position
- 255,0,0,255, // Color
+ (GLbyte)255,0,0,(GLbyte)255, // Color
MIN_T, MIN_T, // texture
12, //point size
1,-1,0,
- 0,255,0,255,
+ 0,(GLbyte)255,0,(GLbyte)255,
MAX_T,MIN_T,
47,
0,1,0,
- 0,0,255,255,
+ 0,0,(GLbyte)255,(GLbyte)255,
MID_T, MAX_T,
14
};