From: Eric Pouech epouech@codeweavers.com
This fixes -Wstringop-overread warnings with GCC 14. --- tools/winedump/msc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c index cb5fbb0b9ad..cec81114797 100644 --- a/tools/winedump/msc.c +++ b/tools/winedump/msc.c @@ -527,7 +527,7 @@ static void do_field(const unsigned char* start, const unsigned char* end)
case LF_ENUMERATE_V3: leaf_len = full_numeric_leaf(&full_value, &fieldtype->enumerate_v3.value); - cstr = (const char*)&fieldtype->enumerate_v3.value + leaf_len; + cstr = (const char*)fieldtype + offsetof(union codeview_fieldtype, enumerate_v3.value) + leaf_len; printf("\t\tEnumerate V3: '%s' value:%s\n", cstr, full_value_string(&full_value)); ptr += 2 + 2 + leaf_len + strlen(cstr) + 1; @@ -553,7 +553,7 @@ static void do_field(const unsigned char* start, const unsigned char* end)
case LF_MEMBER_V3: leaf_len = numeric_leaf(&value, &fieldtype->member_v3.offset); - cstr = (const char*)&fieldtype->member_v3.offset + leaf_len; + cstr = (const char*)fieldtype + offsetof(union codeview_fieldtype, member_v3.offset) + leaf_len; printf("\t\tMember V3: '%s' type:%x attr:%s @%d\n", cstr, fieldtype->member_v3.type, get_attr(fieldtype->member_v3.attribute), value); @@ -810,7 +810,7 @@ static void do_field(const unsigned char* start, const unsigned char* end) static void codeview_dump_one_type(unsigned curr_type, const union codeview_type* type) { const union codeview_reftype* reftype = (const union codeview_reftype*)type; - int i, leaf_len, value; + int i, leaf_len, offset, value; unsigned int j; const char* str;
@@ -894,7 +894,7 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type case LF_STRUCTURE_V3: case LF_CLASS_V3: leaf_len = numeric_leaf(&value, &type->struct_v3.structlen); - str = (const char*)&type->struct_v3.structlen + leaf_len; + str = (const char*)type + offsetof(union codeview_type, struct_v3.structlen) + leaf_len; printf("\t%x => %s V3 '%s' elts:%u property:%s\n" " fieldlist-type:%x derived-type:%x vshape:%x size:%u\n", curr_type, type->generic.id == LF_CLASS_V3 ? "Class" : "Struct", @@ -923,7 +923,7 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type
case LF_UNION_V3: leaf_len = numeric_leaf(&value, &type->union_v3.un_len); - str = (const char*)&type->union_v3.un_len + leaf_len; + str = (const char*)type + offsetof(union codeview_type, union_v3.un_len) + leaf_len; printf("\t%x => Union V3 '%s' count:%u property:%s fieldlist-type:%x size:%u\n", curr_type, str, type->union_v3.count, get_property(type->union_v3.property),