fixed some warnings (msvc)

svn path=/trunk/; revision=22701
This commit is contained in:
Christoph von Wittich 2006-06-29 22:32:06 +00:00
parent 23b77e8fd7
commit 99c66c095c
3 changed files with 27 additions and 20 deletions

View file

@ -322,6 +322,8 @@ static UINT_PTR CALLBACK DIALOG_FileSaveAs_Hook(HWND hDlg, UINT msg, WPARAM wPar
HWND hCombo; HWND hCombo;
OFNOTIFY *pNotify; OFNOTIFY *pNotify;
UNREFERENCED_PARAMETER(wParam);
switch(msg) switch(msg)
{ {
case WM_INITDIALOG: 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); hCombo = GetDlgItem(hDlg, ID_ENCODING);
if (hCombo) if (hCombo)
Globals.iEncoding = SendMessage(hCombo, CB_GETCURSEL, 0, 0); Globals.iEncoding = (int) SendMessage(hCombo, CB_GETCURSEL, 0, 0);
hCombo = GetDlgItem(hDlg, ID_EOLN); hCombo = GetDlgItem(hDlg, ID_EOLN);
if (hCombo) if (hCombo)
Globals.iEoln = SendMessage(hCombo, CB_GETCURSEL, 0, 0); Globals.iEoln = (int) SendMessage(hCombo, CB_GETCURSEL, 0, 0);
} }
break; break;
} }
@ -453,7 +455,7 @@ VOID DIALOG_FilePrint(VOID)
printer.nMinPage = 1; printer.nMinPage = 1;
/* we really need to calculate number of pages to set nMaxPage and nToPage */ /* we really need to calculate number of pages to set nMaxPage and nToPage */
printer.nToPage = 0; printer.nToPage = 0;
printer.nMaxPage = -1; printer.nMaxPage = (WORD) -1;
/* Let commdlg manage copy settings */ /* Let commdlg manage copy settings */
printer.nCopies = (WORD)PD_USEDEVMODECOPIES; printer.nCopies = (WORD)PD_USEDEVMODECOPIES;
@ -772,7 +774,7 @@ VOID DIALOG_GoTo(VOID)
SendMessage(Globals.hEdit, EM_GETSEL, (WPARAM) &dwStart, (LPARAM) &dwEnd); SendMessage(Globals.hEdit, EM_GETSEL, (WPARAM) &dwStart, (LPARAM) &dwEnd);
nLine = 1; nLine = 1;
for (i = 0; pszText[i] && (i < dwStart); i++) for (i = 0; pszText[i] && (i < (int) dwStart); i++)
{ {
if (pszText[i] == '\n') if (pszText[i] == '\n')
nLine++; nLine++;
@ -803,10 +805,10 @@ VOID DIALOG_StatusBarUpdateCaretPos(VOID)
TCHAR buff[MAX_PATH]; TCHAR buff[MAX_PATH];
GetCaretPos(&point); GetCaretPos(&point);
line = SendMessage(Globals.hEdit, EM_LINEFROMCHAR, (WPARAM)-1, (LPARAM)0); line = (int) SendMessage(Globals.hEdit, EM_LINEFROMCHAR, (WPARAM)-1, (LPARAM)0);
ccol = SendMessage(Globals.hEdit, EM_CHARFROMPOS, (WPARAM)0, (LPARAM)MAKELPARAM(point.x, point.y)); ccol = (int) SendMessage(Globals.hEdit, EM_CHARFROMPOS, (WPARAM)0, (LPARAM)MAKELPARAM(point.x, point.y));
ccol = LOWORD(ccol); 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); _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); SendMessage(Globals.hStatusBar, SB_SETTEXT, (WPARAM) SB_SIMPLEID, (LPARAM)buff);

View file

@ -83,7 +83,7 @@ static int NOTEPAD_MenuCommand(WPARAM wParam)
case CMD_ABOUT: DialogBox(GetModuleHandle(NULL), case CMD_ABOUT: DialogBox(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDD_ABOUTBOX), MAKEINTRESOURCE(IDD_ABOUTBOX),
Globals.hMainWnd, Globals.hMainWnd,
AboutDialogProc); (DLGPROC) AboutDialogProc);
break; break;
case CMD_ABOUT_WINE: DIALOG_HelpAboutWine(); 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) static BOOL NOTEPAD_FindTextAt(FINDREPLACE *pFindReplace, LPCTSTR pszText, int iTextLength, DWORD dwPosition)
{ {
BOOL bMatches; BOOL bMatches;
int iTargetLength; size_t iTargetLength;
iTargetLength = _tcslen(pFindReplace->lpstrFindWhat); 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])) if ((dwPosition > 0) && !_istspace(pszText[dwPosition-1]))
bMatches = FALSE; bMatches = FALSE;
if ((dwPosition < iTextLength - 1) && !_istspace(pszText[dwPosition+1])) if ((dwPosition < (DWORD) iTextLength - 1) && !_istspace(pszText[dwPosition+1]))
bMatches = FALSE; 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) BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert)
{ {
int iTextLength, iTargetLength; int iTextLength, iTargetLength;
int iAdjustment = 0; size_t iAdjustment = 0;
LPTSTR pszText = NULL; LPTSTR pszText = NULL;
DWORD dwPosition, dwBegin, dwEnd; DWORD dwPosition, dwBegin, dwEnd;
BOOL bMatches = FALSE; BOOL bMatches = FALSE;
TCHAR szResource[128], szText[128]; TCHAR szResource[128], szText[128];
BOOL bSuccess; BOOL bSuccess;
iTargetLength = _tcslen(pFindReplace->lpstrFindWhat); iTargetLength = (int) _tcslen(pFindReplace->lpstrFindWhat);
/* Retrieve the window text */ /* Retrieve the window text */
iTextLength = GetWindowTextLength(Globals.hEdit); 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); 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)) if (NOTEPAD_FindTextAt(pFindReplace, pszText, iTextLength, dwBegin))
{ {
@ -164,7 +164,7 @@ BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert)
{ {
/* Find Down */ /* Find Down */
dwPosition = dwEnd; dwPosition = dwEnd;
while(dwPosition < iTextLength) while(dwPosition < (DWORD) iTextLength)
{ {
bMatches = NOTEPAD_FindTextAt(pFindReplace, pszText, iTextLength, dwPosition); bMatches = NOTEPAD_FindTextAt(pFindReplace, pszText, iTextLength, dwPosition);
if (bMatches) if (bMatches)
@ -189,7 +189,7 @@ BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert)
{ {
/* Found target */ /* Found target */
if (dwPosition > dwBegin) if (dwPosition > dwBegin)
dwPosition += iAdjustment; dwPosition += (DWORD) iAdjustment;
SendMessage(Globals.hEdit, EM_SETSEL, dwPosition, dwPosition + iTargetLength); SendMessage(Globals.hEdit, EM_SETSEL, dwPosition, dwPosition + iTargetLength);
SendMessage(Globals.hEdit, EM_SCROLLCARET, 0, 0); SendMessage(Globals.hEdit, EM_SCROLLCARET, 0, 0);
bSuccess = TRUE; bSuccess = TRUE;
@ -263,10 +263,12 @@ static VOID NOTEPAD_InitData(VOID)
/*********************************************************************** /***********************************************************************
* Enable/disable items on the menu based on control state * 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; int enable;
UNREFERENCED_PARAMETER(index);
CheckMenuItem(GetMenu(Globals.hMainWnd), CMD_WRAP, CheckMenuItem(GetMenu(Globals.hMainWnd), CMD_WRAP,
MF_BYCOMMAND | (Globals.bWrapLongLines ? MF_CHECKED : MF_UNCHECKED)); MF_BYCOMMAND | (Globals.bWrapLongLines ? MF_CHECKED : MF_UNCHECKED));
if ( !Globals.bWrapLongLines ) 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); SendMessage(Globals.hEdit, EM_CANUNDO, 0, 0) ? MF_ENABLED : MF_GRAYED);
EnableMenuItem(menu, CMD_PASTE, EnableMenuItem(menu, CMD_PASTE,
IsClipboardFormatAvailable(CF_TEXT) ? MF_ENABLED : MF_GRAYED); 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; enable = (HIWORD(enable) == LOWORD(enable)) ? MF_GRAYED : MF_ENABLED;
EnableMenuItem(menu, CMD_CUT, enable); EnableMenuItem(menu, CMD_CUT, enable);
EnableMenuItem(menu, CMD_COPY, 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 className[] = {'N','P','C','l','a','s','s',0};
static const WCHAR winName[] = {'N','o','t','e','p','a','d',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)); ZeroMemory(&Globals, sizeof(Globals));
Globals.hInstance = hInstance; Globals.hInstance = hInstance;
@ -585,5 +590,5 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
} }
} }
SaveSettings(); SaveSettings();
return msg.wParam; return (int) msg.wParam;
} }

View file

@ -187,7 +187,7 @@ static BOOL SaveString(HKEY hKey, LPCSTR pszValueName, LPCTSTR pszValue)
pszValueNameT = pszValueName; pszValueNameT = pszValueName;
#endif #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) void SaveSettings(void)