resource id compar typo

This commit is contained in:
Nikita Smith
2025-02-25 14:41:34 -08:00
parent 1d441bac30
commit 8a8a8bcc8d
2 changed files with 62 additions and 62 deletions
+2 -2
View File
@@ -476,15 +476,15 @@ coff_write_resource(Arena *arena,
internal int internal int
coff_resource_id_compar(void *raw_a, void *raw_b) coff_resource_id_compar(void *raw_a, void *raw_b)
{ {
int cmp = 0; int cmp;
COFF_ResourceID *a = raw_a; COFF_ResourceID *a = raw_a;
COFF_ResourceID *b = raw_b; COFF_ResourceID *b = raw_b;
if (a->type == b->type) { if (a->type == b->type) {
switch (a->type) { switch (a->type) {
default:
case COFF_ResourceIDType_Null: cmp = 0; break; case COFF_ResourceIDType_Null: cmp = 0; break;
case COFF_ResourceIDType_Number: cmp = MemoryCompare(&a->u.number, &b->u.number, sizeof(a->u.number)); break; case COFF_ResourceIDType_Number: cmp = MemoryCompare(&a->u.number, &b->u.number, sizeof(a->u.number)); break;
case COFF_ResourceIDType_String: cmp = strncmp((char *)a->u.string.str, (char *)b->u.string.str, Min(a->u.string.size, b->u.string.size)); break; case COFF_ResourceIDType_String: cmp = strncmp((char *)a->u.string.str, (char *)b->u.string.str, Min(a->u.string.size, b->u.string.size)); break;
default: InvalidPath; break;
} }
} else { } else {
cmp = a->type < b->type ? -1 : a->type > b->type ? +1 : 0; cmp = a->type < b->type ? -1 : a->type > b->type ? +1 : 0;
+1 -1
View File
@@ -1568,7 +1568,7 @@ pe_resource_dir_push_dir(Arena *arena, PE_ResourceDir *dir, COFF_ResourceID id,
internal PE_ResourceNode * internal PE_ResourceNode *
pe_resource_dir_search_node(PE_ResourceDir *dir, COFF_ResourceID id) pe_resource_dir_search_node(PE_ResourceDir *dir, COFF_ResourceID id)
{ {
for (PE_ResourceNode *i = dir->id_list.first; i != NULL; i = i->next) { for (PE_ResourceNode *i = dir->id_list.first; i != 0; i = i->next) {
if (coff_resource_id_compar(&i->data.id, &id) == 0) { if (coff_resource_id_compar(&i->data.id, &id) == 0) {
return i; return i;
} }