[Expat-discuss] Expat 2.0 pre-release
Karl Waclawek
karl at waclawek.net
Sat Dec 24 01:26:39 CET 2005
rolf at pointsman.de wrote:
>I wonder, why I don't see any define for XML_LARGE_SIZE to __int64
>under windows. As far as I know, at least VC++ 6.0 don't know long
>long, but has __int64 (you're much more the expert on this plattform,
>so please enlighten me, if I miss the obvious). If I'm right (I doubt
>it), then XML_LARGE_SIZE support under windows would be only possible
>after editing expat_external.h
>
>
Try this patch (against CVS or the pre-release).. It works for MS VC++
6.0, and takes care
(hopefully) of your printf issues: (I mean for everyone to try it, not
just Rolf):
=== begin patch ===
Index: lib/expat_external.h
===================================================================
RCS file: /cvsroot/expat/expat/lib/expat_external.h,v
retrieving revision 1.4
diff -u -r1.4 expat_external.h
--- lib/expat_external.h 23 Dec 2005 14:45:27 -0000 1.4
+++ lib/expat_external.h 23 Dec 2005 21:41:16 -0000
@@ -95,8 +95,13 @@
#endif /* XML_UNICODE */
#ifdef XML_LARGE_SIZE /* Use large integers for counts and positions. */
+#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
+typedef __int64 XML_Index;
+typedef unsigned __int64 XML_Size;
+#else
typedef long long XML_Index;
typedef unsigned long long XML_Size;
+#endif
#else
typedef long XML_Index;
typedef unsigned long XML_Size;
Index: lib/xmltok_impl.c
===================================================================
RCS file: /cvsroot/expat/expat/lib/xmltok_impl.c,v
retrieving revision 1.11
diff -u -r1.11 xmltok_impl.c
--- lib/xmltok_impl.c 28 Nov 2005 20:02:36 -0000 1.11
+++ lib/xmltok_impl.c 24 Dec 2005 00:18:49 -0000
@@ -1750,7 +1750,7 @@
LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
#undef LEAD_CASE
case BT_LF:
- pos->columnNumber = (unsigned)-1;
+ pos->columnNumber = (XML_Size)-1;
pos->lineNumber++;
ptr += MINBPC(enc);
break;
@@ -1759,7 +1759,7 @@
ptr += MINBPC(enc);
if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF)
ptr += MINBPC(enc);
- pos->columnNumber = (unsigned)-1;
+ pos->columnNumber = (XML_Size)-1;
break;
default:
ptr += MINBPC(enc);
Index: xmlwf/xmlfile.c
===================================================================
RCS file: /cvsroot/expat/expat/xmlwf/xmlfile.c,v
retrieving revision 1.14
diff -u -r1.14 xmlfile.c
--- xmlwf/xmlfile.c 10 Aug 2004 18:13:47 -0000 1.14
+++ xmlwf/xmlfile.c 24 Dec 2005 00:07:28 -0000
@@ -53,7 +53,7 @@
enum XML_Error code = XML_GetErrorCode(parser);
const XML_Char *message = XML_ErrorString(code);
if (message)
- ftprintf(stdout, T("%s:%d:%d: %s\n"),
+ ftprintf(stdout, T("%s:%" XML_FMT_INT_MOD "u:%" XML_FMT_INT_MOD "u:
%s\n"),
filename,
XML_GetErrorLineNumber(parser),
XML_GetErrorColumnNumber(parser),
Index: xmlwf/xmlfile.h
===================================================================
RCS file: /cvsroot/expat/expat/xmlwf/xmlfile.h,v
retrieving revision 1.7
diff -u -r1.7 xmlfile.h
--- xmlwf/xmlfile.h 1 Jul 2002 15:18:34 -0000 1.7
+++ xmlwf/xmlfile.h 23 Dec 2005 22:53:40 -0000
@@ -5,6 +5,16 @@
#define XML_MAP_FILE 01
#define XML_EXTERNAL_ENTITIES 02
+#ifdef XML_LARGE_SIZE
+#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
+#define XML_FMT_INT_MOD "I64"
+#else
+#define XML_FMT_INT_MOD "ll"
+#endif
+#else
+#define XML_FMT_INT_MOD "l"
+#endif
+
extern int XML_ProcessFile(XML_Parser parser,
const XML_Char *filename,
unsigned flags);
Index: xmlwf/xmlwf.c
===================================================================
RCS file: /cvsroot/expat/expat/xmlwf/xmlwf.c,v
retrieving revision 1.67
diff -u -r1.67 xmlwf.c
--- xmlwf/xmlwf.c 10 Aug 2004 18:18:25 -0000 1.67
+++ xmlwf/xmlwf.c 24 Dec 2005 00:10:13 -0000
@@ -7,6 +7,13 @@
#include <stddef.h>
#include <string.h>
+#ifdef COMPILED_FROM_DSP
+#include "winconfig.h"
+#else
+#ifdef HAVE_EXPAT_CONFIG_H
+#include "expat_config.h"
+#endif
+#endif
#include "expat.h"
#include "codepage.h"
#include "xmlfile.h"
@@ -305,7 +312,8 @@
if (uri)
ftprintf((FILE *)XML_GetUserData(parser), T(" uri=\"%s\""), uri);
ftprintf((FILE *)XML_GetUserData(parser),
- T(" byte=\"%ld\" nbytes=\"%d\" line=\"%d\" col=\"%d\""),
+ T(" byte=\"%" XML_FMT_INT_MOD "d\" nbytes=\"%d\" \
+ line=\"%" XML_FMT_INT_MOD "u\" col=\"%" XML_FMT_INT_MOD
"u\""),
XML_GetCurrentByteIndex(parser),
XML_GetCurrentByteCount(parser),
XML_GetCurrentLineNumber(parser),
=== end patch ===
Karl
More information about the Expat-discuss
mailing list