diff --git a/blupi.cpp b/blupi.cpp index 7ee5bcc..41ba8e2 100644 --- a/blupi.cpp +++ b/blupi.cpp @@ -72,7 +72,7 @@ bool ReadConfig(LPSTR lpCmdLine) FILE* file = NULL; char buffer[200]; char* pText; - int nb; + size_t nb; file = fopen("data\\config.def", "rb"); if ( file == NULL ) return false; @@ -476,7 +476,7 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message, else { char s[50]; - sprintf(s, "wParam=%d\n", wParam); + sprintf(s, "wParam=%d\n", static_cast (wParam)); OutputDebug(s); } } @@ -838,7 +838,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, { if ( !GetMessage(&msg, NULL, 0, 0) ) { - return msg.wParam; + return static_cast (msg.wParam); } TranslateMessage(&msg); DispatchMessage(&msg); @@ -850,6 +850,6 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, } } - return msg.wParam; + return static_cast (msg.wParam); } diff --git a/decio.cpp b/decio.cpp index 68804fc..0304261 100644 --- a/decio.cpp +++ b/decio.cpp @@ -98,7 +98,8 @@ bool CDecor::Write(int rank, bool bUser, int world, int time, int total) char filename[MAX_PATH]; FILE* file = NULL; DescFile* pBuffer = NULL; - int nb, i; + int i; + size_t nb; if ( bUser ) { @@ -181,7 +182,8 @@ bool CDecor::Read(int rank, bool bUser, int &world, int &time, int &total) FILE* file = NULL; DescFile* pBuffer = NULL; int majRev, minRev; - int nb, i, x, y; + int i, x, y; + size_t nb; OldBlupi oldBlupi; Init(-1, -1); @@ -325,7 +327,7 @@ bool CDecor::FileExist(int rank, bool bUser, int &world, int &time, int &total) FILE* file = NULL; DescFile* pBuffer = NULL; int majRev, minRev; - int nb; + size_t nb; if ( bUser ) { diff --git a/event.cpp b/event.cpp index bcfcbbd..f7ead84 100644 --- a/event.cpp +++ b/event.cpp @@ -1738,7 +1738,8 @@ bool CEvent::CreateButtons() void AddCheatCode(char *pDst, char *pSrc) { - int i, j; + int i; + size_t j; if ( pDst[0] != 0 ) strcat(pDst, " / "); @@ -4197,7 +4198,8 @@ bool CEvent::ReadLibelle(int world, bool bSchool, bool bHelp) char* pText; char* pDest; char indic; - int nb, h1, h2; + int h1, h2; + size_t nb; if ( bSchool ) indic = '$'; else indic = '#'; @@ -4259,7 +4261,7 @@ bool CEvent::WriteInfo() char filename[MAX_PATH]; FILE* file = NULL; DescInfo info; - int nb; + size_t nb; strcpy(filename, "data\\info.blp"); AddUserPath(filename); @@ -4301,7 +4303,7 @@ bool CEvent::ReadInfo() char filename[MAX_PATH]; FILE* file = NULL; DescInfo info; - int nb; + size_t nb; strcpy(filename, "data\\info.blp"); AddUserPath(filename); @@ -4421,7 +4423,8 @@ bool CEvent::DemoPlayStart() char filename[MAX_PATH]; FILE* file = NULL; DemoHeader header; - int nb, world, time, total; + int world, time, total; + size_t nb; m_pDemoBuffer = (DemoEvent*)malloc(MAXDEMO*sizeof(DemoEvent)); if ( m_pDemoBuffer == NULL ) return false; @@ -4622,7 +4625,7 @@ bool CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) bool bEnable; pos = ConvLongToPos(lParam); - fwKeys = wParam; + fwKeys = static_cast (wParam); DemoRecEvent(message, wParam, lParam); diff --git a/event.h b/event.h index 690efc6..123e344 100644 --- a/event.h +++ b/event.h @@ -209,8 +209,8 @@ protected: bool m_bDemoPlay; DemoEvent* m_pDemoBuffer; int m_demoTime; - int m_demoIndex; - int m_demoEnd; + size_t m_demoIndex; + size_t m_demoEnd; int m_demoNumber; bool m_bCtrlDown; POINT m_debugPos; diff --git a/misc.cpp b/misc.cpp index dc4e51a..5de4853 100644 --- a/misc.cpp +++ b/misc.cpp @@ -114,9 +114,9 @@ int Random(int min, int max) // Retourne le nom de dossier en cours. -void GetCurrentDir(char *pName, int lg) +void GetCurrentDir(char *pName, size_t lg) { - int i; + size_t i; strncpy(pName, _pgmptr, lg-1); pName[lg-1] = 0; @@ -152,7 +152,7 @@ void GetCurrentDir(char *pName, int lg) void AddCDPath(char *pFilename) { char temp[MAX_PATH]; - int lg; + size_t lg; bool bDaniel = false; if ( g_CDPath[0] == 0 ) return; @@ -192,7 +192,7 @@ void AddUserPath(char *pFilename) { char temp[MAX_PATH]; char* pText; - int pos; + size_t pos; char last; SECURITY_ATTRIBUTES att; diff --git a/misc.h b/misc.h index 1b41525..7f74b1f 100644 --- a/misc.h +++ b/misc.h @@ -13,7 +13,7 @@ extern POINT ConvLongToPos(LPARAM lParam); extern void InitRandom(); extern int Random(int min, int max); -extern void GetCurrentDir(char *pName, int lg); +extern void GetCurrentDir(char *pName, size_t lg); extern void AddCDPath(char *pFilename); extern void AddUserPath(char *pFilename); diff --git a/movie.cpp b/movie.cpp index 5934f7a..c170460 100644 --- a/movie.cpp +++ b/movie.cpp @@ -41,7 +41,7 @@ bool CMovie::initAVI() // try to open the driver return (mciSendCommand(0, MCI_OPEN, (DWORD)(MCI_OPEN_TYPE), - (DWORD)(LPMCI_DGV_OPEN_PARMS)&mciOpen) == 0); + (DWORD_PTR)(LPMCI_DGV_OPEN_PARMS)&mciOpen) == 0); } // Closes the opened AVI file and the opened device type. | @@ -55,7 +55,7 @@ void CMovie::termAVI() // the device type. mciID = mciGetDeviceID(AVI_VIDEO); mciSendCommand(mciID, MCI_CLOSE, 0L, - (DWORD)(LPMCI_GENERIC_PARMS)&mciClose); + (DWORD_PTR)(LPMCI_GENERIC_PARMS)&mciClose); } @@ -78,7 +78,7 @@ void CMovie::fileCloseMovie(HWND hWnd) MCI_GENERIC_PARMS mciGeneric; mciSendCommand(m_wMCIDeviceID, MCI_CLOSE, 0L, - (DWORD)(LPMCI_GENERIC_PARMS)&mciGeneric); + (DWORD_PTR)(LPMCI_GENERIC_PARMS)&mciGeneric); m_fPlaying = false; // can't be playing any longer m_fMovieOpen = false; // no more movies open @@ -128,7 +128,7 @@ bool CMovie::fileOpenMovie(HWND hWnd, RECT rect, char *pFilename) // try to open the file if ( mciSendCommand(0, MCI_OPEN, (DWORD)(MCI_OPEN_ELEMENT|MCI_DGV_OPEN_PARENT|MCI_DGV_OPEN_WS), - (DWORD)(LPMCI_DGV_OPEN_PARMS)&mciOpen) == 0 ) + (DWORD_PTR)(LPMCI_DGV_OPEN_PARMS)&mciOpen) == 0 ) { // we opened the file o.k., now set up to play it. m_wMCIDeviceID = mciOpen.wDeviceID; // save ID @@ -147,7 +147,7 @@ bool CMovie::fileOpenMovie(HWND hWnd, RECT rect, char *pFilename) mciStatus.dwItem = MCI_DGV_STATUS_HWND; mciSendCommand(m_wMCIDeviceID, MCI_STATUS, MCI_STATUS_ITEM, - (DWORD)(LPMCI_STATUS_PARMS)&mciStatus); + (DWORD_PTR)(LPMCI_STATUS_PARMS)&mciStatus); m_hwndMovie = (HWND)mciStatus.dwReturn; // now get the movie centered @@ -193,7 +193,7 @@ void CMovie::playMovie(HWND hWnd, int nDirection) dwFlags |= MCI_DGV_PLAY_REVERSE; mciSendCommand(m_wMCIDeviceID, MCI_PLAY, dwFlags, - (DWORD)(LPMCI_DGV_PLAY_PARMS)&mciPlay); + (DWORD_PTR)(LPMCI_DGV_PLAY_PARMS)&mciPlay); } else { @@ -201,7 +201,7 @@ void CMovie::playMovie(HWND hWnd, int nDirection) // tell it to pause mciSendCommand(m_wMCIDeviceID,MCI_PAUSE,0L, - (DWORD)(LPMCI_DGV_PAUSE_PARMS)&mciPause); + (DWORD_PTR)(LPMCI_DGV_PAUSE_PARMS)&mciPause); } } diff --git a/sound.cpp b/sound.cpp index 0f9a936..570db58 100644 --- a/sound.cpp +++ b/sound.cpp @@ -548,7 +548,7 @@ bool CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename) dwReturn = mciSendCommand(NULL, MCI_OPEN, MCI_OPEN_TYPE|MCI_OPEN_ELEMENT, - (DWORD)(LPVOID)&mciOpenParms); + (DWORD_PTR)(LPVOID)&mciOpenParms); if ( dwReturn != 0 ) { OutputDebug("PlayMusic-1\n"); @@ -562,11 +562,11 @@ bool CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename) m_MidiDeviceID = mciOpenParms.wDeviceID; // Begin playback. - mciPlayParms.dwCallback = (DWORD)hWnd; + mciPlayParms.dwCallback = (DWORD_PTR)hWnd; dwReturn = mciSendCommand(m_MidiDeviceID, MCI_PLAY, MCI_NOTIFY, - (DWORD)(LPVOID)&mciPlayParms); + (DWORD_PTR)(LPVOID)&mciPlayParms); if ( dwReturn != 0 ) { OutputDebug("PlayMusic-2\n");