8000 MSVC needs the variables to be declared earlier. · fancycode/MemoryModule@13e979e · GitHub
[go: up one dir, main page]

Skip to content

Commit 13e979e

Browse files
committed
MSVC needs the variables to be declared earlier.
1 parent a5c5bc3 commit 13e979e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

MemoryModule.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,12 @@ static PIMAGE_RESOURCE_DIRECTORY_ENTRY _MemorySearchResourceEntryA(
867867
LPCSTR key)
868868
{
869869
PIMAGE_RESOURCE_DIRECTORY_ENTRY result = NULL;
870+
size_t searchKeyLen;
871+
#define MAX_LOCAL_KEY_LENGTH 2048
872+
// In most cases resource names are short, so optimize for that by
873+
// using a pre-allocated array.
874+
wchar_t _searchKeySpace[MAX_LOCAL_KEY_LENGTH+1];
875+
LPWSTR _searchKey;
870876

871877
if (!IS_INTRESOURCE(key) && key[0] == '#') {
872878
// special case: resource id given as string
@@ -886,12 +892,7 @@ static PIMAGE_RESOURCE_DIRECTORY_ENTRY _MemorySearchResourceEntryA(
886892

887893
// Resource names are always stored using 16bit characters, need to
888894
// convert string we search for.
889-
#define MAX_LOCAL_KEY_LENGTH 2048
890-
size_t searchKeyLen = strlen(key);
891-
// In most cases resource names are short, so optimize for that by
892-
// using a pre-allocated array.
893-
wchar_t _searchKeySpace[MAX_LOCAL_KEY_LENGTH+1];
894-
LPWSTR _searchKey;
895+
searchKeyLen = strlen(key);
895896
if (searchKeyLen > MAX_LOCAL_KEY_LENGTH) {
896897
size_t _searchKeySize = (searchKeyLen + 1) * sizeof(wchar_t);
897898
_searchKey = (LPWSTR) malloc(_searchKeySize);

0 commit comments

Comments
 (0)
0