From 8595c0849801cf4eb053d3b3182cf0a883a4ad66 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 19 Jun 2018 02:35:33 +0300 Subject: [PATCH] Eliminate 'declaration of var hides global declaration' compiler warning * cord/tests/de.c (add_map): Rename line argument to line_arg. * cord/tests/de_win.c (get_line_rect): Likewise. * cord/tests/de_win.c (WndProc): Rename hwnd argument to hwnd_arg. * cord/tests/de_win.c (invalidate_line): Rename line local variable to line_r. --- cord/tests/de.c | 4 ++-- cord/tests/de_win.c | 42 +++++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/cord/tests/de.c b/cord/tests/de.c index cc22df3..c543cce 100644 --- a/cord/tests/de.c +++ b/cord/tests/de.c @@ -141,13 +141,13 @@ void prune_map(void) } /* Add mapping entry */ -void add_map(int line, size_t pos) +void add_map(int line_arg, size_t pos) { line_map new_map = GC_NEW(struct LineMapRep); if (NULL == new_map) OUT_OF_MEMORY; if (current_map_size >= MAX_MAP_SIZE) prune_map(); - new_map -> line = line; + new_map -> line = line_arg; new_map -> pos = pos; new_map -> previous = current_map; GC_end_stubborn_change(new_map); diff --git a/cord/tests/de_win.c b/cord/tests/de_win.c index 2715c41..4a43801 100644 --- a/cord/tests/de_win.c +++ b/cord/tests/de_win.c @@ -160,9 +160,9 @@ char * control_chars(char * text, size_t len) int char_width; int char_height; -void get_line_rect(int line, int win_width, RECT * rectp) +void get_line_rect(int line_arg, int win_width, RECT * rectp) { - rectp -> top = line * (LONG)char_height; + rectp -> top = line_arg * (LONG)char_height; rectp -> bottom = rectp->top + char_height; rectp -> left = 0; rectp -> right = win_width; @@ -201,7 +201,7 @@ INT_PTR CALLBACK AboutBoxCallback( HWND hDlg, UINT message, return FALSE; } -LRESULT CALLBACK WndProc (HWND hwnd, UINT message, +LRESULT CALLBACK WndProc (HWND hwnd_arg, UINT message, WPARAM wParam, LPARAM lParam) { static HINSTANCE hInstance; @@ -218,13 +218,13 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, { case WM_CREATE: hInstance = ( (LPCREATESTRUCT) lParam)->hInstance; - dc = GetDC(hwnd); + dc = GetDC(hwnd_arg); SelectObject(dc, GetStockObject(SYSTEM_FIXED_FONT)); GetTextMetrics(dc, &tm); - ReleaseDC(hwnd, dc); + ReleaseDC(hwnd_arg, dc); char_width = tm.tmAveCharWidth; char_height = tm.tmHeight + tm.tmExternalLeading; - GetClientRect(hwnd, &client_area); + GetClientRect(hwnd_arg, &client_area); COLS = (client_area.right - client_area.left)/char_width; LINES = (client_area.bottom - client_area.top)/char_height; generic_init(); @@ -232,21 +232,21 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, case WM_CHAR: if (wParam == QUIT) { - SendMessage( hwnd, WM_CLOSE, 0, 0L ); + SendMessage(hwnd_arg, WM_CLOSE, 0, 0L); } else { do_command((int)wParam); } return(0); case WM_SETFOCUS: - CreateCaret(hwnd, NULL, char_width, char_height); - ShowCaret(hwnd); + CreateCaret(hwnd_arg, NULL, char_width, char_height); + ShowCaret(hwnd_arg); caret_visible = 1; update_cursor(); return(0); case WM_KILLFOCUS: - HideCaret(hwnd); + HideCaret(hwnd_arg); DestroyCaret(); caret_visible = 0; return(0); @@ -270,13 +270,13 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, } else { switch(id) { case IDM_FILEEXIT: - SendMessage( hwnd, WM_CLOSE, 0, 0L ); + SendMessage(hwnd_arg, WM_CLOSE, 0, 0L); return( 0 ); case IDM_HELPABOUT: if( DialogBox( hInstance, TEXT("ABOUTBOX"), - hwnd, AboutBoxCallback ) ) - InvalidateRect( hwnd, NULL, TRUE ); + hwnd_arg, AboutBoxCallback ) ) + InvalidateRect(hwnd_arg, NULL, TRUE); return( 0 ); case IDM_HELPCONTENTS: de_error( @@ -289,7 +289,7 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, break; case WM_CLOSE: - DestroyWindow( hwnd ); + DestroyWindow(hwnd_arg); return 0; case WM_DESTROY: @@ -298,8 +298,8 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, return 0; case WM_PAINT: - dc = BeginPaint(hwnd, &ps); - GetClientRect(hwnd, &client_area); + dc = BeginPaint(hwnd_arg, &ps); + GetClientRect(hwnd_arg, &client_area); COLS = (client_area.right - client_area.left)/char_width; LINES = (client_area.bottom - client_area.top)/char_height; SelectObject(dc, GetStockObject(SYSTEM_FIXED_FONT)); @@ -335,11 +335,11 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, control, (int)strlen(control)); } } - EndPaint(hwnd, &ps); + EndPaint(hwnd_arg, &ps); screen_was_painted = 1; return 0; } - return DefWindowProc (hwnd, message, wParam, lParam); + return DefWindowProc(hwnd_arg, message, wParam, lParam); } int last_col; @@ -361,11 +361,11 @@ void update_cursor(void) void invalidate_line(int i) { - RECT line; + RECT line_r; if (!screen_was_painted) return; /* Invalidating a rectangle before painting seems result in a */ /* major performance problem. */ - get_line_rect(i, COLS*char_width, &line); - InvalidateRect(hwnd, &line, FALSE); + get_line_rect(i, COLS*char_width, &line_r); + InvalidateRect(hwnd, &line_r, FALSE); } -- 2.7.4