Commit 50f34371 authored by Daniel Veillard's avatar Daniel Veillard

applied Win32 Facelift No.2 patches from Igor Zlatkovic for Windows/MSC

* DOCBparser.c Makefile.am nanohttp.c parser.c testHTML.c
  testSAX.c xmlIO.c xmllint.c include/win32config.h
  include/libxml/xmlversion.h.in include/libxml/xmlwin32version.h
  include/libxml/xmlwin32version.h.in win32/README.MSDev
  win32/dsp/*: applied Win32 Facelift No.2 patches from
  Igor Zlatkovic for Windows/MSC
Daniel
parent 9f4eb911
Fri Aug 3 14:02:20 CEST 2001 Daniel Veillard <daniel@veillard.com>
* DOCBparser.c Makefile.am nanohttp.c parser.c testHTML.c
testSAX.c xmlIO.c xmllint.c include/win32config.h
include/libxml/xmlversion.h.in include/libxml/xmlwin32version.h
include/libxml/xmlwin32version.h.in win32/README.MSDev
win32/dsp/*: applied Win32 Facelift No.2 patches from
Igor Zlatkovic for Windows/MSC
Wed Aug 1 23:21:06 CEST 2001 Daniel Veillard <daniel@veillard.com>
* SAX.c: unparsedEntityDecl() the URI computation of the
......
......@@ -3823,7 +3823,7 @@ docbParseStartTag(docbParserCtxtPtr ctxt) {
}
} else if (nbatts + 4 > maxatts) {
maxatts *= 2;
atts = (const xmlChar **) xmlRealloc(atts, maxatts * sizeof(xmlChar *));
atts = (const xmlChar **) xmlRealloc((void *)atts, maxatts * sizeof(xmlChar *));
if (atts == NULL) {
xmlGenericError(xmlGenericErrorContext,
"realloc of %ld byte failed\n",
......
......@@ -464,7 +464,7 @@ Validtests : xmllint
dist-hook: libxml.spec
-cp libxml.spec $(distdir)
(cd $(srcdir) ; tar -cf - --exclude CVS test result SAXresult ) | (cd $(distdir); tar xf -)
(cd $(srcdir) ; tar -cf - --exclude CVS win32 test result SAXresult ) | (cd $(distdir); tar xf -)
cleantar:
@(rm -f libxslt*.tar.gz)
......@@ -488,10 +488,6 @@ EXTRA_DIST = xml2-config.in xml2Conf.sh.in libxml.spec.in libxml.spec \
libxml.m4 \
example/Makefile.am example/gjobread.c example/gjobs.xml \
$(man_MANS) libxml-2.0.pc.in \
win32/README.MSDev win32/Makefile.mingw \
win32/libxml2/libxml2.dsp win32/libxml2/libxml2_so.dsp \
win32/libxml2/libxml2_a.dsp win32/libxml2/xmllint.dsp \
win32/libxml2/libxml2.def.src \
vms/build_libxml.com vms/config.vms \
strio.c strio.h trio.c trio.h triop.h libxml.h
......
......@@ -163,10 +163,20 @@ extern void xmlCheckVersion(int version);
/**
* LIBXML_DLL_IMPORT:
*
* Used on Windows to declare a variable as exported by the library
* Used on Windows (MS C compiler only) to declare a variable as
* imported from the library. This macro should be empty when compiling
* libxml itself. It should expand to __declspec(dllimport)
* when the client code includes this header, and that only if the client
* links dynamically against libxml.
* For this to work, we need three macros. One tells us which compiler is
* being used and luckily the compiler defines such a thing: _MSC_VER. The
* second macro tells us if we are compiling libxml or the client code and
* we define the macro IN_LIBXML on the compiler's command line for this
* purpose. The third macro, LIBXML_STATIC, must be defined by any client
* code which links against libxml statically.
*/
#ifndef LIBXML_DLL_IMPORT
#if defined(WIN32) && !defined(STATIC)
#if defined(_MSC_VER) && !defined(IN_LIBXML) && !defined(LIBXML_STATIC)
#define LIBXML_DLL_IMPORT __declspec(dllimport)
#else
#define LIBXML_DLL_IMPORT
......
......@@ -18,10 +18,37 @@ extern "C" {
* use those to be sure nothing nasty will happen if
* your library and includes mismatch
*/
#ifndef LIBXML2_COMPILING_MSCCDEF
extern void xmlCheckVersion(int version);
#endif /* LIBXML2_COMPILING_MSCCDEF */
/**
* LIBXML_DOTTED_VERSION:
*
* the version string like "1.2.3"
*/
#define LIBXML_DOTTED_VERSION "2.4.1"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 1002003
*/
#define LIBXML_VERSION 20401
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "1002003"
*/
#define LIBXML_VERSION_STRING "20401"
/**
* LIBXML_TEST_VERSION:
*
* Macro to check that the libxml version in use is compatible with
* the version the software has been compiled against
*/
#define LIBXML_TEST_VERSION xmlCheckVersion(20401);
/**
......@@ -31,8 +58,6 @@ extern void xmlCheckVersion(int version);
*/
#if 0
#define WITH_TRIO
#else
#define WITHOUT_TRIO
#endif
/**
......@@ -42,8 +67,6 @@ extern void xmlCheckVersion(int version);
*/
#if 1
#define LIBXML_FTP_ENABLED
#else
#define LIBXML_FTP_DISABLED
#endif
/**
......@@ -53,8 +76,6 @@ extern void xmlCheckVersion(int version);
*/
#if 1
#define LIBXML_HTTP_ENABLED
#else
#define LIBXML_HTTP_DISABLED
#endif
/**
......@@ -64,8 +85,6 @@ extern void xmlCheckVersion(int version);
*/
#if 1
#define LIBXML_HTML_ENABLED
#else
#define LIBXML_HTML_DISABLED
#endif
/**
......@@ -75,8 +94,6 @@ extern void xmlCheckVersion(int version);
*/
#if 1
#define LIBXML_CATALOG_ENABLED
#else
#define LIBXML_CATALOG_DISABLED
#endif
/**
......@@ -84,10 +101,8 @@ extern void xmlCheckVersion(int version);
*
* Whether the SGML Docbook support is configured in
*/
#if 0
#if 1
#define LIBXML_DOCB_ENABLED
#else
#define LIBXML_DOCB_DISABLED
#endif
/**
......@@ -97,8 +112,6 @@ extern void xmlCheckVersion(int version);
*/
#if 1
#define LIBXML_XPATH_ENABLED
#else
#define LIBXML_XPATH_DISABLED
#endif
/**
......@@ -108,8 +121,6 @@ extern void xmlCheckVersion(int version);
*/
#if 1
#define LIBXML_XPTR_ENABLED
#else
#define LIBXML_XPTR_DISABLED
#endif
/**
......@@ -119,8 +130,6 @@ extern void xmlCheckVersion(int version);
*/
#if 1
#define LIBXML_XINCLUDE_ENABLED
#else
#define LIBXML_XINCLUDE_DISABLED
#endif
/**
......@@ -128,11 +137,9 @@ extern void xmlCheckVersion(int version);
*
* Whether iconv support is available
*/
#if defined(__CYGWIN__)
#if 1
#if !defined(WIN32) || defined(__CYGWIN__)
#if 0
#define LIBXML_ICONV_ENABLED
#else
#define LIBXML_ICONV_DISABLED
#endif
#endif
......@@ -143,8 +150,6 @@ extern void xmlCheckVersion(int version);
*/
#if 1
#define LIBXML_DEBUG_ENABLED
#else
#define LIBXML_DEBUG_DISABLED
#endif
/**
......@@ -156,8 +161,23 @@ extern void xmlCheckVersion(int version);
#define DEBUG_MEMORY_LOCATION
#endif
/**
* LIBXML_DLL_IMPORT:
*
* Used on Windows (MS C compiler only) to declare a variable as
* imported from the library. This macro should be empty when compiling
* libxml itself. It should expand to __declspec(dllimport)
* when the client code includes this header, and that only if the client
* links dynamically against libxml.
* For this to work, we need three macros. One tells us which compiler is
* being used and luckily the compiler defines such a thing: _MSC_VER. The
* second macro tells us if we are compiling libxml or the client code and
* we define the macro IN_LIBXML on the compiler's command line for this
* purpose. The third macro, LIBXML_STATIC, must be defined by any client
* code which links against libxml statically.
*/
#ifndef LIBXML_DLL_IMPORT
#if !defined(STATIC)
#if defined(_MSC_VER) && !defined(IN_LIBXML) && !defined(LIBXML_STATIC)
#define LIBXML_DLL_IMPORT __declspec(dllimport)
#else
#define LIBXML_DLL_IMPORT
......@@ -168,13 +188,19 @@ extern void xmlCheckVersion(int version);
* ATTRIBUTE_UNUSED:
*
* Macro used to signal to GCC unused function parameters
* Disabled on Windows, this is checked on Linux.
*/
#ifdef __GNUC__
#ifdef HAVE_ANSIDECL_H
#include <ansidecl.h>
#endif
#ifndef ATTRIBUTE_UNUSED
#define ATTRIBUTE_UNUSED
#endif
#else
#define ATTRIBUTE_UNUSED
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
......@@ -18,10 +18,37 @@ extern "C" {
* use those to be sure nothing nasty will happen if
* your library and includes mismatch
*/
#ifndef LIBXML2_COMPILING_MSCCDEF
extern void xmlCheckVersion(int version);
#endif /* LIBXML2_COMPILING_MSCCDEF */
/**
* LIBXML_DOTTED_VERSION:
*
* the version string like "1.2.3"
*/
#define LIBXML_DOTTED_VERSION "@VERSION@"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 1002003
*/
#define LIBXML_VERSION @LIBXML_VERSION_NUMBER@
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "1002003"
*/
#define LIBXML_VERSION_STRING "@LIBXML_VERSION_NUMBER@"
/**
* LIBXML_TEST_VERSION:
*
* Macro to check that the libxml version in use is compatible with
* the version the software has been compiled against
*/
#define LIBXML_TEST_VERSION xmlCheckVersion(@LIBXML_VERSION_NUMBER@);
/**
......@@ -31,8 +58,6 @@ extern void xmlCheckVersion(int version);
*/
#if 0
#define WITH_TRIO
#else
#define WITHOUT_TRIO
#endif
/**
......@@ -42,8 +67,6 @@ extern void xmlCheckVersion(int version);
*/
#if 1
#define LIBXML_FTP_ENABLED
#else
#define LIBXML_FTP_DISABLED
#endif
/**
......@@ -53,8 +76,6 @@ extern void xmlCheckVersion(int version);
*/
#if 1
#define LIBXML_HTTP_ENABLED
#else
#define LIBXML_HTTP_DISABLED
#endif
/**
......@@ -64,8 +85,6 @@ extern void xmlCheckVersion(int version);
*/
#if 1
#define LIBXML_HTML_ENABLED
#else
#define LIBXML_HTML_DISABLED
#endif
/**
......@@ -75,8 +94,6 @@ extern void xmlCheckVersion(int version);
*/
#if 1
#define LIBXML_CATALOG_ENABLED
#else
#define LIBXML_CATALOG_DISABLED
#endif
/**
......@@ -84,10 +101,8 @@ extern void xmlCheckVersion(int version);
*
* Whether the SGML Docbook support is configured in
*/
#if 0
#if 1
#define LIBXML_DOCB_ENABLED
#else
#define LIBXML_DOCB_DISABLED
#endif
/**
......@@ -97,8 +112,6 @@ extern void xmlCheckVersion(int version);
*/
#if 1
#define LIBXML_XPATH_ENABLED
#else
#define LIBXML_XPATH_DISABLED
#endif
/**
......@@ -108,8 +121,6 @@ extern void xmlCheckVersion(int version);
*/
#if 1
#define LIBXML_XPTR_ENABLED
#else
#define LIBXML_XPTR_DISABLED
#endif
/**
......@@ -119,8 +130,6 @@ extern void xmlCheckVersion(int version);
*/
#if 1
#define LIBXML_XINCLUDE_ENABLED
#else
#define LIBXML_XINCLUDE_DISABLED
#endif
/**
......@@ -128,11 +137,9 @@ extern void xmlCheckVersion(int version);
*
* Whether iconv support is available
*/
#if defined(__CYGWIN__)
#if @WITH_ICONV@
#if !defined(WIN32) || defined(__CYGWIN__)
#if 0
#define LIBXML_ICONV_ENABLED
#else
#define LIBXML_ICONV_DISABLED
#endif
#endif
......@@ -143,8 +150,6 @@ extern void xmlCheckVersion(int version);
*/
#if 1
#define LIBXML_DEBUG_ENABLED
#else
#define LIBXML_DEBUG_DISABLED
#endif
/**
......@@ -156,8 +161,23 @@ extern void xmlCheckVersion(int version);
#define DEBUG_MEMORY_LOCATION
#endif
/**
* LIBXML_DLL_IMPORT:
*
* Used on Windows (MS C compiler only) to declare a variable as
* imported from the library. This macro should be empty when compiling
* libxml itself. It should expand to __declspec(dllimport)
* when the client code includes this header, and that only if the client
* links dynamically against libxml.
* For this to work, we need three macros. One tells us which compiler is
* being used and luckily the compiler defines such a thing: _MSC_VER. The
* second macro tells us if we are compiling libxml or the client code and
* we define the macro IN_LIBXML on the compiler's command line for this
* purpose. The third macro, LIBXML_STATIC, must be defined by any client
* code which links against libxml statically.
*/
#ifndef LIBXML_DLL_IMPORT
#if !defined(STATIC)
#if defined(_MSC_VER) && !defined(IN_LIBXML) && !defined(LIBXML_STATIC)
#define LIBXML_DLL_IMPORT __declspec(dllimport)
#else
#define LIBXML_DLL_IMPORT
......@@ -168,13 +188,19 @@ extern void xmlCheckVersion(int version);
* ATTRIBUTE_UNUSED:
*
* Macro used to signal to GCC unused function parameters
* Disabled on Windows, this is checked on Linux.
*/
#ifdef __GNUC__
#ifdef HAVE_ANSIDECL_H
#include <ansidecl.h>
#endif
#ifndef ATTRIBUTE_UNUSED
#define ATTRIBUTE_UNUSED
#endif
#else
#define ATTRIBUTE_UNUSED
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
......@@ -9,14 +9,6 @@
#include <io.h>
#ifndef LIBXML_DLL_IMPORT
#if !defined(STATIC)
#define LIBXML_DLL_IMPORT __declspec(dllimport)
#else
#define LIBXML_DLL_IMPORT
#endif
#endif
#define SOCKLEN_T int
#ifdef NEED_SOCKETS
#include <winsock2.h>
......@@ -64,6 +56,24 @@
#define HAVE_ISNAN
#include <math.h>
#ifdef _MSC_VER
/* MS C-runtime has functions which can be used in order to determine if
a given floating-point variable contains NaN, (+-)INF. These are
preferred, because floating-point technology is considered propriatary
by MS and we can assume that their functions know more about their
oddities than we do. */
#include <float.h>
/* Bjorn Reese figured a quite nice construct for isinf() using the _fpclass
function. */
#ifndef isinf
#define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
: ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0))
#endif
/* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */
#ifndef isnan
#define isnan(d) (_isnan(d))
#endif
#else /* _MSC_VER */
static int isinf (double d) {
int expon = 0;
double val = frexp (d, &expon);
......@@ -94,22 +104,40 @@ static int isnan (double d) {
return 0;
}
}
#endif /* _MSC_VER */
#include <direct.h>
#define HAVE_SYS_STAT_H
#define HAVE__STAT
#include <libxml/xmlwin32version.h>
#ifdef _MSC_VER
/* We don't use trio when compiling under MSVC. This is not because trio
is bad, but because MSVC has no easy way to conditionally include a .c
file in the project. In order to enable trio usage, we would have to compile
all trio functionality into the executable, even if we don't use it.
Since MS C-runtime has all required functions, trio is not necessary. */
#ifdef WITH_TRIO
#undef WITH_TRIO
#endif /* WITH_TRIO */
#ifndef WITHOUT_TRIO
#define WITHOUT_TRIO
#endif /* WITHOUT_TRIO */
/* 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/xmlwin32version.h>
#ifndef WITH_TRIO
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif /* WITH_TRIO */
#endif /* _MSC_VER */
#ifndef LIBXML_DLL_IMPORT
#if defined(_MSC_VER) && !defined(IN_LIBXML) && !defined(LIBXML_STATIC)
#define LIBXML_DLL_IMPORT __declspec(dllimport)
#else
#define LIBXML_DLL_IMPORT
#endif
#endif
#ifndef ATTRIBUTE_UNUSED
#define ATTRIBUTE_UNUSED
......
......@@ -542,7 +542,11 @@ xmlNanoHTTPRecv(xmlNanoHTTPCtxtPtr ctxt) {
FD_ZERO(&rfd);
FD_SET(ctxt->fd, &rfd);
if ( (select(ctxt->fd+1, &rfd, NULL, NULL, &tv)<1) && (errno != EINTR) )
if ( (select(ctxt->fd+1, &rfd, NULL, NULL, &tv)<1)
#if defined(EINTR)
&& (errno != EINTR)
#endif
)
return(0);
}
return(0);
......
......@@ -7308,7 +7308,7 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator);
if (ctxt->encoding == XML_CHAR_ENCODING_NONE) {
if (ctxt->encoding == (const xmlChar *)XML_CHAR_ENCODING_NONE) {
/*
* Get the 4 first bytes and decode the charset
* if enc != XML_CHAR_ENCODING_NONE
......
......@@ -10,10 +10,6 @@
#ifdef LIBXML_HTML_ENABLED
#ifdef WIN32
#undef LIBXML_DLL_IMPORT
#endif
#include <string.h>
#include <stdarg.h>
......
......@@ -8,10 +8,6 @@
#include "libxml.h"
#ifdef WIN32
#undef LIBXML_DLL_IMPORT
#endif
#include <string.h>
#include <stdarg.h>
......
-----------------------------------------------------------------------
[24. July, 2001, igor@stud.fh-frankfurt.de]
And again there are new MSVC project files for libxml2.
You can find the project files for MSVC 6.0 and higher in win32/dsp/
subdirectory of the source tree. You should load the file libxml2.dsw
into the IDE. This is the workspace file which contains all projects
and their interdependencies.
Check the file xmlwin32version.h for optional features and enable or
disable them, as it suits you. The defaults are apropriate for most
people, so there is usually no need to mess with this.
If you receive few compiler warnings, ignore them. These are harmless
and shall dissapear in the future.
From now on, all object files produced by the compiler end up in the same
directory for each project, no matter if you compile with debugging
turned on or not. This means that a release build shall overwite the
debug build and vice versa. This makes the dependency tracking easier,
but there are people who don't like this for some reason.
The new project files from win32/dsp/ make any other project files
obsolete. Previous project files shall remain in their usual location
for some time and end up removed if noone complains.
-----------------------------------------------------------------------
[January the 16th, 2001, igor@stud.fh-frankfurt.de]
......
This diff is collapsed.
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "libxml2_a"=.\libxml2_a.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "libxml2_so"=.\libxml2_so.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "testCatalog"=.\testCatalog.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "testDocbook"=.\testDocbook.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "testHTML"=.\testHTML.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "testSAX"=.\testSAX.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "testURI"=.\testURI.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "testXPath"=.\testXPath.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "xmllint"=.\xmllint.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
# Microsoft Developer Studio Project File - Name="libxml2_a" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=libxml2_a - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "libxml2_a.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "libxml2_a.mak" CFG="libxml2_a - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "libxml2_a - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "libxml2_a - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "libxml2_a - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "libxml2_a___Win32_Release"
# PROP BASE Intermediate_Dir "libxml2_a___Win32_Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "libxml2_a"
# PROP Intermediate_Dir "libxml2_a"
# PROP Target_Dir ""
F90=df.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "IN_LIBXML" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"