mirror of
https://github.com/ioquake/jedi-academy.git
synced 2025-02-16 09:12:08 +00:00
initial round of amd64 fixes
This commit is contained in:
parent
21a15843f6
commit
5b9dda241c
45 changed files with 451 additions and 389 deletions
|
@ -789,11 +789,11 @@ namespace storage
|
|||
// this is so node support does not need to be added to the primitive containers
|
||||
static NODE & node(TValue &v)
|
||||
{
|
||||
return *(NODE *)((unsigned char *)(&v)+int(&((TStorage *)0)->nodeData)-int(&((TStorage *)0)->value));
|
||||
return *(NODE *)((unsigned char *)(&v)+size_t(&((TStorage *)0)->nodeData)-size_t(&((TStorage *)0)->value));
|
||||
}
|
||||
static const NODE & node(const TValue &v)
|
||||
{
|
||||
return *(const NODE *)((unsigned char *)(&v)+int(&((TStorage *)0)->nodeData)-int(&((TStorage *)0)->value));
|
||||
return *(const NODE *)((unsigned char *)(&v)+size_t(&((TStorage *)0)->nodeData)-size_t(&((TStorage *)0)->value));
|
||||
}
|
||||
static void swap(TStorage *s1,TStorage *s2)
|
||||
{
|
||||
|
@ -803,8 +803,8 @@ namespace storage
|
|||
static int pointer_to_index(const void *s1,const void *s2)
|
||||
{
|
||||
return
|
||||
((TStorage *)(((unsigned char *)s1)-int(&((TStorage *)0)->value))) -
|
||||
((TStorage *)(((unsigned char *)s2)-int(&((TStorage *)0)->value)));
|
||||
((TStorage *)(((unsigned char *)s1)-size_t(&((TStorage *)0)->value))) -
|
||||
((TStorage *)(((unsigned char *)s2)-size_t(&((TStorage *)0)->value)));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -884,11 +884,11 @@ namespace storage
|
|||
// this is so node support does not need to be added to the primitive containers
|
||||
static NODE & node(TValue &v)
|
||||
{
|
||||
return *(NODE *)((unsigned char *)(&v)+int(&((TStorage *)0)->nodeData)-int(&((TStorage *)0)->value));
|
||||
return *(NODE *)((unsigned char *)(&v)+size_t(&((TStorage *)0)->nodeData)-size_t(&((TStorage *)0)->value));
|
||||
}
|
||||
static const NODE & node(const TValue &v)
|
||||
{
|
||||
return *(const NODE *)((unsigned char *)(&v)+int(&((TStorage *)0)->nodeData)-int(&((TStorage *)0)->value));
|
||||
return *(const NODE *)((unsigned char *)(&v)+size_t(&((TStorage *)0)->nodeData)-size_t(&((TStorage *)0)->value));
|
||||
}
|
||||
static void swap(TStorage *s1,TStorage *s2)
|
||||
{
|
||||
|
@ -900,8 +900,8 @@ namespace storage
|
|||
static int pointer_to_index(const void *s1,const void *s2)
|
||||
{
|
||||
return
|
||||
((TStorage *)(((unsigned char *)s1)-int(&((TStorage *)0)->value))) -
|
||||
((TStorage *)(((unsigned char *)s2)-int(&((TStorage *)0)->value)));
|
||||
((TStorage *)(((unsigned char *)s1)-size_t(&((TStorage *)0)->value))) -
|
||||
((TStorage *)(((unsigned char *)s2)-size_t(&((TStorage *)0)->value)));
|
||||
}
|
||||
};
|
||||
template<class T,int SIZE,int MAX_CLASS_SIZE,class NODE>
|
||||
|
@ -975,11 +975,11 @@ namespace storage
|
|||
// this is so node support does not need to be added to the primitive containers
|
||||
static NODE & node(TValue &v)
|
||||
{
|
||||
return *(NODE *)((unsigned char *)(&v)+int(&((TStorage *)0)->nodeData)-int(&((TStorage *)0)->value));
|
||||
return *(NODE *)((unsigned char *)(&v)+size_t(&((TStorage *)0)->nodeData)-size_t(&((TStorage *)0)->value));
|
||||
}
|
||||
static const NODE & node(const TValue &v)
|
||||
{
|
||||
return *(const NODE *)((unsigned char *)(&v)+int(&((TStorage *)0)->nodeData)-int(&((TStorage *)0)->value));
|
||||
return *(const NODE *)((unsigned char *)(&v)+size_t(&((TStorage *)0)->nodeData)-size_t(&((TStorage *)0)->value));
|
||||
}
|
||||
// this is a bit suspicious, we are forced to do a memory swap, and for a class, that, say
|
||||
// stores a pointer to itself, it won't work right
|
||||
|
@ -991,8 +991,8 @@ namespace storage
|
|||
static int pointer_to_index(const void *s1,const void *s2)
|
||||
{
|
||||
return
|
||||
((TStorage *)(((unsigned char *)s1)-int(&((TStorage *)0)->value))) -
|
||||
((TStorage *)(((unsigned char *)s2)-int(&((TStorage *)0)->value)));
|
||||
((TStorage *)(((unsigned char *)s1)-size_t(&((TStorage *)0)->value))) -
|
||||
((TStorage *)(((unsigned char *)s2)-size_t(&((TStorage *)0)->value)));
|
||||
}
|
||||
template<class CAST_TO>
|
||||
static CAST_TO *verify_alloc(CAST_TO *p)
|
||||
|
@ -1179,4 +1179,4 @@ public:
|
|||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -2645,10 +2645,10 @@ qboolean CG_WorldCoordToScreenCoordFloat(vec3_t worldCoord, float *x, float *y)
|
|||
|
||||
qboolean CG_WorldCoordToScreenCoord( vec3_t worldCoord, int *x, int *y )
|
||||
{
|
||||
float xF, yF;
|
||||
qboolean retVal = CG_WorldCoordToScreenCoordFloat( worldCoord, &xF, &yF );
|
||||
*x = (int)xF;
|
||||
*y = (int)yF;
|
||||
floatint_t xFI, yFI;
|
||||
qboolean retVal = CG_WorldCoordToScreenCoordFloat( worldCoord, &xFI.f, &yFI.f );
|
||||
*x = xFI.i;
|
||||
*y = yFI.i;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,8 @@ This must be the very first function compiled into the .q3vm file
|
|||
================
|
||||
*/
|
||||
extern "C" {
|
||||
int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7 ) {
|
||||
intptr_t vmMain( intptr_t command, intptr_t arg0, intptr_t arg1, intptr_t arg2,
|
||||
intptr_t arg3, intptr_t arg4, intptr_t arg5, intptr_t arg6, intptr_t arg7 ) {
|
||||
centity_t *cent;
|
||||
|
||||
switch ( command ) {
|
||||
|
|
|
@ -25,13 +25,13 @@
|
|||
//prototypes
|
||||
extern void CG_PreInit();
|
||||
|
||||
static int (*qsyscall)( int arg, ... ) = (int (*)( int, ...))-1;
|
||||
static intptr_t (*qsyscall)( intptr_t arg, ... ) = (intptr_t (*)( intptr_t, ...))-1;
|
||||
|
||||
extern "C" {
|
||||
#ifdef _XBOX
|
||||
void cg_dllEntry( int (*syscallptr)( int arg,... ) ) {
|
||||
void cg_dllEntry( intptr_t (*syscallptr)( intptr_t arg,... ) ) {
|
||||
#else
|
||||
void dllEntry( int (*syscallptr)( int arg,... ) ) {
|
||||
void dllEntry( intptr_t (*syscallptr)( intptr_t arg,... ) ) {
|
||||
#endif
|
||||
qsyscall = syscallptr;
|
||||
CG_PreInit();
|
||||
|
@ -40,9 +40,9 @@ void dllEntry( int (*syscallptr)( int arg,... ) ) {
|
|||
|
||||
|
||||
inline int PASSFLOAT( float x ) {
|
||||
float floatTemp;
|
||||
floatTemp = x;
|
||||
return *(int *)&floatTemp;
|
||||
floatint_t fi;
|
||||
fi.f = x;
|
||||
return fi.i;
|
||||
}
|
||||
|
||||
void cgi_Printf( const char *fmt ) {
|
||||
|
|
|
@ -431,8 +431,16 @@ void *VM_ArgPtr( int intValue );
|
|||
void CM_SnapPVS(vec3_t origin,byte *buffer);
|
||||
//#define VMA(x) VM_ArgPtr(args[x])
|
||||
#define VMA(x) ((void*)args[x])
|
||||
#define VMF(x) ((float *)args)[x]
|
||||
int CL_CgameSystemCalls( int *args ) {
|
||||
|
||||
static inline float _vmf(intptr_t x)
|
||||
{
|
||||
floatint_t fi;
|
||||
fi.i = (int) x;
|
||||
return fi.f;
|
||||
}
|
||||
#define VMF(x) _vmf(args[x])
|
||||
|
||||
intptr_t CL_CgameSystemCalls( intptr_t *args ) {
|
||||
switch( args[0] ) {
|
||||
case CG_PRINT:
|
||||
Com_Printf( "%s", VMA(1) );
|
||||
|
@ -825,7 +833,7 @@ Ghoul2 Insert End
|
|||
return 0;
|
||||
|
||||
case CG_Z_MALLOC:
|
||||
return (int)Z_Malloc(args[1], (memtag_t) args[2], qfalse);
|
||||
return (intptr_t)Z_Malloc(args[1], (memtag_t) args[2], qfalse);
|
||||
|
||||
case CG_Z_FREE:
|
||||
Z_Free((void *) VMA(1));
|
||||
|
|
|
@ -60,7 +60,7 @@ typedef struct {
|
|||
byte file[65536];
|
||||
short sqrTable[256];
|
||||
|
||||
unsigned int mcomp[256];
|
||||
int mcomp[256];
|
||||
unsigned short vq2[256*16*4];
|
||||
unsigned short vq4[256*64*4];
|
||||
unsigned short vq8[256*256*4];
|
||||
|
@ -893,8 +893,8 @@ static void readQuadInfo( byte *qData )
|
|||
cinTable[currentHandle].VQ0 = cinTable[currentHandle].VQNormal;
|
||||
cinTable[currentHandle].VQ1 = cinTable[currentHandle].VQBuffer;
|
||||
|
||||
cinTable[currentHandle].t[0] = (0 - (unsigned int)cin.linbuf)+(unsigned int)cin.linbuf+cinTable[currentHandle].screenDelta;
|
||||
cinTable[currentHandle].t[1] = (0 - ((unsigned int)cin.linbuf + cinTable[currentHandle].screenDelta))+(unsigned int)cin.linbuf;
|
||||
cinTable[currentHandle].t[0] = cinTable[currentHandle].screenDelta;
|
||||
cinTable[currentHandle].t[1] = -cinTable[currentHandle].screenDelta;
|
||||
|
||||
cinTable[currentHandle].drawX = cinTable[currentHandle].CIN_WIDTH;
|
||||
cinTable[currentHandle].drawY = cinTable[currentHandle].CIN_HEIGHT;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
int PC_ReadTokenHandle(int handle, struct pc_token_s *pc_token);
|
||||
|
||||
int CL_UISystemCalls( int *args );
|
||||
intptr_t CL_UISystemCalls( intptr_t *args );
|
||||
|
||||
//prototypes
|
||||
//extern qboolean SG_GetSaveImage( const char *psPathlessBaseName, void *pvAddress );
|
||||
|
@ -127,11 +127,10 @@ FloatAsInt
|
|||
*/
|
||||
int FloatAsInt( float f )
|
||||
{
|
||||
int temp;
|
||||
floatint_t fi;
|
||||
|
||||
*(float *)&temp = f;
|
||||
|
||||
return temp;
|
||||
fi.f = f;
|
||||
return fi.i;
|
||||
}
|
||||
|
||||
static void UI_Cvar_Create( const char *var_name, const char *var_value, int flags ) {
|
||||
|
@ -362,8 +361,18 @@ The ui module is making a system call
|
|||
vm_t uivm;
|
||||
|
||||
#define VMA(x) ((void*)args[x])
|
||||
#define VMF(x) ((float *)args)[x]
|
||||
int CL_UISystemCalls( int *args )
|
||||
//#define VMF(x) ((float *)args)[x]
|
||||
|
||||
static inline float _vmf(intptr_t x)
|
||||
{
|
||||
floatint_t fi;
|
||||
fi.i = (int) x;
|
||||
return fi.f;
|
||||
}
|
||||
#define VMF(x) _vmf(args[x])
|
||||
|
||||
|
||||
intptr_t CL_UISystemCalls( intptr_t *args )
|
||||
{
|
||||
|
||||
switch( args[0] )
|
||||
|
|
|
@ -98,7 +98,7 @@ void DumpChunks(void)
|
|||
memcpy (str, data_p, 4);
|
||||
data_p += 4;
|
||||
iff_chunk_len = GetLittleLong();
|
||||
Com_Printf ("0x%x : %s (%d)\n", (int)(data_p - 4), str, iff_chunk_len);
|
||||
Com_Printf ("0x%x : %s (%d)\n", (intptr_t)(data_p - 4), str, iff_chunk_len);
|
||||
data_p += (iff_chunk_len + 1) & ~1;
|
||||
} while (data_p < iff_end);
|
||||
}
|
||||
|
|
|
@ -10,15 +10,23 @@ VIRTUAL MACHINE
|
|||
|
||||
==============================================================
|
||||
*/
|
||||
int VM_Call( int callnum, ... )
|
||||
intptr_t VM_Call( intptr_t callnum, ... )
|
||||
{
|
||||
intptr_t args[9];
|
||||
int i;
|
||||
va_list ap;
|
||||
// assert (cgvm.entryPoint);
|
||||
|
||||
if (cgvm.entryPoint)
|
||||
{
|
||||
return cgvm.entryPoint( (&callnum)[0], (&callnum)[1], (&callnum)[2], (&callnum)[3],
|
||||
(&callnum)[4], (&callnum)[5], (&callnum)[6], (&callnum)[7],
|
||||
(&callnum)[8], (&callnum)[9] );
|
||||
va_start(ap, callnum);
|
||||
for (i = 0; i < 9; i++) {
|
||||
args[i] = va_arg(ap, intptr_t);
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
return cgvm.entryPoint( callnum, args[0], args[1], args[2],
|
||||
args[3], args[4], args[5], args[6], args[7], args[8] );
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
@ -31,10 +39,25 @@ VM_DllSyscall
|
|||
we pass this to the cgame dll to call back into the client
|
||||
============
|
||||
*/
|
||||
extern int CL_CgameSystemCalls( int *args );
|
||||
extern int CL_UISystemCalls( int *args );
|
||||
extern intptr_t CL_CgameSystemCalls( intptr_t *args );
|
||||
extern intptr_t CL_UISystemCalls( intptr_t *args );
|
||||
|
||||
int VM_DllSyscall( int arg, ... ) {
|
||||
intptr_t VM_DllSyscall( intptr_t arg, ... ) {
|
||||
#if !defined(__i386__) || defined(__clang__)
|
||||
intptr_t args[15];
|
||||
int i;
|
||||
va_list ap;
|
||||
|
||||
args[0] = arg;
|
||||
|
||||
va_start(ap, arg);
|
||||
for (i = 1; i < 15; i++)
|
||||
args[i] = va_arg(ap, intptr_t);
|
||||
va_end(ap);
|
||||
|
||||
return CL_CgameSystemCalls( args );
|
||||
#else
|
||||
// return cgvm->systemCall( &arg );
|
||||
return CL_CgameSystemCalls( &arg );
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ VIRTUAL MACHINE
|
|||
==============================================================
|
||||
*/
|
||||
struct vm_s {
|
||||
int (*entryPoint)( int callNum, ... );
|
||||
intptr_t (*entryPoint)( intptr_t callNum, ... );
|
||||
};
|
||||
|
||||
typedef struct vm_s vm_t;
|
||||
|
@ -54,8 +54,8 @@ typedef struct vm_s vm_t;
|
|||
extern vm_t cgvm; // interface to cgame dll or vm
|
||||
extern vm_t uivm; // interface to ui dll or vm
|
||||
|
||||
extern int VM_Call( int callnum, ... );
|
||||
extern int VM_DllSyscall( int arg, ... );
|
||||
extern intptr_t VM_Call( intptr_t callnum, ... );
|
||||
extern intptr_t VM_DllSyscall( intptr_t arg, ... );
|
||||
extern void CL_ShutdownCGame(void);
|
||||
|
||||
#include "../game/q_shared.h"
|
||||
|
@ -67,7 +67,7 @@ VM_Create
|
|||
it will attempt to load as a system dll
|
||||
================
|
||||
*/
|
||||
extern void *Sys_LoadCgame( int (**entryPoint)(int, ...), int (*systemcalls)(int, ...) );
|
||||
extern void *Sys_LoadCgame( intptr_t (**entryPoint)(intptr_t, ...), intptr_t (*systemcalls)(intptr_t, ...) );
|
||||
|
||||
inline void *VM_Create( const char *module)
|
||||
{
|
||||
|
@ -90,4 +90,4 @@ inline void *VM_Create( const char *module)
|
|||
return res;
|
||||
}
|
||||
|
||||
#endif //__VMACHINE_H__
|
||||
#endif //__VMACHINE_H__
|
||||
|
|
|
@ -356,7 +356,7 @@ TIMER_Exists
|
|||
*/
|
||||
qboolean TIMER_Exists( gentity_t *ent, const char *identifier )
|
||||
{
|
||||
return (qboolean)TIMER_GetExisting(ent->s.number, identifier);
|
||||
return (qboolean)(TIMER_GetExisting(ent->s.number, identifier) != NULL);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,13 +12,13 @@
|
|||
#define MAX_GHOULINST_SIZE 16384
|
||||
|
||||
#ifndef FOFS
|
||||
#define FOFS(x) ((int)&(((gentity_t *)0)->x)) // usually already defined in qshared.h
|
||||
#define FOFS(x) ((size_t)&(((gentity_t *)0)->x)) // usually already defined in qshared.h
|
||||
#endif
|
||||
#define STOFS(x) ((int)&(((spawn_temp_t *)0)->x))
|
||||
#define LLOFS(x) ((int)&(((level_locals_t *)0)->x))
|
||||
#define CLOFS(x) ((int)&(((gclient_t *)0)->x))
|
||||
#define NPCOFS(x) ((int)&(((gNPC_t *)0)->x))
|
||||
#define VHOFS(x) ((int)&(((Vehicle_t *)0)->x))
|
||||
#define STOFS(x) ((size_t)&(((spawn_temp_t *)0)->x))
|
||||
#define LLOFS(x) ((size_t)&(((level_locals_t *)0)->x))
|
||||
#define CLOFS(x) ((size_t)&(((gclient_t *)0)->x))
|
||||
#define NPCOFS(x) ((size_t)&(((gNPC_t *)0)->x))
|
||||
#define VHOFS(x) ((size_t)&(((Vehicle_t *)0)->x))
|
||||
|
||||
//
|
||||
#define strFOFS(x) #x,FOFS(x)
|
||||
|
@ -61,4 +61,4 @@ typedef struct
|
|||
|
||||
#endif // #ifndef FIELDS_H
|
||||
|
||||
//////////////////////// eof //////////////////////////
|
||||
//////////////////////// eof //////////////////////////
|
||||
|
|
|
@ -722,7 +722,7 @@ static void EvaluateFields(const save_field_t *pFields, byte *pbData, byte *pbOr
|
|||
if ( iSize == (int)(iReadSize+((sizeof(saberInfo_t)-sizeof(saberInfoRetail_t))*2)) )
|
||||
{
|
||||
gclient_t newClient;
|
||||
const int preSaberDataSize = ((int)&newClient.ps.saber[0]-(int)&newClient);
|
||||
const int preSaberDataSize = ((size_t)&newClient.ps.saber[0]-(size_t)&newClient);
|
||||
memcpy( &newClient, pbData, preSaberDataSize );
|
||||
SG_ConvertRetailSaberinfoToNewSaberinfo( ((void *)(&((gclient_t *)(pbData))->ps.saber[0])), &newClient.ps.saber[0] );
|
||||
memcpy( &newClient.ps.dualSabers, pbData+preSaberDataSize+(sizeof(saberInfoRetail_t)*2), sizeof(newClient)-(preSaberDataSize+(sizeof(saberInfo_t)*2)) );
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "hitlocs.h"
|
||||
#include "bset.h"
|
||||
|
||||
#define FOFS(x) ((int)&(((gentity_t *)0)->x))
|
||||
#define FOFS(x) ((size_t)&(((gentity_t *)0)->x))
|
||||
|
||||
#ifdef _XBOX
|
||||
#define MAX_NPC_WATER_UPDATE_PER_FRAME 2 // maxmum number of NPCs that will get updated water infromation per frame
|
||||
|
|
|
@ -63,7 +63,7 @@ typedef struct
|
|||
//NOTE: this MUST stay up to date with the number of variables in the vehFields table!!!
|
||||
#define NUM_VWEAP_PARMS 25
|
||||
|
||||
#define VWFOFS(x) ((int)&(((vehWeaponInfo_t *)0)->x))
|
||||
#define VWFOFS(x) ((size_t)&(((vehWeaponInfo_t *)0)->x))
|
||||
|
||||
#define MAX_VEH_WEAPONS 16 //sigh... no more than 16 different vehicle weapons
|
||||
#define VEH_WEAPON_BASE 0
|
||||
|
@ -352,7 +352,7 @@ typedef struct
|
|||
bool (*Inhabited)( Vehicle_t *pVeh );
|
||||
} vehicleInfo_t;
|
||||
|
||||
#define VFOFS(x) ((int)&(((vehicleInfo_t *)0)->x))
|
||||
#define VFOFS(x) ((size_t)&(((vehicleInfo_t *)0)->x))
|
||||
|
||||
#define MAX_VEHICLES 16 //sigh... no more than 64 individual vehicles
|
||||
extern vehicleInfo_t g_vehicleInfo[MAX_VEHICLES];
|
||||
|
|
|
@ -264,7 +264,7 @@ public:
|
|||
int mFlags; // used for determining whether to do full collision detection against this object
|
||||
// to here
|
||||
#define BSAVE_END_FIELD mTransformedVertsArray // this is the end point for loadsave, keep it up to date it you change anything
|
||||
int *mTransformedVertsArray; // used to create an array of pointers to transformed verts per surface for collision detection
|
||||
size_t *mTransformedVertsArray; // used to create an array of pointers to transformed verts per surface for collision detection
|
||||
CBoneCache *mBoneCache;
|
||||
int mSkin;
|
||||
|
||||
|
@ -492,4 +492,4 @@ enum EG2_Collision
|
|||
|
||||
//====================================================================
|
||||
|
||||
#endif // GHOUL2_SHARED_H_INC
|
||||
#endif // GHOUL2_SHARED_H_INC
|
||||
|
|
|
@ -535,15 +535,15 @@ void MakeNormalVectors( const vec3_t forward, vec3_t right, vec3_t up) {
|
|||
*/
|
||||
float Q_rsqrt( float number )
|
||||
{
|
||||
long i;
|
||||
floatint_t t;
|
||||
float x2, y;
|
||||
const float threehalfs = 1.5F;
|
||||
|
||||
x2 = number * 0.5F;
|
||||
y = number;
|
||||
i = * ( long * ) &y; // evil floating point bit level hacking
|
||||
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
|
||||
y = * ( float * ) &i;
|
||||
t.f = number;
|
||||
t.i = 0x5f3759df - (t.i >> 1); // what the fuck?
|
||||
y = t.f;
|
||||
|
||||
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
|
||||
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
|
||||
|
||||
|
@ -551,9 +551,10 @@ float Q_rsqrt( float number )
|
|||
}
|
||||
|
||||
float Q_fabs( float f ) {
|
||||
int tmp = * ( int * ) &f;
|
||||
tmp &= 0x7FFFFFFF;
|
||||
return * ( float * ) &tmp;
|
||||
floatint_t fi;
|
||||
fi.f = f;
|
||||
fi.i &= 0x7FFFFFFF;
|
||||
return fi.f;
|
||||
}
|
||||
|
||||
//============================================================
|
||||
|
|
|
@ -204,6 +204,13 @@ typedef const char *LPCSTR;
|
|||
typedef enum {qfalse, qtrue} qboolean;
|
||||
#define qboolean int //don't want strict type checking on the qboolean
|
||||
|
||||
typedef union
|
||||
{
|
||||
float f;
|
||||
int i;
|
||||
unsigned int ui;
|
||||
} floatint_t;
|
||||
|
||||
typedef int qhandle_t;
|
||||
typedef int thandle_t;
|
||||
typedef int fxHandle_t;
|
||||
|
|
|
@ -195,7 +195,7 @@ public:
|
|||
const int modelIndex;
|
||||
const skin_t *skin;
|
||||
const shader_t *cust_shader;
|
||||
int *TransformedVertsArray;
|
||||
size_t *TransformedVertsArray;
|
||||
const EG2_Collision eG2TraceType;
|
||||
bool hitOne;
|
||||
float m_fRadius;
|
||||
|
@ -224,7 +224,7 @@ public:
|
|||
int initmodelIndex,
|
||||
const skin_t *initskin,
|
||||
const shader_t *initcust_shader,
|
||||
int *initTransformedVertsArray,
|
||||
size_t *initTransformedVertsArray,
|
||||
const EG2_Collision einitG2TraceType,
|
||||
#ifdef _G2_GORE
|
||||
float fRadius,
|
||||
|
@ -290,7 +290,7 @@ void G2_List_Model_Surfaces(const char *fileName)
|
|||
}
|
||||
}
|
||||
// find the next surface
|
||||
surf = (mdxmSurfHierarchy_t *)( (byte *)surf + (int)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surf->numChildren ] ));
|
||||
surf = (mdxmSurfHierarchy_t *)( (byte *)surf + (size_t)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surf->numChildren ] ));
|
||||
surface =(mdxmSurface_t *)( (byte *)surface + surface->ofsEnd );
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ void G2_List_Model_Bones(const char *fileName, int frame)
|
|||
// figure out where the offset list is
|
||||
offsets = (mdxaSkelOffsets_t *)((byte *)header + sizeof(mdxaHeader_t));
|
||||
|
||||
// frameSize = (int)( &((mdxaFrame_t *)0)->boneIndexes[ header->numBones ] );
|
||||
// frameSize = (size_t)( &((mdxaFrame_t *)0)->boneIndexes[ header->numBones ] );
|
||||
|
||||
// aframe = (mdxaFrame_t *)((byte *)header + header->ofsFrames + (frame * frameSize));
|
||||
// walk each bone and list it's name
|
||||
|
@ -394,7 +394,7 @@ int G2_DecideTraceLod(CGhoul2Info &ghoul2, int useLod)
|
|||
// This is in tr_ghoul2 for various reasons.
|
||||
extern void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, CMiniHeap *G2VertSpace, int *TransformedVertsArray,CBoneCache *boneCache);
|
||||
#else
|
||||
void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, CMiniHeap *G2VertSpace, int *TransformedVertsArray,CBoneCache *boneCache)
|
||||
void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, CMiniHeap *G2VertSpace, size_t *TransformedVertsArray,CBoneCache *boneCache)
|
||||
{
|
||||
int j, k;
|
||||
mdxmVertex_t *v;
|
||||
|
@ -407,7 +407,7 @@ void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, CMiniHe
|
|||
|
||||
// alloc some space for the transformed verts to get put in
|
||||
TransformedVerts = (float *)G2VertSpace->MiniHeapAlloc(surface->numVerts * 5 * 4);
|
||||
TransformedVertsArray[surface->thisSurfaceIndex] = (int)TransformedVerts;
|
||||
TransformedVertsArray[surface->thisSurfaceIndex] = (size_t)TransformedVerts;
|
||||
if (!TransformedVerts)
|
||||
{
|
||||
assert(TransformedVerts);
|
||||
|
@ -509,7 +509,7 @@ void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, CMiniHe
|
|||
#endif
|
||||
|
||||
void G2_TransformSurfaces(int surfaceNum, surfaceInfo_v &rootSList,
|
||||
CBoneCache *boneCache, const model_t *currentModel, int lod, vec3_t scale, CMiniHeap *G2VertSpace, int *TransformedVertArray, bool secondTimeAround)
|
||||
CBoneCache *boneCache, const model_t *currentModel, int lod, vec3_t scale, CMiniHeap *G2VertSpace, size_t *TransformedVertArray, bool secondTimeAround)
|
||||
{
|
||||
int i;
|
||||
assert(currentModel);
|
||||
|
@ -633,7 +633,7 @@ void G2_TransformModel(CGhoul2Info_v &ghoul2, const int frameNum, vec3_t scale,
|
|||
}
|
||||
|
||||
// give us space for the transformed vertex array to be put in
|
||||
g.mTransformedVertsArray = (int*)G2VertSpace->MiniHeapAlloc(g.currentModel->mdxm->numSurfaces * 4);
|
||||
g.mTransformedVertsArray = (size_t*)G2VertSpace->MiniHeapAlloc(g.currentModel->mdxm->numSurfaces * 4);
|
||||
if (!g.mTransformedVertsArray)
|
||||
{
|
||||
Com_Error(ERR_DROP, "Ran out of transform space for Ghoul2 Models. Adjust MiniHeapSize in SV_SpawnServer.\n");
|
||||
|
@ -1725,7 +1725,7 @@ void *G2_FindSurface(const model_s *mod, int index, int lod)
|
|||
assert(mod->mdxm);
|
||||
|
||||
// point at first lod list
|
||||
byte *current = (byte*)((int)mod->mdxm + (int)mod->mdxm->ofsLODs);
|
||||
byte *current = (byte*)((size_t)mod->mdxm + (size_t)mod->mdxm->ofsLODs);
|
||||
int i;
|
||||
|
||||
//walk the lods
|
||||
|
@ -1764,7 +1764,7 @@ void G2_SaveGhoul2Models(CGhoul2Info_v &ghoul2)
|
|||
}
|
||||
|
||||
// this one isn't a define since I couldn't work out how to figure it out at compile time
|
||||
const int ghoul2BlockSize = (int)&ghoul2[0].BSAVE_END_FIELD - (int)&ghoul2[0].BSAVE_START_FIELD;
|
||||
const int ghoul2BlockSize = (size_t)&ghoul2[0].BSAVE_END_FIELD - (size_t)&ghoul2[0].BSAVE_START_FIELD;
|
||||
|
||||
// add in count for number of ghoul2 models
|
||||
iGhoul2Size += 4;
|
||||
|
@ -1877,7 +1877,7 @@ void G2_LoadGhoul2Model(CGhoul2Info_v &ghoul2, char *buffer)
|
|||
}
|
||||
|
||||
// this one isn't a define since I couldn't work out how to figure it out at compile time
|
||||
const int ghoul2BlockSize = (int)&ghoul2[0].mTransformedVertsArray - (int)&ghoul2[0].mModelindex;
|
||||
const int ghoul2BlockSize = (size_t)&ghoul2[0].mTransformedVertsArray - (size_t)&ghoul2[0].mModelindex;
|
||||
|
||||
// now we have enough instances, lets go through each one and load up the relevant details
|
||||
for (int i=0; i<ghoul2.size(); i++)
|
||||
|
|
|
@ -135,7 +135,7 @@ int G2_IsSurfaceLegal(const model_s *mod_m, const char *surfaceName, int *flags)
|
|||
return i;
|
||||
}
|
||||
// find the next surface
|
||||
surf = (mdxmSurfHierarchy_t *)( (byte *)surf + (int)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surf->numChildren ] ));
|
||||
surf = (mdxmSurfHierarchy_t *)( (byte *)surf + (size_t)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surf->numChildren ] ));
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -95,24 +95,24 @@ ReadMember
|
|||
-------------------------
|
||||
*/
|
||||
|
||||
int CBlockMember::ReadMember( char **stream, long *streamPos, CIcarus* icarus )
|
||||
int CBlockMember::ReadMember( char **stream, int *streamPos, CIcarus* icarus )
|
||||
{
|
||||
IGameInterface* game = icarus->GetGame();
|
||||
m_id = *(int *) (*stream + *streamPos);
|
||||
m_id = *(int *) (*stream + *((int *)streamPos));
|
||||
*streamPos += sizeof( int );
|
||||
|
||||
if ( m_id == CIcarus::ID_RANDOM )
|
||||
{//special case, need to initialize this member's data to Q3_INFINITE so we can randomize the number only the first time random is checked when inside a wait
|
||||
m_size = sizeof( float );
|
||||
*streamPos += sizeof( long );
|
||||
*streamPos += sizeof( int );
|
||||
m_data = game->Malloc( m_size );
|
||||
float infinite = game->MaxFloat();
|
||||
memcpy( m_data, &infinite, m_size );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_size = *(long *) (*stream + *streamPos);
|
||||
*streamPos += sizeof( long );
|
||||
m_size = *(int *) (*stream + *streamPos);
|
||||
*streamPos += sizeof( int );
|
||||
m_data = game->Malloc( m_size );
|
||||
memcpy( m_data, (*stream + *streamPos), m_size );
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
void Free(IGameInterface* game);
|
||||
|
||||
int WriteMember ( FILE * ); //Writes the member's data, in block format, to FILE *
|
||||
int ReadMember( char **, long *, CIcarus* icarus ); //Reads the member's data, in block format, from FILE *
|
||||
int ReadMember( char **, int *, CIcarus* icarus ); //Reads the member's data, in block format, from FILE *
|
||||
|
||||
void SetID( int id ) { m_id = id; } //Set the ID member variable
|
||||
void SetSize( int size ) { m_size = size; } //Set the size member variable
|
||||
|
@ -205,11 +205,11 @@ protected:
|
|||
char m_fileName[CIcarus::MAX_FILENAME_LENGTH]; //Name of the current file
|
||||
|
||||
char *m_stream; //Stream of data to be parsed
|
||||
long m_streamPos;
|
||||
int m_streamPos;
|
||||
|
||||
static char* s_IBI_EXT;
|
||||
static char* s_IBI_HEADER_ID;
|
||||
static const float s_IBI_VERSION;
|
||||
};
|
||||
|
||||
#endif //__INTERPRETED_BLOCK_STREAM__
|
||||
#endif //__INTERPRETED_BLOCK_STREAM__
|
||||
|
|
|
@ -161,9 +161,9 @@ bool PNG_HandleIHDR(const byte *data, png_image_t *image)
|
|||
|
||||
// Filter a row of data
|
||||
|
||||
void PNG_Filter(byte *out, byte filter, const byte *in, const byte *lastline, ulong rowbytes, ulong bpp)
|
||||
void PNG_Filter(byte *out, byte filter, const byte *in, const byte *lastline, uint32_t rowbytes, uint32_t bpp)
|
||||
{
|
||||
ulong i;
|
||||
uint32_t i;
|
||||
|
||||
switch(filter)
|
||||
{
|
||||
|
@ -262,9 +262,9 @@ void PNG_Filter(byte *out, byte filter, const byte *in, const byte *lastline, ul
|
|||
|
||||
// Unfilters a row of data
|
||||
|
||||
void PNG_Unfilter(byte *out, byte filter, const byte *lastline, ulong rowbytes, ulong bpp)
|
||||
void PNG_Unfilter(byte *out, byte filter, const byte *lastline, uint32_t rowbytes, uint32_t bpp)
|
||||
{
|
||||
ulong i;
|
||||
uint32_t i;
|
||||
|
||||
switch(filter)
|
||||
{
|
||||
|
@ -351,11 +351,11 @@ void PNG_Unfilter(byte *out, byte filter, const byte *lastline, ulong rowbytes,
|
|||
|
||||
// Pack up the image data line by line
|
||||
|
||||
bool PNG_Pack(byte *out, ulong *size, ulong maxsize, byte *data, int width, int height, int bytedepth)
|
||||
bool PNG_Pack(byte *out, uint32_t *size, uint32_t maxsize, byte *data, int width, int height, int bytedepth)
|
||||
{
|
||||
z_stream zdata;
|
||||
ulong rowbytes;
|
||||
ulong y;
|
||||
uint32_t rowbytes;
|
||||
uint32_t y;
|
||||
const byte *lastline, *source;
|
||||
// Storage for filter type and filtered row
|
||||
byte workline[(MAX_PNG_WIDTH * MAX_PNG_DEPTH) + 1];
|
||||
|
@ -405,9 +405,9 @@ bool PNG_Pack(byte *out, ulong *size, ulong maxsize, byte *data, int width, int
|
|||
|
||||
// Unpack the image data, line by line
|
||||
|
||||
bool PNG_Unpack(const byte *data, const ulong datasize, png_image_t *image)
|
||||
bool PNG_Unpack(const byte *data, const uint32_t datasize, png_image_t *image)
|
||||
{
|
||||
ulong rowbytes, zerror, y;
|
||||
uint32_t rowbytes, zerror, y;
|
||||
byte filter;
|
||||
z_stream zdata;
|
||||
byte *lastline, *out;
|
||||
|
@ -464,12 +464,12 @@ bool PNG_Unpack(const byte *data, const ulong datasize, png_image_t *image)
|
|||
|
||||
// Scan through all chunks and process each one
|
||||
|
||||
bool PNG_Load(const byte *data, ulong datasize, png_image_t *image)
|
||||
bool PNG_Load(const byte *data, uint32_t datasize, png_image_t *image)
|
||||
{
|
||||
bool moredata;
|
||||
const byte *next;
|
||||
byte *workspace, *work;
|
||||
ulong length, type, crc, totallength;
|
||||
uint32_t length, type, crc, totallength;
|
||||
|
||||
png_error = PNG_ERROR_OK;
|
||||
|
||||
|
@ -487,19 +487,19 @@ bool PNG_Load(const byte *data, ulong datasize, png_image_t *image)
|
|||
moredata = true;
|
||||
while(moredata)
|
||||
{
|
||||
length = BigLong(*(ulong *)data);
|
||||
data += sizeof(ulong);
|
||||
length = BigLong(*(uint32_t *)data);
|
||||
data += sizeof(uint32_t);
|
||||
|
||||
type = BigLong(*(ulong *)data);
|
||||
type = BigLong(*(uint32_t *)data);
|
||||
const byte *crcbase = data;
|
||||
data += sizeof(ulong);
|
||||
data += sizeof(uint32_t);
|
||||
|
||||
// CRC checksum location
|
||||
next = data + length + sizeof(ulong);
|
||||
next = data + length + sizeof(uint32_t);
|
||||
|
||||
// CRC checksum includes header field
|
||||
crc = crc32(0, crcbase, length + sizeof(ulong));
|
||||
if(crc != (ulong)BigLong(*(ulong *)(next - 4)))
|
||||
crc = crc32(0, crcbase, length + sizeof(uint32_t));
|
||||
if(crc != (uint32_t)BigLong(*(uint32_t *)(next - 4)))
|
||||
{
|
||||
if(image->data)
|
||||
{
|
||||
|
@ -548,9 +548,9 @@ bool PNG_Load(const byte *data, ulong datasize, png_image_t *image)
|
|||
|
||||
// Outputs a crc'd chunk of PNG data
|
||||
|
||||
bool PNG_OutputChunk(fileHandle_t fp, ulong type, byte *data, ulong size)
|
||||
bool PNG_OutputChunk(fileHandle_t fp, uint32_t type, byte *data, uint32_t size)
|
||||
{
|
||||
ulong crc, little, outcount;
|
||||
uint32_t crc, little, outcount;
|
||||
|
||||
// Output a standard PNG chunk - length, type, data, crc
|
||||
little = BigLong(size);
|
||||
|
@ -584,7 +584,7 @@ bool PNG_Save(const char *name, byte *data, int width, int height, int bytedepth
|
|||
byte *work;
|
||||
fileHandle_t fp;
|
||||
int maxsize;
|
||||
ulong size, outcount;
|
||||
uint32_t size, outcount;
|
||||
png_ihdr_t png_header;
|
||||
|
||||
png_error = PNG_ERROR_OK;
|
||||
|
@ -656,7 +656,7 @@ void PNG_ConvertTo32(png_image_t *image)
|
|||
{
|
||||
byte *temp;
|
||||
byte *old, *old2;
|
||||
ulong i;
|
||||
uint32_t i;
|
||||
|
||||
temp = (byte *)Z_Malloc(image->width * image->height * 4, TAG_TEMP_PNG, qtrue);
|
||||
old = image->data;
|
||||
|
@ -780,4 +780,4 @@ bool LoadPNG8 (char *name, byte **pixels, int *width, int *height)
|
|||
return(true);
|
||||
}
|
||||
|
||||
// end
|
||||
// end
|
||||
|
|
|
@ -39,15 +39,15 @@
|
|||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned long ulong;
|
||||
typedef unsigned int uint;
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct png_ihdr_s
|
||||
{
|
||||
ulong width;
|
||||
ulong height;
|
||||
uint width;
|
||||
uint height;
|
||||
byte bitdepth; // Bits per sample (not per pixel)
|
||||
byte colortype; // bit 0 - palette; bit 1 - RGB; bit 2 - alpha channel
|
||||
byte compression; // 0 for zip - error otherwise
|
||||
|
@ -60,9 +60,9 @@ typedef struct png_ihdr_s
|
|||
typedef struct png_image_s
|
||||
{
|
||||
byte *data;
|
||||
ulong width;
|
||||
ulong height;
|
||||
ulong bytedepth;
|
||||
uint width;
|
||||
uint height;
|
||||
uint bytedepth;
|
||||
bool isimage;
|
||||
} png_image_t;
|
||||
|
||||
|
@ -70,4 +70,4 @@ bool LoadPNG32 (char *name, byte **pixels, int *width, int *height, int *bytedep
|
|||
bool LoadPNG8 (char *name, byte **pixels, int *width, int *height);
|
||||
bool PNG_Save(const char *name, byte *data, int width, int height, int bytedepth);
|
||||
|
||||
// end
|
||||
// end
|
||||
|
|
|
@ -16,9 +16,9 @@ public:
|
|||
void ResetHeap()
|
||||
{
|
||||
#if _DEBUG
|
||||
if ((int)mCurrentHeap - (int)mHeap>mMaxAlloc)
|
||||
if ((size_t)mCurrentHeap - (size_t)mHeap>mMaxAlloc)
|
||||
{
|
||||
mMaxAlloc=(int)mCurrentHeap - (int)mHeap;
|
||||
mMaxAlloc=(size_t)mCurrentHeap - (size_t)mHeap;
|
||||
}
|
||||
#endif
|
||||
mCurrentHeap = mHeap;
|
||||
|
@ -50,7 +50,7 @@ CMiniHeap(int size)
|
|||
// give me some space from the heap please
|
||||
char *MiniHeapAlloc(int size)
|
||||
{
|
||||
if (size < (mSize - ((int)mCurrentHeap - (int)mHeap)))
|
||||
if (size < (mSize - ((size_t)mCurrentHeap - (size_t)mHeap)))
|
||||
{
|
||||
char *tempAddress = mCurrentHeap;
|
||||
mCurrentHeap += size;
|
||||
|
|
|
@ -250,7 +250,7 @@ winding_t *CopyWinding (winding_t *w)
|
|||
winding_t *c;
|
||||
|
||||
c = AllocWinding (w->numpoints);
|
||||
size = (int)((winding_t *)0)->p[w->numpoints];
|
||||
size = (size_t)((winding_t *)0)->p[w->numpoints];
|
||||
memcpy (c, w, size);
|
||||
return c;
|
||||
}
|
||||
|
|
|
@ -1524,7 +1524,7 @@ static void FS_AddGameDirectory( const char *path, const char *dir ) {
|
|||
sorted[i] = pakfiles[i];
|
||||
}
|
||||
|
||||
qsort( sorted, numfiles, 4, paksort );
|
||||
qsort( sorted, numfiles, sizeof(char *), paksort );
|
||||
|
||||
for ( i = 0 ; i < numfiles ; i++ ) {
|
||||
pakfile = FS_BuildOSPath( path, dir, sorted[i] );
|
||||
|
|
|
@ -9,7 +9,7 @@ typedef unsigned char *POINTER;
|
|||
typedef unsigned short int UINT2;
|
||||
|
||||
/* UINT4 defines a four byte word */
|
||||
typedef unsigned long int UINT4;
|
||||
typedef unsigned int UINT4;
|
||||
|
||||
|
||||
/* MD4.H - header file for MD4C.C */
|
||||
|
|
|
@ -399,20 +399,22 @@ int MSG_ReadDelta( msg_t *msg, int oldV, int bits ) {
|
|||
}
|
||||
|
||||
void MSG_WriteDeltaFloat( msg_t *msg, float oldV, float newV ) {
|
||||
floatint_t fi;
|
||||
if ( oldV == newV ) {
|
||||
MSG_WriteBits( msg, 0, 1 );
|
||||
return;
|
||||
}
|
||||
fi.f = newV;
|
||||
MSG_WriteBits( msg, 1, 1 );
|
||||
MSG_WriteBits( msg, *(int *)&newV, 32 );
|
||||
MSG_WriteBits( msg, fi.i, 32 );
|
||||
}
|
||||
|
||||
float MSG_ReadDeltaFloat( msg_t *msg, float oldV ) {
|
||||
if ( MSG_ReadBits( msg, 1 ) ) {
|
||||
float newV;
|
||||
floatint_t fi;
|
||||
|
||||
*(int *)&newV = MSG_ReadBits( msg, 32 );
|
||||
return newV;
|
||||
fi.i = MSG_ReadBits(msg, 32);
|
||||
return fi.f;
|
||||
}
|
||||
return oldV;
|
||||
}
|
||||
|
@ -488,7 +490,7 @@ typedef struct {
|
|||
} netField_t;
|
||||
|
||||
// using the stringizing operator to save typing...
|
||||
#define NETF(x) #x,(int)&((entityState_t*)0)->x
|
||||
#define NETF(x) #x,(size_t)&((entityState_t*)0)->x
|
||||
|
||||
#if 0 // Removed by BTO (VV)
|
||||
const netField_t entityStateFields[] =
|
||||
|
@ -922,7 +924,7 @@ plyer_state_t communication
|
|||
*/
|
||||
|
||||
// using the stringizing operator to save typing...
|
||||
#define PSF(x) #x,(int)&((playerState_t*)0)->x
|
||||
#define PSF(x) #x,(size_t)&((playerState_t*)0)->x
|
||||
|
||||
static const netField_t playerStateFields[] =
|
||||
{
|
||||
|
|
|
@ -192,7 +192,7 @@ typedef struct {
|
|||
int parentIndex; // this points to the index in the file of the parent surface. -1 if null/root
|
||||
int numChildren; // number of surfaces which are children of this one
|
||||
int childIndexes[1]; // [mdxmSurfHierarch_t->numChildren] (variable sized)
|
||||
} mdxmSurfHierarchy_t; // struct size = (int)( &((mdxmSurfHierarch_t *)0)->childIndexes[ mdxmSurfHierarch_t->numChildren ] );
|
||||
} mdxmSurfHierarchy_t; // struct size = (size_t)( &((mdxmSurfHierarch_t *)0)->childIndexes[ mdxmSurfHierarch_t->numChildren ] );
|
||||
// }
|
||||
|
||||
|
||||
|
@ -393,7 +393,7 @@ typedef struct {
|
|||
mdxaBone_t BasePoseMatInv; // inverse, to save run-time calc
|
||||
int numChildren; // number of children bones
|
||||
int children[1]; // [mdxaSkel_t->numChildren] (variable sized)
|
||||
} mdxaSkel_t; // struct size = (int)( &((mdxaSkel_t *)0)->children[ mdxaSkel_t->numChildren ] );
|
||||
} mdxaSkel_t; // struct size = (size_t)( &((mdxaSkel_t *)0)->children[ mdxaSkel_t->numChildren ] );
|
||||
// }
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ static int R_ACullModel( md4Header_t *header, trRefEntity_t *ent ) {
|
|||
|
||||
if (header->ofsFrames<0) // Compressed
|
||||
{
|
||||
frameSize = (int)( &((md4CompFrame_t *)0)->bones[ tr.currentModel->md4->numBones ] );
|
||||
frameSize = (size_t)( &((md4CompFrame_t *)0)->bones[ tr.currentModel->md4->numBones ] );
|
||||
newFrame = (md4Frame_t *)((byte *)header - header->ofsFrames + ent->e.frame * frameSize );
|
||||
oldFrame = (md4Frame_t *)((byte *)header - header->ofsFrames + ent->e.oldframe * frameSize );
|
||||
// HACK! These frames actually are md4CompFrames, but the first fields are the same,
|
||||
|
@ -46,7 +46,7 @@ static int R_ACullModel( md4Header_t *header, trRefEntity_t *ent ) {
|
|||
}
|
||||
else
|
||||
{
|
||||
frameSize = (int)( &((md4Frame_t *)0)->bones[ tr.currentModel->md4->numBones ] );
|
||||
frameSize = (size_t)( &((md4Frame_t *)0)->bones[ tr.currentModel->md4->numBones ] );
|
||||
newFrame = (md4Frame_t *)((byte *)header + header->ofsFrames + ent->e.frame * frameSize );
|
||||
oldFrame = (md4Frame_t *)((byte *)header + header->ofsFrames + ent->e.oldframe * frameSize );
|
||||
}
|
||||
|
@ -144,14 +144,14 @@ static int R_AComputeFogNum( md4Header_t *header, trRefEntity_t *ent ) {
|
|||
|
||||
if (header->ofsFrames<0) // Compressed
|
||||
{
|
||||
frameSize = (int)( &((md4CompFrame_t *)0)->bones[ header->numBones ] );
|
||||
frameSize = (size_t)( &((md4CompFrame_t *)0)->bones[ header->numBones ] );
|
||||
frame = (md4Frame_t *)((byte *)header - header->ofsFrames + ent->e.frame * frameSize );
|
||||
// HACK! These frames actually are md4CompFrames, but the first fields are the same,
|
||||
// so this will work for this routine.
|
||||
}
|
||||
else
|
||||
{
|
||||
frameSize = (int)( &((md4Frame_t *)0)->bones[ header->numBones ] );
|
||||
frameSize = (size_t)( &((md4Frame_t *)0)->bones[ header->numBones ] );
|
||||
frame = (md4Frame_t *)((byte *)header + header->ofsFrames + ent->e.frame * frameSize );
|
||||
}
|
||||
|
||||
|
@ -376,14 +376,14 @@ void RB_SurfaceAnim( md4Surface_t *surface ) {
|
|||
if (header->ofsFrames<0) // Compressed
|
||||
{
|
||||
compressed = qtrue;
|
||||
frameSize = (int)( &((md4CompFrame_t *)0)->bones[ header->numBones ] );
|
||||
frameSize = (size_t)( &((md4CompFrame_t *)0)->bones[ header->numBones ] );
|
||||
cframe = (md4CompFrame_t *)((byte *)header - header->ofsFrames + backEnd.currentEntity->e.frame * frameSize );
|
||||
coldFrame = (md4CompFrame_t *)((byte *)header - header->ofsFrames + backEnd.currentEntity->e.oldframe * frameSize );
|
||||
}
|
||||
else
|
||||
{
|
||||
compressed = qfalse;
|
||||
frameSize = (int)( &((md4Frame_t *)0)->bones[ header->numBones ] );
|
||||
frameSize = (size_t)( &((md4Frame_t *)0)->bones[ header->numBones ] );
|
||||
frame = (md4Frame_t *)((byte *)header + header->ofsFrames +
|
||||
backEnd.currentEntity->e.frame * frameSize );
|
||||
oldFrame = (md4Frame_t *)((byte *)header + header->ofsFrames +
|
||||
|
@ -475,4 +475,4 @@ void RB_SurfaceAnim( md4Surface_t *surface ) {
|
|||
}
|
||||
|
||||
tess.numVertexes += surface->numVerts;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -372,7 +372,7 @@ static void ParseFace( dsurface_t *ds, mapVert_t *verts, msurface_t *surf, int *
|
|||
srfSurfaceFace_t *cv;
|
||||
int numPoints, numIndexes;
|
||||
int lightmapNum[MAXLIGHTMAPS];
|
||||
int sfaceSize, ofsIndexes;
|
||||
size_t sfaceSize, ofsIndexes;
|
||||
|
||||
for(i=0;i<MAXLIGHTMAPS;i++)
|
||||
{
|
||||
|
@ -400,7 +400,7 @@ static void ParseFace( dsurface_t *ds, mapVert_t *verts, msurface_t *surf, int *
|
|||
numIndexes = LittleLong( ds->numIndexes );
|
||||
|
||||
// create the srfSurfaceFace_t
|
||||
sfaceSize = ( int ) &((srfSurfaceFace_t *)0)->points[numPoints];
|
||||
sfaceSize = ( size_t ) &((srfSurfaceFace_t *)0)->points[numPoints];
|
||||
ofsIndexes = sfaceSize;
|
||||
sfaceSize += sizeof( int ) * numIndexes;
|
||||
|
||||
|
@ -689,7 +689,7 @@ static void R_LoadSurfaces( lump_t *surfs, lump_t *verts, lump_t *indexLump, wor
|
|||
{
|
||||
case MST_PLANAR:
|
||||
|
||||
int sfaceSize = ( int ) &((srfSurfaceFace_t *)0)->points[LittleLong(in->numVerts)];
|
||||
int sfaceSize = ( size_t ) &((srfSurfaceFace_t *)0)->points[LittleLong(in->numVerts)];
|
||||
sfaceSize += sizeof( int ) * LittleLong(in->numIndexes);
|
||||
|
||||
iFaceDataSizeRequired += sfaceSize;
|
||||
|
|
|
@ -365,15 +365,15 @@ byte* RE_TempRawImage_ReadFromFile(const char *psLocalFilename, int *piWidth, in
|
|||
|
||||
if (pbReturn && qbVertFlip)
|
||||
{
|
||||
unsigned long *pSrcLine = (unsigned long *) pbReturn;
|
||||
unsigned long *pDstLine = (unsigned long *) pbReturn + (*piHeight * *piWidth ); // *4 done by compiler (longs)
|
||||
unsigned int *pSrcLine = (unsigned int *) pbReturn;
|
||||
unsigned int *pDstLine = (unsigned int *) pbReturn + (*piHeight * *piWidth ); // *4 done by compiler (ints)
|
||||
pDstLine-= *piWidth; // point at start of last line, not first after buffer
|
||||
|
||||
for (int iLineCount=0; iLineCount<*piHeight/2; iLineCount++)
|
||||
{
|
||||
for (int x=0; x<*piWidth; x++)
|
||||
{
|
||||
unsigned long l = pSrcLine[x];
|
||||
unsigned int l = pSrcLine[x];
|
||||
pSrcLine[x] = pDstLine[x];
|
||||
pDstLine[x] = l;
|
||||
}
|
||||
|
|
|
@ -2338,7 +2338,7 @@ void G2_TransformGhoulBones(boneInfo_v &rootBoneList,mdxaBone_t &rootMatrix, CGh
|
|||
//rww - RAGDOLL_END
|
||||
|
||||
// ghoul2.mBoneCache->mWraithID=0;
|
||||
ghoul2.mBoneCache->frameSize = 0;// can be deleted in new G2 format //(int)( &((mdxaFrame_t *)0)->boneIndexes[ ghoul2.aHeader->numBones ] );
|
||||
ghoul2.mBoneCache->frameSize = 0;// can be deleted in new G2 format //(size_t)( &((mdxaFrame_t *)0)->boneIndexes[ ghoul2.aHeader->numBones ] );
|
||||
|
||||
ghoul2.mBoneCache->rootBoneList=&rootBoneList;
|
||||
ghoul2.mBoneCache->rootMatrix=rootMatrix;
|
||||
|
@ -4141,7 +4141,7 @@ qboolean R_LoadMDXM( model_t *mod, void *buffer, const char *mod_name, qboolean
|
|||
}
|
||||
|
||||
// find the next surface
|
||||
surfInfo = (mdxmSurfHierarchy_t *)( (byte *)surfInfo + (int)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surfInfo->numChildren ] ));
|
||||
surfInfo = (mdxmSurfHierarchy_t *)( (byte *)surfInfo + (size_t)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surfInfo->numChildren ] ));
|
||||
}
|
||||
|
||||
// swap all the LOD's (we need to do the middle part of this even for intel, because of shader reg and err-check)
|
||||
|
@ -4347,12 +4347,12 @@ qboolean R_LoadMDXA( model_t *mod, void *buffer, const char *mod_name, qboolean
|
|||
}
|
||||
|
||||
// get next bone
|
||||
boneInfo += (int)( &((mdxaSkel_t *)0)->children[ boneInfo->numChildren ] );
|
||||
boneInfo += (size_t)( &((mdxaSkel_t *)0)->children[ boneInfo->numChildren ] );
|
||||
}
|
||||
|
||||
|
||||
// swap all the frames
|
||||
frameSize = (int)( &((mdxaFrame_t *)0)->bones[ mdxa->numBones ] );
|
||||
frameSize = (size_t)( &((mdxaFrame_t *)0)->bones[ mdxa->numBones ] );
|
||||
for ( i = 0 ; i < mdxa->numFrames ; i++)
|
||||
{
|
||||
cframe = (mdxaFrame_t *) ( (byte *)mdxa + mdxa->ofsFrames + i * frameSize );
|
||||
|
|
|
@ -1376,8 +1376,8 @@ void R_Init( void ) {
|
|||
Swap_Init();
|
||||
|
||||
#ifndef FINAL_BUILD
|
||||
if ( (int)tess.xyz & 15 ) {
|
||||
Com_Printf( "WARNING: tess.xyz not 16 byte aligned (%x)\n",(int)tess.xyz & 15 );
|
||||
if ( (intptr_t)tess.xyz & 15 ) {
|
||||
Com_Printf( "WARNING: tess.xyz not 16 byte aligned (%x)\n",(intptr_t)tess.xyz & 15 );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1097,7 +1097,14 @@ qsort replacement
|
|||
|
||||
=================
|
||||
*/
|
||||
#define SWAP_DRAW_SURF(a,b) temp=((int *)a)[0];((int *)a)[0]=((int *)b)[0];((int *)b)[0]=temp; temp=((int *)a)[1];((int *)a)[1]=((int *)b)[1];((int *)b)[1]=temp;
|
||||
|
||||
static inline void SWAP_DRAW_SURF(drawSurf_t* a, drawSurf_t* b)
|
||||
{
|
||||
drawSurf_t t;
|
||||
memcpy(&t, a, sizeof(t));
|
||||
memcpy(a, b, sizeof(t));
|
||||
memcpy(b, &t, sizeof(t));
|
||||
}
|
||||
|
||||
/* this parameter defines the cutoff between using quick sort and
|
||||
insertion sort for arrays; arrays with lengths shorter or equal to the
|
||||
|
@ -1140,9 +1147,11 @@ void qsortFast (
|
|||
int stkptr; /* stack for saving sub-array to be processed */
|
||||
int temp;
|
||||
|
||||
#if 0
|
||||
if ( sizeof(drawSurf_t) != 8 ) {
|
||||
Com_Error( ERR_DROP, "change SWAP_DRAW_SURF macro" );
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Note: the number of stack entries required is no more than
|
||||
1 + log2(size), so 30 is sufficient for any array */
|
||||
|
@ -1177,7 +1186,7 @@ recurse:
|
|||
performance. */
|
||||
|
||||
mid = lo + (size / 2) * width; /* find middle element */
|
||||
SWAP_DRAW_SURF(mid, lo); /* swap it to beginning of array */
|
||||
SWAP_DRAW_SURF((drawSurf_t *)mid, (drawSurf_t *)lo); /* swap it to beginning of array */
|
||||
|
||||
/* We now wish to partition the array into three pieces, one
|
||||
consisiting of elements <= partition element, one of elements
|
||||
|
@ -1218,7 +1227,7 @@ recurse:
|
|||
A[loguy] > A[lo], A[higuy] < A[lo],
|
||||
loguy < hi, highy > lo */
|
||||
|
||||
SWAP_DRAW_SURF(loguy, higuy);
|
||||
SWAP_DRAW_SURF((drawSurf_t *)loguy, (drawSurf_t *)higuy);
|
||||
|
||||
/* A[loguy] < A[lo], A[higuy] > A[lo]; so condition at top
|
||||
of loop is re-established */
|
||||
|
@ -1232,7 +1241,7 @@ recurse:
|
|||
A[i] <= A[lo] for lo <= i <= higuy,
|
||||
A[i] = A[lo] for higuy < i < loguy */
|
||||
|
||||
SWAP_DRAW_SURF(lo, higuy); /* put partition element in place */
|
||||
SWAP_DRAW_SURF((drawSurf_t *)lo, (drawSurf_t *)higuy); /* put partition element in place */
|
||||
|
||||
/* OK, now we have the following:
|
||||
A[i] >= A[higuy] for loguy <= i <= hi,
|
||||
|
@ -1723,4 +1732,4 @@ void R_RenderView (viewParms_t *parms) {
|
|||
|
||||
// draw main system development information (surface outlines, etc)
|
||||
R_DebugGraphics();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -509,7 +509,9 @@ This is the only way control passes into the module.
|
|||
This must be the very first function compiled into the .qvm file
|
||||
================
|
||||
*/
|
||||
int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 )
|
||||
intptr_t vmMain( intptr_t command, intptr_t arg0, intptr_t arg1, intptr_t arg2,
|
||||
intptr_t arg3, intptr_t arg4, intptr_t arg5, intptr_t arg6, intptr_t arg7,
|
||||
intptr_t arg8, intptr_t arg9, intptr_t arg10, intptr_t arg11 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -2621,7 +2623,7 @@ void _UI_Init( qboolean inGameLoad )
|
|||
uis.debugMode = qfalse;
|
||||
|
||||
// sets defaults for ui temp cvars
|
||||
uiInfo.effectsColor = (int)trap_Cvar_VariableValue("color")-1;
|
||||
uiInfo.effectsColor = gamecodetoui[(int)trap_Cvar_VariableValue("color")-1];
|
||||
if (uiInfo.effectsColor < 0)
|
||||
{
|
||||
uiInfo.effectsColor = 0;
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
// this file is only included when building a dll
|
||||
// syscalls.asm is included instead when building a qvm
|
||||
|
||||
static int (*qsyscall)( int arg, ... ) = (int (*)( int, ...))-1;
|
||||
static intptr_t (*qsyscall)( intptr_t arg, ... ) = (intptr_t (*)( intptr_t, ...))-1;
|
||||
|
||||
extern "C" {
|
||||
void dllEntry( int (*syscallptr)( int arg,... ) ) {
|
||||
void dllEntry( intptr_t (*syscallptr)( intptr_t arg,... ) ) {
|
||||
qsyscall = syscallptr;
|
||||
// CG_PreInit();
|
||||
}
|
||||
|
@ -24,22 +24,22 @@ void dllEntry( int (*syscallptr)( int arg,... ) ) {
|
|||
|
||||
inline int PASSFLOAT( float x )
|
||||
{
|
||||
float floatTemp;
|
||||
floatTemp = x;
|
||||
return *(int *)&floatTemp;
|
||||
floatint_t fi;
|
||||
fi.f = x;
|
||||
return fi.i;
|
||||
}
|
||||
|
||||
int CL_UISystemCalls( int *args );
|
||||
intptr_t CL_UISystemCalls( intptr_t *args );
|
||||
|
||||
|
||||
int FloatAsInt( float f );
|
||||
|
||||
float trap_Cvar_VariableValue( const char *var_name )
|
||||
{
|
||||
int temp;
|
||||
// temp = qsyscall( UI_CVAR_VARIABLEVALUE, var_name );
|
||||
temp = FloatAsInt( Cvar_VariableValue(var_name) );
|
||||
return (*(float*)&temp);
|
||||
floatint_t fi;
|
||||
// fi.i = qsyscall( UI_CVAR_VARIABLEVALUE, var_name );
|
||||
fi.i = FloatAsInt( Cvar_VariableValue(var_name) );
|
||||
return fi.f;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -318,12 +318,12 @@ void *Sys_GetGameAPI (void *parms)
|
|||
return GetGameAPI (parms);
|
||||
}
|
||||
|
||||
void * Sys_LoadCgame( int (**entryPoint)(int, ...), int (*systemcalls)(int, ...) )
|
||||
void * Sys_LoadCgame( intptr_t (**entryPoint)(intptr_t, ...), intptr_t (*systemcalls)(intptr_t, ...) )
|
||||
{
|
||||
void (*dllEntry)( int (*syscallptr)(int, ...) );
|
||||
void (*dllEntry)( intptr_t (*syscallptr)(intptr_t, ...) );
|
||||
|
||||
dllEntry = ( void (*)( int (*)( int, ... ) ) )dlsym( game_library, "dllEntry" );
|
||||
*entryPoint = (int (*)(int,...))dlsym( game_library, "vmMain" );
|
||||
dllEntry = ( void (*)( intptr_t (*)( intptr_t, ... ) ) )dlsym( game_library, "dllEntry" );
|
||||
*entryPoint = (intptr_t (*)(intptr_t,...))dlsym( game_library, "vmMain" );
|
||||
if ( !*entryPoint || !dllEntry ) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ static const char *deflate_error = "OK";
|
|||
|
||||
// ===============================================================================
|
||||
// A word is an index in the character window. We use short instead of int to
|
||||
// save space in the various tables. ulong is used only for parameter passing.
|
||||
// save space in the various tables. uint32_t is used only for parameter passing.
|
||||
|
||||
// The static literal tree. Since the bit lengths are imposed, there is no
|
||||
// need for the L_CODES extra codes used during heap construction. However
|
||||
|
@ -229,19 +229,19 @@ static const config configuration_table[10] =
|
|||
};
|
||||
|
||||
// extra bits for each length code
|
||||
static ulong extra_lbits[LENGTH_CODES] =
|
||||
static uint32_t extra_lbits[LENGTH_CODES] =
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0
|
||||
};
|
||||
|
||||
// Extra bits for distance codes
|
||||
const ulong extra_dbits[D_CODES] =
|
||||
const uint32_t extra_dbits[D_CODES] =
|
||||
{
|
||||
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13
|
||||
};
|
||||
|
||||
// extra bits for each bit length code
|
||||
static ulong extra_blbits[BL_CODES] =
|
||||
static uint32_t extra_blbits[BL_CODES] =
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7
|
||||
};
|
||||
|
@ -290,7 +290,7 @@ inline void put_shortMSB(deflate_state *s, const word w)
|
|||
s->pending_buf[s->pending++] = (byte)(w & 0xff);
|
||||
}
|
||||
|
||||
inline void put_longMSB(deflate_state *s, const ulong l)
|
||||
inline void put_longMSB(deflate_state *s, const uint32_t l)
|
||||
{
|
||||
s->pending_buf[s->pending++] = (byte)(l >> 24);
|
||||
s->pending_buf[s->pending++] = (byte)(l >> 16);
|
||||
|
@ -303,7 +303,7 @@ inline void put_longMSB(deflate_state *s, const ulong l)
|
|||
// IN assertion: length <= 16 and value fits in length bits.
|
||||
// ===============================================================================
|
||||
|
||||
static void send_bits(deflate_state *s, const ulong val, const ulong len)
|
||||
static void send_bits(deflate_state *s, const uint32_t val, const uint32_t len)
|
||||
{
|
||||
assert(len <= 16);
|
||||
assert(val <= 65536);
|
||||
|
@ -379,7 +379,7 @@ static void tr_init(deflate_state *s)
|
|||
// the subtrees have equal frequency. This minimizes the worst case length.
|
||||
// ===============================================================================
|
||||
|
||||
static bool smaller(ct_data *tree, ulong son, ulong daughter, byte *depth)
|
||||
static bool smaller(ct_data *tree, uint32_t son, uint32_t daughter, byte *depth)
|
||||
{
|
||||
if(tree[son].fc.freq < tree[daughter].fc.freq)
|
||||
{
|
||||
|
@ -399,10 +399,10 @@ static bool smaller(ct_data *tree, ulong son, ulong daughter, byte *depth)
|
|||
// two sons).
|
||||
// ===============================================================================
|
||||
|
||||
static void pqdownheap(deflate_state *s, ct_data *tree, ulong node)
|
||||
static void pqdownheap(deflate_state *s, ct_data *tree, uint32_t node)
|
||||
{
|
||||
ulong base;
|
||||
ulong sibling; // left son of node
|
||||
uint32_t base;
|
||||
uint32_t sibling; // left son of node
|
||||
|
||||
base = s->heap[node];
|
||||
sibling = node << 1;
|
||||
|
@ -443,15 +443,15 @@ static void pqdownheap(deflate_state *s, ct_data *tree, ulong node)
|
|||
static void gen_bitlen(deflate_state *s, tree_desc *desc)
|
||||
{
|
||||
const ct_data *stree;
|
||||
const ulong *extra;
|
||||
ulong base;
|
||||
ulong max_length;
|
||||
ulong heapIdx; // heap index
|
||||
ulong n, m; // iterate over the tree elements
|
||||
ulong bits; // bit length
|
||||
ulong xbits; // extra bits
|
||||
const uint32_t *extra;
|
||||
uint32_t base;
|
||||
uint32_t max_length;
|
||||
uint32_t heapIdx; // heap index
|
||||
uint32_t n, m; // iterate over the tree elements
|
||||
uint32_t bits; // bit length
|
||||
uint32_t xbits; // extra bits
|
||||
word freq; // frequency
|
||||
ulong overflow; // number of elements with bit length too large
|
||||
uint32_t overflow; // number of elements with bit length too large
|
||||
|
||||
stree = desc->stat_desc->static_tree;
|
||||
extra = desc->stat_desc->extra_bits;
|
||||
|
@ -571,9 +571,9 @@ static void bi_windup(deflate_state *s)
|
|||
// method would use a table)
|
||||
// ===============================================================================
|
||||
|
||||
static ulong bi_reverse(ulong code, ulong len)
|
||||
static uint32_t bi_reverse(uint32_t code, uint32_t len)
|
||||
{
|
||||
ulong res;
|
||||
uint32_t res;
|
||||
|
||||
assert(1 <= len);
|
||||
assert(len <= 15);
|
||||
|
@ -597,13 +597,13 @@ static ulong bi_reverse(ulong code, ulong len)
|
|||
// OUT assertion: the field code is set for all tree elements of non zero code length.
|
||||
// ===============================================================================
|
||||
|
||||
static void gen_codes(ct_data *tree, ulong max_code, word *bl_count)
|
||||
static void gen_codes(ct_data *tree, uint32_t max_code, word *bl_count)
|
||||
{
|
||||
word next_code[MAX_WBITS + 1]; // next code value for each bit length
|
||||
word code; // running code value
|
||||
ulong bits; // bit index
|
||||
ulong codes; // code index
|
||||
ulong len;
|
||||
uint32_t bits; // bit index
|
||||
uint32_t codes; // code index
|
||||
uint32_t len;
|
||||
|
||||
// The distribution counts are first used to generate the code values
|
||||
// without bit reversal.
|
||||
|
@ -642,10 +642,10 @@ static void build_tree(deflate_state *s, tree_desc *desc)
|
|||
{
|
||||
ct_data *tree;
|
||||
const ct_data *stree;
|
||||
ulong elems;
|
||||
ulong n, m; // iterate over heap elements
|
||||
ulong max_code; // largest code with non zero frequency
|
||||
ulong node; // new node being created
|
||||
uint32_t elems;
|
||||
uint32_t n, m; // iterate over heap elements
|
||||
uint32_t max_code; // largest code with non zero frequency
|
||||
uint32_t node; // new node being created
|
||||
|
||||
tree = desc->dyn_tree;
|
||||
stree = desc->stat_desc->static_tree;
|
||||
|
@ -748,15 +748,15 @@ static void build_tree(deflate_state *s, tree_desc *desc)
|
|||
// in the bit length tree.
|
||||
// ===============================================================================
|
||||
|
||||
static void scan_tree (deflate_state *s, ct_data *tree, ulong max_code)
|
||||
static void scan_tree (deflate_state *s, ct_data *tree, uint32_t max_code)
|
||||
{
|
||||
ulong n; // iterates over all tree elements
|
||||
ulong prevlen; // last emitted length
|
||||
ulong curlen; // length of current code
|
||||
ulong nextlen; // length of next code
|
||||
ulong count; // repeat count of the current code
|
||||
ulong max_count; // max repeat count
|
||||
ulong min_count; // min repeat count
|
||||
uint32_t n; // iterates over all tree elements
|
||||
uint32_t prevlen; // last emitted length
|
||||
uint32_t curlen; // length of current code
|
||||
uint32_t nextlen; // length of next code
|
||||
uint32_t count; // repeat count of the current code
|
||||
uint32_t max_count; // max repeat count
|
||||
uint32_t min_count; // min repeat count
|
||||
|
||||
prevlen = 0xffff;
|
||||
nextlen = tree[0].dl.len;
|
||||
|
@ -824,15 +824,15 @@ static void scan_tree (deflate_state *s, ct_data *tree, ulong max_code)
|
|||
// Send a literal or distance tree in compressed form, using the codes in bl_tree.
|
||||
// ===============================================================================
|
||||
|
||||
static void send_tree(deflate_state *s, ct_data *tree, ulong max_code)
|
||||
static void send_tree(deflate_state *s, ct_data *tree, uint32_t max_code)
|
||||
{
|
||||
ulong n; // iterates over all tree elements
|
||||
ulong prevlen; // last emitted length
|
||||
ulong curlen; // length of current code
|
||||
ulong nextlen; // length of next code
|
||||
ulong count; // repeat count of the current code
|
||||
ulong max_count; // max repeat count
|
||||
ulong min_count; // min repeat count
|
||||
uint32_t n; // iterates over all tree elements
|
||||
uint32_t prevlen; // last emitted length
|
||||
uint32_t curlen; // length of current code
|
||||
uint32_t nextlen; // length of next code
|
||||
uint32_t count; // repeat count of the current code
|
||||
uint32_t max_count; // max repeat count
|
||||
uint32_t min_count; // min repeat count
|
||||
|
||||
prevlen = 0xffff;
|
||||
nextlen = tree[0].dl.len;
|
||||
|
@ -910,9 +910,9 @@ static void send_tree(deflate_state *s, ct_data *tree, ulong max_code)
|
|||
// bl_order of the last bit length code to send.
|
||||
// ===============================================================================
|
||||
|
||||
static ulong build_bl_tree(deflate_state *s)
|
||||
static uint32_t build_bl_tree(deflate_state *s)
|
||||
{
|
||||
ulong max_blindex; // index of last bit length code of non zero freq
|
||||
uint32_t max_blindex; // index of last bit length code of non zero freq
|
||||
|
||||
// Determine the bit length frequencies for literal and distance trees
|
||||
scan_tree(s, s->dyn_ltree, s->l_desc.max_code);
|
||||
|
@ -944,9 +944,9 @@ static ulong build_bl_tree(deflate_state *s)
|
|||
// IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
|
||||
// ===========================================================================
|
||||
|
||||
static void send_all_trees(deflate_state *s, ulong lcodes, ulong dcodes, ulong blcodes)
|
||||
static void send_all_trees(deflate_state *s, uint32_t lcodes, uint32_t dcodes, uint32_t blcodes)
|
||||
{
|
||||
ulong rank; // index in bl_order
|
||||
uint32_t rank; // index in bl_order
|
||||
|
||||
// not +255 as stated in appnote.txt
|
||||
send_bits(s, lcodes - 257, 5);
|
||||
|
@ -971,11 +971,11 @@ static void send_all_trees(deflate_state *s, ulong lcodes, ulong dcodes, ulong b
|
|||
|
||||
static void compress_block(deflate_state *s, const ct_data *ltree, const ct_data *dtree)
|
||||
{
|
||||
ulong dist; // distance of matched string
|
||||
ulong lenCount; // match length or unmatched char (if dist == 0)
|
||||
ulong lenIdx; // running index in l_buf
|
||||
ulong code; // the code to send
|
||||
ulong extra; // number of extra bits to send
|
||||
uint32_t dist; // distance of matched string
|
||||
uint32_t lenCount; // match length or unmatched char (if dist == 0)
|
||||
uint32_t lenIdx; // running index in l_buf
|
||||
uint32_t code; // the code to send
|
||||
uint32_t extra; // number of extra bits to send
|
||||
|
||||
lenIdx = 0;
|
||||
if(s->last_lit)
|
||||
|
@ -1028,10 +1028,10 @@ static void compress_block(deflate_state *s, const ct_data *ltree, const ct_data
|
|||
// Send a stored block
|
||||
// ===========================================================================
|
||||
|
||||
static void tr_stored_block(deflate_state *s, const byte *buf, ulong stored_len, bool eof)
|
||||
static void tr_stored_block(deflate_state *s, const byte *buf, uint32_t stored_len, bool eof)
|
||||
{
|
||||
// send block type
|
||||
send_bits(s, (STORED_BLOCK << 1) + (ulong)eof, 3);
|
||||
send_bits(s, (STORED_BLOCK << 1) + (uint32_t)eof, 3);
|
||||
|
||||
// align on byte boundary
|
||||
bi_windup(s);
|
||||
|
@ -1052,11 +1052,11 @@ static void tr_stored_block(deflate_state *s, const byte *buf, ulong stored_len,
|
|||
// trees or store, and output the encoded block to the zip file.
|
||||
// ===========================================================================
|
||||
|
||||
static void tr_flush_block(deflate_state *s, const byte *buf, ulong stored_len, bool eof)
|
||||
static void tr_flush_block(deflate_state *s, const byte *buf, uint32_t stored_len, bool eof)
|
||||
{
|
||||
ulong opt_lenb;
|
||||
ulong static_lenb;
|
||||
ulong max_blindex; // index of last bit length code of non zero freq
|
||||
uint32_t opt_lenb;
|
||||
uint32_t static_lenb;
|
||||
uint32_t max_blindex; // index of last bit length code of non zero freq
|
||||
|
||||
max_blindex = 0;
|
||||
|
||||
|
@ -1102,12 +1102,12 @@ static void tr_flush_block(deflate_state *s, const byte *buf, ulong stored_len,
|
|||
}
|
||||
else if(static_lenb == opt_lenb)
|
||||
{
|
||||
send_bits(s, (STATIC_TREES << 1) + (ulong)eof, 3);
|
||||
send_bits(s, (STATIC_TREES << 1) + (uint32_t)eof, 3);
|
||||
compress_block(s, static_ltree, static_dtree);
|
||||
}
|
||||
else
|
||||
{
|
||||
send_bits(s, (DYN_TREES << 1) + (ulong)eof, 3);
|
||||
send_bits(s, (DYN_TREES << 1) + (uint32_t)eof, 3);
|
||||
send_all_trees(s, s->l_desc.max_code + 1, s->d_desc.max_code + 1, max_blindex + 1);
|
||||
compress_block(s, s->dyn_ltree, s->dyn_dtree);
|
||||
}
|
||||
|
@ -1137,7 +1137,7 @@ inline bool tr_tally_lit(deflate_state *s, byte c)
|
|||
// ===============================================================================
|
||||
// ===============================================================================
|
||||
|
||||
inline bool tr_tally_dist(deflate_state *s, ulong dist, ulong len)
|
||||
inline bool tr_tally_dist(deflate_state *s, uint32_t dist, uint32_t len)
|
||||
{
|
||||
assert(dist < 65536);
|
||||
assert(len < 256);
|
||||
|
@ -1165,7 +1165,7 @@ inline bool tr_tally_dist(deflate_state *s, ulong dist, ulong len)
|
|||
// (except for the last MIN_MATCH-1 bytes of the input file).
|
||||
// ===============================================================================
|
||||
|
||||
inline void insert_string(deflate_state *s, ulong str, ulong &match_head)
|
||||
inline void insert_string(deflate_state *s, uint32_t str, uint32_t &match_head)
|
||||
{
|
||||
s->ins_h = ((s->ins_h << HASH_SHIFT) ^ s->window[str + (MIN_MATCH - 1)]) & HASH_MASK;
|
||||
match_head = s->head[s->ins_h];
|
||||
|
@ -1207,7 +1207,7 @@ static void lm_init(deflate_state *s)
|
|||
// OUT assertion: the match length is not greater than s->lookahead.
|
||||
// ===========================================================================
|
||||
|
||||
inline byte *qcmp(byte *scan, byte *match, ulong count)
|
||||
inline byte *qcmp(byte *scan, byte *match, uint32_t count)
|
||||
{
|
||||
byte *retval;
|
||||
#ifdef _MSC_VER
|
||||
|
@ -1236,15 +1236,15 @@ inline byte *qcmp(byte *scan, byte *match, ulong count)
|
|||
return(--retval);
|
||||
}
|
||||
|
||||
static ulong longest_match(deflate_state *s, ulong cur_match)
|
||||
static uint32_t longest_match(deflate_state *s, uint32_t cur_match)
|
||||
{
|
||||
ulong chain_length; // max hash chain length
|
||||
ulong limit;
|
||||
uint32_t chain_length; // max hash chain length
|
||||
uint32_t limit;
|
||||
byte *scan; // current string
|
||||
byte *match; // matched string
|
||||
ulong len; // length of current match
|
||||
ulong best_len; // best match length so far
|
||||
ulong nice_match; // stop if match long enough
|
||||
uint32_t len; // length of current match
|
||||
uint32_t best_len; // best match length so far
|
||||
uint32_t nice_match; // stop if match long enough
|
||||
byte scan_end1;
|
||||
byte scan_end;
|
||||
|
||||
|
@ -1321,7 +1321,7 @@ static ulong longest_match(deflate_state *s, ulong cur_match)
|
|||
|
||||
static void flush_pending(z_stream *z)
|
||||
{
|
||||
ulong len = z->dstate->pending;
|
||||
uint32_t len = z->dstate->pending;
|
||||
|
||||
if(len > z->avail_out)
|
||||
{
|
||||
|
@ -1354,9 +1354,9 @@ static void flush_pending(z_stream *z)
|
|||
// (See also flush_pending()).
|
||||
// ===========================================================================
|
||||
|
||||
static ulong read_buf(z_stream *z, byte *buf, ulong size)
|
||||
static uint32_t read_buf(z_stream *z, byte *buf, uint32_t size)
|
||||
{
|
||||
ulong len;
|
||||
uint32_t len;
|
||||
|
||||
len = z->avail_in;
|
||||
if(len > size)
|
||||
|
@ -1391,9 +1391,9 @@ static ulong read_buf(z_stream *z, byte *buf, ulong size)
|
|||
|
||||
static void fill_window(deflate_state *s)
|
||||
{
|
||||
ulong n, m;
|
||||
uint32_t n, m;
|
||||
word *p;
|
||||
ulong more; // Amount of free space at the end of the window.
|
||||
uint32_t more; // Amount of free space at the end of the window.
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -1492,7 +1492,7 @@ static block_state deflate_stored(deflate_state *s, EFlush flush)
|
|||
{
|
||||
// Stored blocks are limited to 0xffff bytes, pending_buf is limited
|
||||
// to pending_buf_size, and each stored block has a 5 byte header:
|
||||
ulong max_start;
|
||||
uint32_t max_start;
|
||||
|
||||
// Copy as much as possible from input to output:
|
||||
while(true)
|
||||
|
@ -1555,7 +1555,7 @@ static block_state deflate_stored(deflate_state *s, EFlush flush)
|
|||
|
||||
static block_state deflate_fast(deflate_state *s, EFlush flush)
|
||||
{
|
||||
ulong hash_head; // head of the hash chain
|
||||
uint32_t hash_head; // head of the hash chain
|
||||
bool bflush; // set if current block must be flushed
|
||||
|
||||
hash_head = 0;
|
||||
|
@ -1662,8 +1662,8 @@ static block_state deflate_fast(deflate_state *s, EFlush flush)
|
|||
|
||||
static block_state deflate_slow(deflate_state *s, EFlush flush)
|
||||
{
|
||||
ulong hash_head; // head of hash chain
|
||||
ulong max_insert;
|
||||
uint32_t hash_head; // head of hash chain
|
||||
uint32_t max_insert;
|
||||
bool bflush; // set if current block must be flushed
|
||||
|
||||
hash_head = 0;
|
||||
|
@ -1870,8 +1870,8 @@ EStatus deflate(z_stream *z, EFlush flush)
|
|||
{
|
||||
EFlush old_flush; // value of flush param for previous deflate call
|
||||
deflate_state *s;
|
||||
ulong header;
|
||||
ulong level_flags;
|
||||
uint32_t header;
|
||||
uint32_t level_flags;
|
||||
|
||||
assert(z);
|
||||
assert(z->dstate);
|
||||
|
@ -2049,7 +2049,7 @@ const char *deflateError(void)
|
|||
// External calls
|
||||
// ===============================================================================
|
||||
|
||||
bool DeflateFile(byte *src, ulong uncompressedSize, byte *dst, ulong maxCompressedSize, ulong *compressedSize, ELevel level, int noWrap)
|
||||
bool DeflateFile(byte *src, uint32_t uncompressedSize, byte *dst, uint32_t maxCompressedSize, uint32_t *compressedSize, ELevel level, int noWrap)
|
||||
{
|
||||
z_stream z = { 0 };
|
||||
|
||||
|
|
|
@ -106,16 +106,16 @@ typedef struct ct_data_s
|
|||
typedef struct static_tree_desc_s
|
||||
{
|
||||
const ct_data *static_tree; // static tree or NULL
|
||||
const ulong *extra_bits; // extra bits for each code or NULL
|
||||
ulong extra_base; // base index for extra_bits
|
||||
ulong elems; // max number of elements in the tree
|
||||
ulong max_length; // max bit length for the codes
|
||||
const uint32_t *extra_bits; // extra bits for each code or NULL
|
||||
uint32_t extra_base; // base index for extra_bits
|
||||
uint32_t elems; // max number of elements in the tree
|
||||
uint32_t max_length; // max bit length for the codes
|
||||
} static_tree_desc;
|
||||
|
||||
typedef struct tree_desc_s
|
||||
{
|
||||
ct_data *dyn_tree; // the dynamic tree
|
||||
ulong max_code; // largest code with non zero frequency
|
||||
uint32_t max_code; // largest code with non zero frequency
|
||||
static_tree_desc *stat_desc; // the corresponding static tree
|
||||
} tree_desc;
|
||||
|
||||
|
@ -123,14 +123,14 @@ typedef struct tree_desc_s
|
|||
typedef struct deflate_state_s
|
||||
{
|
||||
z_stream *z; // pointer back to this zlib stream
|
||||
ulong status; // as the name implies
|
||||
uint32_t status; // as the name implies
|
||||
|
||||
EFlush last_flush; // value of flush param for previous deflate call
|
||||
int noheader; // suppress zlib header and adler32
|
||||
|
||||
byte pending_buf[MAX_BLOCK_SIZE + 5];// output still pending
|
||||
byte *pending_out; // next pending byte to output to the stream
|
||||
ulong pending; // nb of bytes in the pending buffer
|
||||
uint32_t pending; // nb of bytes in the pending buffer
|
||||
|
||||
// Sliding window. Input bytes are read into the second half of the window,
|
||||
// and move to the first half later to keep a dictionary of at least wSize
|
||||
|
@ -148,33 +148,33 @@ typedef struct deflate_state_s
|
|||
|
||||
word head[HASH_SIZE]; // Heads of the hash chains or NULL.
|
||||
|
||||
ulong ins_h; // hash index of string to be inserted
|
||||
uint32_t ins_h; // hash index of string to be inserted
|
||||
|
||||
// Window position at the beginning of the current output block. Gets
|
||||
// negative when the window is moved backwards.
|
||||
int block_start;
|
||||
|
||||
ulong match_length; // length of best match
|
||||
ulong prev_match; // previous match
|
||||
ulong match_available; // set if previous match exists
|
||||
ulong strstart; // start of string to insert
|
||||
ulong match_start; // start of matching string
|
||||
ulong lookahead; // number of valid bytes ahead in window
|
||||
uint32_t match_length; // length of best match
|
||||
uint32_t prev_match; // previous match
|
||||
uint32_t match_available; // set if previous match exists
|
||||
uint32_t strstart; // start of string to insert
|
||||
uint32_t match_start; // start of matching string
|
||||
uint32_t lookahead; // number of valid bytes ahead in window
|
||||
|
||||
// Length of the best match at previous step. Matches not greater than this
|
||||
// are discarded. This is used in the lazy match evaluation.
|
||||
ulong prev_length;
|
||||
uint32_t prev_length;
|
||||
|
||||
// Attempt to find a better match only when the current match is strictly
|
||||
// smaller than this value. This mechanism is used only for compression levels >= 4.
|
||||
ulong max_lazy_match;
|
||||
uint32_t max_lazy_match;
|
||||
|
||||
ulong good_match; // Use a faster search when the previous match is longer than this
|
||||
ulong nice_match; // Stop searching when current match exceeds this
|
||||
uint32_t good_match; // Use a faster search when the previous match is longer than this
|
||||
uint32_t nice_match; // Stop searching when current match exceeds this
|
||||
|
||||
// To speed up deflation, hash chains are never searched beyond this
|
||||
// length. A higher limit improves compression ratio but degrades the speed.
|
||||
ulong max_chain_length;
|
||||
uint32_t max_chain_length;
|
||||
|
||||
ELevel level; // compression level (0..9)
|
||||
|
||||
|
@ -190,30 +190,30 @@ typedef struct deflate_state_s
|
|||
|
||||
// The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
|
||||
// The same heap array is used to build all trees.
|
||||
ulong heap[(2 * L_CODES) + 1]; // heap used to build the Huffman trees
|
||||
ulong heap_len; // number of elements in the heap
|
||||
ulong heap_max; // element of largest frequency
|
||||
uint32_t heap[(2 * L_CODES) + 1]; // heap used to build the Huffman trees
|
||||
uint32_t heap_len; // number of elements in the heap
|
||||
uint32_t heap_max; // element of largest frequency
|
||||
|
||||
byte depth[(2 * L_CODES) + 1]; // Depth of each subtree used as tie breaker for trees of equal frequency
|
||||
|
||||
byte l_buf[LIT_BUFSIZE]; // buffer for literals or lengths
|
||||
|
||||
ulong last_lit; // running index in l_buf
|
||||
uint32_t last_lit; // running index in l_buf
|
||||
|
||||
// Buffer for distances. To simplify the code, d_buf and l_buf have
|
||||
// the same number of elements. To use different lengths, an extra flag
|
||||
// array would be necessary.
|
||||
word d_buf[LIT_BUFSIZE];
|
||||
|
||||
ulong opt_len; // bit length of current block with optimal trees
|
||||
ulong static_len; // bit length of current block with static trees
|
||||
ulong matches; // number of string matches in current block
|
||||
ulong last_eob_len; // bit length of EOB code for last block
|
||||
uint32_t opt_len; // bit length of current block with optimal trees
|
||||
uint32_t static_len; // bit length of current block with static trees
|
||||
uint32_t matches; // number of string matches in current block
|
||||
uint32_t last_eob_len; // bit length of EOB code for last block
|
||||
|
||||
word bi_buf; // Output buffer. bits are inserted starting at the bottom (least significant bits).
|
||||
ulong bi_valid; // Number of valid bits in bi_buf. All bits above the last valid bit are always zero.
|
||||
uint32_t bi_valid; // Number of valid bits in bi_buf. All bits above the last valid bit are always zero.
|
||||
|
||||
ulong adler;
|
||||
uint32_t adler;
|
||||
} deflate_state;
|
||||
|
||||
// Compression function. Returns the block state after the call.
|
||||
|
@ -228,4 +228,4 @@ typedef struct config_s
|
|||
compress_func func;
|
||||
} config;
|
||||
|
||||
// end
|
||||
// end
|
||||
|
|
|
@ -142,7 +142,7 @@ static const char *inflate_error = "OK";
|
|||
// the two sets of lengths.
|
||||
|
||||
// And'ing with mask[n] masks the lower n bits
|
||||
static const ulong inflate_mask[17] =
|
||||
static const uint32_t inflate_mask[17] =
|
||||
{
|
||||
0x0000,
|
||||
0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
|
||||
|
@ -150,35 +150,35 @@ static const ulong inflate_mask[17] =
|
|||
};
|
||||
|
||||
// Order of the bit length code lengths
|
||||
static const ulong border[] =
|
||||
static const uint32_t border[] =
|
||||
{
|
||||
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
|
||||
};
|
||||
|
||||
// Copy lengths for literal codes 257..285 (see note #13 above about 258)
|
||||
static const ulong cplens[31] =
|
||||
static const uint32_t cplens[31] =
|
||||
{
|
||||
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
|
||||
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
|
||||
};
|
||||
|
||||
// Extra bits for literal codes 257..285 (112 == invalid)
|
||||
static const ulong cplext[31] =
|
||||
static const uint32_t cplext[31] =
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
|
||||
3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112
|
||||
};
|
||||
|
||||
// Copy offsets for distance codes 0..29
|
||||
static const ulong cpdist[30] =
|
||||
static const uint32_t cpdist[30] =
|
||||
{
|
||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
||||
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
||||
8193, 12289, 16385, 24577
|
||||
};
|
||||
|
||||
static ulong fixed_bl = 9;
|
||||
static ulong fixed_bd = 5;
|
||||
static uint32_t fixed_bl = 9;
|
||||
static uint32_t fixed_bd = 5;
|
||||
|
||||
static inflate_huft_t fixed_tl[] =
|
||||
{
|
||||
|
@ -377,7 +377,7 @@ static inflate_blocks_state_t *inflate_blocks_new(z_stream *z, check_func check)
|
|||
// copy as much as possible from the sliding window to the output area
|
||||
// ===============================================================================
|
||||
|
||||
static void inflate_flush_copy(z_stream *z, inflate_blocks_state_t *s, ulong count)
|
||||
static void inflate_flush_copy(z_stream *z, inflate_blocks_state_t *s, uint32_t count)
|
||||
{
|
||||
if(count > z->avail_out)
|
||||
{
|
||||
|
@ -409,7 +409,7 @@ static void inflate_flush_copy(z_stream *z, inflate_blocks_state_t *s, ulong cou
|
|||
|
||||
static void inflate_flush(z_stream *z, inflate_blocks_state_t *s)
|
||||
{
|
||||
ulong count;
|
||||
uint32_t count;
|
||||
|
||||
// compute number of bytes to copy as as end of window
|
||||
count = (s->read <= s->write ? s->write : s->end) - s->read;
|
||||
|
@ -435,7 +435,7 @@ static void inflate_flush(z_stream *z, inflate_blocks_state_t *s)
|
|||
// get bytes and bits
|
||||
// ===============================================================================
|
||||
|
||||
static bool getbits(z_stream *z, inflate_blocks_state_t *s, ulong bits)
|
||||
static bool getbits(z_stream *z, inflate_blocks_state_t *s, uint32_t bits)
|
||||
{
|
||||
while(s->bitk < bits)
|
||||
{
|
||||
|
@ -460,7 +460,7 @@ static bool getbits(z_stream *z, inflate_blocks_state_t *s, ulong bits)
|
|||
// output bytes
|
||||
// ===============================================================================
|
||||
|
||||
static ulong needout(z_stream *z, inflate_blocks_state_t *s, ulong bytesToEnd)
|
||||
static uint32_t needout(z_stream *z, inflate_blocks_state_t *s, uint32_t bytesToEnd)
|
||||
{
|
||||
if(!bytesToEnd)
|
||||
{
|
||||
|
@ -525,7 +525,7 @@ inline byte *qcopy(byte *dst, byte *src, int count)
|
|||
return(retval);
|
||||
}
|
||||
|
||||
inline ulong get_remaining(inflate_blocks_state_t *s)
|
||||
inline uint32_t get_remaining(inflate_blocks_state_t *s)
|
||||
{
|
||||
if(s->write < s->read)
|
||||
{
|
||||
|
@ -534,21 +534,21 @@ inline ulong get_remaining(inflate_blocks_state_t *s)
|
|||
return(s->end - s->write);
|
||||
}
|
||||
|
||||
static EStatus inflate_fast(ulong lengthMask, ulong distMask, inflate_huft_t *lengthTree, inflate_huft_t *distTree, inflate_blocks_state_t *s, z_stream *z)
|
||||
static EStatus inflate_fast(uint32_t lengthMask, uint32_t distMask, inflate_huft_t *lengthTree, inflate_huft_t *distTree, inflate_blocks_state_t *s, z_stream *z)
|
||||
{
|
||||
inflate_huft_t *huft; // temporary pointer
|
||||
byte *data;
|
||||
byte *src; // copy source pointer
|
||||
byte *dst;
|
||||
ulong extraBits; // extra bits or operation
|
||||
ulong bytesToEnd; // bytes to end of window or read pointer
|
||||
ulong count; // bytes to copy
|
||||
ulong dist; // distance back to copy from
|
||||
ulong bitb;
|
||||
ulong bitk;
|
||||
ulong availin;
|
||||
ulong morebits;
|
||||
ulong copymore;
|
||||
uint32_t extraBits; // extra bits or operation
|
||||
uint32_t bytesToEnd; // bytes to end of window or read pointer
|
||||
uint32_t count; // bytes to copy
|
||||
uint32_t dist; // distance back to copy from
|
||||
uint32_t bitb;
|
||||
uint32_t bitk;
|
||||
uint32_t availin;
|
||||
uint32_t morebits;
|
||||
uint32_t copymore;
|
||||
|
||||
// load input, output, bit values
|
||||
data = z->next_in;
|
||||
|
@ -737,8 +737,8 @@ static EStatus inflate_fast(ulong lengthMask, ulong distMask, inflate_huft_t *le
|
|||
static void inflate_codes(z_stream *z, inflate_blocks_state_t *s)
|
||||
{
|
||||
inflate_huft_t *huft; // temporary pointer
|
||||
ulong extraBits; // extra bits or operation
|
||||
ulong bytesToEnd; // bytes to end of window or read pointer
|
||||
uint32_t extraBits; // extra bits or operation
|
||||
uint32_t bytesToEnd; // bytes to end of window or read pointer
|
||||
byte *src; // pointer to copy strings from
|
||||
inflate_codes_state_t *infCodes; // codes state
|
||||
|
||||
|
@ -948,7 +948,7 @@ static void inflate_codes(z_stream *z, inflate_blocks_state_t *s)
|
|||
// ===============================================================================
|
||||
// ===============================================================================
|
||||
|
||||
static inflate_codes_state_t *inflate_codes_new(z_stream *z, ulong bl, ulong bd, inflate_huft_t *lengthTree, inflate_huft_t *distTree)
|
||||
static inflate_codes_state_t *inflate_codes_new(z_stream *z, uint32_t bl, uint32_t bd, inflate_huft_t *lengthTree, inflate_huft_t *distTree)
|
||||
{
|
||||
inflate_codes_state_t *c;
|
||||
|
||||
|
@ -965,16 +965,16 @@ static inflate_codes_state_t *inflate_codes_new(z_stream *z, ulong bl, ulong bd,
|
|||
// ===============================================================================
|
||||
// Generate Huffman trees for efficient decoding
|
||||
|
||||
// ulong b // code lengths in bits (all assumed <= BMAX)
|
||||
// ulong n // number of codes (assumed <= 288)
|
||||
// ulong s // number of simple-valued codes (0..s-1)
|
||||
// const ulong *d // list of base values for non-simple codes
|
||||
// const ulong *e // list of extra bits for non-simple codes
|
||||
// uint32_t b // code lengths in bits (all assumed <= BMAX)
|
||||
// uint32_t n // number of codes (assumed <= 288)
|
||||
// uint32_t s // number of simple-valued codes (0..s-1)
|
||||
// const uint32_t *d // list of base values for non-simple codes
|
||||
// const uint32_t *e // list of extra bits for non-simple codes
|
||||
// inflate_huft ** t // result: starting table
|
||||
// ulong *m // maximum lookup bits, returns actual
|
||||
// uint32_t *m // maximum lookup bits, returns actual
|
||||
// inflate_huft *hp // space for trees
|
||||
// ulong *hn // hufts used in space
|
||||
// ulong *workspace // working area: values in order of bit length
|
||||
// uint32_t *hn // hufts used in space
|
||||
// uint32_t *workspace // working area: values in order of bit length
|
||||
//
|
||||
// Given a list of code lengths and a maximum table size, make a set of
|
||||
// tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR
|
||||
|
@ -1013,26 +1013,26 @@ static inflate_codes_state_t *inflate_codes_new(z_stream *z, ulong bl, ulong bd,
|
|||
// possibly even between compilers. Your mileage may vary.
|
||||
// ===============================================================================
|
||||
|
||||
static EStatus huft_build(ulong *b, ulong numCodes, ulong s, const ulong *d, const ulong *e, inflate_huft_t **t, ulong *m, inflate_huft_t *hp, ulong *hn, ulong *workspace)
|
||||
static EStatus huft_build(uint32_t *b, uint32_t numCodes, uint32_t s, const uint32_t *d, const uint32_t *e, inflate_huft_t **t, uint32_t *m, inflate_huft_t *hp, uint32_t *hn, uint32_t *workspace)
|
||||
{
|
||||
ulong codeCounter; // counter for codes of length bitsPerCode
|
||||
ulong bitLengths[BMAX + 1] = { 0 }; // bit length count table
|
||||
ulong bitOffsets[BMAX + 1]; // bit offsets, then code stack
|
||||
ulong f; // i repeats in table every f entries
|
||||
uint32_t codeCounter; // counter for codes of length bitsPerCode
|
||||
uint32_t bitLengths[BMAX + 1] = { 0 }; // bit length count table
|
||||
uint32_t bitOffsets[BMAX + 1]; // bit offsets, then code stack
|
||||
uint32_t f; // i repeats in table every f entries
|
||||
int maxCodeLen; // maximum code length
|
||||
int tableLevel; // table level
|
||||
ulong i; // counter, current code
|
||||
ulong j; // counter
|
||||
uint32_t i; // counter, current code
|
||||
uint32_t j; // counter
|
||||
int bitsPerCode; // number of bits in current code
|
||||
ulong bitsPerTable; // bits per table (returned in m)
|
||||
uint32_t bitsPerTable; // bits per table (returned in m)
|
||||
int bitsBeforeTable; // bits before this table == (bitsPerTable * tableLevel)
|
||||
ulong *p; // pointer into bitLengths[], b[], or workspace[]
|
||||
uint32_t *p; // pointer into bitLengths[], b[], or workspace[]
|
||||
inflate_huft_t *q; // points to current table
|
||||
inflate_huft_t r; // table entry for structure assignment
|
||||
inflate_huft_t *tableStack[BMAX]; // table stack
|
||||
ulong *xp; // pointer into bitOffsets
|
||||
uint32_t *xp; // pointer into bitOffsets
|
||||
int dummyCodes; // number of dummy codes added
|
||||
ulong entryCount; // number of entries in current table
|
||||
uint32_t entryCount; // number of entries in current table
|
||||
|
||||
// Generate counts for each bit length
|
||||
// assume all entries <= BMAX
|
||||
|
@ -1248,16 +1248,16 @@ static EStatus huft_build(ulong *b, ulong numCodes, ulong s, const ulong *d, con
|
|||
}
|
||||
|
||||
// ===============================================================================
|
||||
// ulong *c 19 code lengths
|
||||
// ulong *bb bits tree desired/actual depth
|
||||
// uint32_t *c 19 code lengths
|
||||
// uint32_t *bb bits tree desired/actual depth
|
||||
// inflate_huft **tb bits tree result
|
||||
// inflate_huft *hp space for trees
|
||||
// ===============================================================================
|
||||
|
||||
static void inflate_trees_bits(z_stream *z, ulong *c, ulong *bb, inflate_huft_t **tb, inflate_huft_t *hp)
|
||||
static void inflate_trees_bits(z_stream *z, uint32_t *c, uint32_t *bb, inflate_huft_t **tb, inflate_huft_t *hp)
|
||||
{
|
||||
ulong hn = 0; // hufts used in space
|
||||
ulong workspace[19]; // work area for huft_build
|
||||
uint32_t hn = 0; // hufts used in space
|
||||
uint32_t workspace[19]; // work area for huft_build
|
||||
|
||||
z->error = huft_build(c, 19, 19, NULL, NULL, tb, bb, hp, &hn, workspace);
|
||||
if(z->error == Z_DATA_ERROR)
|
||||
|
@ -1272,18 +1272,18 @@ static void inflate_trees_bits(z_stream *z, ulong *c, ulong *bb, inflate_huft_t
|
|||
}
|
||||
|
||||
// ===============================================================================
|
||||
// ulong *c // that many (total) code lengths
|
||||
// ulong *bl // literal desired/actual bit depth
|
||||
// ulong *bd // distance desired/actual bit depth
|
||||
// uint32_t *c // that many (total) code lengths
|
||||
// uint32_t *bl // literal desired/actual bit depth
|
||||
// uint32_t *bd // distance desired/actual bit depth
|
||||
// inflate_huft **tl // literal/length tree result
|
||||
// inflate_huft **td // distance tree result
|
||||
// inflate_huft *hp // space for trees
|
||||
// ===============================================================================
|
||||
|
||||
static void inflate_trees_dynamic(z_stream *z, ulong numLiteral, ulong numDist, ulong *c, ulong *bl, ulong *bd, inflate_huft_t **tl, inflate_huft_t **td, inflate_huft_t *hp)
|
||||
static void inflate_trees_dynamic(z_stream *z, uint32_t numLiteral, uint32_t numDist, uint32_t *c, uint32_t *bl, uint32_t *bd, inflate_huft_t **tl, inflate_huft_t **td, inflate_huft_t *hp)
|
||||
{
|
||||
ulong hn = 0; // hufts used in space
|
||||
ulong workspace[288]; // work area for huft_build
|
||||
uint32_t hn = 0; // hufts used in space
|
||||
uint32_t workspace[288]; // work area for huft_build
|
||||
|
||||
// build literal/length tree
|
||||
z->error = huft_build(c, numLiteral, 257, cplens, cplext, tl, bl, hp, &hn, workspace);
|
||||
|
@ -1304,15 +1304,15 @@ static void inflate_trees_dynamic(z_stream *z, ulong numLiteral, ulong numDist,
|
|||
}
|
||||
|
||||
// ===============================================================================
|
||||
// ulong *bl // literal desired/actual bit depth
|
||||
// ulong *bd // distance desired/actual bit depth
|
||||
// uint32_t *bl // literal desired/actual bit depth
|
||||
// uint32_t *bd // distance desired/actual bit depth
|
||||
// inflate_huft **tl // literal/length tree result
|
||||
// inflate_huft **td // distance tree result
|
||||
// ===============================================================================
|
||||
|
||||
// Fixme: Calculate dynamically
|
||||
|
||||
static void inflate_trees_fixed(z_stream *z, ulong *bl, ulong *bd, inflate_huft_t **tl, inflate_huft_t **td)
|
||||
static void inflate_trees_fixed(z_stream *z, uint32_t *bl, uint32_t *bd, inflate_huft_t **tl, inflate_huft_t **td)
|
||||
{
|
||||
*bl = fixed_bl;
|
||||
*bd = fixed_bd;
|
||||
|
@ -1326,9 +1326,9 @@ static void inflate_trees_fixed(z_stream *z, ulong *bl, ulong *bd, inflate_huft_
|
|||
|
||||
static void inflate_blocks(inflate_blocks_state_t *s, z_stream *z)
|
||||
{
|
||||
ulong t; // temporary storage
|
||||
ulong bytesToEnd; // bytes to end of window or read pointer
|
||||
ulong bl, bd;
|
||||
uint32_t t; // temporary storage
|
||||
uint32_t bytesToEnd; // bytes to end of window or read pointer
|
||||
uint32_t bl, bd;
|
||||
inflate_huft_t *lengthTree = NULL;
|
||||
inflate_huft_t *distTree = NULL;
|
||||
inflate_codes_state_t *c;
|
||||
|
@ -1448,7 +1448,7 @@ static void inflate_blocks(inflate_blocks_state_t *s, z_stream *z)
|
|||
return;
|
||||
}
|
||||
t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f);
|
||||
s->trees.blens = (ulong *)Z_Malloc(t * sizeof(ulong), TAG_INFLATE, qfalse);
|
||||
s->trees.blens = (uint32_t *)Z_Malloc(t * sizeof(uint32_t), TAG_INFLATE, qfalse);
|
||||
s->bitb >>= 14;
|
||||
s->bitk -= 14;
|
||||
s->trees.index = 0;
|
||||
|
@ -1483,7 +1483,7 @@ static void inflate_blocks(inflate_blocks_state_t *s, z_stream *z)
|
|||
while(t = s->trees.table, s->trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f))
|
||||
{
|
||||
inflate_huft_t *h;
|
||||
ulong i, j, c;
|
||||
uint32_t i, j, c;
|
||||
|
||||
t = s->trees.bb;
|
||||
if(!getbits(z, s, t))
|
||||
|
@ -1648,7 +1648,7 @@ EStatus inflateInit(z_stream *z, EFlush flush, int noWrap)
|
|||
|
||||
EStatus inflate(z_stream *z)
|
||||
{
|
||||
ulong b;
|
||||
uint32_t b;
|
||||
|
||||
// Sanity check data
|
||||
assert(z);
|
||||
|
@ -1790,7 +1790,7 @@ const char *inflateError(void)
|
|||
// External calls
|
||||
// ===============================================================================
|
||||
|
||||
bool InflateFile(byte *src, ulong compressedSize, byte *dst, ulong uncompressedSize, int noWrap)
|
||||
bool InflateFile(byte *src, uint32_t compressedSize, byte *dst, uint32_t uncompressedSize, int noWrap)
|
||||
{
|
||||
z_stream z = { 0 };
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
#define MANY 1440
|
||||
|
||||
// maximum bit length of any code (if BMAX needs to be larger than 16, then h and x[] should be ulong.)
|
||||
// maximum bit length of any code (if BMAX needs to be larger than 16, then h and x[] should be uint32_t.)
|
||||
#define BMAX 15
|
||||
|
||||
typedef ulong (*check_func) (ulong check, const byte *buf, ulong len);
|
||||
typedef uint32_t (*check_func) (uint32_t check, const byte *buf, uint32_t len);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ typedef struct inflate_huft_s
|
|||
{
|
||||
byte Exop; // number of extra bits or operation
|
||||
byte Bits; // number of bits in this code or subcode
|
||||
ulong base; // literal, length base, distance base, or table offset
|
||||
uint32_t base; // literal, length base, distance base, or table offset
|
||||
} inflate_huft_t;
|
||||
|
||||
// inflate codes private state
|
||||
|
@ -66,19 +66,19 @@ typedef struct inflate_codes_state_s
|
|||
inflate_codes_mode mode; // current inflate_codes mode
|
||||
|
||||
// mode dependent information
|
||||
ulong len;
|
||||
uint32_t len;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
inflate_huft_t *tree; // pointer into tree
|
||||
ulong need; // bits needed
|
||||
uint32_t need; // bits needed
|
||||
} code; // if LEN or DIST, where in tree
|
||||
ulong lit; // if LIT, literal
|
||||
uint32_t lit; // if LIT, literal
|
||||
struct
|
||||
{
|
||||
ulong get; // bits to get for extra
|
||||
ulong dist; // distance back to copy from
|
||||
uint32_t get; // bits to get for extra
|
||||
uint32_t dist; // distance back to copy from
|
||||
} copy; // if EXT or COPY, where and how much
|
||||
}; // submode
|
||||
|
||||
|
@ -98,13 +98,13 @@ typedef struct inflate_blocks_state_s
|
|||
// mode dependent information
|
||||
union
|
||||
{
|
||||
ulong left; // if STORED, bytes left to copy
|
||||
uint32_t left; // if STORED, bytes left to copy
|
||||
struct
|
||||
{
|
||||
ulong table; // table lengths (14 bits)
|
||||
ulong index; // index into blens (or border)
|
||||
ulong *blens; // bit lengths of codes
|
||||
ulong bb; // bit length tree depth
|
||||
uint32_t table; // table lengths (14 bits)
|
||||
uint32_t index; // index into blens (or border)
|
||||
uint32_t *blens; // bit lengths of codes
|
||||
uint32_t bb; // bit length tree depth
|
||||
inflate_huft_t *tb; // bit length decoding tree
|
||||
} trees; // if DTREE, decoding info for trees
|
||||
struct
|
||||
|
@ -115,14 +115,14 @@ typedef struct inflate_blocks_state_s
|
|||
bool last; // true if this block is the last block
|
||||
|
||||
// mode independent information
|
||||
ulong bitk; // bits in bit buffer
|
||||
ulong bitb; // bit buffer
|
||||
uint32_t bitk; // bits in bit buffer
|
||||
uint32_t bitb; // bit buffer
|
||||
inflate_huft_t *hufts; // single malloc for tree space
|
||||
byte window[WINDOW_SIZE]; // sliding window
|
||||
byte *end; // one byte after sliding window
|
||||
byte *read; // window read pointer
|
||||
byte *write; // window write pointer
|
||||
ulong check; // check on output
|
||||
uint32_t check; // check on output
|
||||
} inflate_blocks_state_t;
|
||||
|
||||
// inflate private state
|
||||
|
@ -130,15 +130,15 @@ typedef struct inflate_state_s
|
|||
{
|
||||
inflate_mode mode; // current inflate mode
|
||||
|
||||
ulong method; // if FLAGS, method byte
|
||||
uint32_t method; // if FLAGS, method byte
|
||||
|
||||
// mode independent information
|
||||
int nowrap; // flag for no wrapper
|
||||
ulong wbits; // log2(window size) (8..15, defaults to 15)
|
||||
uint32_t wbits; // log2(window size) (8..15, defaults to 15)
|
||||
inflate_blocks_state_t *blocks; // current inflate_blocks state
|
||||
|
||||
ulong adler;
|
||||
ulong calcadler;
|
||||
uint32_t adler;
|
||||
uint32_t calcadler;
|
||||
} inflate_state;
|
||||
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ typedef enum
|
|||
// number of distance codes
|
||||
#define D_CODES 30
|
||||
|
||||
extern const ulong extra_dbits[D_CODES];
|
||||
extern const uint32_t extra_dbits[D_CODES];
|
||||
|
||||
// Structure to be used by external applications
|
||||
|
||||
|
@ -129,12 +129,12 @@ extern const ulong extra_dbits[D_CODES];
|
|||
typedef struct z_stream_s
|
||||
{
|
||||
byte *next_in; // next input unsigned char
|
||||
ulong avail_in; // number of unsigned chars available at next_in
|
||||
ulong total_in; // total number of bytes processed so far
|
||||
uint32_t avail_in; // number of unsigned chars available at next_in
|
||||
uint32_t total_in; // total number of bytes processed so far
|
||||
|
||||
byte *next_out; // next output unsigned char should be put there
|
||||
ulong avail_out; // remaining free space at next_out
|
||||
ulong total_out; // total number of bytes output
|
||||
uint32_t avail_out; // remaining free space at next_out
|
||||
uint32_t total_out; // total number of bytes output
|
||||
|
||||
EStatus status;
|
||||
EStatus error; // error code
|
||||
|
@ -142,7 +142,7 @@ typedef struct z_stream_s
|
|||
struct inflate_state_s *istate; // not visible by applications
|
||||
struct deflate_state_s *dstate; // not visible by applications
|
||||
|
||||
ulong quality;
|
||||
uint32_t quality;
|
||||
} z_stream;
|
||||
|
||||
// Update a running crc with the bytes buf[0..len-1] and return the updated
|
||||
|
@ -151,14 +151,14 @@ typedef struct z_stream_s
|
|||
// within this function so it shouldn't be done by the application.
|
||||
// Usage example:
|
||||
//
|
||||
// ulong crc = crc32(0L, NULL, 0);
|
||||
// uint32_t crc = crc32(0L, NULL, 0);
|
||||
//
|
||||
// while (read_buffer(buffer, length) != EOF) {
|
||||
// crc = crc32(crc, buffer, length);
|
||||
// }
|
||||
// if (crc != original_crc) error();
|
||||
|
||||
ulong crc32(ulong crc, const byte *buf, ulong len);
|
||||
unsigned long crc32(unsigned long crc, const byte *buf, unsigned int len);
|
||||
|
||||
// Update a running Adler-32 checksum with the bytes buf[0..len-1] and
|
||||
// return the updated checksum. If buf is NULL, this function returns
|
||||
|
@ -166,14 +166,14 @@ ulong crc32(ulong crc, const byte *buf, ulong len);
|
|||
// An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
|
||||
// much faster. Usage example:
|
||||
//
|
||||
// ulong adler = adler32(0L, NULL, 0);
|
||||
// uint32_t adler = adler32(0L, NULL, 0);
|
||||
//
|
||||
// while (read_buffer(buffer, length) != EOF) {
|
||||
// adler = adler32(adler, buffer, length);
|
||||
// }
|
||||
// if (adler != original_adler) error();
|
||||
|
||||
ulong adler32(ulong adler, const byte *buf, ulong len);
|
||||
unsigned long adler32(unsigned long adler, const byte *buf, unsigned int len);
|
||||
|
||||
// External calls to the deflate code
|
||||
EStatus deflateInit(z_stream *strm, ELevel level, int noWrap = 0);
|
||||
|
@ -189,7 +189,7 @@ EStatus inflateEnd(z_stream *strm);
|
|||
const char *inflateError(void);
|
||||
|
||||
// External calls to the zipfile code
|
||||
bool InflateFile(byte *src, ulong compressedSize, byte *dst, ulong uncompressedSize, int noWrap = 0);
|
||||
bool DeflateFile(byte *src, ulong uncompressedSize, byte *dst, ulong maxCompressedSize, ulong *compressedSize, ELevel level, int noWrap = 0);
|
||||
bool InflateFile(byte *src, uint32_t compressedSize, byte *dst, uint32_t uncompressedSize, int noWrap = 0);
|
||||
bool DeflateFile(byte *src, uint32_t uncompressedSize, byte *dst, uint32_t maxCompressedSize, uint32_t *compressedSize, ELevel level, int noWrap = 0);
|
||||
|
||||
// end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Table of CRC-32's of all single-byte values (made by make_crc_table)
|
||||
// -----------------------------------------------------------------------------------------------
|
||||
|
||||
static const unsigned long crc_table[256] =
|
||||
static const unsigned int crc_table[256] =
|
||||
{
|
||||
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
|
||||
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
|
||||
|
@ -62,7 +62,7 @@ static const unsigned long crc_table[256] =
|
|||
// Calculate 32 bit CRC checksum for len bytes
|
||||
// -----------------------------------------------------------------------------------------------
|
||||
|
||||
unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned long len)
|
||||
unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned int len)
|
||||
{
|
||||
if(!buf)
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned long l
|
|||
// NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1
|
||||
#define NMAX 5552
|
||||
|
||||
unsigned long adler32(unsigned long adler, const unsigned char *buf, unsigned long len)
|
||||
unsigned long adler32(unsigned long adler, const unsigned char *buf, unsigned int len)
|
||||
{
|
||||
unsigned long s1;
|
||||
unsigned long s2;
|
||||
|
@ -114,4 +114,4 @@ unsigned long adler32(unsigned long adler, const unsigned char *buf, unsigned lo
|
|||
return (s2 << 16) | s1;
|
||||
}
|
||||
|
||||
// end
|
||||
// end
|
||||
|
|
Loading…
Reference in a new issue