diff options
author | David 'Digit' Turner <digit@android.com> | 2014-01-14 11:57:18 +0100 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2014-01-18 16:56:31 +0100 |
commit | b81cc7bbd7baa35042af6c6b71edcfe94004bbcd (patch) | |
tree | 409c961afb25f6768f38f76110dcf4466d39a4ca /emulator | |
parent | 4a218a8b31d712290dce83cc65fc0a529fb10823 (diff) | |
download | sdk-b81cc7bbd7baa35042af6c6b71edcfe94004bbcd.zip sdk-b81cc7bbd7baa35042af6c6b71edcfe94004bbcd.tar.gz sdk-b81cc7bbd7baa35042af6c6b71edcfe94004bbcd.tar.bz2 |
emulator/opengl: Get rid of all compiler warnings (Linux).
This patch gets rid of all compiler warnings for the
GPU emulation libraries when building on a Linux host.
Note that GLcommon/GLutils.h now provides two new functions
to perform 'safe' type casts between unsigned integers and
pointers: SafePointerFromUInt() and SafeUIntFromPointer().
Change-Id: I01c48bbd72f925d70eb9831f57e15815e687121f
Diffstat (limited to 'emulator')
15 files changed, 83 insertions, 69 deletions
diff --git a/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp b/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp index 5399445..3c5bd70 100644 --- a/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp +++ b/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp @@ -21,6 +21,10 @@ #include <GLES/gl.h> #include <GLES/glext.h> +static inline void* SafePointerFromUInt(GLuint value) { + return (void*)(uintptr_t)value; +} + GLDecoder::GLDecoder() { m_contextData = NULL; @@ -88,43 +92,43 @@ int GLDecoder::s_glFinishRoundTrip(void *self) void GLDecoder::s_glVertexPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset) { GLDecoder *ctx = (GLDecoder *)self; - ctx->glVertexPointer(size, type, stride, (void *)offset); + ctx->glVertexPointer(size, type, stride, SafePointerFromUInt(offset)); } void GLDecoder::s_glColorPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset) { GLDecoder *ctx = (GLDecoder *)self; - ctx->glColorPointer(size, type, stride, (void *)offset); + ctx->glColorPointer(size, type, stride, SafePointerFromUInt(offset)); } void GLDecoder::s_glTexCoordPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset) { GLDecoder *ctx = (GLDecoder *)self; - ctx->glTexCoordPointer(size, type, stride, (void *) offset); + ctx->glTexCoordPointer(size, type, stride, SafePointerFromUInt(offset)); } void GLDecoder::s_glNormalPointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset) { GLDecoder *ctx = (GLDecoder *)self; - ctx->glNormalPointer(type, stride, (void *)offset); + ctx->glNormalPointer(type, stride, SafePointerFromUInt(offset)); } void GLDecoder::s_glPointSizePointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset) { GLDecoder *ctx = (GLDecoder *)self; - ctx->glPointSizePointerOES(type, stride, (void *)offset); + ctx->glPointSizePointerOES(type, stride, SafePointerFromUInt(offset)); } void GLDecoder::s_glWeightPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset) { GLDecoder *ctx = (GLDecoder *)self; - ctx->glWeightPointerOES(size, type, stride, (void*)offset); + ctx->glWeightPointerOES(size, type, stride, SafePointerFromUInt(offset)); } void GLDecoder::s_glMatrixIndexPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset) { GLDecoder *ctx = (GLDecoder *)self; - ctx->glMatrixIndexPointerOES(size, type, stride, (void*)offset); + ctx->glMatrixIndexPointerOES(size, type, stride, SafePointerFromUInt(offset)); } @@ -204,7 +208,7 @@ void GLDecoder::s_glMatrixIndexPointerData(void * self, GLint size, GLenum type, void GLDecoder::s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset) { GLDecoder *ctx = (GLDecoder *)self; - ctx->glDrawElements(mode, count, type, (void *)offset); + ctx->glDrawElements(mode, count, type, SafePointerFromUInt(offset)); } void GLDecoder::s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen) diff --git a/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp b/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp index a777c50..ccf2f06 100644 --- a/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp +++ b/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp @@ -19,6 +19,9 @@ #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> +static inline void* SafePointerFromUInt(GLuint value) { + return (void*)(uintptr_t)value; +} GL2Decoder::GL2Decoder() { @@ -115,7 +118,7 @@ void GL2Decoder::s_glVertexAttribPointerOffset(void *self, GLuint indx, GLint si GLboolean normalized, GLsizei stride, GLuint data) { GL2Decoder *ctx = (GL2Decoder *) self; - ctx->glVertexAttribPointer(indx, size, type, normalized, stride, (GLvoid *)data); + ctx->glVertexAttribPointer(indx, size, type, normalized, stride, SafePointerFromUInt(data)); } @@ -129,7 +132,7 @@ void GL2Decoder::s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GL void GL2Decoder::s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset) { GL2Decoder *ctx = (GL2Decoder *)self; - ctx->glDrawElements(mode, count, type, (void *)offset); + ctx->glDrawElements(mode, count, type, SafePointerFromUInt(offset)); } void GL2Decoder::s_glShaderString(void *self, GLuint shader, const GLchar* string, GLsizei len) diff --git a/emulator/opengl/host/libs/Translator/EGL/EglDisplay.cpp b/emulator/opengl/host/libs/Translator/EGL/EglDisplay.cpp index 99f9d8b..3516986 100644 --- a/emulator/opengl/host/libs/Translator/EGL/EglDisplay.cpp +++ b/emulator/opengl/host/libs/Translator/EGL/EglDisplay.cpp @@ -142,7 +142,7 @@ EglConfig* EglDisplay::getConfig(EGLConfig conf) { SurfacePtr EglDisplay::getSurface(EGLSurface surface) { android::Mutex::Autolock mutex(m_lock); /* surface is "key" in map<unsigned int, SurfacePtr>. */ - unsigned int hndl = ToTargetCompatibleHandle((uintptr_t)surface); + unsigned int hndl = SafeUIntFromPointer(surface); SurfacesHndlMap::iterator it = m_surfaces.find(hndl); return it != m_surfaces.end() ? (*it).second : @@ -152,7 +152,7 @@ SurfacePtr EglDisplay::getSurface(EGLSurface surface) { ContextPtr EglDisplay::getContext(EGLContext ctx) { android::Mutex::Autolock mutex(m_lock); /* ctx is "key" in map<unsigned int, ContextPtr>. */ - unsigned int hndl = ToTargetCompatibleHandle((uintptr_t)ctx); + unsigned int hndl = SafeUIntFromPointer(ctx); ContextsHndlMap::iterator it = m_contexts.find(hndl); return it != m_contexts.end() ? (*it).second : @@ -162,7 +162,7 @@ ContextPtr EglDisplay::getContext(EGLContext ctx) { bool EglDisplay::removeSurface(EGLSurface s) { android::Mutex::Autolock mutex(m_lock); /* s is "key" in map<unsigned int, SurfacePtr>. */ - unsigned int hndl = ToTargetCompatibleHandle((uintptr_t)s); + unsigned int hndl = SafeUIntFromPointer(s); SurfacesHndlMap::iterator it = m_surfaces.find(hndl); if(it != m_surfaces.end()) { m_surfaces.erase(it); @@ -191,7 +191,7 @@ bool EglDisplay::removeSurface(SurfacePtr s) { bool EglDisplay::removeContext(EGLContext ctx) { android::Mutex::Autolock mutex(m_lock); /* ctx is "key" in map<unsigned int, ContextPtr>. */ - unsigned int hndl = ToTargetCompatibleHandle((uintptr_t)ctx); + unsigned int hndl = SafeUIntFromPointer(ctx); ContextsHndlMap::iterator it = m_contexts.find(hndl); if(it != m_contexts.end()) { m_contexts.erase(it); @@ -295,7 +295,7 @@ EGLImageKHR EglDisplay::addImageKHR(ImagePtr img) { ImagePtr EglDisplay::getImage(EGLImageKHR img) { android::Mutex::Autolock mutex(m_lock); /* img is "key" in map<unsigned int, ImagePtr>. */ - unsigned int hndl = ToTargetCompatibleHandle((uintptr_t)img); + unsigned int hndl = SafeUIntFromPointer(img); ImagesHndlMap::iterator i( m_eglImages.find(hndl) ); return (i != m_eglImages.end()) ? (*i).second :ImagePtr(NULL); } @@ -303,7 +303,7 @@ ImagePtr EglDisplay::getImage(EGLImageKHR img) { bool EglDisplay:: destroyImageKHR(EGLImageKHR img) { android::Mutex::Autolock mutex(m_lock); /* img is "key" in map<unsigned int, ImagePtr>. */ - unsigned int hndl = ToTargetCompatibleHandle((uintptr_t)img); + unsigned int hndl = SafeUIntFromPointer(img); ImagesHndlMap::iterator i( m_eglImages.find(hndl) ); if (i != m_eglImages.end()) { diff --git a/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp b/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp index d03c9db..1d5c494 100644 --- a/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp +++ b/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp @@ -815,7 +815,7 @@ EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void) { if(dpy && ctx.Ptr()){ // This double check is required because a context might still be current after it is destroyed - in which case // its handle should be invalid, that is EGL_NO_CONTEXT should be returned even though the context is current - EGLContext c = (EGLContext)ctx->getHndl(); + EGLContext c = (EGLContext)SafePointerFromUInt(ctx->getHndl()); if(dpy->getContext(c).Ptr()) { return c; @@ -839,7 +839,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw) { // current after it is destroyed - in which case its handle should // be invalid, that is EGL_NO_SURFACE should be returned even // though the surface is current. - EGLSurface s = (EGLSurface)surface->getHndl(); + EGLSurface s = (EGLSurface)SafePointerFromUInt(surface->getHndl()); surface = dpy->getSurface(s); if(surface.Ptr()) { @@ -1033,13 +1033,13 @@ EGLImageKHR eglCreateImageKHR(EGLDisplay display, EGLContext context, EGLenum ta ThreadInfo* thread = getThreadInfo(); ShareGroupPtr sg = thread->shareGroup; if (sg.Ptr() != NULL) { - unsigned int globalTexName = sg->getGlobalName(TEXTURE, (uintptr_t)buffer); + unsigned int globalTexName = sg->getGlobalName(TEXTURE, SafeUIntFromPointer(buffer)); if (!globalTexName) return EGL_NO_IMAGE_KHR; ImagePtr img( new EglImage() ); if (img.Ptr() != NULL) { - ObjectDataPtr objData = sg->getObjectData(TEXTURE, (uintptr_t)buffer); + ObjectDataPtr objData = sg->getObjectData(TEXTURE, SafeUIntFromPointer(buffer)); if (!objData.Ptr()) return EGL_NO_IMAGE_KHR; TextureData *texData = (TextureData *)objData.Ptr(); diff --git a/emulator/opengl/host/libs/Translator/EGL/EglX11Api.cpp b/emulator/opengl/host/libs/Translator/EGL/EglX11Api.cpp index 129f244..a8c624e 100644 --- a/emulator/opengl/host/libs/Translator/EGL/EglX11Api.cpp +++ b/emulator/opengl/host/libs/Translator/EGL/EglX11Api.cpp @@ -71,7 +71,7 @@ int ErrorHandler::errorHandlerProc(EGLNativeDisplayType dpy,XErrorEvent* event){ } #define IS_SUCCESS(a) \ - if(a != Success) return false; + if(a != Success) return 0; namespace EglOS { @@ -193,7 +193,7 @@ bool validNativePixmap(EGLNativeDisplayType dpy,EGLNativeSurfaceType pix) { int tmp; unsigned int utmp; ErrorHandler handler(dpy); - if(!XGetGeometry(dpy,pix ? pix->srfc() : NULL,&root,&tmp,&tmp,&utmp,&utmp,&utmp,&utmp)) return false; + if(!XGetGeometry(dpy,pix ? pix->srfc() : 0,&root,&tmp,&tmp,&utmp,&utmp,&utmp,&utmp)) return false; return handler.getLastError() == 0; } @@ -260,7 +260,7 @@ bool makeCurrent(EGLNativeDisplayType dpy,EglSurface* read,EglSurface* draw,EGLN bool retval = false; if (!ctx && !read && !draw) { // unbind - retval = glXMakeContextCurrent(dpy, NULL, NULL, NULL); + retval = glXMakeContextCurrent(dpy, 0, 0, NULL); } else if (ctx && read && draw) { retval = glXMakeContextCurrent(dpy,draw->native()->srfc(),read->native()->srfc(),ctx); diff --git a/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp b/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp index 3ae271f..28ebca9 100644 --- a/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp +++ b/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp @@ -582,7 +582,7 @@ GL_API void GL_APIENTRY glDrawElements( GLenum mode, GLsizei count, GLenum type GLESConversionArrays tmpArrs; if(ctx->isBindedBuffer(GL_ELEMENT_ARRAY_BUFFER)) { // if vbo is binded take the indices from the vbo const unsigned char* buf = static_cast<unsigned char *>(ctx->getBindedBuffer(GL_ELEMENT_ARRAY_BUFFER)); - indices = buf+reinterpret_cast<uintptr_t>(elementsIndices); + indices = buf + SafeUIntFromPointer(elementsIndices); } ctx->setupArraysPointers(tmpArrs,0,count,type,indices,false); @@ -994,9 +994,9 @@ GL_API void GL_APIENTRY glGetPointerv( GLenum pname, void **params) { if(p) { if(p->isVBO()) { - *params = (void*)(p->getBufferOffset()); + *params = SafePointerFromUInt(p->getBufferOffset()); }else{ - *params = const_cast<void *>( p->getArrayData()); + *params = const_cast<void *>(p->getArrayData()); } } else { ctx->setGLerror(GL_INVALID_ENUM); @@ -1652,7 +1652,7 @@ GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOE { GET_CTX(); SET_ERROR_IF(!GLEScmValidate::textureTargetLimited(target),GL_INVALID_ENUM); - unsigned int imagehndl = ToTargetCompatibleHandle((uintptr_t)image); + unsigned int imagehndl = SafeUIntFromPointer(image); EglImage *img = s_eglIface->eglAttachEGLImage(imagehndl); if (img) { // Create the texture object in the underlying EGL implementation, @@ -1688,7 +1688,7 @@ GL_API void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target, GL { GET_CTX(); SET_ERROR_IF(target != GL_RENDERBUFFER_OES,GL_INVALID_ENUM); - unsigned int imagehndl = ToTargetCompatibleHandle((uintptr_t)image); + unsigned int imagehndl = SafeUIntFromPointer(image); EglImage *img = s_eglIface->eglAttachEGLImage(imagehndl); SET_ERROR_IF(!img,GL_INVALID_VALUE); SET_ERROR_IF(!ctx->shareGroup().Ptr(),GL_INVALID_OPERATION); diff --git a/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp b/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp index 7ae9427..c3886d3 100644 --- a/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp +++ b/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp @@ -593,7 +593,7 @@ GL_APICALL void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum t const GLvoid* indices = elementsIndices; if(ctx->isBindedBuffer(GL_ELEMENT_ARRAY_BUFFER)) { // if vbo is binded take the indices from the vbo const unsigned char* buf = static_cast<unsigned char *>(ctx->getBindedBuffer(GL_ELEMENT_ARRAY_BUFFER)); - indices = buf+reinterpret_cast<uintptr_t>(elementsIndices); + indices = buf + SafeUIntFromPointer(elementsIndices); } GLESConversionArrays tmpArrs; @@ -2006,7 +2006,7 @@ GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglIma { GET_CTX(); SET_ERROR_IF(!GLESv2Validate::textureTargetLimited(target),GL_INVALID_ENUM); - unsigned int imagehndl = ToTargetCompatibleHandle((uintptr_t)image); + unsigned int imagehndl = SafeUIntFromPointer(image); EglImage *img = s_eglIface->eglAttachEGLImage(imagehndl); if (img) { // Create the texture object in the underlying EGL implementation, @@ -2042,7 +2042,7 @@ GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target { GET_CTX(); SET_ERROR_IF(target != GL_RENDERBUFFER_OES,GL_INVALID_ENUM); - unsigned int imagehndl = ToTargetCompatibleHandle((uintptr_t)image); + unsigned int imagehndl = SafeUIntFromPointer(image); EglImage *img = s_eglIface->eglAttachEGLImage(imagehndl); SET_ERROR_IF(!img,GL_INVALID_VALUE); SET_ERROR_IF(!ctx->shareGroup().Ptr(),GL_INVALID_OPERATION); diff --git a/emulator/opengl/host/libs/Translator/GLcommon/GLEScontext.cpp b/emulator/opengl/host/libs/Translator/GLcommon/GLEScontext.cpp index 387eb2d..6572719 100644 --- a/emulator/opengl/host/libs/Translator/GLcommon/GLEScontext.cpp +++ b/emulator/opengl/host/libs/Translator/GLcommon/GLEScontext.cpp @@ -191,7 +191,7 @@ GLEScontext::~GLEScontext() { const GLvoid* GLEScontext::setPointer(GLenum arrType,GLint size,GLenum type,GLsizei stride,const GLvoid* data,bool normalize) { GLuint bufferName = m_arrayBuffer; if(bufferName) { - unsigned int offset = ToTargetCompatibleHandle((uintptr_t)data); + unsigned int offset = SafeUIntFromPointer(data); GLESbuffer* vbo = static_cast<GLESbuffer*>(m_shareGroup->getObjectData(VERTEXBUFFER,bufferName).Ptr()); m_map[arrType]->setBuffer(size,type,stride,vbo,bufferName,offset,normalize); return static_cast<const unsigned char*>(vbo->getData()) + offset; diff --git a/emulator/opengl/host/libs/Translator/include/GLcommon/GLutils.h b/emulator/opengl/host/libs/Translator/include/GLcommon/GLutils.h index 2aed646..974b9be 100644 --- a/emulator/opengl/host/libs/Translator/include/GLcommon/GLutils.h +++ b/emulator/opengl/host/libs/Translator/include/GLcommon/GLutils.h @@ -16,36 +16,37 @@ #ifndef GL_UTILS_H #define GL_UTILS_H -#include <inttypes.h> #include <assert.h> +#include <inttypes.h> -typedef enum{ - GLES_1_1 = 1, - GLES_2_0 = 2, - MAX_GLES_VERSION //Must be last - }GLESVersion; +typedef enum { + GLES_1_1 = 1, + GLES_2_0 = 2, + MAX_GLES_VERSION //Must be last +} GLESVersion; template <class T> void swap(T& x,T& y) { T temp; - temp=x; - x=y; - y=temp; + temp = x; + x = y; + y = temp; } bool isPowerOf2(int num); -inline -unsigned int ToTargetCompatibleHandle(uintptr_t hostHandle) -{ - // The host and target handles can have different sizes (e.g. 32-bit - // target handle for ARM, and 64-bit host handle on x86_64). - // This function checks that the input host handle value can be - // converted into a target handle one without losing any bits. - // - unsigned int targetHandle = (unsigned int)hostHandle; - assert(sizeof(targetHandle) == sizeof(hostHandle) || targetHandle == hostHandle); - return targetHandle; +// <EGL/egl.h> defines many types as 'void*' while they're really +// implemented as unsigned integers. These convenience template functions +// help casting between them safely without generating compiler warnings. +inline void* SafePointerFromUInt(unsigned int handle) { + return (void*)(uintptr_t)(handle); +} + +inline unsigned int SafeUIntFromPointer(const void* ptr) { + // Assertion error if the pointer contains a value that does not fit + // in an unsigned integer! + assert((uintptr_t)(ptr) == (unsigned int)(uintptr_t)(ptr)); + return (unsigned int)(uintptr_t)(ptr); } #endif diff --git a/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp b/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp index 46c5acf..f4280e1 100644 --- a/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp +++ b/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp @@ -18,6 +18,7 @@ #include "EGLDispatch.h" #include "GLDispatch.h" #include "ThreadInfo.h" +#include "GLcommon/GLutils.h" #ifdef WITH_GLES2 #include "GL2Dispatch.h" #endif @@ -92,17 +93,19 @@ ColorBuffer *ColorBuffer::create(int p_width, int p_height, cb->m_internalFormat = texInternalFormat; if (fb->getCaps().has_eglimage_texture_2d) { - cb->m_eglImage = s_egl.eglCreateImageKHR(fb->getDisplay(), - s_egl.eglGetCurrentContext(), - EGL_GL_TEXTURE_2D_KHR, - (EGLClientBuffer)cb->m_tex, - NULL); - - cb->m_blitEGLImage = s_egl.eglCreateImageKHR(fb->getDisplay(), - s_egl.eglGetCurrentContext(), - EGL_GL_TEXTURE_2D_KHR, - (EGLClientBuffer)cb->m_blitTex, - NULL); + cb->m_eglImage = s_egl.eglCreateImageKHR( + fb->getDisplay(), + s_egl.eglGetCurrentContext(), + EGL_GL_TEXTURE_2D_KHR, + (EGLClientBuffer)SafePointerFromUInt(cb->m_tex), + NULL); + + cb->m_blitEGLImage = s_egl.eglCreateImageKHR( + fb->getDisplay(), + s_egl.eglGetCurrentContext(), + EGL_GL_TEXTURE_2D_KHR, + (EGLClientBuffer)SafePointerFromUInt(cb->m_blitTex), + NULL); } fb->unbind_locked(); diff --git a/emulator/opengl/host/renderer/main.cpp b/emulator/opengl/host/renderer/main.cpp index d2e3f72..2c3f8e2 100644 --- a/emulator/opengl/host/renderer/main.cpp +++ b/emulator/opengl/host/renderer/main.cpp @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) int winY = 0; int winWidth = 320; int winHeight = 480; - FBNativeWindowType windowId = NULL; + FBNativeWindowType windowId = 0; int iWindowId = 0; // diff --git a/emulator/opengl/host/tools/emugen/ApiGen.h b/emulator/opengl/host/tools/emugen/ApiGen.h index 1627ef6..8ba18af 100644 --- a/emulator/opengl/host/tools/emugen/ApiGen.h +++ b/emulator/opengl/host/tools/emugen/ApiGen.h @@ -54,6 +54,8 @@ public: case WRAPPER_SIDE: retval = "wrapper"; break; + default: + retval = "unknown"; } return retval; } diff --git a/emulator/opengl/shared/OpenglOsUtils/osThreadUnix.cpp b/emulator/opengl/shared/OpenglOsUtils/osThreadUnix.cpp index d8879eb..8cd73a9 100644 --- a/emulator/opengl/shared/OpenglOsUtils/osThreadUnix.cpp +++ b/emulator/opengl/shared/OpenglOsUtils/osThreadUnix.cpp @@ -15,6 +15,8 @@ */ #include "osThread.h" +#include <stdint.h> + namespace osUtils { Thread::Thread() : @@ -55,9 +57,8 @@ Thread::wait(int *exitStatus) return false; } - long long int ret=(long long int)retval; if (exitStatus) { - *exitStatus = (int)ret; + *exitStatus = (int)(uintptr_t)retval; } return true; } @@ -87,7 +88,7 @@ Thread::thread_main(void *p_arg) self->m_exitStatus = ret; pthread_mutex_unlock(&self->m_lock); - return (void*)ret; + return (void*)(uintptr_t)ret; } } // of namespace osUtils diff --git a/emulator/opengl/tests/translator_tests/GLES_CM/triangleCM.cpp b/emulator/opengl/tests/translator_tests/GLES_CM/triangleCM.cpp index 7547cd0..ce65cca 100644 --- a/emulator/opengl/tests/translator_tests/GLES_CM/triangleCM.cpp +++ b/emulator/opengl/tests/translator_tests/GLES_CM/triangleCM.cpp @@ -154,7 +154,7 @@ int main(int argc, char **argv) #ifdef _WIN32 HWND windowId = NULL; #elif __linux__ - Window windowId = NULL; + Window windowId = 0; #elif __APPLE__ void* windowId = NULL; #endif diff --git a/emulator/opengl/tests/translator_tests/GLES_V2/triangleV2.cpp b/emulator/opengl/tests/translator_tests/GLES_V2/triangleV2.cpp index 59535c5..732a19a 100644 --- a/emulator/opengl/tests/translator_tests/GLES_V2/triangleV2.cpp +++ b/emulator/opengl/tests/translator_tests/GLES_V2/triangleV2.cpp @@ -372,7 +372,7 @@ int main(int argc, char **argv) #ifdef _WIN32 HWND windowId = NULL; #elif __linux__ - Window windowId = NULL; + Window windowId = 0; #elif __APPLE__ void* windowId = NULL; #endif |