Skip to content

Commit fc6a58a

Browse files
committed
Changed variable definitions to fix compiler errors in Visual Studio.
1 parent 54e3a29 commit fc6a58a

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

MemoryModule.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -572,17 +572,18 @@ static PIMAGE_RESOURCE_DIRECTORY_ENTRY _MemorySearchResourceEntry(
572572
}
573573
}
574574
} else {
575-
start = 0;
576-
end = resources->NumberOfIdEntries;
577575
#if !defined(UNICODE)
578576
char *searchKey = NULL;
579577
int searchKeyLength = 0;
580578
#endif
579+
start = 0;
580+
end = resources->NumberOfIdEntries;
581581
while (end > start) {
582582
// resource names are always stored using 16bit characters
583-
middle = (start + end) >> 1;
584-
PIMAGE_RESOURCE_DIR_STRING_U resourceString = (PIMAGE_RESOURCE_DIR_STRING_U) (((char *) root) + (entries[middle].Name & 0x7FFFFFFF));
585583
int cmp;
584+
PIMAGE_RESOURCE_DIR_STRING_U resourceString;
585+
middle = (start + end) >> 1;
586+
resourceString = (PIMAGE_RESOURCE_DIR_STRING_U) (((char *) root) + (entries[middle].Name & 0x7FFFFFFF));
586587
#if !defined(UNICODE)
587588
if (searchKey == NULL || searchKeyLength < resourceString->Length) {
588589
void *tmp = realloc(searchKey, resourceString->Length);
@@ -693,17 +694,20 @@ MemoryLoadString(HMEMORYMODULE module, UINT id, LPTSTR buffer, int maxsize)
693694
int
694695
MemoryLoadStringEx(HMEMORYMODULE module, UINT id, LPTSTR buffer, int maxsize, WORD language)
695696
{
697+
HMEMORYRSRC resource;
698+
PIMAGE_RESOURCE_DIR_STRING_U data;
699+
DWORD size;
696700
if (maxsize == 0) {
697701
return 0;
698702
}
699703

700-
HMEMORYRSRC resource = MemoryFindResourceEx(module, MAKEINTRESOURCE((id >> 4) + 1), RT_STRING, language);
704+
resource = MemoryFindResourceEx(module, MAKEINTRESOURCE((id >> 4) + 1), RT_STRING, language);
701705
if (resource == NULL) {
702706
buffer[0] = 0;
703707
return 0;
704708
}
705709

706-
PIMAGE_RESOURCE_DIR_STRING_U data = MemoryLoadResource(module, resource);
710+
data = MemoryLoadResource(module, resource);
707711
id = id & 0x0f;
708712
while (id--) {
709713
data = (PIMAGE_RESOURCE_DIR_STRING_U) (((char *) data) + (data->Length + 1) * sizeof(WCHAR));
@@ -714,8 +718,8 @@ MemoryLoadStringEx(HMEMORYMODULE module, UINT id, LPTSTR buffer, int maxsize, WO
714718
return 0;
715719
}
716720

717-
DWORD size = data->Length;
718-
if (size >= maxsize) {
721+
size = data->Length;
722+
if (size >= (DWORD) maxsize) {
719723
size = maxsize;
720724
} else {
721725
buffer[size] = 0;

0 commit comments

Comments
 (0)