Re: [xml] libxml2.xmlIO.awn.1.patch

Emelyanov Alexey wrote:
2006-09-06  Andrew W. Nosenko  <andrew w nosenko gmail com
<mailto:andrew w nosenko gmail com>>

* xmlIO.c [HAVE_STAT && HAVE__STAT]:
Fix the compilation breakage: macro that redefines of the 'stat'
as '_stat' is removed (was introduced in the r1.172).

Removing this macro results in occurrence of warnings about
types incompatibility in _wstat() call on Windows.

Changes in this patch (for xmlIO.c rev. 1.172):
1. Replacement of 'stat' on '_stat' only on Windows
2. C style comments are used

I hope, patch must solve compilation problem.
I have no FreeBSD, but library was also compiled with glibc 2.0, both
HAVE_STAT and HAVE__STAT was defined.


--- xmlIO.orig.c      Fri Sep  1 12:27:58 2006
+++ xmlIO.c   Sat Sep  9 13:38:20 2006
@@ -52,7 +52,9 @@
 #  endif
 #  ifdef HAVE__STAT
+#    if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
 #      define stat _stat
+#    endif
 #  endif

I'm pretty sure DJGPP has stat under its normal name.  Also, the test
you write tests for "DJGPP unless it's cygwin", but DJGPP is DOS-based
and has nothing to do with Cygwin, so that makes no sense.

  #if defined(_WIN32) && !defined(__CYGWIN__)
  #  define stat _stat

makes more sense.  In fact, if this is an issue only for Visual C++, and
not for Borland or the other Windows C compilers it may make even more
sense to test for that instead (MSC_VER is the preprocessor macro I
think, or possibly _MSC_VER - something like that anyway).

In fact if stat is being remapped to _wstat, resulting in compiler
warnings, wouldn't the code above result in "macro redefined" warnings?
Maybe throw in an "#undef stat" too just in case.

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