diff --git a/AudioEncode/encoder.cpp b/AudioEncode/encoder.cpp index 1e7699d8..b6983642 100644 --- a/AudioEncode/encoder.cpp +++ b/AudioEncode/encoder.cpp @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +#include #include #include #include @@ -23,7 +24,7 @@ #include "mono.h" #include "Aencode.h" -long aenc_ReadSamp(void *data) { +int32_t aenc_ReadSamp(void *data) { FILE *f = (FILE *)data; int a, b; a = getc(f); @@ -33,13 +34,13 @@ long aenc_ReadSamp(void *data) { b = getc(f); if (b == EOF) return ReadSampleEof; - return (short)((b << 8) + a); + return (b << 8) | a; } -int aenc_Compress(char *input_filename, char *output_filename, int *input_levels, int *input_samples, int *input_rate, +bool aenc_Compress(char *input_filename, char *output_filename, int *input_levels, int *input_samples, int *input_rate, int *input_channels, float *input_factor, float *input_volscale) { FILE *in, *out; - long result; + int32_t result; int levels, samples_per_subband; unsigned sample_rate, channels; @@ -50,7 +51,7 @@ int aenc_Compress(char *input_filename, char *output_filename, int *input_levels in = fopen(input_filename, "rb"); if (!in) { mprintf((0, "AENC: Unable to open %s for input.\n", input_filename)); - return 0; + return false; } if (input_levels) { @@ -114,7 +115,9 @@ int aenc_Compress(char *input_filename, char *output_filename, int *input_levels unsigned subbands = (2048 / samples_per_subband) >> 1; for (levels = 0; subbands; subbands >>= 1, ++levels) - ; + { + + } } if (!sample_rate_set) @@ -129,7 +132,7 @@ int aenc_Compress(char *input_filename, char *output_filename, int *input_levels out = fopen(output_filename, "wb"); if (!out) { mprintf((0, "AENC: Unable to open %s for output.\n", output_filename)); - return 0; + return false; } result = AudioEncode(aenc_ReadSamp, in, channels, sample_rate, volume_scale, out, levels, samples_per_subband, @@ -138,5 +141,5 @@ int aenc_Compress(char *input_filename, char *output_filename, int *input_levels fclose(out); fclose(in); - return 1; + return result > 0; } diff --git a/Descent3/GameLoop.cpp b/Descent3/GameLoop.cpp index 10c8f4a1..b7239118 100644 --- a/Descent3/GameLoop.cpp +++ b/Descent3/GameLoop.cpp @@ -931,7 +931,7 @@ int frames_one_second = 0; int min_one_second = 0x7fffffff; int max_one_second = 0; -longlong last_timer = 0; +int64_t last_timer = 0; // contains information for the music system. tMusicSeqInfo Game_music_info; @@ -2752,7 +2752,7 @@ unsigned int Frames_counted = 0; // Compute how long last frame took void CalcFrameTime(void) { - longlong current_timer; + int64_t current_timer; if (timer_paused) return; @@ -3108,7 +3108,7 @@ void GameFrame(void) { // float start_delay = timer_GetTime(); // Slow down the game if the user asked us to - longlong current_timer; + int64_t current_timer; unsigned int sleeptime; current_timer = timer_GetMSTime(); if ((current_timer - last_timer) < Min_allowed_frametime) { diff --git a/Descent3/dedicated_server.cpp b/Descent3/dedicated_server.cpp index aa01f6d0..40017984 100644 --- a/Descent3/dedicated_server.cpp +++ b/Descent3/dedicated_server.cpp @@ -883,7 +883,7 @@ void ListenDedicatedSocket(void) { #endif if (!Dedicated_allow_remote) { // Check to see if this came in from the local address - unsigned long localhost = inet_addr("127.0.0.1"); + uint32_t localhost = inet_addr("127.0.0.1"); if (memcmp(&localhost, &conn_addr.sin_addr, sizeof(localhost)) != 0) { mprintf((0, "Rejecting connection from remote host!\n")); PrintDedicatedMessage(TXT_DS_REJECTREMOTE, inet_ntoa(conn_addr.sin_addr)); diff --git a/Descent3/gamesave.cpp b/Descent3/gamesave.cpp index 992de627..4575bdce 100644 --- a/Descent3/gamesave.cpp +++ b/Descent3/gamesave.cpp @@ -1094,7 +1094,7 @@ void SGSObjects(CFILE *fp) { // data universal to all objects that need to be saved. gs_WriteShort(fp, (short)op->id); - gs_WriteInt(fp, (long)op->flags); + gs_WriteInt(fp, static_cast(op->flags)); gs_WriteByte(fp, (sbyte)op->control_type); gs_WriteByte(fp, (sbyte)op->movement_type); gs_WriteByte(fp, (sbyte)op->render_type); diff --git a/acmlib/acmlib.cpp b/acmlib/acmlib.cpp index e979e383..b585a29b 100644 --- a/acmlib/acmlib.cpp +++ b/acmlib/acmlib.cpp @@ -26,7 +26,7 @@ extern "C" { #endif AudioDecoder *Create_AudioDecoder(ReadFunction *reader, void *data, unsigned *pChannels, unsigned *pSampleRate, - long *pSampleCount) { + int32_t *pSampleCount) { return (AudioDecoder *)mem_malloc(sizeof(AudioDecoder)); } diff --git a/bitmap/bitmain.cpp b/bitmap/bitmain.cpp index 2b7642a1..dae85de8 100644 --- a/bitmap/bitmain.cpp +++ b/bitmap/bitmain.cpp @@ -322,7 +322,7 @@ #define BM_FILETYPE_IFF 3 int Num_of_bitmaps = 0; bms_bitmap GameBitmaps[MAX_BITMAPS]; -ulong Bitmap_memory_used = 0; +uint32_t Bitmap_memory_used = 0; ubyte Bitmaps_initted = 0; /* modify these lines to establish data type */ typedef bms_bitmap *bm_T; /* type of item to be stored */ diff --git a/bitmap/iff.cpp b/bitmap/iff.cpp index 4c90b51d..697facc4 100644 --- a/bitmap/iff.cpp +++ b/bitmap/iff.cpp @@ -117,7 +117,7 @@ short iff_has_transparency; // 0=no transparency, 1=iff_transparent_color is val #define MIN(a, b) ((a < b) ? a : b) -#define MAKE_SIG(a, b, c, d) (((long)(a) << 24) + ((long)(b) << 16) + ((c) << 8) + (d)) +#define MAKE_SIG(a, b, c, d) (((int32_t)(a) << 24) + ((int32_t)(b) << 16) + ((c) << 8) + (d)) #define IFF_SIG_FORM 1 #define IFF_SIG_ILBM 2 @@ -307,7 +307,7 @@ void bm_iff_skip_chunk(CFILE *ifile, uint len) { int bm_iff_parse_delta(CFILE *ifile, int len, iff_bitmap_header *bmheader) { unsigned char *p = bmheader->raw_data; int y; - long chunk_end = cftell(ifile) + len; + int32_t chunk_end = cftell(ifile) + len; cf_ReadInt(ifile); // longword, seems to be equal to 4. Don't know what it is @@ -555,8 +555,8 @@ int bm_iff_read_animbrush(const char *ifilename, int *bm_list) { CFILE *ifile; iff_bitmap_header bm_headers[40]; iff_bitmap_header *temp_bm_head; - long sig, form_len; - long form_type; + int32_t sig, form_len; + int32_t form_type; int num_bitmaps = 0; int ret, i; diff --git a/czip/BitIO.cpp b/czip/BitIO.cpp index a68e63c9..091a0a44 100644 --- a/czip/BitIO.cpp +++ b/czip/BitIO.cpp @@ -34,6 +34,7 @@ * $NoKeywords: $ */ +#include #include #include #include @@ -136,8 +137,8 @@ void CZip::OutputBit(BITFILE *bfile, int bit) { } } -void CZip::OutputBits(BITFILE *bfile, ulong code, int count) { - ulong mask; +void CZip::OutputBits(BITFILE *bfile, uint32_t code, int count) { + uint32_t mask; mask = 1L << (count - 1); while (mask != 0) { if (mask & code) @@ -171,9 +172,9 @@ int CZip::InputBit(BITFILE *bfile) { return (value ? 1 : 0); } -ulong CZip::InputBits(BITFILE *bfile, int bitcount) { - ulong mask; - ulong return_value; +uint32_t CZip::InputBits(BITFILE *bfile, int bitcount) { + uint32_t mask; + uint32_t return_value; mask = 1L << (bitcount - 1); return_value = 0; diff --git a/czip/HuffmanAdapt.cpp b/czip/HuffmanAdapt.cpp index 1b972c8c..48cc0204 100644 --- a/czip/HuffmanAdapt.cpp +++ b/czip/HuffmanAdapt.cpp @@ -142,8 +142,8 @@ void CZip::ha_InitializeTree(tHATree *tree) { } void CZip::ha_EncodeSymbol(tHATree *tree, uint c, BITFILE *output) { - ulong code; - ulong current_bit; + uint32_t code; + uint32_t current_bit; int code_size; int current_node; @@ -162,7 +162,7 @@ void CZip::ha_EncodeSymbol(tHATree *tree, uint c, BITFILE *output) { } OutputBits(output, code, code_size); if (tree->leaf[c] == -1) { - OutputBits(output, (ulong)c, 8); + OutputBits(output, (uint32_t)c, 8); ha_add_new_node(tree, c); } } diff --git a/czip/HuffmanBasic.cpp b/czip/HuffmanBasic.cpp index 8c276c72..b6bb8f27 100644 --- a/czip/HuffmanBasic.cpp +++ b/czip/HuffmanBasic.cpp @@ -43,14 +43,14 @@ #define END_OF_STREAM 256 int CZip::hb_CompressFile(tVirtualFile *input, BITFILE *output) { - ulong *counts; + uint32_t *counts; tH0Node *nodes; tH0Code *codes; int root_node; int original_pos = VFtell(output->file); - counts = (ulong *)malloc(256 * sizeof(ulong)); + counts = (uint32_t *)malloc(256 * sizeof(uint32_t)); if (!counts) return -1; if ((nodes = (tH0Node *)malloc(514 * sizeof(tH0Node))) == NULL) { @@ -63,7 +63,7 @@ int CZip::hb_CompressFile(tVirtualFile *input, BITFILE *output) { return -1; } - memset(counts, 0, 256 * sizeof(ulong)); + memset(counts, 0, 256 * sizeof(uint32_t)); memset(nodes, 0, 514 * sizeof(tH0Node)); memset(codes, 0, 257 * sizeof(tH0Code)); @@ -169,8 +169,8 @@ void CZip::hb_input_counts(BITFILE *input, tH0Node *nodes) { nodes[END_OF_STREAM].count = 1; } -void CZip::hb_count_bytes(tVirtualFile *input, ulong *counts) { - long input_marker; +void CZip::hb_count_bytes(tVirtualFile *input, uint32_t *counts) { + int32_t input_marker; int c; input_marker = VFtell(input); @@ -179,8 +179,8 @@ void CZip::hb_count_bytes(tVirtualFile *input, ulong *counts) { VFseek(input, input_marker, SEEK_SET); } -void CZip::hb_scale_counts(ulong *counts, tH0Node *nodes) { - ulong max_count; +void CZip::hb_scale_counts(uint32_t *counts, tH0Node *nodes) { + uint32_t max_count; int i; max_count = 0; @@ -251,8 +251,8 @@ void CZip::hb_convert_tree_to_code(tH0Node *nodes, tH0Code *codes, uint code_so_ void CZip::hb_compress_data(tVirtualFile *input, BITFILE *output, tH0Code *codes) { int c; while ((c = VFgetc(input)) != EOF) - OutputBits(output, (ulong)codes[c].code, codes[c].code_bits); - OutputBits(output, (ulong)codes[END_OF_STREAM].code, codes[END_OF_STREAM].code_bits); + OutputBits(output, (uint32_t)codes[c].code, codes[c].code_bits); + OutputBits(output, (uint32_t)codes[END_OF_STREAM].code, codes[END_OF_STREAM].code_bits); } void CZip::hb_expand_data(BITFILE *input, tVirtualFile *output, tH0Node *nodes, int root_node) { diff --git a/ddebug/lnxmono.cpp b/ddebug/lnxmono.cpp index 37d2c288..25fbceb2 100644 --- a/ddebug/lnxmono.cpp +++ b/ddebug/lnxmono.cpp @@ -102,17 +102,17 @@ static pthread_self_fp dpthread_self = NULL; #define dpthread_self pthread_self #endif -static unsigned long long Timer_sys_start_time = 0; -static unsigned long long Timer_accum = 0, Timer_high_mark = 0; +static uint64_t Timer_sys_start_time = 0; +static uint64_t Timer_accum = 0, Timer_high_mark = 0; static float nw_TCPLoggingTimer(void) { unsigned int time_ms; - unsigned long long ret; + uint64_t ret; struct timeval t; gettimeofday(&t, NULL); - ret = (unsigned long long)t.tv_sec * 1000000.0 + t.tv_usec; + ret = (uint64_t)t.tv_sec * 1000000.0 + t.tv_usec; if (ret > Timer_high_mark) { Timer_high_mark = ret; @@ -134,7 +134,7 @@ static bool nw_TCPLoggingTimer_Init(void) { struct timeval t; gettimeofday(&t, NULL); - Timer_sys_start_time = (unsigned long long)t.tv_sec * 1000000.0 + t.tv_usec; + Timer_sys_start_time = (uint64_t)t.tv_sec * 1000000.0 + t.tv_usec; Timer_accum = 0; Timer_high_mark = 0; return true; diff --git a/ddebug/windebug.cpp b/ddebug/windebug.cpp index ffd251b1..590d2c0a 100644 --- a/ddebug/windebug.cpp +++ b/ddebug/windebug.cpp @@ -195,6 +195,7 @@ #include #include #include +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/ddio_lnx/lnxtimer.cpp b/ddio_lnx/lnxtimer.cpp index 447682ee..d2053e69 100644 --- a/ddio_lnx/lnxtimer.cpp +++ b/ddio_lnx/lnxtimer.cpp @@ -62,10 +62,10 @@ static bool Timer_initialized = 0; // rcg06292000 not used with SDL. -// static unsigned long long Timer_sys_start_time = 0; -// static unsigned long long Timer_accum = 0,Timer_high_mark = 0; +// static uint64_t Timer_sys_start_time = 0; +// static uint64_t Timer_accum = 0,Timer_high_mark = 0; // void timer_Normalize(); -// unsigned long long timer_GetTickCount(); +// uint64_t timer_GetTickCount(); // --------------------------------------------------------------------------- @@ -87,10 +87,10 @@ void timer_Close() { Timer_initialized = 0; } -float ddio_TickToSeconds(unsigned long ticks) { +float ddio_TickToSeconds(uint32_t ticks) { // rcg06292000 not used with SDL. - // unsigned long time_ms; - // unsigned long long new_ticks = ticks; + // uint32_t time_ms; + // uint64_t new_ticks = ticks; // timer_Normalize(); // time_ms = new_ticks;// - Timer_sys_start_time; @@ -102,7 +102,7 @@ float ddio_TickToSeconds(unsigned long ticks) { float timer_GetTime() { // rcg06292000 ain't working. - // unsigned long time_ms; + // uint32_t time_ms; // timer_Normalize(); // time_ms = timer_GetTickCount() - Timer_sys_start_time; // return (float)((double)time_ms/((double)1000000.0)); @@ -111,12 +111,12 @@ float timer_GetTime() { return ((float)SDL_GetTicks() / 1000.0); } -longlong timer_GetMSTime() { +int64_t timer_GetMSTime() { // rcg06292000 not used with SDL. - // unsigned long time_ms; + // uint32_t time_ms; // timer_Normalize(); // time_ms = timer_GetTickCount() - Timer_sys_start_time; - // return (longlong)((double)time_ms/((double)1000.0)); + // return (int64_t)((double)time_ms/((double)1000.0)); return (SDL_GetTicks()); } @@ -129,7 +129,7 @@ longlong timer_GetMSTime() { /* void timer_Normalize() { - unsigned long long new_time; + uint64_t new_time; new_time = timer_GetTickCount(); if (new_time < Timer_sys_start_time) { @@ -138,9 +138,9 @@ void timer_Normalize() } } -unsigned long long timer_GetTickCount(void) +uint64_t timer_GetTickCount(void) { - unsigned long long ret; + uint64_t ret; struct timeval t; gettimeofday(&t,NULL); diff --git a/ddio_win/ddio_win.h b/ddio_win/ddio_win.h index 843ccae6..f9ffc8ae 100644 --- a/ddio_win/ddio_win.h +++ b/ddio_win/ddio_win.h @@ -71,6 +71,8 @@ #ifndef DDIO_WIN_H #define DDIO_WIN_H +#include +#include #include "pstypes.h" #include "win/DirectX/dinput.h" @@ -88,7 +90,7 @@ extern bool DDIO_init; extern bool DDIO_preemptive; bool ddio_JoyHandler(); -float ddio_TickToSeconds(unsigned long ticks); +float ddio_TickToSeconds(uint32_t ticks); #ifdef _DEBUG void ddio_DebugMessage(unsigned err, char *fmt, ...); diff --git a/ddio_win/wintimer.cpp b/ddio_win/wintimer.cpp index 109788cf..45eb6386 100644 --- a/ddio_win/wintimer.cpp +++ b/ddio_win/wintimer.cpp @@ -46,7 +46,7 @@ bool timerhi_Init(void); void timerhi_Close(void); float ddio_TickToSeconds(LARGE_INTEGER ticks); float timerhi_GetTime(); -longlong timerhi_GetMSTime(); +int64_t timerhi_GetMSTime(); void timerhi_Normalize(); LARGE_INTEGER Timer_hi_sys_start_time; LARGE_INTEGER Timer_hi_resolution; @@ -146,7 +146,7 @@ void timer_Close() { Timer_initialized = 0; } -float ddio_TickToSeconds(unsigned long ticks) { +float ddio_TickToSeconds(uint32_t ticks) { if (Timer_use_highres_timer) { LARGE_INTEGER t; t.QuadPart = ticks; @@ -181,7 +181,7 @@ float timer_GetTime() { return 0; } -longlong timer_GetMSTime() { +int64_t timer_GetMSTime() { if (Timer_use_highres_timer) { return timerhi_GetMSTime(); } else { @@ -292,7 +292,7 @@ float timerhi_GetTime() { } // This should return a timer in milliseconds -longlong timerhi_GetMSTime() { +int64_t timerhi_GetMSTime() { LARGE_INTEGER time_tick; timerhi_Normalize(); diff --git a/legacy/D3Launch/SpeedTab.cpp b/legacy/D3Launch/SpeedTab.cpp index 1c9c0433..a6286ff3 100644 --- a/legacy/D3Launch/SpeedTab.cpp +++ b/legacy/D3Launch/SpeedTab.cpp @@ -104,9 +104,6 @@ static char THIS_FILE[] = __FILE__; #endif -typedef LONGLONG longlong; - - ///////////////////////////////////////////////////////////////////////////// // CSpeedTab property page @@ -472,7 +469,7 @@ void CSpeedTab::OnBtnSpeedDetect() array1 = new int[1024*1024]; array2 = new int[1024*1024]; - longlong ct1, ct2, freq; + int64_t ct1, ct2, freq; QueryPerformanceCounter( (LARGE_INTEGER *)&ct1 ); @@ -502,7 +499,7 @@ void CSpeedTab::OnBtnSpeedDetect() delete(array1); delete(array2); - longlong deltat = (ct2-ct1)/count; + int64_t deltat = (ct2-ct1)/count; int speed = int(freq/deltat); @@ -537,15 +534,15 @@ void CSpeedTab::OnBtnSpeedDetect() deltat = ct2-ct1; - //longlong speed = (longlong(300)*freq)/(deltat*longlong(1024)); + //int64_t speed = (int64_t(300)*freq)/(deltat*int64_t(1024)); int bpp = GetDeviceCaps(hScreenDC,BITSPIXEL); int bpp1 = (bpp+7)/8; - longlong vram_speed = freq; - vram_speed /= (longlong)deltat; - vram_speed *= (longlong)(w*h*bpp1); - vram_speed /= (longlong)(1024*1024); + int64_t vram_speed = freq; + vram_speed /= (int64_t)deltat; + vram_speed *= (int64_t)(w*h*bpp1); + vram_speed /= (int64_t)(1024*1024); speed = int(vram_speed); diff --git a/legacy/D3Launch/eax.h b/legacy/D3Launch/eax.h index 14e85fe7..78d00e03 100644 --- a/legacy/D3Launch/eax.h +++ b/legacy/D3Launch/eax.h @@ -48,7 +48,7 @@ typedef enum // use this structure for get/set all properties... typedef struct { - unsigned long environment; // 0 to EAX_ENVIRONMENT_COUNT-1 + uint32_t environment; // 0 to EAX_ENVIRONMENT_COUNT-1 float fVolume; // 0 to 1 float fDecayTime_sec; // seconds, 0.1 to 100 float fDamping; // 0 to 1 diff --git a/legacy/editor/DallasMainDlg.cpp b/legacy/editor/DallasMainDlg.cpp index ef0f8b37..7573c2e2 100644 --- a/legacy/editor/DallasMainDlg.cpp +++ b/legacy/editor/DallasMainDlg.cpp @@ -9352,7 +9352,7 @@ void CDallasMainDlg::ClearCustomScriptStorage(void) // Scans the file for the custom script block and count how many lines are in it int CDallasMainDlg::CountCustomScriptLines(CFILE *infile) { - long int start_pos; + int32_t start_pos; int line_count; char linebuf[2048]; bool done; diff --git a/legacy/editor/ScriptStudio.cpp b/legacy/editor/ScriptStudio.cpp index feb27308..667a5f54 100644 --- a/legacy/editor/ScriptStudio.cpp +++ b/legacy/editor/ScriptStudio.cpp @@ -608,7 +608,7 @@ void CScriptStudio::RemoveAllSelections() //Replaces the selected word with the passed word void CScriptStudio::ReplaceSelected(char *replace_word) { - long start_index,end_index; + int32_t start_index,end_index; UpdateData(false); diff --git a/legacy/editor/StatusDlg.cpp b/legacy/editor/StatusDlg.cpp index 932dd559..f55cf575 100644 --- a/legacy/editor/StatusDlg.cpp +++ b/legacy/editor/StatusDlg.cpp @@ -104,7 +104,7 @@ END_MESSAGE_MAP() // calling CProgress::IncreaseProgress(). If you are going to use CProgress::SetProgressPercentage() // then you should call the version of InitProgress(CWnd *parent) below. // Returns true if the progress dialog was created -bool CProgress::InitProgress(fix min,fix max,long int iterations,CWnd *parent) +bool CProgress::InitProgress(fix min,fix max,int32_t iterations,CWnd *parent) { int nmin,nmax,Step; nmin=FixToInt(min); @@ -130,7 +130,7 @@ bool CProgress::InitProgress(fix min,fix max,long int iterations,CWnd *parent) return true; } -bool CProgress::InitProgress(int min,int max,long int iterations,CWnd *parent) +bool CProgress::InitProgress(int min,int max,int32_t iterations,CWnd *parent) { int Step; @@ -212,4 +212,4 @@ void CProgress::SetProgressPercentage(float percent) { ASSERT(m_StatusDlg!=NULL); m_StatusDlg->SetTo(m_Min+((int)(percent*(m_Max-m_Min)))); -} \ No newline at end of file +} diff --git a/legacy/editor/StatusDlg.h b/legacy/editor/StatusDlg.h index c5c29ffa..18d3ba28 100644 --- a/legacy/editor/StatusDlg.h +++ b/legacy/editor/StatusDlg.h @@ -69,8 +69,8 @@ protected: class CProgress { public: - bool InitProgress(fix min,fix max,long int iterations,CWnd *parent=NULL); - bool InitProgress(int min,int max,long int iterations,CWnd *parent); + bool InitProgress(fix min,fix max,int32_t iterations,CWnd *parent=NULL); + bool InitProgress(int min,int max,int32_t iterations,CWnd *parent); bool InitProgress(CWnd *parent=NULL); void DestroyProgress(); bool IncreaseProgress(); @@ -89,4 +89,4 @@ private: -#endif \ No newline at end of file +#endif diff --git a/legacy/editor/drawworld.cpp b/legacy/editor/drawworld.cpp index 61680be8..71ca4c62 100644 --- a/legacy/editor/drawworld.cpp +++ b/legacy/editor/drawworld.cpp @@ -311,7 +311,7 @@ void DrawTerrainPoints (vector *view_pos,matrix *view_orient) typedef struct seg_edge { union { struct {short v0,v1;}; - long vv; + int32_t vv; }; ushort type; } seg_edge; @@ -332,7 +332,7 @@ int edge_list_size; //set each frame //finds edge, filling in edge_ptr. if found old edge, returns index, else return -1 int FindEdge(int v0,int v1,seg_edge **edge_ptr) { - long vv; + int32_t vv; short hash,oldhash; int ret; diff --git a/legacy/hogedit/HogEditDoc.cpp b/legacy/hogedit/HogEditDoc.cpp index f00a9b37..e92b4b40 100644 --- a/legacy/hogedit/HogEditDoc.cpp +++ b/legacy/hogedit/HogEditDoc.cpp @@ -457,7 +457,7 @@ int CHogEditDoc::AddFile(const char *pathname, hog_library_entry *entry) char filename[PSFILENAME_LEN+1]; char ext[_MAX_EXT]; unsigned length; - long timestamp; + int32_t timestamp; POSITION pos; char path[PSPATHNAME_LEN]; char drive[PSPATHNAME_LEN]; diff --git a/legacy/hogedit/HogEditDoc.h b/legacy/hogedit/HogEditDoc.h index b46c0084..9db79c17 100644 --- a/legacy/hogedit/HogEditDoc.h +++ b/legacy/hogedit/HogEditDoc.h @@ -85,7 +85,7 @@ typedef struct hog_library_entry char path[PSPATHNAME_LEN]; // location of data file (filename not included) char name[PSFILENAME_LEN+1]; // just the filename unsigned length; // length of this file - long timestamp; // time and date of file + int32_t timestamp; // time and date of file int flags; // misc flags int offset; // file offset in hog (or -1 if in .rib file) } hog_library_entry; diff --git a/legacy/hogmaker/hogmaker.cpp b/legacy/hogmaker/hogmaker.cpp index e716e908..23fbc67a 100644 --- a/legacy/hogmaker/hogmaker.cpp +++ b/legacy/hogmaker/hogmaker.cpp @@ -33,7 +33,7 @@ typedef struct { char name[LIB_FILENAME_LEN]; //just the filename part int offset; //offset into library file int length; //length of this file - long timestamp; //time and date of file + int32_t timestamp; //time and date of file int flags; //misc flags } library_entry; @@ -262,7 +262,7 @@ list_files(char *hogname) printf(" %-12s %7d",hogfile->table[i].name,hogfile->table[i].length); if (hogfile->table[i].timestamp) { - long t = hogfile->table[i].timestamp; + int32_t t = hogfile->table[i].timestamp; printf(" %2d/%02d/%02d %2d:%02d:%02d",MONTH(t),DAY(t),YEAR(t),HOUR(t),MINUTE(t),SECOND(t)); } else diff --git a/legacy/mtclient/mt_net.cpp b/legacy/mtclient/mt_net.cpp index 9970e0b3..2df0af68 100644 --- a/legacy/mtclient/mt_net.cpp +++ b/legacy/mtclient/mt_net.cpp @@ -107,8 +107,8 @@ typedef struct vmt_descent3_struct { unsigned int lateral_thrust; unsigned int rotational_thrust; unsigned int sliding_pct; //Percentage of the time you were sliding - unsigned long checksum; //This value needs to be equal to whatever the checksum is once the packet is decoded - unsigned long pad; //just to provide room for out 4 byte encryption boundry only needed on the client side for now + uint32_t checksum; //This value needs to be equal to whatever the checksum is once the packet is decoded + uint32_t pad; //just to provide room for out 4 byte encryption boundry only needed on the client side for now } vmt_descent3_struct; #define DESCENT3_BLOCK_SIZE (sizeof(vmt_descent3_struct)-4) #ifdef WIN32 diff --git a/legacy/mtclient/mtclient.cpp b/legacy/mtclient/mtclient.cpp index 62394229..4bd02bd3 100644 --- a/legacy/mtclient/mtclient.cpp +++ b/legacy/mtclient/mtclient.cpp @@ -3314,7 +3314,7 @@ void AutoLoginAndJoinGame(void) int passlen = PASSWORD_LEN; int valret; unsigned short port; - unsigned long iaddr; + uint32_t iaddr; *DLLMultiGameStarting = 0; DLLCreateSplashScreen(TXT_PXO_CONNECTING,0); @@ -3386,7 +3386,7 @@ void AutoLoginAndJoinGame(void) network_address s_address; iaddr = inet_addr(DLLAuto_login_addr); - memcpy (&s_address.address,&iaddr,sizeof(unsigned long)); + memcpy (&s_address.address,&iaddr,sizeof(uint32_t)); s_address.port=port; s_address.connection_type = NP_TCP; *DLLGame_is_master_tracker_game = 1; diff --git a/legacy/mtclient/mtgametrack.h b/legacy/mtclient/mtgametrack.h index 4d5da242..84f1a524 100644 --- a/legacy/mtclient/mtgametrack.h +++ b/legacy/mtclient/mtgametrack.h @@ -155,7 +155,7 @@ typedef struct { unsigned char game_type; //1==freespace (GT_FREESPACE), 2==D3, 3==tuberacer, etc. SOCKADDR_IN addr; int type; //Used to specify what to do ie. Add a new net game (GNT_GAMESTARTED), remove a net game (game over), etc. - unsigned long sig; //Unique identifier for client ACKs (The server always fills this in, the client responds) + uint32_t sig; //Unique identifier for client ACKs (The server always fills this in, the client responds) char data[MAX_GT_GAME_DATA_SIZE]; }game_packet_header; @@ -209,14 +209,14 @@ typedef struct _active_games{ typedef struct { unsigned char game_type; char game_name[MAX_GAME_LISTS_PER_PACKET][MAX_GENERIC_GAME_NAME_LEN]; - unsigned long game_server[MAX_GAME_LISTS_PER_PACKET]; + uint32_t game_server[MAX_GAME_LISTS_PER_PACKET]; unsigned short game_port[MAX_GAME_LISTS_PER_PACKET]; }game_list; */ typedef struct { unsigned char game_type; - unsigned long game_server[MAX_GAME_LISTS_PER_PACKET*4]; + uint32_t game_server[MAX_GAME_LISTS_PER_PACKET*4]; unsigned short game_port[MAX_GAME_LISTS_PER_PACKET*4]; }game_list; diff --git a/legacy/mtclient/mtpilottrack.h b/legacy/mtclient/mtpilottrack.h index 78047a8d..6e2a5600 100644 --- a/legacy/mtclient/mtpilottrack.h +++ b/legacy/mtclient/mtpilottrack.h @@ -241,10 +241,10 @@ typedef struct { typedef struct { unsigned char type; //Type of request unsigned short len; //Length of total packet, including this header - unsigned long code; //For control messages + uint32_t code; //For control messages unsigned short xcode; //For control/NAK messages and for sigs. - unsigned long sig; //To identify unique return ACKs - unsigned long security; // Just a random value, we store the last value used in the user record + uint32_t sig; //To identify unique return ACKs + uint32_t security; // Just a random value, we store the last value used in the user record // So we don't process the same request twice. unsigned char data[MAX_UDP_DATA_LENGH]; } udp_packet_header; @@ -256,12 +256,12 @@ typedef struct { typedef struct _net_reg_queue { char login[LOGIN_LEN]; //Login id - unsigned long time_last_sent; //Time in milliseconds since we last sent this packet + uint32_t time_last_sent; //Time in milliseconds since we last sent this packet int retries; //Number of times this has been sent udp_packet_header packet; //Packet containing the actual data to resend, etc. struct _net_reg_queue *next; //Pointer to next item in the list SOCKADDR netaddr; - unsigned long sig; //Signature to be used by the client to ACK our response. + uint32_t sig; //Signature to be used by the client to ACK our response. } net_reg_queue; #endif @@ -286,8 +286,8 @@ typedef struct vmt_descent3_struct { unsigned int lateral_thrust; unsigned int rotational_thrust; unsigned int sliding_pct; //Percentage of the time you were sliding - unsigned long checksum; //This value needs to be equal to whatever the checksum is once the packet is decoded - unsigned long pad; //just to provide room for out 4 byte encryption boundry only needed on the client side for now + uint32_t checksum; //This value needs to be equal to whatever the checksum is once the packet is decoded + uint32_t pad; //just to provide room for out 4 byte encryption boundry only needed on the client side for now } vmt_descent3_struct; */ @@ -306,7 +306,7 @@ void PollPTrackNet(); void ValidIdle(); //int ValidateUser(validate_id_request *valid_id); int ValidateUser(validate_id_request *valid_id, char *trackerid); -void xorcode(void *data,unsigned int len,unsigned long hash); +void xorcode(void *data,unsigned int len,uint32_t hash); extern int MTAVersionCheck(unsigned int oldver, char *URL); void VersionIdle(); void HandlePilotData(ubyte *data,int len, network_address *from); diff --git a/legacy/mtclient/mtpilottracker.cpp b/legacy/mtclient/mtpilottracker.cpp index dbd676f8..0dd3c087 100644 --- a/legacy/mtclient/mtpilottracker.cpp +++ b/legacy/mtclient/mtpilottracker.cpp @@ -150,8 +150,8 @@ typedef struct vmt_descent3_struct { unsigned int lateral_thrust; unsigned int rotational_thrust; unsigned int sliding_pct; //Percentage of the time you were sliding - unsigned long checksum; //This value needs to be equal to whatever the checksum is once the packet is decoded - unsigned long pad; //just to provide room for out 4 byte encryption boundry only needed on the client side for now + uint32_t checksum; //This value needs to be equal to whatever the checksum is once the packet is decoded + uint32_t pad; //just to provide room for out 4 byte encryption boundry only needed on the client side for now } vmt_descent3_struct; #define DESCENT3_BLOCK_SIZE (sizeof(vmt_descent3_struct)-4) #ifdef WIN32 @@ -733,17 +733,17 @@ void ValidIdle() } } //This code will modify 4 bytes at a time, so make sure to pad it!!! -void xorcode(void *data,unsigned int len,unsigned long hash) +void xorcode(void *data,unsigned int len,uint32_t hash) { return; unsigned int i=0; - unsigned long *src = (unsigned long *)&data; + uint32_t *src = (uint32_t *)&data; while(i +#include +#include +#include "pstypes.h" -typedef long ReadSampleFunction(void *data); + +typedef int32_t ReadSampleFunction(void *data); enum AudioError { ReadSampleEof = 0x80000000, }; -unsigned int AudioEncode(ReadSampleFunction *read, void *data, unsigned channels, unsigned sample_rate, float volume, +int32_t AudioEncode(ReadSampleFunction *read, void *data, unsigned channels, unsigned sample_rate, float volume, FILE *out, int levels, int samples_per_subband, float comp_ratio); #endif diff --git a/lib/CZip.h b/lib/CZip.h index d2e2720a..8dbf3202 100644 --- a/lib/CZip.h +++ b/lib/CZip.h @@ -19,6 +19,8 @@ #ifndef __CZIPFILE_H_ #define __CZIPFILE_H_ +#include + #define OCF_VERSION 0x01 //////////////////////////////////////// @@ -68,7 +70,6 @@ #define ubyte unsigned char #define uint unsigned int #define ushort unsigned short -#define ulong unsigned int typedef struct { ubyte type; @@ -227,9 +228,9 @@ private: BITFILE *OpenInputBitFile(char *filename); BITFILE *OpenOutputBitFile(char *filename); void OutputBit(BITFILE *bfile, int bit); - void OutputBits(BITFILE *bfile, ulong code, int count); + void OutputBits(BITFILE *bfile, uint32_t code, int count); int InputBit(BITFILE *bfile); - ulong InputBits(BITFILE *bfile, int bitcount); + uint32_t InputBits(BITFILE *bfile, int bitcount); void CloseInputBitFile(BITFILE *bfile); void CloseOutputBitFile(BITFILE *bfile); void FilePrintBinary(FILE *file, uint code, int bits); @@ -249,8 +250,8 @@ private: bool hb_ExpandFile(BITFILE *input, tVirtualFile *output); void hb_compress_data(tVirtualFile *input, BITFILE *output, tH0Code *codes); void hb_expand_data(BITFILE *input, tVirtualFile *output, tH0Node *nodes, int root_node); - void hb_count_bytes(tVirtualFile *input, ulong *long_counts); - void hb_scale_counts(ulong *long_counts, tH0Node *nodes); + void hb_count_bytes(tVirtualFile *input, uint32_t *long_counts); + void hb_scale_counts(uint32_t *long_counts, tH0Node *nodes); int hb_build_tree(tH0Node *nodes); void hb_convert_tree_to_code(tH0Node *nodes, tH0Code *codes, uint code_so_far, int bits, int node); void hb_output_counts(BITFILE *output, tH0Node *nodes); diff --git a/lib/Controller.h b/lib/Controller.h index ed6a0a9a..2b092181 100644 --- a/lib/Controller.h +++ b/lib/Controller.h @@ -116,6 +116,8 @@ #ifndef CONTROLLER_H #define CONTROLLER_H +#include + #include "pstypes.h" #include "Macros.h" diff --git a/lib/appdatabase.h b/lib/appdatabase.h index 815c6033..a29e1d0e 100644 --- a/lib/appdatabase.h +++ b/lib/appdatabase.h @@ -83,7 +83,7 @@ public: virtual bool write(const char *label, int entry) = 0; // get the current user's name. - virtual void get_user_name(char *buffer, ulong *size) = 0; + virtual void get_user_name(char *buffer, size_t *size) = 0; }; // JCA: moved these from the Win32Database diff --git a/lib/application.h b/lib/application.h index 8ee6e1e4..7dcc45ad 100644 --- a/lib/application.h +++ b/lib/application.h @@ -110,7 +110,7 @@ public: Win32 Samir Win32App.h 06/97 */ #if defined(WIN32) -#include "win\Win32App.h" +#include "win\win32app.h" #elif defined(__LINUX__) #include "lnxapp.h" #endif diff --git a/lib/audio_encode.h b/lib/audio_encode.h index fbf67ff7..0eb44e14 100644 --- a/lib/audio_encode.h +++ b/lib/audio_encode.h @@ -40,8 +40,8 @@ // input_channels (default 1) // input_factor (compression factor) (default 4 for 22K, 8 for 44K) // input_volscale (Volume scaling) (slightly <= 1.0, default ,97) -int aenc_Compress(char *input_filename, char *output_filename, int *input_levels = NULL, int *input_samples = NULL, - int *input_rate = NULL, int *input_channels = NULL, float *input_factor = NULL, - float *input_volscale = NULL); +bool aenc_Compress(char *input_filename, char *output_filename, int *input_levels = nullptr, int *input_samples = nullptr, + int *input_rate = nullptr, int *input_channels = nullptr, float *input_factor = nullptr, + float *input_volscale = nullptr); #endif diff --git a/lib/bitmap.h b/lib/bitmap.h index bc67c2d2..92262ef6 100644 --- a/lib/bitmap.h +++ b/lib/bitmap.h @@ -74,7 +74,7 @@ typedef struct chunked_bitmap { int *bm_array; // array of bitmap handles. } chunked_bitmap; extern bms_bitmap GameBitmaps[MAX_BITMAPS]; -extern ulong Bitmap_memory_used; +extern uint32_t Bitmap_memory_used; // Sets all the bitmaps to unused void bm_InitBitmaps(); diff --git a/lib/ddio.h b/lib/ddio.h index 42f45a94..b3bd2852 100644 --- a/lib/ddio.h +++ b/lib/ddio.h @@ -193,6 +193,7 @@ class oeApplication; #include +#include #include "pstypes.h" #include "ddio_common.h" @@ -238,7 +239,7 @@ void timer_Close(); float timer_GetTime(); // returns time in milliseconds -longlong timer_GetMSTime(); +int64_t timer_GetMSTime(); // hook in timer function at certain period. returns a handle to this function //@@int timer_HookFunction(void (*fncptr)(), int period); diff --git a/lib/forcefeedback.h b/lib/forcefeedback.h index 20e5da50..d1ca6b95 100644 --- a/lib/forcefeedback.h +++ b/lib/forcefeedback.h @@ -72,6 +72,7 @@ */ #ifndef __DDIO_FORCEFEEDBACK_H_ #define __DDIO_FORCEFEEDBACK_H_ +#include #include "pstypes.h" #include "string.h" #define kMAX_Str 80 @@ -162,31 +163,31 @@ typedef enum { kMaxEffectSubTypes } tEffType; typedef struct tEffectConstant { - long Mag; // +- 10,000 + int32_t Mag; // +- 10,000 } tEffConstant; typedef struct tEffectRamp { - long Start; // +- 10,000 - long End; // +- 10,000 + int32_t Start; // +- 10,000 + int32_t End; // +- 10,000 } tEffRamp; typedef struct tEffectWave { unsigned int Mag; // 0 to 10,000 - long Offset; // +- 10,000 + int32_t Offset; // +- 10,000 unsigned int Phase; // 0 to 35,999 unsigned int Period; } tEffWave; typedef struct tEffectCondition { - long Offset; // +- 10,000 - long PositiveCoefficient; // +- 10,000 - long NegativeCoefficient; // +- 10,000 + int32_t Offset; // +- 10,000 + int32_t PositiveCoefficient; // +- 10,000 + int32_t NegativeCoefficient; // +- 10,000 unsigned int PositiveSaturation; // 0 to 10,000 unsigned int NegativeSaturation; // 0 to 10,000 - long DeadBand; // 0 to 10,000 + int32_t DeadBand; // 0 to 10,000 } tEffCondition; typedef struct tEffectCustom { int Channels; int Period; int Samples; - long *ForceData; + int32_t *ForceData; } tEffCustom; typedef union tEffectInfo { tEffConstant Constant; @@ -213,7 +214,7 @@ typedef struct tFFB_Effect { tEffAxis Axis; tJoyButtons Trigger; unsigned int TriggerRepeatTime; - long Direction; // 0 to 360 deg. + int32_t Direction; // 0 to 360 deg. tEffEnvelope Envelope; } tFFB_Effect; extern bool ddForce_found; // a Force Feedback device was found diff --git a/lib/gameos.h b/lib/gameos.h index 34f98744..21a3be65 100644 --- a/lib/gameos.h +++ b/lib/gameos.h @@ -138,7 +138,7 @@ public: virtual bool write(const char *label, int *entry) = 0; // get the current user's name from the os - virtual void get_user_name(char *buffer, ulong *size) = 0; + virtual void get_user_name(char *buffer, size_t *size) = 0; }; // Data structures typedef struct os_date { diff --git a/lib/joystick.h b/lib/joystick.h index 7e4f8820..5eaa374d 100644 --- a/lib/joystick.h +++ b/lib/joystick.h @@ -65,6 +65,8 @@ #ifndef JOYSTICK_H #define JOYSTICK_H +#include + // joystick ids. used to initialize a stick and get its position #define MAX_JOYSTICKS 8 #define JOYPOV_NUM 4 diff --git a/lib/linux/lnxdatabase.h b/lib/linux/lnxdatabase.h index a3b8097a..32f839ca 100644 --- a/lib/linux/lnxdatabase.h +++ b/lib/linux/lnxdatabase.h @@ -63,7 +63,7 @@ public: virtual bool write(const char *label, int entry); // get the current user's name. - virtual void get_user_name(char *buffer, ulong *size); + virtual void get_user_name(char *buffer, size_t *size); }; // Handy macro to read an int without having to specify the wordsize diff --git a/lib/linux/oelnx_os.h b/lib/linux/oelnx_os.h index aa191979..596ba548 100644 --- a/lib/linux/oelnx_os.h +++ b/lib/linux/oelnx_os.h @@ -106,7 +106,7 @@ public: virtual bool write(const char *label, int *entry); // get the current user's name from the os - virtual void get_user_name(char *buffer, ulong *size); + virtual void get_user_name(char *buffer, size_t *size); protected: // Additional Macintosh Functions, return true if successful diff --git a/lib/mvelibw.h b/lib/mvelibw.h index 9a52cf03..4e6bf989 100644 --- a/lib/mvelibw.h +++ b/lib/mvelibw.h @@ -59,8 +59,8 @@ void __cdecl MVE_sndInit(LPDIRECTSOUND lpDS); ** thru 10,000 (left -100db, right full volume). ** The default value for volume and pan is zero. */ -void __cdecl MVE_dsbSetVolume(long lVolume); -void __cdecl MVE_dsbSetPan(long lPan); +void __cdecl MVE_dsbSetVolume(int32_t lVolume); +void __cdecl MVE_dsbSetPan(int32_t lPan); /* Only call this function to configure software to work with a Super VGA diff --git a/lib/networking.h b/lib/networking.h index f1eeaeb8..b111c289 100644 --- a/lib/networking.h +++ b/lib/networking.h @@ -157,6 +157,7 @@ #define NETWORKING_H #include "pstypes.h" +#include #if defined(WIN32) // Windows includes @@ -324,7 +325,13 @@ static inline void INADDR_GET_SUN_SUNB(struct in_addr *st, unsigned char *s_b1, #define NF_CHECKSUM 1 #define NF_NOSEQINC 2 -typedef enum { NP_NONE, NP_TCP, NP_IPX, NP_DIRECTPLAY } network_protocol; +enum network_protocol : uint32_t +{ + NP_NONE, + NP_TCP, + NP_IPX, + NP_DIRECTPLAY +}; typedef struct { ubyte address[6]; @@ -361,7 +368,7 @@ void nw_ConnectToServer(SOCKET *socket, network_address *server_addr); // Returns internet address format from string address format...ie "204.243.217.14" // turns into 1414829242 -unsigned long nw_GetHostAddressFromNumbers(char *str); +uint32_t nw_GetHostAddressFromNumbers(char *str); // Fills in the string with the string address from the internet address void nw_GetNumbersFromHostAddress(network_address *address, char *str); @@ -429,7 +436,7 @@ void nw_psnet_buffer_packet(ubyte *data, int length, network_address *from); int nw_psnet_buffer_get_next(ubyte *data, int *length, network_address *from); // get the index of the next packet in order! -int nw_psnet_buffer_get_next_by_dpid(ubyte *data, int *length, unsigned long dpid); +int nw_psnet_buffer_get_next_by_packet_id(ubyte *data, int *length, uint32_t packet_id); // This is all the reliable UDP stuff... #define MAXNETBUFFERS \ diff --git a/lib/psrand.h b/lib/psrand.h index 4cccfb36..74006433 100644 --- a/lib/psrand.h +++ b/lib/psrand.h @@ -34,6 +34,7 @@ * $NoKeywords: $ */ +#include #undef RAND_MAX #define RAND_MAX 0x7fff diff --git a/lib/rtperformance.h b/lib/rtperformance.h index 8414a76a..d568e1ca 100644 --- a/lib/rtperformance.h +++ b/lib/rtperformance.h @@ -34,7 +34,7 @@ // use INT64 for 64bit integers #ifdef USE_RTP #if defined(__LINUX__) -#define INT64 long long +#define INT64 int64_t #else #define INT64 signed __int64 #endif diff --git a/lib/texture.h b/lib/texture.h index 46928da4..57cb0675 100644 --- a/lib/texture.h +++ b/lib/texture.h @@ -123,9 +123,9 @@ extern void (*Texture_functions[])(g3Point *, int); // Our shade tables extern ubyte TexShadeTable8[MAX_TEXTURE_SHADES][256]; -extern ulong TexShadeTable16[MAX_TEXTURE_SHADES][256]; +extern uint32_t TexShadeTable16[MAX_TEXTURE_SHADES][256]; extern ubyte TexRevShadeTable8[MAX_TEXTURE_SHADES][256]; -extern ulong TexRevShadeTable16[MAX_TEXTURE_SHADES][256]; +extern uint32_t TexRevShadeTable16[MAX_TEXTURE_SHADES][256]; int tex_Init(); diff --git a/lib/unzip.h b/lib/unzip.h index 7ba8ddd3..2077866b 100644 --- a/lib/unzip.h +++ b/lib/unzip.h @@ -38,6 +38,7 @@ #ifndef __UNZIP_H #define __UNZIP_H +#include #include #include "pstypes.h" @@ -120,7 +121,7 @@ private: bool m_open; char *m_zip; // zip name FILE *m_fp; // zip handler - long m_length; // length of zip file + int32_t m_length; // length of zip file char *m_ecd; // end_of_cent_dir data unsigned m_ecd_length; // end_of_cent_dir length diff --git a/lib/win/win32database.h b/lib/win/win32database.h index ef556eb0..b77fd7af 100644 --- a/lib/win/win32database.h +++ b/lib/win/win32database.h @@ -84,7 +84,7 @@ public: virtual bool write(const char *label, int entry); // get the current user's name. - virtual void get_user_name(char *buffer, ulong *size); + virtual void get_user_name(char *buffer, size_t *size); }; // pass name of dll which contains desired language diff --git a/lib/win/wincontroller.h b/lib/win/wincontroller.h index 04347325..712c79f1 100644 --- a/lib/win/wincontroller.h +++ b/lib/win/wincontroller.h @@ -290,7 +290,7 @@ private: } m_ExtCtlStates[CT_MAX_EXTCTLS]; // thread info. - longlong m_frame_timer_ms; + int64_t m_frame_timer_ms; float m_frame_time; // note id is id value from controller in control list. diff --git a/libacm/aencode.cpp b/libacm/aencode.cpp index e76096c5..326e0385 100644 --- a/libacm/aencode.cpp +++ b/libacm/aencode.cpp @@ -929,7 +929,7 @@ void WriteBands(Encoder &enc) { for (int i = 0; i < enc.m_numColumns; ++i) { const uint32 formatId = enc.m_pFormatIdPerColumn[i]; enc.m_bits.WriteBits(formatId, 5); - int currPos = ftell(enc.m_bits.m_outFile); +// int32_t currPos = ftell(enc.m_bits.m_outFile); WriteBand_tbl[formatId](enc, i, formatId); } } @@ -993,7 +993,7 @@ void EncodeFlush(Encoder &enc) { ProcessBlock(enc); } -unsigned int AudioEncode(ReadSampleFunction *read, void *data, unsigned channels, unsigned sample_rate, float volume, +int32_t AudioEncode(ReadSampleFunction *read, void *data, unsigned channels, unsigned sample_rate, float volume, FILE *out, int levels, int samples_per_subband, float comp_ratio) { Encoder enc; memset(&enc, 0, sizeof(enc)); @@ -1016,7 +1016,7 @@ unsigned int AudioEncode(ReadSampleFunction *read, void *data, unsigned channels enc.m_threshold = (sint32)(float(enc.m_samplesPerBlock) * comp_ratio * 16.0f); - int originalPosVAR64 = ftell(out); + int32_t originalPosVAR64 = ftell(out); // Header enc.m_bits.WriteBits(0x97, 8); @@ -1073,13 +1073,13 @@ unsigned int AudioEncode(ReadSampleFunction *read, void *data, unsigned channels ///////////// // Go back and write the Sample Count out proper - int endPos = ftell(out); - fseek(out, originalPosVAR64 + 4, 0); + int32_t endPos = ftell(out); + fseek(out, originalPosVAR64 + 4, SEEK_SET); putc((enc.m_sampleCount >> 0) & 0xFF, out); putc((enc.m_sampleCount >> 8) & 0xFF, out); putc((enc.m_sampleCount >> 16) & 0xFF, out); putc((enc.m_sampleCount >> 24) & 0xFF, out); - fseek(out, endPos, 0); + fseek(out, endPos, SEEK_SET); DestroyEncoder(enc); return endPos; diff --git a/libmve/lnxdsound.cpp b/libmve/lnxdsound.cpp index e6c75ef1..debe6806 100644 --- a/libmve/lnxdsound.cpp +++ b/libmve/lnxdsound.cpp @@ -666,8 +666,8 @@ static unsigned int LinuxSoundMixNormalize(LnxSoundBuffer *dsb, unsigned char *b int DoMulDiv(int nNumber, int nNumerator, int nDenominator) { if (!nDenominator) return -1; - long long ret; - ret = (((long long)nNumber * nNumerator) + (nDenominator / 2)) / nDenominator; + int64_t ret; + ret = (((int64_t)nNumber * nNumerator) + (nDenominator / 2)) / nDenominator; if ((ret > 0x7FFFFFFF) || (ret < 0xFFFFFFFF)) return -1; diff --git a/libmve/mvelibi.h b/libmve/mvelibi.h index 5e120b2a..bc8de448 100644 --- a/libmve/mvelibi.h +++ b/libmve/mvelibi.h @@ -60,10 +60,6 @@ inline unsigned int IntelSwapper(unsigned int a) { return INTEL_INT(a); } inline int IntelSwapper(int a) { return INTEL_INT(a); } -inline unsigned long IntelSwapper(unsigned long a) { return INTEL_INT(a); } - -inline long IntelSwapper(long a) { return INTEL_INT(a); } - typedef struct _mve_hdr { char FileType[20]; // MVE_FILE_TYPE unsigned short HdrSize; // sizeof(mve_hdr) @@ -121,7 +117,7 @@ typedef struct _mcmd_hdr { #define mcmd_syncInit 2 typedef struct _syncInit { - unsigned long period; // period of quanta + uint32_t period; // period of quanta unsigned short wait_quanta; // # of quanta per frame void SwapBytes() { period = IntelSwapper(period); @@ -149,7 +145,7 @@ typedef struct _sndConfigure { #endif unsigned short frequency; // Minor opcode 1 extends buflen to be a long - unsigned long buflen; + uint32_t buflen; void SwapBytes() { rate = IntelSwapper(rate); frequency = IntelSwapper(frequency); @@ -279,13 +275,13 @@ typedef struct _palLoadPalette { #define mcmd_nfPkInfo 19 #define mcmd_nfHPkInfo 20 typedef struct _nfPkInfo { - unsigned long error; // scaled by 10000 + uint32_t error; // scaled by 10000 unsigned short usage[64]; } marg_nfPkInfo; #define mcmd_idcode 21 typedef struct _idcode { - unsigned long idcode; // Code identifying version mcomp used to create + uint32_t idcode; // Code identifying version mcomp used to create } marg_idcode; #if __SC__ diff --git a/libmve/mvelibl.cpp b/libmve/mvelibl.cpp index cf2f249d..f35f2d69 100644 --- a/libmve/mvelibl.cpp +++ b/libmve/mvelibl.cpp @@ -142,7 +142,7 @@ static void syncReset(unsigned int wait_quanta) { static void syncRelease(void) { sync_active = false; } static bool syncInit(unsigned int period, unsigned wait_quanta) { - int new_wait_quanta = -(long)(period * wait_quanta + (wait_quanta >> 1)); + int new_wait_quanta = -(int32_t)(period * wait_quanta + (wait_quanta >> 1)); // If timer is still running and has same timing // characteristics, assume we are trying to continue smoothly @@ -292,8 +292,8 @@ static int snd_pad = 0; static unsigned snd_stereo = 0; static unsigned snd_comp16 = 0; static unsigned snd_bits16 = 0; -static long snd_volume = 0; -static long snd_pan = 0; +static int32_t snd_volume = 0; +static int32_t snd_pan = 0; #endif @@ -303,7 +303,7 @@ void MVE_sndInit(ISoundDevice *lpDS) { #endif } -void MVE_dsbSetVolume(long lVolume) { +void MVE_dsbSetVolume(int32_t lVolume) { #if SOUND_SUPPORT snd_volume = lVolume; if (snd_buffer) { @@ -312,7 +312,7 @@ void MVE_dsbSetVolume(long lVolume) { #endif } -void MVE_dsbSetPan(long lPan) { +void MVE_dsbSetPan(int32_t lPan) { #if SOUND_SUPPORT snd_pan = lPan; if (snd_buffer) { diff --git a/libmve/mvelibl.h b/libmve/mvelibl.h index f417db17..aa999222 100644 --- a/libmve/mvelibl.h +++ b/libmve/mvelibl.h @@ -20,6 +20,8 @@ #ifndef MVELIB_H_INCLUDED #define MVELIB_H_INCLUDED +#include + #include "SystemInterfaces.h" #if defined(__LINUX__) #include "lnxdsound.h" @@ -50,8 +52,8 @@ void MVE_sndInit(ISoundDevice *lpDS); // Pan ranges from -10,000 (left full volume, right -100db), thru 0 (both full), // thru 10,000 (left -100db, right full volume). // The default value for volume and pan is zero. -void MVE_dsbSetVolume(long lVolume); -void MVE_dsbSetPan(long lPan); +void MVE_dsbSetVolume(int32_t lVolume); +void MVE_dsbSetPan(int32_t lPan); // Only call this function to configure software to work with a Super VGA // mode if you do not have VESA support. diff --git a/linux/lnxcontroller.cpp b/linux/lnxcontroller.cpp index 71c731cd..d0b1e800 100644 --- a/linux/lnxcontroller.cpp +++ b/linux/lnxcontroller.cpp @@ -62,7 +62,7 @@ #define MOUSE_DEADZONE 0.00f static float WinControllerTimer = 0.0f; -static longlong g_last_frame_timer_ms = -1; +static int64_t g_last_frame_timer_ms = -1; static float g_accum_frame_time = 0.0f; lnxgameController::lnxgameController(int num_funcs, ct_function *funcs) : gameController(num_funcs, funcs) { @@ -98,7 +98,7 @@ void lnxgameController::resume() { // this functions polls the controllers if needed. some systems may not need to implement // this function. void lnxgameController::poll() { - longlong cur_frame_timer_ms; + int64_t cur_frame_timer_ms; if (m_Suspended) return; diff --git a/linux/lnxcontroller.h b/linux/lnxcontroller.h index fc6bf70e..6611281d 100644 --- a/linux/lnxcontroller.h +++ b/linux/lnxcontroller.h @@ -178,7 +178,7 @@ private: } m_ExtCtlStates[CT_MAX_EXTCTLS]; // thread info. - longlong m_frame_timer_ms; + int64_t m_frame_timer_ms; float m_frame_time; // note id is id value from controller in control list. diff --git a/linux/lnxdata.cpp b/linux/lnxdata.cpp index ef1242f4..27866e05 100644 --- a/linux/lnxdata.cpp +++ b/linux/lnxdata.cpp @@ -207,7 +207,7 @@ bool oeLnxAppDatabase::write(const char *label, int entry) { } // get the current user's name from the os -void oeLnxAppDatabase::get_user_name(char *buffer, ulong *size) { +void oeLnxAppDatabase::get_user_name(char *buffer, size_t *size) { struct passwd *pwuid = getpwuid(geteuid()); if ((pwuid != NULL) && (pwuid->pw_name != NULL)) { diff --git a/lnxmvelib/lnxdsound.cpp b/lnxmvelib/lnxdsound.cpp index 975e1842..739e7077 100644 --- a/lnxmvelib/lnxdsound.cpp +++ b/lnxmvelib/lnxdsound.cpp @@ -650,8 +650,8 @@ static unsigned int LinuxSoundMixNormalize(LnxSoundBuffer *dsb, unsigned char *b int DoMulDiv(int nNumber, int nNumerator, int nDenominator) { if (!nDenominator) return -1; - long long ret; - ret = (((long long)nNumber * nNumerator) + (nDenominator / 2)) / nDenominator; + int64_t ret; + ret = (((int64_t)nNumber * nNumerator) + (nDenominator / 2)) / nDenominator; if ((ret > 0x7FFFFFFF) || (ret < 0xFFFFFFFF)) return -1; diff --git a/lnxmvelib/mvelibl.cpp b/lnxmvelib/mvelibl.cpp index 9589fcbb..25fd57ad 100644 --- a/lnxmvelib/mvelibl.cpp +++ b/lnxmvelib/mvelibl.cpp @@ -144,7 +144,7 @@ static void syncReset(unsigned int wait_quanta) { static void syncRelease(void) { sync_active = FALSE; } static bool syncInit(unsigned int period, unsigned wait_quanta) { - int new_wait_quanta = -(long)(period * wait_quanta + (wait_quanta >> 1)); + int new_wait_quanta = -(int32_t)(period * wait_quanta + (wait_quanta >> 1)); // If timer is still running and has same timing // characteristics, assume we are trying to continue smoothly // with another movie and ignore new syncInit() call. @@ -293,8 +293,8 @@ static unsigned snd_stereo; static unsigned snd_comp16; static unsigned snd_bits16; -static long snd_volume = 0; -static long snd_pan = 0; +static int32_t snd_volume = 0; +static int32_t snd_pan = 0; #endif @@ -304,7 +304,7 @@ void MVE_sndInit(LnxSoundDevice *lpDS) { #endif } -void MVE_dsbSetVolume(long lVolume) { +void MVE_dsbSetVolume(int32_t lVolume) { #if SOUND_SUPPORT snd_volume = lVolume; if (snd_buffer) @@ -312,7 +312,7 @@ void MVE_dsbSetVolume(long lVolume) { #endif } -void MVE_dsbSetPan(long lPan) { +void MVE_dsbSetPan(int32_t lPan) { #if SOUND_SUPPORT snd_pan = lPan; if (snd_buffer) diff --git a/lnxmvelib/mvelibl.h b/lnxmvelib/mvelibl.h index 964fc374..71770bee 100644 --- a/lnxmvelib/mvelibl.h +++ b/lnxmvelib/mvelibl.h @@ -57,8 +57,8 @@ void MVE_sndInit(LnxSoundDevice *lpDS); ** thru 10,000 (left -100db, right full volume). ** The default value for volume and pan is zero. */ -void MVE_dsbSetVolume(long lVolume); -void MVE_dsbSetPan(long lPan); +void MVE_dsbSetVolume(int32_t lVolume); +void MVE_dsbSetPan(int32_t lPan); /* Only call this function to configure software to work with a Super VGA ** mode if you do not have VESA support. diff --git a/manage/manage.cpp b/manage/manage.cpp index 0a7ee429..cd75a431 100644 --- a/manage/manage.cpp +++ b/manage/manage.cpp @@ -564,7 +564,7 @@ void Read256TextureNames(); // Sets up our table files, get their filenames, etc. // Returns 1 on success, zero on error int mng_InitTableFiles() { - ulong size = TABLE_NAME_LEN; + size_t size = TABLE_NAME_LEN; int answer; Database->get_user_name(TableUser, &size); if (FindArg("-filter")) diff --git a/mem/mem.cpp b/mem/mem.cpp index 85dd9ff2..e48d5a7a 100644 --- a/mem/mem.cpp +++ b/mem/mem.cpp @@ -206,6 +206,7 @@ #include #else #endif +#include #include "init.h" #include "mem.h" @@ -393,7 +394,7 @@ void mem_Init() { mprintf((0, "Available virtual memory : %d\n", ms.dwAvailPageFile)); // See if there is enough memory to run - if (((longlong)ms.dwAvailPageFile + ms.dwAvailPhys) < (50 * 1024 * 1024)) { + if (((int64_t)ms.dwAvailPageFile + ms.dwAvailPhys) < (50 * 1024 * 1024)) { Error("Your system doesn't have enough available memory to continue.\r\n\r\nMemory Statistics:\r\nTotal Physical: " "%d\r\nAvaliable Physical: %d\r\nAvailable Virtual: %d\r\n\r\nYou may be able to continue by rebooting, or " "freeing up some disk space.", diff --git a/misc/psrand.cpp b/misc/psrand.cpp index 19e9d55d..cd67c438 100644 --- a/misc/psrand.cpp +++ b/misc/psrand.cpp @@ -36,10 +36,10 @@ #include "psrand.h" -static long ps_holdrand = 1L; +static int32_t ps_holdrand = 1L; // These are adapted from the C runtime lib. Pretty simple. -void ps_srand(unsigned int seed) { ps_holdrand = (long)seed; } +void ps_srand(unsigned int seed) { ps_holdrand = (int32_t)seed; } int ps_rand(void) { return (((ps_holdrand = ps_holdrand * 214013L + 2531011L) >> 16) & 0x7fff); } diff --git a/networking/networking.cpp b/networking/networking.cpp index 2b80b009..0a694819 100644 --- a/networking/networking.cpp +++ b/networking/networking.cpp @@ -365,7 +365,7 @@ network_protocol NetworkProtocol = NP_NONE; int Sockets_initted = 0; int Network_initted = 0; -unsigned long Net_fixed_ip = INADDR_NONE; +uint32_t Net_fixed_ip = INADDR_NONE; // sockets for IPX and TCP SOCKET TCP_socket; @@ -827,7 +827,7 @@ void nw_GetMyAddress(network_address *addr) { // Returns internet address format from string address format...ie "204.243.217.14" // turns into 1414829242 -unsigned long nw_GetHostAddressFromNumbers(char *str) { +uint32_t nw_GetHostAddressFromNumbers(char *str) { // ASSERT (NetworkProtocol==NP_TCP); return inet_addr(str); @@ -975,7 +975,7 @@ int nw_ReceiveReliable(SOCKET socketid, ubyte *buffer, int max_len) { dp_DirectPlayDispatch(); // try and get a free buffer and return its size - if (nw_psnet_buffer_get_next_by_dpid((ubyte *)buffer, &max_len, socketid)) { + if (nw_psnet_buffer_get_next_by_packet_id((ubyte *)buffer, &max_len, socketid)) { return max_len; } return 0; @@ -1879,7 +1879,7 @@ void nw_psnet_buffer_packet(ubyte *data, int length, network_address *from) { // MTS: only used in this file // get the index of the next packet in order! -int nw_psnet_buffer_get_next_by_dpid(ubyte *data, int *length, unsigned long dpid) { +int nw_psnet_buffer_get_next_by_packet_id(ubyte *data, int *length, uint32_t packet_id) { int idx; int found_buf = 0; @@ -1890,10 +1890,10 @@ int nw_psnet_buffer_get_next_by_dpid(ubyte *data, int *length, unsigned long dpi // search until we find the lowest packet index id# for (idx = 0; idx < MAX_PACKET_BUFFERS; idx++) { - unsigned long *thisid; - thisid = (unsigned long *)&Psnet_buffers[idx].from_addr.address; + uint32_t *thisid; + thisid = (uint32_t *)&Psnet_buffers[idx].from_addr.address; // if we found the buffer - if ((Psnet_buffers[idx].sequence_number == Psnet_lowest_id) && (dpid == *thisid)) { + if ((Psnet_buffers[idx].sequence_number == Psnet_lowest_id) && (packet_id == *thisid)) { found_buf = 1; break; } @@ -1960,7 +1960,7 @@ unsigned int psnet_ras_status() { unsigned long size, num_connections, i; RASCONN rasbuffer[25]; HINSTANCE ras_handle; - unsigned long rasip = 0; + uint32_t rasip = 0; RASPPPIP projection; int Ras_connected; diff --git a/scripts/lnx/osiris_common.h b/scripts/lnx/osiris_common.h index 3e250e9b..93653deb 100644 --- a/scripts/lnx/osiris_common.h +++ b/scripts/lnx/osiris_common.h @@ -931,7 +931,6 @@ typedef unsigned char ubyte; typedef signed char sbyte; typedef unsigned short ushort; typedef unsigned int uint; -typedef unsigned long ulong; typedef unsigned int ddgr_color; #ifndef NULL diff --git a/scripts/lnx/osiris_vector.h b/scripts/lnx/osiris_vector.h index 3bab1438..cc4d4fac 100644 --- a/scripts/lnx/osiris_vector.h +++ b/scripts/lnx/osiris_vector.h @@ -33,7 +33,7 @@ const vector Zero_vector = {0.0f, 0.0f, 0.0f}; typedef unsigned short angle; // The basic fixed-point type -typedef long fix; +typedef int32_t fix; #define PI 3.141592654 @@ -67,7 +67,7 @@ fix FloatToFixFast(float num); //??#define FloatToFix(num) Round((num) * FLOAT_SCALER) #define FloatToFix(num) ((fix)((num) * FLOAT_SCALER)) #define IntToFix(num) ((num) << FIX_SHIFT) -#define ShortToFix(num) (((long)(num)) << FIX_SHIFT) +#define ShortToFix(num) (((int32_t)(num)) << FIX_SHIFT) #define FixToFloat(num) (((float)(num)) / FLOAT_SCALER) #define FixToInt(num) ((num) >> FIX_SHIFT) #define FixToShort(num) ((short)((num) >> FIX_SHIFT)) diff --git a/scripts/osiris_common.h b/scripts/osiris_common.h index 5b6d82e8..9a97b039 100644 --- a/scripts/osiris_common.h +++ b/scripts/osiris_common.h @@ -932,7 +932,6 @@ typedef unsigned char ubyte; typedef signed char sbyte; typedef unsigned short ushort; typedef unsigned int uint; -typedef unsigned long ulong; typedef unsigned int ddgr_color; #ifndef NULL diff --git a/sndlib/ddsoundload.cpp b/sndlib/ddsoundload.cpp index 996f9287..97498e06 100644 --- a/sndlib/ddsoundload.cpp +++ b/sndlib/ddsoundload.cpp @@ -122,12 +122,12 @@ char SoundLoadWaveFile(const char *filename, float percent_volume, int sound_fil char format_type[80]; // ASCII name of format type unsigned short fmttag = 0; // Numerical format type - unsigned long ckid; // Current chunk's ID - unsigned long cksize; // Current chunk's size in bytes - unsigned long filesize; // Size of the sound file - unsigned long nextseek = 0; // Location of the next seek + uint32_t ckid; // Current chunk's ID + uint32_t cksize; // Current chunk's size in bytes + uint32_t filesize; // Size of the sound file + uint32_t nextseek = 0; // Location of the next seek - unsigned long aligned_size; // Sound files are aligned to SOUND_FILE_SAMPLE_ALIGNMENT samples + uint32_t aligned_size; // Sound files are aligned to SOUND_FILE_SAMPLE_ALIGNMENT samples // Sound format information int samples_per_second; @@ -135,7 +135,7 @@ char SoundLoadWaveFile(const char *filename, float percent_volume, int sound_fil short number_channels; // Used to read temporary long values - unsigned long temp_long; + uint32_t temp_long; // Flags for if we previously read data or a format char f_data, f_fmt = 0; @@ -169,7 +169,7 @@ char SoundLoadWaveFile(const char *filename, float percent_volume, int sound_fil paged_in_count += cfilelength(cfptr); paged_in_num++; // Make sure that it is a RIFF format - temp_long = (unsigned long)cf_ReadInt(cfptr); + temp_long = (uint32_t)cf_ReadInt(cfptr); if (temp_long != 0x46464952) { mprintf((0, "SOUND LOADER: %s is not a RIFF format file\n", filename)); goto error_state; @@ -180,7 +180,7 @@ char SoundLoadWaveFile(const char *filename, float percent_volume, int sound_fil filesize += cftell(cfptr); // Make sure it is a wave file - temp_long = (unsigned long)cf_ReadInt(cfptr); + temp_long = (uint32_t)cf_ReadInt(cfptr); if (temp_long != 0x45564157) { mprintf((0, "SOUND LOADER: %s is not a WAVE file\n", filename)); goto error_state; diff --git a/sndlib/eax.cpp b/sndlib/eax.cpp index 7e0b1584..99facc54 100644 --- a/sndlib/eax.cpp +++ b/sndlib/eax.cpp @@ -257,12 +257,12 @@ bool EAX_SetEnvironmentalReverb(float volume, float damping, float decay) { for (i = 0; i < EAX_ENVIRONMENT_COUNT; i++) { if (volume == EAX_Environments[i].fVolume && damping == EAX_Environments[i].fDamping && decay == EAX_Environments[i].fDecayTime_sec) { - EAX.m_preset.environment = (ulong)i; + EAX.m_preset.environment = (uint32_t)i; break; } } if (FAILED(EAX.m_lpksps->Set(DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_ENVIRONMENT, NULL, 0, - &EAX.m_preset.environment, sizeof(ulong)))) { + &EAX.m_preset.environment, sizeof(uint32_t)))) { return false; } } else { diff --git a/stream_audio/streamaudio.cpp b/stream_audio/streamaudio.cpp index eb9007ab..4803844b 100644 --- a/stream_audio/streamaudio.cpp +++ b/stream_audio/streamaudio.cpp @@ -488,8 +488,8 @@ bool AudioStream::ReopenDigitalStream(ubyte fbufidx, int nbufs) { return false; } - long bytes_per_buf = (SAMPLES_PER_STREAM_BUF * granularity); - long filelen = (sample_count / channels) * granularity; + int32_t bytes_per_buf = (SAMPLES_PER_STREAM_BUF * granularity); + int32_t filelen = (sample_count / channels) * granularity; int nbuffers = filelen / bytes_per_buf; if (nbuffers >= 0 && nbuffers <= 1) { if (filelen > 0) { diff --git a/tests/byteswap_tests.cpp b/tests/byteswap_tests.cpp index ac38fae8..bf1c8b65 100644 --- a/tests/byteswap_tests.cpp +++ b/tests/byteswap_tests.cpp @@ -23,7 +23,7 @@ // This code taken from original byteswap.h for testing float conversion // It cannot convert negative float numbers in 64-bit systems, so testing only non-negative numbers -#define SWAPINT(x) (int)(((x) << 24) | (((unsigned long)(x)) >> 24) | (((x) & 0x0000ff00) << 8) | (((x) & 0x00ff0000) >> 8)) +#define SWAPINT(x) (int)(((x) << 24) | (((uint32_t)(x)) >> 24) | (((x) & 0x0000ff00) << 8) | (((x) & 0x00ff0000) >> 8)) // Stupid function to trick the compiler into letting me byteswap a float inline float SWAPFLOAT(float x) { diff --git a/ui/UISystem.cpp b/ui/UISystem.cpp index 249c3ffd..cc1bed98 100644 --- a/ui/UISystem.cpp +++ b/ui/UISystem.cpp @@ -502,7 +502,7 @@ int ui_DoFrame(bool input) { ui_DoWindowFocus(); // determine window with current input focus. res = ui_ProcessFocusedWindow(); // process focused window - // longlong cur_time = timer_GetMSTime(); + // int64_t cur_time = timer_GetMSTime(); while ((timer_GetTime() - UI_input.cur_time) < UI_FRAMETIME) { }; diff --git a/unzip/unzip.cpp b/unzip/unzip.cpp index d2ce7a45..a235a3db 100644 --- a/unzip/unzip.cpp +++ b/unzip/unzip.cpp @@ -503,7 +503,7 @@ int ZIP::ReadZipDataToFile(zipentry *ent, FILE *file) { int ZIP::SeekToCompressedData(zipentry *ent) { char buf[LFH_NAME]; - long offset; + int32_t offset; if (fseek(m_fp, ent->offset_lcl_hdr_frm_frst_disk, SEEK_SET) != 0) { return -1; diff --git a/win32/WinController.cpp b/win32/WinController.cpp index acaeb89d..9f9a2627 100644 --- a/win32/WinController.cpp +++ b/win32/WinController.cpp @@ -335,7 +335,7 @@ extern float Mouse_sensitivity; #define MOUSE_DEADZONE 0.00f static float WinControllerTimer = 0.0f; -static longlong g_last_frame_timer_ms = -1; +static int64_t g_last_frame_timer_ms = -1; static float g_accum_frame_time = 0.0f; // Functions to create and destroy a game controller object. @@ -375,7 +375,7 @@ gameWinController::~gameWinController() {} #define MOUSE_POLLING_TIME (1.0f / 20.0f) void gameWinController::poll() { - longlong cur_frame_timer_ms; + int64_t cur_frame_timer_ms; if (m_Suspended) return; diff --git a/win32/windata.cpp b/win32/windata.cpp index 989a350e..fd52eb7c 100644 --- a/win32/windata.cpp +++ b/win32/windata.cpp @@ -257,7 +257,7 @@ bool oeWin32AppDatabase::write(const char *label, int entry) { } // get the current user's name from the os -void oeWin32AppDatabase::get_user_name(char *buffer, ulong *size) { GetUserName(buffer, size); } +void oeWin32AppDatabase::get_user_name(char *buffer, size_t *size) { GetUserName(buffer, reinterpret_cast(size)); } ///////////////////////////////////////////////////////////////////////////////// // pass name of dll which contains desired language