MSW: Grouped all MSVC #pragma disable
authorGuillermo Rodriguez Garcia <guille@iies.es>
Thu, 16 Mar 2000 12:26:15 +0000 (12:26 +0000)
committerGuillermo Rodriguez Garcia <guille@iies.es>
Thu, 16 Mar 2000 12:26:15 +0000 (12:26 +0000)
Unix: Fixed GAddress_destroy leak as Vadim did for MSW

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6755 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/gsocket.c
src/unix/gsocket.c

index eb4d669270a5ba42a0f76a837612483c0386113a..85e0adf88436c80fb5dfb07506657703b6830eb0 100644 (file)
  * PLEASE don't put C++ comments here - this is a C source file.
  */
 
-/* including rasasync.h (included from windows.h itself included from
- * wx/setup.h and/or winsock.h results in this warning for
- * RPCNOTIFICATION_ROUTINE
- */
 #ifdef _MSC_VER
-#  pragma warning(disable:4115) /* named type definition in parentheses */
-#endif
+   /* RPCNOTIFICATION_ROUTINE in rasasync.h (included from winsock.h),
+    * warning: conditional expression is constant.
+    */
+#  pragma warning(disable:4115)
+   /* FD_SET,
+    * warning: named type definition in parentheses.
+    */
+#  pragma warning(disable:4127)
+   /* GAddress_UNIX_GetPath,
+    * warning: unreferenced formal parameter.
+    */
+#  pragma warning(disable:4100)
+#endif /* _MSC_VER */
+
 
 #ifndef __GSOCKET_STANDALONE__
-#include "wx/setup.h"
+#  include "wx/setup.h"
 #endif
 
 #if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
@@ -33,9 +41,9 @@
 #  include "gsocket.h"
 #endif /* __GSOCKET_STANDALONE__ */
 
-/* redefine some GUI-only functions to do nothing in console mode */
+/* Redefine some GUI-only functions to do nothing in console mode */
 #if defined(wxUSE_GUI) && !wxUSE_GUI
-#  define _GSocket_GUI_Init(socket) 1
+#  define _GSocket_GUI_Init(socket) (1)
 #  define _GSocket_GUI_Destroy(socket)
 #  define _GSocket_Enable_Events(socket)
 #  define _GSocket_Disable_Events(socket)
 
 #include <winsock.h>
 
-#ifdef _MSC_VER
-#  pragma warning(default:4115) /* named type definition in parentheses */
-#endif
 
 /* if we use configure for MSW SOCKLEN_T will be already defined */
 #ifndef SOCKLEN_T
 #  define SOCKLEN_T int
 #endif
 
-/* using FD_SET results in this warning */
-#ifdef _MSC_VER
-#  pragma warning(disable:4127) /* conditional expression is constant */
-#endif
-
 
 /* Constructors / Destructors for GSocket */
 
@@ -1074,7 +1074,9 @@ void GAddress_destroy(GAddress *address)
 {
   assert(address != NULL);
 
-  free(address->m_addr);
+  if (address->m_addr)
+    free(address->m_addr);
+
   free(address);
 }
 
@@ -1332,10 +1334,6 @@ unsigned short GAddress_INET_GetPort(GAddress *address)
  * -------------------------------------------------------------------------
  */
 
-#ifdef _MSC_VER
-    #pragma warning(disable:4100) /* unreferenced formal parameter */
-#endif /* Visual C++ */
-
 GSocketError _GAddress_Init_UNIX(GAddress *address)
 {
   assert (address != NULL);
index b45ba4e9a2d4627d1f643aa703998996b295ad4a..a36e36e8f6450fd1f083cf060e6437d84138bfbb 100644 (file)
@@ -1282,6 +1282,9 @@ void GAddress_destroy(GAddress *address)
 {
   assert(address != NULL);
 
+  if (address->m_addr)
+    free(address->m_addr);
+
   free(address);
 }