[xml] Patches for FTP/HTTP (Win32/MSCC build)
- From: "Igor Zlatkovic" <izlatkovic daenet de>
- To: <xml gnome org>
- Subject: [xml] Patches for FTP/HTTP (Win32/MSCC build)
- Date: Fri, 8 Jun 2001 17:04:58 +0200
Hi there.
Here are few patches to make libxml2 compile cleanly under Win32/MSCC.
There was a recent discussion about sockets and lack thereof when
compiling nanoftp.c and nanohttp.c. The file include/win32config.h
includes windows sockets conditionally, means if a certain macro is
defined (INCLUDE_WINSOCK). The problem is that code which needs sockets
almost never defines this macro and thus ends up without socket
declarations. I don't know why this macro was invented - that was before
my time - but, there must have been a reason. Although everything works
on my system if I throw this macro away, there might be a problem
elsewhere, using a different compiler. Since I don't know if this holds,
I suggest to keep the conditional include.
In order to make it clearer for non-windows programmers, I took the
liberty to rename this macro (INCLUDE_WINSOCK -> NEED_SOCKETS). I hope
not to ask for too much if I plea for a #define NEEDS_SOCKETS in every
source file which cannot work if a sockets implementation isn't
available.
One small thing more: the file uri.c has defined the macro
INCLUDE_WINSOCK, but:
- it does not need sockets at all
- it defined the macro after including the relevant header, thus making
it ineffective.
A patch for this file is included as well.
Ciao
Igor
Patches for include/win32config.h, nanoftp.c, nanohttp.c and uri.c
against libxml2-2.3.10 follow:
diff -r -c libxml2-2.3.10/include/win32config.h
libxml2/include/win32config.h
*** libxml2-2.3.10/include/win32config.h Tue Apr 17 04:35:08 2001
--- libxml2/include/win32config.h Fri Jun 08 16:05:39 2001
***************
*** 8,15 ****
#define LIBXML_DLL_IMPORT
#define SOCKLEN_T int
!
! #ifdef INCLUDE_WINSOCK
#include <winsock2.h>
#define EWOULDBLOCK WSAEWOULDBLOCK
--- 8,15 ----
#define LIBXML_DLL_IMPORT
#define SOCKLEN_T int
!
! #ifdef NEED_SOCKETS
#include <winsock2.h>
#define EWOULDBLOCK WSAEWOULDBLOCK
***************
*** 94,100 ****
/* Microsoft's C runtime names all non-ANSI functions with a leading
underscore. Since functionality is still the same, they can be
used. */
#ifdef _MSC_VER
#define snprintf _snprintf
! #define vsnprintf _vsnprintf
#endif /* _MSC_VER */
--- 94,103 ----
/* Microsoft's C runtime names all non-ANSI functions with a leading
underscore. Since functionality is still the same, they can be
used. */
#ifdef _MSC_VER
+ #include <libxml/xmlversion.h>
+ #ifndef WITH_TRIO
#define snprintf _snprintf
! #define vsnprintf _vsnprintf
! #endif /* WITH_TRIO */
#endif /* _MSC_VER */
diff -r -c libxml2-2.3.10/nanoftp.c libxml2/nanoftp.c
*** libxml2-2.3.10/nanoftp.c Sun Apr 22 04:35:08 2001
--- libxml2/nanoftp.c Fri Jun 08 16:05:31 2001
***************
*** 20,25 ****
--- 20,26 ----
#include "trio.h"
#endif
#else /* STANDALONE */
+ #define NEED_SOCKETS
#include "libxml.h"
#endif /* STANDALONE */
diff -r -c libxml2-2.3.10/nanohttp.c libxml2/nanohttp.c
*** libxml2-2.3.10/nanohttp.c Tue May 29 04:35:08 2001
--- libxml2/nanohttp.c Fri Jun 08 16:05:28 2001
***************
*** 13,19 ****
/* TODO add compression support, Send the Accept- , and decompress on
the
fly with ZLIB if found at compile-time */
!
#include "libxml.h"
#ifdef LIBXML_HTTP_ENABLED
--- 13,20 ----
/* TODO add compression support, Send the Accept- , and decompress on
the
fly with ZLIB if found at compile-time */
!
! #define NEED_SOCKETS
#include "libxml.h"
#ifdef LIBXML_HTTP_ENABLED
diff -r -c libxml2-2.3.10/uri.c libxml2/uri.c
*** libxml2-2.3.10/uri.c Sat May 26 04:35:08 2001
--- libxml2/uri.c Wed Jun 06 12:35:55 2001
***************
*** 10,19 ****
#include "libxml.h"
- #ifdef WIN32
- #define INCLUDE_WINSOCK
- #endif
-
#include <string.h>
#include <libxml/xmlmemory.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]