@@ -17,6 +17,7 @@
|
|||||||
#include "EglOsApi.h"
|
#include "EglOsApi.h"
|
||||||
#include <GLcommon/GLutils.h>
|
#include <GLcommon/GLutils.h>
|
||||||
#include <utils/threads.h>
|
#include <utils/threads.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
EglDisplay::EglDisplay(EGLNativeInternalDisplayType dpy,bool isDefault) :
|
EglDisplay::EglDisplay(EGLNativeInternalDisplayType dpy,bool isDefault) :
|
||||||
m_dpy(dpy),
|
m_dpy(dpy),
|
||||||
@@ -141,8 +142,12 @@ EglConfig* EglDisplay::getConfig(EGLConfig conf) {
|
|||||||
|
|
||||||
SurfacePtr EglDisplay::getSurface(EGLSurface surface) {
|
SurfacePtr EglDisplay::getSurface(EGLSurface surface) {
|
||||||
android::Mutex::Autolock mutex(m_lock);
|
android::Mutex::Autolock mutex(m_lock);
|
||||||
|
/* surface is "key" in map<unsigned int, SurfacePtr>.
|
||||||
SurfacesHndlMap::iterator it = m_surfaces.find(reinterpret_cast<unsigned int>(surface));
|
In 64-bit the upper 32-bit should be all zero. Assert for that. */
|
||||||
|
uintptr_t hndlptr = (uintptr_t)surface;
|
||||||
|
unsigned int hndl = (unsigned int)hndlptr;
|
||||||
|
assert(sizeof(hndl) == sizeof(hndlptr) || hndl == hndlptr);
|
||||||
|
SurfacesHndlMap::iterator it = m_surfaces.find(hndl);
|
||||||
return it != m_surfaces.end() ?
|
return it != m_surfaces.end() ?
|
||||||
(*it).second :
|
(*it).second :
|
||||||
SurfacePtr(NULL);
|
SurfacePtr(NULL);
|
||||||
@@ -150,8 +155,12 @@ SurfacePtr EglDisplay::getSurface(EGLSurface surface) {
|
|||||||
|
|
||||||
ContextPtr EglDisplay::getContext(EGLContext ctx) {
|
ContextPtr EglDisplay::getContext(EGLContext ctx) {
|
||||||
android::Mutex::Autolock mutex(m_lock);
|
android::Mutex::Autolock mutex(m_lock);
|
||||||
|
/* ctx is "key" in map<unsigned int, ContextPtr>.
|
||||||
ContextsHndlMap::iterator it = m_contexts.find(reinterpret_cast<unsigned int>(ctx));
|
In 64-bit the upper 32-bit should be all zero. Assert for that. */
|
||||||
|
uintptr_t hndlptr = (uintptr_t)ctx;
|
||||||
|
unsigned int hndl = (unsigned int)hndlptr;
|
||||||
|
assert(sizeof(hndl) == sizeof(hndlptr) || hndl == hndlptr);
|
||||||
|
ContextsHndlMap::iterator it = m_contexts.find(hndl);
|
||||||
return it != m_contexts.end() ?
|
return it != m_contexts.end() ?
|
||||||
(*it).second :
|
(*it).second :
|
||||||
ContextPtr(NULL);
|
ContextPtr(NULL);
|
||||||
@@ -159,8 +168,12 @@ ContextPtr EglDisplay::getContext(EGLContext ctx) {
|
|||||||
|
|
||||||
bool EglDisplay::removeSurface(EGLSurface s) {
|
bool EglDisplay::removeSurface(EGLSurface s) {
|
||||||
android::Mutex::Autolock mutex(m_lock);
|
android::Mutex::Autolock mutex(m_lock);
|
||||||
|
/* s is "key" in map<unsigned int, SurfacePtr>.
|
||||||
SurfacesHndlMap::iterator it = m_surfaces.find(reinterpret_cast<unsigned int>(s));
|
In 64-bit the upper 32-bit should be all zero. Assert for that. */
|
||||||
|
uintptr_t hndlptr = (uintptr_t)s;
|
||||||
|
unsigned int hndl = (unsigned int)hndlptr;
|
||||||
|
assert(sizeof(hndl) == sizeof(hndlptr) || hndl == hndlptr);
|
||||||
|
SurfacesHndlMap::iterator it = m_surfaces.find(hndl);
|
||||||
if(it != m_surfaces.end()) {
|
if(it != m_surfaces.end()) {
|
||||||
m_surfaces.erase(it);
|
m_surfaces.erase(it);
|
||||||
return true;
|
return true;
|
||||||
@@ -187,8 +200,12 @@ bool EglDisplay::removeSurface(SurfacePtr s) {
|
|||||||
|
|
||||||
bool EglDisplay::removeContext(EGLContext ctx) {
|
bool EglDisplay::removeContext(EGLContext ctx) {
|
||||||
android::Mutex::Autolock mutex(m_lock);
|
android::Mutex::Autolock mutex(m_lock);
|
||||||
|
/* ctx is "key" in map<unsigned int, ContextPtr>.
|
||||||
ContextsHndlMap::iterator it = m_contexts.find(reinterpret_cast<unsigned int>(ctx));
|
In 64-bit the upper 32-bit should be all zero. Assert for that. */
|
||||||
|
uintptr_t hndlptr = (uintptr_t)ctx;
|
||||||
|
unsigned int hndl = (unsigned int)hndlptr;
|
||||||
|
assert(sizeof(hndl) == sizeof(hndlptr) || hndl == hndlptr);
|
||||||
|
ContextsHndlMap::iterator it = m_contexts.find(hndl);
|
||||||
if(it != m_contexts.end()) {
|
if(it != m_contexts.end()) {
|
||||||
m_contexts.erase(it);
|
m_contexts.erase(it);
|
||||||
return true;
|
return true;
|
||||||
@@ -290,13 +307,23 @@ EGLImageKHR EglDisplay::addImageKHR(ImagePtr img) {
|
|||||||
|
|
||||||
ImagePtr EglDisplay::getImage(EGLImageKHR img) {
|
ImagePtr EglDisplay::getImage(EGLImageKHR img) {
|
||||||
android::Mutex::Autolock mutex(m_lock);
|
android::Mutex::Autolock mutex(m_lock);
|
||||||
ImagesHndlMap::iterator i( m_eglImages.find((unsigned int)img) );
|
/* img is "key" in map<unsigned int, ImagePtr>.
|
||||||
|
In 64-bit the upper 32-bit should be all zero. Assert for that. */
|
||||||
|
uintptr_t hndlptr = (uintptr_t)img;
|
||||||
|
unsigned int hndl = (unsigned int)hndlptr;
|
||||||
|
assert(sizeof(hndl) == sizeof(hndlptr) || hndl == hndlptr);
|
||||||
|
ImagesHndlMap::iterator i( m_eglImages.find(hndl) );
|
||||||
return (i != m_eglImages.end()) ? (*i).second :ImagePtr(NULL);
|
return (i != m_eglImages.end()) ? (*i).second :ImagePtr(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EglDisplay:: destroyImageKHR(EGLImageKHR img) {
|
bool EglDisplay:: destroyImageKHR(EGLImageKHR img) {
|
||||||
android::Mutex::Autolock mutex(m_lock);
|
android::Mutex::Autolock mutex(m_lock);
|
||||||
ImagesHndlMap::iterator i( m_eglImages.find((unsigned int)img) );
|
/* img is "key" in map<unsigned int, ImagePtr>.
|
||||||
|
In 64-bit the upper 32-bit should be all zero. Assert for that. */
|
||||||
|
uintptr_t hndlptr = (uintptr_t)img;
|
||||||
|
unsigned int hndl = (unsigned int)hndlptr;
|
||||||
|
assert(sizeof(hndl) == sizeof(hndlptr) || hndl == hndlptr);
|
||||||
|
ImagesHndlMap::iterator i( m_eglImages.find(hndl) );
|
||||||
if (i != m_eglImages.end())
|
if (i != m_eglImages.end())
|
||||||
{
|
{
|
||||||
m_eglImages.erase(i);
|
m_eglImages.erase(i);
|
||||||
|
|||||||
@@ -1041,13 +1041,13 @@ EGLImageKHR eglCreateImageKHR(EGLDisplay display, EGLContext context, EGLenum ta
|
|||||||
ThreadInfo* thread = getThreadInfo();
|
ThreadInfo* thread = getThreadInfo();
|
||||||
ShareGroupPtr sg = thread->shareGroup;
|
ShareGroupPtr sg = thread->shareGroup;
|
||||||
if (sg.Ptr() != NULL) {
|
if (sg.Ptr() != NULL) {
|
||||||
unsigned int globalTexName = sg->getGlobalName(TEXTURE, (unsigned int)buffer);
|
unsigned int globalTexName = sg->getGlobalName(TEXTURE, (uintptr_t)buffer);
|
||||||
if (!globalTexName) return EGL_NO_IMAGE_KHR;
|
if (!globalTexName) return EGL_NO_IMAGE_KHR;
|
||||||
|
|
||||||
ImagePtr img( new EglImage() );
|
ImagePtr img( new EglImage() );
|
||||||
if (img.Ptr() != NULL) {
|
if (img.Ptr() != NULL) {
|
||||||
|
|
||||||
ObjectDataPtr objData = sg->getObjectData(TEXTURE, (unsigned int)buffer);
|
ObjectDataPtr objData = sg->getObjectData(TEXTURE, (uintptr_t)buffer);
|
||||||
if (!objData.Ptr()) return EGL_NO_IMAGE_KHR;
|
if (!objData.Ptr()) return EGL_NO_IMAGE_KHR;
|
||||||
|
|
||||||
TextureData *texData = (TextureData *)objData.Ptr();
|
TextureData *texData = (TextureData *)objData.Ptr();
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include <GLES/glext.h>
|
#include <GLES/glext.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
@@ -585,7 +586,7 @@ GL_API void GL_APIENTRY glDrawElements( GLenum mode, GLsizei count, GLenum type
|
|||||||
GLESConversionArrays tmpArrs;
|
GLESConversionArrays tmpArrs;
|
||||||
if(ctx->isBindedBuffer(GL_ELEMENT_ARRAY_BUFFER)) { // if vbo is binded take the indices from the vbo
|
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));
|
const unsigned char* buf = static_cast<unsigned char *>(ctx->getBindedBuffer(GL_ELEMENT_ARRAY_BUFFER));
|
||||||
indices = buf+reinterpret_cast<unsigned int>(elementsIndices);
|
indices = buf+reinterpret_cast<uintptr_t>(elementsIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->setupArraysPointers(tmpArrs,0,count,type,indices,false);
|
ctx->setupArraysPointers(tmpArrs,0,count,type,indices,false);
|
||||||
@@ -1655,7 +1656,10 @@ GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOE
|
|||||||
{
|
{
|
||||||
GET_CTX();
|
GET_CTX();
|
||||||
SET_ERROR_IF(!GLEScmValidate::textureTargetLimited(target),GL_INVALID_ENUM);
|
SET_ERROR_IF(!GLEScmValidate::textureTargetLimited(target),GL_INVALID_ENUM);
|
||||||
EglImage *img = s_eglIface->eglAttachEGLImage((unsigned int)image);
|
uintptr_t imagehndlptr = (uintptr_t)image;
|
||||||
|
unsigned int imagehndl = (unsigned int)imagehndlptr;
|
||||||
|
assert(sizeof(imagehndl) == sizeof(imagehndlptr) || imagehndl == imagehndlptr);
|
||||||
|
EglImage *img = s_eglIface->eglAttachEGLImage(imagehndl);
|
||||||
if (img) {
|
if (img) {
|
||||||
// Create the texture object in the underlying EGL implementation,
|
// Create the texture object in the underlying EGL implementation,
|
||||||
// flag to the OpenGL layer to skip the image creation and map the
|
// flag to the OpenGL layer to skip the image creation and map the
|
||||||
@@ -1679,7 +1683,7 @@ GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOE
|
|||||||
texData->height = img->height;
|
texData->height = img->height;
|
||||||
texData->border = img->border;
|
texData->border = img->border;
|
||||||
texData->internalFormat = img->internalFormat;
|
texData->internalFormat = img->internalFormat;
|
||||||
texData->sourceEGLImage = (unsigned int)image;
|
texData->sourceEGLImage = imagehndl;
|
||||||
texData->eglImageDetach = s_eglIface->eglDetachEGLImage;
|
texData->eglImageDetach = s_eglIface->eglDetachEGLImage;
|
||||||
texData->oldGlobal = oldGlobal;
|
texData->oldGlobal = oldGlobal;
|
||||||
}
|
}
|
||||||
@@ -1690,7 +1694,10 @@ GL_API void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target, GL
|
|||||||
{
|
{
|
||||||
GET_CTX();
|
GET_CTX();
|
||||||
SET_ERROR_IF(target != GL_RENDERBUFFER_OES,GL_INVALID_ENUM);
|
SET_ERROR_IF(target != GL_RENDERBUFFER_OES,GL_INVALID_ENUM);
|
||||||
EglImage *img = s_eglIface->eglAttachEGLImage((unsigned int)image);
|
uintptr_t imagehndlptr = (uintptr_t)image;
|
||||||
|
unsigned int imagehndl = (unsigned int)imagehndlptr;
|
||||||
|
assert(sizeof(imagehndl) == sizeof(imagehndlptr) || imagehndl == imagehndlptr);
|
||||||
|
EglImage *img = s_eglIface->eglAttachEGLImage(imagehndl);
|
||||||
SET_ERROR_IF(!img,GL_INVALID_VALUE);
|
SET_ERROR_IF(!img,GL_INVALID_VALUE);
|
||||||
SET_ERROR_IF(!ctx->shareGroup().Ptr(),GL_INVALID_OPERATION);
|
SET_ERROR_IF(!ctx->shareGroup().Ptr(),GL_INVALID_OPERATION);
|
||||||
|
|
||||||
@@ -1705,7 +1712,7 @@ GL_API void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target, GL
|
|||||||
//
|
//
|
||||||
// flag in the renderbufferData that it is an eglImage target
|
// flag in the renderbufferData that it is an eglImage target
|
||||||
//
|
//
|
||||||
rbData->sourceEGLImage = (unsigned int)image;
|
rbData->sourceEGLImage = imagehndl;
|
||||||
rbData->eglImageDetach = s_eglIface->eglDetachEGLImage;
|
rbData->eglImageDetach = s_eglIface->eglDetachEGLImage;
|
||||||
rbData->eglImageGlobalTexName = img->globalTexName;
|
rbData->eglImageGlobalTexName = img->globalTexName;
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include "ProgramData.h"
|
#include "ProgramData.h"
|
||||||
#include <GLcommon/TextureUtils.h>
|
#include <GLcommon/TextureUtils.h>
|
||||||
#include <GLcommon/FramebufferData.h>
|
#include <GLcommon/FramebufferData.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
@@ -593,7 +594,7 @@ GL_APICALL void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum t
|
|||||||
const GLvoid* indices = elementsIndices;
|
const GLvoid* indices = elementsIndices;
|
||||||
if(ctx->isBindedBuffer(GL_ELEMENT_ARRAY_BUFFER)) { // if vbo is binded take the indices from the vbo
|
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));
|
const unsigned char* buf = static_cast<unsigned char *>(ctx->getBindedBuffer(GL_ELEMENT_ARRAY_BUFFER));
|
||||||
indices = buf+reinterpret_cast<unsigned int>(elementsIndices);
|
indices = buf+reinterpret_cast<uintptr_t>(elementsIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLESConversionArrays tmpArrs;
|
GLESConversionArrays tmpArrs;
|
||||||
@@ -2008,7 +2009,10 @@ GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglIma
|
|||||||
{
|
{
|
||||||
GET_CTX();
|
GET_CTX();
|
||||||
SET_ERROR_IF(!GLESv2Validate::textureTargetLimited(target),GL_INVALID_ENUM);
|
SET_ERROR_IF(!GLESv2Validate::textureTargetLimited(target),GL_INVALID_ENUM);
|
||||||
EglImage *img = s_eglIface->eglAttachEGLImage((unsigned int)image);
|
uintptr_t imagehndlptr = (uintptr_t)image;
|
||||||
|
unsigned int imagehndl = (unsigned int)imagehndlptr;
|
||||||
|
assert(sizeof(imagehndl) == sizeof(imagehndlptr) || imagehndl == imagehndlptr);
|
||||||
|
EglImage *img = s_eglIface->eglAttachEGLImage(imagehndl);
|
||||||
if (img) {
|
if (img) {
|
||||||
// Create the texture object in the underlying EGL implementation,
|
// Create the texture object in the underlying EGL implementation,
|
||||||
// flag to the OpenGL layer to skip the image creation and map the
|
// flag to the OpenGL layer to skip the image creation and map the
|
||||||
@@ -2032,7 +2036,7 @@ GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglIma
|
|||||||
texData->height = img->height;
|
texData->height = img->height;
|
||||||
texData->border = img->border;
|
texData->border = img->border;
|
||||||
texData->internalFormat = img->internalFormat;
|
texData->internalFormat = img->internalFormat;
|
||||||
texData->sourceEGLImage = (unsigned int)image;
|
texData->sourceEGLImage = (unsigned int)imagehndl;
|
||||||
texData->eglImageDetach = s_eglIface->eglDetachEGLImage;
|
texData->eglImageDetach = s_eglIface->eglDetachEGLImage;
|
||||||
texData->oldGlobal = oldGlobal;
|
texData->oldGlobal = oldGlobal;
|
||||||
}
|
}
|
||||||
@@ -2043,7 +2047,10 @@ GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target
|
|||||||
{
|
{
|
||||||
GET_CTX();
|
GET_CTX();
|
||||||
SET_ERROR_IF(target != GL_RENDERBUFFER_OES,GL_INVALID_ENUM);
|
SET_ERROR_IF(target != GL_RENDERBUFFER_OES,GL_INVALID_ENUM);
|
||||||
EglImage *img = s_eglIface->eglAttachEGLImage((unsigned int)image);
|
uintptr_t imagehndlptr = (uintptr_t)image;
|
||||||
|
unsigned int imagehndl = (unsigned int)imagehndlptr;
|
||||||
|
assert(sizeof(imagehndl) == sizeof(imagehndlptr) || imagehndl == imagehndlptr);
|
||||||
|
EglImage *img = s_eglIface->eglAttachEGLImage(imagehndl);
|
||||||
SET_ERROR_IF(!img,GL_INVALID_VALUE);
|
SET_ERROR_IF(!img,GL_INVALID_VALUE);
|
||||||
SET_ERROR_IF(!ctx->shareGroup().Ptr(),GL_INVALID_OPERATION);
|
SET_ERROR_IF(!ctx->shareGroup().Ptr(),GL_INVALID_OPERATION);
|
||||||
|
|
||||||
@@ -2058,7 +2065,7 @@ GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target
|
|||||||
//
|
//
|
||||||
// flag in the renderbufferData that it is an eglImage target
|
// flag in the renderbufferData that it is an eglImage target
|
||||||
//
|
//
|
||||||
rbData->sourceEGLImage = (unsigned int)image;
|
rbData->sourceEGLImage = imagehndl;
|
||||||
rbData->eglImageDetach = s_eglIface->eglDetachEGLImage;
|
rbData->eglImageDetach = s_eglIface->eglDetachEGLImage;
|
||||||
rbData->eglImageGlobalTexName = img->globalTexName;
|
rbData->eglImageGlobalTexName = img->globalTexName;
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <GLcommon/TextureUtils.h>
|
#include <GLcommon/TextureUtils.h>
|
||||||
#include <GLcommon/FramebufferData.h>
|
#include <GLcommon/FramebufferData.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
//decleration
|
//decleration
|
||||||
static void convertFixedDirectLoop(const char* dataIn,unsigned int strideIn,void* dataOut,unsigned int nBytes,unsigned int strideOut,int attribSize);
|
static void convertFixedDirectLoop(const char* dataIn,unsigned int strideIn,void* dataOut,unsigned int nBytes,unsigned int strideOut,int attribSize);
|
||||||
@@ -173,7 +174,9 @@ GLEScontext::~GLEScontext() {
|
|||||||
const GLvoid* GLEScontext::setPointer(GLenum arrType,GLint size,GLenum type,GLsizei stride,const GLvoid* data,bool normalize) {
|
const GLvoid* GLEScontext::setPointer(GLenum arrType,GLint size,GLenum type,GLsizei stride,const GLvoid* data,bool normalize) {
|
||||||
GLuint bufferName = m_arrayBuffer;
|
GLuint bufferName = m_arrayBuffer;
|
||||||
if(bufferName) {
|
if(bufferName) {
|
||||||
unsigned int offset = reinterpret_cast<unsigned int>(data);
|
uintptr_t offsetptr = (uintptr_t)data;
|
||||||
|
unsigned int offset = offsetptr;
|
||||||
|
assert(sizeof(offset) == sizeof(offsetptr) || offset == offsetptr);
|
||||||
GLESbuffer* vbo = static_cast<GLESbuffer*>(m_shareGroup->getObjectData(VERTEXBUFFER,bufferName).Ptr());
|
GLESbuffer* vbo = static_cast<GLESbuffer*>(m_shareGroup->getObjectData(VERTEXBUFFER,bufferName).Ptr());
|
||||||
m_map[arrType]->setBuffer(size,type,stride,vbo,bufferName,offset,normalize);
|
m_map[arrType]->setBuffer(size,type,stride,vbo,bufferName,offset,normalize);
|
||||||
return static_cast<const unsigned char*>(vbo->getData()) + offset;
|
return static_cast<const unsigned char*>(vbo->getData()) + offset;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ int ReadBuffer::getData()
|
|||||||
|
|
||||||
new_buf = (unsigned char*)realloc(m_buf, new_size);
|
new_buf = (unsigned char*)realloc(m_buf, new_size);
|
||||||
if (!new_buf) {
|
if (!new_buf) {
|
||||||
ERR("Failed to alloc %d bytes for ReadBuffer\n", new_size);
|
ERR("Failed to alloc %zu bytes for ReadBuffer\n", new_size);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
m_size = new_size;
|
m_size = new_size;
|
||||||
|
|||||||
@@ -519,7 +519,7 @@ int ApiGen::genEncoderImpl(const std::string &filename)
|
|||||||
npointers += writeVarEncodingSize(evars[j], fp);
|
npointers += writeVarEncodingSize(evars[j], fp);
|
||||||
}
|
}
|
||||||
if (npointers > 0) {
|
if (npointers > 0) {
|
||||||
fprintf(fp, " + %u*4", npointers);
|
fprintf(fp, " + %zu*4", npointers);
|
||||||
}
|
}
|
||||||
fprintf(fp, ";\n");
|
fprintf(fp, ";\n");
|
||||||
|
|
||||||
@@ -561,7 +561,7 @@ int ApiGen::genEncoderImpl(const std::string &filename)
|
|||||||
npointers += writeVarEncodingSize(evars[j], fp);
|
npointers += writeVarEncodingSize(evars[j], fp);
|
||||||
}
|
}
|
||||||
if (npointers > 0) {
|
if (npointers > 0) {
|
||||||
fprintf(fp, "%s%u*4", plus, npointers); plus = " + ";
|
fprintf(fp, "%s%zu*4", plus, npointers); plus = " + ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(fp,");\n");
|
fprintf(fp,");\n");
|
||||||
@@ -760,6 +760,7 @@ int ApiGen::genDecoderImpl(const std::string &filename)
|
|||||||
fprintf(fp, "#include \"%s_opcodes.h\"\n\n", m_basename.c_str());
|
fprintf(fp, "#include \"%s_opcodes.h\"\n\n", m_basename.c_str());
|
||||||
fprintf(fp, "#include \"%s_dec.h\"\n\n\n", m_basename.c_str());
|
fprintf(fp, "#include \"%s_dec.h\"\n\n\n", m_basename.c_str());
|
||||||
fprintf(fp, "#include <stdio.h>\n\n");
|
fprintf(fp, "#include <stdio.h>\n\n");
|
||||||
|
fprintf(fp, "typedef unsigned int tsize_t; // Target \"size_t\", which is 32-bit for now. It may or may not be the same as host's size_t when emugen is compiled.\n\n");
|
||||||
|
|
||||||
// decoder switch;
|
// decoder switch;
|
||||||
fprintf(fp, "size_t %s::decode(void *buf, size_t len, IOStream *stream)\n{\n", classname.c_str());
|
fprintf(fp, "size_t %s::decode(void *buf, size_t len, IOStream *stream)\n{\n", classname.c_str());
|
||||||
@@ -859,7 +860,7 @@ int ApiGen::genDecoderImpl(const std::string &filename)
|
|||||||
v->type()->name().c_str(), varoffset.c_str(),
|
v->type()->name().c_str(), varoffset.c_str(),
|
||||||
varoffset.c_str());
|
varoffset.c_str());
|
||||||
}
|
}
|
||||||
varoffset += " + 4 + *(size_t *)(ptr +" + varoffset + ")";
|
varoffset += " + 4 + *(tsize_t *)(ptr +" + varoffset + ")";
|
||||||
} else { // out pointer;
|
} else { // out pointer;
|
||||||
if (pass == PASS_TmpBuffAlloc) {
|
if (pass == PASS_TmpBuffAlloc) {
|
||||||
fprintf(fp, "\t\t\tsize_t tmpPtr%uSize = (size_t)*(unsigned int *)(ptr + %s);\n",
|
fprintf(fp, "\t\t\tsize_t tmpPtr%uSize = (size_t)*(unsigned int *)(ptr + %s);\n",
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ void *SocketStream::allocBuffer(size_t minSize)
|
|||||||
m_buf = p;
|
m_buf = p;
|
||||||
m_bufsize = allocSize;
|
m_bufsize = allocSize;
|
||||||
} else {
|
} else {
|
||||||
ERR("%s: realloc (%d) failed\n", __FUNCTION__, allocSize);
|
ERR("%s: realloc (%zu) failed\n", __FUNCTION__, allocSize);
|
||||||
free(m_buf);
|
free(m_buf);
|
||||||
m_buf = NULL;
|
m_buf = NULL;
|
||||||
m_bufsize = 0;
|
m_bufsize = 0;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else // !WIN32
|
#else // !WIN32
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <inttypes.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace osUtils {
|
namespace osUtils {
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ Thread::thread_main(void *p_arg)
|
|||||||
|
|
||||||
pthread_mutex_lock(&self->m_lock);
|
pthread_mutex_lock(&self->m_lock);
|
||||||
self->m_isRunning = false;
|
self->m_isRunning = false;
|
||||||
self->m_exitStatus = (int)ret;
|
self->m_exitStatus = (int)(intptr_t)ret;
|
||||||
pthread_mutex_unlock(&self->m_lock);
|
pthread_mutex_unlock(&self->m_lock);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user