A lot of these are in 3rdparty/wine DLLs.

Were these bugs reported to the appropriate projects?

Best regards,
Alex Ionescu


On Thu, Sep 1, 2011 at 4:30 PM, <dchapyshev@svn.reactos.org> wrote:
Author: dchapyshev
Date: Thu Sep  1 15:30:19 2011
New Revision: 53519

URL: http://svn.reactos.org/svn/reactos?rev=53519&view=rev
Log:
- Fix multiple typos and bugs, found by PVS-Studio

Modified:
   trunk/reactos/base/applications/sndrec32/sndrec32.cpp
   trunk/reactos/base/system/smss/client.c
   trunk/reactos/dll/cpl/desk/screensaver.c
   trunk/reactos/dll/win32/browseui/bandsite.cpp
   trunk/reactos/dll/win32/glu32/libnurbs/internals/mapdesc.cc
   trunk/reactos/dll/win32/oleaut32/typelib2.c
   trunk/reactos/dll/win32/rsaenh/sha2.c
   trunk/reactos/dll/win32/shell32/pidl.c
   trunk/reactos/drivers/storage/ide/uniata/id_dma.cpp
   trunk/reactos/ntoskrnl/config/cmcontrl.c
   trunk/reactos/subsystems/win32/win32k/eng/gradient.c
   trunk/reactos/subsystems/win32/win32k/objects/bitblt.c

Modified: trunk/reactos/base/applications/sndrec32/sndrec32.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sndrec32/sndrec32.cpp?rev=53519&r1=53518&r2=53519&view=diff
==============================================================================
--- trunk/reactos/base/applications/sndrec32/sndrec32.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/sndrec32/sndrec32.cpp [iso-8859-1] Thu Sep  1 15:30:19 2011
@@ -766,7 +766,7 @@
                isnew = TRUE;
                display_dur = TRUE;

-                ZeroMemory( file_path, MAX_PATH );
+                ZeroMemory( file_path, MAX_PATH * sizeof(TCHAR) );

                EnableWindow( slider, FALSE );


Modified: trunk/reactos/base/system/smss/client.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/smss/client.c?rev=53519&r1=53518&r2=53519&view=diff
==============================================================================
--- trunk/reactos/base/system/smss/client.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/smss/client.c [iso-8859-1] Thu Sep  1 15:30:19 2011
@@ -441,7 +441,7 @@
                        */
                       RtlCopyMemory (SmpClientDirectory.CandidateClient->ProgramName,
                                      ProgramName,
-                                      SM_SB_NAME_MAX_LENGTH);
+                                      SM_SB_NAME_MAX_LENGTH * sizeof(WCHAR));
               }
       } else {
               DPRINT1("SM: %s: CandidateClient %p pending!\n", __FUNCTION__,

Modified: trunk/reactos/dll/cpl/desk/screensaver.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/screensaver.c?rev=53519&r1=53518&r2=53519&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/desk/screensaver.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/desk/screensaver.c [iso-8859-1] Thu Sep  1 15:30:19 2011
@@ -450,7 +450,7 @@
    lpBackSlash = _tcsrchr(szSearchPath, _T('\\'));
    if (lpBackSlash != NULL)
    {
-        lpBackSlash = '\0';
+        *lpBackSlash = '\0';
        SearchScreenSavers(hwndScreenSavers, szSearchPath, pData);
    }
 }

Modified: trunk/reactos/dll/win32/browseui/bandsite.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/bandsite.cpp?rev=53519&r1=53518&r2=53519&view=diff
==============================================================================
--- trunk/reactos/dll/win32/browseui/bandsite.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/bandsite.cpp [iso-8859-1] Thu Sep  1 15:30:19 2011
@@ -719,7 +719,7 @@
    if (fRebarWindow == NULL)
        return E_FAIL;

-    if (IsEqualIID(pguidCmdGroup, IID_IDeskBand))
+    if (IsEqualIID(*pguidCmdGroup, IID_IDeskBand))
    {
        switch (nCmdID)
        {

Modified: trunk/reactos/dll/win32/glu32/libnurbs/internals/mapdesc.cc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/glu32/libnurbs/internals/mapdesc.cc?rev=53519&r1=53518&r2=53519&view=diff
==============================================================================
--- trunk/reactos/dll/win32/glu32/libnurbs/internals/mapdesc.cc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/glu32/libnurbs/internals/mapdesc.cc [iso-8859-1] Thu Sep  1 15:30:19 2011
@@ -90,7 +90,7 @@
 }

 void
-Mapdesc::identify( REAL dest[MAXCOORDS][MAXCOORDS] )
+Mapdesc::identify( REAL (&dest)[MAXCOORDS][MAXCOORDS] )
 {
    memset( dest, 0, sizeof( dest ) );
    for( int i=0; i != hcoords; i++ )

Modified: trunk/reactos/dll/win32/oleaut32/typelib2.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/typelib2.c?rev=53519&r1=53518&r2=53519&view=diff
==============================================================================
--- trunk/reactos/dll/win32/oleaut32/typelib2.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/oleaut32/typelib2.c [iso-8859-1] Thu Sep  1 15:30:19 2011
@@ -317,7 +317,7 @@
    while (offset != -1) {
       guidentry = (MSFT_GuidEntry *)&This->typelib_segment_data[MSFT_SEG_GUID][offset];

-        if (IsEqualGUID(guidentry, guid)) return offset;
+        if (IsEqualGUID(*guidentry, guid)) return offset;

       offset = guidentry->next_hash;
    }

Modified: trunk/reactos/dll/win32/rsaenh/sha2.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rsaenh/sha2.c?rev=53519&r1=53518&r2=53519&view=diff
==============================================================================
--- trunk/reactos/dll/win32/rsaenh/sha2.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/rsaenh/sha2.c [iso-8859-1] Thu Sep  1 15:30:19 2011
@@ -563,7 +563,7 @@
       }

       /* Clean up state data: */
-       MEMSET_BZERO(context, sizeof(context));
+       MEMSET_BZERO(context, sizeof(*context));
       usedspace = 0;
 }

@@ -584,7 +584,7 @@
               }
               *buffer = 0;
       } else {
-               MEMSET_BZERO(context, sizeof(context));
+               MEMSET_BZERO(context, sizeof(*context));
       }
       MEMSET_BZERO(digest, SHA256_DIGEST_LENGTH);
       return buffer;
@@ -893,7 +893,7 @@
       }

       /* Zero out state data */
-       MEMSET_BZERO(context, sizeof(context));
+       MEMSET_BZERO(context, sizeof(*context));
 }

 char *SHA512_End(SHA512_CTX* context, char buffer[]) {
@@ -913,7 +913,7 @@
               }
               *buffer = 0;
       } else {
-               MEMSET_BZERO(context, sizeof(context));
+               MEMSET_BZERO(context, sizeof(*context));
       }
       MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH);
       return buffer;
@@ -968,7 +968,7 @@
       }

       /* Zero out state data */
-       MEMSET_BZERO(context, sizeof(context));
+       MEMSET_BZERO(context, sizeof(*context));
 }

 char *SHA384_End(SHA384_CTX* context, char buffer[]) {
@@ -988,7 +988,7 @@
               }
               *buffer = 0;
       } else {
-               MEMSET_BZERO(context, sizeof(context));
+               MEMSET_BZERO(context, sizeof(*context));
       }
       MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH);
       return buffer;

Modified: trunk/reactos/dll/win32/shell32/pidl.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/pidl.c?rev=53519&r1=53518&r2=53519&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shell32/pidl.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/pidl.c [iso-8859-1] Thu Sep  1 15:30:19 2011
@@ -1157,7 +1157,7 @@
        if (len < sizeof(WIN32_FIND_DATAW))
            return E_INVALIDARG;

-        ZeroMemory(pfd, sizeof (WIN32_FIND_DATAA));
+        ZeroMemory(pfd, sizeof (WIN32_FIND_DATAW));
        _ILGetFileDateTime( pidl, &(pfd->ftLastWriteTime));
        pfd->dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0);
        pfd->nFileSizeLow = _ILGetFileSize ( pidl, NULL, 0);

Modified: trunk/reactos/drivers/storage/ide/uniata/id_dma.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/ide/uniata/id_dma.cpp?rev=53519&r1=53518&r2=53519&view=diff
==============================================================================
--- trunk/reactos/drivers/storage/ide/uniata/id_dma.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/storage/ide/uniata/id_dma.cpp [iso-8859-1] Thu Sep  1 15:30:19 2011
@@ -1607,7 +1607,7 @@
                { 0xc2, 0x82, 0x042, 0x8a, 0x4a, 0x0a } };
            static const UCHAR cmd_wdma_modes[] = { 0x87, 0x32, 0x3f };
            static const UCHAR cmd_pio_modes[] = { 0xa9, 0x57, 0x44, 0x32, 0x3f };
-            ULONG treg = 0x54 + (dev < 3) ? (dev << 1) : 7;
+            ULONG treg = 0x54 + ((dev < 3) ? (dev << 1) : 7);

            udmamode = min(udmamode, 5);
            /* enable UDMA mode */

Modified: trunk/reactos/ntoskrnl/config/cmcontrl.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmcontrl.c?rev=53519&r1=53518&r2=53519&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmcontrl.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmcontrl.c [iso-8859-1] Thu Sep  1 15:30:19 2011
@@ -118,7 +118,7 @@
    if (!SystemHiveData) return;

    /* Initialize the Hive View List and the security cache */
-    RtlZeroMemory(SystemHive, sizeof(SystemHive));
+    RtlZeroMemory(SystemHive, sizeof(*SystemHive));
    CmpInitHiveViewList((PCMHIVE)SystemHive);
    CmpInitSecurityCache((PCMHIVE)SystemHive);


Modified: trunk/reactos/subsystems/win32/win32k/eng/gradient.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/gradient.c?rev=53519&r1=53518&r2=53519&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/gradient.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/gradient.c [iso-8859-1] Thu Sep  1 15:30:19 2011
@@ -298,7 +298,7 @@
 #define SMALLER(a,b)     (a->y < b->y) || (a->y == b->y && a->x < b->x)
 #define SWAP(a,b,c)  c = a;\
                     a = b;\
-                     a = c
+                     b = c
 #define NLINES 3
 BOOL FASTCALL
 IntEngGradientFillTriangle(

Modified: trunk/reactos/subsystems/win32/win32k/objects/bitblt.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/bitblt.c?rev=53519&r1=53518&r2=53519&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/bitblt.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/bitblt.c [iso-8859-1] Thu Sep  1 15:30:19 2011
@@ -667,7 +667,7 @@
        MaskPoint.y = YOriginMask;
        IntLPtoDP(DCMask, &MaskPoint, 1);
        MaskPoint.x += DCMask->ptlDCOrig.x;
-        MaskPoint.y += DCMask->ptlDCOrig.x;
+        MaskPoint.y += DCMask->ptlDCOrig.y;
    }

    /* Perform the bitblt operation */