Hello community,

here is the log from the commit of package librevenge for openSUSE:Factory 
checked in at 2016-01-13 22:44:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/librevenge (Old)
 and      /work/SRC/openSUSE:Factory/.librevenge.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "librevenge"

Changes:
--------
--- /work/SRC/openSUSE:Factory/librevenge/librevenge.changes    2016-01-04 
09:20:26.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.librevenge.new/librevenge.changes       
2016-01-13 22:44:37.000000000 +0100
@@ -1,0 +2,15 @@
+Tue Jan 12 09:14:06 UTC 2016 - [email protected]
+
+- Version bump to 0.0.4:
+  * Fix possible crash in raw generators for unbalanced open/close
+    calls.
+  * Fix build in C++11 mode.
+  * Fix gdb pretty printers and make them compatible with Python 3.
+  * Fix RVNGString::Iter::last(), which only worked correctly for
+    strings containing only ASCII characters.
+  * Document the difference between RVNGString::len() and
+    RVNGString::size().
+  * Considerably improve performance of RVNGString iterator (a
+    crude measurement shows at least 45% improvement).
+
+-------------------------------------------------------------------

Old:
----
  librevenge-0.0.3.tar.xz

New:
----
  librevenge-0.0.4.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ librevenge.spec ++++++
--- /var/tmp/diff_new_pack.1MuhYU/_old  2016-01-13 22:44:38.000000000 +0100
+++ /var/tmp/diff_new_pack.1MuhYU/_new  2016-01-13 22:44:38.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package librevenge
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %global apiversion 0.0
 %global pkgextension 0_0-0
 Name:           librevenge
-Version:        0.0.3
+Version:        0.0.4
 Release:        0
 Summary:        A base library for writing document import filters
 License:        LGPL-2.1+ or MPL-2.0+

++++++ librevenge-0.0.3.tar.xz -> librevenge-0.0.4.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librevenge-0.0.3/ChangeLog 
new/librevenge-0.0.4/ChangeLog
--- old/librevenge-0.0.3/ChangeLog      2015-12-24 13:21:19.000000000 +0100
+++ new/librevenge-0.0.4/ChangeLog      2016-01-12 08:38:15.000000000 +0100
@@ -1,3 +1,67 @@
+2016-01-11  David Tardon  <[email protected]>  
[c22162a463a76b8a210a27f3c4528682a186e19f]
+
+       update NEWS
+
+
+2016-01-11  David Tardon  <[email protected]>  
[99f2c3946155f9cf79e8ffc69587fd1e2f99d3ea]
+
+       avoid unnecessary reallocations
+
+       By my crude measurement (time ./iter-test), this improves the iteration
+       time by at least 45%. It would be possible to shave off few more
+       percents if we could avoid the strlen(), but that'd require adding a
+       member var., which we currently cannot do because of ABI compatibility.
+
+2016-01-11  David Tardon  <[email protected]>  
[50226aeb3d993602e4ba6589238b0d570593d165]
+
+       prepare for a release
+
+
+2016-01-05  David Tardon  <[email protected]>  
[7b08af6bb29422b48ccf29e4f55f5ce467b1c363]
+
+       document RVNGString len() and size()
+
+
+2016-01-05  David Tardon  <[email protected]>  
[bc7d6c3041c8d5ac4585a5ebee40173ba0280728]
+
+       one line is enough
+
+
+2016-01-05  David Tardon  <[email protected]>  
[e014745479f488aa32f26a63dd01256d50eb8cd0]
+
+       rewrite sligthly
+
+
+2016-01-05  David Tardon  <[email protected]>  
[4a6588974bc403dd1a0401ee6a3abbbd8a7be703]
+
+       use the buffer data length, not the char. count
+
+
+2016-01-05  David Tardon  <[email protected]>  
[08d174aa01b870d986c78717a45fbb9bf59f45a4]
+
+       make pretty printers python3-compatible
+
+
+2016-01-05  David Tardon  <[email protected]>  
[56dff742330d2a742b4257bba8a89bb5ec633a53]
+
+       test string iterator
+
+
+2015-12-30  David Tardon  <[email protected]>  
[fac633c7e3f06b940e7c8650bb3c6b9c11c9557e]
+
+       fix build in c++11 mode
+
+
+2015-12-30  David Tardon  <[email protected]>  
[0cd9da39bc0828db34f0cf892d4aa600a709da18]
+
+       avoid access to empty stack
+
+
+2015-12-26  David Tardon  <[email protected]>  
[baf98cf3c7923d7a89a7f5facbaa02669b1a0245]
+
+       fix import statement
+
+
 2015-12-24  David Tardon  <[email protected]>  
[b3646641081967574e6fc0bcecfae289274ae26a]
 
        linker path is not needed
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librevenge-0.0.3/NEWS new/librevenge-0.0.4/NEWS
--- old/librevenge-0.0.3/NEWS   2015-12-24 12:29:10.000000000 +0100
+++ new/librevenge-0.0.4/NEWS   2016-01-11 15:42:45.000000000 +0100
@@ -1,3 +1,14 @@
+librevenge 0.0.4
+
+- Fix possible crash in raw generators for unbalanced open/close calls.
+- Fix build in C++11 mode.
+- Fix gdb pretty printers and make them compatible with Python 3.
+- Fix RVNGString::Iter::last(), which only worked correctly for strings
+  containing only ASCII characters.
+- Document the difference between RVNGString::len() and RVNGString::size().
+- Considerably improve performance of RVNGString iterator (a crude
+  measurement shows at least 45% improvement).
+
 librevenge 0.0.3
 
 - SVG generator: fix the center of rotation.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librevenge-0.0.3/configure 
new/librevenge-0.0.4/configure
--- old/librevenge-0.0.3/configure      2015-12-24 13:04:00.000000000 +0100
+++ new/librevenge-0.0.4/configure      2016-01-11 15:21:32.000000000 +0100
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for librevenge 0.0.3.
+# Generated by GNU Autoconf 2.69 for librevenge 0.0.4.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@
 # Identity of this package.
 PACKAGE_NAME='librevenge'
 PACKAGE_TARNAME='librevenge'
-PACKAGE_VERSION='0.0.3'
-PACKAGE_STRING='librevenge 0.0.3'
+PACKAGE_VERSION='0.0.4'
+PACKAGE_STRING='librevenge 0.0.4'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1378,7 +1378,7 @@
   # 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 librevenge 0.0.3 to adapt to many kinds of systems.
+\`configure' configures librevenge 0.0.4 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1448,7 +1448,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of librevenge 0.0.3:";;
+     short | recursive ) echo "Configuration of librevenge 0.0.4:";;
    esac
   cat <<\_ACEOF
 
@@ -1585,7 +1585,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-librevenge configure 0.0.3
+librevenge configure 0.0.4
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2102,7 +2102,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by librevenge $as_me 0.0.3, which was
+It was created by librevenge $as_me 0.0.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2968,7 +2968,7 @@
 
 # Define the identity of the package.
  PACKAGE='librevenge'
- VERSION='0.0.3'
+ VERSION='0.0.4'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -17152,9 +17152,9 @@
 
 RVNG_MINOR_VERSION=0
 
-RVNG_MICRO_VERSION=3
+RVNG_MICRO_VERSION=4
 
-RVNG_VERSION=0.0.3
+RVNG_VERSION=0.0.4
 
 # AC_SUBST(LT_RELEASE, [librevenge_version_major.librevenge_version_minor])
 LT_CURRENT=`expr 100 '*' 0 + 0`
@@ -17162,7 +17162,7 @@
 LT_AGE=0
 # LT_AGE=librevenge_version_minor
 
-LT_REVISION=3
+LT_REVISION=4
 
 
 
@@ -18735,7 +18735,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by librevenge $as_me 0.0.3, which was
+This file was extended by librevenge $as_me 0.0.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -18801,7 +18801,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-librevenge config.status 0.0.3
+librevenge config.status 0.0.4
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librevenge-0.0.3/configure.ac 
new/librevenge-0.0.4/configure.ac
--- old/librevenge-0.0.3/configure.ac   2015-12-24 12:29:10.000000000 +0100
+++ new/librevenge-0.0.4/configure.ac   2016-01-11 14:03:42.000000000 +0100
@@ -7,7 +7,7 @@
 # ====================
 m4_define([librevenge_version_major],[0])
 m4_define([librevenge_version_minor],[0])
-m4_define([librevenge_version_micro],[3])
+m4_define([librevenge_version_micro],[4])
 
m4_define([librevenge_version],[librevenge_version_major.librevenge_version_minor.librevenge_version_micro])
 
 # =============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/librevenge-0.0.3/data/gdb/librevenge/util/printing.py 
new/librevenge-0.0.4/data/gdb/librevenge/util/printing.py
--- old/librevenge-0.0.3/data/gdb/librevenge/util/printing.py   2014-06-26 
16:58:23.000000000 +0200
+++ new/librevenge-0.0.4/data/gdb/librevenge/util/printing.py   2016-01-05 
13:09:42.000000000 +0100
@@ -18,7 +18,9 @@
 import gdb
 import re
 
-from compatibility import use_gdb_printing
+from six import iteritems
+
+from librevenge.util.compatibility import use_gdb_printing
 
 class SimplePrinter(object):
 
@@ -80,7 +82,7 @@
         return len(self.map)
 
     def __getitem__(self, type):
-        for (test, printer) in self.map.iteritems():
+        for (test, printer) in iteritems(self.map):
             if test(type):
                 return printer
         return None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librevenge-0.0.3/inc/librevenge/RVNGString.h 
new/librevenge-0.0.4/inc/librevenge/RVNGString.h
--- old/librevenge-0.0.3/inc/librevenge/RVNGString.h    2015-06-27 
13:54:41.000000000 +0200
+++ new/librevenge-0.0.4/inc/librevenge/RVNGString.h    2016-01-05 
14:08:13.000000000 +0100
@@ -28,6 +28,8 @@
 
 class RVNGStringImpl;
 
+/** UTF-8 string.
+  */
 class REVENGE_API RVNGString
 {
 public:
@@ -55,8 +57,20 @@
        static RVNGString escapeXML(const char *s);
 
        const char *cstr() const;
+
+       /** Return the number of UTF-8 characters.
+         *
+         * @sa size()
+         */
        int len() const;
+       /** Return the size in bytes of the data buffer.
+         *
+         * This is equivalent to <code>strlen(str.cstr())</code>
+         *
+         * @sa len()
+         */
        unsigned long size() const;
+
        bool empty() const;
 
        void sprintf(const char *format, ...) REVENGE_ATTRIBUTE_PRINTF(2, 3);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librevenge-0.0.3/src/lib/RVNGPropertyList.cpp 
new/librevenge-0.0.4/src/lib/RVNGPropertyList.cpp
--- old/librevenge-0.0.3/src/lib/RVNGPropertyList.cpp   2015-06-27 
13:54:41.000000000 +0200
+++ new/librevenge-0.0.4/src/lib/RVNGPropertyList.cpp   2016-01-05 
13:59:57.000000000 +0100
@@ -446,10 +446,7 @@
 
 bool RVNGPropertyListIterImpl::last()
 {
-       if (m_iter == m_map->end())
-               return true;
-
-       return false;
+       return m_iter == m_map->end();
 }
 
 const RVNGProperty *RVNGPropertyListIterImpl::operator()() const
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librevenge-0.0.3/src/lib/RVNGRawGeneratorBase.h 
new/librevenge-0.0.4/src/lib/RVNGRawGeneratorBase.h
--- old/librevenge-0.0.3/src/lib/RVNGRawGeneratorBase.h 2015-06-27 
13:54:41.000000000 +0200
+++ new/librevenge-0.0.4/src/lib/RVNGRawGeneratorBase.h 2016-01-04 
21:08:06.000000000 +0100
@@ -47,10 +47,17 @@
                        m_impl->idprintf M; \
        else \
        { \
-               const int lc = m_impl->m_callStack.top(); \
-               if (lc != L) \
+               if (m_impl->m_callStack.empty()) \
+               { \
                        m_impl->m_callbackMisses++; \
-               m_impl->m_callStack.pop(); \
+               } \
+               else \
+               { \
+                       const int lc = m_impl->m_callStack.top(); \
+                       if (lc != L) \
+                               m_impl->m_callbackMisses++; \
+                       m_impl->m_callStack.pop(); \
+               } \
        }
 
 namespace librevenge
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librevenge-0.0.3/src/lib/RVNGString.cpp 
new/librevenge-0.0.4/src/lib/RVNGString.cpp
--- old/librevenge-0.0.3/src/lib/RVNGString.cpp 2014-11-28 16:25:52.000000000 
+0100
+++ new/librevenge-0.0.4/src/lib/RVNGString.cpp 2016-01-11 15:35:09.000000000 
+0100
@@ -20,10 +20,12 @@
 
 #include "librevenge_internal.h"
 
+#include <cassert>
 #include <cstring>
 #include <string>
 #include <stdarg.h>
 #include <stdio.h>
+#include <utility>
 
 #define FIRST_BUF_SIZE 128
 #ifdef _MSC_VER
@@ -329,20 +331,25 @@
 
 bool RVNGString::Iter::last()
 {
-       if (m_pos >= m_stringImpl->len())
-               return true;
-       return false;
+       assert(m_pos >= -1);
+       if (m_pos == -1)
+               return false;
+       return unsigned(m_pos) >= m_stringImpl->m_buf.length();
 }
 
 const char *RVNGString::Iter::operator()() const
 {
        if (m_pos == (-1)) return 0;
 
-       if (m_curChar) delete [] m_curChar;
-       m_curChar = 0;
        int charLength 
=(int)(librvng_utf8_next_char(&(m_stringImpl->m_buf.c_str()[m_pos])) -
                              &(m_stringImpl->m_buf.c_str()[m_pos]));
-       m_curChar = new char[charLength+1];
+       const int curCharLength = m_curChar ? 
int(unsigned(std::strlen(m_curChar))) : 0;
+       if (curCharLength < charLength)
+       {
+               char *newChar = new char[charLength+1];
+               std::swap(m_curChar, newChar);
+               delete[] newChar;
+       }
        for (int i=0; i<charLength; i++)
                m_curChar[i] = m_stringImpl->m_buf[size_t(m_pos+i)];
        m_curChar[charLength]='\0';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librevenge-0.0.3/src/lib/RVNGTextTextGenerator.cpp 
new/librevenge-0.0.4/src/lib/RVNGTextTextGenerator.cpp
--- old/librevenge-0.0.3/src/lib/RVNGTextTextGenerator.cpp      2015-08-30 
08:03:12.000000000 +0200
+++ new/librevenge-0.0.4/src/lib/RVNGTextTextGenerator.cpp      2016-01-04 
21:08:06.000000000 +0100
@@ -123,7 +123,7 @@
        if (!m_impl->m_endnotes.str().empty())
        {
                *m_impl->m_stream << '\n';
-               *m_impl->m_stream << m_impl->m_endnotes;
+               *m_impl->m_stream << m_impl->m_endnotes.str();
        }
        m_impl->m_document=m_impl->m_stream->str().c_str();
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librevenge-0.0.3/src/test/Makefile.am 
new/librevenge-0.0.4/src/test/Makefile.am
--- old/librevenge-0.0.3/src/test/Makefile.am   2015-12-24 13:18:15.000000000 
+0100
+++ new/librevenge-0.0.4/src/test/Makefile.am   2016-01-04 21:08:08.000000000 
+0100
@@ -18,6 +18,7 @@
        RVNGDirectoryStreamTest.cpp \
        RVNGOLEStreamTest.cpp \
        RVNGStreamTest.cpp \
+       RVNGStringIterTest.cpp \
        RVNGStringTest.cpp \
        test.cpp
        
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librevenge-0.0.3/src/test/Makefile.in 
new/librevenge-0.0.4/src/test/Makefile.in
--- old/librevenge-0.0.3/src/test/Makefile.in   2015-12-24 13:18:18.000000000 
+0100
+++ new/librevenge-0.0.4/src/test/Makefile.in   2016-01-11 15:21:33.000000000 
+0100
@@ -106,6 +106,7 @@
 am_test_OBJECTS = test-RVNGBinaryDataTest.$(OBJEXT) \
        test-RVNGDirectoryStreamTest.$(OBJEXT) \
        test-RVNGOLEStreamTest.$(OBJEXT) test-RVNGStreamTest.$(OBJEXT) \
+       test-RVNGStringIterTest.$(OBJEXT) \
        test-RVNGStringTest.$(OBJEXT) test-test.$(OBJEXT)
 test_OBJECTS = $(am_test_OBJECTS)
 am__DEPENDENCIES_1 =
@@ -547,6 +548,7 @@
        RVNGDirectoryStreamTest.cpp \
        RVNGOLEStreamTest.cpp \
        RVNGStreamTest.cpp \
+       RVNGStringIterTest.cpp \
        RVNGStringTest.cpp \
        test.cpp
 
@@ -623,6 +625,7 @@
 @AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/test-RVNGDirectoryStreamTest.Po@am__quote@
 @AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/test-RVNGOLEStreamTest.Po@am__quote@
 @AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/test-RVNGStreamTest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/test-RVNGStringIterTest.Po@am__quote@
 @AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/test-RVNGStringTest.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-test.Po@am__quote@
 
@@ -703,6 +706,20 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) 
$(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) 
$(CXXFLAGS) -c -o test-RVNGStreamTest.obj `if test -f 'RVNGStreamTest.cpp'; 
then $(CYGPATH_W) 'RVNGStreamTest.cpp'; else $(CYGPATH_W) 
'$(srcdir)/RVNGStreamTest.cpp'; fi`
 
+test-RVNGStringIterTest.o: RVNGStringIterTest.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) 
$(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 
test-RVNGStringIterTest.o -MD -MP -MF $(DEPDIR)/test-RVNGStringIterTest.Tpo -c 
-o test-RVNGStringIterTest.o `test -f 'RVNGStringIterTest.cpp' || echo 
'$(srcdir)/'`RVNGStringIterTest.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) 
$(DEPDIR)/test-RVNGStringIterTest.Tpo $(DEPDIR)/test-RVNGStringIterTest.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     
$(AM_V_CXX)source='RVNGStringIterTest.cpp' object='test-RVNGStringIterTest.o' 
libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) 
$(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) 
$(CXXFLAGS) -c -o test-RVNGStringIterTest.o `test -f 'RVNGStringIterTest.cpp' 
|| echo '$(srcdir)/'`RVNGStringIterTest.cpp
+
+test-RVNGStringIterTest.obj: RVNGStringIterTest.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) 
$(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 
test-RVNGStringIterTest.obj -MD -MP -MF $(DEPDIR)/test-RVNGStringIterTest.Tpo 
-c -o test-RVNGStringIterTest.obj `if test -f 'RVNGStringIterTest.cpp'; then 
$(CYGPATH_W) 'RVNGStringIterTest.cpp'; else $(CYGPATH_W) 
'$(srcdir)/RVNGStringIterTest.cpp'; fi`
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) 
$(DEPDIR)/test-RVNGStringIterTest.Tpo $(DEPDIR)/test-RVNGStringIterTest.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     
$(AM_V_CXX)source='RVNGStringIterTest.cpp' object='test-RVNGStringIterTest.obj' 
libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) 
$(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) 
$(CXXFLAGS) -c -o test-RVNGStringIterTest.obj `if test -f 
'RVNGStringIterTest.cpp'; then $(CYGPATH_W) 'RVNGStringIterTest.cpp'; else 
$(CYGPATH_W) '$(srcdir)/RVNGStringIterTest.cpp'; fi`
+
 test-RVNGStringTest.o: RVNGStringTest.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) 
$(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 
test-RVNGStringTest.o -MD -MP -MF $(DEPDIR)/test-RVNGStringTest.Tpo -c -o 
test-RVNGStringTest.o `test -f 'RVNGStringTest.cpp' || echo 
'$(srcdir)/'`RVNGStringTest.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) $(DEPDIR)/test-RVNGStringTest.Tpo 
$(DEPDIR)/test-RVNGStringTest.Po
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librevenge-0.0.3/src/test/RVNGStringIterTest.cpp 
new/librevenge-0.0.4/src/test/RVNGStringIterTest.cpp
--- old/librevenge-0.0.3/src/test/RVNGStringIterTest.cpp        1970-01-01 
01:00:00.000000000 +0100
+++ new/librevenge-0.0.4/src/test/RVNGStringIterTest.cpp        2016-01-05 
10:29:17.000000000 +0100
@@ -0,0 +1,135 @@
+/* librevenge
+ * Version: MPL 2.0 / LGPLv2.1+
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of the GNU Lesser General Public License Version 2.1 or later
+ * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
+ * applicable instead of those above.
+ */
+
+#ifndef RVNGSTRINGITERTEST_H
+#define RVNGSTRINGITERTEST_H
+
+#include <boost/lexical_cast.hpp>
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <librevenge/librevenge.h>
+
+#include "librevenge_internal.h"
+
+namespace test
+{
+
+using librevenge::RVNGString;
+
+using std::string;
+
+namespace
+{
+
+void implTestIter(const string &msg, const char *chars[], const std::size_t 
count)
+{
+       assert(count > 1);
+
+       RVNGString str;
+       for (std::size_t i = 0; i != count; ++i)
+               str.append(chars[i]);
+
+       RVNGString::Iter iter(str);
+
+       CPPUNIT_ASSERT_MESSAGE(msg + ": " + "not at end after creation", 
!iter.last());
+       CPPUNIT_ASSERT_EQUAL_MESSAGE(msg + ": " + "deref. at first char", 
string(chars[0]), string(iter()));
+       CPPUNIT_ASSERT_EQUAL_MESSAGE(msg + ": " + "second deref. doesn't change 
result", string(chars[0]), string(iter()));
+       CPPUNIT_ASSERT_MESSAGE(msg + ": " + "can advance to second char", 
iter.next());
+
+       for (std::size_t i = 1; i < count - 1; ++i)
+       {
+               const string pos(boost::lexical_cast<string>(i));
+               CPPUNIT_ASSERT_MESSAGE(msg + ": " + "not at end at char pos " + 
pos, !iter.last());
+               CPPUNIT_ASSERT_EQUAL_MESSAGE(msg + ": " + "deref. at char pos " 
+ pos, string(chars[i]), string(iter()));
+               CPPUNIT_ASSERT_MESSAGE(msg + ": " + "can advance at char pos " 
+ pos, iter.next());
+       }
+
+       CPPUNIT_ASSERT_MESSAGE(msg + ": " + "not at end at last char", 
!iter.last());
+       CPPUNIT_ASSERT_EQUAL_MESSAGE(msg + ": " + "deref. at last char", 
string(chars[count - 1]), string(iter()));
+       CPPUNIT_ASSERT_MESSAGE(msg + ": " + "can't advance anymore", 
!iter.next());
+       CPPUNIT_ASSERT_MESSAGE(msg + ": " + "is at end", iter.last());
+}
+
+}
+
+class RVNGStringIterTest : public CPPUNIT_NS::TestFixture
+{
+public:
+       virtual void setUp();
+       virtual void tearDown();
+
+private:
+       CPPUNIT_TEST_SUITE(RVNGStringIterTest);
+       CPPUNIT_TEST(testEmpty);
+       CPPUNIT_TEST(testNonempty);
+       CPPUNIT_TEST(testRewind);
+       CPPUNIT_TEST_SUITE_END();
+
+private:
+       void testEmpty();
+       void testNonempty();
+       void testRewind();
+};
+
+void RVNGStringIterTest::setUp()
+{
+}
+
+void RVNGStringIterTest::tearDown()
+{
+}
+
+void RVNGStringIterTest::testEmpty()
+{
+       const RVNGString str;
+       RVNGString::Iter iter(str);
+
+       CPPUNIT_ASSERT_MESSAGE("can't advance on empty string", !iter.next());
+       CPPUNIT_ASSERT_MESSAGE("deref. returns a string", iter());
+       CPPUNIT_ASSERT_EQUAL_MESSAGE("deref. returns an empty string", 
string(), string(iter()));
+       CPPUNIT_ASSERT_MESSAGE("check end", iter.last());
+}
+
+void RVNGStringIterTest::testNonempty()
+{
+       const char *ascii[] = {"a", "b", "c"};
+       implTestIter("ASCII text", ascii, RVNG_NUM_ELEMENTS(ascii));
+       const char *cyrilic[] = {"\xd0\xb0", "\xd0\xb1", "\xd0\xb2"};
+       implTestIter("Cyrilic text", cyrilic, RVNG_NUM_ELEMENTS(cyrilic));
+       const char *mixed[] = {"a", "\xd0\xb1", "c", "\xd0\xb3"};
+       implTestIter("Mixed text", mixed, RVNG_NUM_ELEMENTS(mixed));
+}
+
+void RVNGStringIterTest::testRewind()
+{
+       const RVNGString str;
+       RVNGString::Iter iter(str);
+
+       CPPUNIT_ASSERT_MESSAGE("at end", iter.last());
+       iter.rewind();
+       CPPUNIT_ASSERT_MESSAGE("not at end", !iter.last());
+       CPPUNIT_ASSERT_EQUAL_MESSAGE("deref. is ignored", 
reinterpret_cast<const char *>(0), iter());
+       CPPUNIT_ASSERT_MESSAGE("nothing to step forward at", !iter.next());
+       CPPUNIT_ASSERT_MESSAGE("at end again", iter.last());
+       CPPUNIT_ASSERT_MESSAGE("deref. returns a string", iter());
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(RVNGStringIterTest);
+
+}
+
+#endif // RVNGSTRINGITERTEST_H
+
+/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */


Reply via email to