Fix Windows x64 type inconsistency regarding RageTexture

This commit is contained in:
Prcuvu
2019-10-03 08:58:14 +08:00
parent 7e96188088
commit 54c067f48d
18 changed files with 107 additions and 105 deletions
+2 -2
View File
@@ -185,8 +185,8 @@ void ImageCache::ReadFromDisk()
struct ImageTexture: public RageTexture struct ImageTexture: public RageTexture
{ {
unsigned m_uTexHandle; uintptr_t m_uTexHandle;
unsigned GetTexHandle() const { return m_uTexHandle; }; // accessed by RageDisplay uintptr_t GetTexHandle() const { return m_uTexHandle; }; // accessed by RageDisplay
/* This is a reference to a pointer in g_ImagePathToImage. */ /* This is a reference to a pointer in g_ImagePathToImage. */
RageSurface *&m_pImage; RageSurface *&m_pImage;
int m_iWidth, m_iHeight; int m_iWidth, m_iHeight;
+2 -2
View File
@@ -13,12 +13,12 @@ public:
/* only called by RageTextureManager::InvalidateTextures */ /* only called by RageTextureManager::InvalidateTextures */
virtual void Invalidate() { m_uTexHandle = 0; /* don't Destroy() */} virtual void Invalidate() { m_uTexHandle = 0; /* don't Destroy() */}
virtual void Reload(); virtual void Reload();
virtual unsigned GetTexHandle() const { return m_uTexHandle; }; // accessed by RageDisplay virtual uintptr_t GetTexHandle() const { return m_uTexHandle; }; // accessed by RageDisplay
private: private:
void Create(); // called by constructor and Reload void Create(); // called by constructor and Reload
void Destroy(); void Destroy();
unsigned m_uTexHandle; // treat as unsigned in OpenGL, ID3D8Texture* for D3D uintptr_t m_uTexHandle; // treat as unsigned in OpenGL, IDirect3DTexture9* for D3D
}; };
#endif #endif
+10 -10
View File
@@ -205,7 +205,7 @@ struct RageTextureLock
/* Given a surface with a format and no pixel data, lock the texture into the /* Given a surface with a format and no pixel data, lock the texture into the
* surface. The data is write-only. */ * surface. The data is write-only. */
virtual void Lock( unsigned iTexHandle, RageSurface *pSurface ) = 0; virtual void Lock( uintptr_t iTexHandle, RageSurface *pSurface ) = 0;
/* Unlock and update the texture. If bChanged is false, the texture update /* Unlock and update the texture. If bChanged is false, the texture update
* may be omitted. */ * may be omitted. */
@@ -261,23 +261,23 @@ public:
/* return 0 if failed or internal texture resource handle /* return 0 if failed or internal texture resource handle
* (unsigned in OpenGL, texture pointer in D3D) */ * (unsigned in OpenGL, texture pointer in D3D) */
virtual unsigned CreateTexture( virtual uintptr_t CreateTexture(
RagePixelFormat pixfmt, // format of img and of texture in video mem RagePixelFormat pixfmt, // format of img and of texture in video mem
RageSurface* img, // must be in pixfmt RageSurface* img, // must be in pixfmt
bool bGenerateMipMaps bool bGenerateMipMaps
) = 0; ) = 0;
virtual void UpdateTexture( virtual void UpdateTexture(
unsigned iTexHandle, uintptr_t iTexHandle,
RageSurface* img, RageSurface* img,
int xoffset, int yoffset, int width, int height int xoffset, int yoffset, int width, int height
) = 0; ) = 0;
virtual void DeleteTexture( unsigned iTexHandle ) = 0; virtual void DeleteTexture( uintptr_t iTexHandle ) = 0;
/* Return an object to lock pixels for streaming. If not supported, returns nullptr. /* Return an object to lock pixels for streaming. If not supported, returns nullptr.
* Delete the object normally. */ * Delete the object normally. */
virtual RageTextureLock *CreateTextureLock() { return nullptr; } virtual RageTextureLock *CreateTextureLock() { return nullptr; }
virtual void ClearAllTextures() = 0; virtual void ClearAllTextures() = 0;
virtual int GetNumTextureUnits() = 0; virtual int GetNumTextureUnits() = 0;
virtual void SetTexture( TextureUnit, unsigned /* iTexture */ ) = 0; virtual void SetTexture( TextureUnit, uintptr_t /* iTexture */ ) = 0;
virtual void SetTextureMode( TextureUnit, TextureMode ) = 0; virtual void SetTextureMode( TextureUnit, TextureMode ) = 0;
virtual void SetTextureWrapping( TextureUnit, bool ) = 0; virtual void SetTextureWrapping( TextureUnit, bool ) = 0;
virtual int GetMaxTextureSize() const = 0; virtual int GetMaxTextureSize() const = 0;
@@ -293,9 +293,9 @@ public:
* DeleteTexture. (UpdateTexture is not permitted.) Returns 0 if render-to- * DeleteTexture. (UpdateTexture is not permitted.) Returns 0 if render-to-
* texture is unsupported. * texture is unsupported.
*/ */
virtual unsigned CreateRenderTarget( const RenderTargetParam &, int & /* iTextureWidthOut */, int & /* iTextureHeightOut */ ) { return 0; } virtual uintptr_t CreateRenderTarget( const RenderTargetParam &, int & /* iTextureWidthOut */, int & /* iTextureHeightOut */ ) { return 0; }
virtual unsigned GetRenderTarget() { return 0; } virtual uintptr_t GetRenderTarget() { return 0; }
/* Set the render target, or 0 to resume rendering to the framebuffer. An active render /* Set the render target, or 0 to resume rendering to the framebuffer. An active render
* target may not be used as a texture. If bPreserveTexture is true, the contents * target may not be used as a texture. If bPreserveTexture is true, the contents
@@ -303,7 +303,7 @@ public:
* bPreserveTexture is true the first time a render target is used, behave as if * bPreserveTexture is true the first time a render target is used, behave as if
* bPreserveTexture was false. * bPreserveTexture was false.
*/ */
virtual void SetRenderTarget( unsigned /* iHandle */, bool /* bPreserveTexture */ = true ) { } virtual void SetRenderTarget( uintptr_t /* iHandle */, bool /* bPreserveTexture */ = true ) { }
virtual bool IsZTestEnabled() const = 0; virtual bool IsZTestEnabled() const = 0;
virtual bool IsZWriteEnabled() const = 0; virtual bool IsZWriteEnabled() const = 0;
@@ -364,9 +364,9 @@ public:
}; };
bool SaveScreenshot( RString sPath, GraphicsFileFormat format ); bool SaveScreenshot( RString sPath, GraphicsFileFormat format );
virtual RString GetTextureDiagnostics( unsigned /* id */ ) const { return RString(); } virtual RString GetTextureDiagnostics( uintptr_t /* id */ ) const { return RString(); }
virtual RageSurface* CreateScreenshot() = 0; // allocates a surface. Caller must delete it. virtual RageSurface* CreateScreenshot() = 0; // allocates a surface. Caller must delete it.
virtual RageSurface *GetTexture( unsigned /* iTexture */ ) { return nullptr; } // allocates a surface. Caller must delete it. virtual RageSurface *GetTexture( uintptr_t /* iTexture */ ) { return nullptr; } // allocates a surface. Caller must delete it.
protected: protected:
virtual void DrawQuadsInternal( const RageSpriteVertex v[], int iNumVerts ) = 0; virtual void DrawQuadsInternal( const RageSpriteVertex v[], int iNumVerts ) = 0;
+26 -26
View File
@@ -52,13 +52,13 @@ const D3DFORMAT g_DefaultAdapterFormat = D3DFMT_X8R8G8B8;
/* Direct3D doesn't associate a palette with textures. Instead, we load a /* Direct3D doesn't associate a palette with textures. Instead, we load a
* palette into a slot. We need to keep track of which texture's palette is * palette into a slot. We need to keep track of which texture's palette is
* stored in what slot. */ * stored in what slot. */
map<unsigned,int> g_TexResourceToPaletteIndex; std::map<uintptr_t, size_t> g_TexResourceToPaletteIndex;
list<int> g_PaletteIndex; std::list<size_t> g_PaletteIndex;
struct TexturePalette { PALETTEENTRY p[256]; }; struct TexturePalette { PALETTEENTRY p[256]; };
map<unsigned,TexturePalette> g_TexResourceToTexturePalette; std::map<uintptr_t, TexturePalette> g_TexResourceToTexturePalette;
// Load the palette, if any, for the given texture into a palette slot, and make it current. // Load the palette, if any, for the given texture into a palette slot, and make it current.
static void SetPalette( unsigned TexResource ) static void SetPalette( uintptr_t TexResource )
{ {
// If the texture isn't paletted, we have nothing to do. // If the texture isn't paletted, we have nothing to do.
if( g_TexResourceToTexturePalette.find(TexResource) == g_TexResourceToTexturePalette.end() ) if( g_TexResourceToTexturePalette.find(TexResource) == g_TexResourceToTexturePalette.end() )
@@ -68,10 +68,10 @@ static void SetPalette( unsigned TexResource )
if( g_TexResourceToPaletteIndex.find(TexResource) == g_TexResourceToPaletteIndex.end() ) if( g_TexResourceToPaletteIndex.find(TexResource) == g_TexResourceToPaletteIndex.end() )
{ {
// It's not. Grab the least recently used slot. // It's not. Grab the least recently used slot.
int iPalIndex = g_PaletteIndex.front(); UINT iPalIndex = static_cast<UINT>(g_PaletteIndex.front());
// If any other texture is currently using this slot, mark that palette unloaded. // If any other texture is currently using this slot, mark that palette unloaded.
for( map<unsigned,int>::iterator i = g_TexResourceToPaletteIndex.begin(); i != g_TexResourceToPaletteIndex.end(); ++i ) for( std::map<uintptr_t, size_t>::iterator i = g_TexResourceToPaletteIndex.begin(); i != g_TexResourceToPaletteIndex.end(); ++i )
{ {
if( i->second != iPalIndex ) if( i->second != iPalIndex )
continue; continue;
@@ -89,7 +89,7 @@ static void SetPalette( unsigned TexResource )
const int iPalIndex = g_TexResourceToPaletteIndex[TexResource]; const int iPalIndex = g_TexResourceToPaletteIndex[TexResource];
// Find this palette index in the least-recently-used queue and move it to the end. // Find this palette index in the least-recently-used queue and move it to the end.
for(list<int>::iterator i = g_PaletteIndex.begin(); i != g_PaletteIndex.end(); ++i) for(std::list<size_t>::iterator i = g_PaletteIndex.begin(); i != g_PaletteIndex.end(); ++i)
{ {
if( *i != iPalIndex ) if( *i != iPalIndex )
continue; continue;
@@ -335,7 +335,7 @@ D3DFORMAT FindBackBufferType(bool bWindowed, int iBPP)
} }
// Test each back buffer format until we find something that works. // Test each back buffer format until we find something that works.
for( unsigned i=0; i < vBackBufferFormats.size(); i++ ) for( size_t i=0; i < vBackBufferFormats.size(); i++ )
{ {
D3DFORMAT fmtBackBuffer = vBackBufferFormats[i]; D3DFORMAT fmtBackBuffer = vBackBufferFormats[i];
@@ -775,18 +775,18 @@ public:
} }
void Change( const vector<msMesh> &vMeshes ) void Change( const vector<msMesh> &vMeshes )
{ {
for( unsigned i=0; i<vMeshes.size(); i++ ) for( size_t i=0; i<vMeshes.size(); i++ )
{ {
const MeshInfo& meshInfo = m_vMeshInfo[i]; const MeshInfo& meshInfo = m_vMeshInfo[i];
const msMesh& mesh = vMeshes[i]; const msMesh& mesh = vMeshes[i];
const vector<RageModelVertex> &Vertices = mesh.Vertices; const vector<RageModelVertex> &Vertices = mesh.Vertices;
const vector<msTriangle> &Triangles = mesh.Triangles; const vector<msTriangle> &Triangles = mesh.Triangles;
for( unsigned j=0; j<Vertices.size(); j++ ) for( size_t j=0; j<Vertices.size(); j++ )
m_vVertex[meshInfo.iVertexStart+j] = Vertices[j]; m_vVertex[meshInfo.iVertexStart+j] = Vertices[j];
for( unsigned j=0; j<Triangles.size(); j++ ) for( size_t j=0; j<Triangles.size(); j++ )
for( unsigned k=0; k<3; k++ ) for( size_t k=0; k<3; k++ )
m_vTriangles[meshInfo.iTriangleStart+j].nVertexIndices[k] = (uint16_t) meshInfo.iVertexStart + Triangles[j].nVertexIndices[k]; m_vTriangles[meshInfo.iTriangleStart+j].nVertexIndices[k] = (uint16_t) meshInfo.iVertexStart + Triangles[j].nVertexIndices[k];
} }
} }
@@ -844,8 +844,8 @@ void RageDisplay_D3D::DrawQuadsInternal( const RageSpriteVertex v[], int iNumVer
// make a temporary index buffer // make a temporary index buffer
static vector<uint16_t> vIndices; static vector<uint16_t> vIndices;
unsigned uOldSize = vIndices.size(); size_t uOldSize = vIndices.size();
unsigned uNewSize = max(uOldSize,(unsigned)iNumIndices); size_t uNewSize = max(uOldSize, static_cast<size_t>(iNumIndices));
vIndices.resize( uNewSize ); vIndices.resize( uNewSize );
for( uint16_t i=(uint16_t)uOldSize/6; i<(uint16_t)iNumQuads; i++ ) for( uint16_t i=(uint16_t)uOldSize/6; i<(uint16_t)iNumQuads; i++ )
{ {
@@ -880,8 +880,8 @@ void RageDisplay_D3D::DrawQuadStripInternal( const RageSpriteVertex v[], int iNu
// make a temporary index buffer // make a temporary index buffer
static vector<uint16_t> vIndices; static vector<uint16_t> vIndices;
unsigned uOldSize = vIndices.size(); size_t uOldSize = vIndices.size();
unsigned uNewSize = max(uOldSize,(unsigned)iNumIndices); size_t uNewSize = max(uOldSize, static_cast<size_t>(iNumIndices));
vIndices.resize( uNewSize ); vIndices.resize( uNewSize );
for( uint16_t i=(uint16_t)uOldSize/6; i<(uint16_t)iNumQuads; i++ ) for( uint16_t i=(uint16_t)uOldSize/6; i<(uint16_t)iNumQuads; i++ )
{ {
@@ -915,8 +915,8 @@ void RageDisplay_D3D::DrawSymmetricQuadStripInternal( const RageSpriteVertex v[]
// make a temporary index buffer // make a temporary index buffer
static vector<uint16_t> vIndices; static vector<uint16_t> vIndices;
unsigned uOldSize = vIndices.size(); size_t uOldSize = vIndices.size();
unsigned uNewSize = max(uOldSize,(unsigned)iNumIndices); size_t uNewSize = max(uOldSize, static_cast<size_t>(iNumIndices));
vIndices.resize( uNewSize ); vIndices.resize( uNewSize );
for( uint16_t i=(uint16_t)uOldSize/12; i<(uint16_t)iNumPieces; i++ ) for( uint16_t i=(uint16_t)uOldSize/12; i<(uint16_t)iNumPieces; i++ )
{ {
@@ -1041,7 +1041,7 @@ int RageDisplay_D3D::GetNumTextureUnits()
return g_DeviceCaps.MaxSimultaneousTextures; return g_DeviceCaps.MaxSimultaneousTextures;
} }
void RageDisplay_D3D::SetTexture( TextureUnit tu, unsigned iTexture ) void RageDisplay_D3D::SetTexture( TextureUnit tu, uintptr_t iTexture )
{ {
// g_DeviceCaps.MaxSimultaneousTextures = 1; // g_DeviceCaps.MaxSimultaneousTextures = 1;
if( tu >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported if( tu >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
@@ -1058,7 +1058,7 @@ void RageDisplay_D3D::SetTexture( TextureUnit tu, unsigned iTexture )
} }
else else
{ {
IDirect3DTexture9* pTex = (IDirect3DTexture9*) iTexture; IDirect3DTexture9* pTex = reinterpret_cast<IDirect3DTexture9*>(iTexture);
g_pd3dDevice->SetTexture( tu, pTex ); g_pd3dDevice->SetTexture( tu, pTex );
/* Intentionally commented out. Don't mess with texture stage state /* Intentionally commented out. Don't mess with texture stage state
@@ -1349,12 +1349,12 @@ void RageDisplay_D3D::SetCullMode( CullMode mode )
} }
} }
void RageDisplay_D3D::DeleteTexture( unsigned iTexHandle ) void RageDisplay_D3D::DeleteTexture( uintptr_t iTexHandle )
{ {
if( iTexHandle == 0 ) if( iTexHandle == 0 )
return; return;
IDirect3DTexture9* pTex = (IDirect3DTexture9*) iTexHandle; IDirect3DTexture9* pTex = reinterpret_cast<IDirect3DTexture9*>(iTexHandle);
pTex->Release(); pTex->Release();
// Delete palette (if any) // Delete palette (if any)
@@ -1365,7 +1365,7 @@ void RageDisplay_D3D::DeleteTexture( unsigned iTexHandle )
} }
unsigned RageDisplay_D3D::CreateTexture( uintptr_t RageDisplay_D3D::CreateTexture(
RagePixelFormat pixfmt, RagePixelFormat pixfmt,
RageSurface* img, RageSurface* img,
bool bGenerateMipMaps ) bool bGenerateMipMaps )
@@ -1378,7 +1378,7 @@ unsigned RageDisplay_D3D::CreateTexture(
RageException::Throw( "CreateTexture(%i,%i,%s) failed: %s", RageException::Throw( "CreateTexture(%i,%i,%s) failed: %s",
img->w, img->h, RagePixelFormatToString(pixfmt).c_str(), GetErrorString(hr).c_str() ); img->w, img->h, RagePixelFormatToString(pixfmt).c_str(), GetErrorString(hr).c_str() );
unsigned uTexHandle = (unsigned)pTex; uintptr_t uTexHandle = reinterpret_cast<uintptr_t>(pTex);
if( pixfmt == RagePixelFormat_PAL ) if( pixfmt == RagePixelFormat_PAL )
{ {
@@ -1404,11 +1404,11 @@ unsigned RageDisplay_D3D::CreateTexture(
} }
void RageDisplay_D3D::UpdateTexture( void RageDisplay_D3D::UpdateTexture(
unsigned uTexHandle, uintptr_t uTexHandle,
RageSurface* img, RageSurface* img,
int xoffset, int yoffset, int width, int height ) int xoffset, int yoffset, int width, int height )
{ {
IDirect3DTexture9* pTex = (IDirect3DTexture9*)uTexHandle; IDirect3DTexture9* pTex = reinterpret_cast<IDirect3DTexture9*>(uTexHandle);
ASSERT( pTex != nullptr ); ASSERT( pTex != nullptr );
RECT rect; RECT rect;
+4 -4
View File
@@ -22,19 +22,19 @@ public:
bool SupportsTextureFormat( RagePixelFormat pixfmt, bool realtime=false ); bool SupportsTextureFormat( RagePixelFormat pixfmt, bool realtime=false );
bool SupportsThreadedRendering(); bool SupportsThreadedRendering();
bool SupportsPerVertexMatrixScale() { return false; } bool SupportsPerVertexMatrixScale() { return false; }
unsigned CreateTexture( uintptr_t CreateTexture(
RagePixelFormat pixfmt, RagePixelFormat pixfmt,
RageSurface* img, RageSurface* img,
bool bGenerateMipMaps ); bool bGenerateMipMaps );
void UpdateTexture( void UpdateTexture(
unsigned iTexHandle, uintptr_t iTexHandle,
RageSurface* img, RageSurface* img,
int xoffset, int yoffset, int width, int height int xoffset, int yoffset, int width, int height
); );
void DeleteTexture( unsigned iTexHandle ); void DeleteTexture( uintptr_t iTexHandle );
void ClearAllTextures(); void ClearAllTextures();
int GetNumTextureUnits(); int GetNumTextureUnits();
void SetTexture( TextureUnit tu, unsigned iTexture ); void SetTexture( TextureUnit tu, uintptr_t iTexture );
void SetTextureMode( TextureUnit tu, TextureMode tm ); void SetTextureMode( TextureUnit tu, TextureMode tm );
void SetTextureWrapping( TextureUnit tu, bool b ); void SetTextureWrapping( TextureUnit tu, bool b );
int GetMaxTextureSize() const; int GetMaxTextureSize() const;
+4 -4
View File
@@ -19,19 +19,19 @@ public:
void SetBlendMode( BlendMode ) { } void SetBlendMode( BlendMode ) { }
bool SupportsTextureFormat( RagePixelFormat, bool /* realtime */ =false ) { return true; } bool SupportsTextureFormat( RagePixelFormat, bool /* realtime */ =false ) { return true; }
bool SupportsPerVertexMatrixScale() { return false; } bool SupportsPerVertexMatrixScale() { return false; }
unsigned CreateTexture( uintptr_t CreateTexture(
RagePixelFormat, RagePixelFormat,
RageSurface* /* img */, RageSurface* /* img */,
bool /* bGenerateMipMaps */ ) { return 1; } bool /* bGenerateMipMaps */ ) { return 1; }
void UpdateTexture( void UpdateTexture(
unsigned /* iTexHandle */, uintptr_t /* iTexHandle */,
RageSurface* /* img */, RageSurface* /* img */,
int /* xoffset */, int /* yoffset */, int /* width */, int /* height */ int /* xoffset */, int /* yoffset */, int /* width */, int /* height */
) { } ) { }
void DeleteTexture( unsigned /* iTexHandle */ ) { } void DeleteTexture( uintptr_t /* iTexHandle */ ) { }
void ClearAllTextures() { } void ClearAllTextures() { }
int GetNumTextureUnits() { return 1; } int GetNumTextureUnits() { return 1; }
void SetTexture( TextureUnit, unsigned /* iTexture */ ) { } void SetTexture( TextureUnit, uintptr_t /* iTexture */ ) { }
void SetTextureMode( TextureUnit, TextureMode ) { } void SetTextureMode( TextureUnit, TextureMode ) { }
void SetTextureWrapping( TextureUnit, bool ) { } void SetTextureWrapping( TextureUnit, bool ) { }
int GetMaxTextureSize() const { return 2048; } int GetMaxTextureSize() const { return 2048; }
+29 -29
View File
@@ -62,7 +62,7 @@ static const GLenum RageSpriteVertexFormat = GL_T2F_C4F_N3F_V3F;
/* If we support texture matrix scaling, a handle to the vertex program: */ /* If we support texture matrix scaling, a handle to the vertex program: */
static GLhandleARB g_bTextureMatrixShader = 0; static GLhandleARB g_bTextureMatrixShader = 0;
static std::map<unsigned, RenderTarget *> g_mapRenderTargets; static std::map<uintptr_t, RenderTarget *> g_mapRenderTargets;
static RenderTarget *g_pCurrentRenderTarget = nullptr; static RenderTarget *g_pCurrentRenderTarget = nullptr;
static LowLevelWindow *g_pWind; static LowLevelWindow *g_pWind;
@@ -795,7 +795,7 @@ RString RageDisplay_Legacy::TryVideoMode( const VideoModeParams &p, bool &bNewDe
/* Delete all render targets. They may have associated resources other than /* Delete all render targets. They may have associated resources other than
* the texture itself. */ * the texture itself. */
for (std::pair<unsigned const, RenderTarget *> &rt : g_mapRenderTargets) for (std::pair<uintptr_t const, RenderTarget *> &rt : g_mapRenderTargets)
delete rt.second; delete rt.second;
g_mapRenderTargets.clear(); g_mapRenderTargets.clear();
@@ -922,14 +922,14 @@ RageSurface* RageDisplay_Legacy::CreateScreenshot()
return image; return image;
} }
RageSurface *RageDisplay_Legacy::GetTexture( unsigned iTexture ) RageSurface *RageDisplay_Legacy::GetTexture( uintptr_t iTexture )
{ {
if (iTexture == 0) if (iTexture == 0)
return nullptr; // XXX return nullptr; // XXX
FlushGLErrors(); FlushGLErrors();
glBindTexture( GL_TEXTURE_2D, iTexture ); glBindTexture( GL_TEXTURE_2D, static_cast<GLuint>(iTexture) );
GLint iHeight, iWidth, iAlphaBits; GLint iHeight, iWidth, iAlphaBits;
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &iHeight ); glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &iHeight );
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &iWidth ); glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &iWidth );
@@ -1677,7 +1677,7 @@ int RageDisplay_Legacy::GetNumTextureUnits()
return g_iMaxTextureUnits; return g_iMaxTextureUnits;
} }
void RageDisplay_Legacy::SetTexture( TextureUnit tu, unsigned iTexture ) void RageDisplay_Legacy::SetTexture( TextureUnit tu, uintptr_t iTexture )
{ {
if (!SetTextureUnit( tu )) if (!SetTextureUnit( tu ))
return; return;
@@ -1685,7 +1685,7 @@ void RageDisplay_Legacy::SetTexture( TextureUnit tu, unsigned iTexture )
if (iTexture) if (iTexture)
{ {
glEnable( GL_TEXTURE_2D ); glEnable( GL_TEXTURE_2D );
glBindTexture( GL_TEXTURE_2D, iTexture ); glBindTexture( GL_TEXTURE_2D, static_cast<GLuint>(iTexture) );
} }
else else
{ {
@@ -2104,7 +2104,7 @@ void RageDisplay_Legacy::EndConcurrentRendering()
g_pWind->EndConcurrentRendering(); g_pWind->EndConcurrentRendering();
} }
void RageDisplay_Legacy::DeleteTexture( unsigned iTexture ) void RageDisplay_Legacy::DeleteTexture( uintptr_t iTexture )
{ {
if (iTexture == 0) if (iTexture == 0)
return; return;
@@ -2189,7 +2189,7 @@ void SetPixelMapForSurface( int glImageFormat, int glTexFormat, const RageSurfac
DebugAssertNoGLError(); DebugAssertNoGLError();
} }
unsigned RageDisplay_Legacy::CreateTexture( uintptr_t RageDisplay_Legacy::CreateTexture(
RagePixelFormat pixfmt, RagePixelFormat pixfmt,
RageSurface* pImg, RageSurface* pImg,
bool bGenerateMipMaps ) bool bGenerateMipMaps )
@@ -2234,11 +2234,11 @@ unsigned RageDisplay_Legacy::CreateTexture(
SetTextureUnit( TextureUnit_1 ); SetTextureUnit( TextureUnit_1 );
// allocate OpenGL texture resource // allocate OpenGL texture resource
unsigned int iTexHandle; uintptr_t iTexHandle;
glGenTextures( 1, reinterpret_cast<GLuint*>(&iTexHandle) ); glGenTextures( 1, reinterpret_cast<GLuint*>(&iTexHandle) );
ASSERT( iTexHandle != 0 ); ASSERT( iTexHandle != 0 );
glBindTexture( GL_TEXTURE_2D, iTexHandle ); glBindTexture( GL_TEXTURE_2D, static_cast<GLuint>(iTexHandle) );
if (g_pWind->GetActualVideoModeParams().bAnisotropicFiltering && if (g_pWind->GetActualVideoModeParams().bAnisotropicFiltering &&
GLEW_EXT_texture_filter_anisotropic ) GLEW_EXT_texture_filter_anisotropic )
@@ -2350,7 +2350,7 @@ public:
m_iTexHandle = 0; m_iTexHandle = 0;
} }
void Lock( unsigned iTexHandle, RageSurface *pSurface ) void Lock( uintptr_t iTexHandle, RageSurface *pSurface )
{ {
ASSERT( m_iTexHandle == 0 ); ASSERT( m_iTexHandle == 0 );
ASSERT( pSurface->pixels == nullptr ); ASSERT( pSurface->pixels == nullptr );
@@ -2396,7 +2396,7 @@ private:
GLuint m_iBuffer; GLuint m_iBuffer;
unsigned m_iTexHandle; uintptr_t m_iTexHandle;
}; };
RageTextureLock *RageDisplay_Legacy::CreateTextureLock() RageTextureLock *RageDisplay_Legacy::CreateTextureLock()
@@ -2408,11 +2408,11 @@ RageTextureLock *RageDisplay_Legacy::CreateTextureLock()
} }
void RageDisplay_Legacy::UpdateTexture( void RageDisplay_Legacy::UpdateTexture(
unsigned iTexHandle, uintptr_t iTexHandle,
RageSurface* pImg, RageSurface* pImg,
int iXOffset, int iYOffset, int iWidth, int iHeight ) int iXOffset, int iYOffset, int iWidth, int iHeight )
{ {
glBindTexture( GL_TEXTURE_2D, iTexHandle ); glBindTexture( GL_TEXTURE_2D, static_cast<GLuint>(iTexHandle) );
bool bFreeImg; bool bFreeImg;
RagePixelFormat SurfacePixFmt = GetImgPixelFormat( pImg, bFreeImg, iWidth, iHeight, false ); RagePixelFormat SurfacePixFmt = GetImgPixelFormat( pImg, bFreeImg, iWidth, iHeight, false );
@@ -2450,16 +2450,16 @@ public:
RenderTarget_FramebufferObject(); RenderTarget_FramebufferObject();
~RenderTarget_FramebufferObject(); ~RenderTarget_FramebufferObject();
void Create( const RenderTargetParam &param, int &iTextureWidthOut, int &iTextureHeightOut ); void Create( const RenderTargetParam &param, int &iTextureWidthOut, int &iTextureHeightOut );
unsigned GetTexture() const { return m_iTexHandle; } uintptr_t GetTexture() const { return m_iTexHandle; }
void StartRenderingTo(); void StartRenderingTo();
void FinishRenderingTo(); void FinishRenderingTo();
virtual bool InvertY() const { return true; } virtual bool InvertY() const { return true; }
private: private:
unsigned int m_iFrameBufferHandle; uintptr_t m_iFrameBufferHandle;
unsigned int m_iTexHandle; uintptr_t m_iTexHandle;
unsigned int m_iDepthBufferHandle; uintptr_t m_iDepthBufferHandle;
}; };
RenderTarget_FramebufferObject::RenderTarget_FramebufferObject() RenderTarget_FramebufferObject::RenderTarget_FramebufferObject()
@@ -2495,7 +2495,7 @@ void RenderTarget_FramebufferObject::Create( const RenderTargetParam &param, int
iTextureWidthOut = iTextureWidth; iTextureWidthOut = iTextureWidth;
iTextureHeightOut = iTextureHeight; iTextureHeightOut = iTextureHeight;
glBindTexture( GL_TEXTURE_2D, m_iTexHandle ); glBindTexture( GL_TEXTURE_2D, static_cast<GLuint>(m_iTexHandle) );
GLenum internalformat; GLenum internalformat;
GLenum type = param.bWithAlpha? GL_RGBA:GL_RGB; GLenum type = param.bWithAlpha? GL_RGBA:GL_RGB;
if (param.bFloat && GLEW_ARB_texture_float) if (param.bFloat && GLEW_ARB_texture_float)
@@ -2517,8 +2517,8 @@ void RenderTarget_FramebufferObject::Create( const RenderTargetParam &param, int
ASSERT( m_iFrameBufferHandle != 0 ); ASSERT( m_iFrameBufferHandle != 0 );
/* Attach the texture to it. */ /* Attach the texture to it. */
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, m_iFrameBufferHandle ); glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, static_cast<GLuint>(m_iFrameBufferHandle) );
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_iTexHandle, 0 ); glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, static_cast<GLuint>(m_iTexHandle), 0 );
DebugAssertNoGLError(); DebugAssertNoGLError();
/* Attach a depth buffer, if requested. */ /* Attach a depth buffer, if requested. */
@@ -2527,9 +2527,9 @@ void RenderTarget_FramebufferObject::Create( const RenderTargetParam &param, int
glGenRenderbuffersEXT( 1, reinterpret_cast<GLuint*>(&m_iDepthBufferHandle) ); glGenRenderbuffersEXT( 1, reinterpret_cast<GLuint*>(&m_iDepthBufferHandle) );
ASSERT( m_iDepthBufferHandle != 0 ); ASSERT( m_iDepthBufferHandle != 0 );
glBindRenderbufferEXT( GL_RENDERBUFFER, m_iDepthBufferHandle ); glBindRenderbufferEXT( GL_RENDERBUFFER, static_cast<GLuint>(m_iDepthBufferHandle) );
glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16, iTextureWidth, iTextureHeight ); glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16, iTextureWidth, iTextureHeight );
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_iDepthBufferHandle ); glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, static_cast<GLuint>(m_iDepthBufferHandle) );
} }
GLenum status = glCheckFramebufferStatusEXT( GL_FRAMEBUFFER_EXT ); GLenum status = glCheckFramebufferStatusEXT( GL_FRAMEBUFFER_EXT );
@@ -2555,7 +2555,7 @@ void RenderTarget_FramebufferObject::Create( const RenderTargetParam &param, int
void RenderTarget_FramebufferObject::StartRenderingTo() void RenderTarget_FramebufferObject::StartRenderingTo()
{ {
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, m_iFrameBufferHandle ); glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, static_cast<GLuint>(m_iFrameBufferHandle) );
} }
void RenderTarget_FramebufferObject::FinishRenderingTo() void RenderTarget_FramebufferObject::FinishRenderingTo()
@@ -2582,7 +2582,7 @@ bool RageDisplay_Legacy::SupportsFullscreenBorderlessWindow() const
* particularly GeForce 2, but is simpler and faster when available. * particularly GeForce 2, but is simpler and faster when available.
*/ */
unsigned RageDisplay_Legacy::CreateRenderTarget( const RenderTargetParam &param, int &iTextureWidthOut, int &iTextureHeightOut ) uintptr_t RageDisplay_Legacy::CreateRenderTarget( const RenderTargetParam &param, int &iTextureWidthOut, int &iTextureHeightOut )
{ {
RenderTarget *pTarget; RenderTarget *pTarget;
if (GLEW_EXT_framebuffer_object) if (GLEW_EXT_framebuffer_object)
@@ -2592,22 +2592,22 @@ unsigned RageDisplay_Legacy::CreateRenderTarget( const RenderTargetParam &param,
pTarget->Create( param, iTextureWidthOut, iTextureHeightOut ); pTarget->Create( param, iTextureWidthOut, iTextureHeightOut );
unsigned iTexture = pTarget->GetTexture(); uintptr_t iTexture = pTarget->GetTexture();
ASSERT( g_mapRenderTargets.find(iTexture) == g_mapRenderTargets.end() ); ASSERT( g_mapRenderTargets.find(iTexture) == g_mapRenderTargets.end() );
g_mapRenderTargets[iTexture] = pTarget; g_mapRenderTargets[iTexture] = pTarget;
return iTexture; return iTexture;
} }
unsigned RageDisplay_Legacy::GetRenderTarget( ) uintptr_t RageDisplay_Legacy::GetRenderTarget()
{ {
for( map<unsigned, RenderTarget*>::const_iterator it = g_mapRenderTargets.begin( ); it != g_mapRenderTargets.end( ); ++it ) for( map<uintptr_t, RenderTarget*>::const_iterator it = g_mapRenderTargets.begin(); it != g_mapRenderTargets.end(); ++it )
if( it->second == g_pCurrentRenderTarget ) if( it->second == g_pCurrentRenderTarget )
return it->first; return it->first;
return 0; return 0;
} }
void RageDisplay_Legacy::SetRenderTarget( unsigned iTexture, bool bPreserveTexture ) void RageDisplay_Legacy::SetRenderTarget( uintptr_t iTexture, bool bPreserveTexture )
{ {
if (iTexture == 0) if (iTexture == 0)
{ {
+8 -8
View File
@@ -53,23 +53,23 @@ public:
void SetBlendMode( BlendMode mode ); void SetBlendMode( BlendMode mode );
bool SupportsTextureFormat( RagePixelFormat pixfmt, bool realtime=false ); bool SupportsTextureFormat( RagePixelFormat pixfmt, bool realtime=false );
bool SupportsPerVertexMatrixScale(); bool SupportsPerVertexMatrixScale();
unsigned CreateTexture( uintptr_t CreateTexture(
RagePixelFormat pixfmt, RagePixelFormat pixfmt,
RageSurface* img, RageSurface* img,
bool bGenerateMipMaps ); bool bGenerateMipMaps );
void UpdateTexture( void UpdateTexture(
unsigned iTexHandle, uintptr_t iTexHandle,
RageSurface* img, RageSurface* img,
int xoffset, int yoffset, int width, int height int xoffset, int yoffset, int width, int height
); );
void DeleteTexture( unsigned iTexHandle ); void DeleteTexture( uintptr_t iTexHandle );
bool UseOffscreenRenderTarget(); bool UseOffscreenRenderTarget();
RageSurface *GetTexture( unsigned iTexture ); RageSurface *GetTexture( uintptr_t iTexture );
RageTextureLock *CreateTextureLock(); RageTextureLock *CreateTextureLock();
void ClearAllTextures(); void ClearAllTextures();
int GetNumTextureUnits(); int GetNumTextureUnits();
void SetTexture( TextureUnit tu, unsigned iTexture ); void SetTexture( TextureUnit tu, uintptr_t iTexture );
void SetTextureMode( TextureUnit tu, TextureMode tm ); void SetTextureMode( TextureUnit tu, TextureMode tm );
void SetTextureWrapping( TextureUnit tu, bool b ); void SetTextureWrapping( TextureUnit tu, bool b );
int GetMaxTextureSize() const; int GetMaxTextureSize() const;
@@ -78,9 +78,9 @@ public:
bool IsEffectModeSupported( EffectMode effect ); bool IsEffectModeSupported( EffectMode effect );
bool SupportsRenderToTexture() const; bool SupportsRenderToTexture() const;
bool SupportsFullscreenBorderlessWindow() const; bool SupportsFullscreenBorderlessWindow() const;
unsigned CreateRenderTarget( const RenderTargetParam &param, int &iTextureWidthOut, int &iTextureHeightOut ); uintptr_t CreateRenderTarget( const RenderTargetParam &param, int &iTextureWidthOut, int &iTextureHeightOut );
unsigned GetRenderTarget(); uintptr_t GetRenderTarget();
void SetRenderTarget( unsigned iHandle, bool bPreserveTexture ); void SetRenderTarget( uintptr_t iHandle, bool bPreserveTexture );
bool IsZWriteEnabled() const; bool IsZWriteEnabled() const;
bool IsZTestEnabled() const; bool IsZTestEnabled() const;
void SetZWrite( bool b ); void SetZWrite( bool b );
+1 -1
View File
@@ -28,7 +28,7 @@ public:
virtual ~RenderTarget() { } virtual ~RenderTarget() { }
virtual void Create( const RenderTargetParam &param, int &iTextureWidthOut, int &iTextureHeightOut ) = 0; virtual void Create( const RenderTargetParam &param, int &iTextureWidthOut, int &iTextureHeightOut ) = 0;
virtual unsigned GetTexture() const = 0; virtual uintptr_t GetTexture() const = 0;
/* Render to this RenderTarget. */ /* Render to this RenderTarget. */
virtual void StartRenderingTo() = 0; virtual void StartRenderingTo() = 0;
+1 -1
View File
@@ -15,7 +15,7 @@ public:
virtual void Update( float /* fDeltaTime */ ) {} virtual void Update( float /* fDeltaTime */ ) {}
virtual void Reload() {} virtual void Reload() {}
virtual void Invalidate() { } /* only called by RageTextureManager::InvalidateTextures */ virtual void Invalidate() { } /* only called by RageTextureManager::InvalidateTextures */
virtual unsigned GetTexHandle() const = 0; // accessed by RageDisplay virtual uintptr_t GetTexHandle() const = 0; // accessed by RageDisplay
// movie texture/animated texture stuff // movie texture/animated texture stuff
virtual void SetPosition( float /* fSeconds */ ) {} // seek virtual void SetPosition( float /* fSeconds */ ) {} // seek
+2 -2
View File
@@ -132,10 +132,10 @@ public:
m_iImageWidth = m_iImageHeight = 1; m_iImageWidth = m_iImageHeight = 1;
CreateFrameRects(); CreateFrameRects();
} }
unsigned GetTexHandle() const { return m_uTexHandle; } uintptr_t GetTexHandle() const { return m_uTexHandle; }
private: private:
unsigned m_uTexHandle; uintptr_t m_uTexHandle;
}; };
// Load and unload textures from disk. // Load and unload textures from disk.
+3 -3
View File
@@ -14,7 +14,7 @@ public:
virtual ~RageTextureRenderTarget(); virtual ~RageTextureRenderTarget();
virtual void Invalidate() { m_iTexHandle = 0; /* don't Destroy() */ } virtual void Invalidate() { m_iTexHandle = 0; /* don't Destroy() */ }
virtual void Reload(); virtual void Reload();
virtual unsigned GetTexHandle() const { return m_iTexHandle; } virtual uintptr_t GetTexHandle() const { return m_iTexHandle; }
void BeginRenderingTo( bool bPreserveTexture = true ); void BeginRenderingTo( bool bPreserveTexture = true );
void FinishRenderingTo(); void FinishRenderingTo();
@@ -26,8 +26,8 @@ private:
void Create(); void Create();
void Destroy(); void Destroy();
unsigned m_iTexHandle; uintptr_t m_iTexHandle;
unsigned m_iPreviousRenderTarget; uintptr_t m_iPreviousRenderTarget;
}; };
#endif #endif
+2
View File
@@ -31,8 +31,10 @@ inline float max( float a, int b ) { return a > b? a:b; }
inline float max( int a, float b ) { return a > b? a:b; } inline float max( int a, float b ) { return a > b? a:b; }
inline unsigned long min( unsigned int a, unsigned long b ) { return a < b? a:b; } inline unsigned long min( unsigned int a, unsigned long b ) { return a < b? a:b; }
inline unsigned long min( unsigned long a, unsigned int b ) { return a < b? a:b; } inline unsigned long min( unsigned long a, unsigned int b ) { return a < b? a:b; }
inline size_t min( unsigned int a, size_t b ) { return a < b? a:b; }
inline unsigned long max( unsigned int a, unsigned long b ) { return a > b? a:b; } inline unsigned long max( unsigned int a, unsigned long b ) { return a > b? a:b; }
inline unsigned long max( unsigned long a, unsigned int b ) { return a > b? a:b; } inline unsigned long max( unsigned long a, unsigned int b ) { return a > b? a:b; }
inline size_t max( unsigned int a, size_t b ) { return a > b? a:b; }
/** @brief If outside the range from low to high, bring it within range. */ /** @brief If outside the range from low to high, bring it within range. */
#define clamp(val,low,high) ( max( (low), min((val),(high)) ) ) #define clamp(val,low,high) ( max( (low), min((val),(high)) ) )
@@ -318,7 +318,7 @@ public:
virtual ~RenderTarget_Win32(); virtual ~RenderTarget_Win32();
void Create( const RenderTargetParam &param, int &iTextureWidthOut, int &iTextureHeightOut ); void Create( const RenderTargetParam &param, int &iTextureWidthOut, int &iTextureHeightOut );
unsigned int GetTexture() const { return m_texHandle; } uintptr_t GetTexture() const { return static_cast<uintptr_t>(m_texHandle); }
void StartRenderingTo(); void StartRenderingTo();
void FinishRenderingTo(); void FinishRenderingTo();
@@ -145,7 +145,7 @@ public:
virtual void Invalidate() { m_uTexHandle = 0; } virtual void Invalidate() { m_uTexHandle = 0; }
virtual void Reload() { } virtual void Reload() { }
virtual unsigned GetTexHandle() const virtual uintptr_t GetTexHandle() const
{ {
return m_uTexHandle; return m_uTexHandle;
} }
@@ -168,7 +168,7 @@ private:
delete pSurface; delete pSurface;
} }
unsigned m_uTexHandle; uintptr_t m_uTexHandle;
RageSurfaceFormat m_SurfaceFormat; RageSurfaceFormat m_SurfaceFormat;
RagePixelFormat m_PixFmt; RagePixelFormat m_PixFmt;
}; };
@@ -449,7 +449,7 @@ void MovieTexture_Generic::UpdateFrame()
if( m_pTextureLock != nullptr ) if( m_pTextureLock != nullptr )
{ {
int iHandle = m_pTextureIntermediate != nullptr? m_pTextureIntermediate->GetTexHandle(): this->GetTexHandle(); uintptr_t iHandle = m_pTextureIntermediate != nullptr? m_pTextureIntermediate->GetTexHandle(): this->GetTexHandle();
m_pTextureLock->Lock( iHandle, m_pSurface ); m_pTextureLock->Lock( iHandle, m_pSurface );
} }
@@ -518,7 +518,7 @@ void MovieTexture_Generic::SetPosition( float fSeconds )
m_bWantRewind = true; m_bWantRewind = true;
} }
unsigned MovieTexture_Generic::GetTexHandle() const uintptr_t MovieTexture_Generic::GetTexHandle() const
{ {
if( m_pRenderTarget != nullptr ) if( m_pRenderTarget != nullptr )
return m_pRenderTarget->GetTexHandle(); return m_pRenderTarget->GetTexHandle();
+2 -2
View File
@@ -93,7 +93,7 @@ public:
virtual void DecodeSeconds( float fSeconds ); virtual void DecodeSeconds( float fSeconds );
virtual void SetPlaybackRate( float fRate ) { m_fRate = fRate; } virtual void SetPlaybackRate( float fRate ) { m_fRate = fRate; }
void SetLooping( bool bLooping=true ) { m_bLoop = bLooping; } void SetLooping( bool bLooping=true ) { m_bLoop = bLooping; }
unsigned GetTexHandle() const; uintptr_t GetTexHandle() const;
static EffectMode GetEffectMode( MovieDecoderPixelFormatYCbCr fmt ); static EffectMode GetEffectMode( MovieDecoderPixelFormatYCbCr fmt );
@@ -110,7 +110,7 @@ private:
enum State { DECODER_QUIT, DECODER_RUNNING } m_State; enum State { DECODER_QUIT, DECODER_RUNNING } m_State;
unsigned m_uTexHandle; uintptr_t m_uTexHandle;
RageTextureRenderTarget *m_pRenderTarget; RageTextureRenderTarget *m_pRenderTarget;
RageTexture *m_pTextureIntermediate; RageTexture *m_pTextureIntermediate;
Sprite *m_pSprite; Sprite *m_pSprite;
+2 -2
View File
@@ -11,7 +11,7 @@ public:
MovieTexture_Null(RageTextureID ID); MovieTexture_Null(RageTextureID ID);
virtual ~MovieTexture_Null(); virtual ~MovieTexture_Null();
void Invalidate() { texHandle = 0; } void Invalidate() { texHandle = 0; }
unsigned GetTexHandle() const { return texHandle; } uintptr_t GetTexHandle() const { return texHandle; }
void Update(float /* delta */) { } void Update(float /* delta */) { }
void Reload() { } void Reload() { }
void SetPosition(float /* seconds */) { } void SetPosition(float /* seconds */) { }
@@ -21,7 +21,7 @@ public:
private: private:
bool playing; bool playing;
bool loop; bool loop;
unsigned texHandle; uintptr_t texHandle;
}; };
MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID) MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID)
+4 -4
View File
@@ -60,7 +60,7 @@ namespace
#endif #endif
int MAXCON; int MAXCON;
int sock; uintptr_t sock;
struct sockaddr_in addr; struct sockaddr_in addr;
struct sockaddr_in fromAddr; struct sockaddr_in fromAddr;
@@ -439,7 +439,7 @@ int EzSockets::ReadPack(char *data, unsigned int max)
int size = PeekPack(data, max); int size = PeekPack(data, max);
if (size != -1) if (size != -1)
inBuffer = inBuffer.substr(size+4); inBuffer = inBuffer.substr(static_cast<size_t>(size) + 4);
return size; return size;
} }
@@ -466,10 +466,10 @@ int EzSockets::PeekPack(char *data, unsigned int max)
size = ntohl(size); size = ntohl(size);
if (blocking) if (blocking)
while (inBuffer.length()<(size+4) && !IsError()) while (inBuffer.length()<(static_cast<size_t>(size) + 4) && !IsError())
pUpdateRead(); pUpdateRead();
else else
if (inBuffer.length()<(size+4) || inBuffer.length()<=4) if (inBuffer.length()<(static_cast<size_t>(size) + 4) || inBuffer.length()<=4)
return -1; return -1;
if (IsError()) if (IsError())