[gtk+/gtk-3-0] Bug 660730: Win32: Only use _fstat32 if available



commit 4588df974b3f560dccb0e53b20d16c24c7813ad2
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Oct 12 11:41:29 2011 +0800

    Bug 660730: Win32: Only use _fstat32 if available
    
    _fstat32 is only introduced with msvcrt80.dll (i.e. Visual C++ 2005),
    in which using this function will break compilation with MinGW,
    which links against msvcrt.dll.  The msvcrt.lib in the Windows DDK
    which links to a later incarnation of the msvcrt.dll in later Windows
    systems may have this symbol defined, but that needs to be checked
    upon to be sure.
    
    Thanks to Dieter Verfaillie for pointing out this problem.

 gtk/gtkiconcache.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkiconcache.c b/gtk/gtkiconcache.c
index 855b270..480a45d 100644
--- a/gtk/gtkiconcache.c
+++ b/gtk/gtkiconcache.c
@@ -109,9 +109,15 @@ _gtk_icon_cache_new_for_path (const gchar *path)
     goto done;
 
 #ifdef G_OS_WIN32
+
+/* Bug 660730: _fstat32 is only defined in msvcrt80.dll+/VS 2005+ */
+/*             or possibly in the msvcrt.dll linked to by the Windows DDK */
+/*             (will need to check on the Windows DDK part later) */
+#if (_MSC_VER >= 1400 || __MSVCRT_VERSION__ >= 0x0800)
 #undef fstat /* Just in case */
 #define fstat _fstat32  
 #endif
+#endif
 
   if (fstat (fd, &st) < 0 || st.st_size < 4)
     goto done;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]