[libgetdata] 01/08: 0.9.2.1 upstream

Alastair McKinstry mckinstry at moszumanska.debian.org
Wed May 3 10:35:11 UTC 2017


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

mckinstry pushed a commit to tag debian/0.9.3-1
in repository libgetdata.

commit 0b4643459d15a37b10a7d462a0d6012709a4a23f
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Tue May 31 11:58:11 2016 +0100

    0.9.2.1 upstream
---
 ChangeLog                                          |  98 ++++++++++++
 Makefile.in                                        |   1 +
 NEWS                                               |  42 +++++
 bindings/Makefile.in                               |   1 +
 bindings/cxx/Makefile.in                           |   1 +
 bindings/cxx/test/Makefile.in                      |   1 +
 bindings/cxx/test/big_test.cpp                     |   2 +-
 bindings/f77/Makefile.in                           |   1 +
 bindings/f77/test/Makefile.in                      |   1 +
 bindings/idl/Makefile.in                           |   1 +
 bindings/idl/test/Makefile.in                      |   1 +
 bindings/make_parameters.c                         |   2 +-
 bindings/matlab/Makefile.in                        |   1 +
 bindings/matlab/getdata_constants.m                |   2 +-
 bindings/matlab/test/Makefile.in                   |   1 +
 bindings/perl/Makefile.in                          |   1 +
 bindings/php/Makefile.in                           |   1 +
 bindings/php/getdata.c                             |  37 +++--
 bindings/php/test/Makefile.am                      |   4 +-
 bindings/php/test/Makefile.in                      |   5 +-
 bindings/php/test/callback.php                     |  79 +++++++++
 bindings/php/test/persistence.php                  |  79 +++++++++
 bindings/python/Makefile.in                        |   1 +
 bindings/python/pydirfile.c                        |  52 +++---
 bindings/python/pyentry.c                          |   4 +-
 bindings/python/test/Makefile.in                   |   1 +
 configure                                          |  39 ++---
 configure.ac                                       |   3 +-
 doc/Makefile.in                                    |   1 +
 m4/perl.m4                                         |   6 +-
 m4/version.m4                                      |   9 +-
 man/Makefile.in                                    |   1 +
 man/gd_alter_entry.3                               |  18 ++-
 man/gd_getdata.3                                   |   8 +-
 man/gd_putdata.3                                   |  10 +-
 src/Makefile.am                                    |  14 +-
 src/Makefile.in                                    |  15 +-
 src/add.c                                          |   4 +-
 src/encoding.c                                     |   4 +-
 src/entry.c                                        | 117 ++++++++------
 src/field_list.c                                   |   2 +-
 src/flac.c                                         |   5 +-
 src/flush.c                                        |   5 +-
 src/fragment.c                                     |   4 +-
 src/internal.h                                     |   2 +
 src/mod.c                                          | 178 ++++++++++++++-------
 src/zzip.c                                         |   3 +-
 test/Makefile.am                                   |  18 +--
 test/Makefile.in                                   |  46 ++++--
 test/add_scalar_carray_bad.c                       |  33 ++--
 test/alter_entry_scalar3c.c                        |  39 +++--
 ...ter_entry_scalar3c.c => alter_entry_scalar3i.c} |   0
 ...ter_entry_scalar3c.c => alter_entry_scalar3r.c} |  32 ++--
 test/flac_put_big.c                                |  22 +--
 test/flac_put_complex128.c                         |   4 +-
 test/flac_put_float64.c                            |   4 +-
 test/flac_put_int32.c                              |   4 +-
 test/flac_put_little.c                             |  22 +--
 test/flush_amb_code.c                              |   3 +-
 test/lzma_put.c                                    |   2 +-
 test/parse_scalar2.c                               |   3 +-
 util/Makefile.in                                   |   1 +
 62 files changed, 770 insertions(+), 331 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ccd0eea..d65b8fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,101 @@
+2016-03-29   D. V. Wiebe <getdata at ketiltrout.net> svn:1055
+	GetData-0.9.2.1 released:
+
+	* m4/version.m4: distinguish library version (getdata_version) and package
+	version (getdata_pkg_version).
+	* configure.ac bindings/idl/package/configure.ac
+	bindings/matlab/package/configure.ac: Call AC_INIT with getdata_pkg_version
+	not getdata_version
+	* configure.ac: AC_SUBST GETDATA_LIB_VERSION
+	* bindings/php/getdata.c (PHP_MINFO_FUNCTION getdata_module_entry)
+	bindings/make_parameters.c (MatLab) src/encoding.c (_GD_MissingFramework)
+	src/flush.c (_GD_FlushFragment): Use GD_GETDATA_VERSION instead of
+	PACKAGE_VERSION or VERSION.
+	* src/Makefile.am: Use GETDATA_LIB_VERSION for module version instead of
+	PACKAGE_VERSION
+
+2016-03-25   D. V. Wiebe <getdata at ketiltrout.net> svn:1054
+	* test/alter_entry_scalar3r.c: Fix check.
+
+2016-03-24   D. V. Wiebe <getdata at ketiltrout.net> svn:1050
+	GetData-0.9.2 released.
+
+2016-03-21   D. V. Wiebe <getdata at ketiltrout.net> svn:1049
+	* php/getdata.c (gdphp_open): Record persistent-ness.
+	* php/getdata.c (gd_close gd_discard): Don't close persistent dirfiles.
+	* php/test/persistence.php: Added.
+
+2016-03-12   D. V. Wiebe <getdata at ketiltrout.net> svn:1048
+	GetData-0.9.2rc2:
+
+	* bindings/python/pydirfile.c (gdpy_dirfile_delentry): Change flags to
+	unsigned per C API.
+	* bindings/python/pydirfile.c (gdpy_dirfile_include): Change flags to
+	unsigned long per C API.
+
+	* bindings/python/pydirfile.c (gdpy_dirfile_getcarray): Use unsigned
+	PY_LONG_LONG for len instead of size_t since size_t isn't supported by
+	PyArg_ParseTupleAndKeywords.
+
+	* bindings/python/pydirfile.c (gdpy_dirfile_getconstants
+	gdpy_dirfile_mcarrays gdpy_dirfile_getmconstants gdpy_dirfile_getmfieldlist
+	gdpy_dirfile_putconstant gdpy_dirfile_putcarray gdpy_dirfile_putdata)
+	bindings/python/pyentry.c (gdpy_entry_init): Don't assume enums are the same
+	size as int.
+
+2016-03-08   D. V. Wiebe <getdata at ketiltrout.net> svn:1047
+	GetData-0.9.2rc1.
+
+2016-03-05   D. V. Wiebe <getdata at ketiltrout.net> svn:1046
+	* src/entry.c (_GD_GetScalar): Take scalar and scalar_ind directly;
+	allow E == NULL, return GD_E_BAD_SCALAR error instead of setting an
+	error; destatickify.
+	* src/entry.c (_GD_GetScalar2): Added with the old signature of
+	_GD_GetScalar.
+	* src/entry.c (_GD_Calculate): Call _GD_GetScalar2 instead of _GD_GetScalar
+	directly.
+	* src/mod.c (_GD_AlterScalar): Call _GD_GetScalar instead of gd_get_constant
+	to dereference when needed.  Also renamed most of the parameters to make
+	things (hopefully) less confusing in the future.
+	* test/alter_entry_scalar3i.c: Renamed from test/alter_entry_scalar3c.c.
+	* test/alter_entry_scalar3r.c test/alter_entry_scalar3c.c: Added.
+
+	* test/flac_put_big.c test/flac_put_little.c: Don't double-close the
+	dirfile.
+
+2016-03-02   D. V. Wiebe <getdata at ketiltrout.net> svn:1044
+	* src/mod.c (_GD_Change): Free the correct scalar for PHASE entries.
+
+	* bindings/cxx/test/big_test.cpp: Delete test 272's Dirfile object.
+
+2016-03-01   D. V. Wiebe <getdata at ketiltrout.net> svn:1043
+	* src/flush.c (_GD_FlushFragment): Don't double fclose on ferror.
+
+	* src/fragment.c (gd_desync): close dup'd dirfd on error.
+
+	* src/add.c (gd_add_string gd_madd_string): free the empty string created
+	by _GD_Add.
+	* src/flac.c (_GD_FlacClose): Free gdfl->data.
+	* src/zzip.c (_GD_ZzipSize): Free gdzz.
+	* test/flush_amb_code.c test/parse_scalar2.c: Call gd_free_entry_strings.
+
+2016-02-24   D. V. Wiebe <getdata at ketiltrout.net> svn:1041
+	* m4/perl.m4: Fix perlmandir when user specifies --with-perl-dir=
+
+	* src/flac.c (_GD_FlacSize): Close the file after reading it.
+
+	* test/flac_put_big.c test/flac_put_float64.c test/flac_put_little.c
+	test/flac_put_complex128.c test/flac_put_int32.c: Call gd_discard at the end.
+
+	* test/lzma_put.c: Fix Dirfile creation.
+
+	* src/field_list.c (_GD_EntryList): Fix fencepost error in realloc check.
+
+	* man/gd_getdata.3 man/gd_putdata.3: Mention the 2**63 sample limit.
+
+2016-02-18   D. V. Wiebe <getdata at ketiltrout.net> svn:1038
+	GetData-0.9.1 released.
+
 2016-02-17   D. V. Wiebe <getdata at ketiltrout.net> svn:1037
 	* src/gzip.c (_GD_GzipWrite): A return value of zero from gzwrite indicates
 	error.
diff --git a/Makefile.in b/Makefile.in
index da3cc37..40f77d5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -313,6 +313,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
diff --git a/NEWS b/NEWS
index 08f68b8..ee2a0cf 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,45 @@
+New in version 0.9.2.1:
+
+  Miscellaneous:
+
+  * This release fixes one entry in the test suite (alter_entry_scalar3r) which
+    was broken in the original 0.9.2 release.  The library and bindings are
+    unchanged (and report their version to be simply 0.9.2).  The error in
+    the test suite was reported by Dinar Valeev.
+
+New in version 0.9.2:
+  
+  Library Changes:
+
+  * BUG FIX: When using a FLAC-encoded reference field, gd_nframes() no
+    longer leaks file descriptors.
+
+  * BUG FIX: A segfault in gd_entry_list() introduced in 0.9.1 has been
+    fixed.  Reported by Christian Trippe.
+
+  * BUG FIX: A descriptor leak on error has been plugged in gd_desync().
+
+  * BUG FIX: A segfault triggered by encountering an I/O error while
+    writing metadata has been fixed.
+
+  * BUG FIX: Memory leaks in the FLAC and ZZIP encodings, plus single-byte
+    leaks in gd_add_string() and gd_madd_string() have been plugged.
+
+  * BUG FIX: gd_alter_entry() and gd_[m]alter_spec() no longer mangle the
+    values of entry parameters when asked to remove scalar field codes.
+    Reported by Dan Horák.
+
+  Bindings Changes:
+
+  * PYTHON BUG FIX: Fixed a potential segfault in dirfile.get_carray() on
+    platforms where sizeof size_t != sizeof int.  Reported by Dan Horák.
+
+  * PHP BUG FIX: Calling gd_discard or gd_close on a persistent dirfile now
+    does nothing, instead of closing the Dirfile and corrupting the
+    persistent resource.
+
+|=========================================================================|
+
 New in version 0.9.1:
   
   Library Changes:
diff --git a/bindings/Makefile.in b/bindings/Makefile.in
index df4459c..3d85057 100644
--- a/bindings/Makefile.in
+++ b/bindings/Makefile.in
@@ -294,6 +294,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
diff --git a/bindings/cxx/Makefile.in b/bindings/cxx/Makefile.in
index 022798e..1091735 100644
--- a/bindings/cxx/Makefile.in
+++ b/bindings/cxx/Makefile.in
@@ -350,6 +350,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
diff --git a/bindings/cxx/test/Makefile.in b/bindings/cxx/test/Makefile.in
index 2a690af..a3db01f 100644
--- a/bindings/cxx/test/Makefile.in
+++ b/bindings/cxx/test/Makefile.in
@@ -273,6 +273,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
diff --git a/bindings/cxx/test/big_test.cpp b/bindings/cxx/test/big_test.cpp
index 32b3828..845ab07 100644
--- a/bindings/cxx/test/big_test.cpp
+++ b/bindings/cxx/test/big_test.cpp
@@ -1768,7 +1768,7 @@ void run_tests(void)
   CHECK_OK2(272, 2);
   CHECK_NULL(272, rep);
 
-  id->Discard();
+  delete id;
 
 
 
diff --git a/bindings/f77/Makefile.in b/bindings/f77/Makefile.in
index 74b0025..14fdbd9 100644
--- a/bindings/f77/Makefile.in
+++ b/bindings/f77/Makefile.in
@@ -348,6 +348,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
diff --git a/bindings/f77/test/Makefile.in b/bindings/f77/test/Makefile.in
index 93cca23..d75abbf 100644
--- a/bindings/f77/test/Makefile.in
+++ b/bindings/f77/test/Makefile.in
@@ -310,6 +310,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
diff --git a/bindings/idl/Makefile.in b/bindings/idl/Makefile.in
index 45b56e7..2d55717 100644
--- a/bindings/idl/Makefile.in
+++ b/bindings/idl/Makefile.in
@@ -329,6 +329,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
diff --git a/bindings/idl/test/Makefile.in b/bindings/idl/test/Makefile.in
index 71b4be7..85840ef 100644
--- a/bindings/idl/test/Makefile.in
+++ b/bindings/idl/test/Makefile.in
@@ -222,6 +222,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
diff --git a/bindings/make_parameters.c b/bindings/make_parameters.c
index 6c06eaf..ec2aa55 100644
--- a/bindings/make_parameters.c
+++ b/bindings/make_parameters.c
@@ -531,7 +531,7 @@ void MatLab(void)
       "%   See also GETDATA\n\n", stdout);
 
   fputs("  GD = struct(...\n"
-      "    'VERSION', '" VERSION "'", stdout);
+      "    'VERSION', '" GD_GETDATA_VERSION "'", stdout);
 
   for (i = 0; constant_list[i].lname != NULL; ++i)
     printf(", ...\n    '%s', int32(%li)", constant_list[i].sname,
diff --git a/bindings/matlab/Makefile.in b/bindings/matlab/Makefile.in
index 3f6ae12..c685f02 100644
--- a/bindings/matlab/Makefile.in
+++ b/bindings/matlab/Makefile.in
@@ -329,6 +329,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
diff --git a/bindings/matlab/getdata_constants.m b/bindings/matlab/getdata_constants.m
index 57c2783..0def650 100644
--- a/bindings/matlab/getdata_constants.m
+++ b/bindings/matlab/getdata_constants.m
@@ -31,7 +31,7 @@ function GD = getdata_constants()
 %   See also GETDATA
 
   GD = struct(...
-    'VERSION', '0.9.1', ...
+    'VERSION', '0.9.2', ...
     'E_OK', int32(0), ...
     'E_FORMAT', int32(2), ...
     'E_CREAT', int32(4), ...
diff --git a/bindings/matlab/test/Makefile.in b/bindings/matlab/test/Makefile.in
index 4932b33..32bfe99 100644
--- a/bindings/matlab/test/Makefile.in
+++ b/bindings/matlab/test/Makefile.in
@@ -222,6 +222,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
diff --git a/bindings/perl/Makefile.in b/bindings/perl/Makefile.in
index 6997998..5b83af0 100644
--- a/bindings/perl/Makefile.in
+++ b/bindings/perl/Makefile.in
@@ -233,6 +233,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
diff --git a/bindings/php/Makefile.in b/bindings/php/Makefile.in
index db560c3..309826d 100644
--- a/bindings/php/Makefile.in
+++ b/bindings/php/Makefile.in
@@ -324,6 +324,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
diff --git a/bindings/php/getdata.c b/bindings/php/getdata.c
index 0b61e52..dca2c2b 100644
--- a/bindings/php/getdata.c
+++ b/bindings/php/getdata.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013, 2014, 2015 D. V. Wiebe
+/* Copyright (C) 2013, 2014, 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -150,13 +150,16 @@ static char *gdphp_context(char *buffer, const struct gdphp_context_t *ctx)
 }
 
 /* the dirfile resource */
-typedef struct _gdphp_dirfile {
+typedef struct gdphp_dirfile_ {
   DIRFILE *D;
   char *callback;
   int callback_len;
   zval **callback_data;
   char *key;
   int key_len;
+
+  /* Persistent resource stuff */
+  int persist;
 } gdphp_dirfile;
 
 int le_gdphp_dirfile;
@@ -315,6 +318,7 @@ static gdphp_dirfile *gdphp_open(const char *dirfilename, int len, long flags,
 
   /* record the dirfile */
   r->D = D;
+  r->persist = persist;
 
   dreturn("%p", r);
   return r;
@@ -1706,7 +1710,7 @@ PHP_MINFO_FUNCTION(getdata)
 
   php_info_print_table_start();
   php_info_print_table_header(2, "GetData support", "enabled");
-  php_info_print_table_row(2, "Version", PACKAGE_VERSION);
+  php_info_print_table_row(2, "Version", GD_GETDATA_VERSION);
   php_info_print_table_end();
 
   dreturnvoid();
@@ -2742,12 +2746,14 @@ PHP_FUNCTION(gd_close)
   GDPHP_PARSE("r", &z);
   GDPHP_FETCH_DIRFILE(r, z);
 
-  if (gd_close(r->D))
-    GDPHP_RETURN_F;
+  if (!r->persist) {
+    if (gd_close(r->D))
+      GDPHP_RETURN_F;
 
-  /* delete the resource on success */
-  r->D = NULL; /* avoid double close */
-  zend_list_delete(Z_LVAL_P(z));
+    /* delete the resource on success */
+    r->D = NULL; /* avoid double close */
+    zend_list_delete(Z_LVAL_P(z));
+  }
 
   GDPHP_RETURN_T;
 }
@@ -2876,12 +2882,14 @@ PHP_FUNCTION(gd_discard)
   GDPHP_PARSE("r", &z);
   GDPHP_FETCH_DIRFILE(r, z);
 
-  if (gd_discard(r->D))
-    GDPHP_RETURN_F;
+  if (!r->persist) {
+    if (gd_discard(r->D))
+      GDPHP_RETURN_F;
 
-  /* delete the resource on success */
-  r->D = NULL; /* avoid double close */
-  zend_list_delete(Z_LVAL_P(z));
+    /* delete the resource on success */
+    r->D = NULL; /* avoid double close */
+    zend_list_delete(Z_LVAL_P(z));
+  }
 
   GDPHP_RETURN_T;
 }
@@ -3460,6 +3468,7 @@ PHP_FUNCTION(gd_invalid_dirfile)
   memset(r, 0, sizeof(gdphp_dirfile));
 
   r->D = gd_invalid_dirfile();
+  r->persist = 0;
 
   ZEND_REGISTER_RESOURCE(return_value, r, le_gdphp_dirfile);
   dreturn("%p", r);
@@ -4914,7 +4923,7 @@ zend_module_entry getdata_module_entry = {
   NULL,
   PHP_MINFO(getdata),
 #if ZEND_MODULE_API_NO >= 20010901
-  PACKAGE_VERSION,
+  GD_GETDATA_VERSION,
 #endif
   STANDARD_MODULE_PROPERTIES
 };
diff --git a/bindings/php/test/Makefile.am b/bindings/php/test/Makefile.am
index 6161add..3b07cf1 100644
--- a/bindings/php/test/Makefile.am
+++ b/bindings/php/test/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2013, 2014, 2015 D. V. Wiebe
+# Copyright (C) 2013, 2014, 2015, 2016 D. V. Wiebe
 #
 ##########################################################################
 #
@@ -32,7 +32,7 @@ TESTS_ENVIRONMENT=${DL_LIBRARY_PATH}=../../../src/.libs:${${DL_LIBRARY_PATH}} \
 	-d "ignore_repeated_errors=0" -d "precision=14" -d "memory_limit=128M" \
 	-d "extension_dir=@top_builddir@/bindings/php/.libs" \
 	-d "extension=getdata.so" -d "session.auto_start=0" -f
-phpTESTS=big_test.php
+phpTESTS=big_test.php callback.php persistence.php
 TESTS=$(addprefix ${srcdir}/,$(phpTESTS))
 endif
 
diff --git a/bindings/php/test/Makefile.in b/bindings/php/test/Makefile.in
index 51b3cf6..85ac0d0 100644
--- a/bindings/php/test/Makefile.in
+++ b/bindings/php/test/Makefile.in
@@ -222,6 +222,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
@@ -375,7 +376,7 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
-# Copyright (C) 2013, 2014, 2015 D. V. Wiebe
+# Copyright (C) 2013, 2014, 2015, 2016 D. V. Wiebe
 #
 ##########################################################################
 #
@@ -408,7 +409,7 @@ AUTOMAKE_OPTIONS = foreign serial-tests
 @TEST_PHP_TRUE@	-d "extension_dir=@top_builddir@/bindings/php/.libs" \
 @TEST_PHP_TRUE@	-d "extension=getdata.so" -d "session.auto_start=0" -f
 
- at TEST_PHP_TRUE@phpTESTS = big_test.php
+ at TEST_PHP_TRUE@phpTESTS = big_test.php callback.php persistence.php
 @TEST_PHP_TRUE at TESTS = $(addprefix ${srcdir}/,$(phpTESTS))
 EXTRA_DIST = ${phpTESTS}
 all: all-am
diff --git a/bindings/php/test/callback.php b/bindings/php/test/callback.php
new file mode 100644
index 0000000..5c04e85
--- /dev/null
+++ b/bindings/php/test/callback.php
@@ -0,0 +1,79 @@
+<?php
+# Copyright (C) 2013 D. V. Wiebe
+#
+##########################################################################
+#
+# This file is part of the GetData project.
+#
+# GetData is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation; either version 2.1 of the License, or (at your
+# option) any later version.
+#
+# GetData 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 Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with GetData; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+
+$ret = 2;
+
+function callback($pdata, $extra)
+{
+  global $ret;
+
+  $ret = 0;
+
+  if ($extra != 'extra stuff') {
+    echo 'extra = ', $extra, "\n";
+    $ret = 1;
+  }
+
+  if ($pdata['suberror'] != 8) {
+    echo 'suberror = ', $pdata['suberror'], "\n";
+    $ret = 1;
+  }
+
+  if ($pdata['linenum'] != 2) {
+    echo 'linenum = ', $pdata['linenum'], "\n";
+    $ret = 1;
+  }
+
+  if ($pdata['line'] != "bad line\n") {
+    echo 'line = ', $pdata['line'], "\n";
+    $ret = 1;
+  }
+
+  if (preg_match('/dirfile\/format$/', $pdata['filename']) != 1) {
+    echo 'filename = ', $pdata['filename'], "\n";
+    $ret = 1;
+  }
+
+  return GD_SYNTAX_IGNORE;
+}
+
+mkdir('dirfile', 0700);
+file_put_contents('dirfile/format', "data RAW UINT16 8\nbad line\n");
+
+$D = gd_open('dirfile', GD_RDONLY, 'callback', 'extra stuff');
+$e = gd_error($D);
+
+unlink('dirfile/format');
+rmdir('dirfile');
+
+if ($ret == 2) {
+  echo "never saw callback\n";
+  $ret = 1;
+}
+if ($e != GD_E_OK) {
+  echo "error = ", $e, "\n";
+  $ret = 1;
+}
+
+exit($ret);
+
+?>
diff --git a/bindings/php/test/persistence.php b/bindings/php/test/persistence.php
new file mode 100644
index 0000000..cf78bdc
--- /dev/null
+++ b/bindings/php/test/persistence.php
@@ -0,0 +1,79 @@
+<?php
+# Copyright (C) 2016 D. V. Wiebe
+#
+##########################################################################
+#
+# This file is part of the GetData project.
+#
+# GetData is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation; either version 2.1 of the License, or (at your
+# option) any later version.
+#
+# GetData 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 Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with GetData; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+
+$ret = 0;
+
+unlink('dirfile/format');
+rmdir('dirfile');
+
+$D1 = gd_popen('dirfile', GD_RDWR | GD_CREAT | GD_EXCL);
+
+$e1 = gd_error($D1);
+if ($e1 != GD_E_OK) {
+  echo "e1 = ", $e1, "\n";
+  $ret = 1;
+}
+
+gd_add_spec($D1, "const CONST UINT8 1");
+
+$n1 = gd_nfields_by_type($D1, GD_CONST_ENTRY);
+if ($n1 != 1) {
+  echo "n1 = ", $n1, "\n";
+  $ret = 1;
+}
+
+$D2 = gd_popen('dirfile', GD_RDWR | GD_CREAT);
+
+$e2 = gd_error($D2);
+if ($e2 != GD_E_OK) {
+  echo "e2 = ", $e2, "\n";
+  $ret = 1;
+}
+
+$n2 = gd_nfields_by_type($D2, GD_CONST_ENTRY);
+if ($n2 != 1) {
+  echo "n2 = ", $n2, "\n";
+  $ret = 1;
+}
+
+if (!gd_discard($D2)) {
+  echo "dicard(D2) returns FALSE\n";
+  $ret = 1;
+}
+
+$n3 = gd_nfields_by_type($D1, GD_CONST_ENTRY);
+if ($n3 != 1) {
+  echo "n3 = ", $n3, "\n";
+  $ret = 1;
+}
+
+if (!gd_discard($D1)) {
+  echo "dicard(D1) returns FALSE\n";
+  $ret = 1;
+}
+
+unlink('dirfile/format');
+rmdir('dirfile');
+
+exit($ret);
+
+?>
diff --git a/bindings/python/Makefile.in b/bindings/python/Makefile.in
index 4bb1368..3ae8db2 100644
--- a/bindings/python/Makefile.in
+++ b/bindings/python/Makefile.in
@@ -290,6 +290,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
diff --git a/bindings/python/pydirfile.c b/bindings/python/pydirfile.c
index adedde8..aea2e31 100644
--- a/bindings/python/pydirfile.c
+++ b/bindings/python/pydirfile.c
@@ -334,12 +334,12 @@ static PyObject *gdpy_dirfile_delentry(struct gdpy_dirfile_t *self,
 {
   char *keywords[] = {"field_code", "flags", NULL};
   const char *field_code;
-  int flags = 0;
+  unsigned int flags = 0;
 
   dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
-        "s|i:pygetdata.dirfile.delete", keywords, &field_code, &flags))
+        "s|I:pygetdata.dirfile.delete", keywords, &field_code, &flags))
   {
     dreturn("%p", NULL);
     return NULL;
@@ -377,7 +377,7 @@ static PyObject *gdpy_dirfile_getcarray(struct gdpy_dirfile_t *self,
     NULL};
   const char *field_code;
   unsigned int start = 0;
-  size_t len = 0;
+  unsigned PY_LONG_LONG len = 0;
   int as_list = 0;
   gd_type_t return_type;
   PyObject *return_type_obj = NULL;
@@ -387,7 +387,7 @@ static PyObject *gdpy_dirfile_getcarray(struct gdpy_dirfile_t *self,
   dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
-        "s|OIIi:pygetdata.dirfile.get_carray", keywords, &field_code,
+        "s|OIKi:pygetdata.dirfile.get_carray", keywords, &field_code,
         &return_type_obj, &start, &len, &as_list))
   {
     dreturn("%p", NULL);
@@ -410,7 +410,8 @@ static PyObject *gdpy_dirfile_getcarray(struct gdpy_dirfile_t *self,
     if (len == 0)
       gd_get_carray(self->D, field_code, GD_NULL, NULL);
     else
-      gd_get_carray_slice(self->D, field_code, start, len, GD_NULL, NULL);
+      gd_get_carray_slice(self->D, field_code, start, (size_t)len, GD_NULL,
+          NULL);
 
     PYGD_CHECK_ERROR(self->D, NULL);
 
@@ -546,8 +547,7 @@ static PyObject *gdpy_dirfile_carrays(struct gdpy_dirfile_t *self,
 {
   char *keywords[] = {"return_type", "as_list", NULL};
   const char **fields;
-  int as_list = 0, i;
-  gd_type_t return_type;
+  int as_list = 0, i, return_type;
   const gd_carray_t *carrays;
   PyObject *pyobj;
   npy_intp dims[] = { 0 };
@@ -565,7 +565,7 @@ static PyObject *gdpy_dirfile_carrays(struct gdpy_dirfile_t *self,
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  carrays = gd_carrays(self->D, return_type);
+  carrays = gd_carrays(self->D, (gd_type_t)return_type);
 
   pyobj = PyList_New(0);
 
@@ -593,7 +593,7 @@ static PyObject *gdpy_dirfile_getconstants(struct gdpy_dirfile_t *self,
   char *keywords[] = {"return_type", NULL};
   const char **fields;
   const char *values;
-  gd_type_t return_type;
+  int return_type;
   PyObject *pyobj;
 
   dtrace("%p, %p, %p", self, args, keys);
@@ -609,7 +609,7 @@ static PyObject *gdpy_dirfile_getconstants(struct gdpy_dirfile_t *self,
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  values = gd_constants(self->D, return_type);
+  values = gd_constants(self->D, (gd_type_t)return_type);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
@@ -944,7 +944,7 @@ static PyObject *gdpy_dirfile_getfieldlist(struct gdpy_dirfile_t *self,
 {
   const char **fields;
   char *keywords[] = { "type", NULL };
-  int type = (int)GD_NO_ENTRY;
+  int type = GD_NO_ENTRY;
   PyObject *pyobj;
 
   dtrace("%p, %p, %p", self, args, keys);
@@ -1048,7 +1048,7 @@ static PyObject *gdpy_dirfile_include(struct gdpy_dirfile_t *self,
     NULL };
   const char *file = NULL;
   int fragment_index = 0;
-  unsigned int flags = 0;
+  unsigned long flags = 0;
   char *prefix = NULL, *suffix = NULL;
   long index;
   PyObject *pyobj;
@@ -1056,7 +1056,7 @@ static PyObject *gdpy_dirfile_include(struct gdpy_dirfile_t *self,
   dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
-        "s|iiss:pygetdata.dirfile.include", keywords, &file, &fragment_index,
+        "s|ikss:pygetdata.dirfile.include", keywords, &file, &fragment_index,
         &flags, &prefix, &suffix))
   {
     dreturn("%p", NULL);
@@ -1163,8 +1163,7 @@ static PyObject *gdpy_dirfile_mcarrays(struct gdpy_dirfile_t *self,
   char *keywords[] = {"parent", "return_type", "as_list", NULL};
   const char **fields;
   const char *parent;
-  int as_list = 0, i;
-  gd_type_t return_type;
+  int as_list = 0, i, return_type;
   const gd_carray_t *carrays;
   PyObject *pyobj;
   npy_intp dims[] = { 0 };
@@ -1183,7 +1182,7 @@ static PyObject *gdpy_dirfile_mcarrays(struct gdpy_dirfile_t *self,
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  carrays = gd_mcarrays(self->D, parent, return_type);
+  carrays = gd_mcarrays(self->D, parent, (gd_type_t)return_type);
 
   pyobj = PyList_New(0);
 
@@ -1212,7 +1211,7 @@ static PyObject *gdpy_dirfile_getmconstants(struct gdpy_dirfile_t *self,
   const char **fields;
   const char *values;
   const char *parent = NULL;
-  gd_type_t return_type;
+  int return_type;
   PyObject *pyobj;
 
   dtrace("%p, %p, %p", self, args, keys);
@@ -1228,7 +1227,7 @@ static PyObject *gdpy_dirfile_getmconstants(struct gdpy_dirfile_t *self,
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  values = gd_mconstants(self->D, parent, return_type);
+  values = gd_mconstants(self->D, parent, (gd_type_t)return_type);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
@@ -1262,7 +1261,7 @@ static PyObject *gdpy_dirfile_getmfieldlist(struct gdpy_dirfile_t *self,
   const char **fields;
   char *keywords[] = { "parent", "type", NULL };
   const char *parent = NULL;
-  gd_entype_t type = GD_NO_ENTRY;
+  int type = GD_NO_ENTRY;
   PyObject *pyobj;
 
   dtrace("%p, %p, %p", self, args, keys);
@@ -1770,7 +1769,7 @@ static PyObject *gdpy_dirfile_putconstant(struct gdpy_dirfile_t *self,
   char *keywords[] = {"field_code", "value", "type", NULL};
   const char *field_code;
   PyObject *value;
-  gd_type_t type = GD_UNKNOWN;
+  int type = GD_UNKNOWN;
   union gdpy_quadruple_value data;
   int data_type;
 
@@ -1814,7 +1813,7 @@ static PyObject *gdpy_dirfile_putcarray(struct gdpy_dirfile_t *self,
   const char *field_code;
   unsigned int start = 0;
   size_t len;
-  gd_type_t type = GD_UNKNOWN;
+  int type = GD_UNKNOWN;
   PyObject *pyobj;
   int have_ndarray = 0;
 
@@ -1913,7 +1912,7 @@ static PyObject *gdpy_dirfile_putdata(struct gdpy_dirfile_t *self,
     "first_sample", NULL };
   const char *field_code;
   PY_LONG_LONG first_frame = 0, first_sample = 0;
-  gd_type_t type = GD_UNKNOWN;
+  int type = GD_UNKNOWN;
   PyObject *pyobj;
   size_t ns;
   int have_ndarray = 0;
@@ -1993,13 +1992,10 @@ static PyObject *gdpy_dirfile_putdata(struct gdpy_dirfile_t *self,
     ns = gd_putdata64(self->D, field_code, first_frame, first_sample, 0, ns,
         type, data);
 
-    if (have_ndarray)
-      PYGD_CHECK_ERROR(self->D, NULL);
-    else {
-      PYGD_CHECK_ERROR2(self->D, NULL, free(data));
-
+    if (!have_ndarray)
       free(data);
-    }
+
+    PYGD_CHECK_ERROR(self->D, NULL);
   }
 
   pyobj = PyLong_FromLongLong(ns);
diff --git a/bindings/python/pyentry.c b/bindings/python/pyentry.c
index d591f44..4444f64 100644
--- a/bindings/python/pyentry.c
+++ b/bindings/python/pyentry.c
@@ -640,6 +640,7 @@ static int gdpy_entry_init(struct gdpy_entry_t *self, PyObject *args,
   gd_entry_t E;
   char *keywords[] = {"type", "name", "fragment_index", "parameters", NULL};
   PyObject *parms = NULL;
+  int field_type;
   const char *field_name;
 
   dtrace("%p, %p, %p", self, args, keys);
@@ -647,12 +648,13 @@ static int gdpy_entry_init(struct gdpy_entry_t *self, PyObject *args,
   memset(&E, 0, sizeof(gd_entry_t));
 
   if (!PyArg_ParseTupleAndKeywords(args, keys, "isi|O:pygetdata.entry.__init__",
-        keywords, &E.field_type, &field_name, &E.fragment_index, &parms))
+        keywords, &field_type, &field_name, &E.fragment_index, &parms))
   {
     dreturn("%i", -1);
     return -1;
   }
 
+  E.field_type = field_type;
   E.field = strdup(field_name);
   if (E.field == NULL) {
     PyErr_NoMemory();
diff --git a/bindings/python/test/Makefile.in b/bindings/python/test/Makefile.in
index 43269e7..2fb5b1a 100644
--- a/bindings/python/test/Makefile.in
+++ b/bindings/python/test/Makefile.in
@@ -222,6 +222,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
diff --git a/configure b/configure
index e50cfdb..301d2ca 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 GetData 0.9.1.
+# Generated by GNU Autoconf 2.69 for GetData 0.9.2.1.
 #
 # Report bugs to <getdata-devel at lists.sourceforge.net>.
 #
@@ -598,8 +598,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='GetData'
 PACKAGE_TARNAME='getdata'
-PACKAGE_VERSION='0.9.1'
-PACKAGE_STRING='GetData 0.9.1'
+PACKAGE_VERSION='0.9.2.1'
+PACKAGE_STRING='GetData 0.9.2.1'
 PACKAGE_BUGREPORT='getdata-devel at lists.sourceforge.net'
 PACKAGE_URL='http://getdata.sourceforge.net/'
 
@@ -884,6 +884,7 @@ GETDATA_IFACE_AGE
 GETDATA_IMPL_REVISION
 GETDATA_IFACE_VERSION
 BUILDCC
+GETDATA_LIB_VERSION
 GETDATA_VERSION_SUFFIX
 GETDATA_REVISION
 GETDATA_MINOR
@@ -1543,7 +1544,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 GetData 0.9.1 to adapt to many kinds of systems.
+\`configure' configures GetData 0.9.2.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1613,7 +1614,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of GetData 0.9.1:";;
+     short | recursive ) echo "Configuration of GetData 0.9.2.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1834,7 +1835,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-GetData configure 0.9.1
+GetData configure 0.9.2.1
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -3009,7 +3010,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 GetData $as_me 0.9.1, which was
+It was created by GetData $as_me 0.9.2.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3367,7 +3368,7 @@ $as_echo "#define GETDATA_MAJOR 0" >>confdefs.h
 $as_echo "#define GETDATA_MINOR 9" >>confdefs.h
 
 
-$as_echo "#define GETDATA_REVISION 1" >>confdefs.h
+$as_echo "#define GETDATA_REVISION 2" >>confdefs.h
 
 
 $as_echo "#define GETDATA_VERSION_SUFFIX \"\"" >>confdefs.h
@@ -3377,10 +3378,12 @@ GETDATA_MAJOR=0
 
 GETDATA_MINOR=9
 
-GETDATA_REVISION=1
+GETDATA_REVISION=2
 
 GETDATA_VERSION_SUFFIX=
 
+GETDATA_LIB_VERSION=0.9.2
+
 
 
 
@@ -3391,7 +3394,7 @@ GETDATA_VERSION_SUFFIX=
 
 GETDATA_IFACE_VERSION=7
 
-GETDATA_IMPL_REVISION=1
+GETDATA_IMPL_REVISION=2
 
 GETDATA_IFACE_AGE=0
 
@@ -4343,7 +4346,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='getdata'
- VERSION='0.9.1'
+ VERSION='0.9.2.1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -4873,9 +4876,9 @@ _ACEOF
 fi
 
 
-DEFINE_GD_GETDATA_VERSION="#define GD_GETDATA_VERSION \"0.9.1\""
+DEFINE_GD_GETDATA_VERSION="#define GD_GETDATA_VERSION \"0.9.2\""
 
-DEFINE_GD_GETDATA_INT_VERSION="#define GD_GETDATA_INT_VERSION `${PRINTF} %i%02i 9 1`"
+DEFINE_GD_GETDATA_INT_VERSION="#define GD_GETDATA_INT_VERSION `${PRINTF} %i%02i 9 2`"
 
 echo
 echo "*** Checking host environment"
@@ -26169,7 +26172,7 @@ Usage: $0 [OPTIONS]
 Report bugs to <bug-libtool at gnu.org>."
 
 lt_cl_version="\
-GetData config.lt 0.9.1
+GetData config.lt 0.9.2.1
 configured by $0, generated by GNU Autoconf 2.69.
 
 Copyright (C) 2011 Free Software Foundation, Inc.
@@ -32015,11 +32018,11 @@ perlmandir=`$perl_int -V::siteman3direxp: | sed -e "s/'//g" | sed -e "s/ \t*$//"
 
   elif test $perl_inst_type != "vendor"; then
     perldir="${local_perl_path}"
-    perlmandir="${man3dir}"
+    perlmandir="UNKNOWN"
   fi
 
   if test $perlmandir = "UNKNOWN"; then
-    perlmandir="${mandir}"
+    perlmandir="${mandir}/man3"
   fi
 
 
@@ -35070,7 +35073,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 GetData $as_me 0.9.1, which was
+This file was extended by GetData $as_me 0.9.2.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -35137,7 +35140,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="\\
-GetData config.status 0.9.1
+GetData config.status 0.9.2.1
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index be2455e..fa1e97c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ dnl
 
 m4_include([m4/version.m4])
 
-AC_INIT([GetData],[getdata_version],[getdata-devel at lists.sourceforge.net],,
+AC_INIT([GetData],[getdata_pkg_version],[getdata-devel at lists.sourceforge.net],,
         [http://getdata.sourceforge.net/])
 
 AC_COPYRIGHT(
@@ -43,6 +43,7 @@ AC_SUBST([GETDATA_MAJOR], [getdata_major])
 AC_SUBST([GETDATA_MINOR], [getdata_minor])
 AC_SUBST([GETDATA_REVISION], [getdata_revision])
 AC_SUBST([GETDATA_VERSION_SUFFIX], [getdata_extra])
+AC_SUBST([GETDATA_LIB_VERSION], [getdata_version])
 
 AC_PREREQ([2.65])
 AC_CONFIG_MACRO_DIR([m4])
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 85358ce..f08ce31 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -234,6 +234,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
diff --git a/m4/perl.m4 b/m4/perl.m4
index bb6cbba..32e624b 100644
--- a/m4/perl.m4
+++ b/m4/perl.m4
@@ -1,4 +1,4 @@
-dnl Copyright (C) 2011-2013 D. V. Wiebe
+dnl Copyright (C) 2011-2013, 2015, 2016 D. V. Wiebe
 dnl
 dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
 dnl
@@ -178,11 +178,11 @@ if test "x${have_perl}" != "xno"; then
     GD_PERL_CONFIG([perlmandir], [siteman3direxp])
   elif test $perl_inst_type != "vendor"; then
     perldir="${local_perl_path}"
-    perlmandir="${man3dir}"
+    perlmandir="UNKNOWN"
   fi
 
   if test $perlmandir = "UNKNOWN"; then
-    perlmandir="${mandir}"
+    perlmandir="${mandir}/man3"
   fi
 
   AC_SUBST([perldir])
diff --git a/m4/version.m4 b/m4/version.m4
index 58fdec9..ed46a49 100644
--- a/m4/version.m4
+++ b/m4/version.m4
@@ -1,4 +1,4 @@
-dnl Copyright (C) 2011-2013 D. V. Wiebe
+dnl Copyright (C) 2011-2016 D. V. Wiebe
 dnl
 dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
 dnl
@@ -20,15 +20,18 @@ dnl 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 m4_define(getdata_major,    0)
 m4_define(getdata_minor,    9)
-m4_define(getdata_revision, 1)
+m4_define(getdata_revision, 2)
 m4_define(getdata_extra,    [])
+m4_define(getdata_pkg_extra,[.1])
 m4_define(getdata_version,
           getdata_major.getdata_minor.getdata_revision[]getdata_extra)
+m4_define(getdata_pkg_version,
+          getdata_version[]getdata_pkg_extra)
 
 dnl libgetdata current interface version
 m4_define(getdata_iface_version,    7)
 dnl libgetdata current interface implementation revision
-m4_define(getdata_impl_revision,    1)
+m4_define(getdata_impl_revision,    2)
 dnl libgetdata interface age (current interface - oldest supported interface)
 m4_define(getdata_iface_age,        0)
 
diff --git a/man/Makefile.in b/man/Makefile.in
index dd94ff3..7b55cac 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -238,6 +238,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
diff --git a/man/gd_alter_entry.3 b/man/gd_alter_entry.3
index b265fd7..dfc2df1 100644
--- a/man/gd_alter_entry.3
+++ b/man/gd_alter_entry.3
@@ -1,6 +1,6 @@
 .\" gd_alter_entry.3.  The gd_alter_entry man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2012, 2013, 2014 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012, 2013, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_alter_entry 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_alter_entry 3 "4 March 2016" "Version 0.9.2" "GETDATA"
 .SH NAME
 gd_alter_entry \(em modify the metadata of a dirfile field
 .SH SYNOPSIS
@@ -131,8 +131,7 @@ Some entry members have special values which indicate no change should be
 made to the member.  These special values are:
 .TP
 .B NULL\fR:
-any of the string members, also 
-.IR m ", " b ", " a ", " cm ", " cb ", or " ca ;
+any of the string members;
 .TP
 .B 0\fR:
 .IR spf ", " n_fields ", " numbits ", " cdividend ", " dividend ", or " array_len ;
@@ -168,6 +167,17 @@ value of the corresponding numerical
 .I entry
 member is the special value listed above indicating no change, no change is
 made to the field parameter at all.
+.I NB:
+In this case, GetData also ignores the corresponding
+.IR entry -> scalar_ind
+element, even if it differs from the current value.  To change a
+.I scalar_ind
+element without changing the corresponding
+.IR scalar ,
+set that
+.I scalar
+element to its current value (at which point GetData operates as per the
+previous bullet).
 .IP \(bu 4
 the NULL pointer.  If the corresponding field parameter was previously a field
 code, the field code will be deleted and a literal number used instead.  In the
diff --git a/man/gd_getdata.3 b/man/gd_getdata.3
index 18ed01a..d127f59 100644
--- a/man/gd_getdata.3
+++ b/man/gd_getdata.3
@@ -1,6 +1,6 @@
 .\" gd_getdata.3.  The gd_getdata man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 D. V. Wiebe
+.\" Copyright (C) 2008-2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_getdata 3 "16 December 2015" "Version 0.9.1" "GETDATA"
+.TH gd_getdata 3 "24 February 2016" "Version 0.9.2" "GETDATA"
 .SH NAME
 gd_getdata \(em retrieve data from a dirfile database
 .SH SYNOPSIS
@@ -312,6 +312,10 @@ a raw field or LINTERP table.
 .B GD_E_LUT
 A LINTERP table was malformed.
 .TP
+.B GD_E_RANGE
+An attempt was made to read data outside the addressable Dirfile range (more
+than 2**63 samples past the start of the dirfile).
+.TP
 .B GD_E_RECURSE_LEVEL
 Too many levels of recursion were encountered while trying to resolve
 .IR field_code .
diff --git a/man/gd_putdata.3 b/man/gd_putdata.3
index 39156bc..3c548f5 100644
--- a/man/gd_putdata.3
+++ b/man/gd_putdata.3
@@ -1,6 +1,6 @@
 .\" gd_putdata.3.  The gd_putdata man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2011, 2012, 2014, 2015 D. V. Wiebe
+.\" Copyright (C) 2008-2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_putdata 3 "16 December 2015" "Version 0.9.1" "GETDATA"
+.TH gd_putdata 3 "24 February 2016" "Version 0.9.2" "GETDATA"
 .SH NAME
 gd_putdata \(em write data to a dirfile database
 .SH SYNOPSIS
@@ -228,9 +228,11 @@ field backing
 was protected from change by a /PROTECT directive.
 .TP
 .B GD_E_RANGE
-An attempt was made to write data before the beginning-of-frame marker for
+An attempt was made to write data either before the beginning-of-frame marker
+for
 .IR field_code ,
-or the raw field it depends on.
+or the raw field it depends on, or else outside the addressable Dirfile range
+(more than 2**63 samples beyond the start of the Dirfile).
 .TP
 .B GD_E_RECURSE_LEVEL
 Too many levels of recursion were encountered while trying to resolve
diff --git a/src/Makefile.am b/src/Makefile.am
index 2ec8c4c..2fc8b92 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -146,38 +146,38 @@ libgetdata_la_LIBADD = $(LIBLTDL) $(DLOPEN_LIBGETDATASLIM_LA) \
 											 $(DLOPEN_LIBGETDATAZZSLIM_LA) $(DLOPEN_LIBGETDATAFLAC_LA)
 
 libgetdataslim_la_SOURCES = slim.c
-libgetdataslim_la_LDFLAGS = $(SLIM_LDFLAGS) -release $(PACKAGE_VERSION) \
+libgetdataslim_la_LDFLAGS = $(SLIM_LDFLAGS) -release $(GETDATA_LIB_VERSION) \
 														-module $(SLIM_LIBS)
 libgetdataslim_la_CPPFLAGS = $(AM_CPPFLAGS) $(SLIM_CPPFLAGS)
 
 libgetdataflac_la_SOURCES = flac.c
-libgetdataflac_la_LDFLAGS = $(FLAC_LDFLAGS) -release $(PACKAGE_VERSION) \
+libgetdataflac_la_LDFLAGS = $(FLAC_LDFLAGS) -release $(GETDATA_LIB_VERSION) \
 														-module $(FLAC_LIBS)
 libgetdataflac_la_CPPFLAGS = $(AM_CPPFLAGS) $(FLAC_CPPFLAGS)
 
 libgetdatagzip_la_SOURCES = gzip.c
-libgetdatagzip_la_LDFLAGS = $(GZIP_LDFLAGS) -release $(PACKAGE_VERSION) \
+libgetdatagzip_la_LDFLAGS = $(GZIP_LDFLAGS) -release $(GETDATA_LIB_VERSION) \
 														-module $(GZIP_LIBS)
 libgetdatagzip_la_CPPFLAGS = $(AM_CPPFLAGS) $(GZIP_CPPFLAGS)
 
 libgetdatabzip2_la_SOURCES = bzip.c
-libgetdatabzip2_la_LDFLAGS = $(BZIP2_LDFLAGS) -release $(PACKAGE_VERSION) \
+libgetdatabzip2_la_LDFLAGS = $(BZIP2_LDFLAGS) -release $(GETDATA_LIB_VERSION) \
 														 -module $(BZIP2_LIBS)
 libgetdatabzip2_la_CPPFLAGS = $(AM_CPPFLAGS) $(BZIP2_CPPFLAGS)
 
 libgetdatalzma_la_SOURCES = lzma.c
-libgetdatalzma_la_LDFLAGS = $(LZMA_LDFLAGS) -release $(PACKAGE_VERSION) \
+libgetdatalzma_la_LDFLAGS = $(LZMA_LDFLAGS) -release $(GETDATA_LIB_VERSION) \
 														 -module $(LZMA_LIBS)
 libgetdatalzma_la_CPPFLAGS = $(AM_CPPFLAGS) $(LZMA_CPPFLAGS)
 
 libgetdatazzip_la_SOURCES = zzip.c
-libgetdatazzip_la_LDFLAGS = $(ZZIP_LDFLAGS) -release $(PACKAGE_VERSION) \
+libgetdatazzip_la_LDFLAGS = $(ZZIP_LDFLAGS) -release $(GETDATA_LIB_VERSION) \
 														 -module $(ZZIP_LIBS)
 libgetdatazzip_la_CPPFLAGS = $(AM_CPPFLAGS) $(ZZIP_CPPFLAGS)
 
 libgetdatazzslim_la_SOURCES = zzslim.c
 libgetdatazzslim_la_LDFLAGS = $(SLIM_LDFLAGS) $(ZZIP_LDFLAGS) \
-														-release $(PACKAGE_VERSION) -module \
+														-release $(GETDATA_LIB_VERSION) -module \
 														$(SLIM_LIBS) $(ZZIP_LIBS)
 libgetdatazzslim_la_CPPFLAGS = $(AM_CPPFLAGS) $(SLIM_CPPFLAGS) $(ZZIP_CPPFLAGS)
 
diff --git a/src/Makefile.in b/src/Makefile.in
index f635242..ba63714 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -391,6 +391,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
@@ -632,38 +633,38 @@ libgetdata_la_LIBADD = $(LIBLTDL) $(DLOPEN_LIBGETDATASLIM_LA) \
 											 $(DLOPEN_LIBGETDATAGZIP_LA) 
 
 libgetdataslim_la_SOURCES = slim.c
-libgetdataslim_la_LDFLAGS = $(SLIM_LDFLAGS) -release $(PACKAGE_VERSION) \
+libgetdataslim_la_LDFLAGS = $(SLIM_LDFLAGS) -release $(GETDATA_LIB_VERSION) \
 														-module $(SLIM_LIBS)
 
 libgetdataslim_la_CPPFLAGS = $(AM_CPPFLAGS) $(SLIM_CPPFLAGS)
 libgetdataflac_la_SOURCES = flac.c
-libgetdataflac_la_LDFLAGS = $(FLAC_LDFLAGS) -release $(PACKAGE_VERSION) \
+libgetdataflac_la_LDFLAGS = $(FLAC_LDFLAGS) -release $(GETDATA_LIB_VERSION) \
 														-module $(FLAC_LIBS)
 
 libgetdataflac_la_CPPFLAGS = $(AM_CPPFLAGS) $(FLAC_CPPFLAGS)
 libgetdatagzip_la_SOURCES = gzip.c
-libgetdatagzip_la_LDFLAGS = $(GZIP_LDFLAGS) -release $(PACKAGE_VERSION) \
+libgetdatagzip_la_LDFLAGS = $(GZIP_LDFLAGS) -release $(GETDATA_LIB_VERSION) \
 														-module $(GZIP_LIBS)
 
 libgetdatagzip_la_CPPFLAGS = $(AM_CPPFLAGS) $(GZIP_CPPFLAGS)
 libgetdatabzip2_la_SOURCES = bzip.c
-libgetdatabzip2_la_LDFLAGS = $(BZIP2_LDFLAGS) -release $(PACKAGE_VERSION) \
+libgetdatabzip2_la_LDFLAGS = $(BZIP2_LDFLAGS) -release $(GETDATA_LIB_VERSION) \
 														 -module $(BZIP2_LIBS)
 
 libgetdatabzip2_la_CPPFLAGS = $(AM_CPPFLAGS) $(BZIP2_CPPFLAGS)
 libgetdatalzma_la_SOURCES = lzma.c
-libgetdatalzma_la_LDFLAGS = $(LZMA_LDFLAGS) -release $(PACKAGE_VERSION) \
+libgetdatalzma_la_LDFLAGS = $(LZMA_LDFLAGS) -release $(GETDATA_LIB_VERSION) \
 														 -module $(LZMA_LIBS)
 
 libgetdatalzma_la_CPPFLAGS = $(AM_CPPFLAGS) $(LZMA_CPPFLAGS)
 libgetdatazzip_la_SOURCES = zzip.c
-libgetdatazzip_la_LDFLAGS = $(ZZIP_LDFLAGS) -release $(PACKAGE_VERSION) \
+libgetdatazzip_la_LDFLAGS = $(ZZIP_LDFLAGS) -release $(GETDATA_LIB_VERSION) \
 														 -module $(ZZIP_LIBS)
 
 libgetdatazzip_la_CPPFLAGS = $(AM_CPPFLAGS) $(ZZIP_CPPFLAGS)
 libgetdatazzslim_la_SOURCES = zzslim.c
 libgetdatazzslim_la_LDFLAGS = $(SLIM_LDFLAGS) $(ZZIP_LDFLAGS) \
-														-release $(PACKAGE_VERSION) -module \
+														-release $(GETDATA_LIB_VERSION) -module \
 														$(SLIM_LIBS) $(ZZIP_LIBS)
 
 libgetdatazzslim_la_CPPFLAGS = $(AM_CPPFLAGS) $(SLIM_CPPFLAGS) $(ZZIP_CPPFLAGS)
diff --git a/src/add.c b/src/add.c
index bbfc387..66476ed 100644
--- a/src/add.c
+++ b/src/add.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2015 D. V. Wiebe
+/* Copyright (C) 2008-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -1338,6 +1338,7 @@ int gd_add_string(DIRFILE* D, const char* field_code, const char* value,
     return -1;
   }
 
+  free(entry->e->u.string);
   entry->e->u.string = ptr;
   dreturn("%i", 0);
   return 0;
@@ -1959,6 +1960,7 @@ int gd_madd_string(DIRFILE* D, const char* parent,
     return -1;
   }
 
+  free(entry->e->u.string);
   entry->e->u.string = ptr;
   dreturn("%i", 0);
   return 0;
diff --git a/src/encoding.c b/src/encoding.c
index 9274e78..e7bcc97 100644
--- a/src/encoding.c
+++ b/src/encoding.c
@@ -287,7 +287,7 @@ int _GD_MissingFramework(int encoding, unsigned int funcs)
 
     /* make the library name */
     library = (char *)malloc(sizeof(GETDATA_MODULEDIR) +
-        strlen(_GD_ef[encoding].affix) + sizeof(PACKAGE_VERSION) + 13);
+        strlen(_GD_ef[encoding].affix) + sizeof(GD_GETDATA_VERSION) + 13);
     if (!library) {
       _GD_ef[encoding].provides = 0;
 #ifdef USE_PTHREAD
@@ -297,7 +297,7 @@ int _GD_MissingFramework(int encoding, unsigned int funcs)
       return 1;
     }
 
-    sprintf(library, GETDATA_MODULEPREFIX "%s-" PACKAGE_VERSION,
+    sprintf(library, GETDATA_MODULEPREFIX "%s-" GD_GETDATA_VERSION,
         _GD_ef[encoding].affix);
 
     /* affix starts with a capital letter, we need to lowercasify it --
diff --git a/src/entry.c b/src/entry.c
index c01ceac..53d7d9b 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2015 D. V. Wiebe
+/* Copyright (C) 2008-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -159,67 +159,78 @@ gd_entry_t* gd_free_entry_strings(gd_entry_t* entry) gd_nothrow
   return entry;
 }
 
-static int _GD_GetScalar(DIRFILE *restrict D, gd_entry_t *restrict E, int i,
-    gd_type_t type, void *restrict data, int err)
+int _GD_GetScalar(DIRFILE *restrict D, const char *restrict scalar,
+    int *index_in, gd_type_t type, void *restrict data, gd_entry_t *E)
 {
-  void *ptr = NULL;
   gd_entry_t* C = NULL;
   int repr, e = 0;
   char* field_code;
-  const char* scalar = E->scalar[i];
-  int index = E->scalar_ind[i];
+  int index = *index_in;
 
-  dtrace("%p, %p, %i, %i, %p, %i", D, E, i, type, data, err);
+  dtrace("%p, \"%s\", %p(%i), 0x%02X, %p, %p", D, scalar, index_in, *index_in,
+      type, data, E);
 
-  if (scalar != NULL) {
-    C = _GD_FindFieldAndRepr(D, scalar, &field_code, &repr, NULL, 0, 1);
+  C = _GD_FindFieldAndRepr(D, scalar, &field_code, &repr, NULL, 0, 1);
 
-    if (D->error) {
-      dreturn("%i", 1);
-      return 1;
-    }
+  if (D->error) {
+    dreturn("%i", 1);
+    return 1;
+  }
 
-    if (C == NULL) {
-      if (err)
-        _GD_SetError(D, GD_E_BAD_SCALAR, GD_E_SCALAR_CODE, E->field, 0,
-            field_code);
-      e = 1;
-    } else if (C->field_type != GD_CONST_ENTRY &&
-        C->field_type != GD_CARRAY_ENTRY)
-    {
-      if (err)
-        _GD_SetError(D, GD_E_BAD_SCALAR, GD_E_SCALAR_TYPE, E->field, 0,
-            field_code);
-      e = 1;
-    } else {
-      if (C->field_type == GD_CONST_ENTRY) {
-        index = 0;
-        E->scalar_ind[i] = -1;
-      } else if (index < 0) {
-        /* a CARRAY masquerading as a CONST; default to the first element */
-        index = E->scalar_ind[i] = 0;
-      }
+  if (field_code != scalar)
+    free(field_code);
+
+  if (C == NULL)
+    e = GD_E_SCALAR_CODE;
+  else if (C->field_type != GD_CONST_ENTRY &&
+      C->field_type != GD_CARRAY_ENTRY)
+  {
+    e = GD_E_SCALAR_TYPE;
+  } else {
+    if (C->field_type == GD_CONST_ENTRY) {
+      /* Ignore and reset index */
+      if (index != -1)
+        *index_in = -1;
+      index = 0;
+    } else if (index < 0) {
+      /* a CARRAY masquerading as a CONST; default to the first element */
+      index = *index_in = 0;
+    }
 
-      if ((D->flags & GD_ACCMODE) == GD_RDWR)
-        ptr = _GD_Realloc(D, C->e->u.scalar.client,
-            (C->e->u.scalar.n_client + 1) * sizeof(gd_entry_t*));
+    _GD_DoField(D, C, repr, index, 1, type, data);
 
-      _GD_DoField(D, C, repr, index, 1, type, data);
+    if (E && (D->flags & GD_ACCMODE) == GD_RDWR) {
+      void *ptr = _GD_Realloc(D, C->e->u.scalar.client,
+          (C->e->u.scalar.n_client + 1) * sizeof(gd_entry_t*));
 
       if (ptr) {
         C->e->u.scalar.client = (gd_entry_t **)ptr;
         C->e->u.scalar.client[C->e->u.scalar.n_client++] = E;
       }
     }
-
-    if (field_code != scalar)
-      free(field_code);
   }
 
   dreturn("%i", e);
   return e;
 }
 
+static int _GD_GetScalar2(DIRFILE *restrict D, gd_entry_t *restrict E, int i,
+    gd_type_t type, void *restrict data, int err)
+{
+  int e = 0;
+
+  dtrace("%p, %p, %i, 0x%02X, %p, %i", D, E, i, type, data, err);
+
+  if (E->scalar[i]) {
+    e = _GD_GetScalar(D, E->scalar[i], E->scalar_ind + i, type, data, E);
+    if (e && err)
+      _GD_SetError(D, GD_E_BAD_SCALAR, e, E->field, 0, E->scalar[i]);
+  }
+
+  dreturn("%i", (D->error != GD_E_OK) || e);
+  return (D->error != GD_E_OK) || e;
+}
+
 /* resolve non-literal scalars */
 int _GD_CalculateEntry(DIRFILE *restrict D, gd_entry_t *restrict E, int err)
 {
@@ -229,11 +240,11 @@ int _GD_CalculateEntry(DIRFILE *restrict D, gd_entry_t *restrict E, int err)
 
   switch(E->field_type) {
     case GD_RAW_ENTRY:
-      e = _GD_GetScalar(D, E, 0, GD_UINT_TYPE, &E->EN(raw,spf), err);
+      e = _GD_GetScalar2(D, E, 0, GD_UINT_TYPE, &E->EN(raw,spf), err);
       break;
     case GD_POLYNOM_ENTRY:
       for (i = 0; i <= E->EN(polynom,poly_ord); ++i) {
-        if (_GD_GetScalar(D, E, i, GD_COMPLEX128, &E->EN(polynom,ca)[i], err))
+        if (_GD_GetScalar2(D, E, i, GD_COMPLEX128, &E->EN(polynom,ca)[i], err))
           e = 1;
         else {
           E->EN(polynom,a)[i] = creal(E->EN(polynom,ca)[i]);
@@ -248,7 +259,7 @@ int _GD_CalculateEntry(DIRFILE *restrict D, gd_entry_t *restrict E, int err)
       break;
     case GD_LINCOM_ENTRY:
       for (i = 0; i < E->EN(lincom,n_fields); ++i) {
-        if (_GD_GetScalar(D, E, i, GD_COMPLEX128, &E->EN(lincom,cm)[i], err))
+        if (_GD_GetScalar2(D, E, i, GD_COMPLEX128, &E->EN(lincom,cm)[i], err))
           e = 1;
         else {
           E->EN(lincom,m)[i] = creal(E->EN(lincom,cm)[i]);
@@ -257,7 +268,7 @@ int _GD_CalculateEntry(DIRFILE *restrict D, gd_entry_t *restrict E, int err)
             cs = 1;
         }
 
-        if (_GD_GetScalar(D, E, i + GD_MAX_LINCOM, GD_COMPLEX128,
+        if (_GD_GetScalar2(D, E, i + GD_MAX_LINCOM, GD_COMPLEX128,
             &E->EN(lincom,cb)[i], err))
         {
           e = 1;
@@ -273,7 +284,7 @@ int _GD_CalculateEntry(DIRFILE *restrict D, gd_entry_t *restrict E, int err)
       }
       break;
     case GD_RECIP_ENTRY:
-      if (_GD_GetScalar(D, E, 0, GD_COMPLEX128, &E->EN(recip,cdividend), err))
+      if (_GD_GetScalar2(D, E, 0, GD_COMPLEX128, &E->EN(recip,cdividend), err))
         e = 1;
       else {
         E->EN(recip,dividend) = creal(E->EN(recip,cdividend));
@@ -283,32 +294,32 @@ int _GD_CalculateEntry(DIRFILE *restrict D, gd_entry_t *restrict E, int err)
       break;
     case GD_BIT_ENTRY:
     case GD_SBIT_ENTRY:
-      e = _GD_GetScalar(D, E, 0, GD_INT_TYPE, &E->EN(bit,bitnum), err);
-      e |= _GD_GetScalar(D, E, 1, GD_INT_TYPE, &E->EN(bit,numbits), err);
+      e = _GD_GetScalar2(D, E, 0, GD_INT_TYPE, &E->EN(bit,bitnum), err);
+      e |= _GD_GetScalar2(D, E, 1, GD_INT_TYPE, &E->EN(bit,numbits), err);
       break;
     case GD_PHASE_ENTRY:
-      e = _GD_GetScalar(D, E, 0, GD_INT64, &E->EN(phase,shift), err);
+      e = _GD_GetScalar2(D, E, 0, GD_INT64, &E->EN(phase,shift), err);
       break;
     case GD_WINDOW_ENTRY:
       switch (E->EN(window,windop)) {
         case GD_WINDOP_EQ:
         case GD_WINDOP_NE:
-          e = _GD_GetScalar(D, E, 0, GD_INT64, &E->EN(window,threshold.i), err);
+          e = _GD_GetScalar2(D, E, 0, GD_INT64, &E->EN(window,threshold.i), err);
           break;
         case GD_WINDOP_SET:
         case GD_WINDOP_CLR:
-          e = _GD_GetScalar(D, E, 0, GD_UINT64, &E->EN(window,threshold.u),
+          e = _GD_GetScalar2(D, E, 0, GD_UINT64, &E->EN(window,threshold.u),
               err);
           break;
         default:
-          e = _GD_GetScalar(D, E, 0, GD_FLOAT64, &E->EN(window,threshold.r),
+          e = _GD_GetScalar2(D, E, 0, GD_FLOAT64, &E->EN(window,threshold.r),
               err);
           break;
       }
       break;
     case GD_MPLEX_ENTRY:
-      e = _GD_GetScalar(D, E, 0, GD_INT_TYPE, &E->EN(mplex,count_val), err);
-      e |= _GD_GetScalar(D, E, 1, GD_INT_TYPE, &E->EN(mplex,period), err);
+      e = _GD_GetScalar2(D, E, 0, GD_INT_TYPE, &E->EN(mplex,count_val), err);
+      e |= _GD_GetScalar2(D, E, 1, GD_INT_TYPE, &E->EN(mplex,period), err);
       break;
     case GD_NO_ENTRY:
     case GD_LINTERP_ENTRY:
diff --git a/src/field_list.c b/src/field_list.c
index 7ca2b59..8ac44d6 100644
--- a/src/field_list.c
+++ b/src/field_list.c
@@ -212,7 +212,7 @@ static const char **_GD_EntryList(DIRFILE *D, struct gd_private_entry_ *p,
   }
 
   for (i = n = 0; i < nentries; ++i) {
-    if (n == len) {
+    if (n == len - 1) { /* leave space for the terminating NULL */
       void *ptr = _GD_Realloc(D, el, sizeof(*el) * (len *= 2));
       if (ptr == NULL) {
         free(el);
diff --git a/src/flac.c b/src/flac.c
index 12d3d05..ffe5c5e 100644
--- a/src/flac.c
+++ b/src/flac.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -469,6 +469,7 @@ int _GD_FlacClose(struct gd_raw_file_ *file)
     FLAC__stream_encoder_delete(gdfl->codec.e);
   }
 
+  free(gdfl->data);
   file->idata = -1;
   file->mode = 0;
   free(file->edata);
@@ -493,6 +494,8 @@ off64_t _GD_FlacSize(int dirfd, struct gd_raw_file_ *file, gd_type_t data_type,
 
   n = FLAC__stream_decoder_get_total_samples(gdfl->codec.d);
 
+  FLAC__stream_decoder_finish(gdfl->codec.d);
+  FLAC__stream_decoder_delete(gdfl->codec.d);
   free(gdfl);
 
   dreturn("%" PRId64, (int64_t)n);
diff --git a/src/flush.c b/src/flush.c
index 0fb02f8..6eb152d 100644
--- a/src/flush.c
+++ b/src/flush.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2015 D. V. Wiebe
+/* Copyright (C) 2008-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -829,7 +829,7 @@ static void _GD_FlushFragment(DIRFILE* D, int i, int permissive)
 
   if (fprintf(stream, "# This is a dirfile format file.\n"
         "# It was written using version %s of the GetData Library.\n"
-        "# Written on %s UTC", PACKAGE_VERSION, buffer) < 0)
+        "# Written on %s UTC", GD_GETDATA_VERSION, buffer) < 0)
   {
     goto WRITE_ERR;
   }
@@ -1043,7 +1043,6 @@ static void _GD_FlushFragment(DIRFILE* D, int i, int permissive)
 WRITE_ERR:
     if (!D->error)
       _GD_SetError(D, GD_E_IO, GD_E_IO_WRITE, NULL, 0, NULL);
-    fclose(stream);
   }
 
   if (fclose(stream) == EOF) {
diff --git a/src/fragment.c b/src/fragment.c
index 90d9a90..897f640 100644
--- a/src/fragment.c
+++ b/src/fragment.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2010, 2011, 2012, 2014, 2015 D. V. Wiebe
+/* Copyright (C) 2008, 2010, 2011, 2012, 2014, 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -397,6 +397,8 @@ int gd_desync(DIRFILE *D, unsigned int flags)
     D->name = NULL; /* so FreeD doesn't delete it */
     if (_GD_ShutdownDirfile(D, 0, 1)) {
       D->name = name;
+      if (dirfd >= 0)
+        close(dirfd);
       dreturn("%i", -1);
       return -1;
     }
diff --git a/src/internal.h b/src/internal.h
index 6666ce8..40c4f43 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -1281,6 +1281,8 @@ off64_t _GD_GetIOPos(DIRFILE *restrict, gd_entry_t *restrict, off64_t);
 char *_GD_GetLine(FILE *restrict, size_t *restrict, int *restrict);
 int _GD_GetRepr(DIRFILE *restrict, const char *restrict,
     char **restrict, int);
+int _GD_GetScalar(DIRFILE *restrict, const char *restrict, int*, gd_type_t,
+   void *restrict, gd_entry_t*);
 unsigned int _GD_GetSPF(DIRFILE*, gd_entry_t*);
 int _GD_GrabDir(DIRFILE*, int, const char *restrict, int);
 int _GD_Include(DIRFILE*, struct parser_state *restrict, const char *restrict,
diff --git a/src/mod.c b/src/mod.c
index a3df845..44c3973 100644
--- a/src/mod.c
+++ b/src/mod.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2015 D. V. Wiebe
+/* Copyright (C) 2008-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,103 +25,161 @@ static unsigned int gd_max_(unsigned int A, unsigned int B)
   return (A > B) ? A : B;
 }
 
-#define GD_AS_FREE_SCALAR 1
-#define GD_AS_NEED_RECALC 2
-#define GD_AS_ERROR       4
-#define GD_AS_MODIFIED    8
-/* inputs:
- *  sin - old scalar name ( == NULL means remove; == "" means keep as-is )
- *  iin - old scalar index
- *  lin - old literal value
+#define GD_AS_FREE_SCALAR 1 /* Free the old scalar */
+#define GD_AS_NEED_RECALC 2 /* Updated entry needs re-calculation */
+#define GD_AS_ERROR       4 /* Error occurred */
+#define GD_AS_MODIFIED    8 /* Updated entry has been modified */
+/* _GD_AlterScalar: modify an entry scalar that can take a field code.
  *
- * outputs:
- *  sout - new scalar name
- *  iout - new scalar index
- *  lout - new literal value
+ * There's two types of things to consider here:
+ * - the literal (numeric) parameter (e.g. E->shfit for PHASE)
+ * - the scalar field code (if any) (i.e. E->scalar and E->scalar_ind)
  *
- *  sin sout alit
- * 0a N    N0   0     -> do nothing         ()
- * 1  N    N0   1     -> set lout           ()
- * 2  Na   a    01    -> set sout           (free scalar; need recalc)
- * 3  a    N    0     -> recalc, set sout   (free scalar)
- * 4  a    N    1     -> set sout, set lout (free scalar)
- * 0b a    0    01    -> do nothing         ()
+ * There are bits and pieces of two entry objects here:
+ * - Q: the entry object we're updating.  It started off as a copy of the
+ *      old entry (E) and it's a mess
+ * - N: the entry object containing the update request (from the caller)
+ *      which may contain some special "keep-as-is" values
+ *
+ * Parameters:
+ *  sN - scalar name in N (NULL means remove; "" means keep as-is)
+ *  iN - scalar index in N
+ *  lN - literal value in N
+ *
+ *  sQ - scalar name in Q
+ *  iQ - scalar index in Q
+ *  lQ - literal value in Q
+ *
+ *  calculated: whether E was calculated (GD_EN_CALCULATED) before _GD_Change
+ *              was called.
+ *
+ *  alter_literal: boolean; true if lN and lQ differ and lN is not a special
+ *                          "keep-as-is" value
+ *
+ * This function performs one of five actions, inicated by 0 through 4
+ * according to the values of sN, sQ, and alter_literal as given in 
+ * the following table where:
+ *
+ * - sQ can be 'N' (NULL) or 'a' (a non-NULL field code from the
+ *                                                     original entry)
+ * - sN can be 'N' (NULL), '-' (the empty string ""), or 'b' (a new
+ *                                  field code provided by the caller)
+ * - AL can be '0' or '1' indicating the boolean state of alter_literal
+ *
+ * sQ or AL can also be '*' meaning any permitted value
+ *
+ * sQ  sN  AL  ->  action
+ *  N   N   0  ->  0: no change            (labelled 0a below)
+ *  N   N   1  ->  1: set lQ from lN       (labelled 1a below)
+ *  N   -   0  ->  0: no change            (labelled 0b below)
+ *  N   -   1  ->  1: set lQ from lN       (labelled 1b below)
+ *  a   N   0  ->  3: set lQ to the value of the entry specified
+ *                    by sQ field and then delete sQ
+ *  a   N   1  ->  4: set lQ to lN and delete sQ
+ *  a   -   *  ->  0: no change            (labelled 0c below)
+ *  *   b   *  ->  2: set sQ,iQ from sN,iN
+ *
+ * Flags returned by this function are based on action performed:
+ *
+ * GD_AS_FREE_SCALAR is set when sQ is changed (2) or deleted (3,4)
+ * GD_AS_NEED_RECALC is set when sQ is changed (2)
+ * GD_AS_MODIFIED is set when any of Q is changed (all but 0)
+ *
+ * Also note: iN is ignored if sN == "" (keep as-is), even if it is
+ * different than iQ!
  */
 static int _GD_AlterScalar(DIRFILE* D, int alter_literal, gd_type_t type,
-    void *lout, const void *lin, char **sout, int *iout, const char *sin,
-    int iin, int calculated, int fragment_index)
+    void *lQ, const void *lN, char **sQ, int *iQ, const char *sN,
+    int iN, int calculated, int fragment_index)
 {
   int r = 0;
-  int set_lout = 0;
+  int set_lQ = 0;
 
   dtrace("%p, %i, 0x%X, %p, %p, %p, %p, %p, %i, %i, %i", D, alter_literal, type,
-      lout, lin, sout, iout, sin, iin, calculated, fragment_index);
+      lQ, lN, sQ, iQ, sN, iN, calculated, fragment_index);
 
-  if (sin == NULL) {
-    if (*sout != NULL) {
+  if (sN == NULL) {
+    if (*sQ != NULL) {
       if (alter_literal) {
         /* 4: replace a CONST field with a literal scalar */
         r = GD_AS_FREE_SCALAR | GD_AS_MODIFIED;
-        *sout = NULL;
-        set_lout = 1;
+        *sQ = NULL;
+        set_lQ = 1;
       } else {
-        /* 3: derefencing a CONST field to turn it into a literal scalar
-         *    lout is not set from lin, but kept as-is, after calculation;
-         *    this may throw GD_E_BAD_CODE or GD_E_BAD_FIELD_TYPE, via
-         *    get_constant. */
+        /* 3: derefence a CONST field to turn it into a literal scalar
+         *
+         *    if E has been successfully calculated, lQ already has
+         *    the right value, and all we need to do is delete sQ.
+         *
+         *    Otherwise we're in for some tricks:
+         */
+        if (!calculated) {
+          /* We've not tried to fetch this scalar before.  Ideally we'd like
+           * to run _GD_Calculate here, but we can't because Q is a mess right
+           * now, being in the middle of an update.  It's also in two discon-
+           * nected parts on the stack (Q, Qe), which makes even passing it to
+           * other parts of the library sketchy at best.  Instead we call
+           * _GD_GetScalar (which _GD_Calculate uses) directly.  It returns a
+           * GD_E_BAD_SCALAR suberror which we convert into GD_E_BAD_CODE or
+           * GD_E_BAD_FIELD_TYPE
+           */
+          int e = _GD_GetScalar(D, *sQ, iQ, type, lQ, NULL);
+          if (e == GD_E_SCALAR_CODE) 
+            _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, *sQ);
+          else if (e == GD_E_SCALAR_TYPE)
+            _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, *sQ);
+        }
         r = GD_AS_FREE_SCALAR | GD_AS_MODIFIED;
-        if (!calculated)
-          gd_get_constant(D, *sout, GD_INT64, lout);
-        *sout = NULL;
+        *sQ = NULL;
       }
     } else if (alter_literal) {
-      /* 1: set lout from lin */
-      set_lout = 1;
+      /* 1a: set lQ from lN */
+      set_lQ = 1;
     }
     /* otherwise 0a: do nothing */
-  } else if (sin[0] == '\0') {
-    if (*sout == NULL && alter_literal) {
-      /* 1: set lout from lin */
-      set_lout = 1;
+  } else if (sN[0] == '\0') {
+    if (*sQ == NULL && alter_literal) {
+      /* 1b: set lQ from lN */
+      set_lQ = 1;
     }
-    /* otherwise 0b: do nothing */
+    /* otherwise 0b or 0c: do nothing */
   } else {
-    /* 2: set a new CONST field from sout; if this is a RAW field, and we've
+    /* 2: set a new CONST field from sN; if this is a RAW field, and we've
      *    been asked to move the raw file, _GD_Change is going to need to
-     *    recalculate the entry; no need to change lout: it's ignored. */
+     *    recalculate the entry; no need to change lQ: it's ignored. */
 
-    if (_GD_CheckCodeAffixes(D, sin, fragment_index, 1))
+    if (_GD_CheckCodeAffixes(D, sN, fragment_index, 1))
       ; /* reject codes with bad affixes */
-    else if (iin == -1 && !(D->flags & GD_NOSTANDARD) && D->standards <= 7 &&
-        _GD_TokToNum(sin, D->standards, 1, NULL, NULL, NULL, NULL) != -1)
+    else if (iN == -1 && !(D->flags & GD_NOSTANDARD) && D->standards <= 7 &&
+        _GD_TokToNum(sN, D->standards, 1, NULL, NULL, NULL, NULL) != -1)
     {
       /* when using early Standards, reject ambiguous field codes */
-      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_AMBIGUOUS, NULL, 0, sin);
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_AMBIGUOUS, NULL, 0, sN);
     } else {
       r = GD_AS_FREE_SCALAR | GD_AS_NEED_RECALC | GD_AS_MODIFIED;
-      *sout = _GD_Strdup(D, sin);
-      *iout = iin;
+      *sQ = _GD_Strdup(D, sN);
+      *iQ = iN;
     }
   }
 
-  if (!D->error && set_lout) {
+  if (!D->error && set_lQ) {
     r |= GD_AS_MODIFIED;
     if (type == GD_INT64)
-      *(int64_t *)lout = *(int64_t *)lin;
+      *(int64_t *)lQ = *(int64_t *)lN;
     else if (type == GD_COMPLEX128)
-      memcpy(lout, lin, 2 * sizeof(double));
+      memcpy(lQ, lN, 2 * sizeof(double));
     else if (type == GD_FLOAT64)
-      *(double *)lout = *(double *)lin;
+      *(double *)lQ = *(double *)lN;
     else if (type == GD_INT16)
-      *(int16_t *)lout = *(int16_t *)lin;
+      *(int16_t *)lQ = *(int16_t *)lN;
     else if (type == GD_UINT16)
-      *(uint16_t *)lout = *(uint16_t *)lin;
+      *(uint16_t *)lQ = *(uint16_t *)lN;
     else if (type == GD_INT32)
-      *(int32_t *)lout = *(int32_t *)lin;
+      *(int32_t *)lQ = *(int32_t *)lN;
     else if (type == GD_UINT32)
-      *(uint32_t *)lout = *(uint32_t *)lin;
+      *(uint32_t *)lQ = *(uint32_t *)lN;
     else if (type == GD_UINT64)
-      *(uint64_t *)lout = *(uint64_t *)lin;
+      *(uint64_t *)lQ = *(uint64_t *)lN;
     else
       _GD_InternalError(D);
   }
@@ -688,7 +746,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       if (j & GD_AS_ERROR)
         break;
       if (j & GD_AS_FREE_SCALAR)
-        scalar_free |= 2;
+        scalar_free |= 1;
       if (j & GD_AS_NEED_RECALC)
         Q.flags &= ~GD_EN_CALC;
       if (j & GD_AS_MODIFIED)
diff --git a/src/zzip.c b/src/zzip.c
index 9224ed4..8e2c3a2 100644
--- a/src/zzip.c
+++ b/src/zzip.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2012, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2011, 2012, 2013, 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -233,6 +233,7 @@ off64_t _GD_ZzipSize(int dirfd, struct gd_raw_file_ *file, gd_type_t data_type,
 
   zzip_file_close(gdzz->file);
   zzip_dir_close(gdzz->dir);
+  free(gdzz);
 
   dreturn("%" PRId64, (int64_t)size);
   return size;
diff --git a/test/Makefile.am b/test/Makefile.am
index ba34f82..ea57288 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -52,15 +52,15 @@ ALTER_TESTS=alter_bit_bitnum alter_bit_numbits alter_carray_len \
 						alter_divide alter_entry alter_entry_affix alter_entry_hidden \
 						alter_entry_lincom alter_entry_recode alter_entry_recode_recalc \
 						alter_entry_scalar1 alter_entry_scalar2a alter_entry_scalar2n \
-						alter_entry_scalar3 alter_entry_scalar3c alter_entry_scalar4 \
-						alter_entry_scalar_amb alter_index alter_lincom_23 alter_lincom_32 \
-						alter_lincom_affix alter_lincom_input alter_lincom_offset \
-						alter_lincom_slope alter_linterp alter_linterp_move alter_mplex \
-						alter_mspec alter_mspec_affix alter_multiply alter_phase \
-						alter_polynom_coeff alter_polynom_input alter_polynom_ord \
-						alter_raw_spf alter_raw_type alter_recip alter_recip_zero \
-						alter_scalar_affix alter_spec alter_spec_affix alter_spec_meta \
-						alter_spec_polynom alter_window
+						alter_entry_scalar3 alter_entry_scalar3c alter_entry_scalar3i \
+						alter_entry_scalar3r alter_entry_scalar4 alter_entry_scalar_amb \
+						alter_index alter_lincom_23 alter_lincom_32 alter_lincom_affix \
+						alter_lincom_input alter_lincom_offset alter_lincom_slope \
+						alter_linterp alter_linterp_move alter_mplex alter_mspec \
+						alter_mspec_affix alter_multiply alter_phase alter_polynom_coeff \
+						alter_polynom_input alter_polynom_ord alter_raw_spf alter_raw_type \
+						alter_recip alter_recip_zero alter_scalar_affix alter_spec \
+						alter_spec_affix alter_spec_meta alter_spec_polynom alter_window
 
 ASCII_TESTS=ascii_add ascii_get ascii_get_complex ascii_get_get ascii_get_here \
 						ascii_get_sub ascii_nframes ascii_put ascii_put_here ascii_seek \
diff --git a/test/Makefile.in b/test/Makefile.in
index 544fa5c..6a5e582 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -177,7 +177,8 @@ am__EXEEXT_3 = alter_bit_bitnum$(EXEEXT) alter_bit_numbits$(EXEEXT) \
 	alter_entry_recode$(EXEEXT) alter_entry_recode_recalc$(EXEEXT) \
 	alter_entry_scalar1$(EXEEXT) alter_entry_scalar2a$(EXEEXT) \
 	alter_entry_scalar2n$(EXEEXT) alter_entry_scalar3$(EXEEXT) \
-	alter_entry_scalar3c$(EXEEXT) alter_entry_scalar4$(EXEEXT) \
+	alter_entry_scalar3c$(EXEEXT) alter_entry_scalar3i$(EXEEXT) \
+	alter_entry_scalar3r$(EXEEXT) alter_entry_scalar4$(EXEEXT) \
 	alter_entry_scalar_amb$(EXEEXT) alter_index$(EXEEXT) \
 	alter_lincom_23$(EXEEXT) alter_lincom_32$(EXEEXT) \
 	alter_lincom_affix$(EXEEXT) alter_lincom_input$(EXEEXT) \
@@ -1176,6 +1177,14 @@ alter_entry_scalar3c_SOURCES = alter_entry_scalar3c.c
 alter_entry_scalar3c_OBJECTS = alter_entry_scalar3c.$(OBJEXT)
 alter_entry_scalar3c_LDADD = $(LDADD)
 alter_entry_scalar3c_DEPENDENCIES = ../src/libgetdata.la
+alter_entry_scalar3i_SOURCES = alter_entry_scalar3i.c
+alter_entry_scalar3i_OBJECTS = alter_entry_scalar3i.$(OBJEXT)
+alter_entry_scalar3i_LDADD = $(LDADD)
+alter_entry_scalar3i_DEPENDENCIES = ../src/libgetdata.la
+alter_entry_scalar3r_SOURCES = alter_entry_scalar3r.c
+alter_entry_scalar3r_OBJECTS = alter_entry_scalar3r.$(OBJEXT)
+alter_entry_scalar3r_LDADD = $(LDADD)
+alter_entry_scalar3r_DEPENDENCIES = ../src/libgetdata.la
 alter_entry_scalar4_SOURCES = alter_entry_scalar4.c
 alter_entry_scalar4_OBJECTS = alter_entry_scalar4.$(OBJEXT)
 alter_entry_scalar4_LDADD = $(LDADD)
@@ -5601,7 +5610,8 @@ SOURCES = add_add.c add_affix.c add_alias.c add_alias_affix.c \
 	alter_entry_recode.c alter_entry_recode_recalc.c \
 	alter_entry_scalar1.c alter_entry_scalar2a.c \
 	alter_entry_scalar2n.c alter_entry_scalar3.c \
-	alter_entry_scalar3c.c alter_entry_scalar4.c \
+	alter_entry_scalar3c.c alter_entry_scalar3i.c \
+	alter_entry_scalar3r.c alter_entry_scalar4.c \
 	alter_entry_scalar_amb.c alter_index.c alter_lincom_23.c \
 	alter_lincom_32.c alter_lincom_affix.c alter_lincom_input.c \
 	alter_lincom_offset.c alter_lincom_slope.c alter_linterp.c \
@@ -5979,7 +5989,8 @@ DIST_SOURCES = add_add.c add_affix.c add_alias.c add_alias_affix.c \
 	alter_entry_recode.c alter_entry_recode_recalc.c \
 	alter_entry_scalar1.c alter_entry_scalar2a.c \
 	alter_entry_scalar2n.c alter_entry_scalar3.c \
-	alter_entry_scalar3c.c alter_entry_scalar4.c \
+	alter_entry_scalar3c.c alter_entry_scalar3i.c \
+	alter_entry_scalar3r.c alter_entry_scalar4.c \
 	alter_entry_scalar_amb.c alter_index.c alter_lincom_23.c \
 	alter_lincom_32.c alter_lincom_affix.c alter_lincom_input.c \
 	alter_lincom_offset.c alter_lincom_slope.c alter_linterp.c \
@@ -6445,6 +6456,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@
@@ -6649,15 +6661,15 @@ ALTER_TESTS = alter_bit_bitnum alter_bit_numbits alter_carray_len \
 						alter_divide alter_entry alter_entry_affix alter_entry_hidden \
 						alter_entry_lincom alter_entry_recode alter_entry_recode_recalc \
 						alter_entry_scalar1 alter_entry_scalar2a alter_entry_scalar2n \
-						alter_entry_scalar3 alter_entry_scalar3c alter_entry_scalar4 \
-						alter_entry_scalar_amb alter_index alter_lincom_23 alter_lincom_32 \
-						alter_lincom_affix alter_lincom_input alter_lincom_offset \
-						alter_lincom_slope alter_linterp alter_linterp_move alter_mplex \
-						alter_mspec alter_mspec_affix alter_multiply alter_phase \
-						alter_polynom_coeff alter_polynom_input alter_polynom_ord \
-						alter_raw_spf alter_raw_type alter_recip alter_recip_zero \
-						alter_scalar_affix alter_spec alter_spec_affix alter_spec_meta \
-						alter_spec_polynom alter_window
+						alter_entry_scalar3 alter_entry_scalar3c alter_entry_scalar3i \
+						alter_entry_scalar3r alter_entry_scalar4 alter_entry_scalar_amb \
+						alter_index alter_lincom_23 alter_lincom_32 alter_lincom_affix \
+						alter_lincom_input alter_lincom_offset alter_lincom_slope \
+						alter_linterp alter_linterp_move alter_mplex alter_mspec \
+						alter_mspec_affix alter_multiply alter_phase alter_polynom_coeff \
+						alter_polynom_input alter_polynom_ord alter_raw_spf alter_raw_type \
+						alter_recip alter_recip_zero alter_scalar_affix alter_spec \
+						alter_spec_affix alter_spec_meta alter_spec_polynom alter_window
 
 ASCII_TESTS = ascii_add ascii_get ascii_get_complex ascii_get_get ascii_get_here \
 						ascii_get_sub ascii_nframes ascii_put ascii_put_here ascii_seek \
@@ -7447,6 +7459,14 @@ alter_entry_scalar3c$(EXEEXT): $(alter_entry_scalar3c_OBJECTS) $(alter_entry_sca
 	@rm -f alter_entry_scalar3c$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_entry_scalar3c_OBJECTS) $(alter_entry_scalar3c_LDADD) $(LIBS)
 
+alter_entry_scalar3i$(EXEEXT): $(alter_entry_scalar3i_OBJECTS) $(alter_entry_scalar3i_DEPENDENCIES) $(EXTRA_alter_entry_scalar3i_DEPENDENCIES) 
+	@rm -f alter_entry_scalar3i$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_entry_scalar3i_OBJECTS) $(alter_entry_scalar3i_LDADD) $(LIBS)
+
+alter_entry_scalar3r$(EXEEXT): $(alter_entry_scalar3r_OBJECTS) $(alter_entry_scalar3r_DEPENDENCIES) $(EXTRA_alter_entry_scalar3r_DEPENDENCIES) 
+	@rm -f alter_entry_scalar3r$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_entry_scalar3r_OBJECTS) $(alter_entry_scalar3r_LDADD) $(LIBS)
+
 alter_entry_scalar4$(EXEEXT): $(alter_entry_scalar4_OBJECTS) $(alter_entry_scalar4_DEPENDENCIES) $(EXTRA_alter_entry_scalar4_DEPENDENCIES) 
 	@rm -f alter_entry_scalar4$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_entry_scalar4_OBJECTS) $(alter_entry_scalar4_LDADD) $(LIBS)
@@ -11890,6 +11910,8 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry_scalar2n.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry_scalar3.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry_scalar3c.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry_scalar3i.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry_scalar3r.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry_scalar4.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry_scalar_amb.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_index.Po at am__quote@
diff --git a/test/add_scalar_carray_bad.c b/test/add_scalar_carray_bad.c
index 48976ed..91e46cf 100644
--- a/test/add_scalar_carray_bad.c
+++ b/test/add_scalar_carray_bad.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,7 +24,7 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  int error, r = 0;
+  int e1, e2, r = 0;
   DIRFILE *D;
 
   gd_entry_t E, e;
@@ -43,30 +43,27 @@ int main(void)
   D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_spec(D, "c CARRAY INT64 1 2 3 4", 0);
   gd_add(D, &E);
-  error = gd_error(D);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_OK);
 
   /* check */
   gd_entry(D, "data", &e);
-  if (gd_error(D))
-    r = 1;
-  else {
-    CHECKI(e.field_type, GD_LINCOM_ENTRY);
-    CHECKI(e.fragment_index, 0);
-    CHECKI(e.EN(lincom,n_fields), 1);
-    CHECKF(e.EN(lincom,m)[0], 1);
-    CHECKF(e.EN(lincom,b)[0], 1);
-    CHECKP(e.scalar[0]);
-    CHECKS(e.scalar[0 + GD_MAX_LINCOM], "c");
-    CHECKI(e.scalar_ind[0 + GD_MAX_LINCOM], 0);
-    gd_free_entry_strings(&e);
-  }
+  e2 = gd_error(D);
+  CHECKI(e2, GD_E_OK);
+  CHECKI(e.field_type, GD_LINCOM_ENTRY);
+  CHECKI(e.fragment_index, 0);
+  CHECKI(e.EN(lincom,n_fields), 1);
+  CHECKF(e.EN(lincom,m)[0], 1);
+  CHECKF(e.EN(lincom,b)[0], 1);
+  CHECKP(e.scalar[0]);
+  CHECKS(e.scalar[0 + GD_MAX_LINCOM], "c");
+  CHECKI(e.scalar_ind[0 + GD_MAX_LINCOM], 0);
+  gd_free_entry_strings(&e);
 
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error, GD_E_OK);
-
   return r;
 }
diff --git a/test/alter_entry_scalar3c.c b/test/alter_entry_scalar3c.c
index 558d2d3..6904199 100644
--- a/test/alter_entry_scalar3c.c
+++ b/test/alter_entry_scalar3c.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,17 @@
  */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "data BIT in c1 3\nc1 CONST INT64 3\n";
+  const char *format_data = "data RECIP in c1\nc1 CONST COMPLEX128 3.1;4.5\n";
   int fd, ret, error, n, r = 0;
+#ifdef GD_NO_C99_API
+  const double d[2] = {3.1, 4.5};
+#else
+  const double _Complex d = 3.1 + _Complex_I * 4.5;
+#endif
   DIRFILE *D;
   gd_entry_t E;
 
@@ -47,27 +44,27 @@ int main(void)
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
 
   memset(&E, 0, sizeof(E));
-  E.field_type = GD_BIT_ENTRY;
-  E.EN(bit,bitnum) = -1;
-  E.EN(bit,numbits) = 3;
+  E.field_type = GD_RECIP_ENTRY;
   E.in_fields[0] = "in";
-
+  E.flags = GD_EN_COMPSCAL;
   ret = gd_alter_entry(D, "data", &E, 0);
   error = gd_error(D);
 
+  CHECKI(ret,0);
+  CHECKI(error,0);
+
   n = gd_entry(D, "data", &E);
 
+  CHECKI(n,0);
+  CHECKU(E.flags & GD_EN_COMPSCAL, GD_EN_COMPSCAL);
+  CHECKC(E.EN(recip,cdividend), d);
+  CHECKP(E.scalar[0]);
+  gd_free_entry_strings(&E);
+
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error,0);
-  CHECKI(n,0);
-  CHECKI(ret,0);
-  CHECKI(E.EN(bit,bitnum), 3);
-  CHECKP(E.scalar[0]);
-  gd_free_entry_strings(&E);
-
   return r;
 }
diff --git a/test/alter_entry_scalar3c.c b/test/alter_entry_scalar3i.c
similarity index 100%
copy from test/alter_entry_scalar3c.c
copy to test/alter_entry_scalar3i.c
diff --git a/test/alter_entry_scalar3c.c b/test/alter_entry_scalar3r.c
similarity index 81%
copy from test/alter_entry_scalar3c.c
copy to test/alter_entry_scalar3r.c
index 558d2d3..3d5532d 100644
--- a/test/alter_entry_scalar3c.c
+++ b/test/alter_entry_scalar3r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,19 +20,11 @@
  */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "data BIT in c1 3\nc1 CONST INT64 3\n";
+  const char *format_data = "data RECIP in c1\nc1 CONST FLOAT64 3.1\n";
   int fd, ret, error, n, r = 0;
   DIRFILE *D;
   gd_entry_t E;
@@ -47,27 +39,25 @@ int main(void)
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
 
   memset(&E, 0, sizeof(E));
-  E.field_type = GD_BIT_ENTRY;
-  E.EN(bit,bitnum) = -1;
-  E.EN(bit,numbits) = 3;
+  E.field_type = GD_RECIP_ENTRY;
   E.in_fields[0] = "in";
-
   ret = gd_alter_entry(D, "data", &E, 0);
   error = gd_error(D);
 
+  CHECKI(ret,0);
+  CHECKI(error,0);
+
   n = gd_entry(D, "data", &E);
 
+  CHECKI(n,0);
+  CHECKF(E.EN(recip,dividend), 3.1);
+  CHECKP(E.scalar[0]);
+  gd_free_entry_strings(&E);
+
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error,0);
-  CHECKI(n,0);
-  CHECKI(ret,0);
-  CHECKI(E.EN(bit,bitnum), 3);
-  CHECKP(E.scalar[0]);
-  gd_free_entry_strings(&E);
-
   return r;
 }
diff --git a/test/flac_put_big.c b/test/flac_put_big.c
index 06ea32f..f873937 100644
--- a/test/flac_put_big.c
+++ b/test/flac_put_big.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -58,25 +58,23 @@ int main(void)
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
   e1 = gd_error(D);
 
-  e2 = gd_close(D);
-  CHECKI(e2, 0);
-
-  stat_data = stat(data_flac, &buf);
-
 #ifdef USE_FLAC
   CHECKI(e1, GD_E_OK);
   CHECKI(n, 8);
-  if (stat_data) {
-    perror("stat");
-  }
-  CHECKI(stat_data, 0);
 #else
   CHECKI(e1, GD_E_UNSUPPORTED);
   CHECKI(n, 0);
-  CHECKI(stat_data, -1);
 #endif
 
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  stat_data = stat(data_flac, &buf);
+
 #ifdef USE_FLAC
+  CHECKI(stat_data, 0);
+  if (stat_data)
+    perror("stat");
   snprintf(command, 4096, "%s --silent --decode --delete-input-file "
       "--force-raw-format --sign=signed --endian=big %s --output-name=%s",
       FLAC, data_flac, data);
@@ -97,6 +95,8 @@ int main(void)
       close(fd);
     }
   }
+#else
+  CHECKI(stat_data, -1);
 #endif
 
   unlink_flac = unlink(data_flac);
diff --git a/test/flac_put_complex128.c b/test/flac_put_complex128.c
index 77418e9..020c292 100644
--- a/test/flac_put_complex128.c
+++ b/test/flac_put_complex128.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -72,6 +72,8 @@ int main(void)
       CHECKFi(i, d[i], 1.234 * (i - 10));
   }
 
+  gd_discard(D);
+
   unlink(data);
   unlink(format);
   rmdir(filedir);
diff --git a/test/flac_put_float64.c b/test/flac_put_float64.c
index 07bae44..7a43cdc 100644
--- a/test/flac_put_float64.c
+++ b/test/flac_put_float64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -71,6 +71,8 @@ int main(void)
       CHECKFi(i, d[i], 1.234 * (i - 5));
   }
 
+  gd_discard(D);
+
   unlink(data);
   unlink(format);
   rmdir(filedir);
diff --git a/test/flac_put_int32.c b/test/flac_put_int32.c
index c3b3ec9..2525c27 100644
--- a/test/flac_put_int32.c
+++ b/test/flac_put_int32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -72,6 +72,8 @@ int main(void)
       CHECKXi(i, d[i], 0x01020304U * (i - 5));
   }
 
+  gd_discard(D);
+
   unlink(data);
   unlink(format);
   rmdir(filedir);
diff --git a/test/flac_put_little.c b/test/flac_put_little.c
index 944f723..6fb9ac2 100644
--- a/test/flac_put_little.c
+++ b/test/flac_put_little.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -59,25 +59,23 @@ int main(void)
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
   e1 = gd_error(D);
 
-  e2 = gd_close(D);
-  CHECKI(e2, 0);
-
-  stat_data = stat(data_flac, &buf);
-
 #ifdef USE_FLAC
   CHECKI(e1, GD_E_OK);
   CHECKI(n, 8);
-  if (stat_data) {
-    perror("stat");
-  }
-  CHECKI(stat_data, 0);
 #else
   CHECKI(e1, GD_E_UNSUPPORTED);
   CHECKI(n, 0);
-  CHECKI(stat_data, -1);
 #endif
 
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  stat_data = stat(data_flac, &buf);
+
 #ifdef USE_FLAC
+  CHECKI(stat_data, 0);
+  if (stat_data)
+    perror("stat");
   snprintf(command, 4096, "%s --silent --decode --delete-input-file "
       "--force-raw-format --sign=signed --endian=little %s --output-name=%s",
       FLAC, data_flac, data);
@@ -98,6 +96,8 @@ int main(void)
       close(fd);
     }
   }
+#else
+  CHECKI(stat_data, -1);
 #endif
 
   unlink_flac = unlink(data_flac);
diff --git a/test/flush_amb_code.c b/test/flush_amb_code.c
index bd52eee..eae3c37 100644
--- a/test/flush_amb_code.c
+++ b/test/flush_amb_code.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -68,6 +68,7 @@ int main(void)
 
   for (i = 0; i < 6; ++i)
     CHECKSi(i, E.scalar[i], code[i]);
+  gd_free_entry_strings(&E);
 
   gd_discard(D);
 
diff --git a/test/lzma_put.c b/test/lzma_put.c
index 402ccf7..f017db5 100644
--- a/test/lzma_put.c
+++ b/test/lzma_put.c
@@ -47,7 +47,7 @@ int main(void)
   close(fd);
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
+  write(fd, data_data, 256 * sizeof(uint8_t));
   close(fd);
 
   /* compress */
diff --git a/test/parse_scalar2.c b/test/parse_scalar2.c
index c78644e..375e8e0 100644
--- a/test/parse_scalar2.c
+++ b/test/parse_scalar2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -49,6 +49,7 @@ int main(void)
 
   gd_entry(D, "data", &E);
   CHECKS(E.scalar[0], "scalar<3");
+  gd_free_entry_strings(&E);
 
   gd_discard(D);
 
diff --git a/util/Makefile.in b/util/Makefile.in
index 708b9f4..0d4c35c 100644
--- a/util/Makefile.in
+++ b/util/Makefile.in
@@ -256,6 +256,7 @@ GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_LIB_VERSION = @GETDATA_LIB_VERSION@
 GETDATA_MAJOR = @GETDATA_MAJOR@
 GETDATA_MINOR = @GETDATA_MINOR@
 GETDATA_REVISION = @GETDATA_REVISION@

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/libgetdata.git



More information about the debian-science-commits mailing list