[libzmf] 01/03: New upstream version 0.0.2

Rene Engelhard rene at moszumanska.debian.org
Sun Sep 17 10:38:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

rene pushed a commit to branch master
in repository libzmf.

commit 631087fd91f19675a5916823ca865e762c31b1ad
Author: Rene Engelhard <rene at rene-engelhard.de>
Date:   Sun Sep 17 12:33:29 2017 +0200

    New upstream version 0.0.2
---
 ChangeLog                          | 251 ++++++++++++++++++++
 Makefile.in                        |  10 +-
 NEWS                               |   7 +
 aclocal.m4                         |  81 ++++++-
 ar-lib                             |   2 +-
 build/Makefile.in                  |   2 +-
 build/win32/Makefile.in            |   2 +-
 build/win32/libzmf.dsp             |   8 -
 build/win32/libzmf.vcproj          |  24 --
 build/win32/libzmf.vcxproj         |   5 -
 config.guess                       |  43 ++--
 config.h.in                        |   6 +
 config.sub                         |  77 +++---
 configure                          | 391 ++++++++++++++++++-------------
 configure.ac                       |  52 +++--
 docs/Makefile.in                   |   2 +-
 docs/doxygen/Makefile.in           |   2 +-
 docs/doxygen/doxygen.cfg           |   2 +-
 inc/Makefile.in                    |   2 +-
 inc/libzmf/Makefile.in             |   2 +-
 install-sh                         |  14 +-
 m4/ax_cxx_compile_stdcxx.m4        | 466 +++++++++++++++++++++++++++++++++++--
 m4/ax_cxx_compile_stdcxx_11.m4     |   8 +-
 m4/dlp_fallthrough.m4              |  65 ++++++
 src/Makefile.am                    |   4 +
 src/Makefile.in                    |   9 +-
 src/conv/Makefile.in               |   2 +-
 src/conv/raw/Makefile.in           |   2 +-
 src/conv/svg/Makefile.in           |   2 +-
 src/fuzz/Makefile.am               |  24 ++
 src/{conv/svg => fuzz}/Makefile.in | 162 ++++++-------
 src/fuzz/bmifuzzer.cpp             |  27 +++
 src/fuzz/zmffuzzer.cpp             |  27 +++
 src/lib/BMIHeader.cpp              |  45 +++-
 src/lib/BMIHeader.h                |   3 +
 src/lib/BMIParser.cpp              | 123 +++++++---
 src/lib/BMIParser.h                |  10 +-
 src/lib/Makefile.am                |   4 +-
 src/lib/Makefile.in                |   9 +-
 src/lib/ZMF2Parser.h               |   4 +-
 src/lib/ZMF4Parser.cpp             |  88 ++++---
 src/lib/ZMF4Parser.h               |   4 +-
 src/lib/ZMFCollector.cpp           |  32 +--
 src/lib/ZMFCollector.h             |  10 +-
 src/lib/ZMFInternalStream.cpp      | 162 -------------
 src/lib/ZMFInternalStream.h        |  56 -----
 src/lib/ZMFTypes.cpp               |   6 +-
 src/lib/libzmf_utils.cpp           |  42 ++--
 src/lib/libzmf_utils.h             |   8 +
 src/test/Makefile.am               |   1 -
 src/test/Makefile.in               |  21 +-
 src/test/ZMFDocumentTest.cpp       |   4 +-
 src/test/ZMFInternalStreamTest.cpp | 106 ---------
 src/test/ZMFTypesTest.cpp          |   4 +-
 54 files changed, 1595 insertions(+), 930 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8844678..8f1f6a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,254 @@
+2017-09-14  David Tardon  <dtardon at redhat.com>  [130184de11251be77cf4030bca0b510f69bd2dc0]
+
+	make the condition a bit easier to read
+
+	Change-Id: I94f84e3bb77f8871a31580a5cd009a8193b81658
+
+2017-09-13  David Tardon  <dtardon at redhat.com>  [344e055e624ce4cb3b688262c550099a3327aef8]
+
+	use subtraction and division in check to avoid overflows
+
+	Change-Id: I503124716b488ab92bb7980ea1c711e8ef770bce
+
+2017-09-13  David Tardon  <dtardon at redhat.com>  [665fe1c98a9d96c5cf223ed8cccc2cdb175e4461]
+
+	cid#1354067 rewrite to appease coverity
+
+	Change-Id: I98da4522147906beb9401217704234d0c016835f
+
+2017-09-12  David Tardon  <dtardon at redhat.com>  [bea72558805b78dfe4e8bbc00d3650b183a8830e]
+
+	prepare for a release
+
+	Change-Id: I5cc05ceefae714d8b7bdde55669ba9a29a20b080
+
+2017-09-11  David Tardon  <dtardon at redhat.com>  [d563f1b1201e72abcf45f3c48d6ced1711ef7d70]
+
+	WaE: declaration of 'points' shadows a member of 'this'
+
+	Change-Id: I1f01cfe0cd6c3406830f45ef8b1b5ddf1ef75feb
+
+2017-09-11  David Tardon  <dtardon at redhat.com>  [41e6cae5b0a80d09997bf90e9b948a8757257b04]
+
+	WaE: declaration of 'header' shadows a member of 'this'
+
+	Change-Id: I9b67601c2e6f8f574fef44b3529e53dec82516a6
+
+2017-09-10  Miklos Vajna  <vmiklos at collabora.co.uk>  [2e72b06d7e0cd5a316aa2198246676b97480922b]
+
+	m4: MSVC defines __cplusplus as 199711L still
+
+	See e.g.
+	<https://stackoverflow.com/questions/37503029/cplusplus-is-equal-to-199711-in-msvc-does-it-support-c11>,
+	on MSVC we can't depend on the value of __cplusplus, since that one is a
+	too low value, even if everything else works fine.
+
+2017-09-08  David Tardon  <dtardon at redhat.com>  [bfc20028e143ae7427f2704344d9f3ed8c7d6852]
+
+	tests need librevenge-stream too
+
+	Change-Id: Id8e8fa81ac82cc0be11593f0ee954b509e8b650b
+
+2017-09-08  David Tardon  <dtardon at redhat.com>  [7f72c153f370dcdf83388fa7ce1ef5ff9d8b4570]
+
+	assume modern enough ICU is available
+
+	The separate .pc files already exist in 46.0, possibly even in older
+	versions.
+
+	Change-Id: Ib5ae67b02dd577655fdab297219f2ffa9b69a798
+
+2017-08-15  Thorsten Behrens  <Thorsten.Behrens at CIB.de>  [6be6f4b385323df34864a4c77586ad36487a1d31]
+
+	Fix spelling
+
+	Change-Id: Iaddcde92abf1f53c4916e88f2b53dd0ecba5382e
+
+2017-07-29  David Tardon  <dtardon at redhat.com>  [cc3cefe7ef23928d0b93ae73a67f38c196d15e5d]
+
+	supress GCC 7 fallthrough warning
+
+	Change-Id: I2fc3d232ca8a7c430604cb44b015d1dc881cba71
+
+2017-07-29  David Tardon  <dtardon at redhat.com>  [9170b3700cbd2f894dd0d9907e680d9cd3e1c2ad]
+
+	do not insert UTF-8 string by code units
+
+	Change-Id: I91fd9691900c9ade92ad60983c90fba994c7cf30
+
+2017-07-07  David Tardon  <dtardon at redhat.com>  [3c5d7cfe0e31bf77b5e3fd40e05c1e692a289545]
+
+	drop unused internal stream impl.
+
+	Change-Id: Ib9b1a33cbad078e55cad711a5cbdbdbeade54583
+
+2017-04-23  David Tardon  <dtardon at redhat.com>  [9b8c5318db81db5e26fb1e82343698f33067d755]
+
+	change include guard to match file name
+
+	Change-Id: I5c5de099d149298da31c36cb64bfcb1d7f76db95
+
+2017-04-23  David Tardon  <dtardon at redhat.com>  [10e502b529a0d50e111d4653823a81dce6d1f6c8]
+
+	mark unimplemented functions as deleted
+
+	Change-Id: I6139f3990d64e6077ae20907f780efc31c347ad4
+
+2017-04-23  David Tardon  <dtardon at redhat.com>  [59bb448ea86987d77281608e2c76cf04bcb03916]
+
+	mark virtual functions with override
+
+	Change-Id: Ic1b5da52d3bcfd92ce0e262281d60268e0e22e0d
+
+2017-04-23  David Tardon  <dtardon at redhat.com>  [a5e303b7e0d94a8d1c10c8a6977c35147e55ee12]
+
+	update C++11 checks
+
+	Change-Id: I1769ddc906140bd0595fb961bff0c48cb4c2278f
+
+2017-04-23  David Tardon  <dtardon at redhat.com>  [97b79982cff50c29a8d14a97dfe4316177e3309d]
+
+	replace dumb pointers by smart ones
+
+	Change-Id: I17c0b4aca09ea53ffa5d4ff6222060b516ca6bdf
+
+2017-04-21  David Tardon  <dtardon at redhat.com>  [cc1e8888f14e4c7bc6c46b18b8e458e25176b6b0]
+
+	ofz#1195 speed up normalization of angle
+
+	Change-Id: I5b081bc7ee79afcd3ad63003d1169ddefe83e4d7
+
+2017-04-21  David Tardon  <dtardon at redhat.com>  [0dac28e590c2cefacf6a5a7186eaa51470f4bc11]
+
+	avoid manual resource management
+
+	Change-Id: Id9d8c0c0efa53a1cb76dc043d9161fd1bcf05ce6
+
+2017-04-15  David Tardon  <dtardon at redhat.com>  [bf4f4512168501b55b6ed7dff49a48642a7a9e9b]
+
+	ofz#1006 skip bitmap if it could not be read
+
+	Change-Id: Iffd3456c51caa92815cdcc6f7ccf4a69d3f9f8db
+
+2017-04-12  David Tardon  <dtardon at redhat.com>  [72893e0929e16c3e766fae45e4d20d0cb9e3ba96]
+
+	ofz#1030 try to repair bitmap dims in damaged file
+
+	... if the bitmap has transparency.
+
+	Change-Id: If2e5128f04653e5b1a49e194e374924299db23ea
+
+2017-04-12  David Tardon  <dtardon at redhat.com>  [fc8195a3acc100822fbffe818aa9d23e3a3089bb]
+
+	refactor bitmap parser
+
+	Change-Id: I54b94cc72a4aaa8a70568cc14427e39d44dca3eb
+
+2017-04-12  David Tardon  <dtardon at redhat.com>  [97de75421f07c472cacfb9dda3ae2dafaab59212]
+
+	put PNG writer to a separate namespace
+
+	Change-Id: Ie0c4a561c5ec4be7e2c550d0645c2a8738b2c492
+
+2017-04-10  David Tardon  <dtardon at redhat.com>  [df5d76f0e538bef9e68bf3377d965fab55a12089]
+
+	ofz#1073 avoid inf loop with too big angle
+
+	Change-Id: I5af806486d02296d6d55851afa7329ca2b8ec97e
+
+2017-04-05  David Tardon  <dtardon at redhat.com>  [a518a331a4335aa818efdd6fc5258fc8ff0703c3]
+
+	make the condition easier to understand (for me .-)
+
+	Change-Id: I172bf51376ea79ed19687ebda932ec2cd80e9f0d
+
+2017-04-05  David Tardon  <dtardon at redhat.com>  [5d44a5b8f44ef3c47bf0d21aab9fc73b451be05f]
+
+	ofz#988 sanitize color depth
+
+	Change-Id: I8b2a70e7ee3fbaf853e40b67683db588b026be74
+
+2017-04-05  David Tardon  <dtardon at redhat.com>  [4b761a9b4296d24eb95c0f302995b0435c17dd86]
+
+	simplify this
+
+	Change-Id: I04d5dd4856d4496e2538bfdc3dd456d17d3e00cd
+
+2017-04-05  David Tardon  <dtardon at redhat.com>  [3fcae08b7367f10649f2eef25a530db39c1233be]
+
+	ofz#1007 ensure font name ends with 0
+
+	Change-Id: I77e72d3dd81affaf1bc4a565fd4280d7ca200cd2
+
+2017-04-05  David Tardon  <dtardon at redhat.com>  [22a5eff6b62d10937793fc3c95bc10dcdf0faa05]
+
+	drop unneeded braces
+
+	Change-Id: I17b18cc5a56dbd1dd05834d8c4b6fd0223a95627
+
+2017-04-05  David Tardon  <dtardon at redhat.com>  [14c60f7f029855639de6b6da12a9c3b55dff2674]
+
+	do not fall through
+
+	This is harmless, though, as lines always contain both start and end
+	arrow.
+
+	Change-Id: I3bcf955835e80e6d61338d40343038f1e6a014e9
+
+2017-04-05  David Tardon  <dtardon at redhat.com>  [d1e7c8bedee76fde3947dc86644df640b2815745]
+
+	WaE: fall-through is intended here
+
+	Change-Id: I233192ec85cf0ad2158f953d9e188f0d178190ee
+
+2017-04-01  David Tardon  <dtardon at redhat.com>  [197862b3b43eba1ca91698a98b0391d0c9ed84d8]
+
+	avoid enormous allocation
+
+	Change-Id: I16abb5a820f6ca622575f0e19671f97543be902f
+
+2017-04-01  David Tardon  <dtardon at redhat.com>  [6f4d75430dc023c53d5d69946b4cb4fd8ee8ddd7]
+
+	fix handling of inflate error
+
+	Change-Id: I0034a152ee96bb81ec15f77a12d902ae04fe4545
+
+2017-03-31  David Tardon  <dtardon at redhat.com>  [9fe46f17a08781974d73a41c9a58f65856f099f7]
+
+	add fuzzer for bitmaps too
+
+	Change-Id: I341f6adf5d43d347cdfaecdc5d05fe3ccaaa13c3
+
+2017-03-31  David Tardon  <dtardon at redhat.com>  [60662664fc57d059a075d0dc8a6ee8b73acd9cf8]
+
+	add fuzzing driver for oss-fuzz
+
+	Change-Id: I7fee4b2bb49930c94d5f449f381c40c3b9b648d0
+
+2017-03-14  dennisroczek  <dennisroczek at libreoffice.org>  [67671765e9eccc7c591abc708fb3c2789921637e]
+
+	fix typo: "the the" --> the
+
+	Change-Id: Id44d0553bf8868c3d6436db454379613b7a891f6
+
+2017-03-09  dennisroczek  <dennisroczek at libreoffice.org>  [e1a5d6642878b9a01cae1ebe69c71e29ea00914f]
+
+	fix typo: usefull --> useful
+
+	Change-Id: I921598581b9625d81e9aeaf887b341ff32434ca6
+
+2016-10-23  David Tardon  <dtardon at redhat.com>  [11b8d5b0c8c0461ac638aba6bc6e59e7ec5d815c]
+
+	allow build with boost < 1.56, part II
+
+	Change-Id: I4421847b1aa7bbb006a32dd85567b96125df6b6b
+
+2016-10-23  David Tardon  <dtardon at redhat.com>  [16d921505a56745f671525310ebb4b3c58b35afe]
+
+	allow build with boost < 1.56
+
+	Change-Id: I81a110fc19e1540980a265c773bd840c47643d86
+
 2016-09-07  David Tardon  <dtardon at redhat.com>  [57be949c2e4b9a59c7488d8921c54f993f7fe70b]
 
 	fix file name
diff --git a/Makefile.in b/Makefile.in
index 2313de4..628b7b3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -93,6 +93,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
 	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
 	$(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
+	$(top_srcdir)/m4/dlp_fallthrough.m4 \
 	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
 	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
 	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
@@ -275,7 +276,6 @@ FGREP = @FGREP@
 GREP = @GREP@
 HAVE_CXX11 = @HAVE_CXX11@
 ICU_CFLAGS = @ICU_CFLAGS@
-ICU_CONFIG = @ICU_CONFIG@
 ICU_LIBS = @ICU_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
@@ -660,7 +660,7 @@ distdir: $(DISTFILES)
 	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
 	|| chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
 	$(am__post_remove_distdir)
 dist-bzip2: distdir
 	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
@@ -684,7 +684,7 @@ dist-shar: distdir
 	@echo WARNING: "Support for shar distribution archives is" \
 	               "deprecated." >&2
 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+	shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
 	$(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -702,7 +702,7 @@ dist dist-all:
 distcheck: dist
 	case '$(DIST_ARCHIVES)' in \
 	*.tar.gz*) \
-	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
 	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
 	*.tar.lz*) \
@@ -712,7 +712,7 @@ distcheck: dist
 	*.tar.Z*) \
 	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
 	*.shar.gz*) \
-	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
 	esac
diff --git a/NEWS b/NEWS
index 0023a20..b317501 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+libzmf-0.0.2
+
+- Allow build with boost older than 1.56.
+- Require C++11 for build.
+- Fix various issues found by oss-fuzz.
+- Minor code cleanups.
+
 libzmf-0.0.1
 
 - Handle ellipse rotation.
diff --git a/aclocal.m4 b/aclocal.m4
index eda1aa1..d2ad1f6 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -21,7 +21,7 @@ If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
 # ===========================================================================
-#    http://www.gnu.org/software/autoconf-archive/ax_require_defined.html
+#    https://www.gnu.org/software/autoconf-archive/ax_require_defined.html
 # ===========================================================================
 #
 # SYNOPSIS
@@ -52,15 +52,15 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 1
+#serial 2
 
 AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
   m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
 ])dnl AX_REQUIRE_DEFINED
 
-dnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
-dnl serial 11 (pkg-config-0.29)
-dnl
+# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
+# serial 11 (pkg-config-0.29.1)
+
 dnl Copyright © 2004 Scott James Remnant <scott at netsplit.com>.
 dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists at gmail.com>
 dnl
@@ -101,7 +101,7 @@ dnl
 dnl See the "Since" comment for each macro you use to see what version
 dnl of the macros you require.
 m4_defun([PKG_PREREQ],
-[m4_define([PKG_MACROS_VERSION], [0.29])
+[m4_define([PKG_MACROS_VERSION], [0.29.1])
 m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
     [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
 ])dnl PKG_PREREQ
@@ -334,6 +334,74 @@ AS_VAR_COPY([$1], [pkg_cv_][$1])
 AS_VAR_IF([$1], [""], [$5], [$4])dnl
 ])dnl PKG_CHECK_VAR
 
+dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
+dnl   [DESCRIPTION], [DEFAULT])
+dnl ------------------------------------------
+dnl
+dnl Prepare a "--with-" configure option using the lowercase
+dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
+dnl PKG_CHECK_MODULES in a single macro.
+AC_DEFUN([PKG_WITH_MODULES],
+[
+m4_pushdef([with_arg], m4_tolower([$1]))
+
+m4_pushdef([description],
+           [m4_default([$5], [build with ]with_arg[ support])])
+
+m4_pushdef([def_arg], [m4_default([$6], [auto])])
+m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
+m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
+
+m4_case(def_arg,
+            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
+            [m4_pushdef([with_without],[--with-]with_arg)])
+
+AC_ARG_WITH(with_arg,
+     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
+    [AS_TR_SH([with_]with_arg)=def_arg])
+
+AS_CASE([$AS_TR_SH([with_]with_arg)],
+            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
+            [auto],[PKG_CHECK_MODULES([$1],[$2],
+                                        [m4_n([def_action_if_found]) $3],
+                                        [m4_n([def_action_if_not_found]) $4])])
+
+m4_popdef([with_arg])
+m4_popdef([description])
+m4_popdef([def_arg])
+
+])dnl PKG_WITH_MODULES
+
+dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl   [DESCRIPTION], [DEFAULT])
+dnl -----------------------------------------------
+dnl
+dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
+dnl check._[VARIABLE-PREFIX] is exported as make variable.
+AC_DEFUN([PKG_HAVE_WITH_MODULES],
+[
+PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
+
+AM_CONDITIONAL([HAVE_][$1],
+               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
+])dnl PKG_HAVE_WITH_MODULES
+
+dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl   [DESCRIPTION], [DEFAULT])
+dnl ------------------------------------------------------
+dnl
+dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
+dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
+dnl and preprocessor variable.
+AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
+[
+PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
+
+AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
+        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
+])dnl PKG_HAVE_DEFINE_WITH_MODULES
+
 # Copyright (C) 2002-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
@@ -1527,6 +1595,7 @@ AC_SUBST([am__untar])
 m4_include([m4/ax_cxx_compile_stdcxx.m4])
 m4_include([m4/ax_cxx_compile_stdcxx_11.m4])
 m4_include([m4/ax_gcc_func_attribute.m4])
+m4_include([m4/dlp_fallthrough.m4])
 m4_include([m4/libtool.m4])
 m4_include([m4/ltoptions.m4])
 m4_include([m4/ltsugar.m4])
diff --git a/ar-lib b/ar-lib
index fe2301e..0f62c6f 100755
--- a/ar-lib
+++ b/ar-lib
@@ -4,7 +4,7 @@
 me=ar-lib
 scriptversion=2012-03-01.08; # UTC
 
-# Copyright (C) 2010-2013 Free Software Foundation, Inc.
+# Copyright (C) 2010, 2012 Free Software Foundation, Inc.
 # Written by Peter Rosin <peda at lysator.liu.se>.
 #
 # This program is free software; you can redistribute it and/or modify
diff --git a/build/Makefile.in b/build/Makefile.in
index b0709dd..202d4c6 100644
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -92,6 +92,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
 	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
 	$(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
+	$(top_srcdir)/m4/dlp_fallthrough.m4 \
 	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
 	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
 	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
@@ -221,7 +222,6 @@ FGREP = @FGREP@
 GREP = @GREP@
 HAVE_CXX11 = @HAVE_CXX11@
 ICU_CFLAGS = @ICU_CFLAGS@
-ICU_CONFIG = @ICU_CONFIG@
 ICU_LIBS = @ICU_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
diff --git a/build/win32/Makefile.in b/build/win32/Makefile.in
index 2ae1339..625026f 100644
--- a/build/win32/Makefile.in
+++ b/build/win32/Makefile.in
@@ -92,6 +92,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
 	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
 	$(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
+	$(top_srcdir)/m4/dlp_fallthrough.m4 \
 	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
 	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
 	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
@@ -161,7 +162,6 @@ FGREP = @FGREP@
 GREP = @GREP@
 HAVE_CXX11 = @HAVE_CXX11@
 ICU_CFLAGS = @ICU_CFLAGS@
-ICU_CONFIG = @ICU_CONFIG@
 ICU_LIBS = @ICU_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
diff --git a/build/win32/libzmf.dsp b/build/win32/libzmf.dsp
index 999bb45..aa1d737 100644
--- a/build/win32/libzmf.dsp
+++ b/build/win32/libzmf.dsp
@@ -111,10 +111,6 @@ SOURCE=..\..\src\lib\ZMFHeader.cpp
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\lib\ZMFInternalStream.cpp
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\src\lib\ZMFraphics.cpp
 # End Source File
 # Begin Source File
@@ -163,10 +159,6 @@ SOURCE=..\..\src\lib\ZMFHeader.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\lib\ZMFInternalStream.h
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\src\lib\ZMFraphics.h
 # End Source File
 # Begin Source File
diff --git a/build/win32/libzmf.vcproj b/build/win32/libzmf.vcproj
index 04ab792..537c268 100644
--- a/build/win32/libzmf.vcproj
+++ b/build/win32/libzmf.vcproj
@@ -292,26 +292,6 @@
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\..\src\lib\ZMFInternalStream.cpp"
-				>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
 				RelativePath="..\..\src\lib\ZMFraphics.cpp"
 				>
 				<FileConfiguration
@@ -413,10 +393,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\src\lib\ZMFInternalStream.h"
-				>
-			</File>
-			<File
 				RelativePath="..\..\src\lib\ZMFSVGGenerator.h"
 				>
 			</File>
diff --git a/build/win32/libzmf.vcxproj b/build/win32/libzmf.vcxproj
index e3899d3..72234d8 100644
--- a/build/win32/libzmf.vcxproj
+++ b/build/win32/libzmf.vcxproj
@@ -125,10 +125,6 @@
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\lib\ZMFInternalStream.cpp">
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
     <ClCompile Include="..\..\src\lib\ZMFraphics.cpp">
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -152,7 +148,6 @@
     <ClInclude Include="..\..\src\lib\ZMFColor.h" />
     <ClInclude Include="..\..\src\lib\ZMFDashArray.h" />
     <ClInclude Include="..\..\src\lib\ZMFHeader.h" />
-    <ClInclude Include="..\..\src\lib\ZMFInternalStream.h" />
     <ClInclude Include="..\..\src\lib\ZMFSVGGenerator.h" />
     <ClInclude Include="..\..\src\lib\ZMFXParser.h" />
   </ItemGroup>
diff --git a/config.guess b/config.guess
index 1804e9f..d622a44 100755
--- a/config.guess
+++ b/config.guess
@@ -2,13 +2,13 @@
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011, 2012, 2013 Free Software Foundation, Inc.
+#   2011, 2012 Free Software Foundation, Inc.
 
-timestamp='2012-12-29'
+timestamp='2012-02-10'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but
@@ -22,17 +22,19 @@ timestamp='2012-12-29'
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that
-# program.  This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches at gnu.org> and include a ChangeLog
+# entry.
 #
-# Originally written by Per Bothner. 
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
 #
 # You can get the latest version of this script from:
 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-#
-# Please send patches with a ChangeLog entry to config-patches at gnu.org.
-
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -53,8 +55,8 @@ GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
-2012, 2013 Free Software Foundation, Inc.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -198,10 +200,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
 	echo "${machine}-${os}${release}"
 	exit ;;
-    *:Bitrig:*:*)
-	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
-	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
-	exit ;;
     *:OpenBSD:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
 	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@@ -304,7 +302,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
 	exit ;;
-    arm*:riscos:*:*|arm*:RISCOS:*:*)
+    arm:riscos:*:*|arm:RISCOS:*:*)
 	echo arm-unknown-riscos
 	exit ;;
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -803,9 +801,6 @@ EOF
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
 	exit ;;
-    *:MINGW64*:*)
-	echo ${UNAME_MACHINE}-pc-mingw64
-	exit ;;
     *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
@@ -1206,9 +1201,6 @@ EOF
     BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
 	echo i586-pc-haiku
 	exit ;;
-    x86_64:Haiku:*:*)
-	echo x86_64-unknown-haiku
-	exit ;;
     SX-4:SUPER-UX:*:*)
 	echo sx4-nec-superux${UNAME_RELEASE}
 	exit ;;
@@ -1264,7 +1256,7 @@ EOF
     NEO-?:NONSTOP_KERNEL:*:*)
 	echo neo-tandem-nsk${UNAME_RELEASE}
 	exit ;;
-    NSE-*:NONSTOP_KERNEL:*:*)
+    NSE-?:NONSTOP_KERNEL:*:*)
 	echo nse-tandem-nsk${UNAME_RELEASE}
 	exit ;;
     NSR-?:NONSTOP_KERNEL:*:*)
@@ -1338,6 +1330,9 @@ EOF
 	exit ;;
 esac
 
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
 eval $set_cc_for_build
 cat >$dummy.c <<EOF
 #ifdef _SEQUENT_
diff --git a/config.h.in b/config.h.in
index 5797cd2..b988afa 100644
--- a/config.h.in
+++ b/config.h.in
@@ -16,6 +16,9 @@
 /* Define to 1 if you have the <boost/variant.hpp> header file. */
 #undef HAVE_BOOST_VARIANT_HPP
 
+/* Define to 1 if the system has the clang-style `fallthrough' attribute */
+#undef HAVE_CLANG_ATTRIBUTE_FALLTHROUGH
+
 /* define if the compiler supports basic C++11 syntax */
 #undef HAVE_CXX11
 
@@ -28,6 +31,9 @@
 /* Define to 1 if the system has the `format' function attribute */
 #undef HAVE_FUNC_ATTRIBUTE_FORMAT
 
+/* Define to 1 if the system has the GNU-style `fallthrough' attribute */
+#undef HAVE_GCC_ATTRIBUTE_FALLTHROUGH
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
diff --git a/config.sub b/config.sub
index 52f04bc..c894da4 100755
--- a/config.sub
+++ b/config.sub
@@ -2,19 +2,23 @@
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011, 2012, 2013 Free Software Foundation, Inc.
+#   2011, 2012 Free Software Foundation, Inc.
 
-timestamp='2012-12-29'
+timestamp='2012-02-10'
 
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.
 #
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
@@ -22,12 +26,11 @@ timestamp='2012-12-29'
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that
-# program.  This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
+# the same distribution terms that you use for the rest of that program.
 
 
-# Please send patches with a ChangeLog entry to config-patches at gnu.org.
+# Please send patches to <config-patches at gnu.org>.  Submit a context
+# diff and a properly formatted GNU ChangeLog entry.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
@@ -71,8 +74,8 @@ version="\
 GNU config.sub ($timestamp)
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
-2012, 2013 Free Software Foundation, Inc.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -120,7 +123,7 @@ esac
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
-  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
   knetbsd*-gnu* | netbsd*-gnu* | \
   kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
@@ -153,7 +156,7 @@ case $os in
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray | -microblaze*)
+	-apple | -axis | -knuth | -cray | -microblaze)
 		os=
 		basic_machine=$1
 		;;
@@ -222,12 +225,6 @@ case $os in
 	-isc*)
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
-	-lynx*178)
-		os=-lynxos178
-		;;
-	-lynx*5)
-		os=-lynxos5
-		;;
 	-lynx*)
 		os=-lynxos
 		;;
@@ -256,10 +253,8 @@ case $basic_machine in
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
-	| arc \
-	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
-	| avr | avr32 \
-	| be32 | be64 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+        | be32 | be64 \
 	| bfin \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
@@ -272,7 +267,7 @@ case $basic_machine in
 	| le32 | le64 \
 	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
+	| maxq | mb | microblaze | mcore | mep | metag \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -388,8 +383,7 @@ case $basic_machine in
 	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
-	| microblaze-* | microblazeel-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
@@ -788,13 +782,9 @@ case $basic_machine in
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
-	microblaze*)
+	microblaze)
 		basic_machine=microblaze-xilinx
 		;;
-	mingw64)
-		basic_machine=x86_64-pc
-		os=-mingw64
-		;;
 	mingw32)
 		basic_machine=i386-pc
 		os=-mingw32
@@ -1008,7 +998,7 @@ case $basic_machine in
 		;;
 	ppc64)	basic_machine=powerpc64-unknown
 		;;
-	ppc64-* | ppc64p7-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
 		basic_machine=powerpc64le-unknown
@@ -1023,11 +1013,7 @@ case $basic_machine in
 		basic_machine=i586-unknown
 		os=-pw32
 		;;
-	rdos | rdos64)
-		basic_machine=x86_64-pc
-		os=-rdos
-		;;
-	rdos32)
+	rdos)
 		basic_machine=i386-pc
 		os=-rdos
 		;;
@@ -1360,15 +1346,15 @@ case $os in
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -bitrig* | -openbsd* | -solidbsd* \
+	      | -openbsd* | -solidbsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
 	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
-	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
+	      | -mingw32* | -linux-gnu* | -linux-android* \
+	      | -linux-newlib* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1551,9 +1537,6 @@ case $basic_machine in
 	c4x-* | tic4x-*)
 		os=-coff
 		;;
-	hexagon-*)
-		os=-elf
-		;;
 	tic54x-*)
 		os=-coff
 		;;
diff --git a/configure b/configure
index 9027459..03f2643 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libzmf 0.0.1.
+# Generated by GNU Autoconf 2.69 for libzmf 0.0.2.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='libzmf'
 PACKAGE_TARNAME='libzmf'
-PACKAGE_VERSION='0.0.1'
-PACKAGE_STRING='libzmf 0.0.1'
+PACKAGE_VERSION='0.0.2'
+PACKAGE_STRING='libzmf 0.0.2'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -634,6 +634,8 @@ LTLIBOBJS
 LIBOBJS
 REVENGE_GENERATORS_LIBS
 REVENGE_GENERATORS_CFLAGS
+BUILD_FUZZERS_FALSE
+BUILD_FUZZERS_TRUE
 BUILD_TOOLS_FALSE
 BUILD_TOOLS_TRUE
 WITH_LIBZMF_DOCS_FALSE
@@ -661,7 +663,6 @@ ZMF_VERSION
 ZMF_MICRO_VERSION
 ZMF_MINOR_VERSION
 ZMF_MAJOR_VERSION
-ICU_CONFIG
 ICU_LIBS
 ICU_CFLAGS
 LIBPNG_LIBS
@@ -816,6 +817,7 @@ enable_debug_draw_bbox
 enable_tests
 with_docs
 enable_tools
+enable_fuzzers
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1388,7 +1390,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 libzmf 0.0.1 to adapt to many kinds of systems.
+\`configure' configures libzmf 0.0.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1458,7 +1460,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libzmf 0.0.1:";;
+     short | recursive ) echo "Configuration of libzmf 0.0.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1477,9 +1479,8 @@ Optional Features:
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
-  --disable-werror        Treat all warnings as errors, usefull for
-                          development
-  --disable-weffc         Disable -Weffc++ warnings, usefull when using an old
+  --disable-werror        Treat all warnings as errors, useful for development
+  --disable-weffc         Disable -Weffc++ warnings, useful when using an old
                           version of gcc or of boost
   --enable-wparanoic      Enable a lot of warnings...
   --enable-debug          Turn on debugging
@@ -1487,6 +1488,7 @@ Optional Features:
                           Turn on drawing of bounding boxes
   --enable-tests          Build and run unit tests
   --disable-tools         Do not build command line conversion tools
+  --enable-fuzzers        Build fuzzer(s)
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -1610,7 +1612,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libzmf configure 0.0.1
+libzmf configure 0.0.2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2127,7 +2129,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 libzmf $as_me 0.0.1, which was
+It was created by libzmf $as_me 0.0.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2993,7 +2995,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='libzmf'
- VERSION='0.0.1'
+ VERSION='0.0.2'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -17169,7 +17171,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
 
-      ax_cxx_compile_cxx11_required=true
+  ax_cxx_compile_alternatives="11 0x"    ax_cxx_compile_cxx11_required=true
   ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -17192,7 +17194,7 @@ else
 
 #error "This is not a C++ compiler"
 
-#elif __cplusplus < 201103L
+#elif __cplusplus < 201103L && !(defined _MSC_VER)
 
 #error "This is not a C++11 compiler"
 
@@ -17484,7 +17486,8 @@ $as_echo "$ax_cv_cxx_compile_cxx11" >&6; }
   fi
 
     if test x$ac_success = xno; then
-    for switch in -std=gnu++11 -std=gnu++0x; do
+    for alternative in ${ax_cxx_compile_alternatives}; do
+      switch="-std=gnu++${alternative}"
       cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh`
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5
 $as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; }
@@ -17504,7 +17507,7 @@ else
 
 #error "This is not a C++ compiler"
 
-#elif __cplusplus < 201103L
+#elif __cplusplus < 201103L && !(defined _MSC_VER)
 
 #error "This is not a C++11 compiler"
 
@@ -17805,16 +17808,17 @@ $as_echo "$ac_res" >&6; }
   fi
 
     if test x$ac_success = xno; then
-                for switch in -std=c++11 -std=c++0x +std=c++11 "-h std=c++11"; do
-      cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh`
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5
+                for alternative in ${ax_cxx_compile_alternatives}; do
+      for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
+        cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh`
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5
 $as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; }
 if eval \${$cachevar+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_CXX="$CXX"
-         CXX="$CXX $switch"
-         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+           CXX="$CXX $switch"
+           cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 
@@ -17825,7 +17829,7 @@ else
 
 #error "This is not a C++ compiler"
 
-#elif __cplusplus < 201103L
+#elif __cplusplus < 201103L && !(defined _MSC_VER)
 
 #error "This is not a C++11 compiler"
 
@@ -18109,17 +18113,21 @@ else
   eval $cachevar=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-         CXX="$ac_save_CXX"
+           CXX="$ac_save_CXX"
 fi
 eval ac_res=\$$cachevar
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-      if eval test x\$$cachevar = xyes; then
-        CXX="$CXX $switch"
-        if test -n "$CXXCPP" ; then
-          CXXCPP="$CXXCPP $switch"
+        if eval test x\$$cachevar = xyes; then
+          CXX="$CXX $switch"
+          if test -n "$CXXCPP" ; then
+            CXXCPP="$CXXCPP $switch"
+          fi
+          ac_success=yes
+          break
         fi
-        ac_success=yes
+      done
+      if test x$ac_success = xyes; then
         break
       fi
     done
@@ -18150,6 +18158,7 @@ $as_echo "#define HAVE_CXX11 1" >>confdefs.h
 
 
 
+
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((format))" >&5
 $as_echo_n "checking for __attribute__((format))... " >&6; }
 if ${ax_cv_have_func_attribute_format+:} false; then :
@@ -18201,6 +18210,126 @@ fi
 
 
 
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((fallthrough))" >&5
+$as_echo_n "checking for __attribute__((fallthrough))... " >&6; }
+if ${ax_cv_have_gcc_attribute_falltrough+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+                void foo(int &i)
+                {
+                    switch (i)
+                    {
+                        case 0:
+                            i += 1;
+                            __attribute__((fallthrough));
+                        default:
+                            i += 1;
+                    }
+                }
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+                                      if test -s conftest.err; then :
+  ax_cv_have_gcc_attribute_falltrough=no
+else
+  ax_cv_have_gcc_attribute_falltrough=yes
+fi
+else
+  ax_cv_have_gcc_attribute_falltrough=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_have_gcc_attribute_falltrough" >&5
+$as_echo "$ax_cv_have_gcc_attribute_falltrough" >&6; }
+
+    if test yes = $ax_cv_have_gcc_attribute_falltrough; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_GCC_ATTRIBUTE_FALLTHROUGH 1
+_ACEOF
+
+fi
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for [[clang:fallthrough]]" >&5
+$as_echo_n "checking for [[clang:fallthrough]]... " >&6; }
+if ${ax_cv_have_clang_attribute_falltrough+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+                void foo(int &i)
+                {
+                    switch (i)
+                    {
+                        case 0:
+                            i += 1;
+                            [[clang:fallthrough]];
+                        default:
+                            i += 1;
+                    }
+                }
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+                                      if test -s conftest.err; then :
+  ax_cv_have_clang_attribute_falltrough=no
+else
+  ax_cv_have_clang_attribute_falltrough=yes
+fi
+else
+  ax_cv_have_clang_attribute_falltrough=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_have_clang_attribute_falltrough" >&5
+$as_echo "$ax_cv_have_clang_attribute_falltrough" >&6; }
+
+    if test yes = $ax_cv_have_clang_attribute_falltrough; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_CLANG_ATTRIBUTE_FALLTHROUGH 1
+_ACEOF
+
+fi
+
+
+
+
+
+
+
+
 
 
 
@@ -18821,13 +18950,6 @@ fi
 # ========
 # Find icu
 # ========
-if test "${ICU_CFLAGS+set}" = set; then :
-
-	ICU_CFLAGS_overriden=yes
-else
-
-	ICU_CFLAGS_overriden=no
-fi
 
 pkg_failed=no
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ICU" >&5
@@ -18837,12 +18959,12 @@ if test -n "$ICU_CFLAGS"; then
     pkg_cv_ICU_CFLAGS="$ICU_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"icu-i18n\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "icu-i18n") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"icu-uc\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "icu-uc") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_ICU_CFLAGS=`$PKG_CONFIG --cflags "icu-i18n" 2>/dev/null`
+  pkg_cv_ICU_CFLAGS=`$PKG_CONFIG --cflags "icu-uc" 2>/dev/null`
 		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -18854,12 +18976,12 @@ if test -n "$ICU_LIBS"; then
     pkg_cv_ICU_LIBS="$ICU_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"icu-i18n\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "icu-i18n") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"icu-uc\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "icu-uc") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_ICU_LIBS=`$PKG_CONFIG --libs "icu-i18n" 2>/dev/null`
+  pkg_cv_ICU_LIBS=`$PKG_CONFIG --libs "icu-uc" 2>/dev/null`
 		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -18880,135 +19002,44 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        ICU_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "icu-i18n" 2>&1`
+	        ICU_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "icu-uc" 2>&1`
         else
-	        ICU_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "icu-i18n" 2>&1`
+	        ICU_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "icu-uc" 2>&1`
         fi
 	# Put the nasty error message in config.log where it belongs
 	echo "$ICU_PKG_ERRORS" >&5
 
+	as_fn_error $? "Package requirements (icu-uc) were not met:
 
-	# Extract the first word of "icu-config", so it can be a program name with args.
-set dummy icu-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ICU_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $ICU_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ICU_CONFIG="$ICU_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_ICU_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-ICU_CONFIG=$ac_cv_path_ICU_CONFIG
-if test -n "$ICU_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ICU_CONFIG" >&5
-$as_echo "$ICU_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking ICU installation" >&5
-$as_echo_n "checking ICU installation... " >&6; }
-	if ${ICU_CONFIG} --cflags >/dev/null 2>&1; then :
+$ICU_PKG_ERRORS
 
-		ICU_CFLAGS=`${ICU_CONFIG} --cppflags-searchpath --cxxflags`
-		ICU_LIBS=`${ICU_CONFIG} --ldflags`
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
-$as_echo "found" >&6; }
-else
-
-		as_fn_error $? "libicu config program icu-config not found" "$LINENO" 5
-fi
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
 
+Alternatively, you may set the environment variables ICU_CFLAGS
+and ICU_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
 elif test $pkg_failed = untried; then
      	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
 
-	# Extract the first word of "icu-config", so it can be a program name with args.
-set dummy icu-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ICU_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $ICU_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ICU_CONFIG="$ICU_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_ICU_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-ICU_CONFIG=$ac_cv_path_ICU_CONFIG
-if test -n "$ICU_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ICU_CONFIG" >&5
-$as_echo "$ICU_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking ICU installation" >&5
-$as_echo_n "checking ICU installation... " >&6; }
-	if ${ICU_CONFIG} --cflags >/dev/null 2>&1; then :
-
-		ICU_CFLAGS=`${ICU_CONFIG} --cppflags-searchpath --cxxflags`
-		ICU_LIBS=`${ICU_CONFIG} --ldflags`
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
-$as_echo "found" >&6; }
-else
-
-		as_fn_error $? "libicu config program icu-config not found" "$LINENO" 5
-fi
+Alternatively, you may set the environment variables ICU_CFLAGS
+and ICU_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
 
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
 else
 	ICU_CFLAGS=$pkg_cv_ICU_CFLAGS
 	ICU_LIBS=$pkg_cv_ICU_LIBS
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
-	if test "${ICU_CFLAGS_overriden}" = no; then :
-
-		ICU_CFLAGS="${ICU_CFLAGS} `${PKG_CONFIG} icu-i18n --variable=CXXFLAGS`"
-fi
-
 fi
 
 
@@ -19020,9 +19051,9 @@ ZMF_MAJOR_VERSION=0
 
 ZMF_MINOR_VERSION=0
 
-ZMF_MICRO_VERSION=1
+ZMF_MICRO_VERSION=2
 
-ZMF_VERSION=0.0.1
+ZMF_VERSION=0.0.2
 
 # AC_SUBST(LT_RELEASE, [libzmf_version_major.libzmf_version_minor])
 LT_CURRENT=`expr 100 '*' 0 + 0`
@@ -19030,7 +19061,7 @@ LT_CURRENT=`expr 100 '*' 0 + 0`
 LT_AGE=0
 # LT_AGE=libzmf_version_minor
 
-LT_REVISION=1
+LT_REVISION=2
 
 
 
@@ -19576,6 +19607,9 @@ else
   TESTS_FALSE=
 fi
 
+if test "x$enable_tests" = "xyes"; then :
+  need_stream=yes
+fi
 
 # =============
 # Documentation
@@ -19678,6 +19712,33 @@ else
 fi
 
 if test "x$enable_tools" = "xyes"; then :
+  need_stream=yes; need_generators=yes
+fi
+
+# =======
+# Fuzzers
+# =======
+# Check whether --enable-fuzzers was given.
+if test "${enable_fuzzers+set}" = set; then :
+  enableval=$enable_fuzzers; enable_fuzzers="$enableval"
+else
+  enable_fuzzers=no
+
+fi
+
+ if test "x$enable_fuzzers" = "xyes"; then
+  BUILD_FUZZERS_TRUE=
+  BUILD_FUZZERS_FALSE='#'
+else
+  BUILD_FUZZERS_TRUE='#'
+  BUILD_FUZZERS_FALSE=
+fi
+
+if test "x$enable_fuzzers" = "xyes"; then :
+  need_stream=yes; need_generators=yes
+fi
+
+if test "x$need_generators" = "xyes"; then :
 
 
 pkg_failed=no
@@ -19789,6 +19850,13 @@ $as_echo "yes" >&6; }
 
 fi
 
+fi
+
+
+
+if test "x$need_stream" = "xyes"; then :
+
+
 pkg_failed=no
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for REVENGE_STREAM" >&5
 $as_echo_n "checking for REVENGE_STREAM... " >&6; }
@@ -19902,12 +19970,10 @@ fi
 
 
 
-
-
 # =====================
 # Prepare all .in files
 # =====================
-ac_config_files="$ac_config_files Makefile src/Makefile src/conv/Makefile src/conv/raw/Makefile src/conv/raw/zmf2raw.rc src/conv/svg/Makefile src/conv/svg/zmf2svg.rc src/lib/Makefile src/lib/libzmf.rc src/test/Makefile inc/Makefile inc/libzmf/Makefile build/Makefile build/win32/Makefile docs/Makefile docs/doxygen/Makefile libzmf-$ZMF_MAJOR_VERSION.$ZMF_MINOR_VERSION.pc:libzmf.pc.in"
+ac_config_files="$ac_config_files Makefile src/Makefile src/conv/Makefile src/conv/raw/Makefile src/conv/raw/zmf2raw.rc src/conv/svg/Makefile src/conv/svg/zmf2svg.rc src/fuzz/Makefile src/lib/Makefile src/lib/libzmf.rc src/test/Makefile inc/Makefile inc/libzmf/Makefile build/Makefile build/win32/Makefile docs/Makefile docs/doxygen/Makefile libzmf-$ZMF_MAJOR_VERSION.$ZMF_MINOR_VERSION.pc:libzmf.pc.in"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -20070,6 +20136,10 @@ if test -z "${BUILD_TOOLS_TRUE}" && test -z "${BUILD_TOOLS_FALSE}"; then
   as_fn_error $? "conditional \"BUILD_TOOLS\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${BUILD_FUZZERS_TRUE}" && test -z "${BUILD_FUZZERS_FALSE}"; then
+  as_fn_error $? "conditional \"BUILD_FUZZERS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 
 : "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
@@ -20467,7 +20537,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 libzmf $as_me 0.0.1, which was
+This file was extended by libzmf $as_me 0.0.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -20533,7 +20603,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="\\
-libzmf config.status 0.0.1
+libzmf config.status 0.0.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -21055,6 +21125,7 @@ do
     "src/conv/raw/zmf2raw.rc") CONFIG_FILES="$CONFIG_FILES src/conv/raw/zmf2raw.rc" ;;
     "src/conv/svg/Makefile") CONFIG_FILES="$CONFIG_FILES src/conv/svg/Makefile" ;;
     "src/conv/svg/zmf2svg.rc") CONFIG_FILES="$CONFIG_FILES src/conv/svg/zmf2svg.rc" ;;
+    "src/fuzz/Makefile") CONFIG_FILES="$CONFIG_FILES src/fuzz/Makefile" ;;
     "src/lib/Makefile") CONFIG_FILES="$CONFIG_FILES src/lib/Makefile" ;;
     "src/lib/libzmf.rc") CONFIG_FILES="$CONFIG_FILES src/lib/libzmf.rc" ;;
     "src/test/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/Makefile" ;;
@@ -22514,6 +22585,7 @@ Build configuration:
     debug:           ${enable_debug}
     debug draw bbox: ${enable_debug_draw_bbox}
     docs:            ${build_docs}
+    fuzzers:         ${enable_fuzzers}
     tests:           ${enable_tests}
     tools:           ${enable_tools}
     werror:          ${enable_werror}
@@ -22525,6 +22597,7 @@ Build configuration:
     debug:           ${enable_debug}
     debug draw bbox: ${enable_debug_draw_bbox}
     docs:            ${build_docs}
+    fuzzers:         ${enable_fuzzers}
     tests:           ${enable_tests}
     tools:           ${enable_tools}
     werror:          ${enable_werror}
diff --git a/configure.ac b/configure.ac
index b1614ff..174b59a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,7 +8,7 @@ AC_PREREQ([2.65])
 # ====================
 m4_define([libzmf_version_major],[0])
 m4_define([libzmf_version_minor],[0])
-m4_define([libzmf_version_micro],[1])
+m4_define([libzmf_version_micro],[2])
 m4_define([libzmf_version],[libzmf_version_major.libzmf_version_minor.libzmf_version_micro])
 
 # =============
@@ -35,6 +35,7 @@ LT_INIT([win32-dll disable-static pic-only])
 AC_CANONICAL_HOST
 AX_CXX_COMPILE_STDCXX_11
 AX_GCC_FUNC_ATTRIBUTE([format])
+DLP_FALLTHROUGH
 
 PKG_PROG_PKG_CONFIG([0.20])
 
@@ -89,23 +90,9 @@ AC_SUBST(LIBPNG_LIBS)
 # ========
 # Find icu
 # ========
-AS_IF([test "${ICU_CFLAGS+set}" = set],[
-	ICU_CFLAGS_overriden=yes],[
-	ICU_CFLAGS_overriden=no])
-PKG_CHECK_MODULES([ICU],[icu-i18n],[
-	AS_IF([test "${ICU_CFLAGS_overriden}" = no], [
-		ICU_CFLAGS="${ICU_CFLAGS} `${PKG_CONFIG} icu-i18n --variable=CXXFLAGS`"])
-	], [
-	AC_PATH_PROG([ICU_CONFIG],[icu-config])
-	AC_MSG_CHECKING([ICU installation])
-	AS_IF([${ICU_CONFIG} --cflags >/dev/null 2>&1],[
-		ICU_CFLAGS=`${ICU_CONFIG} --cppflags-searchpath --cxxflags`
-		ICU_LIBS=`${ICU_CONFIG} --ldflags`
-		AC_MSG_RESULT([found])],[
-		AC_MSG_ERROR([libicu config program icu-config not found])])]
-)
-AC_SUBST(ICU_CFLAGS)
-AC_SUBST(ICU_LIBS)
+PKG_CHECK_MODULES([ICU], [icu-uc])
+AC_SUBST([ICU_CFLAGS])
+AC_SUBST([ICU_LIBS])
 
 # =================================
 # Libtool/Version Makefile settings
@@ -177,7 +164,7 @@ AS_IF([test "x$platform_win32" = "xyes"],
 # Check for cflags
 # ================
 AC_ARG_ENABLE([werror],
-    [AS_HELP_STRING([--disable-werror], [Treat all warnings as errors, usefull for development])],
+    [AS_HELP_STRING([--disable-werror], [Treat all warnings as errors, useful for development])],
     [enable_werror="$enableval"],
     [enable_werror=yes]
 )
@@ -186,7 +173,7 @@ AS_IF([test x"$enable_werror" != "xno"], [
     CXXFLAGS="$CXXFLAGS -Werror"
 ])
 AC_ARG_ENABLE([weffc],
-    [AS_HELP_STRING([--disable-weffc], [ Disable -Weffc++ warnings, usefull when using an old version of gcc or of boost])],
+    [AS_HELP_STRING([--disable-weffc], [ Disable -Weffc++ warnings, useful when using an old version of gcc or of boost])],
     [enable_weffc="$enableval"],
     [enable_weffc=yes]
 )
@@ -289,6 +276,7 @@ AS_IF([test "x$enable_tests" = "xyes"], [
 AC_SUBST([CPPUNIT_CFLAGS])
 AC_SUBST([CPPUNIT_LIBS])
 AM_CONDITIONAL(TESTS, [test "x$enable_tests" = "xyes"])
+AS_IF([test "x$enable_tests" = "xyes"], [need_stream=yes])
 
 # =============
 # Documentation
@@ -316,16 +304,32 @@ AC_ARG_ENABLE([tools],
     [],
     [enable_tools=yes])
 AM_CONDITIONAL([BUILD_TOOLS], [test "x$enable_tools" = "xyes"])
-AS_IF([test "x$enable_tools" = "xyes"],[
+AS_IF([test "x$enable_tools" = "xyes"], [need_stream=yes; need_generators=yes])
+
+# =======
+# Fuzzers
+# =======
+AC_ARG_ENABLE([fuzzers],
+	[AS_HELP_STRING([--enable-fuzzers], [Build fuzzer(s)])],
+	[enable_fuzzers="$enableval"],
+	[enable_fuzzers=no]
+)
+AM_CONDITIONAL(BUILD_FUZZERS, [test "x$enable_fuzzers" = "xyes"])
+AS_IF([test "x$enable_fuzzers" = "xyes"], [need_stream=yes; need_generators=yes])
+
+AS_IF([test "x$need_generators" = "xyes"], [
     PKG_CHECK_MODULES([REVENGE_GENERATORS],[
         librevenge-generators-0.0
     ])
+])
+AC_SUBST([REVENGE_GENERATORS_CFLAGS])
+AC_SUBST([REVENGE_GENERATORS_LIBS])
+
+AS_IF([test "x$need_stream" = "xyes"], [
     PKG_CHECK_MODULES([REVENGE_STREAM],[
         librevenge-stream-0.0
     ])
 ])
-AC_SUBST([REVENGE_GENERATORS_CFLAGS])
-AC_SUBST([REVENGE_GENERATORS_LIBS])
 AC_SUBST([REVENGE_STREAM_CFLAGS])
 AC_SUBST([REVENGE_STREAM_LIBS])
 
@@ -340,6 +344,7 @@ src/conv/raw/Makefile
 src/conv/raw/zmf2raw.rc
 src/conv/svg/Makefile
 src/conv/svg/zmf2svg.rc
+src/fuzz/Makefile
 src/lib/Makefile
 src/lib/libzmf.rc
 src/test/Makefile
@@ -362,6 +367,7 @@ Build configuration:
     debug:           ${enable_debug}
     debug draw bbox: ${enable_debug_draw_bbox}
     docs:            ${build_docs}
+    fuzzers:         ${enable_fuzzers}
     tests:           ${enable_tests}
     tools:           ${enable_tools}
     werror:          ${enable_werror}
diff --git a/docs/Makefile.in b/docs/Makefile.in
index 58eecb4..73a815c 100644
--- a/docs/Makefile.in
+++ b/docs/Makefile.in
@@ -92,6 +92,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
 	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
 	$(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
+	$(top_srcdir)/m4/dlp_fallthrough.m4 \
 	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
 	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
 	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
@@ -221,7 +222,6 @@ FGREP = @FGREP@
 GREP = @GREP@
 HAVE_CXX11 = @HAVE_CXX11@
 ICU_CFLAGS = @ICU_CFLAGS@
-ICU_CONFIG = @ICU_CONFIG@
 ICU_LIBS = @ICU_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
diff --git a/docs/doxygen/Makefile.in b/docs/doxygen/Makefile.in
index aa142a5..9ad8360 100644
--- a/docs/doxygen/Makefile.in
+++ b/docs/doxygen/Makefile.in
@@ -92,6 +92,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
 	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
 	$(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
+	$(top_srcdir)/m4/dlp_fallthrough.m4 \
 	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
 	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
 	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
@@ -161,7 +162,6 @@ FGREP = @FGREP@
 GREP = @GREP@
 HAVE_CXX11 = @HAVE_CXX11@
 ICU_CFLAGS = @ICU_CFLAGS@
-ICU_CONFIG = @ICU_CONFIG@
 ICU_LIBS = @ICU_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
diff --git a/docs/doxygen/doxygen.cfg b/docs/doxygen/doxygen.cfg
index d365231..f5b6861 100644
--- a/docs/doxygen/doxygen.cfg
+++ b/docs/doxygen/doxygen.cfg
@@ -1540,7 +1540,7 @@ DOT_FONTPATH           =
 # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
 # will generate a graph for each documented class showing the direct and
 # indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
+# CLASS_DIAGRAMS tag to NO.
 
 CLASS_GRAPH            = YES
 
diff --git a/inc/Makefile.in b/inc/Makefile.in
index cad1b5b..4463f48 100644
--- a/inc/Makefile.in
+++ b/inc/Makefile.in
@@ -92,6 +92,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
 	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
 	$(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
+	$(top_srcdir)/m4/dlp_fallthrough.m4 \
 	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
 	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
 	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
@@ -221,7 +222,6 @@ FGREP = @FGREP@
 GREP = @GREP@
 HAVE_CXX11 = @HAVE_CXX11@
 ICU_CFLAGS = @ICU_CFLAGS@
-ICU_CONFIG = @ICU_CONFIG@
 ICU_LIBS = @ICU_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
diff --git a/inc/libzmf/Makefile.in b/inc/libzmf/Makefile.in
index 7918760..2fee977 100644
--- a/inc/libzmf/Makefile.in
+++ b/inc/libzmf/Makefile.in
@@ -93,6 +93,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
 	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
 	$(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
+	$(top_srcdir)/m4/dlp_fallthrough.m4 \
 	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
 	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
 	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
@@ -210,7 +211,6 @@ FGREP = @FGREP@
 GREP = @GREP@
 HAVE_CXX11 = @HAVE_CXX11@
 ICU_CFLAGS = @ICU_CFLAGS@
-ICU_CONFIG = @ICU_CONFIG@
 ICU_LIBS = @ICU_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
diff --git a/install-sh b/install-sh
index 377bb86..a9244eb 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2011-11-20.07; # UTC
+scriptversion=2011-01-19.21; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,7 +35,7 @@ scriptversion=2011-11-20.07; # UTC
 # FSF changes to this file are in the public domain.
 #
 # Calling this script install-sh is preferred over install.sh, to prevent
-# 'make' implicit rules from creating a file called install from it
+# `make' implicit rules from creating a file called install from it
 # when there is no Makefile.
 #
 # This script is compatible with the BSD install script, but was written
@@ -156,7 +156,7 @@ while test $# -ne 0; do
     -s) stripcmd=$stripprog;;
 
     -t) dst_arg=$2
-	# Protect names problematic for 'test' and other utilities.
+	# Protect names problematic for `test' and other utilities.
 	case $dst_arg in
 	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
 	esac
@@ -190,7 +190,7 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
     fi
     shift # arg
     dst_arg=$arg
-    # Protect names problematic for 'test' and other utilities.
+    # Protect names problematic for `test' and other utilities.
     case $dst_arg in
       -* | [=\(\)!]) dst_arg=./$dst_arg;;
     esac
@@ -202,7 +202,7 @@ if test $# -eq 0; then
     echo "$0: no input file specified." >&2
     exit 1
   fi
-  # It's OK to call 'install-sh -d' without argument.
+  # It's OK to call `install-sh -d' without argument.
   # This can happen when creating conditional directories.
   exit 0
 fi
@@ -240,7 +240,7 @@ fi
 
 for src
 do
-  # Protect names problematic for 'test' and other utilities.
+  # Protect names problematic for `test' and other utilities.
   case $src in
     -* | [=\(\)!]) src=./$src;;
   esac
@@ -354,7 +354,7 @@ do
 	      if test -z "$dir_arg" || {
 		   # Check for POSIX incompatibilities with -m.
 		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-		   # other-writable bit of parent directory when it shouldn't.
+		   # other-writeable bit of parent directory when it shouldn't.
 		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
 		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
 		   case $ls_ld_tmpdir in
diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4
index 2c18e49..acc0db2 100644
--- a/m4/ax_cxx_compile_stdcxx.m4
+++ b/m4/ax_cxx_compile_stdcxx.m4
@@ -1,5 +1,5 @@
 # ===========================================================================
-#   http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
+#  https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
 # ===========================================================================
 #
 # SYNOPSIS
@@ -33,21 +33,23 @@
 #   Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov at google.com>
 #   Copyright (c) 2015 Paul Norman <penorman at mac.com>
 #   Copyright (c) 2015 Moritz Klammler <moritz at klammler.eu>
+#   Copyright (c) 2016 Krzesimir Nowak <qdlacz at gmail.com>
 #
 #   Copying and distribution of this file, with or without modification, are
 #   permitted in any medium without royalty provided the copyright notice
 #   and this notice are preserved.  This file is offered as-is, without any
 #   warranty.
 
-#serial 4
+#serial 7
 
 dnl  This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
 dnl  (serial version number 13).
 
+AX_REQUIRE_DEFINED([AC_MSG_WARN])
 AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
-  m4_if([$1], [11], [],
-        [$1], [14], [],
-        [$1], [17], [m4_fatal([support for C++17 not yet implemented in AX_CXX_COMPILE_STDCXX])],
+  m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
+        [$1], [14], [ax_cxx_compile_alternatives="14 1y"],
+        [$1], [17], [ax_cxx_compile_alternatives="17 1z"],
         [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
   m4_if([$2], [], [],
         [$2], [ext], [],
@@ -70,7 +72,8 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
 
   m4_if([$2], [noext], [], [dnl
   if test x$ac_success = xno; then
-    for switch in -std=gnu++$1 -std=gnu++0x; do
+    for alternative in ${ax_cxx_compile_alternatives}; do
+      switch="-std=gnu++${alternative}"
       cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
       AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
                      $cachevar,
@@ -96,22 +99,27 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
     dnl HP's aCC needs +std=c++11 according to:
     dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
     dnl Cray's crayCC needs "-h std=c++11"
-    for switch in -std=c++$1 -std=c++0x +std=c++$1 "-h std=c++$1"; do
-      cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
-      AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
-                     $cachevar,
-        [ac_save_CXX="$CXX"
-         CXX="$CXX $switch"
-         AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
-          [eval $cachevar=yes],
-          [eval $cachevar=no])
-         CXX="$ac_save_CXX"])
-      if eval test x\$$cachevar = xyes; then
-        CXX="$CXX $switch"
-        if test -n "$CXXCPP" ; then
-          CXXCPP="$CXXCPP $switch"
+    for alternative in ${ax_cxx_compile_alternatives}; do
+      for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
+        cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
+        AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
+                       $cachevar,
+          [ac_save_CXX="$CXX"
+           CXX="$CXX $switch"
+           AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
+            [eval $cachevar=yes],
+            [eval $cachevar=no])
+           CXX="$ac_save_CXX"])
+        if eval test x\$$cachevar = xyes; then
+          CXX="$CXX $switch"
+          if test -n "$CXXCPP" ; then
+            CXXCPP="$CXXCPP $switch"
+          fi
+          ac_success=yes
+          break
         fi
-        ac_success=yes
+      done
+      if test x$ac_success = xyes; then
         break
       fi
     done
@@ -131,6 +139,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
               [define if the compiler supports basic C++$1 syntax])
   fi
   AC_SUBST(HAVE_CXX$1)
+  m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may change in incompatible ways anytime])])
 ])
 
 
@@ -148,6 +157,11 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
   _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
 )
 
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
+  _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
+  _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
+  _AX_CXX_COMPILE_STDCXX_testbody_new_in_17
+)
 
 dnl  Tests for new features in C++11
 
@@ -160,7 +174,7 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
 
 #error "This is not a C++ compiler"
 
-#elif __cplusplus < 201103L
+#elif __cplusplus < 201103L && !(defined _MSC_VER)
 
 #error "This is not a C++11 compiler"
 
@@ -518,7 +532,7 @@ namespace cxx14
 
   }
 
-  namespace test_digit_seperators
+  namespace test_digit_separators
   {
 
     constexpr auto ten_million = 100'000'000;
@@ -560,3 +574,409 @@ namespace cxx14
 #endif  // __cplusplus >= 201402L
 
 ]])
+
+
+dnl  Tests for new features in C++17
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
+
+// If the compiler admits that it is not ready for C++17, why torture it?
+// Hopefully, this will speed up the test.
+
+#ifndef __cplusplus
+
+#error "This is not a C++ compiler"
+
+#elif __cplusplus <= 201402L
+
+#error "This is not a C++17 compiler"
+
+#else
+
+#if defined(__clang__)
+  #define REALLY_CLANG
+#else
+  #if defined(__GNUC__)
+    #define REALLY_GCC
+  #endif
+#endif
+
+#include <initializer_list>
+#include <utility>
+#include <type_traits>
+
+namespace cxx17
+{
+
+#if !defined(REALLY_CLANG)
+  namespace test_constexpr_lambdas
+  {
+
+    // TODO: test it with clang++ from git
+
+    constexpr int foo = [](){return 42;}();
+
+  }
+#endif // !defined(REALLY_CLANG)
+
+  namespace test::nested_namespace::definitions
+  {
+
+  }
+
+  namespace test_fold_expression
+  {
+
+    template<typename... Args>
+    int multiply(Args... args)
+    {
+      return (args * ... * 1);
+    }
+
+    template<typename... Args>
+    bool all(Args... args)
+    {
+      return (args && ...);
+    }
+
+  }
+
+  namespace test_extended_static_assert
+  {
+
+    static_assert (true);
+
+  }
+
+  namespace test_auto_brace_init_list
+  {
+
+    auto foo = {5};
+    auto bar {5};
+
+    static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value);
+    static_assert(std::is_same<int, decltype(bar)>::value);
+  }
+
+  namespace test_typename_in_template_template_parameter
+  {
+
+    template<template<typename> typename X> struct D;
+
+  }
+
+  namespace test_fallthrough_nodiscard_maybe_unused_attributes
+  {
+
+    int f1()
+    {
+      return 42;
+    }
+
+    [[nodiscard]] int f2()
+    {
+      [[maybe_unused]] auto unused = f1();
+
+      switch (f1())
+      {
+      case 17:
+        f1();
+        [[fallthrough]];
+      case 42:
+        f1();
+      }
+      return f1();
+    }
+
+  }
+
+  namespace test_extended_aggregate_initialization
+  {
+
+    struct base1
+    {
+      int b1, b2 = 42;
+    };
+
+    struct base2
+    {
+      base2() {
+        b3 = 42;
+      }
+      int b3;
+    };
+
+    struct derived : base1, base2
+    {
+        int d;
+    };
+
+    derived d1 {{1, 2}, {}, 4};  // full initialization
+    derived d2 {{}, {}, 4};      // value-initialized bases
+
+  }
+
+  namespace test_general_range_based_for_loop
+  {
+
+    struct iter
+    {
+      int i;
+
+      int& operator* ()
+      {
+        return i;
+      }
+
+      const int& operator* () const
+      {
+        return i;
+      }
+
+      iter& operator++()
+      {
+        ++i;
+        return *this;
+      }
+    };
+
+    struct sentinel
+    {
+      int i;
+    };
+
+    bool operator== (const iter& i, const sentinel& s)
+    {
+      return i.i == s.i;
+    }
+
+    bool operator!= (const iter& i, const sentinel& s)
+    {
+      return !(i == s);
+    }
+
+    struct range
+    {
+      iter begin() const
+      {
+        return {0};
+      }
+
+      sentinel end() const
+      {
+        return {5};
+      }
+    };
+
+    void f()
+    {
+      range r {};
+
+      for (auto i : r)
+      {
+        [[maybe_unused]] auto v = i;
+      }
+    }
+
+  }
+
+  namespace test_lambda_capture_asterisk_this_by_value
+  {
+
+    struct t
+    {
+      int i;
+      int foo()
+      {
+        return [*this]()
+        {
+          return i;
+        }();
+      }
+    };
+
+  }
+
+  namespace test_enum_class_construction
+  {
+
+    enum class byte : unsigned char
+    {};
+
+    byte foo {42};
+
+  }
+
+  namespace test_constexpr_if
+  {
+
+    template <bool cond>
+    int f ()
+    {
+      if constexpr(cond)
+      {
+        return 13;
+      }
+      else
+      {
+        return 42;
+      }
+    }
+
+  }
+
+  namespace test_selection_statement_with_initializer
+  {
+
+    int f()
+    {
+      return 13;
+    }
+
+    int f2()
+    {
+      if (auto i = f(); i > 0)
+      {
+        return 3;
+      }
+
+      switch (auto i = f(); i + 4)
+      {
+      case 17:
+        return 2;
+
+      default:
+        return 1;
+      }
+    }
+
+  }
+
+#if !defined(REALLY_CLANG)
+  namespace test_template_argument_deduction_for_class_templates
+  {
+
+    // TODO: test it with clang++ from git
+
+    template <typename T1, typename T2>
+    struct pair
+    {
+      pair (T1 p1, T2 p2)
+        : m1 {p1},
+          m2 {p2}
+      {}
+
+      T1 m1;
+      T2 m2;
+    };
+
+    void f()
+    {
+      [[maybe_unused]] auto p = pair{13, 42u};
+    }
+
+  }
+#endif // !defined(REALLY_CLANG)
+
+  namespace test_non_type_auto_template_parameters
+  {
+
+    template <auto n>
+    struct B
+    {};
+
+    B<5> b1;
+    B<'a'> b2;
+
+  }
+
+#if !defined(REALLY_CLANG)
+  namespace test_structured_bindings
+  {
+
+    // TODO: test it with clang++ from git
+
+    int arr[2] = { 1, 2 };
+    std::pair<int, int> pr = { 1, 2 };
+
+    auto f1() -> int(&)[2]
+    {
+      return arr;
+    }
+
+    auto f2() -> std::pair<int, int>&
+    {
+      return pr;
+    }
+
+    struct S
+    {
+      int x1 : 2;
+      volatile double y1;
+    };
+
+    S f3()
+    {
+      return {};
+    }
+
+    auto [ x1, y1 ] = f1();
+    auto& [ xr1, yr1 ] = f1();
+    auto [ x2, y2 ] = f2();
+    auto& [ xr2, yr2 ] = f2();
+    const auto [ x3, y3 ] = f3();
+
+  }
+#endif // !defined(REALLY_CLANG)
+
+#if !defined(REALLY_CLANG)
+  namespace test_exception_spec_type_system
+  {
+
+    // TODO: test it with clang++ from git
+
+    struct Good {};
+    struct Bad {};
+
+    void g1() noexcept;
+    void g2();
+
+    template<typename T>
+    Bad
+    f(T*, T*);
+
+    template<typename T1, typename T2>
+    Good
+    f(T1*, T2*);
+
+    static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
+
+  }
+#endif // !defined(REALLY_CLANG)
+
+  namespace test_inline_variables
+  {
+
+    template<class T> void f(T)
+    {}
+
+    template<class T> inline T g(T)
+    {
+      return T{};
+    }
+
+    template<> inline void f<>(int)
+    {}
+
+    template<> int g<>(int)
+    {
+      return 5;
+    }
+
+  }
+
+}  // namespace cxx17
+
+#endif  // __cplusplus <= 201402L
+
+]])
diff --git a/m4/ax_cxx_compile_stdcxx_11.m4 b/m4/ax_cxx_compile_stdcxx_11.m4
index 0aadeaf..1733fd8 100644
--- a/m4/ax_cxx_compile_stdcxx_11.m4
+++ b/m4/ax_cxx_compile_stdcxx_11.m4
@@ -1,6 +1,6 @@
-# ============================================================================
-#  http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
-# ============================================================================
+# =============================================================================
+#  https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
+# =============================================================================
 #
 # SYNOPSIS
 #
@@ -33,7 +33,7 @@
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 17
+#serial 18
 
 AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX])
 AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])])
diff --git a/m4/dlp_fallthrough.m4 b/m4/dlp_fallthrough.m4
new file mode 100644
index 0000000..99e6be5
--- /dev/null
+++ b/m4/dlp_fallthrough.m4
@@ -0,0 +1,65 @@
+#
+# SYNOPSIS
+#
+#   DLP_FALLTHROUGH
+#
+# DESCRIPTION
+#
+#   This macro checks if the compiler supports a fallthrough warning
+#   suppression attribute in GCC or CLANG style.
+#
+#   If a fallthrough warning suppression attribute is supported define
+#   HAVE_<STYLE>_ATTRIBUTE_FALLTHROUGH.
+#
+#   The macro caches its result in ax_cv_have_<style>_attribute_fallthrough
+#   variables.
+#
+# LICENSE
+#
+#   Copyright (c) 2017 David Tardon <dtardon at redhat.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.  This file is offered as-is, without any
+#   warranty.
+
+#serial 1
+
+m4_defun([_DLP_FALLTHROUGH], [
+    AS_VAR_PUSHDEF([ac_var], [ax_cv_have_$2_attribute_falltrough])
+
+    AC_CACHE_CHECK([for $1], [ac_var], [
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([
+                void foo(int &i)
+                {
+                    switch (i)
+                    {
+                        case 0:
+                            i += 1;
+                            $1;
+                        default:
+                            i += 1;
+                    }
+                }
+            ], [])
+            ],
+            dnl GCC doesn't exit with an error if an unknown attribute is
+            dnl provided but only outputs a warning, so accept the attribute
+            dnl only if no warning were issued.
+            [AS_IF([test -s conftest.err],
+                [AS_VAR_SET([ac_var], [no])],
+                [AS_VAR_SET([ac_var], [yes])])],
+            [AS_VAR_SET([ac_var], [no])])
+    ])
+
+    AS_IF([test yes = AS_VAR_GET([ac_var])],
+        [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$3_ATTRIBUTE_FALLTHROUGH), 1,
+            [Define to 1 if the system has the $4-style `fallthrough' attribute])], [])
+
+    AS_VAR_POPDEF([ac_var])
+])
+
+AC_DEFUN([DLP_FALLTHROUGH], [
+    _DLP_FALLTHROUGH([[__attribute__((fallthrough))]], [gcc], [GCC], [GNU])
+    _DLP_FALLTHROUGH([[[[clang:fallthrough]]]], [clang], [CLANG], [clang])
+])
diff --git a/src/Makefile.am b/src/Makefile.am
index 57fbb84..70b9242 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,6 +4,10 @@ if BUILD_TOOLS
 SUBDIRS += conv
 endif
 
+if BUILD_FUZZERS
+SUBDIRS += fuzz
+endif
+
 if TESTS
 SUBDIRS += test
 endif
diff --git a/src/Makefile.in b/src/Makefile.in
index ac10866..58f7abd 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -88,12 +88,14 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 @BUILD_TOOLS_TRUE at am__append_1 = conv
- at TESTS_TRUE@am__append_2 = test
+ at BUILD_FUZZERS_TRUE@am__append_2 = fuzz
+ at TESTS_TRUE@am__append_3 = test
 subdir = src
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
 	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
 	$(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
+	$(top_srcdir)/m4/dlp_fallthrough.m4 \
 	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
 	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
 	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
@@ -158,7 +160,7 @@ am__define_uniq_tagged_files = \
   done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
-DIST_SUBDIRS = lib conv test
+DIST_SUBDIRS = lib conv fuzz test
 am__DIST_COMMON = $(srcdir)/Makefile.in
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 am__relativize = \
@@ -223,7 +225,6 @@ FGREP = @FGREP@
 GREP = @GREP@
 HAVE_CXX11 = @HAVE_CXX11@
 ICU_CFLAGS = @ICU_CFLAGS@
-ICU_CONFIG = @ICU_CONFIG@
 ICU_LIBS = @ICU_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
@@ -339,7 +340,7 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-SUBDIRS = lib $(am__append_1) $(am__append_2)
+SUBDIRS = lib $(am__append_1) $(am__append_2) $(am__append_3)
 all: all-recursive
 
 .SUFFIXES:
diff --git a/src/conv/Makefile.in b/src/conv/Makefile.in
index dd12018..4b4ea1a 100644
--- a/src/conv/Makefile.in
+++ b/src/conv/Makefile.in
@@ -92,6 +92,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
 	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
 	$(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
+	$(top_srcdir)/m4/dlp_fallthrough.m4 \
 	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
 	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
 	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
@@ -221,7 +222,6 @@ FGREP = @FGREP@
 GREP = @GREP@
 HAVE_CXX11 = @HAVE_CXX11@
 ICU_CFLAGS = @ICU_CFLAGS@
-ICU_CONFIG = @ICU_CONFIG@
 ICU_LIBS = @ICU_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
diff --git a/src/conv/raw/Makefile.in b/src/conv/raw/Makefile.in
index c1364a7..a7f6d72 100644
--- a/src/conv/raw/Makefile.in
+++ b/src/conv/raw/Makefile.in
@@ -94,6 +94,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
 	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
 	$(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
+	$(top_srcdir)/m4/dlp_fallthrough.m4 \
 	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
 	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
 	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
@@ -213,7 +214,6 @@ FGREP = @FGREP@
 GREP = @GREP@
 HAVE_CXX11 = @HAVE_CXX11@
 ICU_CFLAGS = @ICU_CFLAGS@
-ICU_CONFIG = @ICU_CONFIG@
 ICU_LIBS = @ICU_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
diff --git a/src/conv/svg/Makefile.in b/src/conv/svg/Makefile.in
index 11a8d5a..d34e5f7 100644
--- a/src/conv/svg/Makefile.in
+++ b/src/conv/svg/Makefile.in
@@ -94,6 +94,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
 	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
 	$(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
+	$(top_srcdir)/m4/dlp_fallthrough.m4 \
 	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
 	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
 	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
@@ -213,7 +214,6 @@ FGREP = @FGREP@
 GREP = @GREP@
 HAVE_CXX11 = @HAVE_CXX11@
 ICU_CFLAGS = @ICU_CFLAGS@
-ICU_CONFIG = @ICU_CONFIG@
 ICU_LIBS = @ICU_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
diff --git a/src/fuzz/Makefile.am b/src/fuzz/Makefile.am
new file mode 100644
index 0000000..5ef91b9
--- /dev/null
+++ b/src/fuzz/Makefile.am
@@ -0,0 +1,24 @@
+noinst_PROGRAMS = bmifuzzer zmffuzzer
+
+AM_CXXFLAGS = -I$(top_srcdir)/inc \
+	$(REVENGE_GENERATORS_CFLAGS) \
+	$(REVENGE_CFLAGS) \
+	$(REVENGE_STREAM_CFLAGS) \
+	$(DEBUG_CXXFLAGS)
+
+commonfuzzer_ldadd = \
+	$(top_builddir)/src/lib/libzmf- at ZMF_MAJOR_VERSION@. at ZMF_MINOR_VERSION@.la \
+	$(REVENGE_GENERATORS_LIBS) \
+	$(REVENGE_LIBS) \
+	$(REVENGE_STREAM_LIBS) \
+	-lFuzzingEngine
+
+bmifuzzer_LDADD = $(commonfuzzer_ldadd)
+
+bmifuzzer_SOURCES = \
+	bmifuzzer.cpp
+
+zmffuzzer_LDADD = $(commonfuzzer_ldadd)
+
+zmffuzzer_SOURCES = \
+	zmffuzzer.cpp
diff --git a/src/conv/svg/Makefile.in b/src/fuzz/Makefile.in
similarity index 80%
copy from src/conv/svg/Makefile.in
copy to src/fuzz/Makefile.in
index 11a8d5a..a2ebed4 100644
--- a/src/conv/svg/Makefile.in
+++ b/src/fuzz/Makefile.in
@@ -88,12 +88,13 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-bin_PROGRAMS = zmf2svg$(EXEEXT)
-subdir = src/conv/svg
+noinst_PROGRAMS = bmifuzzer$(EXEEXT) zmffuzzer$(EXEEXT)
+subdir = src/fuzz
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
 	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
 	$(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
+	$(top_srcdir)/m4/dlp_fallthrough.m4 \
 	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
 	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
 	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
@@ -102,17 +103,23 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES = zmf2svg.rc
+CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-am__installdirs = "$(DESTDIR)$(bindir)"
-PROGRAMS = $(bin_PROGRAMS)
-am_zmf2svg_OBJECTS = zmf2svg.$(OBJEXT)
-zmf2svg_OBJECTS = $(am_zmf2svg_OBJECTS)
+PROGRAMS = $(noinst_PROGRAMS)
+am_bmifuzzer_OBJECTS = bmifuzzer.$(OBJEXT)
+bmifuzzer_OBJECTS = $(am_bmifuzzer_OBJECTS)
 am__DEPENDENCIES_1 =
+am__DEPENDENCIES_2 = $(top_builddir)/src/lib/libzmf- at ZMF_MAJOR_VERSION@. at ZMF_MINOR_VERSION@.la \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
+bmifuzzer_DEPENDENCIES = $(am__DEPENDENCIES_2)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
+am_zmffuzzer_OBJECTS = zmffuzzer.$(OBJEXT)
+zmffuzzer_OBJECTS = $(am_zmffuzzer_OBJECTS)
+zmffuzzer_DEPENDENCIES = $(am__DEPENDENCIES_2)
 AM_V_P = $(am__v_P_ at AM_V@)
 am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -147,8 +154,8 @@ AM_V_CXXLD = $(am__v_CXXLD_ at AM_V@)
 am__v_CXXLD_ = $(am__v_CXXLD_ at AM_DEFAULT_V@)
 am__v_CXXLD_0 = @echo "  CXXLD   " $@;
 am__v_CXXLD_1 = 
-SOURCES = $(zmf2svg_SOURCES)
-DIST_SOURCES = $(zmf2svg_SOURCES)
+SOURCES = $(bmifuzzer_SOURCES) $(zmffuzzer_SOURCES)
+DIST_SOURCES = $(bmifuzzer_SOURCES) $(zmffuzzer_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -173,8 +180,7 @@ am__define_uniq_tagged_files = \
   done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
-am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/zmf2svg.rc.in \
-	$(top_srcdir)/depcomp
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -213,7 +219,6 @@ FGREP = @FGREP@
 GREP = @GREP@
 HAVE_CXX11 = @HAVE_CXX11@
 ICU_CFLAGS = @ICU_CFLAGS@
-ICU_CONFIG = @ICU_CONFIG@
 ICU_LIBS = @ICU_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
@@ -329,20 +334,26 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CXXFLAGS = -I$(top_srcdir)/inc $(REVENGE_CFLAGS) $(REVENGE_GENERATORS_CFLAGS) $(REVENGE_STREAM_CFLAGS) $(DEBUG_CXXFLAGS)
-zmf2svg_DEPENDENCIES = @ZMF2SVG_WIN32_RESOURCE@
-zmf2svg_LDADD = ../../lib/libzmf- at ZMF_MAJOR_VERSION@. at ZMF_MINOR_VERSION@.la $(REVENGE_LIBS) $(REVENGE_GENERATORS_LIBS) $(REVENGE_STREAM_LIBS) @ZMF2SVG_WIN32_RESOURCE@ 
-zmf2svg_SOURCES = \
-	zmf2svg.cpp
-
-EXTRA_DIST = \
-	$(zmf2svg_SOURCES) \
-	zmf2svg.rc.in
-
-
-# These may be in the builddir too
-BUILD_EXTRA_DIST = \
-	zmf2svg.rc
+AM_CXXFLAGS = -I$(top_srcdir)/inc \
+	$(REVENGE_GENERATORS_CFLAGS) \
+	$(REVENGE_CFLAGS) \
+	$(REVENGE_STREAM_CFLAGS) \
+	$(DEBUG_CXXFLAGS)
+
+commonfuzzer_ldadd = \
+	$(top_builddir)/src/lib/libzmf- at ZMF_MAJOR_VERSION@. at ZMF_MINOR_VERSION@.la \
+	$(REVENGE_GENERATORS_LIBS) \
+	$(REVENGE_LIBS) \
+	$(REVENGE_STREAM_LIBS) \
+	-lFuzzingEngine
+
+bmifuzzer_LDADD = $(commonfuzzer_ldadd)
+bmifuzzer_SOURCES = \
+	bmifuzzer.cpp
+
+zmffuzzer_LDADD = $(commonfuzzer_ldadd)
+zmffuzzer_SOURCES = \
+	zmffuzzer.cpp
 
 all: all-am
 
@@ -357,9 +368,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/conv/svg/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/fuzz/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign src/conv/svg/Makefile
+	  $(AUTOMAKE) --foreign src/fuzz/Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
@@ -377,51 +388,9 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-zmf2svg.rc: $(top_builddir)/config.status $(srcdir)/zmf2svg.rc.in
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-install-binPROGRAMS: $(bin_PROGRAMS)
-	@$(NORMAL_INSTALL)
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	if test -n "$$list"; then \
-	  echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
-	  $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
-	fi; \
-	for p in $$list; do echo "$$p $$p"; done | \
-	sed 's/$(EXEEXT)$$//' | \
-	while read p p1; do if test -f $$p \
-	 || test -f $$p1 \
-	  ; then echo "$$p"; echo "$$p"; else :; fi; \
-	done | \
-	sed -e 'p;s,.*/,,;n;h' \
-	    -e 's|.*|.|' \
-	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
-	sed 'N;N;N;s,\n, ,g' | \
-	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
-	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
-	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
-	    else { print "f", $$3 "/" $$4, $$1; } } \
-	  END { for (d in files) print "f", d, files[d] }' | \
-	while read type dir files; do \
-	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
-	    test -z "$$files" || { \
-	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
-	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
-	    } \
-	; done
-
-uninstall-binPROGRAMS:
-	@$(NORMAL_UNINSTALL)
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	files=`for p in $$list; do echo "$$p"; done | \
-	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-	      -e 's/$$/$(EXEEXT)/' \
-	`; \
-	test -n "$$list" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(bindir)" && rm -f $$files
-
-clean-binPROGRAMS:
-	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
 	echo " rm -f" $$list; \
 	rm -f $$list || exit $$?; \
 	test -n "$(EXEEXT)" || exit 0; \
@@ -429,9 +398,13 @@ clean-binPROGRAMS:
 	echo " rm -f" $$list; \
 	rm -f $$list
 
-zmf2svg$(EXEEXT): $(zmf2svg_OBJECTS) $(zmf2svg_DEPENDENCIES) $(EXTRA_zmf2svg_DEPENDENCIES) 
-	@rm -f zmf2svg$(EXEEXT)
-	$(AM_V_CXXLD)$(CXXLINK) $(zmf2svg_OBJECTS) $(zmf2svg_LDADD) $(LIBS)
+bmifuzzer$(EXEEXT): $(bmifuzzer_OBJECTS) $(bmifuzzer_DEPENDENCIES) $(EXTRA_bmifuzzer_DEPENDENCIES) 
+	@rm -f bmifuzzer$(EXEEXT)
+	$(AM_V_CXXLD)$(CXXLINK) $(bmifuzzer_OBJECTS) $(bmifuzzer_LDADD) $(LIBS)
+
+zmffuzzer$(EXEEXT): $(zmffuzzer_OBJECTS) $(zmffuzzer_DEPENDENCIES) $(EXTRA_zmffuzzer_DEPENDENCIES) 
+	@rm -f zmffuzzer$(EXEEXT)
+	$(AM_V_CXXLD)$(CXXLINK) $(zmffuzzer_OBJECTS) $(zmffuzzer_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -439,7 +412,8 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/zmf2svg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bmifuzzer.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/zmffuzzer.Po at am__quote@
 
 .cpp.o:
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -554,9 +528,6 @@ check-am: all-am
 check: check-am
 all-am: Makefile $(PROGRAMS)
 installdirs:
-	for dir in "$(DESTDIR)$(bindir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
@@ -589,7 +560,8 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+	mostlyclean-am
 
 distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
@@ -615,7 +587,7 @@ install-dvi: install-dvi-am
 
 install-dvi-am:
 
-install-exec-am: install-binPROGRAMS
+install-exec-am:
 
 install-html: install-html-am
 
@@ -655,31 +627,27 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-binPROGRAMS
+uninstall-am:
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
-	clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \
-	ctags ctags-am distclean distclean-compile distclean-generic \
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \
+	ctags-am distclean distclean-compile distclean-generic \
 	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-binPROGRAMS \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
-	install-info install-info-am install-man install-pdf \
-	install-pdf-am install-ps install-ps-am install-strip \
-	installcheck installcheck-am installdirs maintainer-clean \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags tags-am uninstall uninstall-am uninstall-binPROGRAMS
+	tags tags-am uninstall uninstall-am
 
 .PRECIOUS: Makefile
 
 
- at OS_WIN32_TRUE@@ZMF2SVG_WIN32_RESOURCE@ : zmf2svg.rc $(zmf2svg_OBJECTS)
- at OS_WIN32_TRUE@	chmod +x $(top_srcdir)/build/win32/*compile-resource
- at OS_WIN32_TRUE@	WINDRES=@WINDRES@ $(top_srcdir)/build/win32/lt-compile-resource zmf2svg.rc @ZMF2SVG_WIN32_RESOURCE@
-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/fuzz/bmifuzzer.cpp b/src/fuzz/bmifuzzer.cpp
new file mode 100644
index 0000000..56f0860
--- /dev/null
+++ b/src/fuzz/bmifuzzer.cpp
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * This file is part of the libzmf project.
+ *
+ * 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/.
+ */
+
+#include <cstdint>
+#include <cstdlib>
+
+#include <librevenge-generators/librevenge-generators.h>
+
+#include <librevenge-stream/librevenge-stream.h>
+
+#include <libzmf/libzmf.h>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+  librevenge::RVNGStringStream input(data, size);
+  librevenge::RVNGRawDrawingGenerator generator(true);
+  libzmf::ZMFDocument::parse(&input, &generator);
+  return 0;
+}
+
+/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/fuzz/zmffuzzer.cpp b/src/fuzz/zmffuzzer.cpp
new file mode 100644
index 0000000..56f0860
--- /dev/null
+++ b/src/fuzz/zmffuzzer.cpp
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * This file is part of the libzmf project.
+ *
+ * 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/.
+ */
+
+#include <cstdint>
+#include <cstdlib>
+
+#include <librevenge-generators/librevenge-generators.h>
+
+#include <librevenge-stream/librevenge-stream.h>
+
+#include <libzmf/libzmf.h>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+  librevenge::RVNGStringStream input(data, size);
+  librevenge::RVNGRawDrawingGenerator generator(true);
+  libzmf::ZMFDocument::parse(&input, &generator);
+  return 0;
+}
+
+/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/BMIHeader.cpp b/src/lib/BMIHeader.cpp
index 3c98ddd..31a502e 100644
--- a/src/lib/BMIHeader.cpp
+++ b/src/lib/BMIHeader.cpp
@@ -34,8 +34,7 @@ bool BMIHeader::load(const RVNGInputStreamPtr &input)
   m_startOffset = input->tell();
 
   unsigned sigLen = 9;
-  auto sigBytes = readNBytes(input, sigLen);
-  m_signature = std::string(sigBytes, sigBytes + sigLen);
+  m_signature.assign(reinterpret_cast<const char *>(readNBytes(input, sigLen)), sigLen);
 
   m_width = readU16(input);
   m_height = readU16(input);
@@ -43,6 +42,11 @@ bool BMIHeader::load(const RVNGInputStreamPtr &input)
   m_isPaletteMode = static_cast<bool>(readU16(input));
 
   m_colorDepth = readU16(input);
+  if (!(m_colorDepth == 1 || m_colorDepth == 4 || m_colorDepth == 8 || m_colorDepth == 24))
+  {
+    ZMF_DEBUG_MSG(("Invalid color depth %d\n", m_colorDepth));
+    return false;
+  }
 
   skip(input, 2);
 
@@ -143,6 +147,43 @@ void BMIHeader::readOffsets(const RVNGInputStreamPtr &input, uint16_t offsetCoun
   }
 }
 
+namespace
+{
+
+bool reconcileValue(unsigned &v1, unsigned &v2, unsigned &v3)
+{
+  if (v1 == v2)
+  {
+    if (v2 != v3)
+      v3 = v1;
+  }
+  else if (v1 == v3)
+  {
+    v2 = v1;
+  }
+  else if (v2 == v3)
+  {
+    v1 = v2;
+  }
+  else
+  {
+    return false;
+  }
+  return true;
+}
+
+}
+
+bool BMIHeader::reconcileWidth(unsigned &colorWidth, unsigned &transparencyWidth)
+{
+  return reconcileValue(m_width, colorWidth, transparencyWidth);
+}
+
+bool BMIHeader::reconcileHeight(unsigned &colorHeight, unsigned &transparencyHeight)
+{
+  return reconcileValue(m_height, colorHeight, transparencyHeight);
+}
+
 }
 
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/BMIHeader.h b/src/lib/BMIHeader.h
index e3f8ddc..e384a71 100644
--- a/src/lib/BMIHeader.h
+++ b/src/lib/BMIHeader.h
@@ -41,6 +41,9 @@ public:
 
   const std::vector<BMIOffset> &offsets() const;
 
+  bool reconcileWidth(unsigned &colorWidth, unsigned &transparencyWidth);
+  bool reconcileHeight(unsigned &colorHeight, unsigned &transparencyHeight);
+
 private:
   void readOffsets(const RVNGInputStreamPtr &input, uint16_t offsetCount);
 
diff --git a/src/lib/BMIParser.cpp b/src/lib/BMIParser.cpp
index 46ed5e6..f7bc946 100644
--- a/src/lib/BMIParser.cpp
+++ b/src/lib/BMIParser.cpp
@@ -17,6 +17,8 @@
 #include <utility>
 #include <vector>
 
+#include <boost/optional.hpp>
+
 #include <png.h>
 
 #include <zlib.h>
@@ -76,8 +78,9 @@ bool uncompress(const uint8_t *compressedData, unsigned size, std::vector<uint8_
     case Z_OK:
       break;
     default:
-      data.clear();
-    // fall-through intended
+      // abandon partially uncompressed data on error
+      strm.total_out = 0;
+      ZMF_FALLTHROUGH;
     case Z_STREAM_END:
       done = true;
       break;
@@ -94,6 +97,11 @@ bool uncompress(const uint8_t *compressedData, unsigned size, std::vector<uint8_
   return true;
 }
 
+}
+
+namespace
+{
+
 extern "C" void pngWriteCallback(png_structp png, png_bytep data, png_size_t length) try
 {
   auto p = reinterpret_cast<RVNGBinaryData *>(png_get_io_ptr(png));
@@ -296,6 +304,49 @@ catch (const PNGWriter::Error &error)
 
 }
 
+struct BMIParser::ColorBitmapHeader
+{
+  ColorBitmapHeader();
+
+  void parse(const RVNGInputStreamPtr &input, const BMIHeader &header, const BMIOffset &offset);
+
+  unsigned m_width;
+  unsigned m_height;
+  unsigned m_colorDepth;
+  unsigned m_startOffset;
+  unsigned m_endOffset;
+};
+
+BMIParser::ColorBitmapHeader::ColorBitmapHeader()
+  : m_width(0)
+  , m_height(0)
+  , m_colorDepth(0)
+  , m_startOffset(0)
+  , m_endOffset(0)
+{
+}
+
+void BMIParser::ColorBitmapHeader::parse(const RVNGInputStreamPtr &input, const BMIHeader &header, const BMIOffset &offset)
+{
+  seek(input, header.startOffset() + offset.start);
+  m_endOffset = header.startOffset() + offset.end;
+
+  m_width = readU16(input);
+  m_height = readU16(input);
+
+  const unsigned colorDepth = readU16(input);
+  if (colorDepth <= 1)
+    m_colorDepth = 1;
+  else if (colorDepth <= 4)
+    m_colorDepth = 4;
+  else if (colorDepth <= 8)
+    m_colorDepth = 8;
+  else
+    m_colorDepth = 24;
+
+  m_startOffset = unsigned(static_cast<unsigned long>(input->tell()) + 10);
+}
+
 BMIParser::BMIParser(const RVNGInputStreamPtr &input, librevenge::RVNGDrawingInterface *const painter)
   : m_input(input)
   , m_painter(painter)
@@ -330,25 +381,41 @@ Image BMIParser::readImage()
   if (!m_header.load(m_input) || !m_header.isSupported())
     return Image();
 
-  ColorBitmap bitmap;
-  ColorBitmap transparencyBitmap;
+  boost::optional<ColorBitmapHeader> bitmapHeader;
+  boost::optional<ColorBitmapHeader> transparencyBitmapHeader;
 
   for (const auto &offset : m_header.offsets())
   {
     if (offset.type == BMIStreamType::BITMAP)
     {
-      if (bitmap.data.empty())
+      if (!bitmapHeader)
       {
-        bitmap = readColorBitmap(offset);
+        bitmapHeader = ColorBitmapHeader();
+        bitmapHeader->parse(m_input, m_header, offset);
       }
-      else if (transparencyBitmap.data.empty())
+      else if (!transparencyBitmapHeader)
       {
-        transparencyBitmap = readColorBitmap(offset);
+        transparencyBitmapHeader = ColorBitmapHeader();
+        transparencyBitmapHeader->parse(m_input, m_header, offset);
       }
     }
   }
 
-  if (bitmap.data.empty())
+  if (!bitmapHeader)
+    return Image();
+
+  if (transparencyBitmapHeader)
+  {
+    if (!reconcileDimensions(get(bitmapHeader), get(transparencyBitmapHeader)))
+      return Image();
+  }
+
+  ColorBitmap bitmap = readColorBitmap(get(bitmapHeader));
+  ColorBitmap transparencyBitmap;
+  if (transparencyBitmapHeader)
+    transparencyBitmap = readColorBitmap(get(transparencyBitmapHeader));
+
+  if (bitmap.width == 0 || bitmap.height == 0)
     return Image();
 
   Image result;
@@ -367,32 +434,24 @@ const BMIHeader &BMIParser::header() const
   return m_header;
 }
 
-ColorBitmap BMIParser::readColorBitmap(BMIOffset offset)
+ColorBitmap BMIParser::readColorBitmap(const BMIParser::ColorBitmapHeader &hdr)
 {
-  seek(m_input, m_header.startOffset() + offset.start);
-  unsigned endOffset = m_header.startOffset() + offset.end;
-
   ColorBitmap bitmap;
 
-  bitmap.width = readU16(m_input);
-  bitmap.height = readU16(m_input);
-
-  auto colorDepth = readU16(m_input);
-
-  if (colorDepth != 1 && colorDepth != 4 && colorDepth != 8 && colorDepth != 24)
-    return ColorBitmap();
+  bitmap.width = hdr.m_width;
+  bitmap.height = hdr.m_height;
 
-  skip(m_input, 10);
+  seek(m_input, hdr.m_startOffset);
 
   std::vector<Color> colorPalette;
-  if (colorDepth < 24)
+  if (hdr.m_colorDepth < 24)
   {
-    colorPalette = readColorPalette(colorDepth);
+    colorPalette = readColorPalette(hdr.m_colorDepth);
   }
 
-  auto data = readData(endOffset);
+  auto data = readData(hdr.m_endOffset);
 
-  unsigned lineBitCount = bitmap.width * colorDepth;
+  unsigned lineBitCount = bitmap.width * hdr.m_colorDepth;
 
   unsigned lineWidth = lineBitCount / 8;
   if (lineBitCount % 8 != 0)
@@ -404,7 +463,7 @@ ColorBitmap BMIParser::readColorBitmap(BMIOffset offset)
 
   lineWidth += padding;
 
-  unsigned shift = 8 - std::min<uint16_t>(colorDepth, 8);
+  unsigned shift = 8 - std::min<uint16_t>(hdr.m_colorDepth, 8);
   unsigned mask = (0xff >> shift) << shift;
 
   if (data.size() < bitmap.height * lineWidth)
@@ -420,7 +479,7 @@ ColorBitmap BMIParser::readColorBitmap(BMIOffset offset)
 
     while (col < bitmap.width)
     {
-      if (colorDepth == 24)
+      if (hdr.m_colorDepth == 24)
       {
         Color color;
         color.blue = data[i++];
@@ -434,13 +493,13 @@ ColorBitmap BMIParser::readColorBitmap(BMIOffset offset)
       else
       {
         uint8_t indexes = data[i++];
-        for (unsigned j = 0; j < 8 / colorDepth; j++)
+        for (unsigned j = 0; j < 8 / hdr.m_colorDepth; j++)
         {
           uint8_t index = (indexes & mask) >> shift;
 
           bitmap.data.push_back(colorPalette[index]);
 
-          indexes = indexes << colorDepth;
+          indexes = indexes << hdr.m_colorDepth;
 
           col++;
           if (col == bitmap.width)
@@ -493,6 +552,12 @@ std::vector<Color> BMIParser::readColorPalette(unsigned colorDepth)
   return colors;
 }
 
+bool BMIParser::reconcileDimensions(BMIParser::ColorBitmapHeader &colorHeader, BMIParser::ColorBitmapHeader &transparencyHeader)
+{
+  return m_header.reconcileWidth(colorHeader.m_width, transparencyHeader.m_width)
+         && m_header.reconcileHeight(colorHeader.m_height, transparencyHeader.m_height);
+}
+
 }
 
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/BMIParser.h b/src/lib/BMIParser.h
index 1c348b3..c87ba15 100644
--- a/src/lib/BMIParser.h
+++ b/src/lib/BMIParser.h
@@ -23,8 +23,10 @@ namespace libzmf
 class BMIParser
 {
   // disable copying
-  BMIParser(const BMIParser &other);
-  BMIParser &operator=(const BMIParser &other);
+  BMIParser(const BMIParser &other) = delete;
+  BMIParser &operator=(const BMIParser &other) = delete;
+
+  struct ColorBitmapHeader;
 
 public:
   explicit BMIParser(const RVNGInputStreamPtr &input, librevenge::RVNGDrawingInterface *painter = 0);
@@ -40,12 +42,14 @@ public:
   const BMIHeader &header() const;
 
 private:
-  ColorBitmap readColorBitmap(BMIOffset offset);
+  ColorBitmap readColorBitmap(const ColorBitmapHeader &header);
 
   std::vector<uint8_t> readData(unsigned endOffset);
 
   std::vector<Color> readColorPalette(unsigned colorDepth);
 
+  bool reconcileDimensions(ColorBitmapHeader &colorHeader, ColorBitmapHeader &transparencyHeader);
+
   const RVNGInputStreamPtr m_input;
   librevenge::RVNGDrawingInterface *m_painter;
 
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index ab6fc44..e49c830 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -11,7 +11,7 @@ AM_CXXFLAGS = -I$(top_srcdir)/inc $(REVENGE_CFLAGS) $(REVENGE_STREAM_CFLAGS) $(Z
 
 libzmf_ at ZMF_MAJOR_VERSION@_ at ZMF_MINOR_VERSION@_la_LIBADD = libzmf_internal.la $(REVENGE_LIBS) $(ZLIB_LIBS) $(LIBPNG_LIBS) $(ICU_LIBS) @LIBZMF_WIN32_RESOURCE@
 libzmf_ at ZMF_MAJOR_VERSION@_ at ZMF_MINOR_VERSION@_la_DEPENDENCIES = libzmf_internal.la @LIBZMF_WIN32_RESOURCE@
-libzmf_ at ZMF_MAJOR_VERSION@_ at ZMF_MINOR_VERSION@_la_LDFLAGS = $(version_info) -export-dynamic -no-undefines
+libzmf_ at ZMF_MAJOR_VERSION@_ at ZMF_MINOR_VERSION@_la_LDFLAGS = $(version_info) -export-dynamic -no-undefined
 libzmf_ at ZMF_MAJOR_VERSION@_ at ZMF_MINOR_VERSION@_la_SOURCES = \
 	ZMFDocument.cpp
 
@@ -38,8 +38,6 @@ libzmf_internal_la_SOURCES = \
 	ZMFCollector.h \
 	ZMFTypes.cpp \
 	ZMFTypes.h \
-	ZMFInternalStream.cpp \
-	ZMFInternalStream.h \
 	libzmf_utils.cpp \
 	libzmf_utils.h
 
diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in
index 11e8fc3..6e1c087 100644
--- a/src/lib/Makefile.in
+++ b/src/lib/Makefile.in
@@ -93,6 +93,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
 	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
 	$(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
+	$(top_srcdir)/m4/dlp_fallthrough.m4 \
 	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
 	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
 	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
@@ -149,7 +150,7 @@ libzmf_internal_la_LIBADD =
 am_libzmf_internal_la_OBJECTS = BMIHeader.lo BMIParser.lo BMITypes.lo \
 	ZBRHeader.lo ZBRParser.lo ZMF2Header.lo ZMF2Parser.lo \
 	ZMF4Header.lo ZMF4Parser.lo ZMFCollector.lo ZMFTypes.lo \
-	ZMFInternalStream.lo libzmf_utils.lo
+	libzmf_utils.lo
 libzmf_internal_la_OBJECTS = $(am_libzmf_internal_la_OBJECTS)
 AM_V_P = $(am__v_P_ at AM_V@)
 am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
@@ -273,7 +274,6 @@ FGREP = @FGREP@
 GREP = @GREP@
 HAVE_CXX11 = @HAVE_CXX11@
 ICU_CFLAGS = @ICU_CFLAGS@
-ICU_CONFIG = @ICU_CONFIG@
 ICU_LIBS = @ICU_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
@@ -396,7 +396,7 @@ lib_LTLIBRARIES = libzmf- at ZMF_MAJOR_VERSION@. at ZMF_MINOR_VERSION@.la
 AM_CXXFLAGS = -I$(top_srcdir)/inc $(REVENGE_CFLAGS) $(REVENGE_STREAM_CFLAGS) $(ZLIB_CFLAGS) $(LIBPNG_CFLAGS) $(ICU_CFLAGS) $(DEBUG_CXXFLAGS) -DLIBZMF_BUILD
 libzmf_ at ZMF_MAJOR_VERSION@_ at ZMF_MINOR_VERSION@_la_LIBADD = libzmf_internal.la $(REVENGE_LIBS) $(ZLIB_LIBS) $(LIBPNG_LIBS) $(ICU_LIBS) @LIBZMF_WIN32_RESOURCE@
 libzmf_ at ZMF_MAJOR_VERSION@_ at ZMF_MINOR_VERSION@_la_DEPENDENCIES = libzmf_internal.la @LIBZMF_WIN32_RESOURCE@
-libzmf_ at ZMF_MAJOR_VERSION@_ at ZMF_MINOR_VERSION@_la_LDFLAGS = $(version_info) -export-dynamic -no-undefines
+libzmf_ at ZMF_MAJOR_VERSION@_ at ZMF_MINOR_VERSION@_la_LDFLAGS = $(version_info) -export-dynamic -no-undefined
 libzmf_ at ZMF_MAJOR_VERSION@_ at ZMF_MINOR_VERSION@_la_SOURCES = \
 	ZMFDocument.cpp
 
@@ -423,8 +423,6 @@ libzmf_internal_la_SOURCES = \
 	ZMFCollector.h \
 	ZMFTypes.cpp \
 	ZMFTypes.h \
-	ZMFInternalStream.cpp \
-	ZMFInternalStream.h \
 	libzmf_utils.cpp \
 	libzmf_utils.h
 
@@ -541,7 +539,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ZMF4Parser.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ZMFCollector.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ZMFDocument.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ZMFInternalStream.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ZMFTypes.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libzmf_utils.Plo at am__quote@
 
diff --git a/src/lib/ZMF2Parser.h b/src/lib/ZMF2Parser.h
index 5354ddf..a919813 100644
--- a/src/lib/ZMF2Parser.h
+++ b/src/lib/ZMF2Parser.h
@@ -20,8 +20,8 @@ namespace libzmf
 class ZMF2Parser
 {
   // disable copying
-  ZMF2Parser(const ZMF2Parser &other);
-  ZMF2Parser &operator=(const ZMF2Parser &other);
+  ZMF2Parser(const ZMF2Parser &other) = delete;
+  ZMF2Parser &operator=(const ZMF2Parser &other) = delete;
 
 public:
   ZMF2Parser(const RVNGInputStreamPtr &input, librevenge::RVNGDrawingInterface *painter);
diff --git a/src/lib/ZMF4Parser.cpp b/src/lib/ZMF4Parser.cpp
index e23c2e5..6e4905d 100644
--- a/src/lib/ZMF4Parser.cpp
+++ b/src/lib/ZMF4Parser.cpp
@@ -10,6 +10,7 @@
 #include "ZMF4Parser.h"
 #include <algorithm>
 #include <numeric>
+#include <string>
 #include "BMIParser.h"
 
 #define NO_ID 0xffffffff
@@ -174,10 +175,9 @@ ZMF4Parser::ObjectHeader ZMF4Parser::readObjectHeader()
   header.refObjCount = readU32(m_input);
   header.refListStartOffset = readU32(m_input);
 
-  if (header.size == 0 || startOffset + header.size > m_inputLength ||
-      startOffset + header.size < header.size || // overflow
+  if (header.size == 0 || header.size > m_inputLength - startOffset ||
       header.refListStartOffset >= header.size ||
-      header.refListStartOffset + header.refObjCount * 2 * 4 > header.size)
+      header.refObjCount > (header.size - header.refListStartOffset) / 8)
   {
     ZMF_DEBUG_MSG(("Incorrect object header, offset %u\n", startOffset));
     throw GenericException();
@@ -200,18 +200,26 @@ ZMF4Parser::ObjectHeader ZMF4Parser::readObjectHeader()
 
 std::vector<ZMF4Parser::ObjectRef> ZMF4Parser::readObjectRefs()
 {
-  std::vector<ZMF4Parser::ObjectRef> refs(m_currentObjectHeader.refObjCount);
+  uint32_t refObjCount = m_currentObjectHeader.refObjCount;
+  long maxRefObjCount = long(static_cast<unsigned long>(m_currentObjectHeader.nextObjectOffset)) - m_input->tell() / 8;
+  if (maxRefObjCount < 0)
+    maxRefObjCount = 0;
+  if (refObjCount > maxRefObjCount)
+    refObjCount = uint32_t(static_cast<unsigned long>(maxRefObjCount));
 
-  if (m_currentObjectHeader.refObjCount > 0)
+  std::vector<ZMF4Parser::ObjectRef> refs;
+
+  if (refObjCount > 0)
   {
-    seek(m_input, m_currentObjectHeader.nextObjectOffset - 8 * m_currentObjectHeader.refObjCount);
+    refs.resize(refObjCount);
+    seek(m_input, m_currentObjectHeader.nextObjectOffset - 8 * refObjCount);
 
-    for (uint32_t i = 0; i < m_currentObjectHeader.refObjCount; i++)
+    for (uint32_t i = 0; i < refObjCount; i++)
     {
       refs[i].id = readU32(m_input);
     }
 
-    for (uint32_t i = 0; i < m_currentObjectHeader.refObjCount; i++)
+    for (uint32_t i = 0; i < refObjCount; i++)
     {
       refs[i].tag = readU32(m_input);
     }
@@ -269,7 +277,7 @@ boost::optional<Image> ZMF4Parser::getImageByRefId(uint32_t id)
 ArrowPtr ZMF4Parser::getArrowByRefId(uint32_t id)
 {
   auto arrow = getByRefId<ArrowPtr>(id, m_arrows);
-  return arrow ? arrow.value() : ArrowPtr();
+  return get_optional_value_or(arrow, ArrowPtr());
 }
 
 Style ZMF4Parser::readStyle()
@@ -354,6 +362,7 @@ void ZMF4Parser::readCurveSectionTypes(std::vector<CurveType> &sectionTypes)
     {
     default:
       ZMF_DEBUG_MSG(("Unknown point type %u\n", type));
+    // fall-through intended: pick a default
     case 1:
       sectionTypes.push_back(CurveType::LINE);
       break;
@@ -684,13 +693,13 @@ void ZMF4Parser::readFill()
 
     Color color = readColor();
 
-    m_fills[m_currentObjectHeader.id.value()] = color;
+    m_fills[get(m_currentObjectHeader.id)] = color;
   }
   else if (type >= 2 && type <= 7)
   {
     Gradient gradient = readGradient(type);
 
-    m_fills[m_currentObjectHeader.id.value()] = gradient;
+    m_fills[get(m_currentObjectHeader.id)] = gradient;
   }
   else if (type == 8)
   {
@@ -723,13 +732,13 @@ void ZMF4Parser::readFill()
 
     if (!image)
     {
-      ZMF_DEBUG_MSG(("image not found for bitmap fill ID0x%x\n", m_currentObjectHeader.id.value()));
+      ZMF_DEBUG_MSG(("image not found for bitmap fill ID0x%x\n", get(m_currentObjectHeader.id)));
       return;
     }
 
-    imageFill.image = image.value();
+    imageFill.image = get(image);
 
-    m_fills[m_currentObjectHeader.id.value()] = imageFill;
+    m_fills[get(m_currentObjectHeader.id)] = imageFill;
   }
   else
   {
@@ -756,7 +765,7 @@ void ZMF4Parser::readTransparency()
     Transparency transparency;
     transparency.color = readColor();
 
-    m_transparencies[m_currentObjectHeader.id.value()] = transparency;
+    m_transparencies[get(m_currentObjectHeader.id)] = transparency;
   }
 }
 
@@ -778,6 +787,7 @@ void ZMF4Parser::readPen()
   {
   default:
     ZMF_DEBUG_MSG(("Unknown line join type %u\n", lineJoin));
+  // fall-through intended: pick a default
   case 0:
     pen.lineJoinType = LineJoinType::MITER;
     break;
@@ -795,6 +805,7 @@ void ZMF4Parser::readPen()
   {
   default:
     ZMF_DEBUG_MSG(("Unknown line cap type %u\n", lineCap));
+  // fall-through intended: pick a default
   case 0:
     pen.lineCapType = LineCapType::BUTT;
     break;
@@ -861,20 +872,17 @@ void ZMF4Parser::readPen()
     switch (ref.tag)
     {
     case 0:
-    {
       pen.startArrow = getArrowByRefId(ref.id);
-    }
+      break;
     case 1:
-    {
       pen.endArrow = getArrowByRefId(ref.id);
-    }
-    break;
+      break;
     default:
       break;
     }
   }
 
-  m_pens[m_currentObjectHeader.id.value()] = pen;
+  m_pens[get(m_currentObjectHeader.id)] = pen;
 }
 
 void ZMF4Parser::readShadow()
@@ -926,7 +934,7 @@ void ZMF4Parser::readShadow()
     break;
   }
 
-  m_shadows[m_currentObjectHeader.id.value()] = shadow;
+  m_shadows[get(m_currentObjectHeader.id)] = shadow;
 }
 
 void ZMF4Parser::readArrow()
@@ -947,7 +955,7 @@ void ZMF4Parser::readArrow()
 
   arrow->curves = readCurveComponents(std::bind(&ZMF4Parser::readUnscaledPoint, this));
 
-  m_arrows[m_currentObjectHeader.id.value()] = arrow;
+  m_arrows[get(m_currentObjectHeader.id)] = arrow;
 }
 
 void ZMF4Parser::readBitmap()
@@ -975,11 +983,11 @@ void ZMF4Parser::readBitmap()
 
     if (image.data.empty())
     {
-      ZMF_DEBUG_MSG(("Failed to parse bitmap, ID 0x%x\n", m_currentObjectHeader.id.value()));
+      ZMF_DEBUG_MSG(("Failed to parse bitmap, ID 0x%x\n", get(m_currentObjectHeader.id)));
     }
     else
     {
-      m_images[m_currentObjectHeader.id.value()] = image;
+      m_images[get(m_currentObjectHeader.id)] = image;
     }
 
     seek(m_input, m_currentObjectHeader.nextObjectOffset + header.size());
@@ -1012,7 +1020,7 @@ void ZMF4Parser::readImage()
   {
     m_collector.setStyle(readStyle());
 
-    m_collector.collectImage(image.value().data, bbox.topLeft(), bbox.width(), bbox.height(),
+    m_collector.collectImage(get(image).data, bbox.topLeft(), bbox.width(), bbox.height(),
                              bbox.rotation(), bbox.mirrorHorizontal(), bbox.mirrorVertical());
   }
 }
@@ -1040,13 +1048,14 @@ void ZMF4Parser::readFont()
 
   skip(m_input, 4);
 
-  font.name = librevenge::RVNGString(reinterpret_cast<const char *>(readNBytes(m_input, 32)));
+  const std::string name(reinterpret_cast<const char *>(readNBytes(m_input, 32)), 31);
+  font.name = librevenge::RVNGString(name.c_str());
 
   auto style = readStyle();
   font.fill = style.fill;
   font.outline = style.pen;
 
-  m_fonts[m_currentObjectHeader.id.value()] = font;
+  m_fonts[get(m_currentObjectHeader.id)] = font;
 }
 
 void ZMF4Parser::readParagraphStyle()
@@ -1067,6 +1076,7 @@ void ZMF4Parser::readParagraphStyle()
   {
   default:
     ZMF_DEBUG_MSG(("Unknown paragraph alignment %u\n", align));
+  // fall-through intended: pick a default
   case 0:
     parStyle.alignment = HorizontalAlignment::LEFT;
     break;
@@ -1098,7 +1108,7 @@ void ZMF4Parser::readParagraphStyle()
     {
       auto font = getFontByRefId(ref.id);
       if (font)
-        parStyle.font = font.value();
+        parStyle.font = get(font);
     }
     break;
     default:
@@ -1107,7 +1117,7 @@ void ZMF4Parser::readParagraphStyle()
     }
   }
 
-  m_paragraphStyles[m_currentObjectHeader.id.value()] = parStyle;
+  m_paragraphStyles[get(m_currentObjectHeader.id)] = parStyle;
 }
 
 void ZMF4Parser::readText()
@@ -1140,7 +1150,7 @@ void ZMF4Parser::readText()
     uint32_t styleId = readU32(m_input);
     auto style = getParagraphStyleByRefId(styleId);
     if (style)
-      paragraph.style = style.value();
+      paragraph.style = get(style);
 
     skip(m_input, 4);
   }
@@ -1161,7 +1171,7 @@ void ZMF4Parser::readText()
       uint32_t fontId = readU32(m_input);
       auto font = getFontByRefId(fontId);
       if (font)
-        span.font = font.value();
+        span.font = get(font);
       else
       {
         span.font = paragraph.style.font;
@@ -1180,7 +1190,7 @@ void ZMF4Parser::readText()
     }
   }
 
-  m_texts[m_currentObjectHeader.id.value()] = text;
+  m_texts[get(m_currentObjectHeader.id)] = text;
 }
 
 void ZMF4Parser::readTextFrame()
@@ -1216,7 +1226,7 @@ void ZMF4Parser::readTextFrame()
 
   if (text)
   {
-    m_collector.collectTextObject(text.value(), bbox.topLeft(), bbox.width(), bbox.height(), alignment, bbox.rotation());
+    m_collector.collectTextObject(get(text), bbox.topLeft(), bbox.width(), bbox.height(), alignment, bbox.rotation());
   }
 }
 
@@ -1282,9 +1292,11 @@ void ZMF4Parser::readPolygon()
   }
 
   uint32_t pointsCount = readU32(m_input);
-  if (pointsCount == 0 ||
-      m_input->tell() + 8 + pointsCount * 2 * 4 + pointsCount * 4 >
-      (m_currentObjectHeader.refListStartOffset == 0 ? m_currentObjectHeader.nextObjectOffset : m_currentObjectHeader.refListStartOffset))
+  const uint32_t endOffset = m_currentObjectHeader.refListStartOffset == 0
+                             ? m_currentObjectHeader.nextObjectOffset
+                             : m_currentObjectHeader.refListStartOffset
+                             ;
+  if (pointsCount == 0 || m_input->tell() + 8 >= endOffset || pointsCount > (endOffset - m_input->tell() - 8) / 12)
   {
     ZMF_DEBUG_MSG(("Incorrect peak point count, offset %ld\n", m_input->tell()));
     return;
@@ -1350,7 +1362,7 @@ void ZMF4Parser::readTable()
       auto text = getTextByRefId(textId);
       if (text)
       {
-        cell.text = text.value();
+        cell.text = get(text);
       }
 
       uint32_t rightPenRefId = readU32(m_input);
diff --git a/src/lib/ZMF4Parser.h b/src/lib/ZMF4Parser.h
index 634eee5..247fcfc 100644
--- a/src/lib/ZMF4Parser.h
+++ b/src/lib/ZMF4Parser.h
@@ -26,8 +26,8 @@ namespace libzmf
 class ZMF4Parser
 {
   // disable copying
-  ZMF4Parser(const ZMF4Parser &other);
-  ZMF4Parser &operator=(const ZMF4Parser &other);
+  ZMF4Parser(const ZMF4Parser &other) = delete;
+  ZMF4Parser &operator=(const ZMF4Parser &other) = delete;
 
 public:
   ZMF4Parser(const RVNGInputStreamPtr &input, librevenge::RVNGDrawingInterface *painter);
diff --git a/src/lib/ZMFCollector.cpp b/src/lib/ZMFCollector.cpp
index 18377ff..0b2608f 100644
--- a/src/lib/ZMFCollector.cpp
+++ b/src/lib/ZMFCollector.cpp
@@ -218,7 +218,7 @@ public:
 
     if (m_transparency)
     {
-      m_propList.insert("draw:opacity", m_transparency.value().opacity(), librevenge::RVNG_PERCENT);
+      m_propList.insert("draw:opacity", get(m_transparency).opacity(), librevenge::RVNG_PERCENT);
     }
   }
 
@@ -251,7 +251,7 @@ public:
       librevenge::RVNGPropertyList grad;
       grad.insert("svg:offset", stop.offset, librevenge::RVNG_PERCENT);
       grad.insert("svg:stop-color", stop.color.toString());
-      grad.insert("svg:stop-opacity", m_transparency ? m_transparency.value().opacity() : 1.0, librevenge::RVNG_PERCENT);
+      grad.insert("svg:stop-opacity", m_transparency ? get(m_transparency).opacity() : 1.0, librevenge::RVNG_PERCENT);
       gradientVector.append(grad);
     }
 
@@ -294,7 +294,7 @@ public:
 
     if (m_transparency)
     {
-      m_propList.insert("draw:opacity", m_transparency.value().opacity(), librevenge::RVNG_PERCENT);
+      m_propList.insert("draw:opacity", get(m_transparency).opacity(), librevenge::RVNG_PERCENT);
     }
   }
 
@@ -667,9 +667,9 @@ void ZMFCollector::collectText(const Text &text)
       spanPropList.insert("fo:font-style", span.font.isItalic ? "italic" : "normal");
       spanPropList.insert("style:text-outline", static_cast<bool>(span.font.outline));
 
-      if (span.font.fill && span.font.fill.value().type() == typeid(Color))
+      if (span.font.fill && get(span.font.fill).type() == typeid(Color))
       {
-        auto color = boost::get<Color>(span.font.fill.value());
+        auto color = boost::get<Color>(get(span.font.fill));
         spanPropList.insert("fo:color", color.toString());
       }
 
@@ -759,9 +759,9 @@ void ZMFCollector::collectTable(const Table &table)
     {
       librevenge::RVNGPropertyList cellPropList;
 
-      if (cell.fill && cell.fill.value().type() == typeid(Color))
+      if (cell.fill && get(cell.fill).type() == typeid(Color))
       {
-        auto backgroundColor = boost::get<Color>(cell.fill.value());
+        auto backgroundColor = boost::get<Color>(get(cell.fill));
         cellPropList.insert("fo:background-color", backgroundColor.toString());
       }
 
@@ -769,19 +769,19 @@ void ZMFCollector::collectTable(const Table &table)
 
       if (cell.leftBorder)
       {
-        writeBorder(cellPropList, "fo:border-left", cell.leftBorder.value());
+        writeBorder(cellPropList, "fo:border-left", get(cell.leftBorder));
       }
       if (cell.rightBorder)
       {
-        writeBorder(cellPropList, "fo:border-right", cell.rightBorder.value());
+        writeBorder(cellPropList, "fo:border-right", get(cell.rightBorder));
       }
       if (cell.topBorder)
       {
-        writeBorder(cellPropList, "fo:border-top", cell.topBorder.value());
+        writeBorder(cellPropList, "fo:border-top", get(cell.topBorder));
       }
       if (cell.bottomBorder)
       {
-        writeBorder(cellPropList, "fo:border-bottom", cell.bottomBorder.value());
+        writeBorder(cellPropList, "fo:border-bottom", get(cell.bottomBorder));
       }
 
       m_painter->openTableCell(cellPropList);
@@ -806,7 +806,7 @@ void ZMFCollector::collectImage(const librevenge::RVNGBinaryData &image, const P
 
   if (m_style.transparency)
   {
-    propList.insert("draw:opacity", m_style.transparency.value().opacity(), librevenge::RVNG_PERCENT);
+    propList.insert("draw:opacity", get(m_style.transparency).opacity(), librevenge::RVNG_PERCENT);
   }
 
   m_painter->setStyle(propList);
@@ -847,17 +847,17 @@ void ZMFCollector::writeStyle(librevenge::RVNGPropertyList &propList, const Styl
 
   if (style.pen)
   {
-    writePen(propList, style.pen.value());
+    writePen(propList, get(style.pen));
   }
 
   if (style.fill && !noFill)
   {
-    writeFill(propList, style.fill.value());
+    writeFill(propList, get(style.fill));
   }
 
   if (style.shadow)
   {
-    writeShadow(propList, style.shadow.value());
+    writeShadow(propList, get(style.shadow));
   }
 }
 
@@ -920,7 +920,7 @@ void ZMFCollector::writePen(librevenge::RVNGPropertyList &propList, const Pen &p
 
   if (m_style.transparency)
   {
-    propList.insert("svg:stroke-opacity", m_style.transparency.value().opacity(), librevenge::RVNG_PERCENT);
+    propList.insert("svg:stroke-opacity", get(m_style.transparency).opacity(), librevenge::RVNG_PERCENT);
   }
 
   if (pen.startArrow)
diff --git a/src/lib/ZMFCollector.h b/src/lib/ZMFCollector.h
index e0c7bc7..51accea 100644
--- a/src/lib/ZMFCollector.h
+++ b/src/lib/ZMFCollector.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef ZMF4COLLECTOR_H_INCLUDED
-#define ZMF4COLLECTOR_H_INCLUDED
+#ifndef ZMFCOLLECTOR_H_INCLUDED
+#define ZMFCOLLECTOR_H_INCLUDED
 
 #include <librevenge/librevenge.h>
 #include "libzmf_utils.h"
@@ -21,8 +21,8 @@ namespace libzmf
 class ZMFCollector
 {
   // disable copying
-  ZMFCollector(const ZMFCollector &other);
-  ZMFCollector &operator=(const ZMFCollector &other);
+  ZMFCollector(const ZMFCollector &other) = delete;
+  ZMFCollector &operator=(const ZMFCollector &other) = delete;
 
 public:
   ZMFCollector(librevenge::RVNGDrawingInterface *painter);
@@ -84,6 +84,6 @@ private:
 
 }
 
-#endif // ZMF4COLLECTOR_H_INCLUDED
+#endif // ZMFCOLLECTOR_H_INCLUDED
 
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/ZMFInternalStream.cpp b/src/lib/ZMFInternalStream.cpp
deleted file mode 100644
index 3e00e6a..0000000
--- a/src/lib/ZMFInternalStream.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/*
- * This file is a part of the libzmf project.
- *
- * 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/.
- */
-
-#include <algorithm>
-
-#include "ZMFInternalStream.h"
-
-namespace libzmf
-{
-
-ZMFInternalStream::ZMFInternalStream(const unsigned char *data, unsigned long size)
-  : librevenge::RVNGInputStream()
-  , m_offset(0)
-  , m_size(size)
-  , m_data(data)
-  , m_tmpBuf(0)
-  , m_dataOwner(false)
-{
-}
-
-ZMFInternalStream::ZMFInternalStream(const std::vector<unsigned char> &data)
-  : librevenge::RVNGInputStream()
-  , m_offset(0)
-  , m_size(data.size())
-  , m_data(&data[0])
-  , m_tmpBuf(0)
-  , m_dataOwner(false)
-{
-}
-
-ZMFInternalStream::ZMFInternalStream(const RVNGInputStreamPtr &input, unsigned long size)
-  : librevenge::RVNGInputStream()
-  , m_offset(0)
-  , m_size(0)
-  , m_data(0)
-  , m_tmpBuf(0)
-  , m_dataOwner(true)
-{
-  const unsigned char *const bytes = readNBytes(input, size);
-  unsigned char *const data = new unsigned char[size];
-  m_data = data;
-  m_dataOwner = true;
-  m_size = size;
-  std::uninitialized_copy(bytes, bytes + size, data);
-}
-
-ZMFInternalStream::~ZMFInternalStream()
-{
-  if (m_dataOwner)
-    delete [] m_data;
-  if (m_tmpBuf)
-    delete [] m_tmpBuf;
-}
-
-bool ZMFInternalStream::isStructured()
-{
-  return false;
-}
-
-unsigned ZMFInternalStream::subStreamCount()
-{
-  return 0;
-}
-
-const char *ZMFInternalStream::subStreamName(unsigned)
-{
-  return 0;
-}
-
-bool ZMFInternalStream::existsSubStream(const char *)
-{
-  return false;
-}
-
-librevenge::RVNGInputStream *ZMFInternalStream::getSubStreamByName(const char *)
-{
-  return 0;
-}
-
-librevenge::RVNGInputStream *ZMFInternalStream::getSubStreamById(unsigned)
-{
-  return 0;
-}
-
-const unsigned char *ZMFInternalStream::read(unsigned long numBytes, unsigned long &numBytesRead)
-{
-  numBytesRead = 0;
-
-  if (0 == numBytes)
-    return 0;
-
-  if (m_tmpBuf)
-    delete [] m_tmpBuf;
-  m_tmpBuf = 0;
-
-  int numBytesToRead;
-
-  if ((m_offset+numBytes) < m_size)
-    numBytesToRead = numBytes;
-  else
-    numBytesToRead = m_size - m_offset;
-
-  numBytesRead = numBytesToRead; // about as paranoid as we can be..
-
-  if (numBytesToRead == 0)
-    return 0;
-
-  m_tmpBuf = new unsigned char[numBytesToRead];
-  for (unsigned long i=0; (long)i<(long)numBytesToRead; i++)
-  {
-    m_tmpBuf[i] = m_data[m_offset];
-    m_offset++;
-  }
-
-  return m_tmpBuf;
-}
-
-int ZMFInternalStream::seek(long offset, librevenge::RVNG_SEEK_TYPE seekType)
-{
-  if (seekType == librevenge::RVNG_SEEK_CUR)
-    m_offset += offset;
-  else if (seekType == librevenge::RVNG_SEEK_SET)
-    m_offset = offset;
-  else if (seekType == librevenge::RVNG_SEEK_END)
-    m_offset = long(static_cast<unsigned long>(m_size)) + offset;
-
-  if (m_offset < 0)
-  {
-    m_offset = 0;
-    return 1;
-  }
-  if ((long)m_offset > (long)m_size)
-  {
-    m_offset = m_size;
-    return 1;
-  }
-
-  return 0;
-}
-
-long ZMFInternalStream::tell()
-{
-  return m_offset;
-}
-
-bool ZMFInternalStream::isEnd()
-{
-  if ((long)m_offset == (long)m_size)
-    return true;
-
-  return false;
-}
-
-}
-
-/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/ZMFInternalStream.h b/src/lib/ZMFInternalStream.h
deleted file mode 100644
index 08b8bf2..0000000
--- a/src/lib/ZMFInternalStream.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/*
- * This file is a part of the libzmf project.
- *
- * 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/.
- */
-
-#ifndef ZMFINTERNALSTREAM_H_INCLUDED
-#define ZMFINTERNALSTREAM_H_INCLUDED
-
-#include <vector>
-
-#include <librevenge-stream/librevenge-stream.h>
-
-#include "libzmf_utils.h"
-
-namespace libzmf
-{
-
-class ZMFInternalStream : public librevenge::RVNGInputStream
-{
-public:
-  ZMFInternalStream(const unsigned char *data, unsigned long size);
-  ZMFInternalStream(const std::vector<unsigned char> &data);
-  ZMFInternalStream(const RVNGInputStreamPtr &input, unsigned long size);
-  virtual ~ZMFInternalStream();
-
-  virtual bool isStructured();
-  virtual unsigned subStreamCount();
-  virtual const char *subStreamName(unsigned id);
-  virtual bool existsSubStream(const char *name);
-  virtual librevenge::RVNGInputStream *getSubStreamByName(const char *name);
-  virtual librevenge::RVNGInputStream *getSubStreamById(unsigned id);
-
-  const virtual unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
-  virtual int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType);
-  virtual long tell();
-  virtual bool isEnd();
-
-private:
-  long m_offset;
-  unsigned long m_size;
-  const unsigned char *m_data;
-  unsigned char *m_tmpBuf;
-  bool m_dataOwner;
-  ZMFInternalStream(const ZMFInternalStream &);
-  ZMFInternalStream &operator=(const ZMFInternalStream &);
-};
-
-}
-
-#endif // ZMFINTERNALSTREAM_H_INCLUDED
-
-/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/ZMFTypes.cpp b/src/lib/ZMFTypes.cpp
index d7b371c..d255832 100644
--- a/src/lib/ZMFTypes.cpp
+++ b/src/lib/ZMFTypes.cpp
@@ -42,8 +42,8 @@ double Point::distance(const Point &p2) const
 }
 
 
-BoundingBox::BoundingBox(const std::vector<Point> &points)
-  : m_points(points)
+BoundingBox::BoundingBox(const std::vector<Point> &points_)
+  : m_points(points_)
   , m_width(0.0)
   , m_height(0.0)
   , m_center()
@@ -55,7 +55,7 @@ BoundingBox::BoundingBox(const std::vector<Point> &points)
 {
   using namespace boost::math::double_constants;
 
-  if (points.size() != 4)
+  if (m_points.size() != 4)
     throw GenericException();
 
   // rectangle center is middle point of diagonal
diff --git a/src/lib/libzmf_utils.cpp b/src/lib/libzmf_utils.cpp
index 5756bcd..a32dc80 100644
--- a/src/lib/libzmf_utils.cpp
+++ b/src/lib/libzmf_utils.cpp
@@ -18,6 +18,7 @@
 #endif
 
 #include <cstring>
+#include <memory>
 
 #include <boost/math/constants/constants.hpp>
 
@@ -70,17 +71,17 @@ static void _appendUCS4(librevenge::RVNGString &text, unsigned ucs4Character)
     len = 6;
   }
 
-  unsigned char outbuf[6] = { 0, 0, 0, 0, 0, 0 };
+  char outbuf[7] = { 0 };
   int i;
   for (i = len - 1; i > 0; --i)
   {
-    outbuf[i] = (ucs4Character & 0x3f) | 0x80;
+    outbuf[i] = char((ucs4Character & 0x3f) | 0x80);
     ucs4Character >>= 6;
   }
-  outbuf[0] = (ucs4Character & 0xff) | first;
+  outbuf[0] = char((ucs4Character & 0xff) | first);
+  outbuf[len] = '\0';
 
-  for (i = 0; i < len; i++)
-    text.append(outbuf[i]);
+  text.append(outbuf);
 }
 
 }
@@ -198,24 +199,21 @@ unsigned long getLength(const RVNGInputStreamPtr &input)
 {
   checkStream(input);
 
-  const unsigned long begin = input->tell();
-  unsigned long end = begin;
+  const long begin = input->tell();
 
-  if (0 == input->seek(0, librevenge::RVNG_SEEK_END))
-    end = input->tell();
-  else
+  if (input->seek(0, librevenge::RVNG_SEEK_END) != 0)
   {
     // RVNG_SEEK_END does not work. Use the harder way.
     while (!input->isEnd())
-    {
       readU8(input);
-      ++end;
-    }
   }
+  long end = input->tell();
+  if (end < begin)
+    throw SeekFailedException();
 
   seek(input, begin);
 
-  return end - begin;
+  return static_cast<unsigned long>(end - begin);
 }
 
 void appendCharacters(librevenge::RVNGString &text, const unsigned char *characters, uint32_t size,
@@ -228,8 +226,7 @@ void appendCharacters(librevenge::RVNGString &text, const unsigned char *charact
   }
 
   UErrorCode status = U_ZERO_ERROR;
-  UConverter *conv = NULL;
-  conv = ucnv_open(encoding, &status);
+  std::unique_ptr<UConverter, void(*)(UConverter *)> conv(ucnv_open(encoding, &status), ucnv_close);
   if (U_SUCCESS(status))
   {
     // ICU documentation claims that character-by-character processing is faster "for small amounts of data" and "'normal' charsets"
@@ -238,17 +235,13 @@ void appendCharacters(librevenge::RVNGString &text, const unsigned char *charact
     const char *srcLimit = (const char *)src + size;
     while (src < srcLimit)
     {
-      uint32_t ucs4Character = (uint32_t)ucnv_getNextUChar(conv, &src, srcLimit, &status);
+      uint32_t ucs4Character = (uint32_t)ucnv_getNextUChar(conv.get(), &src, srcLimit, &status);
       if (U_SUCCESS(status))
       {
         _appendUCS4(text, ucs4Character);
       }
     }
   }
-  if (conv)
-  {
-    ucnv_close(conv);
-  }
 }
 
 void writeU16(librevenge::RVNGBinaryData &buffer, const int value)
@@ -275,12 +268,9 @@ double rad2deg(double value)
 double normalizeAngle(double radAngle)
 {
   using namespace boost::math::double_constants;
-
-  while (two_pi <= radAngle)
-    radAngle -= two_pi;
-  while (0 > radAngle)
+  radAngle = std::fmod(radAngle, two_pi);
+  if (radAngle < 0)
     radAngle += two_pi;
-
   return radAngle;
 }
 
diff --git a/src/lib/libzmf_utils.h b/src/lib/libzmf_utils.h
index 6898a54..02e7124 100644
--- a/src/lib/libzmf_utils.h
+++ b/src/lib/libzmf_utils.h
@@ -32,6 +32,14 @@
 #define ZMF_EPSILON 1E-6
 #define ZMF_ALMOST_ZERO(m) (std::fabs(m) <= ZMF_EPSILON)
 
+#if defined(HAVE_CLANG_ATTRIBUTE_FALLTHROUGH)
+#  define ZMF_FALLTHROUGH [[clang::fallthrough]]
+#elif defined(HAVE_GCC_ATTRIBUTE_FALLTHROUGH)
+#  define ZMF_FALLTHROUGH __attribute__((fallthrough))
+#else
+#  define ZMF_FALLTHROUGH ((void) 0)
+#endif
+
 #ifdef DEBUG
 
 #if defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
diff --git a/src/test/Makefile.am b/src/test/Makefile.am
index 770bd00..4d671a2 100644
--- a/src/test/Makefile.am
+++ b/src/test/Makefile.am
@@ -23,7 +23,6 @@ test_LDADD = \
 	$(CPPUNIT_LIBS)
 
 test_SOURCES = \
-	ZMFInternalStreamTest.cpp \
 	ZMFTypesTest.cpp
 
 detection_CPPFLAGS = \
diff --git a/src/test/Makefile.in b/src/test/Makefile.in
index f821a7e..fcf2936 100644
--- a/src/test/Makefile.in
+++ b/src/test/Makefile.in
@@ -94,6 +94,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
 	$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
 	$(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
+	$(top_srcdir)/m4/dlp_fallthrough.m4 \
 	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
 	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
 	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
@@ -127,8 +128,7 @@ am__v_lt_1 =
 detection_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
 	$(CXXFLAGS) $(detection_LDFLAGS) $(LDFLAGS) -o $@
-am_test_OBJECTS = test-ZMFInternalStreamTest.$(OBJEXT) \
-	test-ZMFTypesTest.$(OBJEXT)
+am_test_OBJECTS = test-ZMFTypesTest.$(OBJEXT)
 test_OBJECTS = $(am_test_OBJECTS)
 test_DEPENDENCIES = libtest_driver.a \
 	$(top_builddir)/src/lib/libzmf_internal.la \
@@ -443,7 +443,6 @@ FGREP = @FGREP@
 GREP = @GREP@
 HAVE_CXX11 = @HAVE_CXX11@
 ICU_CFLAGS = @ICU_CFLAGS@
-ICU_CONFIG = @ICU_CONFIG@
 ICU_LIBS = @ICU_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
@@ -581,7 +580,6 @@ test_LDADD = \
 	$(CPPUNIT_LIBS)
 
 test_SOURCES = \
-	ZMFInternalStreamTest.cpp \
 	ZMFTypesTest.cpp
 
 detection_CPPFLAGS = \
@@ -677,7 +675,6 @@ distclean-compile:
 
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/detection-ZMFDocumentTest.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libtest_driver_a-test.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test-ZMFInternalStreamTest.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test-ZMFTypesTest.Po at am__quote@
 
 .cpp.o:
@@ -729,20 +726,6 @@ detection-ZMFDocumentTest.obj: ZMFDocumentTest.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(detection_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o detection-ZMFDocumentTest.obj `if test -f 'ZMFDocumentTest.cpp'; then $(CYGPATH_W) 'ZMFDocumentTest.cpp'; else $(CYGPATH_W) '$(srcdir)/ZMFDocumentTest.cpp'; fi`
 
-test-ZMFInternalStreamTest.o: ZMFInternalStreamTest.cpp
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test-ZMFInternalStreamTest.o -MD -MP -MF $(DEPDIR)/test-ZMFInternalStreamTest.Tpo -c -o test-ZMFInternalStreamTest.o `test -f 'ZMFInternalStreamTest.cpp' || echo '$(srcdir)/'`ZMFInternalStreamTest.cpp
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/test-ZMFInternalStreamTest.Tpo $(DEPDIR)/test-ZMFInternalStreamTest.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='ZMFInternalStreamTest.cpp' object='test-ZMFInternalStreamTest.o' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test-ZMFInternalStreamTest.o `test -f 'ZMFInternalStreamTest.cpp' || echo '$(srcdir)/'`ZMFInternalStreamTest.cpp
-
-test-ZMFInternalStreamTest.obj: ZMFInternalStreamTest.cpp
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test-ZMFInternalStreamTest.obj -MD -MP -MF $(DEPDIR)/test-ZMFInternalStreamTest.Tpo -c -o test-ZMFInternalStreamTest.obj `if test -f 'ZMFInternalStreamTest.cpp'; then $(CYGPATH_W) 'ZMFInternalStreamTest.cpp'; else $(CYGPATH_W) '$(srcdir)/ZMFInternalStreamTest.cpp'; fi`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/test-ZMFInternalStreamTest.Tpo $(DEPDIR)/test-ZMFInternalStreamTest.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='ZMFInternalStreamTest.cpp' object='test-ZMFInternalStreamTest.obj' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test-ZMFInternalStreamTest.obj `if test -f 'ZMFInternalStreamTest.cpp'; then $(CYGPATH_W) 'ZMFInternalStreamTest.cpp'; else $(CYGPATH_W) '$(srcdir)/ZMFInternalStreamTest.cpp'; fi`
-
 test-ZMFTypesTest.o: ZMFTypesTest.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test-ZMFTypesTest.o -MD -MP -MF $(DEPDIR)/test-ZMFTypesTest.Tpo -c -o test-ZMFTypesTest.o `test -f 'ZMFTypesTest.cpp' || echo '$(srcdir)/'`ZMFTypesTest.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/test-ZMFTypesTest.Tpo $(DEPDIR)/test-ZMFTypesTest.Po
diff --git a/src/test/ZMFDocumentTest.cpp b/src/test/ZMFDocumentTest.cpp
index d5fe1a5..5bc8079 100644
--- a/src/test/ZMFDocumentTest.cpp
+++ b/src/test/ZMFDocumentTest.cpp
@@ -58,8 +58,8 @@ void assertUnsupported(const string &name)
 class ZMFDocumentTest : public CPPUNIT_NS::TestFixture
 {
 public:
-  virtual void setUp();
-  virtual void tearDown();
+  virtual void setUp() override;
+  virtual void tearDown() override;
 
 private:
   CPPUNIT_TEST_SUITE(ZMFDocumentTest);
diff --git a/src/test/ZMFInternalStreamTest.cpp b/src/test/ZMFInternalStreamTest.cpp
deleted file mode 100644
index 6ffb8dc..0000000
--- a/src/test/ZMFInternalStreamTest.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/*
- * This file is part of the libzmf project.
- *
- * 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/.
- */
-
-#include <algorithm>
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <librevenge-stream/librevenge-stream.h>
-
-#include "ZMFInternalStream.h"
-
-namespace test
-{
-
-using libzmf::ZMFInternalStream;
-
-class ZMFInternalStreamTest : public CPPUNIT_NS::TestFixture
-{
-public:
-  virtual void setUp();
-  virtual void tearDown();
-
-private:
-  CPPUNIT_TEST_SUITE(ZMFInternalStreamTest);
-  CPPUNIT_TEST(testRead);
-  CPPUNIT_TEST(testSeek);
-  CPPUNIT_TEST_SUITE_END();
-
-private:
-  void testRead();
-  void testSeek();
-};
-
-void ZMFInternalStreamTest::setUp()
-{
-}
-
-void ZMFInternalStreamTest::tearDown()
-{
-}
-
-void ZMFInternalStreamTest::testRead()
-{
-  const unsigned char data[] = "abc dee fgh";
-  ZMFInternalStream strm(data, sizeof(data));
-
-  CPPUNIT_ASSERT_MESSAGE("stream is already exhausted before starting to read", !strm.isEnd());
-
-  for (int i = 0; sizeof(data) != i; ++i)
-  {
-    unsigned long readBytes = 0;
-    const unsigned char *s = strm.read(1, readBytes);
-
-    CPPUNIT_ASSERT(1 == readBytes);
-    CPPUNIT_ASSERT_EQUAL(data[i], s[0]);
-    CPPUNIT_ASSERT(((sizeof(data) - 1) == i) || !strm.isEnd());
-  }
-
-  CPPUNIT_ASSERT_MESSAGE("reading did not exhaust the stream", strm.isEnd());
-
-  strm.seek(0, librevenge::RVNG_SEEK_SET);
-
-  unsigned long readBytes = 0;
-  const unsigned char *s = strm.read(sizeof(data), readBytes);
-  CPPUNIT_ASSERT(sizeof(data) == readBytes);
-  CPPUNIT_ASSERT(std::equal(data, data + sizeof(data), s));
-}
-
-void ZMFInternalStreamTest::testSeek()
-{
-  const unsigned char data[] = "abc dee fgh";
-  ZMFInternalStream strm(data, sizeof(data));
-
-  strm.seek(0, librevenge::RVNG_SEEK_SET);
-  CPPUNIT_ASSERT(0 == strm.tell());
-  strm.seek(2, librevenge::RVNG_SEEK_SET);
-  CPPUNIT_ASSERT(2 == strm.tell());
-
-  strm.seek(1, librevenge::RVNG_SEEK_CUR);
-  CPPUNIT_ASSERT(3 == strm.tell());
-  strm.seek(-2, librevenge::RVNG_SEEK_CUR);
-  CPPUNIT_ASSERT(1 == strm.tell());
-
-  CPPUNIT_ASSERT(!strm.isEnd());
-  CPPUNIT_ASSERT(0 == strm.seek(0, librevenge::RVNG_SEEK_END));
-  CPPUNIT_ASSERT(strm.isEnd());
-  CPPUNIT_ASSERT(sizeof(data) == strm.tell());
-  CPPUNIT_ASSERT(0 != strm.seek(1, librevenge::RVNG_SEEK_END)); // cannot seek after the end
-  CPPUNIT_ASSERT(strm.isEnd());
-  CPPUNIT_ASSERT(0 == strm.seek(-1, librevenge::RVNG_SEEK_END)); // but can seek before it
-  CPPUNIT_ASSERT(!strm.isEnd());
-  CPPUNIT_ASSERT((sizeof(data) - 1) == strm.tell());
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ZMFInternalStreamTest);
-
-}
-
-/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/test/ZMFTypesTest.cpp b/src/test/ZMFTypesTest.cpp
index 4b39a1c..c830017 100644
--- a/src/test/ZMFTypesTest.cpp
+++ b/src/test/ZMFTypesTest.cpp
@@ -28,8 +28,8 @@ using libzmf::Point;
 class ZMFTypesTest : public CPPUNIT_NS::TestFixture
 {
 public:
-  virtual void setUp();
-  virtual void tearDown();
+  virtual void setUp() override;
+  virtual void tearDown() override;
 
 private:
   CPPUNIT_TEST_SUITE(ZMFTypesTest);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-openoffice/libzmf.git



More information about the Pkg-openoffice-commits mailing list