Bug fixes against uninitizlied variables and support for tree-wide optimization (do not try yet, crashes in bootvid).
Modified: trunk/reactos/config
Modified: trunk/reactos/drivers/lib/ip/transport/datagram/datagram.c
Modified: trunk/reactos/drivers/net/afd/afd/connect.c
Modified: trunk/reactos/drivers/net/afd/afd/write.c
Modified: trunk/reactos/drivers/net/tcpip/tcpip/info.c
Modified: trunk/reactos/hal/halx86/generic/dma.c
Modified: trunk/reactos/lib/epsapi/enum/drivers.c
Modified: trunk/reactos/lib/msafd/misc/dllmain.c
Modified: trunk/reactos/lib/shellext/slayer/slayer.c
Modified: trunk/reactos/lib/ws2_32/misc/ns.c
Modified: trunk/reactos/ntoskrnl/Makefile
Modified: trunk/reactos/regtests/shared/regtests.h
Modified: trunk/reactos/subsys/csrss/win32csr/guiconsole.c
Modified: trunk/reactos/subsys/win32k/makefile
Modified: trunk/reactos/tools/helper.mk

Modified: trunk/reactos/config
--- trunk/reactos/config	2005-01-19 01:37:35 UTC (rev 13129)
+++ trunk/reactos/config	2005-01-19 03:33:43 UTC (rev 13130)
@@ -30,7 +30,7 @@
 #
 # Whether to compile with optimizations
 #
-OPTIMIZED := 0 
+OPTIMIZED := 0
 
 #
 # Whether to compile a multiprocessor or single processor version

Modified: trunk/reactos/drivers/lib/ip/transport/datagram/datagram.c
--- trunk/reactos/drivers/lib/ip/transport/datagram/datagram.c	2005-01-19 01:37:35 UTC (rev 13129)
+++ trunk/reactos/drivers/lib/ip/transport/datagram/datagram.c	2005-01-19 03:33:43 UTC (rev 13130)
@@ -59,7 +59,7 @@
   if (!IsListEmpty(&AddrFile->ReceiveQueue))
     {
       PLIST_ENTRY CurrentEntry;
-      PDATAGRAM_RECEIVE_REQUEST Current;
+      PDATAGRAM_RECEIVE_REQUEST Current = NULL;
       BOOLEAN Found;
       PTA_IP_ADDRESS RTAIPAddress;
   

Modified: trunk/reactos/drivers/net/afd/afd/connect.c
--- trunk/reactos/drivers/net/afd/afd/connect.c	2005-01-19 01:37:35 UTC (rev 13129)
+++ trunk/reactos/drivers/net/afd/afd/connect.c	2005-01-19 03:33:43 UTC (rev 13130)
@@ -41,7 +41,7 @@
 }
 
 NTSTATUS MakeSocketIntoConnection( PAFD_FCB FCB ) {
-    NTSTATUS Status;
+    NTSTATUS Status = STATUS_NO_MEMORY;
 
     /* Allocate the receive area and start receiving */
     FCB->Recv.Window = 

Modified: trunk/reactos/drivers/net/afd/afd/write.c
--- trunk/reactos/drivers/net/afd/afd/write.c	2005-01-19 01:37:35 UTC (rev 13129)
+++ trunk/reactos/drivers/net/afd/afd/write.c	2005-01-19 03:33:43 UTC (rev 13130)
@@ -22,7 +22,7 @@
     PLIST_ENTRY NextIrpEntry;
     PIRP NextIrp = NULL;
     PIO_STACK_LOCATION NextIrpSp;
-    PAFD_SEND_INFO SendReq;
+    PAFD_SEND_INFO SendReq = NULL;
     PAFD_MAPBUF Map;
     UINT TotalBytesCopied = 0, SpaceAvail, i, CopySize = 0;
 

Modified: trunk/reactos/drivers/net/tcpip/tcpip/info.c
--- trunk/reactos/drivers/net/tcpip/tcpip/info.c	2005-01-19 01:37:35 UTC (rev 13129)
+++ trunk/reactos/drivers/net/tcpip/tcpip/info.c	2005-01-19 03:33:43 UTC (rev 13130)
@@ -129,10 +129,10 @@
 {
     KIRQL OldIrql;
     UINT i;
-    PVOID context;
+    PVOID context = NULL;
     NTSTATUS Status = STATUS_SUCCESS;
     BOOL FoundEntity = FALSE;
-    InfoRequest_f InfoRequest;
+    InfoRequest_f InfoRequest = NULL;
 
     TI_DbgPrint(MAX_TRACE,
 		("InfoEx Req: %x %x %x!%04x:%d\n",

Modified: trunk/reactos/hal/halx86/generic/dma.c
--- trunk/reactos/hal/halx86/generic/dma.c	2005-01-19 01:37:35 UTC (rev 13129)
+++ trunk/reactos/hal/halx86/generic/dma.c	2005-01-19 03:33:43 UTC (rev 13130)
@@ -121,7 +121,7 @@
 	DWORD ChannelSelect;
 	DWORD Controller;
 	ULONG MaximumLength;
-	BOOLEAN ChannelSetup;
+	BOOLEAN ChannelSetup = FALSE;
 	DMA_MODE DmaMode;	
 
 	DPRINT("Entered Function\n");

Modified: trunk/reactos/lib/epsapi/enum/drivers.c
--- trunk/reactos/lib/epsapi/enum/drivers.c	2005-01-19 01:37:35 UTC (rev 13129)
+++ trunk/reactos/lib/epsapi/enum/drivers.c	2005-01-19 03:33:43 UTC (rev 13130)
@@ -67,7 +67,7 @@
 PsaCaptureSystemModules(OUT PSYSTEM_MODULE_INFORMATION *SystemModules)
 {
   SIZE_T nSize = 0;
-  PSYSTEM_MODULE_INFORMATION psmModules;
+  PSYSTEM_MODULE_INFORMATION psmModules = NULL;
   NTSTATUS Status;
 
 #if 0
@@ -94,7 +94,7 @@
      pool/heap, we try to determine the buffer size in advance, knowing that
      the number of elements is unlikely to change */
   nSize = sizeof(SYSTEM_MODULE_INFORMATION) +
-          ((psmModules->Count - 1) * sizeof(SYSTEM_MODULE_INFORMATION));
+          (nSize * sizeof(SYSTEM_MODULE_INFORMATION));
 
   psmModules = NULL;
 

Modified: trunk/reactos/lib/msafd/misc/dllmain.c
--- trunk/reactos/lib/msafd/misc/dllmain.c	2005-01-19 01:37:35 UTC (rev 13129)
+++ trunk/reactos/lib/msafd/misc/dllmain.c	2005-01-19 03:33:43 UTC (rev 13130)
@@ -66,7 +66,7 @@
 	PHELPER_DATA				HelperData;
 	PVOID						HelperDLLContext;
 	DWORD						HelperEvents;
-	DWORD						IOOptions;
+	DWORD						IOOptions = 0;
 	UNICODE_STRING				TransportName;
 	UNICODE_STRING				DevName;
 	LARGE_INTEGER				GroupData;
@@ -728,8 +728,8 @@
 	NTSTATUS					Status;
 	struct fd_set				ReadSet;
 	struct timeval				Timeout;
-	PVOID						PendingData;
-	ULONG						PendingDataLength;
+	PVOID						PendingData = NULL;
+	ULONG						PendingDataLength = 0;
 	PVOID						CalleeDataBuffer;
 	WSABUF						CallerData, CalleeID, CallerID, CalleeData;
 	PSOCKADDR					RemoteAddress =  NULL;

Modified: trunk/reactos/lib/shellext/slayer/slayer.c
--- trunk/reactos/lib/shellext/slayer/slayer.c	2005-01-19 01:37:35 UTC (rev 13129)
+++ trunk/reactos/lib/shellext/slayer/slayer.c	2005-01-19 03:33:43 UTC (rev 13130)
@@ -860,7 +860,7 @@
 HRESULT STDCALL
 DllRegisterServer(VOID)
 {
-  LONG e;
+  LONG e = E_ACCESSDENIED;
   HKEY hk;
   WCHAR szGuid[40];
   WCHAR szDescription[255];

Modified: trunk/reactos/lib/ws2_32/misc/ns.c
--- trunk/reactos/lib/ws2_32/misc/ns.c	2005-01-19 01:37:35 UTC (rev 13129)
+++ trunk/reactos/lib/ws2_32/misc/ns.c	2005-01-19 03:33:43 UTC (rev 13130)
@@ -7,6 +7,7 @@
  * REVISIONS:
  *   CSH 01/09-2000 Created
  */
+#define __NO_CTYPE_INLINES
 #include <ctype.h>
 #include <ws2_32.h>
 #include <winbase.h>

Modified: trunk/reactos/ntoskrnl/Makefile
--- trunk/reactos/ntoskrnl/Makefile	2005-01-19 01:37:35 UTC (rev 13129)
+++ trunk/reactos/ntoskrnl/Makefile	2005-01-19 03:33:43 UTC (rev 13130)
@@ -26,12 +26,6 @@
 LINKER_SCRIPT := ntoskrnl.lnk
 STRIP_FLAGS := -Wl,-s
 
-ifeq ($(OPTIMIZED), 1)
-CFLAGS_OPT := -O2 -Wno-strict-aliasing
-else
-CFLAGS_OPT :=
-endif
-
 ifeq ($(KDBG), 1)
 OBJECTS_KDBG := dbg/kdb.o dbg/kdb_serial.o dbg/kdb_keyboard.o dbg/rdebug.o \
                 dbg/i386/kdb_help.o \

Modified: trunk/reactos/regtests/shared/regtests.h
--- trunk/reactos/regtests/shared/regtests.h	2005-01-19 01:37:35 UTC (rev 13129)
+++ trunk/reactos/regtests/shared/regtests.h	2005-01-19 03:33:43 UTC (rev 13130)
@@ -206,7 +206,7 @@
 FrameworkGetFunction(PAPI_DESCRIPTION ApiDescription)
 {
   HANDLE hModule;
-  PVOID function;
+  PVOID function = NULL;
   PCHAR exportedFunctionName;
 
   exportedFunctionName = FrameworkGetExportedFunctionNameInternal(ApiDescription);

Modified: trunk/reactos/subsys/csrss/win32csr/guiconsole.c
--- trunk/reactos/subsys/csrss/win32csr/guiconsole.c	2005-01-19 01:37:35 UTC (rev 13129)
+++ trunk/reactos/subsys/csrss/win32csr/guiconsole.c	2005-01-19 03:33:43 UTC (rev 13130)
@@ -737,7 +737,7 @@
 static LRESULT CALLBACK
 GuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
-  LRESULT Result;
+  LRESULT Result = 0;
 
   switch(msg)
     {
@@ -746,7 +746,6 @@
         break;
       case WM_PAINT:
         GuiConsoleHandlePaint(hWnd);
-        Result = 0;
         break;
       case WM_KEYDOWN:
       case WM_KEYUP:
@@ -754,19 +753,15 @@
       case WM_SYSKEYUP:
       case WM_CHAR:
         GuiConsoleHandleKey(hWnd, msg, wParam, lParam);
-        Result = 0;
         break;
       case WM_TIMER:
         GuiConsoleHandleTimer(hWnd);
-        Result = 0;
         break;
       case WM_CLOSE:
         GuiConsoleHandleClose(hWnd);
-        Result = 0;
         break;
       case WM_NCDESTROY:
         GuiConsoleHandleNcDestroy(hWnd);
-        Result = 0;
         break;
       case WM_LBUTTONDOWN:
           GuiConsoleLeftMouseDown(hWnd, lParam);

Modified: trunk/reactos/subsys/win32k/makefile
--- trunk/reactos/subsys/win32k/makefile	2005-01-19 01:37:35 UTC (rev 13129)
+++ trunk/reactos/subsys/win32k/makefile	2005-01-19 03:33:43 UTC (rev 13130)
@@ -29,12 +29,6 @@
 CFLAGS_DBG :=
 endif
 
-ifeq ($(OPTIMIZED), 1)
-CFLAGS_OPT := -O2 -Wno-strict-aliasing
-else
-CFLAGS_OPT :=
-endif
-
 TARGET_CFLAGS =\
  $(CFLAGS_DBG) \
  -I. \

Modified: trunk/reactos/tools/helper.mk
--- trunk/reactos/tools/helper.mk	2005-01-19 01:37:35 UTC (rev 13129)
+++ trunk/reactos/tools/helper.mk	2005-01-19 03:33:43 UTC (rev 13130)
@@ -612,6 +612,15 @@
 endif
 endif
 
+#
+# Enable Tree-Wide Optimization.
+# Protect uncompatible files here with an ifneq
+# if needed, until their problems can be found
+#
+ifeq ($(OPTIMIZED), 1)
+  MK_CFLAGS += -O2 -Wno-strict-aliasing
+  MK_CPPFLAGS += -O2 -Wno-strict-aliasing
+endif
 
 ifneq ($(TARGET_LIBS),)
   MK_LIBS := $(TARGET_LIBS) $(MK_LIBS)