From 05b6b556106bff27201477f79ffd0dcde47ce1c8 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Fri, 25 Jan 2019 13:07:47 +0100 Subject: [PATCH] [WINHLP32] Sync with Wine Staging 4.0. CORE-15682 --- base/applications/winhlp32/CMakeLists.txt | 2 +- base/applications/winhlp32/macro.c | 2 +- base/applications/winhlp32/macro.lex.l | 14 +++++++++----- base/applications/winhlp32/macro.lex.yy.c | 21 +++++++++++---------- base/applications/winhlp32/macro.lex.yy.h | 5 +---- base/applications/winhlp32/winhelp.c | 13 ++++++------- media/doc/README.WINE | 2 +- 7 files changed, 30 insertions(+), 29 deletions(-) diff --git a/base/applications/winhlp32/CMakeLists.txt b/base/applications/winhlp32/CMakeLists.txt index aecb08cfd39..cb4ee2e72aa 100644 --- a/base/applications/winhlp32/CMakeLists.txt +++ b/base/applications/winhlp32/CMakeLists.txt @@ -2,8 +2,8 @@ include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine) add_definitions( + -D__WINESRC__ -D__ROS_LONG64__ - -D_CRT_NONSTDC_NO_DEPRECATE -Dfileno=_fileno -Disatty=_isatty) diff --git a/base/applications/winhlp32/macro.c b/base/applications/winhlp32/macro.c index 5a25d6c9449..280e6182361 100644 --- a/base/applications/winhlp32/macro.c +++ b/base/applications/winhlp32/macro.c @@ -154,7 +154,7 @@ void CALLBACK MACRO_About(void) WCHAR name[256]; HICON icon = LoadImageW( Globals.hInstance, MAKEINTRESOURCEW(IDI_WINHELP), IMAGE_ICON, 48, 48, LR_SHARED ); - LoadStringW( Globals.hInstance, STID_WINE_HELP, name, sizeof(name)/sizeof(WCHAR) ); + LoadStringW( Globals.hInstance, STID_WINE_HELP, name, ARRAY_SIZE( name )); ShellAboutW( MACRO_CurrentWindow()->hMainWnd, name, NULL, icon ); } diff --git a/base/applications/winhlp32/macro.lex.l b/base/applications/winhlp32/macro.lex.l index da2dd22e447..eab7a795af0 100644 --- a/base/applications/winhlp32/macro.lex.l +++ b/base/applications/winhlp32/macro.lex.l @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ %} -%option noinput nounput never-interactive 8bit noyywrap +%option noinput nounput never-interactive 8bit %x quote %{ #include "config.h" @@ -75,7 +75,7 @@ struct lexret yylval; /* opening a new one */ if (lex_data->quote_stk_idx == 0) { - assert(lex_data->cache_used < sizeof(lex_data->cache_string) / sizeof(lex_data->cache_string[0])); + assert(lex_data->cache_used < ARRAY_SIZE(lex_data->cache_string)); lex_data->strptr = lex_data->cache_string[lex_data->cache_used] = HeapAlloc(GetProcessHeap(), 0, strlen(lex_data->macroptr) + 1); yylval.string = lex_data->strptr; lex_data->cache_used++; @@ -83,7 +83,7 @@ struct lexret yylval; } else *lex_data->strptr++ = yytext[0]; lex_data->quote_stack[lex_data->quote_stk_idx++] = yytext[0]; - assert(lex_data->quote_stk_idx < sizeof(lex_data->quote_stack) / sizeof(lex_data->quote_stack[0])); + assert(lex_data->quote_stk_idx < ARRAY_SIZE(lex_data->quote_stack)); } else { @@ -222,7 +222,7 @@ CheckArgs_end: static int MACRO_CallBoolFunc(void *fn, const char* args, void** ret) { void* pa[2]; - int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args); + int idx = MACRO_CheckArgs(pa, ARRAY_SIZE(pa), args); if (idx < 0) return 0; if (!fn) return 1; @@ -257,7 +257,7 @@ static int MACRO_CallBoolFunc(void *fn, const char* args, void** ret) static int MACRO_CallVoidFunc(void *fn, const char* args) { void* pa[6]; - int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args); + int idx = MACRO_CheckArgs(pa, ARRAY_SIZE(pa), args); if (idx < 0) return 0; if (!fn) return 1; @@ -367,3 +367,7 @@ WINHELP_WINDOW* MACRO_CurrentWindow(void) { return lex_data ? lex_data->window : Globals.active_win; } + +#ifndef yywrap +int yywrap(void) { return 1; } +#endif diff --git a/base/applications/winhlp32/macro.lex.yy.c b/base/applications/winhlp32/macro.lex.yy.c index 255bdb159ad..ff4d78cfe6d 100644 --- a/base/applications/winhlp32/macro.lex.yy.c +++ b/base/applications/winhlp32/macro.lex.yy.c @@ -333,9 +333,6 @@ void yyfree (void * ); /* Begin user sect3 */ -#define yywrap() 1 -#define YY_SKIP_YYWRAP - typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; @@ -528,7 +525,7 @@ struct lexret yylval; #define YY_INPUT(buf,result,max_size)\ if ((result = *lex_data->macroptr ? 1 : 0)) buf[0] = *lex_data->macroptr++; -#line 532 "macro.lex.yy.c" +#line 529 "macro.lex.yy.c" #define INITIAL 0 #define quote 1 @@ -712,7 +709,7 @@ YY_DECL #line 58 "macro.lex.l" -#line 716 "macro.lex.yy.c" +#line 713 "macro.lex.yy.c" if ( !(yy_init) ) { @@ -827,7 +824,7 @@ YY_RULE_SETUP /* opening a new one */ if (lex_data->quote_stk_idx == 0) { - assert(lex_data->cache_used < sizeof(lex_data->cache_string) / sizeof(lex_data->cache_string[0])); + assert(lex_data->cache_used < ARRAY_SIZE(lex_data->cache_string)); lex_data->strptr = lex_data->cache_string[lex_data->cache_used] = HeapAlloc(GetProcessHeap(), 0, strlen(lex_data->macroptr) + 1); yylval.string = lex_data->strptr; lex_data->cache_used++; @@ -835,7 +832,7 @@ YY_RULE_SETUP } else *lex_data->strptr++ = yytext[0]; lex_data->quote_stack[lex_data->quote_stk_idx++] = yytext[0]; - assert(lex_data->quote_stk_idx < sizeof(lex_data->quote_stack) / sizeof(lex_data->quote_stack[0])); + assert(lex_data->quote_stk_idx < ARRAY_SIZE(lex_data->quote_stack)); } else { @@ -880,7 +877,7 @@ YY_RULE_SETUP #line 108 "macro.lex.l" ECHO; YY_BREAK -#line 884 "macro.lex.yy.c" +#line 881 "macro.lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1957,7 +1954,7 @@ CheckArgs_end: static int MACRO_CallBoolFunc(void *fn, const char* args, void** ret) { void* pa[2]; - int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args); + int idx = MACRO_CheckArgs(pa, ARRAY_SIZE(pa), args); if (idx < 0) return 0; if (!fn) return 1; @@ -1992,7 +1989,7 @@ static int MACRO_CallBoolFunc(void *fn, const char* args, void** ret) static int MACRO_CallVoidFunc(void *fn, const char* args) { void* pa[6]; - int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args); + int idx = MACRO_CheckArgs(pa, ARRAY_SIZE(pa), args); if (idx < 0) return 0; if (!fn) return 1; @@ -2103,3 +2100,7 @@ WINHELP_WINDOW* MACRO_CurrentWindow(void) return lex_data ? lex_data->window : Globals.active_win; } +#ifndef yywrap +int yywrap(void) { return 1; } +#endif + diff --git a/base/applications/winhlp32/macro.lex.yy.h b/base/applications/winhlp32/macro.lex.yy.h index 05147e869b2..7b39b6c1465 100644 --- a/base/applications/winhlp32/macro.lex.yy.h +++ b/base/applications/winhlp32/macro.lex.yy.h @@ -201,9 +201,6 @@ void yyfree (void * ); /* Begin user sect3 */ -#define yywrap() 1 -#define YY_SKIP_YYWRAP - extern int yylineno; extern char *yytext; @@ -318,6 +315,6 @@ extern int yylex (void); #line 107 "macro.lex.l" -#line 322 "macro.lex.yy.h" +#line 319 "macro.lex.yy.h" #undef yyIN_HEADER #endif /* yyHEADER_H */ diff --git a/base/applications/winhlp32/winhelp.c b/base/applications/winhlp32/winhelp.c index 2ac3d2ff249..7ce5d4a0a8f 100644 --- a/base/applications/winhlp32/winhelp.c +++ b/base/applications/winhlp32/winhelp.c @@ -66,19 +66,18 @@ static void WINHELP_InitFonts(HWND hWnd) {-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}}, {-10, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}}, { -8, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}}}; -#define FONTS_LEN (sizeof(logfontlist)/sizeof(*logfontlist)) - static HFONT fonts[FONTS_LEN]; + static HFONT fonts[ARRAY_SIZE(logfontlist)]; static BOOL init = FALSE; - win->fonts_len = FONTS_LEN; + win->fonts_len = ARRAY_SIZE(logfontlist); win->fonts = fonts; if (!init) { UINT i; - for (i = 0; i < FONTS_LEN; i++) + for (i = 0; i < ARRAY_SIZE(logfontlist); i++) { fonts[i] = CreateFontIndirectW(&logfontlist[i]); } @@ -595,7 +594,7 @@ static void WINHELP_RememberPage(WINHELP_WINDOW* win, WINHELP_WNDPAGE* wpage) if (!Globals.history.index || Globals.history.set[0].page != wpage->page) { - num = sizeof(Globals.history.set) / sizeof(Globals.history.set[0]); + num = ARRAY_SIZE(Globals.history.set); /* we're full, remove latest entry */ if (Globals.history.index == num) { @@ -610,7 +609,7 @@ static void WINHELP_RememberPage(WINHELP_WINDOW* win, WINHELP_WNDPAGE* wpage) } if (win->hHistoryWnd) InvalidateRect(win->hHistoryWnd, NULL, TRUE); - num = sizeof(win->back.set) / sizeof(win->back.set[0]); + num = ARRAY_SIZE(win->back.set); if (win->back.index == num) { /* we're full, remove latest entry */ @@ -1136,7 +1135,7 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara GetWindowRect(hWnd, &r); r.right = r.left + 30 * tm.tmAveCharWidth; - r.bottom = r.top + (sizeof(Globals.history.set) / sizeof(Globals.history.set[0])) * tm.tmHeight; + r.bottom = r.top + ARRAY_SIZE(Globals.history.set) * tm.tmHeight; AdjustWindowRect(&r, GetWindowLongW(hWnd, GWL_STYLE), FALSE); if (r.left < 0) {r.right -= r.left; r.left = 0;} if (r.top < 0) {r.bottom -= r.top; r.top = 0;} diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 05961c6c292..9494440bff7 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -239,7 +239,7 @@ reactos/base/applications/extrac32 # Synced to WineStaging-4.0 reactos/base/applications/iexplore # Synced to WineStaging-3.3 reactos/base/applications/notepad # Forked at Wine-20041201 reactos/base/applications/regedit # Out of sync -reactos/base/applications/winhlp32 # Synced to WineStaging-3.3 +reactos/base/applications/winhlp32 # Synced to WineStaging-4.0 reactos/base/applications/wordpad # Synced to WineStaging-1.9.16 reactos/base/applications/write # Synced to WineStaging-3.3 reactos/base/services/rpcss # Synced to WineStaging-3.3