[PATCH 1/6] dlls/oledb32/tests: silence some gcc11 warnings (-Warray-bounds)

Eric Pouech eric.pouech at gmail.com
Mon Feb 14 03:28:00 CST 2022


size of 20 used in most of the tests is not necessarly wrong wrt the
fields adressed, even if I don't fully grasp the logic of a 20 byte buffer:
- VARIANT is 16 bytes on 32bit systems, and 24 bytes on 64 bit systems
- and all the other structures are 16 bytes at most

anyway, make it always of the size of a VARIANT, in order to keep gcc happy

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---
 dlls/oledb32/tests/convert.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c
index 0d888e834e3..7144150c2bc 100644
--- a/dlls/oledb32/tests/convert.c
+++ b/dlls/oledb32/tests/convert.c
@@ -327,7 +327,7 @@ static void test_converttoi1(void)
 {
     HRESULT hr;
     signed char dst;
-    BYTE src[20];
+    BYTE src[sizeof(VARIANT)]; /* assuming that VARIANT is larger than all the types used in src */
     DBSTATUS dst_status;
     DBLENGTH dst_len;
     static const WCHAR ten[] = {'1','0',0};
@@ -638,7 +638,7 @@ static void test_converttoi2(void)
 {
     HRESULT hr;
     signed short dst;
-    BYTE src[20];
+    BYTE src[sizeof(VARIANT)]; /* assuming that VARIANT is larger than all the types used in src */
     DBSTATUS dst_status;
     DBLENGTH dst_len;
     static const WCHAR ten[] = {'1','0',0};
@@ -950,7 +950,7 @@ static void test_converttoi4(void)
 {
     HRESULT hr;
     INT i4;
-    BYTE src[20];
+    BYTE src[sizeof(VARIANT)];  /* assuming that VARIANT is larger than all the types used in src */
     DBSTATUS dst_status;
     DBLENGTH dst_len;
     static const WCHAR ten[] = {'1','0',0};
@@ -1224,7 +1224,7 @@ static void test_converttoi8(void)
 {
     HRESULT hr;
     LARGE_INTEGER dst;
-    BYTE src[20];
+    BYTE src[sizeof(VARIANT)];  /* assuming that VARIANT is larger than all the types used in src */
     DBSTATUS dst_status;
     DBLENGTH dst_len;
     static const WCHAR ten[] = {'1','0',0};
@@ -2774,7 +2774,7 @@ static void test_converttoui4(void)
 {
     HRESULT hr;
     DWORD dst;
-    BYTE src[20];
+    BYTE src[sizeof(VARIANT)];
     DBSTATUS dst_status;
     DBLENGTH dst_len;
 




More information about the wine-devel mailing list