* contrib/hbmxml/3rd/minixml/mxml.hbp
* contrib/hbmxml/3rd/minixml/minixml.diff -> contrib/hbmxml/3rd/minixml/mxml.diff
* one more sync with 3.4 fork
420 lines
9.5 KiB
Diff
420 lines
9.5 KiB
Diff
diff -urN minixml.orig/config.h minixml/config.h
|
|
--- minixml.orig/config.h 2014-02-03 09:42:00.428080633 +0100
|
|
+++ minixml/config.h 2014-02-03 09:42:00.428080633 +0100
|
|
@@ -18,62 +18,87 @@
|
|
* Include necessary headers...
|
|
*/
|
|
|
|
-#include <stdio.h>
|
|
-#include <stdlib.h>
|
|
-#include <string.h>
|
|
-#include <stdarg.h>
|
|
-#include <ctype.h>
|
|
+#define _CRT_SECURE_NO_DEPRECATE
|
|
+#define _CRT_SECURE_NO_WARNINGS
|
|
|
|
+#include "hbdefs.h"
|
|
+#include "hb_io.h"
|
|
+
|
|
+#include "hbapi.h"
|
|
+#define HAVE_SNPRINTF 1
|
|
+#undef snprintf
|
|
+#define snprintf hb_snprintf
|
|
+
|
|
+#define HAVE_VSNPRINTF 1
|
|
+#undef vsnprintf
|
|
+#define vsnprintf hb_vsnprintf
|
|
+
|
|
+#if defined ( _MSC_VER )
|
|
+#define close _close
|
|
+#define open _open
|
|
+#define read _read
|
|
+/* #define snprintf _snprintf */
|
|
+#define strdup _strdup
|
|
+/* #define vsnprintf _vsnprintf */
|
|
+#define write _write
|
|
+#endif
|
|
|
|
/*
|
|
* Version number...
|
|
*/
|
|
|
|
-#define MXML_VERSION ""
|
|
+#define MXML_VERSION "Mini-XML v2.7"
|
|
|
|
|
|
/*
|
|
* Inline function support...
|
|
*/
|
|
|
|
-#define inline
|
|
+#define inline _HB_INLINE_
|
|
|
|
|
|
/*
|
|
* Long long support...
|
|
*/
|
|
|
|
-#undef HAVE_LONG_LONG
|
|
+#ifndef __BORLANDC__
|
|
+#define HAVE_LONG_LONG 1
|
|
+#endif
|
|
|
|
|
|
/*
|
|
* Do we have the snprintf() and vsnprintf() functions?
|
|
*/
|
|
|
|
-#undef HAVE_SNPRINTF
|
|
-#undef HAVE_VSNPRINTF
|
|
+/* #define HAVE_SNPRINTF 1 */
|
|
+/* #define HAVE_VSNPRINTF 1 */
|
|
|
|
|
|
/*
|
|
* Do we have the strXXX() functions?
|
|
*/
|
|
|
|
-#undef HAVE_STRDUP
|
|
+/* #define HAVE_STRDUP 1 */
|
|
|
|
|
|
/*
|
|
* Do we have threading support?
|
|
*/
|
|
|
|
-#undef HAVE_PTHREAD_H
|
|
+/* #undef HAVE_PTHREAD_H */
|
|
|
|
|
|
/*
|
|
* Define prototypes for string functions as needed...
|
|
*/
|
|
|
|
+# ifdef __cplusplus
|
|
+extern "C" {
|
|
+# endif /* __cplusplus */
|
|
+
|
|
# ifndef HAVE_STRDUP
|
|
extern char *_mxml_strdup(const char *);
|
|
+# undef strdup
|
|
# define strdup _mxml_strdup
|
|
# endif /* !HAVE_STRDUP */
|
|
|
|
@@ -82,14 +107,20 @@
|
|
|
|
# ifndef HAVE_SNPRINTF
|
|
extern int _mxml_snprintf(char *, size_t, const char *, ...);
|
|
+# undef snprintf
|
|
# define snprintf _mxml_snprintf
|
|
# endif /* !HAVE_SNPRINTF */
|
|
|
|
# ifndef HAVE_VSNPRINTF
|
|
extern int _mxml_vsnprintf(char *, size_t, const char *, va_list);
|
|
+# undef vsnprintf
|
|
# define vsnprintf _mxml_vsnprintf
|
|
# endif /* !HAVE_VSNPRINTF */
|
|
|
|
+# ifdef __cplusplus
|
|
+}
|
|
+# endif /* __cplusplus */
|
|
+
|
|
/*
|
|
* End of "$Id: config.h.in 451 2014-01-04 21:50:06Z msweet $".
|
|
*/
|
|
diff -urN minixml.orig/mxml_fil.c minixml/mxml_fil.c
|
|
--- minixml.orig/mxml_fil.c 2014-02-03 09:42:00.432080632 +0100
|
|
+++ minixml/mxml_fil.c 2014-02-03 09:42:00.432080632 +0100
|
|
@@ -294,8 +294,14 @@
|
|
return (-1);
|
|
|
|
if (col > 0)
|
|
+ {
|
|
+#ifdef _EOL_CRLF
|
|
+ if (mxml_fd_putc('\r', &buf) < 0)
|
|
+ return (-1);
|
|
+#endif
|
|
if (mxml_fd_putc('\n', &buf) < 0)
|
|
return (-1);
|
|
+ }
|
|
|
|
/*
|
|
* Flush and return...
|
|
@@ -333,8 +339,14 @@
|
|
return (-1);
|
|
|
|
if (col > 0)
|
|
+ {
|
|
+#ifdef _EOL_CRLF
|
|
+ if (putc('\r', fp) < 0)
|
|
+ return (-1);
|
|
+#endif
|
|
if (putc('\n', fp) < 0)
|
|
return (-1);
|
|
+ }
|
|
|
|
/*
|
|
* Return 0 (success)...
|
|
@@ -381,7 +393,12 @@
|
|
return (-1);
|
|
|
|
if (col > 0)
|
|
+ {
|
|
+#ifdef _EOL_CRLF
|
|
+ mxml_string_putc('\r', ptr);
|
|
+#endif
|
|
mxml_string_putc('\n', ptr);
|
|
+ }
|
|
|
|
/*
|
|
* Nul-terminate the buffer...
|
|
@@ -1021,7 +1038,7 @@
|
|
while ((bytes = read(buf->fd, buf->buffer, sizeof(buf->buffer))) < 0)
|
|
#ifdef EINTR
|
|
if (errno != EAGAIN && errno != EINTR)
|
|
-#else
|
|
+#elif defined( EAGAIN )
|
|
if (errno != EAGAIN)
|
|
#endif /* EINTR */
|
|
return (-1);
|
|
@@ -2755,6 +2772,10 @@
|
|
|
|
if (global->wrap > 0 && (col + width) > global->wrap)
|
|
{
|
|
+#ifdef _EOL_CRLF
|
|
+ if ((*putc_cb)('\r', p) < 0)
|
|
+ return (-1);
|
|
+#endif
|
|
if ((*putc_cb)('\n', p) < 0)
|
|
return (-1);
|
|
|
|
@@ -2865,6 +2886,10 @@
|
|
{
|
|
if (global->wrap > 0 && col > global->wrap)
|
|
{
|
|
+#ifdef _EOL_CRLF
|
|
+ if ((*putc_cb)('\r', p) < 0)
|
|
+ return (-1);
|
|
+#endif
|
|
if ((*putc_cb)('\n', p) < 0)
|
|
return (-1);
|
|
|
|
@@ -2895,6 +2920,10 @@
|
|
{
|
|
if (global->wrap > 0 && col > global->wrap)
|
|
{
|
|
+#ifdef _EOL_CRLF
|
|
+ if ((*putc_cb)('\r', p) < 0)
|
|
+ return (-1);
|
|
+#endif
|
|
if ((*putc_cb)('\n', p) < 0)
|
|
return (-1);
|
|
|
|
@@ -2918,6 +2947,10 @@
|
|
{
|
|
if (global->wrap > 0 && col > global->wrap)
|
|
{
|
|
+#ifdef _EOL_CRLF
|
|
+ if ((*putc_cb)('\r', p) < 0)
|
|
+ return (-1);
|
|
+#endif
|
|
if ((*putc_cb)('\n', p) < 0)
|
|
return (-1);
|
|
|
|
diff -urN minixml.orig/mxml.h minixml/mxml.h
|
|
--- minixml.orig/mxml.h 2014-02-03 09:42:00.436080633 +0100
|
|
+++ minixml/mxml.h 2014-02-03 09:42:00.436080633 +0100
|
|
@@ -29,8 +29,16 @@
|
|
# include <stdlib.h>
|
|
# include <string.h>
|
|
# include <ctype.h>
|
|
-# include <errno.h>
|
|
-
|
|
+# if defined( UNDER_CE ) || defined( __CEGCC__ ) || defined( __MINGW32CE__ ) || \
|
|
+ defined( _WINCE )
|
|
+# include <io.h>
|
|
+# if !defined( UNDER_CE )
|
|
+# define UNDER_CE
|
|
+# endif
|
|
+# define strerror(e) ""
|
|
+# else
|
|
+# include <errno.h>
|
|
+# endif
|
|
|
|
/*
|
|
* Constants...
|
|
diff -urN minixml.orig/mxml_nod.c minixml/mxml_nod.c
|
|
--- minixml.orig/mxml_nod.c 2014-02-03 09:42:00.436080633 +0100
|
|
+++ minixml/mxml_nod.c 2014-02-03 09:42:00.436080633 +0100
|
|
@@ -202,7 +202,11 @@
|
|
*/
|
|
|
|
while (node->child)
|
|
- mxmlDelete(node->child);
|
|
+ {
|
|
+ mxml_node_t *child = node->child;
|
|
+ mxmlRemove(child);
|
|
+ mxmlRelease(child);
|
|
+ }
|
|
|
|
/*
|
|
* Now delete any node data...
|
|
diff -urN minixml.orig/mxml_set.c minixml/mxml_set.c
|
|
--- minixml.orig/mxml_set.c 2014-02-03 09:42:00.436080633 +0100
|
|
+++ minixml/mxml_set.c 2014-02-03 09:42:00.436080633 +0100
|
|
@@ -25,7 +25,7 @@
|
|
/*
|
|
* 'mxmlSetCDATA()' - Set the element name of a CDATA node.
|
|
*
|
|
- * The node is not changed if it (or its first child) is not a CDATA element node.
|
|
+ * The node is not changed if it is not a CDATA element node.
|
|
*
|
|
* @since Mini-XML 2.3@
|
|
*/
|
|
@@ -38,12 +38,6 @@
|
|
* Range check input...
|
|
*/
|
|
|
|
- if (node && node->type == MXML_ELEMENT &&
|
|
- strncmp(node->value.element.name, "![CDATA[", 8) &&
|
|
- node->child && node->child->type == MXML_ELEMENT &&
|
|
- !strncmp(node->child->value.element.name, "![CDATA[", 8))
|
|
- node = node->child;
|
|
-
|
|
if (!node || node->type != MXML_ELEMENT || !data ||
|
|
strncmp(node->value.element.name, "![CDATA[", 8))
|
|
return (-1);
|
|
@@ -64,7 +58,7 @@
|
|
/*
|
|
* 'mxmlSetCustom()' - Set the data and destructor of a custom data node.
|
|
*
|
|
- * The node is not changed if it (or its first child) is not a custom node.
|
|
+ * The node is not changed if it is not a custom node.
|
|
*
|
|
* @since Mini-XML 2.1@
|
|
*/
|
|
@@ -79,10 +73,6 @@
|
|
* Range check input...
|
|
*/
|
|
|
|
- if (node && node->type == MXML_ELEMENT &&
|
|
- node->child && node->child->type == MXML_CUSTOM)
|
|
- node = node->child;
|
|
-
|
|
if (!node || node->type != MXML_CUSTOM)
|
|
return (-1);
|
|
|
|
@@ -133,7 +123,7 @@
|
|
/*
|
|
* 'mxmlSetInteger()' - Set the value of an integer node.
|
|
*
|
|
- * The node is not changed if it (or its first child) is not an integer node.
|
|
+ * The node is not changed if it is not an integer node.
|
|
*/
|
|
|
|
int /* O - 0 on success, -1 on failure */
|
|
@@ -144,10 +134,6 @@
|
|
* Range check input...
|
|
*/
|
|
|
|
- if (node && node->type == MXML_ELEMENT &&
|
|
- node->child && node->child->type == MXML_INTEGER)
|
|
- node = node->child;
|
|
-
|
|
if (!node || node->type != MXML_INTEGER)
|
|
return (-1);
|
|
|
|
@@ -164,7 +150,7 @@
|
|
/*
|
|
* 'mxmlSetOpaque()' - Set the value of an opaque node.
|
|
*
|
|
- * The node is not changed if it (or its first child) is not an opaque node.
|
|
+ * The node is not changed if it is not an opaque node.
|
|
*/
|
|
|
|
int /* O - 0 on success, -1 on failure */
|
|
@@ -175,10 +161,6 @@
|
|
* Range check input...
|
|
*/
|
|
|
|
- if (node && node->type == MXML_ELEMENT &&
|
|
- node->child && node->child->type == MXML_OPAQUE)
|
|
- node = node->child;
|
|
-
|
|
if (!node || node->type != MXML_OPAQUE || !opaque)
|
|
return (-1);
|
|
|
|
@@ -198,7 +180,7 @@
|
|
/*
|
|
* 'mxmlSetReal()' - Set the value of a real number node.
|
|
*
|
|
- * The node is not changed if it (or its first child) is not a real number node.
|
|
+ * The node is not changed if it is not a real number node.
|
|
*/
|
|
|
|
int /* O - 0 on success, -1 on failure */
|
|
@@ -209,10 +191,6 @@
|
|
* Range check input...
|
|
*/
|
|
|
|
- if (node && node->type == MXML_ELEMENT &&
|
|
- node->child && node->child->type == MXML_REAL)
|
|
- node = node->child;
|
|
-
|
|
if (!node || node->type != MXML_REAL)
|
|
return (-1);
|
|
|
|
@@ -229,7 +207,7 @@
|
|
/*
|
|
* 'mxmlSetText()' - Set the value of a text node.
|
|
*
|
|
- * The node is not changed if it (or its first child) is not a text node.
|
|
+ * The node is not changed if it is not a text node.
|
|
*/
|
|
|
|
int /* O - 0 on success, -1 on failure */
|
|
@@ -241,10 +219,6 @@
|
|
* Range check input...
|
|
*/
|
|
|
|
- if (node && node->type == MXML_ELEMENT &&
|
|
- node->child && node->child->type == MXML_TEXT)
|
|
- node = node->child;
|
|
-
|
|
if (!node || node->type != MXML_TEXT || !string)
|
|
return (-1);
|
|
|
|
@@ -265,7 +239,7 @@
|
|
/*
|
|
* 'mxmlSetTextf()' - Set the value of a text node to a formatted string.
|
|
*
|
|
- * The node is not changed if it (or its first child) is not a text node.
|
|
+ * The node is not changed if it is not a text node.
|
|
*/
|
|
|
|
int /* O - 0 on success, -1 on failure */
|
|
@@ -281,10 +255,6 @@
|
|
* Range check input...
|
|
*/
|
|
|
|
- if (node && node->type == MXML_ELEMENT &&
|
|
- node->child && node->child->type == MXML_TEXT)
|
|
- node = node->child;
|
|
-
|
|
if (!node || node->type != MXML_TEXT || !format)
|
|
return (-1);
|
|
|
|
diff -urN minixml.orig/mxml_str.c minixml/mxml_str.c
|
|
--- minixml.orig/mxml_str.c 2014-02-03 09:42:00.436080633 +0100
|
|
+++ minixml/mxml_str.c 2014-02-03 09:42:00.436080633 +0100
|
|
@@ -20,6 +20,9 @@
|
|
|
|
#include "config.h"
|
|
|
|
+#ifndef HAVE_VSNPRINTF
|
|
+# include <ctype.h>
|
|
+#endif
|
|
|
|
/*
|
|
* The va_copy macro is part of C99, but many compilers don't implement it.
|