Author: gschneider
Date: Sun May 30 22:19:21 2010
New Revision: 47458
URL:
http://svn.reactos.org/svn/reactos?rev=47458&view=rev
Log:
Various application fixes by Jan Roeloffzen, bug #5182, part 1
Notepad: remove unused variable, tabs -> spaces
Regedit: remove unused variable
Calc: dword->bool, remove unused variables, tabs -> spaces
Modified:
trunk/reactos/base/applications/calc/utl.c
trunk/reactos/base/applications/calc/winmain.c
trunk/reactos/base/applications/notepad/dialog.c
trunk/reactos/base/applications/regedit/edit.c
Modified: trunk/reactos/base/applications/calc/utl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/calc/utl…
==============================================================================
--- trunk/reactos/base/applications/calc/utl.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/calc/utl.c [iso-8859-1] Sun May 30 22:19:21 2010
@@ -2,7 +2,6 @@
void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base)
{
- TCHAR *ptr, *dst;
calc_number_t tmp;
int width;
@@ -21,9 +20,12 @@
/* calculate the width of integer number */
width = (rpn->f==0) ? 1 : (int)log10(fabs(rpn->f))+1;
if (calc.sci_out == TRUE || width > MAX_LD_WIDTH || width < -MAX_LD_WIDTH)
- ptr = buffer + _stprintf(buffer, TEXT("%#e"), rpn->f);
+ _stprintf(buffer, TEXT("%#e"), rpn->f);
else {
+ TCHAR *ptr, *dst;
+
ptr = buffer + _stprintf(buffer, TEXT("%#*.*f"), width,
((MAX_LD_WIDTH-width-1)>=0) ? MAX_LD_WIDTH-width-1 : 0, rpn->f);
+ /* format sring ensures there is a '.': */
dst = _tcschr(buffer, TEXT('.'));
while (--ptr > dst)
if (*ptr != TEXT('0'))
Modified: trunk/reactos/base/applications/calc/winmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/calc/win…
==============================================================================
--- trunk/reactos/base/applications/calc/winmain.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/calc/winmain.c [iso-8859-1] Sun May 30 22:19:21 2010
@@ -861,18 +861,18 @@
n = SendDlgItemMessage(hWnd, IDC_LIST_STAT, LB_GETCURSEL, 0, 0);
if (n == (DWORD)-1)
return TRUE;
- PostMessage(GetParent(hWnd), WM_LOAD_STAT, (WPARAM)n, 0);
+ PostMessage(GetParent(hWnd), WM_LOAD_STAT, (WPARAM)n, 0);
return TRUE;
case IDC_BUTTON_CD:
n = SendDlgItemMessage(hWnd, IDC_LIST_STAT, LB_GETCURSEL, 0, 0);
if (n == (DWORD)-1)
return TRUE;
- SendDlgItemMessage(hWnd, IDC_LIST_STAT, LB_DELETESTRING, (WPARAM)n, 0);
+ SendDlgItemMessage(hWnd, IDC_LIST_STAT, LB_DELETESTRING, (WPARAM)n, 0);
update_n_stats_items(hWnd, buffer);
delete_stat_item(n);
return TRUE;
case IDC_BUTTON_CAD:
- SendDlgItemMessage(hWnd, IDC_LIST_STAT, LB_RESETCONTENT, 0, 0);
+ SendDlgItemMessage(hWnd, IDC_LIST_STAT, LB_RESETCONTENT, 0, 0);
clean_stat_list();
update_n_stats_items(hWnd, buffer);
return TRUE;
@@ -910,20 +910,20 @@
static void CopyMemToClipboard(void *ptr)
{
if(OpenClipboard(NULL)) {
- HGLOBAL clipbuffer;
- TCHAR *buffer;
-
- EmptyClipboard();
- clipbuffer = GlobalAlloc(GMEM_DDESHARE, (_tcslen(ptr)+1)*sizeof(TCHAR));
- buffer = (TCHAR *)GlobalLock(clipbuffer);
- _tcscpy(buffer, ptr);
- GlobalUnlock(clipbuffer);
+ HGLOBAL clipbuffer;
+ TCHAR *buffer;
+
+ EmptyClipboard();
+ clipbuffer = GlobalAlloc(GMEM_DDESHARE, (_tcslen(ptr)+1)*sizeof(TCHAR));
+ buffer = (TCHAR *)GlobalLock(clipbuffer);
+ _tcscpy(buffer, ptr);
+ GlobalUnlock(clipbuffer);
#ifdef UNICODE
- SetClipboardData(CF_UNICODETEXT,clipbuffer);
+ SetClipboardData(CF_UNICODETEXT,clipbuffer);
#else
- SetClipboardData(CF_TEXT,clipbuffer);
+ SetClipboardData(CF_TEXT,clipbuffer);
#endif
- CloseClipboard();
+ CloseClipboard();
}
}
@@ -942,16 +942,16 @@
char *buffer = NULL;
if (OpenClipboard(NULL)) {
- HANDLE hData = GetClipboardData(CF_TEXT);
+ HANDLE hData = GetClipboardData(CF_TEXT);
char *fromClipboard;
if (hData != NULL) {
fromClipboard = (char *)GlobalLock(hData);
if (strlen(fromClipboard))
- buffer = _strupr(_strdup(fromClipboard));
- GlobalUnlock( hData );
- }
- CloseClipboard();
+ buffer = _strupr(_strdup(fromClipboard));
+ GlobalUnlock( hData );
+ }
+ CloseClipboard();
}
return buffer;
}
@@ -1110,20 +1110,20 @@
{
TCHAR text[64];
HMENU hMenu = CreatePopupMenu();
- DWORD idm;
+ BOOL idm;
LoadString(calc.hInstance, IDS_QUICKHELP, text, SIZEOF(text));
AppendMenu(hMenu, MF_STRING | MF_ENABLED, IDM_HELP_HELP, text);
- idm = (DWORD)TrackPopupMenu(hMenu,
- TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD |
TPM_RIGHTBUTTON,
- LOWORD(lp),
- HIWORD(lp),
- 0,
- hWnd,
- NULL);
+ idm = TrackPopupMenu( hMenu,
+ TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD |
TPM_RIGHTBUTTON,
+ LOWORD(lp),
+ HIWORD(lp),
+ 0,
+ hWnd,
+ NULL);
DestroyMenu(hMenu);
#ifndef DISABLE_HTMLHELP_SUPPORT
- if (idm != 0) {
+ if (idm) {
HH_POPUP popup;
memset(&popup, 0, sizeof(popup));
@@ -1139,6 +1139,8 @@
popup.idString = GetWindowLongPtr((HWND)wp, GWL_ID);
HtmlHelp((HWND)wp, HTMLHELP_PATH("/popups.txt"), HH_DISPLAY_TEXT_POPUP,
(DWORD_PTR)&popup);
}
+#else
+ (void)idm;
#endif
}
Modified: trunk/reactos/base/applications/notepad/dialog.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/notepad/…
==============================================================================
--- trunk/reactos/base/applications/notepad/dialog.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/notepad/dialog.c [iso-8859-1] Sun May 30 22:19:21
2010
@@ -400,7 +400,6 @@
{
TCHAR szText[128];
HWND hCombo;
- OFNOTIFY *pNotify;
UNREFERENCED_PARAMETER(wParam);
@@ -440,15 +439,13 @@
case WM_NOTIFY:
if (((NMHDR *) lParam)->code == CDN_FILEOK)
{
- pNotify = (OFNOTIFY *) lParam;
-
hCombo = GetDlgItem(hDlg, ID_ENCODING);
- if (hCombo)
- Globals.iEncoding = (int) SendMessage(hCombo, CB_GETCURSEL, 0, 0);
+ if (hCombo)
+ Globals.iEncoding = (int) SendMessage(hCombo, CB_GETCURSEL, 0, 0);
hCombo = GetDlgItem(hDlg, ID_EOLN);
- if (hCombo)
- Globals.iEoln = (int) SendMessage(hCombo, CB_GETCURSEL, 0, 0);
+ if (hCombo)
+ Globals.iEoln = (int) SendMessage(hCombo, CB_GETCURSEL, 0, 0);
}
break;
}
@@ -808,11 +805,11 @@
TCHAR szText[32];
switch(uMsg) {
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
hTextBox = GetDlgItem(hwndDialog, ID_LINENUMBER);
- _sntprintf(szText, SIZEOF(szText), _T("%d"), lParam);
+ _sntprintf(szText, SIZEOF(szText), _T("%d"), lParam);
SetWindowText(hTextBox, szText);
- break;
+ break;
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED)
{
@@ -823,11 +820,11 @@
EndDialog(hwndDialog, _ttoi(szText));
bResult = TRUE;
}
- else if (LOWORD(wParam) == IDCANCEL)
- {
+ else if (LOWORD(wParam) == IDCANCEL)
+ {
EndDialog(hwndDialog, 0);
bResult = TRUE;
- }
+ }
}
break;
}
@@ -862,7 +859,7 @@
Globals.hMainWnd, DIALOG_GoTo_DialogProc, nLine);
if (nLine >= 1)
- {
+ {
for (i = 0; pszText[i] && (nLine > 1) && (i < nLength - 1);
i++)
{
if (pszText[i] == '\n')
@@ -870,8 +867,8 @@
}
SendMessage(Globals.hEdit, EM_SETSEL, i, i);
SendMessage(Globals.hEdit, EM_SCROLLCARET, 0, 0);
- }
- HeapFree(GetProcessHeap(), 0, pszText);
+ }
+ HeapFree(GetProcessHeap(), 0, pszText);
}
VOID DIALOG_StatusBarUpdateCaretPos(VOID)
Modified: trunk/reactos/base/applications/regedit/edit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/edit.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/edit.c [iso-8859-1] Sun May 30 22:19:21 2010
@@ -276,7 +276,6 @@
{
WNDPROC oldproc;
HWND hwndValue;
- int len;
TCHAR ValueString[32];
LPTSTR Remainder;
DWORD Base;
@@ -319,7 +318,7 @@
dwordEditMode = EDIT_MODE_HEX;
if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA)))
{
- if ((len = GetWindowTextLength(hwndValue)))
+ if (GetWindowTextLength(hwndValue))
{
if (GetWindowText(hwndValue, ValueString, 32))
{
@@ -339,7 +338,7 @@
dwordEditMode = EDIT_MODE_DEC;
if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA)))
{
- if ((len = GetWindowTextLength(hwndValue)))
+ if (GetWindowTextLength(hwndValue))
{
if (GetWindowText(hwndValue, ValueString, 32))
{
@@ -356,7 +355,7 @@
case IDOK:
if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA)))
{
- if ((len = GetWindowTextLength(hwndValue)))
+ if (GetWindowTextLength(hwndValue))
{
if (!GetWindowText(hwndValue, ValueString, 32))
{