OSDN Git Service

Update SCEW to 1.1.2
authorKimmo Varis <kimmov@gmail.com>
Thu, 1 Jul 2010 08:36:46 +0000 (08:36 +0000)
committerKimmo Varis <kimmov@gmail.com>
Thu, 1 Jul 2010 08:36:46 +0000 (08:36 +0000)
19 files changed:
Docs/Users/ChangeLog.txt
Externals/scew/NEWS
Externals/scew/THANKS
Externals/scew/configure.ac
Externals/scew/doc/Doxyfile.in
Externals/scew/etc/autoconf/doxygen.m4
Externals/scew/examples/scew_print/scew_print.c
Externals/scew/examples/scew_stream/scew_stream.c
Externals/scew/examples/scew_write/scew_write.c
Externals/scew/scew/attribute.c
Externals/scew/scew/element.c
Externals/scew/scew/error.c
Externals/scew/scew/parser.c
Externals/scew/scew/str.c
Externals/scew/scew/str.h
Externals/scew/scew/tree.c
Externals/scew/scew/xerror.c
Externals/scew/scew/xparser.c
Externals/versions.txt

index 55e89ba..664fc93 100644 (file)
@@ -5,6 +5,7 @@ http://winmerge.org/tracker/[tracker-id]
 
 WinMerge 2.13.14
   Update to PCRE 8.10 (r7210)
+  Update SCEW to 1.1.2 (r7212)
 
 WinMerge 2.13.13 - 2010-06-19 (r7205)
   Improve editing of linefilter regular expressions (#3015416)
index 55aceb8..c01eb2b 100644 (file)
@@ -1,11 +1,21 @@
 SCEW -- History of visible changes.
 
-Copyright (C) 2002-2009 Aleix Conchillo Flaqué
+Copyright (C) 2002-2010 Aleix Conchillo Flaqué
 
 See the end for copying conditions.
 
 ------------------------------------------------------------------------
 
+* Version 1.1.2 (2010/06/04)
+
+** Fixes:
+
+   - Precondition violation when assigning preamble to tree after
+     trimming and becoming NULL (scew/xparser.c).
+     (reported by Rudolf Alexander Kerbitz)
+
+------------------------------------------------------------------------
+
 * Version 1.1.1 (2009/12/11)
 
 ** Changes:
@@ -135,25 +145,25 @@ See the end for copying conditions.
 
 ** Changes:
 
-        - Ability  to load  and XML  document  from an  stream has  been
-          added. The stream  may not be completed, so  it will just load
+   - Ability to load and XML document from an stream has been
+     added. The stream may not be completed, so it will just load
      correct XML pieces. A callback, set by the user, will be called
      each time an element is available.
-          (thanks to Gord Shier)
+     (thanks to Gord Shier)
 
 ** Fixes:
 
-        - Fixed  indentation  level   when  document  contains  multiple
-          consecutive empty elements.
-          (thanks to Tom Probasco)
+   - Fixed indentation level when document contains multiple
+     consecutive empty elements.
+     (thanks to Tom Probasco)
 
-        - scew_element_add_attr_pair()  did  not  add  a  new  attribute
-          correctly if the attribute already existed.
-          (reported by Matthew Peltzer)
+   - scew_element_add_attr_pair() did not add a new attribute
+     correctly if the attribute already existed.
+     (reported by Matthew Peltzer)
 
-        - Compiltaion  fixes in MSVC.   Compiler interpreted  a function
-          argument called list as the std::list.
-          (reported by Renaud Dumont)
+   - Compiltaion fixes in MSVC.  Compiler interpreted a function
+     argument called list as the std::list.
+     (reported by Renaud Dumont)
 
 ------------------------------------------------------------------------
 
@@ -161,23 +171,23 @@ See the end for copying conditions.
 
 ** Changes:
 
-        - A new "Unknown error code" message has been added.
-          (thanks to Brodie Thiesfield)
+   - A new "Unknown error code" message has been added.
+     (thanks to Brodie Thiesfield)
 
-        - Improved support for Windows and Unix compilation.
-          (thanks to Brodie Thiesfield)
+   - Improved support for Windows and Unix compilation.
+     (thanks to Brodie Thiesfield)
 
-        - Added improvements in str functions. mem.* has been removed.
-          (thanks to Brodie Thiesfield)
+   - Added improvements in str functions. mem.* has been removed.
+     (thanks to Brodie Thiesfield)
 
    - Write functions have been moved from tree to new writer.* files.
 
-        - Added a preamble section to the XML declaration.
+   - Added a preamble section to the XML declaration.
 
 ** Fixes:
 
-        - Allow building in a separate directory.
-          (thanks to Kalle Valo)
+   - Allow building in a separate directory.
+     (thanks to Kalle Valo)
 
 ------------------------------------------------------------------------
 
@@ -187,40 +197,40 @@ See the end for copying conditions.
 
    - Added missing performace improvements by using the linked list in
      element and attribute iterations.
-          (thanks to Brodie Thiesfield)
+     (thanks to Brodie Thiesfield)
 
-        - Added exponentially growing buffer to avoid many realloc calls
-          which are slow and fragment memory in scew_element_list.
-          (thanks to Brodie Thiesfield)
+   - Added exponentially growing buffer to avoid many realloc calls
+     which are slow and fragment memory in scew_element_list.
+     (thanks to Brodie Thiesfield)
 
-        - Performance  improvements in  file loading  by using  a static
-          buffer.
-          (thanks to Brodie Thiesfield)
+   - Performance improvements in file loading by using a static
+     buffer.
+     (thanks to Brodie Thiesfield)
 
-        - Added scew_parser_load_file_fp().
-          (thanks to Brodie Thiesfield)
+   - Added scew_parser_load_file_fp().
+     (thanks to Brodie Thiesfield)
 
-        - Some other minor changes.
-          (thanks to Brodie Thiesfield)
+   - Some other minor changes.
+     (thanks to Brodie Thiesfield)
 
 ** Fixes:
 
-        - scew_isxdigit() was calling isdigit() instead of isxdigit().
+   - scew_isxdigit() was calling isdigit() instead of isxdigit().
 
-        - scew_isxxxx() fixed.
-          (thanks to Brodie Thiesfield)
+   - scew_isxxxx() fixed.
+     (thanks to Brodie Thiesfield)
 
-        - strdup() is a GNU extension, replaced it by own version.
+   - strdup() is a GNU extension, replaced it by own version.
 
-        - Fixed scew_element_by_name.
-          (reported by Eric Fronheiser)
+   - Fixed scew_element_by_name.
+     (reported by Eric Fronheiser)
 
-        - Warning fixes (level 4) in Microsoft Visual C++ 7.
-          (thanks to Brodie Thiesfield)
+   - Warning fixes (level 4) in Microsoft Visual C++ 7.
+     (thanks to Brodie Thiesfield)
 
-        - Multi-thread    support     fixed    in    Microsoft    Visual
+   - Multi-thread support fixed in Microsoft Visual
      C++. __declspec(thread) did not work, use TLS functions instead.
-          (thanks to Brodie Thiesfield)
+     (thanks to Brodie Thiesfield)
 
 ------------------------------------------------------------------------
 
@@ -231,34 +241,34 @@ See the end for copying conditions.
    - Added more string functions. New memory functions have also been
      added.
 
-        - Performance improved in element and attribute iteration.
-          (thanks to Sanzo Miyazawa)
+   - Performance improved in element and attribute iteration.
+     (thanks to Sanzo Miyazawa)
 
    - Support for XML declaration attributes has been added (version,
      encoding, standalone).  This attributes can be changed using SCEW
      tree functions.
 
-        - Improved white spaces treatment in XML element contents.
+   - Improved white spaces treatment in XML element contents.
 
-        - Added error system. See documentation for more details.
+   - Added error system. See documentation for more details.
 
-        - Added pkg-config file.
-          (thanks to Neil Harvey)
+   - Added pkg-config file.
+     (thanks to Neil Harvey)
 
-        - Added 'make doc'. If you have doxygen installed (which will be
+   - Added 'make doc'. If you have doxygen installed (which will be
      automatically detected), it will create SCEW
      documentation. Execute './configure --help' to see more
      documentation options.
 
-        - 'make install' does not install example binaries anymore.
+   - 'make install' does not install example binaries anymore.
 
 ** Fixes:
 
-        - scew_tree_save_file() did not fclose output file.
-          (reported by Paul Bohme)
+   - scew_tree_save_file() did not fclose output file.
+     (reported by Paul Bohme)
 
    - scew_element_free() did not decrement parent number of children.
-          (reported by anonymous)
+     (reported by anonymous)
 
 ------------------------------------------------------------------------
 
@@ -266,16 +276,16 @@ See the end for copying conditions.
 
 ** Changes:
 
-        - Added --enable-debug flag to the configure script.
+   - Added --enable-debug flag to the configure script.
 
 ** Fixes:
 
-        - Added compatibilized headers with C++ (ifdef __cplusplus).
+   - Added compatibilized headers with C++ (ifdef __cplusplus).
 
-        - Compilation warnings fixed.
+   - Compilation warnings fixed.
 
-        - scew_element_del_attr() segmentation fault fixed.
-          (reported by Jussi Mäki)
+   - scew_element_del_attr() segmentation fault fixed.
+     (reported by Jussi Mäki)
 
 ------------------------------------------------------------------------
 
@@ -283,7 +293,7 @@ See the end for copying conditions.
 
 ** Changes:
 
-        - Functions to create and save XML files have been added.
+   - Functions to create and save XML files have been added.
 
    - A lot of cleanup and rewriting has been done. Internal structures
      have changed.
@@ -300,7 +310,7 @@ See the end for copying conditions.
 
    - scew_get_element_by_name() and scew_get_attribute_by_name() did
      not return NULL if an element/attribute was not found.
-          (reported by Stuart R. Anderson)
+     (reported by Stuart R. Anderson)
 
 ------------------------------------------------------------------------
 
@@ -312,7 +322,7 @@ See the end for copying conditions.
 
 * Copying information:
 
-Copyright (C) 2002-2009 Aleix Conchillo Flaqué
+Copyright (C) 2002-2010 Aleix Conchillo Flaqué
 
    Permission is granted to anyone to make or distribute verbatim
    copies of this document as received, in any medium, provided that
index db94ed4..c70138f 100644 (file)
@@ -6,7 +6,7 @@ people have contributed to SCEW by reporting problems, suggesting
 improvements, or submitting actual code. Here is a list of these
 people. Help me keep it complete and exempt of errors.
 
-* Jose A.  Ortega suggested some important C  implementation details. As
+* Jose A. Ortega suggested some important C implementation details. As
   usual, he has helped me in many other ways. Thanks jao!
 
 * Brodie Thiesfield has submitted lots of fixes and improvements. He
@@ -28,6 +28,7 @@ people. Help me keep it complete and exempt of errors.
 * Bug reporting and others (in alphabetical order):
 
   Anonymous reporters, Stuart R. Anderson, Paul Bohme, Eric
-  Fronheiser, Alex Katebi, Aaron S. Kurland, Christopher Layne, Jussi
-  Mäki, Sanzo Miyazawa, George Neill, Gord Shier, Brodie Thiesfield,
-  Andrew Thomas, Kalle Vallo, Michal Wozniak and Mark Zieg.
+  Fronheiser, Alex Katebi, Rudolf Alexander Kerbitz, Aaron S. Kurland,
+  Christopher Layne, Jussi Mäki, Sanzo Miyazawa, George Neill, Gord
+  Shier, Brodie Thiesfield, Andrew Thomas, Kalle Vallo, Michal Wozniak
+  and Mark Zieg.
index 45d9843..43143ad 100644 (file)
@@ -2,12 +2,12 @@
 # Author: Aleix Conchillo Flaque <aleix@member.fsf.org>
 # Date:   Mon Oct 07, 2002 01:56
 #
-# Copyright (C) 2002-2009 Aleix Conchillo Flaque
+# Copyright (C) 2002-2010 Aleix Conchillo Flaque
 #
 
 #### boilerplate and flags
 
-define([scew_version], [1.1.1])
+define([scew_version], [1.1.2])
 
 AC_INIT(scew/scew.h, scew_version)
 AM_INIT_AUTOMAKE(scew, scew_version)
index 68265e6..fbbcb60 100644 (file)
@@ -749,13 +749,13 @@ LATEX_HEADER           =
 # contain links (just like the HTML output) instead of page references
 # This makes the output suitable for online browsing using a pdf viewer.
 
-PDF_HYPERLINKS         = NO
+PDF_HYPERLINKS         = YES
 
 # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
 # plain latex in the generated Makefile. Set this option to YES to get a
 # higher quality PDF documentation.
 
-USE_PDFLATEX           = NO
+USE_PDFLATEX           = YES
 
 # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
 # command to the generated LaTeX files. This will instruct LaTeX to keep
index 1e0a4d8..140352d 100644 (file)
@@ -2,7 +2,7 @@
 # Author: Aleix Conchillo Flaque <aleix@member.fsf.org>
 # Start date: Sun Jul 06, 2003 04:41
 #
-# Copyright (C) 2003-2008 Aleix Conchillo Flaque
+# Copyright (C) 2003-2010 Aleix Conchillo Flaque
 #
 
 # Locate doxygen and auxiliary programs.
@@ -30,22 +30,29 @@ AC_ARG_ENABLE(latex-docs,
 [  --enable-latex-docs     enable LaTeX documentation generation with doxygen (no)], [], [enable_latex_docs=no])
 
 if test "x$enable_doxygen" = xno; then
-        enable_doc=no
+   enable_doc=no
 else
-        AC_PATH_PROG(DOXYGEN, doxygen, , $PATH)
-        if test x$DOXYGEN = x; then
+   AC_PATH_PROG(DOXYGEN, doxygen, , $PATH)
+   if test x$DOXYGEN = x; then
       AC_MSG_WARN(Could not find 'doxygen' (documentation disabled).)
-                enable_doc=no
-        else
-                enable_doc=yes
+      enable_doc=no
+   else
+      enable_doc=yes
+      if test "x$enable_latex_docs" = xyes; then
+         AC_PATH_PROG(LATEX, latex, , $PATH)
+         if test x$LATEX = x; then
+            AC_MSG_WARN(Could not find 'latex'.)
+            enable_latex_docs=no
+         fi
+      fi
       if test "x$enable_dot" = xyes; then
-                AC_PATH_PROG(DOT, dot, , $PATH)
+         AC_PATH_PROG(DOT, dot, , $PATH)
          if test x$DOT = x; then
             AC_MSG_WARN(Could not find 'dot'.)
             enable_dot=no
          fi
-        fi
-        fi
+      fi
+   fi
 fi
 
 AC_SUBST(enable_dot)
index c9103bc..7b09d1d 100644 (file)
@@ -44,7 +44,7 @@ print_indent (unsigned int indent)
   /* Indentation size (in whitespaces). */
   static unsigned int const INDENT_SIZE = 4;
 
-    if (indent > 0)
+  if (indent > 0)
     {
       scew_printf (_XT("%*s"), indent * INDENT_SIZE, " ");
     }
@@ -53,12 +53,12 @@ print_indent (unsigned int indent)
 static void
 print_attributes (scew_element *element)
 {
-    if (element != NULL)
+  if (element != NULL)
     {
-        /**
-         * Iterates through the element's attribute list, printing the
-         * pair name-value.
-         */
+      /**
+       * Iterates through the element's attribute list, printing the
+       * pair name-value.
+       */
       scew_list *list = scew_element_attributes (element);
       while (list != NULL)
         {
@@ -77,9 +77,9 @@ print_element (scew_element *element, unsigned int indent)
   XML_Char const *contents = NULL;
   scew_list *list = NULL;
 
-    if (element == NULL)
+  if (element == NULL)
     {
-        return;
+      return;
     }
 
   /* Prints the starting element tag with its attributes. */
@@ -90,15 +90,15 @@ print_element (scew_element *element, unsigned int indent)
 
   contents = scew_element_contents (element);
 
-    if (contents == NULL)
+  if (contents == NULL)
     {
       scew_printf (_XT("\n"));
     }
 
-    /**
+  /**
    * Call print_element function again for each child of the current
    * element.
-     */
+   */
   list = scew_element_children (element);
   while (list != NULL)
     {
@@ -107,12 +107,12 @@ print_element (scew_element *element, unsigned int indent)
       list = scew_list_next (list);
     }
 
-    /* Prints element's content. */
-    if (contents != NULL)
+  /* Prints element's content. */
+  if (contents != NULL)
     {
       scew_printf (_XT("%s"), contents);
     }
-    else
+  else
     {
       print_indent (indent);
     }
@@ -135,10 +135,10 @@ main (int argc, char *argv[])
   _setmode(_fileno(stdout), _O_U16TEXT);
 #endif /* _MSC_VER && XML_UNICODE_WCHAR_T */
 
-    if (argc < 2)
+  if (argc < 2)
     {
       scew_printf (_XT("Usage: scew_print file.xml\n"));
-        return EXIT_FAILURE;
+      return EXIT_FAILURE;
     }
 
   /* Creates an SCEW parser. This is the first function to call. */
@@ -161,7 +161,7 @@ main (int argc, char *argv[])
       scew_error code = scew_error_code ();
       scew_printf (_XT("Unable to parse file (error #%d: %s)\n"),
                    code, scew_error_string (code));
-        if (code == scew_error_expat)
+      if (code == scew_error_expat)
         {
           enum XML_Error expat_code = scew_error_expat_code (parser);
           scew_printf (_XT("Expat error #%d (line %d, column %d): %s\n"),
@@ -169,7 +169,7 @@ main (int argc, char *argv[])
                        scew_error_expat_line (parser),
                        scew_error_expat_column (parser),
                        scew_error_expat_string (expat_code));
-    }
+        }
 
       /* Frees the SCEW parser and reader. */
       scew_reader_free (reader);
@@ -201,5 +201,5 @@ main (int argc, char *argv[])
   scew_reader_free (reader);
   scew_parser_free (parser);
 
-    return 0;
+  return 0;
 }
index c81daf1..7d6b9d7 100644 (file)
@@ -94,10 +94,10 @@ main (int argc, char *argv[])
   _setmode(_fileno(stdout), _O_U16TEXT);
 #endif /* _MSC_VER && XML_UNICODE_WCHAR_T */
 
-    if (argc < 2)
+  if (argc < 2)
     {
       scew_printf (_XT("Usage: scew_stream file.xml\n"));
-        return EXIT_FAILURE;
+      return EXIT_FAILURE;
     }
 
   /* Create a writer for the standard output. */
@@ -124,19 +124,19 @@ main (int argc, char *argv[])
   scew_parser_set_tree_hook (parser, tree_hook_, NULL);
   scew_parser_set_element_hook (parser, element_hook_, NULL);
   if (!scew_parser_load_stream (parser, reader))
-            {
+    {
       scew_error code = scew_error_code ();
       scew_printf (_XT("Unable to load file (error #%d: %s)\n"),
                    code, scew_error_string (code));
-                if (code == scew_error_expat)
-                {
+      if (code == scew_error_expat)
+        {
           enum XML_Error expat_code = scew_error_expat_code (parser);
           scew_printf (_XT("Expat error #%d (line %d, column %d): %s\n"),
-                           expat_code,
+                       expat_code,
                        scew_error_expat_line (parser),
                        scew_error_expat_column (parser),
                        scew_error_expat_string (expat_code));
-                }
+        }
 
       /* Frees the SCEW parser, printer, reader and writer. */
       scew_reader_free (reader);
@@ -144,8 +144,8 @@ main (int argc, char *argv[])
       scew_writer_free (stdout_writer_);
       scew_printer_free (stdout_printer_);
 
-                return EXIT_FAILURE;
-            }
+      return EXIT_FAILURE;
+    }
 
   /* Frees the SCEW parser, printer, reader and writer. */
   scew_reader_free (reader);
@@ -153,5 +153,5 @@ main (int argc, char *argv[])
   scew_writer_free (stdout_writer_);
   scew_printer_free (stdout_printer_);
 
-    return 0;
+  return 0;
 }
index d3c16cb..0fa74a9 100644 (file)
@@ -76,37 +76,37 @@ main(int argc, char *argv[])
   _setmode(_fileno(stdout), _O_U16TEXT);
 #endif /* _MSC_VER && XML_UNICODE_WCHAR_T */
 
-    if (argc < 2)
+  if (argc < 2)
     {
       scew_printf (_XT("Usage: scew_write new_file.xml\n"));
-        return EXIT_FAILURE;
+      return EXIT_FAILURE;
     }
 
-    /**
-     * Create an empty XML tree in memory, and add a root element
-     * "scew_test".
-     */
+  /**
+   * Create an empty XML tree in memory, and add a root element
+   * "scew_test".
+   */
   tree = scew_tree_create ();
 #ifdef XML_UNICODE_WCHAR_T
   scew_tree_set_xml_encoding(tree, _XT("UTF-16"));
 #endif /* XML_UNICODE_WCHAR_T */
   root = scew_tree_set_root (tree, _XT("test"));
 
-    /* Add an element and set element contents. */
+  /* Add an element and set element contents. */
   element = scew_element_add (root, _XT("element"));
   scew_element_set_contents (element, _XT("element contents"));
 
-    /* Add an element with an attribute pair (name, value). */
+  /* Add an element with an attribute pair (name, value). */
   element = scew_element_add (root, _XT("element"));
   scew_element_add_attribute_pair (element, _XT("attribute"), _XT("value"));
 
   element = scew_element_add (root, _XT("element"));
   scew_element_add_attribute_pair (element, _XT("attribute1"), _XT("value1"));
 
-    /**
-     * Another way to add an attribute. You loose attribute ownership,
-     * so there is no need to free it.
-     */
+  /**
+   * Another way to add an attribute. You loose attribute ownership,
+   * so there is no need to free it.
+   */
   attribute = scew_attribute_create (_XT("attribute2"), _XT("value2"));
   scew_element_add_attribute (element, attribute);
 
@@ -128,7 +128,7 @@ main(int argc, char *argv[])
                                    _XT("attribute2"), _XT("value2"));
   scew_element_add_attribute_pair (sub_sub_element,
                                    _XT("attribute3"), _XT("value3"));
-    /* Check attribute2 replacement. */
+  /* Check attribute2 replacement. */
   scew_element_add_attribute_pair (sub_sub_element,
                                    _XT("attribute2"), _XT("new_value2"));
   scew_element_set_contents (sub_sub_element,
@@ -146,7 +146,7 @@ main(int argc, char *argv[])
   if (printer == NULL)
     {
       printf ("Unable to create printer\n");
-        return EXIT_FAILURE;
+      return EXIT_FAILURE;
     }
 
   /* We should check for errors here. */
@@ -175,5 +175,5 @@ main(int argc, char *argv[])
   scew_printer_free (printer);
   scew_tree_free (tree);
 
-    return 0;
+  return 0;
 }
index e46389f..de1d22e 100644 (file)
@@ -81,10 +81,10 @@ scew_attribute_copy (scew_attribute const *attribute)
         && (scew_attribute_set_value (new_attr, attribute->value) != NULL);
 
       if (!copied)
-       {
+        {
           scew_attribute_free (new_attr);
           new_attr = NULL;
-    }
+        }
     }
 
   return new_attr;
@@ -122,7 +122,7 @@ scew_attribute_name (scew_attribute const *attribute)
 {
   assert (attribute != NULL);
 
-    return attribute->name;
+  return attribute->name;
 }
 
 XML_Char const*
@@ -130,7 +130,7 @@ scew_attribute_value (scew_attribute const *attribute)
 {
   assert (attribute != NULL);
 
-    return attribute->value;
+  return attribute->value;
 }
 
 XML_Char const*
index 65a87a3..b8b11bf 100644 (file)
@@ -50,16 +50,16 @@ scew_element_create (XML_Char const *name)
 
   element = calloc (1, sizeof (scew_element));
 
-    if (element != NULL)
+  if (element != NULL)
     {
       scew_element_set_name (element, name);
     }
-    else
+  else
     {
       scew_error_set_last_error_ (scew_error_no_memory);
     }
 
-    return element;
+  return element;
 }
 
 void
@@ -106,11 +106,11 @@ scew_element_set_name (scew_element *element, XML_Char const *name)
 
   new_name = scew_strdup (name);
   if (new_name != NULL)
-       {
+    {
       free (element->name);
       element->name = new_name;
     }
-    else
+  else
     {
       scew_error_set_last_error_ (scew_error_no_memory);
     }
@@ -149,7 +149,7 @@ scew_element_free_contents (scew_element *element)
     {
       free (element->contents);
       element->contents = NULL;
-            }
+    }
 }
 
 \f
@@ -274,7 +274,7 @@ scew_element_add_element (scew_element *element, scew_element *child)
       element->last_child = item;
       element->n_children += 1;
     }
-    else
+  else
     {
       scew_error_set_last_error_ (scew_error_no_memory);
       child = NULL;
index 263aa17..27dd4c0 100644 (file)
@@ -47,9 +47,9 @@ scew_error_string (scew_error code)
 {
   static XML_Char const *message[] =
     {
-        _XT("No error"),
-        _XT("Out of memory"),
-        _XT("Input/Output error"),
+      _XT("No error"),
+      _XT("Out of memory"),
+      _XT("Input/Output error"),
       _XT("Error while calling hook"),
       _XT("Internal Expat parser error"),
       _XT("Internal SCEW error")
@@ -61,7 +61,7 @@ scew_error_string (scew_error code)
     {
       return message[code];
     }
-    else
+  else
     {
       static XML_Char const *unk_message = _XT("Unknown error code");
 
index 95606c9..84c96c4 100644 (file)
@@ -79,13 +79,13 @@ scew_parser_namespace_create (XML_Char separator)
 void
 scew_parser_free (scew_parser *parser)
 {
-    if (parser != NULL)
+  if (parser != NULL)
     {
       /* Free all intermediate parser data (if used before). */
       scew_parser_reset (parser);
 
       /* Free Expat parser. */
-        if (parser->parser)
+      if (parser->parser)
         {
           XML_ParserFree (parser->parser);
         }
@@ -235,11 +235,11 @@ parser_create_ (scew_bool namespace, XML_Char separator)
       scew_parser_reset (parser);
     }
   else
-        {
+    {
       scew_error_set_last_error_ (scew_error_no_memory);
       scew_parser_free (parser);
       parser = NULL;
-        }
+    }
 
   return parser;
 }
@@ -301,7 +301,7 @@ parse_stream_reader_ (scew_parser *parser, scew_reader *reader)
   scew_bool done = SCEW_FALSE;
   scew_bool result = SCEW_TRUE;
 
-    assert(parser != NULL);
+  assert(parser != NULL);
   assert(reader != NULL);
 
   while (!done && result)
@@ -316,7 +316,7 @@ parse_stream_reader_ (scew_parser *parser, scew_reader *reader)
           result = SCEW_FALSE;
         }
       else
-    {
+        {
           result = parse_stream_buffer_ (parser, buffer, length);
           done = ((0 == length) || scew_reader_end (reader));
         }
@@ -332,15 +332,15 @@ parse_stream_buffer_ (scew_parser *parser, XML_Char const *buffer, size_t size)
   unsigned int end = 0;
   unsigned int length = 0;
 
-    assert(parser != NULL);
-    assert(buffer != NULL);
+  assert(parser != NULL);
+  assert(buffer != NULL);
 
-    /**
+  /**
    * Loop through the buffer and:
-     * if we encounter a '>', send the chunk to Expat.
-     * if we hit the end of the buffer, send whatever remains to Expat.
-     */
-    while ((start < size) && (end <= size))
+   *    if we encounter a '>', send the chunk to Expat.
+   *    if we hit the end of the buffer, send whatever remains to Expat.
+   */
+  while ((start < size) && (end <= size))
     {
       /* Skip initial whitespaces. */
       while ((start < size) && scew_isspace (buffer[start]))
@@ -351,8 +351,8 @@ parse_stream_buffer_ (scew_parser *parser, XML_Char const *buffer, size_t size)
 
       if ((end == size) || (buffer[end] == _XT('>')))
         {
-            length = end - start;
-            if (end < size)
+          length = end - start;
+          if (end < size)
             {
               length += 1;
             }
@@ -376,12 +376,12 @@ parse_stream_buffer_ (scew_parser *parser, XML_Char const *buffer, size_t size)
                * We don't need to free last loaded XML, as it's the
                * users responsibility.
                */
-                parser->tree = NULL;
+              parser->tree = NULL;
 
               /* Reset parser to continue using it. */
               scew_parser_reset (parser);
             }
-            start = end + 1;
+          start = end + 1;
         }
       end += 1;
     }
index d38775d..f35360c 100644 (file)
@@ -129,9 +129,9 @@ scew_strtrim (XML_Char *src)
 
   /* Strip leading whitespace. */
   start = scew_strspn (src, _XT(" \n\r\t\v"));
-    total = end - start;
+  total = end - start;
   scew_memmove (src, &src[start], total);
-    src[total] = _XT('\0');
+  src[total] = _XT('\0');
 }
 
 scew_bool
index e1b0823..bc351b6 100644 (file)
 #include <wchar.h>
 #include <wctype.h>
 
-#define _XT(str)                L##str
+#define _XT(str) L##str
 
 #define scew_printf wprintf
-#define scew_fprintf            fwprintf
+#define scew_fprintf fwprintf
 #define scew_vfprintf vfwprintf
 #define scew_fputs fputws
 #define scew_fgets fgetws
 /**
  * Creates a regular string or a wide character string.
  */
-#define _XT(str)                str
+#define _XT(str) str
 
 /**
  * See standard @a printf documentation.
 /**
  * See standard @a fprintf documentation.
  */
-#define scew_fprintf            fprintf
+#define scew_fprintf fprintf
 
 /**
  * See standard @a vfprintf documentation.
index 362021d..5cc9799 100644 (file)
@@ -71,7 +71,7 @@ scew_tree_create (void)
       scew_error_set_last_error_ (scew_error_no_memory);
     }
 
-    return tree;
+  return tree;
 }
 
 scew_tree*
@@ -112,7 +112,7 @@ scew_tree_copy (scew_tree const *tree)
 void
 scew_tree_free (scew_tree *tree)
 {
-    if (tree != NULL)
+  if (tree != NULL)
     {
       free (tree->version);
       free (tree->encoding);
@@ -146,7 +146,7 @@ scew_tree_compare (scew_tree const *a,
 XML_Char const*
 scew_tree_xml_version (scew_tree const *tree)
 {
-    assert(tree != NULL);
+  assert(tree != NULL);
 
   return tree->version;
 }
@@ -165,7 +165,7 @@ scew_tree_set_xml_version (scew_tree *tree, XML_Char const *version)
 XML_Char const*
 scew_tree_xml_encoding (scew_tree const *tree)
 {
-    assert(tree != NULL);
+  assert(tree != NULL);
 
   return tree->encoding;
 }
@@ -192,9 +192,9 @@ scew_tree_xml_standalone (scew_tree const *tree)
 void
 scew_tree_set_xml_standalone (scew_tree *tree, scew_tree_standalone standalone)
 {
-    assert(tree != NULL);
+  assert(tree != NULL);
 
-    tree->standalone = standalone;
+  tree->standalone = standalone;
 }
 
 \f
index ae19966..f15cac0 100644 (file)
@@ -48,13 +48,13 @@ static scew_error last_error = scew_error_none;
 void
 scew_error_set_last_error_ (scew_error code)
 {
-    last_error = code;
+  last_error = code;
 }
 
 scew_error
 scew_error_last_error_ (void)
 {
-    return last_error;
+  return last_error;
 }
 
 #else /* SINGLE_THREADED */
@@ -148,7 +148,7 @@ scew_error_last_error_ (void)
   error = (scew_error*) pthread_getspecific (key_error_);
   if (NULL == error)
     {
-        return scew_error_none;
+      return scew_error_none;
     }
 
   return *error;
index b40b56d..be95585 100644 (file)
@@ -113,10 +113,10 @@ scew_parser_stack_free_ (scew_parser *parser)
     {
       scew_element *element = parser_stack_pop_ (parser);
       while (element != NULL)
-    {
+        {
           scew_element_free (element);
           element = parser_stack_pop_ (parser);
-    }
+        }
     }
 }
 
@@ -325,7 +325,10 @@ expat_end_handler_ (void *data, XML_Char const *elem)
               free (parser->preamble);
               parser->preamble = NULL;
             }
-          scew_tree_set_xml_preamble (parser->tree, parser->preamble);
+          else
+            {
+              scew_tree_set_xml_preamble (parser->tree, parser->preamble);
+            }
         }
 
       scew_tree_set_root_element (parser->tree, current);
@@ -454,7 +457,7 @@ parser_stack_push_ (scew_parser *parser, scew_element *element)
 
   stack = calloc (1, sizeof (stack_element));
 
-    if (stack != NULL)
+  if (stack != NULL)
     {
       stack->element = element;
       if (parser->stack != NULL)
@@ -483,5 +486,5 @@ parser_stack_pop_ (scew_parser *parser)
       free (stack);
     }
 
-    return element;
+  return element;
 }
index e98091d..7ef1966 100644 (file)
@@ -5,4 +5,4 @@ This file lists versions of the external components we are using.
 
 Expat: 2.0.1
 PCRE: 8.10
-SCEW: 1.1.1
+SCEW: 1.1.2