Bump version to 3.0.

Move all of the private structure definitions to mxml-private.h.
This commit is contained in:
Michael R Sweet 2019-01-04 20:02:48 -05:00
parent bc27547035
commit ea6778390a
No known key found for this signature in database
GPG Key ID: 999559A027815955
15 changed files with 120 additions and 104 deletions

View File

@ -1,4 +1,4 @@
# Changes in Mini-XML 2.13
# Changes in Mini-XML 3.0
- Fixed a potential buffer overflow when writing floating point data
(Issue #233)

View File

@ -1,4 +1,4 @@
# Mini-XML Version 2.12
# Mini-XML Version 3.0
Mini-XML is a small XML parsing library that you can use to read XML data files
or strings in your application without requiring large non-standard libraries.
@ -184,5 +184,5 @@ The Mini-XML project page provides access to the Github issue tracking page:
## Legal Stuff
The Mini-XML library is Copyright 2003-2018 by Michael R Sweet. License terms
The Mini-XML library is Copyright 2003-2019 by Michael R Sweet. License terms
are described in the file "COPYING".

20
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for Mini-XML 2.13.
# Generated by GNU Autoconf 2.69 for Mini-XML 3.0.
#
# Report bugs to <https://github.com/michaelrsweet/mxml/issues>.
#
@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='Mini-XML'
PACKAGE_TARNAME='mxml'
PACKAGE_VERSION='2.13'
PACKAGE_STRING='Mini-XML 2.13'
PACKAGE_VERSION='3.0'
PACKAGE_STRING='Mini-XML 3.0'
PACKAGE_BUGREPORT='https://github.com/michaelrsweet/mxml/issues'
PACKAGE_URL='https://michaelrsweet.github.io/mxml'
@ -1268,7 +1268,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures Mini-XML 2.13 to adapt to many kinds of systems.
\`configure' configures Mini-XML 3.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1333,7 +1333,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of Mini-XML 2.13:";;
short | recursive ) echo "Configuration of Mini-XML 3.0:";;
esac
cat <<\_ACEOF
@ -1433,7 +1433,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
Mini-XML configure 2.13
Mini-XML configure 3.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -1840,7 +1840,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by Mini-XML $as_me 2.13, which was
It was created by Mini-XML $as_me 3.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -2298,7 +2298,7 @@ host_os_version=`echo $host_os | sed -e '1,$s/^[^0-9.]*//g'`
ac_config_headers="$ac_config_headers config.h"
VERSION="2.13"
VERSION="3.0"
cat >>confdefs.h <<_ACEOF
#define MXML_VERSION "Mini-XML v$VERSION"
@ -5146,7 +5146,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by Mini-XML $as_me 2.13, which was
This file was extended by Mini-XML $as_me 3.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -5209,7 +5209,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
Mini-XML config.status 2.13
Mini-XML config.status 3.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@ -13,7 +13,7 @@ dnl https://michaelrsweet.github.io/mxml
dnl
dnl Package name and version...
AC_INIT([Mini-XML], [2.13], [https://github.com/michaelrsweet/mxml/issues], [mxml], [https://michaelrsweet.github.io/mxml])
AC_INIT([Mini-XML], [3.0], [https://github.com/michaelrsweet/mxml/issues], [mxml], [https://michaelrsweet.github.io/mxml])
dnl This line is provided to ensure that you don't run the autoheader program
dnl against this project. Doing so is completely unsupported and WILL cause

View File

@ -1,7 +1,7 @@
/*
* Attribute support code for Mini-XML, a small XML file parsing library.
*
* Copyright 2003-2017 by Michael R Sweet.
* Copyright © 2003-2019 by Michael R Sweet.
*
* These coded instructions, statements, and computer programs are the
* property of Michael R Sweet and are protected by Federal copyright
@ -17,15 +17,14 @@
*/
#include "config.h"
#include "mxml.h"
#include "mxml-private.h"
/*
* Local functions...
*/
static int mxml_set_attr(mxml_node_t *node, const char *name,
char *value);
static int mxml_set_attr(mxml_node_t *node, const char *name, char *value);
/*
@ -39,7 +38,7 @@ mxmlElementDeleteAttr(mxml_node_t *node,/* I - Element */
const char *name)/* I - Attribute name */
{
int i; /* Looping var */
mxml_attr_t *attr; /* Cirrent attribute */
_mxml_attr_t *attr; /* Cirrent attribute */
#ifdef DEBUG
@ -77,7 +76,7 @@ mxmlElementDeleteAttr(mxml_node_t *node,/* I - Element */
i --;
if (i > 0)
memmove(attr, attr + 1, i * sizeof(mxml_attr_t));
memmove(attr, attr + 1, i * sizeof(_mxml_attr_t));
node->value.element.num_attrs --;
@ -101,7 +100,7 @@ mxmlElementGetAttr(mxml_node_t *node, /* I - Element node */
const char *name) /* I - Name of attribute */
{
int i; /* Looping var */
mxml_attr_t *attr; /* Cirrent attribute */
_mxml_attr_t *attr; /* Cirrent attribute */
#ifdef DEBUG
@ -290,7 +289,7 @@ mxml_set_attr(mxml_node_t *node, /* I - Element node */
char *value) /* I - Attribute value */
{
int i; /* Looping var */
mxml_attr_t *attr; /* New attribute */
_mxml_attr_t *attr; /* New attribute */
/*
@ -319,10 +318,10 @@ mxml_set_attr(mxml_node_t *node, /* I - Element node */
*/
if (node->value.element.num_attrs == 0)
attr = malloc(sizeof(mxml_attr_t));
attr = malloc(sizeof(_mxml_attr_t));
else
attr = realloc(node->value.element.attrs,
(node->value.element.num_attrs + 1) * sizeof(mxml_attr_t));
(node->value.element.num_attrs + 1) * sizeof(_mxml_attr_t));
if (!attr)
{

View File

@ -1,7 +1,7 @@
/*
* File loading code for Mini-XML, a small XML file parsing library.
*
* Copyright 2003-2018 by Michael R Sweet.
* Copyright © 2003-2019 by Michael R Sweet.
*
* These coded instructions, statements, and computer programs are the
* property of Michael R Sweet and are protected by Federal copyright
@ -2723,7 +2723,7 @@ mxml_write_node(mxml_node_t *node, /* I - Node to write */
*next; /* Next node */
int i, /* Looping var */
width; /* Width of attr + value */
mxml_attr_t *attr; /* Current attribute */
_mxml_attr_t *attr; /* Current attribute */
char s[255]; /* Temporary string */

View File

@ -17,7 +17,7 @@
*/
#include "config.h"
#include "mxml.h"
#include "mxml-private.h"
/*

View File

@ -1,7 +1,7 @@
/*
* Index support code for Mini-XML, a small XML file parsing library.
*
* Copyright 2003-2017 by Michael R Sweet.
* Copyright © 2003-2019 by Michael R Sweet.
*
* These coded instructions, statements, and computer programs are the
* property of Michael R Sweet and are protected by Federal copyright
@ -17,7 +17,7 @@
*/
#include "config.h"
#include "mxml.h"
#include "mxml-private.h"
/*

View File

@ -1,7 +1,7 @@
/*
* Node support code for Mini-XML, a small XML file parsing library.
*
* Copyright 2003-2018 by Michael R Sweet.
* Copyright © 2003-2019 by Michael R Sweet.
*
* These coded instructions, statements, and computer programs are the
* property of Michael R Sweet and are protected by Federal copyright
@ -17,7 +17,7 @@
*/
#include "config.h"
#include "mxml.h"
#include "mxml-private.h"
/*

View File

@ -1,7 +1,7 @@
/*
* Private definitions for Mini-XML, a small XML file parsing library.
*
* Copyright 2003-2017 by Michael R Sweet.
* Copyright © 2003-2019 by Michael R Sweet.
*
* These coded instructions, statements, and computer programs are the
* property of Michael R Sweet and are protected by Federal copyright
@ -21,10 +21,68 @@
/*
* Global, per-thread data...
* Private structures...
*/
typedef struct _mxml_global_s
typedef struct _mxml_attr_s /**** An XML element attribute value. ****/
{
char *name; /* Attribute name */
char *value; /* Attribute value */
} _mxml_attr_t;
typedef struct _mxml_element_s /**** An XML element value. ****/
{
char *name; /* Name of element */
int num_attrs; /* Number of attributes */
_mxml_attr_t *attrs; /* Attributes */
} _mxml_element_t;
typedef struct _mxml_text_s /**** An XML text value. ****/
{
int whitespace; /* Leading whitespace? */
char *string; /* Fragment string */
} _mxml_text_t;
typedef struct _mxml_custom_s /**** An XML custom value. ****/
{
void *data; /* Pointer to (allocated) custom data */
mxml_custom_destroy_cb_t destroy; /* Pointer to destructor function */
} _mxml_custom_t;
typedef union _mxml_value_u /**** An XML node value. ****/
{
_mxml_element_t element; /* Element */
int integer; /* Integer number */
char *opaque; /* Opaque string */
double real; /* Real number */
_mxml_text_t text; /* Text fragment */
_mxml_custom_t custom; /* Custom data @since Mini-XML 2.1@ */
} _mxml_value_t;
struct _mxml_node_s /**** An XML node. ****/
{
mxml_type_t type; /* Node type */
struct _mxml_node_s *next; /* Next node under same parent */
struct _mxml_node_s *prev; /* Previous node under same parent */
struct _mxml_node_s *parent; /* Parent node */
struct _mxml_node_s *child; /* First child node */
struct _mxml_node_s *last_child; /* Last child node */
_mxml_value_t value; /* Node value */
int ref_count; /* Use count */
void *user_data; /* User data */
};
struct _mxml_index_s /**** An XML node index. ****/
{
char *attr; /* Attribute used for indexing or NULL */
int num_nodes; /* Number of nodes in index */
int alloc_nodes; /* Allocated nodes in index */
int cur_node; /* Current node */
mxml_node_t **nodes; /* Node array */
};
typedef struct _mxml_global_s /**** Global, per-thread data ****/
{
void (*error_cb)(const char *);
int num_entity_cbs;

View File

@ -1,7 +1,7 @@
/*
* Search/navigation functions for Mini-XML, a small XML file parsing library.
*
* Copyright 2003-2017 by Michael R Sweet.
* Copyright © 2003-2019 by Michael R Sweet.
*
* These coded instructions, statements, and computer programs are the
* property of Michael R Sweet and are protected by Federal copyright
@ -17,7 +17,7 @@
*/
#include "config.h"
#include "mxml.h"
#include "mxml-private.h"
/*

View File

@ -1,7 +1,7 @@
/*
* Node set functions for Mini-XML, a small XML file parsing library.
*
* Copyright 2003-2018 by Michael R Sweet.
* Copyright © 2003-2019 by Michael R Sweet.
*
* These coded instructions, statements, and computer programs are the
* property of Michael R Sweet and are protected by Federal copyright
@ -17,7 +17,7 @@
*/
#include "config.h"
#include "mxml.h"
#include "mxml-private.h"
/*

67
mxml.h
View File

@ -1,7 +1,7 @@
/*
* Header file for Mini-XML, a small XML file parsing library.
*
* Copyright 2003-2017 by Michael R Sweet.
* Copyright © 2003-2019 by Michael R Sweet.
*
* These coded instructions, statements, and computer programs are the
* property of Michael R Sweet and are protected by Federal copyright
@ -34,8 +34,8 @@
* Constants...
*/
# define MXML_MAJOR_VERSION 2 /* Major version number */
# define MXML_MINOR_VERSION 12 /* Minor version number */
# define MXML_MAJOR_VERSION 3 /* Major version number */
# define MXML_MINOR_VERSION 0 /* Minor version number */
# define MXML_TAB 8 /* Tabs every N columns */
@ -97,66 +97,9 @@ typedef void (*mxml_custom_destroy_cb_t)(void *);
typedef void (*mxml_error_cb_t)(const char *);
/**** Error callback function ****/
typedef struct mxml_attr_s /**** An XML element attribute value. @private@ ****/
{
char *name; /* Attribute name */
char *value; /* Attribute value */
} mxml_attr_t;
typedef struct _mxml_node_s mxml_node_t; /**** An XML node. ****/
typedef struct mxml_element_s /**** An XML element value. @private@ ****/
{
char *name; /* Name of element */
int num_attrs; /* Number of attributes */
mxml_attr_t *attrs; /* Attributes */
} mxml_element_t;
typedef struct mxml_text_s /**** An XML text value. @private@ ****/
{
int whitespace; /* Leading whitespace? */
char *string; /* Fragment string */
} mxml_text_t;
typedef struct mxml_custom_s /**** An XML custom value. @private@ ****/
{
void *data; /* Pointer to (allocated) custom data */
mxml_custom_destroy_cb_t destroy; /* Pointer to destructor function */
} mxml_custom_t;
typedef union mxml_value_u /**** An XML node value. @private@ ****/
{
mxml_element_t element; /* Element */
int integer; /* Integer number */
char *opaque; /* Opaque string */
double real; /* Real number */
mxml_text_t text; /* Text fragment */
mxml_custom_t custom; /* Custom data @since Mini-XML 2.1@ */
} mxml_value_t;
struct mxml_node_s /**** An XML node. @private@ ****/
{
mxml_type_t type; /* Node type */
struct mxml_node_s *next; /* Next node under same parent */
struct mxml_node_s *prev; /* Previous node under same parent */
struct mxml_node_s *parent; /* Parent node */
struct mxml_node_s *child; /* First child node */
struct mxml_node_s *last_child; /* Last child node */
mxml_value_t value; /* Node value */
int ref_count; /* Use count */
void *user_data; /* User data */
};
typedef struct mxml_node_s mxml_node_t; /**** An XML node. ****/
struct mxml_index_s /**** An XML node index. @private@ ****/
{
char *attr; /* Attribute used for indexing or NULL */
int num_nodes; /* Number of nodes in index */
int alloc_nodes; /* Allocated nodes in index */
int cur_node; /* Current node */
mxml_node_t **nodes; /* Node array */
};
typedef struct mxml_index_s mxml_index_t;
typedef struct _mxml_index_s mxml_index_t;
/**** An XML node index. ****/
typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, const char *);

View File

@ -6,7 +6,7 @@
* ./testmxml input.xml [string-output.xml] >stdio-output.xml
* ./testmxml "<?xml ..." [string-output.xml] >stdio-output.xml
*
* Copyright 2003-2017 by Michael R Sweet.
* Copyright © 2003-2019 by Michael R Sweet.
*
* These coded instructions, statements, and computer programs are the
* property of Michael R Sweet and are protected by Federal copyright
@ -22,7 +22,7 @@
*/
#include "config.h"
#include "mxml.h"
#include "mxml-private.h"
#ifndef WIN32
# include <unistd.h>
#endif /* !WIN32 */

View File

@ -127,7 +127,6 @@
272C000C1E8C66A2007EBCAC /* libmxml */ = {
isa = PBXGroup;
children = (
272C00251E8C66CF007EBCAC /* config.h */,
272C000D1E8C66C8007EBCAC /* mxml-attr.c */,
272C000E1E8C66C8007EBCAC /* mxml-entity.c */,
272C000F1E8C66C8007EBCAC /* mxml-file.c */,
@ -164,6 +163,7 @@
272CFFFC1E8C6664007EBCAC = {
isa = PBXGroup;
children = (
272C00251E8C66CF007EBCAC /* config.h */,
272C000C1E8C66A2007EBCAC /* libmxml */,
272C00321E8C6ABB007EBCAC /* tools */,
272C00061E8C6664007EBCAC /* Products */,
@ -228,7 +228,7 @@
272CFFFD1E8C6664007EBCAC /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0830;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = "Michael R Sweet";
TargetAttributes = {
272C00041E8C6664007EBCAC = {
@ -327,15 +327,23 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@ -381,15 +389,23 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;