summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorkwaclaw <kwaclaw>2004-03-26 14:24:09 +0000
committerkwaclaw <kwaclaw>2004-03-26 14:24:09 +0000
commitb491a95e0941d18b62d280e99a867a85069caf6d (patch)
treeff6283fcfbc805f548e13e45a8f4725c01aa2f8e /lib
parent3e070384c2645b9145dd7abeca711dc03f82a00c (diff)
downloadlibexpat-b491a95e0941d18b62d280e99a867a85069caf6d.tar.gz
Fix for bug #923913, Calling convention problems.
For details see bug description.
Diffstat (limited to 'lib')
-rw-r--r--lib/expat.dsp8
-rw-r--r--lib/expat.h94
-rw-r--r--lib/expat_static.dsp8
-rw-r--r--lib/expatw.dsp8
-rw-r--r--lib/expatw_static.dsp8
-rw-r--r--lib/external.h92
-rw-r--r--lib/xmlparse.c2
-rw-r--r--lib/xmlrole.c1
-rw-r--r--lib/xmltok.c3
-rw-r--r--lib/xmltok.h3
10 files changed, 134 insertions, 93 deletions
diff --git a/lib/expat.dsp b/lib/expat.dsp
index 0724cb5..a9dd307 100644
--- a/lib/expat.dsp
+++ b/lib/expat.dsp
@@ -133,10 +133,18 @@ SOURCE=.\expat.h
# End Source File
# Begin Source File
+SOURCE=.\external.h
+# End Source File
+# Begin Source File
+
SOURCE=.\iasciitab.h
# End Source File
# Begin Source File
+SOURCE=.\internal.h
+# End Source File
+# Begin Source File
+
SOURCE=.\latin1tab.h
# End Source File
# Begin Source File
diff --git a/lib/expat.h b/lib/expat.h
index d6e06d1..c035877 100644
--- a/lib/expat.h
+++ b/lib/expat.h
@@ -15,97 +15,11 @@
#endif
#include <stdlib.h>
-
-#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
-#define XML_USE_MSC_EXTENSIONS 1
-#endif
-
-/* Expat tries very hard to make the API boundary very specifically
- defined. There are two macros defined to control this boundary;
- each of these can be defined before including this header to
- achieve some different behavior, but doing so it not recommended or
- tested frequently.
-
- XMLCALL - The calling convention to use for all calls across the
- "library boundary." This will default to cdecl, and
- try really hard to tell the compiler that's what we
- want.
-
- XMLIMPORT - Whatever magic is needed to note that a function is
- to be imported from a dynamically loaded library
- (.dll, .so, or .sl, depending on your platform).
-
- The XMLCALL macro was added in Expat 1.95.7. The only one which is
- expected to be directly useful in client code is XMLCALL.
-
- Note that on at least some Unix versions, the Expat library must be
- compiled with the cdecl calling convention as the default since
- system headers may assume the cdecl convention.
-*/
-#ifndef XMLCALL
-#if defined(XML_USE_MSC_EXTENSIONS)
-#define XMLCALL __cdecl
-#elif defined(__GNUC__) && defined(__i386)
-#define XMLCALL __attribute__((cdecl))
-#else
-/* For any platform which uses this definition and supports more than
- one calling convention, we need to extend this definition to
- declare the convention used on that platform, if it's possible to
- do so.
-
- If this is the case for your platform, please file a bug report
- with information on how to identify your platform via the C
- pre-processor and how to specify the same calling convention as the
- platform's malloc() implementation.
-*/
-#define XMLCALL
-#endif
-#endif /* not defined XMLCALL */
-
-
-#if !defined(XML_STATIC) && !defined(XMLIMPORT)
-#ifndef XML_BUILDING_EXPAT
-/* using Expat from an application */
-
-#ifdef XML_USE_MSC_EXTENSIONS
-#define XMLIMPORT __declspec(dllimport)
-#endif
-
-#endif
-#endif /* not defined XML_STATIC */
-
-/* If we didn't define it above, define it away: */
-#ifndef XMLIMPORT
-#define XMLIMPORT
-#endif
-
-
-#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef XML_UNICODE_WCHAR_T
-#define XML_UNICODE
-#endif
+#include "external.h"
struct XML_ParserStruct;
typedef struct XML_ParserStruct *XML_Parser;
-#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
-#ifdef XML_UNICODE_WCHAR_T
-typedef wchar_t XML_Char;
-typedef wchar_t XML_LChar;
-#else
-typedef unsigned short XML_Char;
-typedef char XML_LChar;
-#endif /* XML_UNICODE_WCHAR_T */
-#else /* Information is UTF-8 encoded. */
-typedef char XML_Char;
-typedef char XML_LChar;
-#endif /* XML_UNICODE */
-
/* Should this be defined using stdbool.h when C99 is available? */
typedef unsigned char XML_Bool;
#define XML_TRUE ((XML_Bool) 1)
@@ -265,9 +179,9 @@ XML_SetXmlDeclHandler(XML_Parser parser,
typedef struct {
- void *(XMLCALL *malloc_fcn)(size_t size);
- void *(XMLCALL *realloc_fcn)(void *ptr, size_t size);
- void (XMLCALL *free_fcn)(void *ptr);
+ void *(*malloc_fcn)(size_t size);
+ void *(*realloc_fcn)(void *ptr, size_t size);
+ void (*free_fcn)(void *ptr);
} XML_Memory_Handling_Suite;
/* Constructs a new parser; encoding is the encoding specified by the
diff --git a/lib/expat_static.dsp b/lib/expat_static.dsp
index 62e5530..aa3190e 100644
--- a/lib/expat_static.dsp
+++ b/lib/expat_static.dsp
@@ -115,10 +115,18 @@ SOURCE=.\expat.h
# End Source File
# Begin Source File
+SOURCE=.\external.h
+# End Source File
+# Begin Source File
+
SOURCE=.\iasciitab.h
# End Source File
# Begin Source File
+SOURCE=.\internal.h
+# End Source File
+# Begin Source File
+
SOURCE=.\latin1tab.h
# End Source File
# Begin Source File
diff --git a/lib/expatw.dsp b/lib/expatw.dsp
index a902dfe..efc40e8 100644
--- a/lib/expatw.dsp
+++ b/lib/expatw.dsp
@@ -134,10 +134,18 @@ SOURCE=.\expat.h
# End Source File
# Begin Source File
+SOURCE=.\external.h
+# End Source File
+# Begin Source File
+
SOURCE=.\iasciitab.h
# End Source File
# Begin Source File
+SOURCE=.\internal.h
+# End Source File
+# Begin Source File
+
SOURCE=.\latin1tab.h
# End Source File
# Begin Source File
diff --git a/lib/expatw_static.dsp b/lib/expatw_static.dsp
index c366048..c2e0d5f 100644
--- a/lib/expatw_static.dsp
+++ b/lib/expatw_static.dsp
@@ -115,10 +115,18 @@ SOURCE=.\expat.h
# End Source File
# Begin Source File
+SOURCE=.\external.h
+# End Source File
+# Begin Source File
+
SOURCE=.\iasciitab.h
# End Source File
# Begin Source File
+SOURCE=.\internal.h
+# End Source File
+# Begin Source File
+
SOURCE=.\latin1tab.h
# End Source File
# Begin Source File
diff --git a/lib/external.h b/lib/external.h
new file mode 100644
index 0000000..4145cac
--- /dev/null
+++ b/lib/external.h
@@ -0,0 +1,92 @@
+/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
+ See the file COPYING for copying permission.
+*/
+
+/* External API definitions */
+
+#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
+#define XML_USE_MSC_EXTENSIONS 1
+#endif
+
+/* Expat tries very hard to make the API boundary very specifically
+ defined. There are two macros defined to control this boundary;
+ each of these can be defined before including this header to
+ achieve some different behavior, but doing so it not recommended or
+ tested frequently.
+
+ XMLCALL - The calling convention to use for all calls across the
+ "library boundary." This will default to cdecl, and
+ try really hard to tell the compiler that's what we
+ want.
+
+ XMLIMPORT - Whatever magic is needed to note that a function is
+ to be imported from a dynamically loaded library
+ (.dll, .so, or .sl, depending on your platform).
+
+ The XMLCALL macro was added in Expat 1.95.7. The only one which is
+ expected to be directly useful in client code is XMLCALL.
+
+ Note that on at least some Unix versions, the Expat library must be
+ compiled with the cdecl calling convention as the default since
+ system headers may assume the cdecl convention.
+*/
+#ifndef XMLCALL
+#if defined(XML_USE_MSC_EXTENSIONS)
+#define XMLCALL __cdecl
+#elif defined(__GNUC__) && defined(__i386)
+#define XMLCALL __attribute__((cdecl))
+#else
+/* For any platform which uses this definition and supports more than
+ one calling convention, we need to extend this definition to
+ declare the convention used on that platform, if it's possible to
+ do so.
+
+ If this is the case for your platform, please file a bug report
+ with information on how to identify your platform via the C
+ pre-processor and how to specify the same calling convention as the
+ platform's malloc() implementation.
+*/
+#define XMLCALL
+#endif
+#endif /* not defined XMLCALL */
+
+
+#if !defined(XML_STATIC) && !defined(XMLIMPORT)
+#ifndef XML_BUILDING_EXPAT
+/* using Expat from an application */
+
+#ifdef XML_USE_MSC_EXTENSIONS
+#define XMLIMPORT __declspec(dllimport)
+#endif
+
+#endif
+#endif /* not defined XML_STATIC */
+
+/* If we didn't define it above, define it away: */
+#ifndef XMLIMPORT
+#define XMLIMPORT
+#endif
+
+
+#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef XML_UNICODE_WCHAR_T
+#define XML_UNICODE
+#endif
+
+#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
+#ifdef XML_UNICODE_WCHAR_T
+typedef wchar_t XML_Char;
+typedef wchar_t XML_LChar;
+#else
+typedef unsigned short XML_Char;
+typedef char XML_LChar;
+#endif /* XML_UNICODE_WCHAR_T */
+#else /* Information is UTF-8 encoded. */
+typedef char XML_Char;
+typedef char XML_LChar;
+#endif /* XML_UNICODE */
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
index 01542e1..b12383d 100644
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -491,7 +491,7 @@ struct XML_ParserStruct {
void *m_unknownEncodingMem;
void *m_unknownEncodingData;
void *m_unknownEncodingHandlerData;
- void (*m_unknownEncodingRelease)(void *);
+ void (XMLCALL *m_unknownEncodingRelease)(void *);
PROLOG_STATE m_prologState;
Processor *m_processor;
enum XML_Error m_errorCode;
diff --git a/lib/xmlrole.c b/lib/xmlrole.c
index 300d8ff..70c39f9 100644
--- a/lib/xmlrole.c
+++ b/lib/xmlrole.c
@@ -12,6 +12,7 @@
#endif
#endif /* ndef COMPILED_FROM_DSP */
+#include "external.h"
#include "internal.h"
#include "xmlrole.h"
#include "ascii.h"
diff --git a/lib/xmltok.c b/lib/xmltok.c
index 962df0e..2a967e2 100644
--- a/lib/xmltok.c
+++ b/lib/xmltok.c
@@ -12,6 +12,7 @@
#endif
#endif /* ndef COMPILED_FROM_DSP */
+#include "external.h"
#include "internal.h"
#include "xmltok.h"
#include "nametab.h"
@@ -1233,7 +1234,7 @@ XmlUtf16Encode(int charNum, unsigned short *buf)
struct unknown_encoding {
struct normal_encoding normal;
- int (*convert)(void *userData, const char *p);
+ CONVERTER convert;
void *userData;
unsigned short utf16[256];
char utf8[256][4];
diff --git a/lib/xmltok.h b/lib/xmltok.h
index 3d776be..1ecd05f 100644
--- a/lib/xmltok.h
+++ b/lib/xmltok.h
@@ -281,7 +281,8 @@ int FASTCALL XmlUtf8Encode(int charNumber, char *buf);
int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf);
int XmlSizeOfUnknownEncoding(void);
-typedef int (*CONVERTER)(void *userData, const char *p);
+
+typedef int (XMLCALL *CONVERTER) (void *userData, const char *p);
ENCODING *
XmlInitUnknownEncoding(void *mem,