Eric Pouech : windows.globalization: Use a flexible array member for hstring_vector.
Module: wine Branch: master Commit: e47fe700840f534e99228efd88a6d812225ee953 URL: https://source.winehq.org/git/wine.git/?a=commit;h=e47fe700840f534e99228efd8... Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Thu Mar 24 09:54:23 2022 +0100 windows.globalization: Use a flexible array member for hstring_vector. GCC 11 complains about accessing struct hstring_vector (-Warray-bounds) when the allocation is made for a 0-sized vector. Using a C99 flexible array member gets rid of the warnings. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windows.globalization/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/windows.globalization/main.c b/dlls/windows.globalization/main.c index 3e5a59bde14..21ea2908679 100644 --- a/dlls/windows.globalization/main.c +++ b/dlls/windows.globalization/main.c @@ -54,9 +54,11 @@ struct hstring_vector LONG ref; ULONG count; - HSTRING values[1]; + HSTRING values[]; }; +C_ASSERT(sizeof(struct hstring_vector) == offsetof(struct hstring_vector, values[0])); + static inline struct hstring_vector *impl_from_IVectorView_HSTRING(IVectorView_HSTRING *iface) { return CONTAINING_RECORD(iface, struct hstring_vector, IVectorView_HSTRING_iface);
participants (1)
-
Alexandre Julliard