[CMAKE]
authorStefan Ginsberg <stefanginsberg@gmail.com>
Thu, 23 Feb 2012 13:06:11 +0000 (13:06 +0000)
committerStefan Ginsberg <stefanginsberg@gmail.com>
Thu, 23 Feb 2012 13:06:11 +0000 (13:06 +0000)
- Specify C4700 (uninitialized variable usage) to cause an error on compile as this is very likely to result in broken code.
[NTDLL]
- Disable ASSERT in LdrpSearchPath that could be reading an uninitialized variable. The routine is not fully implemented so this should likely be re-enabled once it is.
[BROWSEUI]
- Add missing call to BuildRebarBandInfo, or we would end up with an unitialized variable sent to SendMessage.
[PCIX]
- Fix broken ASSERT
- Fix usage of wrong (and uninitialized) variable in the Unicode case for PciGetDescriptionMessage.
[DDK]
- Prepend "_" to local variable of NdisChainBufferAtBack. Fixes code in ndisuio that called this using the same name as the macro's variable (which resulted in NdisChainBufferAtBack assigning the variable to itself).
[WIN32K]
- Fix WinPosShowIconTitle that checked if a variable was NULL before assigning it to anything.

svn path=/trunk/; revision=55834

reactos/cmake/msvc.cmake
reactos/dll/ntdll/ldr/ldrutils.c
reactos/dll/win32/browseui/bandsite.cpp
reactos/drivers/bus/pcix/pci/id.c
reactos/include/ddk/ndis.h
reactos/subsystems/win32/win32k/ntuser/winpos.c

index 4bd9b98..e6a0b0d 100644 (file)
@@ -21,6 +21,9 @@ add_definitions(/Dinline=__inline /D__STDC__=1)
 
 add_compile_flags("/X /GR- /GS- /Zl /W3")
 
+# C4700 is almost always likely to result in broken code, so mark it as an error
+add_compile_flags("/we4700")
+
 # Debugging
 if(${CMAKE_BUILD_TYPE} MATCHES Debug)
     if(NOT _PREFAST_)
index 4bc12c0..e553e5f 100644 (file)
@@ -1860,7 +1860,9 @@ LdrpSearchPath(IN PWCHAR *SearchPath,
 
             /* Sanity check */
             TestName.Length = (USHORT)ALIGN_DOWN((BufEnd - Buffer), WCHAR);
+#if 0
             ASSERT(TestName.Length < TestName.MaximumLength);
+#endif
 
             /* Check if the file exists */
             #if 0
index aa80e17..15293a8 100644 (file)
@@ -409,6 +409,7 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk)
             WARN("IBandSite::AddBand(): Call to IDeskBand::SetSite() failed: %x\n", hRet);
 
             /* Remove the band from the ReBar control */
+            BuildRebarBandInfo(NewBand, &rbi);
             uBand = (UINT)SendMessageW(fRebarWindow, RB_IDTOINDEX, (WPARAM)rbi.wID, 0);
             if (uBand != (UINT)-1)
             {
index 9db7d70..205265d 100644 (file)
@@ -51,7 +51,7 @@ PciGetDescriptionMessage(IN ULONG Identifier,
 
         /* Validate valid message length, ending with a newline character */
         ASSERT(TextLength > 1);
-        ASSERT(Description[TextLength / sizeof(WCHAR) == L'\n']);
+        ASSERT(Description[TextLength / sizeof(WCHAR)] == L'\n');
 
         /* Allocate the buffer to hold the message string */
         Buffer = ExAllocatePoolWithTag(PagedPool, TextLength, 'BicP');
@@ -61,8 +61,8 @@ PciGetDescriptionMessage(IN ULONG Identifier,
         RtlCopyMemory(Buffer, Entry->Text, TextLength - 1);
         Buffer[TextLength / sizeof(WCHAR)] = UNICODE_NULL;
 
-        /* Return the length to the caller */
-        if (Length) *Length = UnicodeString.Length;
+        /* Return the length to the caller, minus the terminating NULL */
+        if (Length) *Length = TextLength - 1;
     }
     else
     {
index ba7fa0d..bacae3a 100644 (file)
@@ -3101,19 +3101,19 @@ NdisGetFirstBufferFromPacket(
 #define NdisChainBufferAtBack(Packet,           \
                               Buffer)           \
 {                                               \
-  PNDIS_BUFFER NdisBuffer = (Buffer);           \
+  PNDIS_BUFFER _NdisBuffer = (Buffer);           \
                                                 \
-  while (NdisBuffer->Next != NULL)              \
-    NdisBuffer = NdisBuffer->Next;              \
+  while (_NdisBuffer->Next != NULL)              \
+    _NdisBuffer = _NdisBuffer->Next;              \
                                                 \
-  NdisBuffer->Next = NULL;                      \
+  _NdisBuffer->Next = NULL;                      \
                                                 \
   if ((Packet)->Private.Head != NULL)           \
     (Packet)->Private.Tail->Next = (Buffer);    \
   else                                          \
     (Packet)->Private.Head = (Buffer);          \
                                                 \
-  (Packet)->Private.Tail = NdisBuffer;          \
+  (Packet)->Private.Tail = _NdisBuffer;          \
   (Packet)->Private.ValidCounts = FALSE;        \
 }
 
index 32b811f..1cb43ba 100644 (file)
@@ -134,7 +134,7 @@ WinPosShowIconTitle( PWND pWnd, BOOL bShow )
 {
    HICON hIcon;
    if (!pWnd->pcls || pWnd->fnid == FNID_DESKTOP) return FALSE;
-   if (!hIcon) hIcon = pWnd->pcls->hIconSm;
+   hIcon = pWnd->pcls->hIconSm;
    if (!hIcon) hIcon = pWnd->pcls->hIcon;
    if (!hIcon) return FALSE;