From 8f43c6bf9fba585bc8c33282b124d2487a0e2a4e Mon Sep 17 00:00:00 2001 From: Knightmare66 Date: Sat, 1 Aug 2020 22:54:35 -0400 Subject: [PATCH] More 64-bit portability fixes. --- client/snd_mix.c | 6 +++--- client/snd_stream.c | 2 +- game/q_shared.c | 2 +- linux/gl_glx.c | 2 +- linux/rw_svgalib.c | 4 ++-- linux/rw_x11.c | 12 ++++++------ linux/sys_linux.c | 4 ++-- qcommon/files.c | 16 ++++++++-------- qcommon/md4.c | 2 +- renderer/r_cin.c | 4 ++-- renderer/r_image.c | 26 +++++++++++++------------- renderer/r_local.h | 2 +- renderer/r_model.c | 18 +++++++++--------- unix/gl_glx.c | 6 +++--- win32/cd_win.c | 45 ++++++++++++++++++++++++++------------------- win32/sys_console.c | 14 +++++--------- 16 files changed, 84 insertions(+), 81 deletions(-) diff --git a/client/snd_mix.c b/client/snd_mix.c index dd978da..5cffbea 100644 --- a/client/snd_mix.c +++ b/client/snd_mix.c @@ -108,7 +108,7 @@ LClampDone2: #endif #endif -void S_TransferStereo16 (unsigned long *pbuf, int endtime) +void S_TransferStereo16 (unsigned int /*long*/ *pbuf, int endtime) { int lpos; int lpaintedtime; @@ -151,9 +151,9 @@ void S_TransferPaintBuffer(int endtime) int *p; int step; int val; - unsigned long *pbuf; + unsigned int /*long*/ *pbuf; - pbuf = (unsigned long *)dma.buffer; + pbuf = (unsigned int /*long*/ *)dma.buffer; if (s_testsound->value) { diff --git a/client/snd_stream.c b/client/snd_stream.c index 4b81b8e..90ed7d3 100644 --- a/client/snd_stream.c +++ b/client/snd_stream.c @@ -110,7 +110,7 @@ static int ovc_close (void *datasource) } -static long ovc_tell (void *datasource) +static int /*long*/ ovc_tell (void *datasource) { bgTrack_t *track = (bgTrack_t *)datasource; diff --git a/game/q_shared.c b/game/q_shared.c index 4fdfb33..decf365 100644 --- a/game/q_shared.c +++ b/game/q_shared.c @@ -2147,7 +2147,7 @@ unsigned int Com_HashFileName (const char *fname, int hashSize, qboolean sized) letter = tolower(fname[i]); // if (letter == '.') break; if (letter == '\\') letter = '/'; // fix filepaths - hash += (long)(letter)*(i+119); + hash += (int)(letter)*(i+119); i++; } hash = (hash ^ (hash >> 10) ^ (hash >> 20)); diff --git a/linux/gl_glx.c b/linux/gl_glx.c index a876969..f5ea399 100644 --- a/linux/gl_glx.c +++ b/linux/gl_glx.c @@ -606,7 +606,7 @@ int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen ) Window root; XVisualInfo *visinfo; XSetWindowAttributes attr; - unsigned long mask; + unsigned int /*long*/ mask; int MajorVersion, MinorVersion; int actualWidth, actualHeight; int i; diff --git a/linux/rw_svgalib.c b/linux/rw_svgalib.c index 56e7279..a060e71 100644 --- a/linux/rw_svgalib.c +++ b/linux/rw_svgalib.c @@ -313,11 +313,11 @@ void SWimp_AppActivate( qboolean active ) Sys_MakeCodeWriteable ================ */ -void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length) +void Sys_MakeCodeWriteable (unsigned int startaddr, unsigned int length) { int r; - unsigned long addr; + unsigned int addr; int psize = getpagesize(); addr = (startaddr & ~(psize-1)) - psize; diff --git a/linux/rw_x11.c b/linux/rw_x11.c index 6df0699..e6c7b13 100644 --- a/linux/rw_x11.c +++ b/linux/rw_x11.c @@ -93,12 +93,12 @@ int config_notify_width; int config_notify_height; typedef unsigned short PIXEL16; -typedef unsigned long PIXEL24; +typedef unsigned int PIXEL24; static PIXEL16 st2d_8to16table[256]; static PIXEL24 st2d_8to24table[256]; static int shiftmask_fl=0; -static long r_shift,g_shift,b_shift; -static unsigned long r_mask,g_mask,b_mask; +static int r_shift,g_shift,b_shift; +static unsigned int r_mask,g_mask,b_mask; void shiftmask_init(void) { @@ -588,7 +588,7 @@ void ResetSharedFrameBuffers(void) (void *) shmat(x_shminfo[frm].shmid, 0, 0); ri.Con_Printf(PRINT_DEVELOPER, "MITSHM shared memory (id=%d, addr=0x%lx)\n", - x_shminfo[frm].shmid, (long) x_shminfo[frm].shmaddr); + x_shminfo[frm].shmid, (int) x_shminfo[frm].shmaddr); x_framebuffer[frm]->data = x_shminfo[frm].shmaddr; @@ -1233,11 +1233,11 @@ void SWimp_AppActivate( qboolean active ) Sys_MakeCodeWriteable ================ */ -void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length) +void Sys_MakeCodeWriteable (unsigned int startaddr, unsigned int length) { int r; - unsigned long addr; + unsigned int addr; int psize = getpagesize(); addr = (startaddr & ~(psize-1)) - psize; diff --git a/linux/sys_linux.c b/linux/sys_linux.c index 62b8cc9..01fc269 100644 --- a/linux/sys_linux.c +++ b/linux/sys_linux.c @@ -501,11 +501,11 @@ void Sys_CopyProtect(void) Sys_MakeCodeWriteable ================ */ -void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length) +void Sys_MakeCodeWriteable (unsigned int startaddr, unsigned int length) { int r; - unsigned long addr; + unsigned int addr; int psize = getpagesize(); addr = (startaddr & ~(psize-1)) - psize; diff --git a/qcommon/files.c b/qcommon/files.c index a85b689..dc32982 100644 --- a/qcommon/files.c +++ b/qcommon/files.c @@ -86,7 +86,7 @@ instruct clients to write files over areas they shouldn't. typedef struct { char name[MAX_QPATH]; - long hash; // To speed up searching + unsigned int hash; // To speed up searching int size; int offset; // This is ignored in PK3 files qboolean ignore; // Whether this file should be ignored @@ -500,7 +500,7 @@ Performs a binary search by hashed filename to find pack items in a sorted pack ================= */ -int FS_FindPackItem (fsPack_t *pack, char *itemName, long itemHash) +int FS_FindPackItem (fsPack_t *pack, char *itemName, unsigned int itemHash) { int smax, smin, smidpt; //, counter = 0; int i; //, matchStart, matchEnd; @@ -628,7 +628,7 @@ int FS_FOpenFileRead (fsHandle_t *handle) fsSearchPath_t *search; fsPack_t *pack; char path[MAX_OSPATH]; - long hash; + unsigned int hash; int i; unsigned int typeFlag; @@ -1203,7 +1203,7 @@ int FS_FTell (fileHandle_t f) handle = FS_GetFileByHandle(f); if (handle->pakFile) { // inside .pak file uses offset/size - long pos = ftell(handle->file); + int pos = ftell(handle->file); if (pos != -1) pos -= handle->pakFile->offset; return pos; @@ -1589,7 +1589,7 @@ int FS_Tell (fileHandle_t f) handle = FS_GetFileByHandle(f); if (handle->pakFile) { // inside .pak file uses offset/size - long pos = ftell(handle->file); + int pos = ftell(handle->file); if (pos != -1) pos -= handle->pakFile->offset; return pos; @@ -1867,7 +1867,7 @@ FS_PakFileCompare Used for sorting pak entries by hash ================= */ -long *nameHashes = NULL; +unsigned int *nameHashes = NULL; int FS_PakFileCompare (const void *f1, const void *f2) { if (!nameHashes) @@ -1899,7 +1899,7 @@ fsPack_t *FS_LoadPAK (const char *packPath) unsigned contentFlags = 0; #ifdef BINARY_PACK_SEARCH int *sortIndices; - long *sortHashes; + unsigned int *sortHashes; #endif // BINARY_PACK_SEARCH handle = fopen(packPath, "rb"); @@ -2030,7 +2030,7 @@ fsPack_t *FS_LoadPK3 (const char *packPath) #ifdef BINARY_PACK_SEARCH fsPackFile_t *tmpFiles; int *sortIndices; - long *sortHashes; + unsigned int *sortHashes; #endif // BINARY_PACK_SEARCH handle = unzOpen(packPath); diff --git a/qcommon/md4.c b/qcommon/md4.c index 5d1202b..18f98d6 100644 --- a/qcommon/md4.c +++ b/qcommon/md4.c @@ -12,7 +12,7 @@ typedef unsigned short int UINT2; #ifdef __alpha__ typedef unsigned int UINT4; #else -typedef unsigned long int UINT4; +typedef unsigned /*long*/ int UINT4; #endif diff --git a/renderer/r_cin.c b/renderer/r_cin.c index 82cdb9b..073fe04 100644 --- a/renderer/r_cin.c +++ b/renderer/r_cin.c @@ -52,9 +52,9 @@ cinematics_t *cin; //============================================================= -long GetInteger (byte *data) +int GetInteger (byte *data) { - long b0, b1, b2, b3; + int b0, b1, b2, b3; b0 = (data[0] & 0xFF); b1 = (data[1] & 0xFF) << 8; diff --git a/renderer/r_image.c b/renderer/r_image.c index fda2e1b..540ebb0 100644 --- a/renderer/r_image.c +++ b/renderer/r_image.c @@ -1057,9 +1057,9 @@ typedef struct png_handle_s { char *tmpBuf; int tmpi; - long fBgColor; // DL Background color Added 30/05/2000 + int /*long*/ fBgColor; // DL Background color Added 30/05/2000 int fTransparent; // DL Is this Image Transparent? Added 30/05/2000 - long fRowBytes; // DL Added 30/05/2000 + int /*long*/ fRowBytes; // DL Added 30/05/2000 double fGamma; // DL Added 07/06/2000 double fScreenGamma; // DL Added 07/06/2000 char *fRowPtrs; // DL Changed for consistancy 30/05/2000 @@ -1082,8 +1082,8 @@ png_handle_t *r_png_handle = 0; void R_InitializePNGData (void) { - long* cvaluep; //ub - long y; + size_t /*long*/ *cvaluep; //ub + int /*long*/ y; // Initialize Data and RowPtrs if (r_png_handle->data) @@ -1101,10 +1101,10 @@ void R_InitializePNGData (void) if ((r_png_handle->data)&&(r_png_handle->fRowPtrs)) { - cvaluep = (long*)r_png_handle->fRowPtrs; + cvaluep = (size_t /*long*/*)r_png_handle->fRowPtrs; for (y=0; yheight; y++) { - cvaluep[y] = (long)r_png_handle->data + ( y * (long)r_png_handle->fRowBytes ); //DL Added 08/07/2000 + cvaluep[y] = (size_t /*long*/)r_png_handle->data + ( y * (size_t /*long*/)r_png_handle->fRowBytes ); //DL Added 08/07/2000 } } } @@ -1264,17 +1264,17 @@ By Robert 'Heffo' Heffernan ================================================================= */ -void jpg_null(j_decompress_ptr cinfo) +void jpg_null (j_decompress_ptr cinfo) { } -unsigned char jpg_fill_input_buffer(j_decompress_ptr cinfo) +unsigned char jpg_fill_input_buffer (j_decompress_ptr cinfo) { VID_Printf(PRINT_ALL, "Premature end of JPEG data\n"); return 1; } -void jpg_skip_input_data(j_decompress_ptr cinfo, long num_bytes) +void jpg_skip_input_data (j_decompress_ptr cinfo, long num_bytes) { cinfo->src->next_input_byte += (size_t) num_bytes; @@ -1285,7 +1285,7 @@ void jpg_skip_input_data(j_decompress_ptr cinfo, long num_bytes) } //void jpeg_mem_src(j_decompress_ptr cinfo, byte *mem, int len) -void jpeg_mem_src(j_decompress_ptr cinfo, const byte *mem, unsigned long len) +void jpeg_mem_src (j_decompress_ptr cinfo, const byte *mem, unsigned long len) { cinfo->src = (struct jpeg_source_mgr *)(*cinfo->mem->alloc_small)((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(struct jpeg_source_mgr)); cinfo->src->init_source = jpg_null; @@ -2221,7 +2221,7 @@ nonscrap: // store the names of last images that failed to load #define NUM_FAIL_IMAGES 1024 char lastFailedImage[NUM_FAIL_IMAGES][MAX_OSPATH]; -long lastFailedImageHash[NUM_FAIL_IMAGES]; +unsigned int lastFailedImageHash[NUM_FAIL_IMAGES]; static unsigned failedImgListIndex; /* @@ -2248,8 +2248,8 @@ R_CheckImgFailed */ qboolean R_CheckImgFailed (char *name) { - int i; - long hash; + int i; + unsigned int hash; hash = Com_HashFileName(name, 0, false); for (i=0; iscreen); @@ -829,7 +829,7 @@ char *Sys_GetClipboardData() { Window sowner; Atom type, property; - unsigned long len, bytes_left, tmp; + unsigned int len, bytes_left, tmp; unsigned char *data; int format, result; char *ret = NULL; diff --git a/win32/cd_win.c b/win32/cd_win.c index e48c95c..843eff5 100644 --- a/win32/cd_win.c +++ b/win32/cd_win.c @@ -27,6 +27,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include // Knightmare added +// defines for MSVC6 +#if (_MSC_VER < 1300) +#ifndef LONG_PTR +#define LONG_PTR LONG +#endif +#endif // _MSC_VER + extern HWND cl_hwnd; static qboolean cdValid = false; @@ -55,7 +62,7 @@ static void CDAudio_EjectThread (void) { DWORD dwReturn; - if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (DWORD)NULL)) + if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (LONG_PTR)NULL)) Com_DPrintf("MCI_SET_DOOR_OPEN failed (%i)\n", dwReturn); _endthread(); } @@ -65,7 +72,7 @@ static void CDAudio_Eject (void) //_beginthread(CDAudio_EjectThread, 0, NULL); DWORD dwReturn; - if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (DWORD)NULL)) + if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (LONG_PTR)NULL)) Com_DPrintf("MCI_SET_DOOR_OPEN failed (%i)\n", dwReturn); } @@ -74,7 +81,7 @@ static void CDAudio_CloseDoorThread (void) { DWORD dwReturn; - if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD)NULL)) + if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (LONG_PTR)NULL)) Com_DPrintf("MCI_SET_DOOR_CLOSED failed (%i)\n", dwReturn); _endthread(); } @@ -84,7 +91,7 @@ static void CDAudio_CloseDoor (void) //_beginthread(CDAudio_CloseDoorThread, 0, NULL); DWORD dwReturn; - if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD)NULL)) + if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (LONG_PTR)NULL)) Com_DPrintf("MCI_SET_DOOR_CLOSED failed (%i)\n", dwReturn); } @@ -98,7 +105,7 @@ static int CDAudio_GetAudioDiskInfo (void) cdValid = false; mciStatusParms.dwItem = MCI_STATUS_READY; - dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms); + dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (LONG_PTR) (LPVOID) &mciStatusParms); if (dwReturn) { Com_DPrintf("CDAudio: drive ready test - get status failed\n"); @@ -111,7 +118,7 @@ static int CDAudio_GetAudioDiskInfo (void) } mciStatusParms.dwItem = MCI_STATUS_NUMBER_OF_TRACKS; - dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms); + dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (LONG_PTR) (LPVOID) &mciStatusParms); if (dwReturn) { Com_DPrintf("CDAudio: get tracks - status failed\n"); @@ -158,7 +165,7 @@ void CDAudio_Play2 (int track, qboolean looping) // don't try to play a non-audio track mciStatusParms.dwItem = MCI_CDA_STATUS_TYPE_TRACK; mciStatusParms.dwTrack = track; - dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms); + dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (LONG_PTR) (LPVOID) &mciStatusParms); if (dwReturn) { Com_DPrintf("MCI_STATUS failed (%i)\n", dwReturn); @@ -173,7 +180,7 @@ void CDAudio_Play2 (int track, qboolean looping) // get the length of the track to be played mciStatusParms.dwItem = MCI_STATUS_LENGTH; mciStatusParms.dwTrack = track; - dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms); + dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (LONG_PTR) (LPVOID) &mciStatusParms); if (dwReturn) { Com_DPrintf("MCI_STATUS failed (%i)\n", dwReturn); @@ -189,8 +196,8 @@ void CDAudio_Play2 (int track, qboolean looping) mciPlayParms.dwFrom = MCI_MAKE_TMSF(track, 0, 0, 0); mciPlayParms.dwTo = (mciStatusParms.dwReturn << 8) | track; - mciPlayParms.dwCallback = (DWORD)cl_hwnd; - dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO, (DWORD)(LPVOID) &mciPlayParms); + mciPlayParms.dwCallback = (LONG_PTR)cl_hwnd; + dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO, (LONG_PTR)(LPVOID) &mciPlayParms); if (dwReturn) { Com_DPrintf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn); @@ -225,7 +232,7 @@ void CDAudio_Stop (void) if (!playing) return; - if (dwReturn = mciSendCommand(wDeviceID, MCI_STOP, 0, (DWORD)NULL)) + if (dwReturn = mciSendCommand(wDeviceID, MCI_STOP, 0, (LONG_PTR)NULL)) Com_DPrintf("MCI_STOP failed (%i)", dwReturn); wasPlaying = false; @@ -244,8 +251,8 @@ void CDAudio_Pause (void) if (!playing) return; - mciGenericParms.dwCallback = (DWORD)cl_hwnd; - if (dwReturn = mciSendCommand(wDeviceID, MCI_PAUSE, 0, (DWORD)(LPVOID) &mciGenericParms)) + mciGenericParms.dwCallback = (LONG_PTR)cl_hwnd; + if (dwReturn = mciSendCommand(wDeviceID, MCI_PAUSE, 0, (LONG_PTR)(LPVOID) &mciGenericParms)) Com_DPrintf("MCI_PAUSE failed (%i)", dwReturn); wasPlaying = playing; @@ -269,8 +276,8 @@ void CDAudio_Resume (void) mciPlayParms.dwFrom = MCI_MAKE_TMSF(playTrack, 0, 0, 0); mciPlayParms.dwTo = MCI_MAKE_TMSF(playTrack + 1, 0, 0, 0); - mciPlayParms.dwCallback = (DWORD)cl_hwnd; - dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY, (DWORD)(LPVOID) &mciPlayParms); + mciPlayParms.dwCallback = (LONG_PTR)cl_hwnd; + dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY, (LONG_PTR)(LPVOID) &mciPlayParms); if (dwReturn) { Com_DPrintf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn); @@ -487,7 +494,7 @@ int CDAudio_Init (void) return -1; mciOpenParms.lpstrDeviceType = "cdaudio"; - if (dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE, (DWORD) (LPVOID) &mciOpenParms)) + if (dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE, (LONG_PTR) (LPVOID) &mciOpenParms)) { Com_Printf("CDAudio_Init: MCI_OPEN failed (%i)\n", dwReturn); return -1; @@ -496,10 +503,10 @@ int CDAudio_Init (void) // Set the time format to track/minute/second/frame (TMSF). mciSetParms.dwTimeFormat = MCI_FORMAT_TMSF; - if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD)(LPVOID) &mciSetParms)) + if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (LONG_PTR)(LPVOID) &mciSetParms)) { Com_Printf("MCI_SET_TIME_FORMAT failed (%i)\n", dwReturn); - mciSendCommand(wDeviceID, MCI_CLOSE, 0, (DWORD)NULL); + mciSendCommand(wDeviceID, MCI_CLOSE, 0, (LONG_PTR)NULL); return -1; } @@ -528,7 +535,7 @@ void CDAudio_Shutdown(void) if (!initialized) return; CDAudio_Stop(); - if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD)NULL)) + if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (LONG_PTR)NULL)) Com_DPrintf("CDAudio_Shutdown: MCI_CLOSE failed\n"); } diff --git a/win32/sys_console.c b/win32/sys_console.c index 36e8811..81a547c 100644 --- a/win32/sys_console.c +++ b/win32/sys_console.c @@ -227,7 +227,7 @@ void Sys_ShowConsole (qboolean show) Sys_ConsoleProc ================= */ -static LONG WINAPI Sys_ConsoleProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +static LRESULT WINAPI Sys_ConsoleProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { @@ -269,14 +269,14 @@ static LONG WINAPI Sys_ConsoleProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM SetBkMode((HDC)wParam, TRANSPARENT); SetBkColor((HDC)wParam, RGB(39, 115, 102)); SetTextColor((HDC)wParam, RGB(255, 255, 255)); - return (LONG)sys_console.hBrushOutput; + return (LRESULT)sys_console.hBrushOutput; } else if ((HWND)lParam == sys_console.hWndInput) { SetBkMode((HDC)wParam, TRANSPARENT); SetBkColor((HDC)wParam, RGB(255, 255, 255)); SetTextColor((HDC)wParam, RGB(0, 0, 0)); - return (LONG)sys_console.hBrushInput; + return (LRESULT)sys_console.hBrushInput; } break; @@ -291,7 +291,7 @@ static LONG WINAPI Sys_ConsoleProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM else SetTextColor((HDC)wParam, RGB(0, 0, 0)); - return (LONG)sys_console.hBrushMsg; + return (LRESULT)sys_console.hBrushMsg; } break; @@ -311,7 +311,7 @@ static LONG WINAPI Sys_ConsoleProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM Sys_ConsoleEditProc ================= */ -static LONG WINAPI Sys_ConsoleEditProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +static LRESULT WINAPI Sys_ConsoleEditProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { @@ -379,11 +379,9 @@ void Sys_ShutdownConsole (void) } if (sys_console.defOutputProc) { - // SetWindowLong(sys_console.hWndOutput, GWL_WNDPROC, (LONG)sys_console.defOutputProc); SetWindowLongPtr(sys_console.hWndOutput, GWLP_WNDPROC, (LONG_PTR)sys_console.defOutputProc); } if (sys_console.defInputProc) { - // SetWindowLong(sys_console.hWndInput, GWL_WNDPROC, (LONG)sys_console.defInputProc); SetWindowLongPtr(sys_console.hWndInput, GWLP_WNDPROC, (LONG_PTR)sys_console.defInputProc); } @@ -480,8 +478,6 @@ void Sys_InitDedConsole (void) sys_console.hBrushInput = CreateSolidBrush(RGB(255, 255, 255)); // Subclass edit boxes -// sys_console.defOutputProc = (WNDPROC)SetWindowLong(sys_console.hWndOutput, GWL_WNDPROC, (LONG)Sys_ConsoleEditProc); -// sys_console.defInputProc = (WNDPROC)SetWindowLong(sys_console.hWndInput, GWL_WNDPROC, (LONG)Sys_ConsoleEditProc); sys_console.defOutputProc = (WNDPROC)SetWindowLongPtr(sys_console.hWndOutput, GWLP_WNDPROC, (LONG_PTR)Sys_ConsoleEditProc); sys_console.defInputProc = (WNDPROC)SetWindowLongPtr(sys_console.hWndInput, GWLP_WNDPROC, (LONG_PTR)Sys_ConsoleEditProc);