engine: fix long<->int conversion UBs

This commit is contained in:
Alibek Omarov 2019-05-02 19:05:09 +03:00
parent 29a48cb34c
commit ab7a67464b
12 changed files with 32 additions and 32 deletions

View File

@ -48,7 +48,7 @@ typedef integer64 longtime_t;
#define MAX_MODS 512 // environment games that engine can keep visible
#define MAX_USERMSG_LENGTH 2048 // don't modify it's relies on a client-side definitions
#define BIT( n ) ( 1 << ( n ))
#define BIT( n ) ( 1U << ( n ))
#define GAMMA ( 2.2 ) // Valve Software gamma
#define INVGAMMA ( 1.0 / 2.2 ) // back to 1.0
#define TEXGAMMA ( 0.9 ) // compensate dim textures

View File

@ -19,15 +19,15 @@ GNU General Public License for more details.
// avikit.c
//
typedef struct movie_state_s movie_state_t;
long AVI_GetVideoFrameNumber( movie_state_t *Avi, float time );
byte *AVI_GetVideoFrame( movie_state_t *Avi, long frame );
qboolean AVI_GetVideoInfo( movie_state_t *Avi, long *xres, long *yres, float *duration );
int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time );
byte *AVI_GetVideoFrame( movie_state_t *Avi, int frame );
qboolean AVI_GetVideoInfo( movie_state_t *Avi, int *xres, int *yres, float *duration );
qboolean AVI_GetAudioInfo( movie_state_t *Avi, wavdata_t *snd_info );
long AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, long offset, long length );
int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int length );
void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audio, int quiet );
movie_state_t *AVI_LoadVideo( const char *filename, qboolean load_audio );
long AVI_TimeToSoundPosition( movie_state_t *Avi, long time );
long AVI_GetVideoFrameCount( movie_state_t *Avi );
int AVI_TimeToSoundPosition( movie_state_t *Avi, int time );
int AVI_GetVideoFrameCount( movie_state_t *Avi );
void AVI_CloseVideo( movie_state_t *Avi );
qboolean AVI_IsActive( movie_state_t *Avi );
void AVI_FreeVideo( movie_state_t *Avi );

View File

@ -16,17 +16,17 @@ GNU General Public License for more details.
#ifndef _WIN32
#include "common.h"
long AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )
int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )
{
return 0;
}
byte *AVI_GetVideoFrame( movie_state_t *Avi, long frame )
byte *AVI_GetVideoFrame( movie_state_t *Avi, int frame )
{
return NULL;
}
qboolean AVI_GetVideoInfo( movie_state_t *Avi, long *xres, long *yres, float *duration )
qboolean AVI_GetVideoInfo( movie_state_t *Avi, int *xres, int *yres, float *duration )
{
return false;
}
@ -36,7 +36,7 @@ qboolean AVI_GetAudioInfo( movie_state_t *Avi, wavdata_t *snd_info )
return false;
}
long AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, long offset, long length )
int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int length )
{
return 0;
}
@ -51,12 +51,12 @@ movie_state_t *AVI_LoadVideo( const char *filename, qboolean load_audio )
return NULL;
}
long AVI_TimeToSoundPosition( movie_state_t *Avi, long time )
int AVI_TimeToSoundPosition( movie_state_t *Avi, int time )
{
return 0;
}
long AVI_GetVideoFrameCount( movie_state_t *Avi )
int AVI_GetVideoFrameCount( movie_state_t *Avi )
{
return 0;
}

View File

@ -251,7 +251,7 @@ qboolean AVI_ACMConvertAudio( movie_state_t *Avi )
return true;
}
qboolean AVI_GetVideoInfo( movie_state_t *Avi, long *xres, long *yres, float *duration )
qboolean AVI_GetVideoInfo( movie_state_t *Avi, int *xres, int *yres, float *duration )
{
if( !Avi->active )
return false;
@ -269,7 +269,7 @@ qboolean AVI_GetVideoInfo( movie_state_t *Avi, long *xres, long *yres, float *du
}
// returns a unique frame identifier
long AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )
int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )
{
if( !Avi->active )
return 0;
@ -277,7 +277,7 @@ long AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )
return (time * Avi->video_fps);
}
long AVI_GetVideoFrameCount( movie_state_t *Avi )
int AVI_GetVideoFrameCount( movie_state_t *Avi )
{
if( !Avi->active )
return 0;
@ -285,7 +285,7 @@ long AVI_GetVideoFrameCount( movie_state_t *Avi )
return Avi->video_frames;
}
long AVI_TimeToSoundPosition( movie_state_t *Avi, long time )
int AVI_TimeToSoundPosition( movie_state_t *Avi, int time )
{
if( !Avi->active || !Avi->audio_stream )
return 0;
@ -382,7 +382,7 @@ qboolean AVI_SeekPosition( movie_state_t *Avi, dword offset )
}
// get a chunk of audio from the stream (in bytes)
long AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, long offset, long length )
int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int length )
{
long result = 0;
int i;

View File

@ -95,7 +95,7 @@ static void *pfnGetNativeObject( const char *obj )
return Platform_GetNativeObject( obj );
}
void IN_TouchHideButtons( const char *str, qboolean hide )
void IN_TouchHideButtons( const char *str, unsigned char hide )
{
}

View File

@ -24,7 +24,7 @@ AVI PLAYING
=================================================================
*/
static long xres, yres;
static int xres, yres;
static float video_duration;
static float cin_time;
static int cin_frame;

View File

@ -57,7 +57,7 @@ void IN_TouchDraw( void );
void IN_TouchEditClear( void );
void IN_TouchSetClientOnly( qboolean state );
void IN_TouchRemoveButton( const char *name );
void IN_TouchHideButtons( const char *name, qboolean hide );
void IN_TouchHideButtons( const char *name, unsigned char hide );
//void IN_TouchSetCommand( const char *name, const char *command );
//void IN_TouchSetTexture( const char *name, const char *texture );
//void IN_TouchSetColor( const char *name, byte *color );

View File

@ -118,7 +118,7 @@ static void pfnGetPredictedOrigin( vec3_t v )
VectorCopy( cl.simorg, v );
}
static color24 *pfnCL_GetPaletteColor(int color) // clgame.palette[color]
static color24 *pfnCL_GetPaletteColor( int color ) // clgame.palette[color]
{
return &clgame.palette[color];
}
@ -201,13 +201,13 @@ static ref_api_t gEngfuncs =
{
pfnEngineGetParm,
Cvar_Get,
Cvar_FindVarExt,
(void*)Cvar_Get,
(void*)Cvar_FindVarExt,
Cvar_VariableValue,
Cvar_VariableString,
Cvar_SetValue,
Cvar_Set,
Cvar_RegisterVariable,
(void*)Cvar_RegisterVariable,
Cvar_FullSet,
Cmd_AddRefCommand,

View File

@ -52,7 +52,7 @@ struct ref_viewpass_s;
typedef struct ui_enginefuncs_s
{
// image handlers
HIMAGE (*pfnPIC_Load)( const char *szPicName, const byte *ucRawImage, long ulRawImageSize, long flags );
HIMAGE (*pfnPIC_Load)( const char *szPicName, const byte *ucRawImage, int ulRawImageSize, int flags );
void (*pfnPIC_Free)( const char *szPicName );
int (*pfnPIC_Width)( HIMAGE hPic );
int (*pfnPIC_Height)( HIMAGE hPic );
@ -168,7 +168,7 @@ typedef struct ui_enginefuncs_s
int (*pfnCompareFileTime)( const char *filename1, const char *filename2, int *iCompare );
const char *(*pfnGetModeString)( int vid_mode );
int (*COM_SaveFile)( const char *filename, const void *data, long len );
int (*COM_SaveFile)( const char *filename, const void *data, int len );
int (*COM_RemoveFile)( const char *filepath );
} ui_enginefuncs_t;

View File

@ -102,7 +102,7 @@ typedef struct server_physics_api_s
int (*pfnSaveLump)( const char *filename, const int lump, void *lumpdata, int lumpsize );
// FS tools
int (*pfnSaveFile)( const char *filename, const void *data, long len );
int (*pfnSaveFile)( const char *filename, const void *data, int len );
const byte *(*pfnLoadImagePixels)( const char *filename, int *width, int *height );
const char* (*pfnGetModelName)( int modelindex );

View File

@ -292,7 +292,7 @@ typedef struct ref_api_s
struct cl_entity_s *(*GetViewModel)( void );
struct cl_entity_s *(*GetEntityByIndex)( int idx );
struct cl_entity_s *(*R_BeamGetEntity)( int index );
struct cl_entity_s *(*CL_GetWaterEntity)( vec3_t p );
struct cl_entity_s *(*CL_GetWaterEntity)( const vec3_t p );
qboolean (*CL_AddVisibleEntity)( cl_entity_t *ent, int entityType );
// brushes
@ -341,7 +341,7 @@ typedef struct ref_api_s
struct screenfade_s *(*GetScreenFade)( void );
struct client_textmessage_s *(*pfnTextMessageGet)( const char *pName );
void (*GetPredictedOrigin)( vec3_t v );
byte *(*CL_GetPaletteColor)(int color); // clgame.palette[color]
color24 *(*CL_GetPaletteColor)(int color); // clgame.palette[color]
void (*CL_GetScreenInfo)( int *width, int *height ); // clgame.scrInfo, ptrs may be NULL
void (*SetLocalLightLevel)( int level ); // cl.local.light_level
int (*Sys_CheckParm)( const char *flag );
@ -377,7 +377,7 @@ typedef struct ref_api_s
// video init
// try to create window
// will call GL_SetupAttributes in case of REF_GL
int (*R_Init_Video)( int type );
qboolean (*R_Init_Video)( int type );
void (*R_Free_Video)( void );
// GL

2
mainui

@ -1 +1 @@
Subproject commit ebc9d90fb16b713f484ddee9c6755fe6281c7fe0
Subproject commit ec653a40ba1e1d43cdd99c285fafbc205e2c7c58