From 6a7d83c4809e8dbe273dfc5731aa0ba5c79cc10c Mon Sep 17 00:00:00 2001 From: kgv Date: Tue, 16 Apr 2013 13:03:05 +0400 Subject: [PATCH] 0023904: Multiple warning on Windows x86_64 target concerning WinAPI usage --- src/Draw/CommandWindow.cxx | 24 +++++++++++++----------- src/Draw/Draw_Window.cxx | 10 +++++----- src/Draw/Draw_Window.hxx | 2 +- src/Draw/MAINWINDOW.h | 2 +- src/Draw/MainWindow.cxx | 2 +- src/Image/Image_AlienPixMap.cxx | 2 +- src/OpenGl/OpenGl_Context.cxx | 4 ++-- src/OpenGl/OpenGl_View_2.cxx | 2 +- src/WNT/WNT_Window.cxx | 8 +++----- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/Draw/CommandWindow.cxx b/src/Draw/CommandWindow.cxx index 2de0fbc69c..4dfe7701c1 100755 --- a/src/Draw/CommandWindow.cxx +++ b/src/Draw/CommandWindow.cxx @@ -81,10 +81,9 @@ HWND CreateCommandWindow(HWND hWnd, int nitem) /*--------------------------------------------------------*\ | COMMAND WINDOW PROCEDURE \*--------------------------------------------------------*/ -LONG APIENTRY CommandProc(HWND hWnd, UINT wMsg, WPARAM wParam, LONG lParam ) +LRESULT APIENTRY CommandProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam ) { HWND hWndEdit; - int index; // Nb of characters in the buffer of hWndEdit MINMAXINFO* lpmmi; switch(wMsg) @@ -102,12 +101,15 @@ LONG APIENTRY CommandProc(HWND hWnd, UINT wMsg, WPARAM wParam, LONG lParam ) break; case WM_SIZE : + { hWndEdit = (HWND)GetWindowLong(hWnd, CLIENTWND); MoveWindow(hWndEdit, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE); - // Place the cursor at the end of the buffer - index = SendMessage(hWnd, WM_GETTEXTLENGTH, 0l, 0l); + // Place the cursor at the end of the buffer + // Nb of characters in the buffer of hWndEdit + LRESULT index = SendMessage(hWnd, WM_GETTEXTLENGTH, 0l, 0l); SendMessage(hWnd, EM_SETSEL, index, index); break; + } case WM_SETFOCUS : hWndEdit = (HWND)GetWindowLong(hWnd, CLIENTWND); @@ -122,7 +124,7 @@ LONG APIENTRY CommandProc(HWND hWnd, UINT wMsg, WPARAM wParam, LONG lParam ) -LONG APIENTRY EditProc(HWND, UINT, WPARAM, LONG); +LRESULT APIENTRY EditProc(HWND, UINT, WPARAM, LPARAM); /*--------------------------------------------------------*\ | COMMAND CREATE PROCEDURE \*--------------------------------------------------------*/ @@ -176,7 +178,7 @@ int GetCommand(HWND hWnd, char* buffer) int again = 1; char temp[COMMANDSIZE]=""; - int nbLine = SendMessage(hWnd, EM_GETLINECOUNT, 0l, 0l); + int nbLine = (int )SendMessage(hWnd, EM_GETLINECOUNT, 0l, 0l); int nbChar = 0; buffer[0]='\0'; @@ -187,7 +189,7 @@ int GetCommand(HWND hWnd, char* buffer) WORD* nbMaxChar = (WORD*)temp; *nbMaxChar = COMMANDSIZE-1; - int nbCharRead = SendMessage(hWnd, EM_GETLINE, nbLine-1, (LPARAM)temp); + int nbCharRead = (int )SendMessage(hWnd, EM_GETLINE, nbLine-1, (LPARAM)temp); nbChar += nbCharRead ; int cmp = strncmp(temp, PROMPT, 10); temp[nbCharRead]='\0'; @@ -208,14 +210,14 @@ extern char console_command[1000]; /*--------------------------------------------------------*\ | EDIT WINDOW PROCEDURE \*--------------------------------------------------------*/ -LONG APIENTRY EditProc(HWND hWnd, UINT wMsg, WPARAM wParam, LONG lParam ) +LRESULT APIENTRY EditProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam ) { char buffer[COMMANDSIZE]; POINT pos; BOOL rep; - static int nbline; // Process the buffer of the edit window - int index; - + static LRESULT nbline; // Process the buffer of the edit window + LRESULT index; + switch(wMsg) { case WM_CHAR : diff --git a/src/Draw/Draw_Window.cxx b/src/Draw/Draw_Window.cxx index 539bab44e9..397cfc83bc 100755 --- a/src/Draw/Draw_Window.cxx +++ b/src/Draw/Draw_Window.cxx @@ -1365,7 +1365,7 @@ HWND DrawWindow::CreateDrawWindow(HWND hWndClient, int nitem) /*--------------------------------------------------------*\ | DRAW WINDOW PROCEDURE \*--------------------------------------------------------*/ -LONG APIENTRY DrawWindow::DrawProc(HWND hWnd, UINT wMsg, WPARAM wParam, LONG lParam ) +LRESULT APIENTRY DrawWindow::DrawProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam ) { DrawWindow* localObjet = (DrawWindow*)GetWindowLong(hWnd, CLIENTWND); if (!localObjet) @@ -1490,15 +1490,15 @@ DrawWindow::~DrawWindow() void DrawWindow::Init(Standard_Integer theXLeft, Standard_Integer theYTop, Standard_Integer theWidth, Standard_Integer theHeight) { - if (win == 0) + if (win == NULL) { win = CreateDrawWindow(hWndClientMDI, 0); } // include decorations in the window dimensions // to reproduce same behaviour of Xlib window. - DWORD aWinStyle = GetWindowLongPtr (win, GWL_STYLE); - DWORD aWinStyleEx = GetWindowLongPtr (win, GWL_EXSTYLE); + DWORD aWinStyle = GetWindowLong (win, GWL_STYLE); + DWORD aWinStyleEx = GetWindowLong (win, GWL_EXSTYLE); HMENU aMenu = GetMenu (win); RECT aRect; @@ -1820,7 +1820,7 @@ void DrawWindow::DrawString(int x,int y, char* text) HDC hDC = GetDC(win); HDC aWorkDC = myUseBuffer ? GetMemDC(hDC) : hDC; - TextOut(aWorkDC, x, y, text, strlen(text)); + TextOut(aWorkDC, x, y, text, (int )strlen(text)); if (myUseBuffer) ReleaseMemDC(aWorkDC); ReleaseDC(win,hDC); diff --git a/src/Draw/Draw_Window.hxx b/src/Draw/Draw_Window.hxx index 33bb1ac02e..ba8119068f 100755 --- a/src/Draw/Draw_Window.hxx +++ b/src/Draw/Draw_Window.hxx @@ -435,7 +435,7 @@ public: __Draw_API static void SelectNoWait (HANDLE&,int&,int&,int&); // Procedure de fenetre - __Draw_API static LONG APIENTRY DrawProc (HWND,UINT,WPARAM,LONG); + __Draw_API static LRESULT APIENTRY DrawProc (HWND,UINT,WPARAM,LPARAM); private: diff --git a/src/Draw/MAINWINDOW.h b/src/Draw/MAINWINDOW.h index 8fde3455d1..19a8617766 100755 --- a/src/Draw/MAINWINDOW.h +++ b/src/Draw/MAINWINDOW.h @@ -33,7 +33,7 @@ */ #include -LONG APIENTRY WndProc(HWND, UINT, WPARAM, LONG); +LRESULT APIENTRY WndProc(HWND, UINT, WPARAM, LPARAM); BOOL CreateProc(HWND); VOID DestroyProc(HWND); BOOL CommandProc(HWND, WPARAM, LPARAM); diff --git a/src/Draw/MainWindow.cxx b/src/Draw/MainWindow.cxx index d2f8153267..8ea881b2fe 100755 --- a/src/Draw/MainWindow.cxx +++ b/src/Draw/MainWindow.cxx @@ -41,7 +41,7 @@ extern Standard_Boolean Draw_IsConsoleSubsystem; | | \*--------------------------------------------------------*/ -LONG APIENTRY WndProc(HWND hWndFrame, UINT wMsg, WPARAM wParam, LONG lParam ) +LRESULT APIENTRY WndProc(HWND hWndFrame, UINT wMsg, WPARAM wParam, LPARAM lParam ) { HWND hWndClient; switch(wMsg) diff --git a/src/Image/Image_AlienPixMap.cxx b/src/Image/Image_AlienPixMap.cxx index 3de0eb6414..2ba51fe28b 100644 --- a/src/Image/Image_AlienPixMap.cxx +++ b/src/Image/Image_AlienPixMap.cxx @@ -329,7 +329,7 @@ bool Image_AlienPixMap::savePPM (const TCollection_AsciiString& theFileName) con for (Standard_Size aCol = 0; aCol < SizeY(); ++aCol) { // extremely SLOW but universal (implemented for all supported pixel formats) - aColor = PixelColor (aCol, aRow, aDummy); + aColor = PixelColor ((Standard_Integer )aCol, (Standard_Integer )aRow, aDummy); aByte = Standard_Byte(aColor.Red() * 255.0); fwrite (&aByte, 1, 1, aFile); aByte = Standard_Byte(aColor.Green() * 255.0); fwrite (&aByte, 1, 1, aFile); aByte = Standard_Byte(aColor.Blue() * 255.0); fwrite (&aByte, 1, 1, aFile); diff --git a/src/OpenGl/OpenGl_Context.cxx b/src/OpenGl/OpenGl_Context.cxx index 0262971c48..bf702ff8e3 100644 --- a/src/OpenGl/OpenGl_Context.cxx +++ b/src/OpenGl/OpenGl_Context.cxx @@ -299,7 +299,7 @@ Standard_Boolean OpenGl_Context::CheckExtension (const char* theExtName) const std::cerr << "CheckExtension called with NULL string!\n"; return Standard_False; } - int anExtNameLen = strlen (theExtName); + const size_t anExtNameLen = strlen (theExtName); // available since OpenGL 3.0 // and the ONLY way to check extensions with OpenGL 3.1+ core profile @@ -333,7 +333,7 @@ Standard_Boolean OpenGl_Context::CheckExtension (const char* theExtName) const const char* aPtrEnd = aPtrIter + strlen (anExtString); while (aPtrIter < aPtrEnd) { - int n = strcspn (aPtrIter, " "); + const size_t n = strcspn (aPtrIter, " "); if ((n == anExtNameLen) && (strncmp (aPtrIter, theExtName, anExtNameLen) == 0)) { return Standard_True; diff --git a/src/OpenGl/OpenGl_View_2.cxx b/src/OpenGl/OpenGl_View_2.cxx index 28b0be27e6..4ad9445ce7 100644 --- a/src/OpenGl/OpenGl_View_2.cxx +++ b/src/OpenGl/OpenGl_View_2.cxx @@ -1389,7 +1389,7 @@ void OpenGl_View::CreateBackgroundTexture (const Standard_CString theFilePath, { for (Standard_Size aCol = 0; aCol < anImage.SizeX(); ++aCol) { - aSrcColor = anImageLoaded.PixelColor (aCol, aRow); + aSrcColor = anImageLoaded.PixelColor ((Standard_Integer )aCol, (Standard_Integer )aRow); Image_ColorRGB& aColor = aDataNew.ChangeValue (aRow, aCol); aColor.r() = int(255.0 * aSrcColor.Red()); aColor.g() = int(255.0 * aSrcColor.Green()); diff --git a/src/WNT/WNT_Window.cxx b/src/WNT/WNT_Window.cxx index 1c42644f98..eb009533e5 100755 --- a/src/WNT/WNT_Window.cxx +++ b/src/WNT/WNT_Window.cxx @@ -429,27 +429,25 @@ void WNT_Window :: doCreate ( const Quantity_NameOfColor aBackColor ) { - LONG uData; - WINDOWPLACEMENT wp; - ZeroMemory (&myExtraData, sizeof (WNT_WindowData)); myHWindow = aHandle; myHParentWindow = GetParent ((HWND )aHandle); - uData = GetWindowLongPtr ((HWND )aHandle, GWLP_USERDATA); + LONG_PTR uData = GetWindowLongPtr ((HWND )aHandle, GWLP_USERDATA); myUsrData = Standard_Address(-1); SetBackground (aBackColor); myExtraData.WNT_Window_Ptr = (void* )this; - if (uData != (LONG )&myExtraData) + if (uData != (LONG_PTR )&myExtraData) { myUsrData = (Standard_Address )SetWindowLongPtr ((HWND )myHWindow, GWLP_USERDATA, (LONG_PTR )&myExtraData); } myExtraData.dwFlags = WDF_FOREIGN; + WINDOWPLACEMENT wp; wp.length = sizeof (WINDOWPLACEMENT); GetWindowPlacement ((HWND )myHWindow, &wp); -- 2.20.1