From 99c66c095c20292f585198314016d44f7b144094 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Thu, 29 Jun 2006 22:32:06 +0000 Subject: [PATCH] fixed some warnings (msvc) svn path=/trunk/; revision=22701 --- reactos/base/applications/notepad/dialog.c | 16 ++++++----- reactos/base/applications/notepad/main.c | 29 ++++++++++++-------- reactos/base/applications/notepad/settings.c | 2 +- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/reactos/base/applications/notepad/dialog.c b/reactos/base/applications/notepad/dialog.c index eb5b80258cc..fa1c8aca6e2 100644 --- a/reactos/base/applications/notepad/dialog.c +++ b/reactos/base/applications/notepad/dialog.c @@ -322,6 +322,8 @@ static UINT_PTR CALLBACK DIALOG_FileSaveAs_Hook(HWND hDlg, UINT msg, WPARAM wPar HWND hCombo; OFNOTIFY *pNotify; + UNREFERENCED_PARAMETER(wParam); + switch(msg) { case WM_INITDIALOG: @@ -362,11 +364,11 @@ static UINT_PTR CALLBACK DIALOG_FileSaveAs_Hook(HWND hDlg, UINT msg, WPARAM wPar hCombo = GetDlgItem(hDlg, ID_ENCODING); if (hCombo) - Globals.iEncoding = SendMessage(hCombo, CB_GETCURSEL, 0, 0); + Globals.iEncoding = (int) SendMessage(hCombo, CB_GETCURSEL, 0, 0); hCombo = GetDlgItem(hDlg, ID_EOLN); if (hCombo) - Globals.iEoln = SendMessage(hCombo, CB_GETCURSEL, 0, 0); + Globals.iEoln = (int) SendMessage(hCombo, CB_GETCURSEL, 0, 0); } break; } @@ -453,7 +455,7 @@ VOID DIALOG_FilePrint(VOID) printer.nMinPage = 1; /* we really need to calculate number of pages to set nMaxPage and nToPage */ printer.nToPage = 0; - printer.nMaxPage = -1; + printer.nMaxPage = (WORD) -1; /* Let commdlg manage copy settings */ printer.nCopies = (WORD)PD_USEDEVMODECOPIES; @@ -772,7 +774,7 @@ VOID DIALOG_GoTo(VOID) SendMessage(Globals.hEdit, EM_GETSEL, (WPARAM) &dwStart, (LPARAM) &dwEnd); nLine = 1; - for (i = 0; pszText[i] && (i < dwStart); i++) + for (i = 0; pszText[i] && (i < (int) dwStart); i++) { if (pszText[i] == '\n') nLine++; @@ -803,10 +805,10 @@ VOID DIALOG_StatusBarUpdateCaretPos(VOID) TCHAR buff[MAX_PATH]; GetCaretPos(&point); - line = SendMessage(Globals.hEdit, EM_LINEFROMCHAR, (WPARAM)-1, (LPARAM)0); - ccol = SendMessage(Globals.hEdit, EM_CHARFROMPOS, (WPARAM)0, (LPARAM)MAKELPARAM(point.x, point.y)); + line = (int) SendMessage(Globals.hEdit, EM_LINEFROMCHAR, (WPARAM)-1, (LPARAM)0); + ccol = (int) SendMessage(Globals.hEdit, EM_CHARFROMPOS, (WPARAM)0, (LPARAM)MAKELPARAM(point.x, point.y)); ccol = LOWORD(ccol); - col = ccol - SendMessage(Globals.hEdit, EM_LINEINDEX, (WPARAM)line, (LPARAM)0); + col = ccol - (int) SendMessage(Globals.hEdit, EM_LINEINDEX, (WPARAM)line, (LPARAM)0); _stprintf(buff, TEXT("%S %d, %S %d"), Globals.szStatusBarLine, line+1, Globals.szStatusBarCol, col+1); SendMessage(Globals.hStatusBar, SB_SETTEXT, (WPARAM) SB_SIMPLEID, (LPARAM)buff); diff --git a/reactos/base/applications/notepad/main.c b/reactos/base/applications/notepad/main.c index d0b8a52e8db..0d10a796673 100644 --- a/reactos/base/applications/notepad/main.c +++ b/reactos/base/applications/notepad/main.c @@ -83,7 +83,7 @@ static int NOTEPAD_MenuCommand(WPARAM wParam) case CMD_ABOUT: DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_ABOUTBOX), Globals.hMainWnd, - AboutDialogProc); + (DLGPROC) AboutDialogProc); break; case CMD_ABOUT_WINE: DIALOG_HelpAboutWine(); break; @@ -101,7 +101,7 @@ static int NOTEPAD_MenuCommand(WPARAM wParam) static BOOL NOTEPAD_FindTextAt(FINDREPLACE *pFindReplace, LPCTSTR pszText, int iTextLength, DWORD dwPosition) { BOOL bMatches; - int iTargetLength; + size_t iTargetLength; iTargetLength = _tcslen(pFindReplace->lpstrFindWhat); @@ -115,7 +115,7 @@ static BOOL NOTEPAD_FindTextAt(FINDREPLACE *pFindReplace, LPCTSTR pszText, int i { if ((dwPosition > 0) && !_istspace(pszText[dwPosition-1])) bMatches = FALSE; - if ((dwPosition < iTextLength - 1) && !_istspace(pszText[dwPosition+1])) + if ((dwPosition < (DWORD) iTextLength - 1) && !_istspace(pszText[dwPosition+1])) bMatches = FALSE; } @@ -130,14 +130,14 @@ static BOOL NOTEPAD_FindTextAt(FINDREPLACE *pFindReplace, LPCTSTR pszText, int i BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert) { int iTextLength, iTargetLength; - int iAdjustment = 0; + size_t iAdjustment = 0; LPTSTR pszText = NULL; DWORD dwPosition, dwBegin, dwEnd; BOOL bMatches = FALSE; TCHAR szResource[128], szText[128]; BOOL bSuccess; - iTargetLength = _tcslen(pFindReplace->lpstrFindWhat); + iTargetLength = (int) _tcslen(pFindReplace->lpstrFindWhat); /* Retrieve the window text */ iTextLength = GetWindowTextLength(Globals.hEdit); @@ -151,7 +151,7 @@ BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert) } SendMessage(Globals.hEdit, EM_GETSEL, (WPARAM) &dwBegin, (LPARAM) &dwEnd); - if (bReplace && ((dwEnd - dwBegin) == iTargetLength)) + if (bReplace && ((dwEnd - dwBegin) == (DWORD) iTargetLength)) { if (NOTEPAD_FindTextAt(pFindReplace, pszText, iTextLength, dwBegin)) { @@ -164,7 +164,7 @@ BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert) { /* Find Down */ dwPosition = dwEnd; - while(dwPosition < iTextLength) + while(dwPosition < (DWORD) iTextLength) { bMatches = NOTEPAD_FindTextAt(pFindReplace, pszText, iTextLength, dwPosition); if (bMatches) @@ -189,7 +189,7 @@ BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert) { /* Found target */ if (dwPosition > dwBegin) - dwPosition += iAdjustment; + dwPosition += (DWORD) iAdjustment; SendMessage(Globals.hEdit, EM_SETSEL, dwPosition, dwPosition + iTargetLength); SendMessage(Globals.hEdit, EM_SCROLLCARET, 0, 0); bSuccess = TRUE; @@ -263,10 +263,12 @@ static VOID NOTEPAD_InitData(VOID) /*********************************************************************** * Enable/disable items on the menu based on control state */ -static VOID NOTEPAD_InitMenuPopup(HMENU menu, int index) +static VOID NOTEPAD_InitMenuPopup(HMENU menu, LPARAM index) { int enable; + UNREFERENCED_PARAMETER(index); + CheckMenuItem(GetMenu(Globals.hMainWnd), CMD_WRAP, MF_BYCOMMAND | (Globals.bWrapLongLines ? MF_CHECKED : MF_UNCHECKED)); if ( !Globals.bWrapLongLines ) @@ -278,7 +280,7 @@ static VOID NOTEPAD_InitMenuPopup(HMENU menu, int index) SendMessage(Globals.hEdit, EM_CANUNDO, 0, 0) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(menu, CMD_PASTE, IsClipboardFormatAvailable(CF_TEXT) ? MF_ENABLED : MF_GRAYED); - enable = SendMessage(Globals.hEdit, EM_GETSEL, 0, 0); + enable = (int) SendMessage(Globals.hEdit, EM_GETSEL, 0, 0); enable = (HIWORD(enable) == LOWORD(enable)) ? MF_GRAYED : MF_ENABLED; EnableMenuItem(menu, CMD_CUT, enable); EnableMenuItem(menu, CMD_COPY, enable); @@ -532,7 +534,10 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show) static const WCHAR className[] = {'N','P','C','l','a','s','s',0}; static const WCHAR winName[] = {'N','o','t','e','p','a','d',0}; - aFINDMSGSTRING = RegisterWindowMessage(FINDMSGSTRING); + UNREFERENCED_PARAMETER(prev); + UNREFERENCED_PARAMETER(cmdline); + + aFINDMSGSTRING = (ATOM) RegisterWindowMessage(FINDMSGSTRING); ZeroMemory(&Globals, sizeof(Globals)); Globals.hInstance = hInstance; @@ -585,5 +590,5 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show) } } SaveSettings(); - return msg.wParam; + return (int) msg.wParam; } diff --git a/reactos/base/applications/notepad/settings.c b/reactos/base/applications/notepad/settings.c index 4ff3d6e1c9e..610e12fefda 100644 --- a/reactos/base/applications/notepad/settings.c +++ b/reactos/base/applications/notepad/settings.c @@ -187,7 +187,7 @@ static BOOL SaveString(HKEY hKey, LPCSTR pszValueName, LPCTSTR pszValue) pszValueNameT = pszValueName; #endif - return RegSetValueEx(hKey, pszValueNameT, 0, REG_SZ, (LPBYTE) pszValue, _tcslen(pszValue) * sizeof(*pszValue)) == ERROR_SUCCESS; + return RegSetValueEx(hKey, pszValueNameT, 0, REG_SZ, (LPBYTE) pszValue, (DWORD) _tcslen(pszValue) * sizeof(*pszValue)) == ERROR_SUCCESS; } void SaveSettings(void)