From 58d5b3c880ce9d3f0d5f9d193dba250014676144 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Wed, 13 Oct 2021 15:17:20 +0200 Subject: [PATCH] dbghelp: Use proper macros for VARIANT. Signed-off-by: Eric Pouech Signed-off-by: Alexandre Julliard --- dlls/dbghelp/dwarf.c | 32 ++++++++++++------------ dlls/dbghelp/msc.c | 57 +++++++++++++++++++++---------------------- dlls/dbghelp/symbol.c | 18 +++++++------- dlls/dbghelp/type.c | 8 +++--- 4 files changed, 57 insertions(+), 58 deletions(-) diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index c15b59b57c3..c20c3db5ca9 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -1888,19 +1888,19 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm, case DW_FORM_data4: case DW_FORM_udata: case DW_FORM_addr: - v.n1.n2.vt = VT_UI4; - v.n1.n2.n3.lVal = value.u.uvalue; + V_VT(&v) = VT_UI4; + V_UI4(&v) = value.u.uvalue; break; case DW_FORM_data8: case DW_FORM_sec_offset: - v.n1.n2.vt = VT_UI8; - v.n1.n2.n3.llVal = value.u.lluvalue; + V_VT(&v) = VT_UI8; + V_UI8(&v) = value.u.lluvalue; break; case DW_FORM_sdata: - v.n1.n2.vt = VT_I4; - v.n1.n2.n3.lVal = value.u.svalue; + V_VT(&v) = VT_I4; + V_I4(&v) = value.u.svalue; break; case DW_FORM_strp: @@ -1908,8 +1908,8 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm, /* FIXME: native doesn't report const strings from here !! * however, the value of the string is in the code somewhere */ - v.n1.n2.vt = VT_I1 | VT_BYREF; - v.n1.n2.n3.byref = pool_strdup(&subpgm->ctx->module_ctx->module->pool, value.u.string); + V_VT(&v) = VT_BYREF; + V_BYREF(&v) = pool_strdup(&subpgm->ctx->module_ctx->module->pool, value.u.string); break; case DW_FORM_block: @@ -1917,23 +1917,23 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm, case DW_FORM_block2: case DW_FORM_block4: case DW_FORM_exprloc: - v.n1.n2.vt = VT_I4; + V_VT(&v) = VT_I4; switch (value.u.block.size) { - case 1: v.n1.n2.n3.lVal = *(BYTE*)value.u.block.ptr; break; - case 2: v.n1.n2.n3.lVal = *(USHORT*)value.u.block.ptr; break; - case 4: v.n1.n2.n3.lVal = *(DWORD*)value.u.block.ptr; break; + case 1: V_I4(&v) = *(BYTE*)value.u.block.ptr; break; + case 2: V_I4(&v) = *(USHORT*)value.u.block.ptr; break; + case 4: V_I4(&v) = *(DWORD*)value.u.block.ptr; break; default: - v.n1.n2.vt = VT_I1 | VT_BYREF; - v.n1.n2.n3.byref = pool_alloc(&subpgm->ctx->module_ctx->module->pool, value.u.block.size); - memcpy(v.n1.n2.n3.byref, value.u.block.ptr, value.u.block.size); + V_VT(&v) = VT_BYREF; + V_BYREF(&v) = pool_alloc(&subpgm->ctx->module_ctx->module->pool, value.u.block.size); + memcpy(V_BYREF(&v), value.u.block.ptr, value.u.block.size); } break; default: FIXME("Unsupported form for const value %s (%lx)\n", debugstr_a(name.u.string), value.form); - v.n1.n2.vt = VT_EMPTY; + V_VT(&v) = VT_EMPTY; } if (subpgm->func) { diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index c3e243879b2..353915cc7db 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -263,8 +263,8 @@ static int leaf_as_variant(VARIANT* v, const unsigned short int* leaf) if (type < LF_NUMERIC) { - v->n1.n2.vt = VT_UINT; - v->n1.n2.n3.uintVal = type; + V_VT(v) = VT_UINT; + V_UINT(v) = type; } else { @@ -272,109 +272,108 @@ static int leaf_as_variant(VARIANT* v, const unsigned short int* leaf) { case LF_CHAR: length += 1; - v->n1.n2.vt = VT_I1; - v->n1.n2.n3.cVal = *(const char*)leaf; + V_VT(v) = VT_I1; + V_I1(v) = *(const char*)leaf; break; case LF_SHORT: length += 2; - v->n1.n2.vt = VT_I2; - v->n1.n2.n3.iVal = *(const short*)leaf; + V_VT(v) = VT_I2; + V_I2(v) = *(const short*)leaf; break; case LF_USHORT: length += 2; - v->n1.n2.vt = VT_UI2; - v->n1.n2.n3.uiVal = *leaf; + V_VT(v) = VT_UI2; + V_UI2(v) = *leaf; break; case LF_LONG: length += 4; - v->n1.n2.vt = VT_I4; - v->n1.n2.n3.lVal = *(const int*)leaf; + V_VT(v) = VT_I4; + V_I4(v) = *(const int*)leaf; break; case LF_ULONG: length += 4; - v->n1.n2.vt = VT_UI4; - v->n1.n2.n3.uiVal = *(const unsigned int*)leaf; + V_VT(v) = VT_UI4; + V_UI4(v) = *(const unsigned int*)leaf; break; case LF_QUADWORD: length += 8; - v->n1.n2.vt = VT_I8; - v->n1.n2.n3.llVal = *(const long long int*)leaf; + V_VT(v) = VT_I8; + V_I8(v) = *(const long long int*)leaf; break; case LF_UQUADWORD: length += 8; - v->n1.n2.vt = VT_UI8; - v->n1.n2.n3.ullVal = *(const long long unsigned int*)leaf; + V_VT(v) = VT_UI8; + V_UI8(v) = *(const long long unsigned int*)leaf; break; case LF_REAL32: length += 4; - v->n1.n2.vt = VT_R4; - v->n1.n2.n3.fltVal = *(const float*)leaf; + V_VT(v) = VT_R4; + V_R4(v) = *(const float*)leaf; break; case LF_REAL48: FIXME("Unsupported numeric leaf type %04x\n", type); length += 6; - v->n1.n2.vt = VT_EMPTY; /* FIXME */ + V_VT(v) = VT_EMPTY; /* FIXME */ break; case LF_REAL64: length += 8; - v->n1.n2.vt = VT_R8; - v->n1.n2.n3.fltVal = *(const double*)leaf; + V_VT(v) = VT_R8; + V_R8(v) = *(const double*)leaf; break; case LF_REAL80: FIXME("Unsupported numeric leaf type %04x\n", type); length += 10; - v->n1.n2.vt = VT_EMPTY; /* FIXME */ + V_VT(v) = VT_EMPTY; /* FIXME */ break; case LF_REAL128: FIXME("Unsupported numeric leaf type %04x\n", type); length += 16; - v->n1.n2.vt = VT_EMPTY; /* FIXME */ + V_VT(v) = VT_EMPTY; /* FIXME */ break; case LF_COMPLEX32: FIXME("Unsupported numeric leaf type %04x\n", type); length += 4; - v->n1.n2.vt = VT_EMPTY; /* FIXME */ + V_VT(v) = VT_EMPTY; /* FIXME */ break; case LF_COMPLEX64: FIXME("Unsupported numeric leaf type %04x\n", type); length += 8; - v->n1.n2.vt = VT_EMPTY; /* FIXME */ + V_VT(v) = VT_EMPTY; /* FIXME */ break; case LF_COMPLEX80: FIXME("Unsupported numeric leaf type %04x\n", type); length += 10; - v->n1.n2.vt = VT_EMPTY; /* FIXME */ break; case LF_COMPLEX128: FIXME("Unsupported numeric leaf type %04x\n", type); length += 16; - v->n1.n2.vt = VT_EMPTY; /* FIXME */ + V_VT(v) = VT_EMPTY; /* FIXME */ break; case LF_VARSTRING: FIXME("Unsupported numeric leaf type %04x\n", type); length += 2 + *leaf; - v->n1.n2.vt = VT_EMPTY; /* FIXME */ + V_VT(v) = VT_EMPTY; /* FIXME */ break; default: FIXME("Unknown numeric leaf type %04x\n", type); - v->n1.n2.vt = VT_EMPTY; /* FIXME */ + V_VT(v) = VT_EMPTY; /* FIXME */ break; } } diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index ffb0e53fdeb..0b71584e6e0 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -748,18 +748,18 @@ static void symt_fill_sym_info(struct module_pair* pair, if (data->container && (data->container->tag == SymTagFunction || data->container->tag == SymTagBlock)) sym_info->Flags |= SYMFLAG_LOCAL; - switch (data->u.value.n1.n2.vt) + switch (V_VT(&data->u.value)) { - case VT_I4: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.lVal; break; - case VT_I2: sym_info->Value = (ULONG)(LONG_PTR)data->u.value.n1.n2.n3.iVal; break; - case VT_I1: sym_info->Value = (ULONG)(LONG_PTR)data->u.value.n1.n2.n3.cVal; break; - case VT_UI4: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.ulVal; break; - case VT_UI2: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.uiVal; break; - case VT_UI1: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.bVal; break; - case VT_I1 | VT_BYREF: sym_info->Value = (ULONG64)(DWORD_PTR)data->u.value.n1.n2.n3.byref; break; + case VT_I4: sym_info->Value = (ULONG)V_I4(&data->u.value); break; + case VT_I2: sym_info->Value = (ULONG)(LONG_PTR)V_I2(&data->u.value); break; + case VT_I1: sym_info->Value = (ULONG)(LONG_PTR)V_I1(&data->u.value); break; + case VT_UI4: sym_info->Value = (ULONG)V_UI4(&data->u.value); break; + case VT_UI2: sym_info->Value = (ULONG)V_UI2(&data->u.value); break; + case VT_UI1: sym_info->Value = (ULONG)V_UI1(&data->u.value); break; + case VT_BYREF: sym_info->Value = (ULONG64)(DWORD_PTR)V_BYREF(&data->u.value); break; case VT_EMPTY: sym_info->Value = 0; break; default: - FIXME("Unsupported variant type (%u)\n", data->u.value.n1.n2.vt); + FIXME("Unsupported variant type (%u)\n", V_VT(&data->u.value)); sym_info->Value = 0; break; } diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index d41e13ef79e..e50c5cac1fd 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -371,8 +371,8 @@ BOOL symt_add_enum_element(struct module* module, struct symt_enum* enum_type, e->kind = DataIsConstant; e->container = &enum_type->symt; e->type = enum_type->base_type; - e->u.value.n1.n2.vt = VT_I4; - e->u.value.n1.n2.n3.lVal = value; + V_VT(&e->u.value) = VT_I4; + V_I4(&e->u.value) = value; p = vector_add(&enum_type->vchildren, &module->pool); if (!p) return FALSE; /* FIXME we leak e */ @@ -952,8 +952,8 @@ BOOL symt_get_info(struct module* module, const struct symt* type, } } if (loc.kind != loc_absolute) return FALSE; - X(VARIANT).n1.n2.vt = VT_UI4; /* FIXME */ - X(VARIANT).n1.n2.n3.uiVal = loc.offset; + V_VT(&X(VARIANT)) = VT_UI4; /* FIXME */ + V_UI4(&X(VARIANT)) = loc.offset; } break; default: return FALSE;