[PATCH v2] avifil32: Use typed pointers in sizeof() and va_arg() (Coverity)

Nikolay Sivov nsivov at codeweavers.com
Sun Jan 10 10:22:35 CST 2016


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---

v2: change couple more similar places, thanks Bruno.

 dlls/avifil32/api.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/avifil32/api.c b/dlls/avifil32/api.c
index c71efb4..d72e17e 100644
--- a/dlls/avifil32/api.c
+++ b/dlls/avifil32/api.c
@@ -2289,8 +2289,8 @@ HRESULT WINAPIV AVISaveA(LPCSTR szFile, CLSID * pclsidHandler, AVISAVECALLBACK l
 
     if (nStreams <= 0) return AVIERR_BADPARAM;
 
-    streams = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(void *));
-    options = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(void *));
+    streams = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(*streams));
+    options = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(*options));
     if (!streams || !options)
     {
         ret = AVIERR_MEMORY;
@@ -2303,8 +2303,8 @@ HRESULT WINAPIV AVISaveA(LPCSTR szFile, CLSID * pclsidHandler, AVISAVECALLBACK l
     __ms_va_start(vl, lpOptions);
     for (i = 1; i < nStreams; i++)
     {
-        streams[i] = va_arg(vl, void *);
-        options[i] = va_arg(vl, void *);
+        streams[i] = va_arg(vl, PAVISTREAM);
+        options[i] = va_arg(vl, PAVICOMPRESSOPTIONS);
     }
     __ms_va_end(vl);
 
@@ -2332,8 +2332,8 @@ HRESULT WINAPIV AVISaveW(LPCWSTR szFile, CLSID * pclsidHandler, AVISAVECALLBACK
 
     if (nStreams <= 0) return AVIERR_BADPARAM;
 
-    streams = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(void *));
-    options = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(void *));
+    streams = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(*streams));
+    options = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(*options));
     if (!streams || !options)
     {
         ret = AVIERR_MEMORY;
@@ -2346,8 +2346,8 @@ HRESULT WINAPIV AVISaveW(LPCWSTR szFile, CLSID * pclsidHandler, AVISAVECALLBACK
     __ms_va_start(vl, lpOptions);
     for (i = 1; i < nStreams; i++)
     {
-        streams[i] = va_arg(vl, void *);
-        options[i] = va_arg(vl, void *);
+        streams[i] = va_arg(vl, PAVISTREAM);
+        options[i] = va_arg(vl, PAVICOMPRESSOPTIONS);
     }
     __ms_va_end(vl);
 
-- 
2.6.4




More information about the wine-patches mailing list