[MORE] PagePrompt(): Optimize check to load string resources (#7476)

It is useless to check each string individually and to try to load them again.
Use a common flag instead.

Follow-up to 2dbbfe8 (0.4.15-dev-2691).
This commit is contained in:
Serge Gautherie 2024-10-22 20:44:27 +02:00 committed by GitHub
parent cf955094b4
commit 2d655a487e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -176,19 +176,20 @@ PagePrompt(PCON_PAGER Pager, DWORD Done, DWORD Total)
static WCHAR StrLineAt[80] = L""; static WCHAR StrLineAt[80] = L"";
static WCHAR StrOptions[80] = L""; static WCHAR StrOptions[80] = L"";
static WCHAR StrLines[80] = L""; static WCHAR StrLines[80] = L"";
static BOOL AreStrLoaded = FALSE;
WCHAR szPercent[80] = L""; WCHAR szPercent[80] = L"";
WCHAR szLineAt[80] = L""; WCHAR szLineAt[80] = L"";
/* Load the prompt strings */ /* Load the prompt strings */
if (!*StrPercent) if (!AreStrLoaded)
{
K32LoadStringW(NULL, IDS_CONTINUE_PERCENT, StrPercent, ARRAYSIZE(StrPercent)); K32LoadStringW(NULL, IDS_CONTINUE_PERCENT, StrPercent, ARRAYSIZE(StrPercent));
if (!*StrLineAt)
K32LoadStringW(NULL, IDS_CONTINUE_LINE_AT, StrLineAt, ARRAYSIZE(StrLineAt)); K32LoadStringW(NULL, IDS_CONTINUE_LINE_AT, StrLineAt, ARRAYSIZE(StrLineAt));
if (!*StrOptions)
K32LoadStringW(NULL, IDS_CONTINUE_OPTIONS, StrOptions, ARRAYSIZE(StrOptions)); K32LoadStringW(NULL, IDS_CONTINUE_OPTIONS, StrOptions, ARRAYSIZE(StrOptions));
if (!*StrLines)
K32LoadStringW(NULL, IDS_CONTINUE_LINES, StrLines, ARRAYSIZE(StrLines)); K32LoadStringW(NULL, IDS_CONTINUE_LINES, StrLines, ARRAYSIZE(StrLines));
AreStrLoaded = TRUE;
}
/* /*
* Check whether the pager is prompting, but we have actually finished * Check whether the pager is prompting, but we have actually finished