arm64 : fix mempool align

This commit is contained in:
hymei 2022-03-08 22:32:33 +08:00 committed by nillerusr
parent fd38243b54
commit 01413fdd71
13 changed files with 94 additions and 51 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ build/
.lock-waf* .lock-waf*
__pycache__ __pycache__
*.pyc *.pyc
.DS_Store

View File

@ -22,7 +22,7 @@ extern "C" {
#define ALC_APIENTRY #define ALC_APIENTRY
#endif #endif
#if TARGET_OS_MAC #if defined(TARGET_OS_MAC) && TARGET_OS_MAC
#pragma export on #pragma export on
#endif #endif
@ -279,7 +279,7 @@ typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, A
#endif /* ALC_NO_PROTOTYPES */ #endif /* ALC_NO_PROTOTYPES */
#if TARGET_OS_MAC #if defined(TARGET_OS_MAC) && TARGET_OS_MAC
#pragma export off #pragma export off
#endif #endif

View File

@ -2919,8 +2919,8 @@ END_BYTESWAP_DATADESC()
BEGIN_BYTESWAP_DATADESC( mstudio_modelvertexdata_t ) BEGIN_BYTESWAP_DATADESC( mstudio_modelvertexdata_t )
#ifdef PLATFORM_64BITS #ifdef PLATFORM_64BITS
DEFINE_FIELD( unused_pVertexData, FIELD_INTEGER ), // void* DEFINE_FIELD( index_ptr_pVertexData, FIELD_INTEGER ), // void*
DEFINE_FIELD( unused_pTangentData, FIELD_INTEGER ), // void* DEFINE_FIELD( index_ptr_pTangentData, FIELD_INTEGER ), // void*
#else #else
DEFINE_FIELD( pVertexData, FIELD_INTEGER ), // void* DEFINE_FIELD( pVertexData, FIELD_INTEGER ), // void*
DEFINE_FIELD( pTangentData, FIELD_INTEGER ), // void* DEFINE_FIELD( pTangentData, FIELD_INTEGER ), // void*
@ -3004,7 +3004,7 @@ END_BYTESWAP_DATADESC()
BEGIN_BYTESWAP_DATADESC( mstudio_meshvertexdata_t ) BEGIN_BYTESWAP_DATADESC( mstudio_meshvertexdata_t )
#ifdef PLATFORM_64BITS #ifdef PLATFORM_64BITS
DEFINE_FIELD( unused_modelvertexdata, FIELD_INTEGER ), // mstudio_modelvertexdata_t* DEFINE_FIELD( index_ptr_modelvertexdata, FIELD_INTEGER ), // mstudio_modelvertexdata_t*
#else #else
DEFINE_FIELD( modelvertexdata, FIELD_INTEGER ), // mstudio_modelvertexdata_t* DEFINE_FIELD( modelvertexdata, FIELD_INTEGER ), // mstudio_modelvertexdata_t*
#endif #endif

View File

@ -126,7 +126,7 @@ struct studiodata_t
// array of cache handles to demand loaded virtual model data // array of cache handles to demand loaded virtual model data
int m_nAnimBlockCount; int m_nAnimBlockCount;
DataCacheHandle_t *m_pAnimBlock; DataCacheHandle_t *m_pAnimBlock;
unsigned long *m_iFakeAnimBlockStall; unsigned int *m_iFakeAnimBlockStall;
// vertex data is usually compressed to save memory (model decal code only needs some data) // vertex data is usually compressed to save memory (model decal code only needs some data)
DataCacheHandle_t m_VertexCache; DataCacheHandle_t m_VertexCache;
@ -1169,8 +1169,8 @@ void CMDLCache::AllocateAnimBlocks( studiodata_t *pStudioData, int nCount )
memset( pStudioData->m_pAnimBlock, 0, sizeof(DataCacheHandle_t) * pStudioData->m_nAnimBlockCount ); memset( pStudioData->m_pAnimBlock, 0, sizeof(DataCacheHandle_t) * pStudioData->m_nAnimBlockCount );
pStudioData->m_iFakeAnimBlockStall = new unsigned long [pStudioData->m_nAnimBlockCount]; pStudioData->m_iFakeAnimBlockStall = new unsigned int [pStudioData->m_nAnimBlockCount];
memset( pStudioData->m_iFakeAnimBlockStall, 0, sizeof( unsigned long ) * pStudioData->m_nAnimBlockCount ); memset( pStudioData->m_iFakeAnimBlockStall, 0, sizeof( unsigned int ) * pStudioData->m_nAnimBlockCount );
} }
void CMDLCache::FreeAnimBlocks( MDLHandle_t handle ) void CMDLCache::FreeAnimBlocks( MDLHandle_t handle )

View File

@ -121,7 +121,7 @@ inline unsigned char* UpdateRoutesExplicit_Template( DTStack *pStack, ProxyCalle
// Early out. // Early out.
unsigned short iPropProxyIndex = pStack->m_pPrecalc->m_PropProxyIndices[pStack->m_iCurProp]; unsigned short iPropProxyIndex = pStack->m_pPrecalc->m_PropProxyIndices[pStack->m_iCurProp];
unsigned char **pTest = &pStack->m_pProxies[iPropProxyIndex]; unsigned char **pTest = &pStack->m_pProxies[iPropProxyIndex];
if ( *pTest != (unsigned char*)0xFFFFFFFF ) if ( *pTest != (unsigned char*)-1 )
return *pTest; return *pTest;
// Ok.. setup this proxy. // Ok.. setup this proxy.
@ -133,7 +133,7 @@ inline unsigned char* UpdateRoutesExplicit_Template( DTStack *pStack, ProxyCalle
CSendTablePrecalc::CProxyPathEntry *pEntry = &pStack->m_pPrecalc->m_ProxyPathEntries[proxyPath.m_iFirstEntry + i]; CSendTablePrecalc::CProxyPathEntry *pEntry = &pStack->m_pPrecalc->m_ProxyPathEntries[proxyPath.m_iFirstEntry + i];
int iProxy = pEntry->m_iProxy; int iProxy = pEntry->m_iProxy;
if ( pStack->m_pProxies[iProxy] == (unsigned char*)0xFFFFFFFF ) if ( pStack->m_pProxies[iProxy] == (unsigned char*)-1 )
{ {
pStack->m_pProxies[iProxy] = ProxyCaller::CallProxy( pStack, pStructBase, pEntry->m_iDatatableProp ); pStack->m_pProxies[iProxy] = ProxyCaller::CallProxy( pStack, pStructBase, pEntry->m_iDatatableProp );
if ( !pStack->m_pProxies[iProxy] ) if ( !pStack->m_pProxies[iProxy] )

View File

@ -1831,7 +1831,7 @@ void *Hunk_AllocNameAlignedClear_( int size, int alignment, const char *pHunkNam
Assert(IsPowerOfTwo(alignment)); Assert(IsPowerOfTwo(alignment));
void *pMem = Hunk_AllocName( alignment + size, pHunkName ); void *pMem = Hunk_AllocName( alignment + size, pHunkName );
memset( pMem, 0, size + alignment ); memset( pMem, 0, size + alignment );
pMem = (void *)( ( ( ( unsigned long )pMem ) + (alignment-1) ) & ~(alignment-1) ); pMem = (void *)( ( ( ( uintp )pMem ) + (alignment-1) ) & ~(alignment-1) );
return pMem; return pMem;
} }

View File

@ -2304,7 +2304,7 @@ inline void R_DrawDecalMeshList( DecalMeshList_t &meshList )
} }
#define DECALMARKERS_SWITCHSORTTREE ((decal_t *)0x00000000) #define DECALMARKERS_SWITCHSORTTREE ((decal_t *)0x00000000)
#define DECALMARKERS_SWITCHBUCKET ((decal_t *)0xFFFFFFFF) #define DECALMARKERS_SWITCHBUCKET ((decal_t *)-1)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -25,7 +25,7 @@ enum QueryResultType
}; };
// Can pass this into IContextualQuery::IsHindrance to see if any hindrance is ever possible // Can pass this into IContextualQuery::IsHindrance to see if any hindrance is ever possible
#define IS_ANY_HINDRANCE_POSSIBLE ( (CBaseEntity*)0xFFFFFFFF ) #define IS_ANY_HINDRANCE_POSSIBLE ( (CBaseEntity*)-1 )
//---------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------

View File

@ -1293,14 +1293,26 @@ struct mstudio_modelvertexdata_t
// base of external vertex data stores // base of external vertex data stores
#ifdef PLATFORM_64BITS #ifdef PLATFORM_64BITS
int unused_pVertexData; int index_ptr_pVertexData;
int unused_pTangentData; int index_ptr_pTangentData;
const void *pVertexData;
const void *pTangentData;
#else #else
const void *pVertexData; const void *pVertexData;
const void *pTangentData; const void *pTangentData;
#endif #endif
const void *GetVertexData() const {
#ifdef PLATFORM_64BITS
return *(const void **)((byte *)this + index_ptr_pVertexData);
#else
return pVertexData;
#endif
}
const void *GetTangentData() const {
#ifdef PLATFORM_64BITS
return *(const void **)((byte *)this + index_ptr_pTangentData);
#else
return pTangentData;
#endif
}
}; };
#ifdef PLATFORM_64BITS #ifdef PLATFORM_64BITS
@ -1323,17 +1335,22 @@ struct mstudio_meshvertexdata_t
#ifdef PLATFORM_64BITS #ifdef PLATFORM_64BITS
// MoeMod : fix 64bit ptr size // MoeMod : fix 64bit ptr size
int unused_modelvertexdata; int index_ptr_modelvertexdata;
int numLODVertexes[MAX_NUM_LODS];
const mstudio_modelvertexdata_t *modelvertexdata;
#else #else
// indirection to this mesh's model's vertex data // indirection to this mesh's model's vertex data
const mstudio_modelvertexdata_t *modelvertexdata; const mstudio_modelvertexdata_t *modelvertexdata;
#endif
// used for fixup calcs when culling top level lods // used for fixup calcs when culling top level lods
// expected number of mesh verts at desired lod // expected number of mesh verts at desired lod
int numLODVertexes[MAX_NUM_LODS]; int numLODVertexes[MAX_NUM_LODS];
const mstudio_modelvertexdata_t *pModelVertexData() const {
#ifdef PLATFORM_64BITS
return *(const mstudio_modelvertexdata_t **)((byte *)this + index_ptr_modelvertexdata);
#else
return modelvertexdata;
#endif #endif
}
}; };
struct mstudiomesh_t struct mstudiomesh_t
@ -1364,13 +1381,12 @@ struct mstudiomesh_t
Vector center; Vector center;
mstudio_meshvertexdata_t vertexdata;
#ifdef PLATFORM_64BITS #ifdef PLATFORM_64BITS
mstudio_meshvertexdata_t vertexdata;
int unused[6]; // remove as appropriate int unused[6]; // remove as appropriate
const mstudio_modelvertexdata_t *real_modelvertexdata;
#else #else
mstudio_meshvertexdata_t vertexdata;
int unused[8]; // remove as appropriate int unused[8]; // remove as appropriate
#endif #endif
@ -1414,14 +1430,12 @@ struct mstudiomodel_t
int eyeballindex; int eyeballindex;
inline mstudioeyeball_t *pEyeball( int i ) { return (mstudioeyeball_t *)(((byte *)this) + eyeballindex) + i; }; inline mstudioeyeball_t *pEyeball( int i ) { return (mstudioeyeball_t *)(((byte *)this) + eyeballindex) + i; };
#ifdef PLATFORM_64BITS
mstudio_modelvertexdata_t vertexdata; // sizeof(mstudio_modelvertexdata_t) == 16 mstudio_modelvertexdata_t vertexdata; // sizeof(mstudio_modelvertexdata_t) == 16
#ifdef PLATFORM_64BITS
int unused[6]; // remove as appropriate int unused[4]; // remove as appropriate
const void *real_pVertexData;
const void *real_pTangentData;
#else #else
mstudio_modelvertexdata_t vertexdata;
int unused[8]; // remove as appropriate int unused[8]; // remove as appropriate
#endif #endif
}; };
@ -1432,7 +1446,7 @@ struct mstudiomodel_t
inline bool mstudio_modelvertexdata_t::HasTangentData( void ) const inline bool mstudio_modelvertexdata_t::HasTangentData( void ) const
{ {
return (pTangentData != NULL); return (GetTangentData() != NULL);
} }
inline int mstudio_modelvertexdata_t::GetGlobalVertexIndex( int i ) const inline int mstudio_modelvertexdata_t::GetGlobalVertexIndex( int i ) const
@ -1453,7 +1467,7 @@ inline int mstudio_modelvertexdata_t::GetGlobalTangentIndex( int i ) const
inline mstudiovertex_t *mstudio_modelvertexdata_t::Vertex( int i ) const inline mstudiovertex_t *mstudio_modelvertexdata_t::Vertex( int i ) const
{ {
return (mstudiovertex_t *)pVertexData + GetGlobalVertexIndex( i ); return (mstudiovertex_t *)GetVertexData() + GetGlobalVertexIndex( i );
} }
inline Vector *mstudio_modelvertexdata_t::Position( int i ) const inline Vector *mstudio_modelvertexdata_t::Position( int i ) const
@ -1471,7 +1485,7 @@ inline Vector4D *mstudio_modelvertexdata_t::TangentS( int i ) const
// NOTE: The tangents vector is 16-bytes in a separate array // NOTE: The tangents vector is 16-bytes in a separate array
// because it only exists on the high end, and if I leave it out // because it only exists on the high end, and if I leave it out
// of the mstudiovertex_t, the vertex is 64-bytes (good for low end) // of the mstudiovertex_t, the vertex is 64-bytes (good for low end)
return (Vector4D *)pTangentData + GetGlobalTangentIndex( i ); return (Vector4D *)GetTangentData() + GetGlobalTangentIndex( i );
} }
inline Vector2D *mstudio_modelvertexdata_t::Texcoord( int i ) const inline Vector2D *mstudio_modelvertexdata_t::Texcoord( int i ) const
@ -1491,7 +1505,7 @@ inline mstudiomodel_t *mstudiomesh_t::pModel() const
inline bool mstudio_meshvertexdata_t::HasTangentData( void ) const inline bool mstudio_meshvertexdata_t::HasTangentData( void ) const
{ {
return modelvertexdata->HasTangentData(); return pModelVertexData()->HasTangentData();
} }
inline const mstudio_meshvertexdata_t *mstudiomesh_t::GetVertexData( void *pModelData ) inline const mstudio_meshvertexdata_t *mstudiomesh_t::GetVertexData( void *pModelData )
@ -1499,9 +1513,14 @@ inline const mstudio_meshvertexdata_t *mstudiomesh_t::GetVertexData( void *pMode
// get this mesh's model's vertex data (allow for mstudiomodel_t::GetVertexData // get this mesh's model's vertex data (allow for mstudiomodel_t::GetVertexData
// returning NULL if the data has been converted to 'thin' vertices) // returning NULL if the data has been converted to 'thin' vertices)
this->pModel()->GetVertexData( pModelData ); this->pModel()->GetVertexData( pModelData );
#ifdef PLATFORM_64BITS
real_modelvertexdata = &( this->pModel()->vertexdata );
vertexdata.index_ptr_modelvertexdata = (byte *)&real_modelvertexdata - (byte *)&vertexdata;
#else
vertexdata.modelvertexdata = &( this->pModel()->vertexdata ); vertexdata.modelvertexdata = &( this->pModel()->vertexdata );
#endif
if ( !vertexdata.modelvertexdata->pVertexData ) if ( !vertexdata.pModelVertexData()->GetVertexData() )
return NULL; return NULL;
return &vertexdata; return &vertexdata;
@ -1522,37 +1541,37 @@ inline int mstudio_meshvertexdata_t::GetModelVertexIndex( int i ) const
inline int mstudio_meshvertexdata_t::GetGlobalVertexIndex( int i ) const inline int mstudio_meshvertexdata_t::GetGlobalVertexIndex( int i ) const
{ {
return modelvertexdata->GetGlobalVertexIndex( GetModelVertexIndex( i ) ); return pModelVertexData()->GetGlobalVertexIndex( GetModelVertexIndex( i ) );
} }
inline Vector *mstudio_meshvertexdata_t::Position( int i ) const inline Vector *mstudio_meshvertexdata_t::Position( int i ) const
{ {
return modelvertexdata->Position( GetModelVertexIndex( i ) ); return pModelVertexData()->Position( GetModelVertexIndex( i ) );
}; };
inline Vector *mstudio_meshvertexdata_t::Normal( int i ) const inline Vector *mstudio_meshvertexdata_t::Normal( int i ) const
{ {
return modelvertexdata->Normal( GetModelVertexIndex( i ) ); return pModelVertexData()->Normal( GetModelVertexIndex( i ) );
}; };
inline Vector4D *mstudio_meshvertexdata_t::TangentS( int i ) const inline Vector4D *mstudio_meshvertexdata_t::TangentS( int i ) const
{ {
return modelvertexdata->TangentS( GetModelVertexIndex( i ) ); return pModelVertexData()->TangentS( GetModelVertexIndex( i ) );
} }
inline Vector2D *mstudio_meshvertexdata_t::Texcoord( int i ) const inline Vector2D *mstudio_meshvertexdata_t::Texcoord( int i ) const
{ {
return modelvertexdata->Texcoord( GetModelVertexIndex( i ) ); return pModelVertexData()->Texcoord( GetModelVertexIndex( i ) );
}; };
inline mstudioboneweight_t *mstudio_meshvertexdata_t::BoneWeights( int i ) const inline mstudioboneweight_t *mstudio_meshvertexdata_t::BoneWeights( int i ) const
{ {
return modelvertexdata->BoneWeights( GetModelVertexIndex( i ) ); return pModelVertexData()->BoneWeights( GetModelVertexIndex( i ) );
}; };
inline mstudiovertex_t *mstudio_meshvertexdata_t::Vertex( int i ) const inline mstudiovertex_t *mstudio_meshvertexdata_t::Vertex( int i ) const
{ {
return modelvertexdata->Vertex( GetModelVertexIndex( i ) ); return pModelVertexData()->Vertex( GetModelVertexIndex( i ) );
} }
// a group of studio model data // a group of studio model data
@ -1972,15 +1991,29 @@ inline const mstudio_modelvertexdata_t * mstudiomodel_t::GetVertexData( void *pM
const vertexFileHeader_t * pVertexHdr = CacheVertexData( pModelData ); const vertexFileHeader_t * pVertexHdr = CacheVertexData( pModelData );
if ( !pVertexHdr ) if ( !pVertexHdr )
{ {
#ifdef PLATFORM_64BITS
this->real_pVertexData = NULL;
this->real_pTangentData = NULL;
vertexdata.index_ptr_pVertexData = (byte *)&real_pVertexData - (byte *)&vertexdata;
vertexdata.index_ptr_pTangentData = (byte *)&real_pTangentData - (byte *)&vertexdata;
#else
vertexdata.pVertexData = NULL; vertexdata.pVertexData = NULL;
vertexdata.pTangentData = NULL; vertexdata.pTangentData = NULL;
#endif
return NULL; return NULL;
} }
#ifdef PLATFORM_64BITS
this->real_pVertexData = pVertexHdr->GetVertexData();
this->real_pTangentData = pVertexHdr->GetTangentData();
vertexdata.index_ptr_pVertexData = (byte *)&real_pVertexData - (byte *)&vertexdata;
vertexdata.index_ptr_pTangentData = (byte *)&real_pTangentData - (byte *)&vertexdata;
#else
vertexdata.pVertexData = pVertexHdr->GetVertexData(); vertexdata.pVertexData = pVertexHdr->GetVertexData();
vertexdata.pTangentData = pVertexHdr->GetTangentData(); vertexdata.pTangentData = pVertexHdr->GetTangentData();
#endif
if ( !vertexdata.pVertexData ) if ( !vertexdata.GetVertexData() )
return NULL; return NULL;
return &vertexdata; return &vertexdata;

View File

@ -441,7 +441,13 @@ typedef void * HINSTANCE;
// So if being debugged, use INT3 which is precise. // So if being debugged, use INT3 which is precise.
#ifdef OSX #ifdef OSX
#if defined(__arm__) || defined(__arm64__) #if defined(__arm__) || defined(__arm64__)
#ifdef __clang__
#define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __builtin_debugtrap(); } else { raise(SIGTRAP); } } while(0) #define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __builtin_debugtrap(); } else { raise(SIGTRAP); } } while(0)
#elif defined __GNUC__
#define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __builtin_trap(); } else { raise(SIGTRAP); } } while(0)
#else
#define DebuggerBreak() raise(SIGTRAP)
#endif
#else #else
#define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __asm ( "int $3" ); } else { raise(SIGTRAP); } } while(0) #define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __asm ( "int $3" ); } else { raise(SIGTRAP); } } while(0)
#endif #endif

View File

@ -111,7 +111,8 @@ protected:
class CMemoryPoolMT : public CUtlMemoryPool class CMemoryPoolMT : public CUtlMemoryPool
{ {
public: public:
CMemoryPoolMT(int blockSize, int numElements, int growMode = UTLMEMORYPOOL_GROW_FAST, const char *pszAllocOwner = NULL) : CUtlMemoryPool( blockSize, numElements, growMode, pszAllocOwner) {} // MoeMod : add alignment
CMemoryPoolMT(int blockSize, int numElements, int growMode = UTLMEMORYPOOL_GROW_FAST, const char *pszAllocOwner = NULL, int nAlignment = 0) : CUtlMemoryPool( blockSize, numElements, growMode, pszAllocOwner, nAlignment) {}
void* Alloc() { AUTO_LOCK( m_mutex ); return CUtlMemoryPool::Alloc(); } void* Alloc() { AUTO_LOCK( m_mutex ); return CUtlMemoryPool::Alloc(); }
@ -135,7 +136,8 @@ template< class T >
class CClassMemoryPool : public CUtlMemoryPool class CClassMemoryPool : public CUtlMemoryPool
{ {
public: public:
CClassMemoryPool(int numElements, int growMode = GROW_FAST, int nAlignment = 0 ) : // MoeMod : bad default align here, should be alignof(T)
CClassMemoryPool(int numElements, int growMode = GROW_FAST, int nAlignment = alignof(T) ) :
CUtlMemoryPool( sizeof(T), numElements, growMode, MEM_ALLOC_CLASSNAME(T), nAlignment ) { CUtlMemoryPool( sizeof(T), numElements, growMode, MEM_ALLOC_CLASSNAME(T), nAlignment ) {
#ifdef PLATFORM_64BITS #ifdef PLATFORM_64BITS
COMPILE_TIME_ASSERT( sizeof(CUtlMemoryPool) == 64 ); COMPILE_TIME_ASSERT( sizeof(CUtlMemoryPool) == 64 );
@ -315,7 +317,8 @@ inline void CClassMemoryPool<T>::Clear()
for( CBlob *pCur=m_BlobHead.m_pNext; pCur != &m_BlobHead; pCur=pCur->m_pNext ) for( CBlob *pCur=m_BlobHead.m_pNext; pCur != &m_BlobHead; pCur=pCur->m_pNext )
{ {
T *p = (T *)pCur->m_Data; // MoeMod : should realign to real data.
T *p = (T *)AlignValue( pCur->m_Data, m_nAlignment );
T *pLimit = (T *)(pCur->m_Data + pCur->m_NumBytes); T *pLimit = (T *)(pCur->m_Data + pCur->m_NumBytes);
while ( p < pLimit ) while ( p < pLimit )
{ {
@ -361,7 +364,7 @@ inline void CClassMemoryPool<T>::Clear()
static CMemoryPoolMT s_Allocator static CMemoryPoolMT s_Allocator
#define DEFINE_FIXEDSIZE_ALLOCATOR_MT( _class, _initsize, _grow ) \ #define DEFINE_FIXEDSIZE_ALLOCATOR_MT( _class, _initsize, _grow ) \
CMemoryPoolMT _class::s_Allocator(sizeof(_class), _initsize, _grow, #_class " pool") CMemoryPoolMT _class::s_Allocator(sizeof(_class), _initsize, _grow, #_class " pool", alignof(_class))
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Macros that make it simple to make a class use a fixed-size allocator // Macros that make it simple to make a class use a fixed-size allocator

View File

@ -1569,7 +1569,7 @@ void CZipFile::SaveDirectory( IWriteStream& stream )
free( e->m_pData ); free( e->m_pData );
// temp hackery for the logic below to succeed // temp hackery for the logic below to succeed
e->m_pData = (void*)0xFFFFFFFF; e->m_pData = (void*)-1;
} }
} }
} }

View File

@ -145,8 +145,8 @@ unsigned int CLZMA::Uncompress( unsigned char *pInput, unsigned char *pOutput )
} }
// These are in/out variables // These are in/out variables
SizeT outProcessed = pHeader->actualSize; SizeT outProcessed = LittleLong(pHeader->actualSize);
SizeT inProcessed = pHeader->lzmaSize; SizeT inProcessed = LittleLong(pHeader->lzmaSize);
ELzmaStatus status; ELzmaStatus status;
SRes result = LzmaDecode( (Byte *)pOutput, &outProcessed, (Byte *)(pInput + sizeof( lzma_header_t ) ), SRes result = LzmaDecode( (Byte *)pOutput, &outProcessed, (Byte *)(pInput + sizeof( lzma_header_t ) ),
&inProcessed, (Byte *)pHeader->properties, LZMA_PROPS_SIZE, LZMA_FINISH_END, &status, &g_Alloc ); &inProcessed, (Byte *)pHeader->properties, LZMA_PROPS_SIZE, LZMA_FINISH_END, &status, &g_Alloc );
@ -154,7 +154,7 @@ unsigned int CLZMA::Uncompress( unsigned char *pInput, unsigned char *pOutput )
LzmaDec_Free(&state, &g_Alloc); LzmaDec_Free(&state, &g_Alloc);
if ( result != SZ_OK || pHeader->actualSize != outProcessed ) if ( result != SZ_OK || LittleLong(pHeader->actualSize) != outProcessed )
{ {
Warning( "LZMA Decompression failed (%i)\n", result ); Warning( "LZMA Decompression failed (%i)\n", result );
return 0; return 0;