diff options
author | Robb Matzke <matzke@llnl.gov> | 1999-08-30 19:59:37 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1999-08-30 19:59:37 (GMT) |
commit | 99d84a8f4c45e6033046d9b825a2c5dc7c65ac2a (patch) | |
tree | deb7762f9230f4f1598a34edeecf35ea98b0cfe6 /src | |
parent | 27e31d9c26835e5e0b3e81d89cd7bd5d330b53f6 (diff) | |
download | hdf5-99d84a8f4c45e6033046d9b825a2c5dc7c65ac2a.zip hdf5-99d84a8f4c45e6033046d9b825a2c5dc7c65ac2a.tar.gz hdf5-99d84a8f4c45e6033046d9b825a2c5dc7c65ac2a.tar.bz2 |
[svn-r1619] ./src/H5O.c [1.2, 1.3]
Fixed a read-uninitialized-memory error that resulted in the
file containing small amounts (<8 bytes each) of uninitialized
data. These padding areas (which are never read by hdf5) are
initialized to zero now.
./MANIFEST
./src/H5Z.c
./src/H5Zdeflate.c [NEW]
./src/H5Zprivate.h
./src/H5Zpublic.h
./src/Makefile.in
The zlib filter was moved to a separate file but is still
automatically defined.
Diffstat (limited to 'src')
-rw-r--r-- | src/.distdep | 1200 | ||||
-rw-r--r-- | src/H5O.c | 36 | ||||
-rw-r--r-- | src/H5Z.c | 130 | ||||
-rw-r--r-- | src/H5Zdeflate.c | 144 | ||||
-rw-r--r-- | src/H5Zprivate.h | 1 | ||||
-rw-r--r-- | src/H5Zpublic.h | 4 | ||||
-rw-r--r-- | src/Makefile.in | 3 |
7 files changed, 222 insertions, 1296 deletions
diff --git a/src/.distdep b/src/.distdep index 2e5e4ea..1e24282 100644 --- a/src/.distdep +++ b/src/.distdep @@ -149,7 +149,7 @@ H5E.lo: \ H5Eprivate.h H5F.lo: \ H5F.c \ - H5FDsec2.h \ + H5FDcore.h \ H5Ipublic.h \ H5public.h \ H5config.h \ @@ -157,6 +157,8 @@ H5F.lo: \ H5FDfamily.h \ H5FDmpio.h \ H5FDpublic.h \ + H5FDmulti.h \ + H5FDsec2.h \ H5private.h \ H5Aprivate.h \ H5Apublic.h \ @@ -301,7 +303,8 @@ H5FDsec2.lo: \ H5FDcore.h \ H5FDfamily.h \ H5FDmpio.h \ - H5FDsec2.h + H5FDsec2.h \ + H5FDmulti.h H5FDfamily.lo: \ H5FDfamily.c \ hdf5.h \ @@ -326,7 +329,12 @@ H5FDfamily.lo: \ H5Rpublic.h \ H5RApublic.h \ H5Spublic.h \ - H5Tpublic.h + H5Tpublic.h \ + H5FDcore.h \ + H5FDfamily.h \ + H5FDmpio.h \ + H5FDsec2.h \ + H5FDmulti.h H5FDmpio.lo: \ H5FDmpio.c \ hdf5.h \ @@ -351,7 +359,12 @@ H5FDmpio.lo: \ H5Rpublic.h \ H5RApublic.h \ H5Spublic.h \ - H5Tpublic.h + H5Tpublic.h \ + H5FDcore.h \ + H5FDfamily.h \ + H5FDmpio.h \ + H5FDsec2.h \ + H5FDmulti.h H5FDcore.lo: \ H5FDcore.c \ hdf5.h \ @@ -376,7 +389,42 @@ H5FDcore.lo: \ H5Rpublic.h \ H5RApublic.h \ H5Spublic.h \ - H5Tpublic.h + H5Tpublic.h \ + H5FDcore.h \ + H5FDfamily.h \ + H5FDmpio.h \ + H5FDsec2.h \ + H5FDmulti.h +H5FDmulti.lo: \ + H5FDmulti.c \ + hdf5.h \ + H5public.h \ + H5config.h \ + H5api_adpt.h \ + H5Ipublic.h \ + H5Apublic.h \ + H5ACpublic.h \ + H5Bpublic.h \ + H5Dpublic.h \ + H5Epublic.h \ + H5Fpublic.h \ + H5FDpublic.h \ + H5Gpublic.h \ + H5HGpublic.h \ + H5HLpublic.h \ + H5MMpublic.h \ + H5Opublic.h \ + H5Ppublic.h \ + H5Zpublic.h \ + H5Rpublic.h \ + H5RApublic.h \ + H5Spublic.h \ + H5Tpublic.h \ + H5FDcore.h \ + H5FDfamily.h \ + H5FDmpio.h \ + H5FDsec2.h \ + H5FDmulti.h H5G.lo: \ H5G.c \ H5private.h \ @@ -1490,1145 +1538,3 @@ H5Z.lo: \ H5Dpublic.h \ H5Zprivate.h \ H5Zpublic.h -H5.lo: \ - H5.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5FDprivate.h \ - H5Iprivate.h \ - H5MMprivate.h \ - H5Pprivate.h \ - H5Ppublic.h \ - H5Dpublic.h \ - H5Zpublic.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h -H5D.lo: \ - H5D.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5HLprivate.h \ - H5HLpublic.h \ - H5MMprivate.h \ - H5Pprivate.h \ - H5Ppublic.h -H5F.lo: \ - H5F.c \ - H5FDsec2.h \ - H5Ipublic.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5FDfamily.h \ - H5FDmpio.h \ - H5FDpublic.h \ - H5private.h \ - H5Aprivate.h \ - H5Apublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5MMpublic.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Iprivate.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Eprivate.h \ - H5Epublic.h -H5Fistore.lo: \ - H5Fistore.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Iprivate.h \ - H5MFprivate.h \ - H5MMprivate.h -H5FD.lo: \ - H5FD.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5FDprivate.h \ - H5Iprivate.h \ - H5MMprivate.h \ - H5Pprivate.h \ - H5Ppublic.h \ - H5Dpublic.h -H5FDsec2.lo: \ - H5FDsec2.c \ - hdf5.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Ipublic.h \ - H5Apublic.h \ - H5ACpublic.h \ - H5Bpublic.h \ - H5Dpublic.h \ - H5Epublic.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5Gpublic.h \ - H5HGpublic.h \ - H5HLpublic.h \ - H5MMpublic.h \ - H5Opublic.h \ - H5Ppublic.h \ - H5Zpublic.h \ - H5Rpublic.h \ - H5RApublic.h \ - H5Spublic.h \ - H5Tpublic.h \ - H5FDcore.h \ - H5FDfamily.h \ - H5FDmpio.h \ - H5FDsec2.h \ - H5FDmulti.h -H5FDfamily.lo: \ - H5FDfamily.c \ - hdf5.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Ipublic.h \ - H5Apublic.h \ - H5ACpublic.h \ - H5Bpublic.h \ - H5Dpublic.h \ - H5Epublic.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5Gpublic.h \ - H5HGpublic.h \ - H5HLpublic.h \ - H5MMpublic.h \ - H5Opublic.h \ - H5Ppublic.h \ - H5Zpublic.h \ - H5Rpublic.h \ - H5RApublic.h \ - H5Spublic.h \ - H5Tpublic.h \ - H5FDcore.h \ - H5FDfamily.h \ - H5FDmpio.h \ - H5FDsec2.h \ - H5FDmulti.h -H5FDmpio.lo: \ - H5FDmpio.c \ - hdf5.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Ipublic.h \ - H5Apublic.h \ - H5ACpublic.h \ - H5Bpublic.h \ - H5Dpublic.h \ - H5Epublic.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5Gpublic.h \ - H5HGpublic.h \ - H5HLpublic.h \ - H5MMpublic.h \ - H5Opublic.h \ - H5Ppublic.h \ - H5Zpublic.h \ - H5Rpublic.h \ - H5RApublic.h \ - H5Spublic.h \ - H5Tpublic.h \ - H5FDcore.h \ - H5FDfamily.h \ - H5FDmpio.h \ - H5FDsec2.h \ - H5FDmulti.h -H5FDcore.lo: \ - H5FDcore.c \ - hdf5.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Ipublic.h \ - H5Apublic.h \ - H5ACpublic.h \ - H5Bpublic.h \ - H5Dpublic.h \ - H5Epublic.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5Gpublic.h \ - H5HGpublic.h \ - H5HLpublic.h \ - H5MMpublic.h \ - H5Opublic.h \ - H5Ppublic.h \ - H5Zpublic.h \ - H5Rpublic.h \ - H5RApublic.h \ - H5Spublic.h \ - H5Tpublic.h \ - H5FDcore.h \ - H5FDfamily.h \ - H5FDmpio.h \ - H5FDsec2.h \ - H5FDmulti.h -H5I.lo: \ - H5I.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5Eprivate.h -H5Oattr.lo: \ - H5Oattr.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5MMprivate.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Dpublic.h -H5Odtype.lo: \ - H5Odtype.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5MMprivate.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Dpublic.h -H5P.lo: \ - H5P.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5FDprivate.h \ - H5MMprivate.h -H5R.lo: \ - H5R.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h -H5Sall.lo: \ - H5Sall.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Iprivate.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Dpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h -H5Shyper.lo: \ - H5Shyper.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Iprivate.h \ - H5MMprivate.h \ - H5Pprivate.h -H5Snone.lo: \ - H5Snone.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Iprivate.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Dpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h -H5Spoint.lo: \ - H5Spoint.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Iprivate.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Dpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h -H5Sselect.lo: \ - H5Sselect.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Iprivate.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Dpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h -H5T.lo: \ - H5T.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Iprivate.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MMprivate.h \ - H5Pprivate.h -H5.lo: \ - H5.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5FDprivate.h \ - H5Iprivate.h \ - H5MMprivate.h \ - H5Pprivate.h \ - H5Ppublic.h \ - H5Dpublic.h \ - H5Zpublic.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h -H5D.lo: \ - H5D.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5HLprivate.h \ - H5HLpublic.h \ - H5MMprivate.h \ - H5Pprivate.h \ - H5Ppublic.h -H5F.lo: \ - H5F.c \ - H5FDcore.h \ - H5Ipublic.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5FDfamily.h \ - H5FDmpio.h \ - H5FDpublic.h \ - H5FDmulti.h \ - H5FDsec2.h \ - H5private.h \ - H5Aprivate.h \ - H5Apublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5MMpublic.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Iprivate.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Eprivate.h \ - H5Epublic.h -H5Fistore.lo: \ - H5Fistore.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Iprivate.h \ - H5MFprivate.h \ - H5MMprivate.h -H5FD.lo: \ - H5FD.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5FDprivate.h \ - H5Iprivate.h \ - H5MMprivate.h \ - H5Pprivate.h \ - H5Ppublic.h \ - H5Dpublic.h -H5FDsec2.lo: \ - H5FDsec2.c \ - hdf5.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Ipublic.h \ - H5Apublic.h \ - H5ACpublic.h \ - H5Bpublic.h \ - H5Dpublic.h \ - H5Epublic.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5Gpublic.h \ - H5HGpublic.h \ - H5HLpublic.h \ - H5MMpublic.h \ - H5Opublic.h \ - H5Ppublic.h \ - H5Zpublic.h \ - H5Rpublic.h \ - H5RApublic.h \ - H5Spublic.h \ - H5Tpublic.h \ - H5FDcore.h \ - H5FDfamily.h \ - H5FDmpio.h \ - H5FDsec2.h \ - H5FDmulti.h -H5FDfamily.lo: \ - H5FDfamily.c \ - hdf5.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Ipublic.h \ - H5Apublic.h \ - H5ACpublic.h \ - H5Bpublic.h \ - H5Dpublic.h \ - H5Epublic.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5Gpublic.h \ - H5HGpublic.h \ - H5HLpublic.h \ - H5MMpublic.h \ - H5Opublic.h \ - H5Ppublic.h \ - H5Zpublic.h \ - H5Rpublic.h \ - H5RApublic.h \ - H5Spublic.h \ - H5Tpublic.h \ - H5FDcore.h \ - H5FDfamily.h \ - H5FDmpio.h \ - H5FDsec2.h \ - H5FDmulti.h -H5FDmpio.lo: \ - H5FDmpio.c \ - hdf5.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Ipublic.h \ - H5Apublic.h \ - H5ACpublic.h \ - H5Bpublic.h \ - H5Dpublic.h \ - H5Epublic.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5Gpublic.h \ - H5HGpublic.h \ - H5HLpublic.h \ - H5MMpublic.h \ - H5Opublic.h \ - H5Ppublic.h \ - H5Zpublic.h \ - H5Rpublic.h \ - H5RApublic.h \ - H5Spublic.h \ - H5Tpublic.h \ - H5FDcore.h \ - H5FDfamily.h \ - H5FDmpio.h \ - H5FDsec2.h \ - H5FDmulti.h -H5FDcore.lo: \ - H5FDcore.c \ - hdf5.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Ipublic.h \ - H5Apublic.h \ - H5ACpublic.h \ - H5Bpublic.h \ - H5Dpublic.h \ - H5Epublic.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5Gpublic.h \ - H5HGpublic.h \ - H5HLpublic.h \ - H5MMpublic.h \ - H5Opublic.h \ - H5Ppublic.h \ - H5Zpublic.h \ - H5Rpublic.h \ - H5RApublic.h \ - H5Spublic.h \ - H5Tpublic.h \ - H5FDcore.h \ - H5FDfamily.h \ - H5FDmpio.h \ - H5FDsec2.h \ - H5FDmulti.h -H5FDmulti.lo: \ - H5FDmulti.c \ - hdf5.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Ipublic.h \ - H5Apublic.h \ - H5ACpublic.h \ - H5Bpublic.h \ - H5Dpublic.h \ - H5Epublic.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5Gpublic.h \ - H5HGpublic.h \ - H5HLpublic.h \ - H5MMpublic.h \ - H5Opublic.h \ - H5Ppublic.h \ - H5Zpublic.h \ - H5Rpublic.h \ - H5RApublic.h \ - H5Spublic.h \ - H5Tpublic.h \ - H5FDcore.h \ - H5FDfamily.h \ - H5FDmpio.h \ - H5FDsec2.h \ - H5FDmulti.h -H5I.lo: \ - H5I.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5Eprivate.h -H5P.lo: \ - H5P.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5FDprivate.h \ - H5MMprivate.h -H5R.lo: \ - H5R.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h -H5Smpio.lo: \ - H5Smpio.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5FDprivate.h \ - H5FDpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Dpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5MMpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h -H5Spoint.lo: \ - H5Spoint.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Iprivate.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Dpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h -H5Sselect.lo: \ - H5Sselect.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Iprivate.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Dpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h -H5T.lo: \ - H5T.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Rprivate.h \ - H5Rpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Iprivate.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MMprivate.h \ - H5Pprivate.h -H5Tvlen.lo: \ - H5Tvlen.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5FDpublic.h \ - H5MMpublic.h \ - H5Iprivate.h \ - H5MMprivate.h \ - H5Tpkg.h \ - H5Rprivate.h \ - H5Rpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Gprivate.h \ - H5Gpublic.h -H5TB.lo: \ - H5TB.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5api_adpt.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5Eprivate.h @@ -1285,7 +1285,6 @@ H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, intn overwrite, "object header message is too large (16k max)"); } } - size = H5O_ALIGN(size); idx = H5O_alloc(ent->file, oh, type, size); if (idx < 0) { HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, @@ -1371,7 +1370,6 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force) if (idx==oh->nmesgs) { if (!force) HRETURN(SUCCEED); /*nothing to do*/ size = (H5O_MTIME->raw_size)(f, &now); - size = H5O_ALIGN(size); if ((idx=H5O_alloc(f, oh, H5O_MTIME, size))<0) { HRETURN_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for modification time " @@ -1571,7 +1569,7 @@ H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, intn sequence) * * Purpose: Extends a chunk which hasn't been allocated on disk yet * to make the chunk large enough to contain a message whose - * data size is at least SIZE bytes. + * data size is exactly SIZE bytes (SIZE need not be aligned). * * If the last message of the chunk is the null message, then * that message will be extended with the chunk. Otherwise a @@ -1598,7 +1596,8 @@ static intn H5O_alloc_extend_chunk(H5O_t *oh, intn chunkno, size_t size) { intn idx, i; - size_t delta, padding; + size_t delta, old_size; + size_t aligned_size = H5O_ALIGN(size); uint8_t *old_addr; FUNC_ENTER(H5O_alloc_extend_chunk, FAIL); @@ -1607,7 +1606,6 @@ H5O_alloc_extend_chunk(H5O_t *oh, intn chunkno, size_t size) assert(oh); assert(chunkno >= 0 && chunkno < oh->nchunks); assert(size > 0); - assert (size==H5O_ALIGN (size)); if (H5F_addr_defined(oh->chunk[chunkno].addr)) { HRETURN_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "chunk is on disk"); @@ -1619,7 +1617,7 @@ H5O_alloc_extend_chunk(H5O_t *oh, intn chunkno, size_t size) (oh->mesg[idx].raw + oh->mesg[idx].raw_size == oh->chunk[chunkno].image + oh->chunk[chunkno].size)) { - delta = MAX (H5O_MIN_SIZE, size - oh->mesg[idx].raw_size); + delta = MAX (H5O_MIN_SIZE, aligned_size - oh->mesg[idx].raw_size); assert (delta=H5O_ALIGN (delta)); oh->mesg[idx].dirty = TRUE; oh->mesg[idx].raw_size += delta; @@ -1662,8 +1660,7 @@ H5O_alloc_extend_chunk(H5O_t *oh, intn chunkno, size_t size) oh->alloc_nmesgs = (intn)na; oh->mesg = x; } - delta = MAX(H5O_MIN_SIZE, size+H5O_SIZEOF_MSGHDR(f)); - padding = H5O_ALIGN(delta) - delta; + delta = MAX(H5O_MIN_SIZE, aligned_size+H5O_SIZEOF_MSGHDR(f)); delta = H5O_ALIGN(delta); idx = oh->nmesgs++; oh->mesg[idx].type = H5O_NULL; @@ -1676,6 +1673,7 @@ H5O_alloc_extend_chunk(H5O_t *oh, intn chunkno, size_t size) oh->mesg[idx].chunkno = chunkno; old_addr = oh->chunk[chunkno].image; + old_size = oh->chunk[chunkno].size; oh->chunk[chunkno].size += delta; oh->chunk[chunkno].image = H5MM_realloc(old_addr, oh->chunk[chunkno].size); @@ -1683,8 +1681,8 @@ H5O_alloc_extend_chunk(H5O_t *oh, intn chunkno, size_t size) HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } - HDmemset(oh->chunk[chunkno].image+oh->chunk[chunkno].size-padding, - 0, padding); + HDmemset(oh->chunk[chunkno].image+old_size, 0, + oh->chunk[chunkno].size - old_size); /* adjust raw addresses for messages of this chunk */ if (old_addr != oh->chunk[chunkno].image) { @@ -1709,6 +1707,8 @@ H5O_alloc_extend_chunk(H5O_t *oh, intn chunkno, size_t size) * message, then some message from another chunk is moved into * this chunk to make room. * + * SIZE need not be aligned. + * * Return: Success: Index number of the null message for the * new chunk. The null message will be at * least SIZE bytes not counting the message @@ -1740,7 +1740,7 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size) /* check args */ assert (oh); assert (size > 0); - assert (size == H5O_ALIGN (size)); + size = H5O_ALIGN(size); /* * Find the smallest null message that will hold an object @@ -1916,18 +1916,18 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size) intn chunkno; intn idx; intn null_idx; + size_t aligned_size = H5O_ALIGN(size); FUNC_ENTER(H5O_alloc, FAIL); /* check args */ assert (oh); assert (type); - assert (size == H5O_ALIGN (size)); /* look for a null message which is large enough */ for (idx = 0; idx < oh->nmesgs; idx++) { if (H5O_NULL_ID == oh->mesg[idx].type->id && - oh->mesg[idx].raw_size >= size) + oh->mesg[idx].raw_size >= aligned_size) break; } @@ -1966,8 +1966,8 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size) } /* do we need to split the null message? */ - if (oh->mesg[idx].raw_size > size) { - assert(oh->mesg[idx].raw_size - size >= H5O_SIZEOF_MSGHDR(f)); + if (oh->mesg[idx].raw_size > aligned_size) { + assert(oh->mesg[idx].raw_size - aligned_size >= H5O_SIZEOF_MSGHDR(f)); if (oh->nmesgs >= oh->alloc_nmesgs) { int old_alloc=oh->alloc_nmesgs; @@ -1989,12 +1989,12 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size) oh->mesg[null_idx].dirty = TRUE; oh->mesg[null_idx].native = NULL; oh->mesg[null_idx].raw = oh->mesg[idx].raw + - size + + aligned_size + H5O_SIZEOF_MSGHDR(f); oh->mesg[null_idx].raw_size = oh->mesg[idx].raw_size - - (size + H5O_SIZEOF_MSGHDR(f)); + (aligned_size + H5O_SIZEOF_MSGHDR(f)); oh->mesg[null_idx].chunkno = oh->mesg[idx].chunkno; - oh->mesg[idx].raw_size = size; + oh->mesg[idx].raw_size = aligned_size; } /* initialize the new message */ @@ -13,10 +13,6 @@ #include <H5Oprivate.h> #include <H5Zprivate.h> -#ifdef HAVE_ZLIB_H -# include <zlib.h> -#endif - /* Interface initialization */ #define PABLO_MASK H5Z_mask #define INTERFACE_INIT H5Z_init_interface @@ -27,10 +23,6 @@ static size_t H5Z_table_alloc_g = 0; static size_t H5Z_table_used_g = 0; static H5Z_class_t *H5Z_table_g = NULL; -/* Predefined filters */ -static size_t H5Z_filter_deflate(uintn flags, size_t cd_nelmts, - const uintn cd_values[], size_t nbytes, - size_t *buf_size, void **buf); /*------------------------------------------------------------------------- @@ -479,125 +471,3 @@ H5Z_pipeline(H5F_t UNUSED *f, const H5O_pline_t *pline, uintn flags, FUNC_LEAVE(SUCCEED); } - -/*------------------------------------------------------------------------- - * Function: H5Z_filter_deflate - * - * Purpose: - * - * Return: Success: - * - * Failure: - * - * Programmer: Robb Matzke - * Thursday, April 16, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static size_t -H5Z_filter_deflate (uintn flags, size_t cd_nelmts, const uintn cd_values[], - size_t nbytes, size_t *buf_size, void **buf) -{ - size_t ret_value = 0; - void *outbuf = NULL; -#if defined(HAVE_COMPRESS2) - int aggression = 6; - int status; -#endif - - FUNC_ENTER (H5Z_filter_deflate, 0); - - /* Check arguments */ - if (cd_nelmts!=1 || cd_values[0]>9) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, - "invalid deflate aggression level"); - } - -#if defined(HAVE_COMPRESS2) - aggression = cd_values[0]; - if (flags & H5Z_FLAG_REVERSE) { - /* Input; uncompress */ - z_stream z_strm; - size_t nalloc = *buf_size; - - if (NULL==(outbuf = H5MM_malloc(nalloc))) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, - "memory allocation failed for deflate uncompression"); - } - HDmemset(&z_strm, 0, sizeof(z_strm)); - z_strm.next_in = *buf; - z_strm.avail_in = nbytes; - z_strm.next_out = outbuf; - z_strm.avail_out = nalloc; - if (Z_OK!=inflateInit(&z_strm)) { - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflateInit() failed"); - } - while (1) { - status = inflate(&z_strm, Z_SYNC_FLUSH); - if (Z_STREAM_END==status) break; /*done*/ - if (Z_OK!=status) { - inflateEnd(&z_strm); - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflate() failed"); - } - if (Z_OK==status && 0==z_strm.avail_out) { - nalloc *= 2; - if (NULL==(outbuf = H5MM_realloc(outbuf, nalloc))) { - inflateEnd(&z_strm); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, - "memory allocation failed for deflate " - "uncompression"); - } - z_strm.next_out = (char*)outbuf + z_strm.total_out; - z_strm.avail_out = nalloc - z_strm.total_out; - } - } - - H5MM_xfree(*buf); - *buf = outbuf; - outbuf = NULL; - *buf_size = nalloc; - ret_value = z_strm.total_out; - inflateEnd(&z_strm); - - } else { - /* - * Output; compress but fail if the result would be larger than the - * input. The library doesn't provide in-place compression, so we - * must allocate a separate buffer for the result. - */ - const Bytef *z_src = (const Bytef*)(*buf); - Bytef *z_dst; /*destination buffer */ - uLongf z_dst_nbytes = (uLongf)nbytes; - uLong z_src_nbytes = (uLong)nbytes; - - if (NULL==(z_dst=outbuf=H5MM_malloc(nbytes))) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, - "unable to allocate deflate destination buffer"); - } - status = compress2 (z_dst, &z_dst_nbytes, z_src, z_src_nbytes, - aggression); - if (Z_BUF_ERROR==status) { - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow"); - } else if (Z_MEM_ERROR==status) { - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "deflate memory error"); - } else if (Z_OK!=status) { - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "deflate error"); - } else { - H5MM_xfree(*buf); - *buf = outbuf; - outbuf = NULL; - *buf_size = nbytes; - ret_value = z_dst_nbytes; - } - } -#else - HGOTO_ERROR (H5E_PLINE, H5E_UNSUPPORTED, 0, - "hdf5 was not compiled with zlib-1.0.2 or better"); -#endif - - done: - H5MM_xfree(outbuf); - FUNC_LEAVE (ret_value); -} diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c new file mode 100644 index 0000000..1d3928a --- /dev/null +++ b/src/H5Zdeflate.c @@ -0,0 +1,144 @@ +/* + * Copyright © 1999 NCSA + * All rights reserved. + * + * Programmer: Robb Matzke <matzke@llnl.gov> + * Friday, August 27, 1999 + */ +#include <H5private.h> +#include <H5Eprivate.h> +#include <H5MMprivate.h> +#include <H5Zprivate.h> + +#ifdef HAVE_ZLIB_H +# include <zlib.h> +#endif + +/* Interface initialization */ +#define PABLO_MASK H5Z_deflate_mask +#define INTERFACE_INIT NULL +static intn interface_initialize_g = 0; + + +/*------------------------------------------------------------------------- + * Function: H5Z_filter_deflate + * + * Purpose: + * + * Return: Success: + * + * Failure: + * + * Programmer: Robb Matzke + * Thursday, April 16, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +size_t +H5Z_filter_deflate (unsigned flags, size_t cd_nelmts, + const unsigned cd_values[], size_t nbytes, + size_t *buf_size, void **buf) +{ + size_t ret_value = 0; + void *outbuf = NULL; +#if defined(HAVE_COMPRESS2) + int aggression = 6; + int status; +#endif + + FUNC_ENTER (H5Z_filter_deflate, 0); + + /* Check arguments */ + if (cd_nelmts!=1 || cd_values[0]>9) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, + "invalid deflate aggression level"); + } + +#if defined(HAVE_COMPRESS2) + aggression = cd_values[0]; + if (flags & H5Z_FLAG_REVERSE) { + /* Input; uncompress */ + z_stream z_strm; + size_t nalloc = *buf_size; + + if (NULL==(outbuf = H5MM_malloc(nalloc))) { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, + "memory allocation failed for deflate uncompression"); + } + HDmemset(&z_strm, 0, sizeof(z_strm)); + z_strm.next_in = *buf; + z_strm.avail_in = nbytes; + z_strm.next_out = outbuf; + z_strm.avail_out = nalloc; + if (Z_OK!=inflateInit(&z_strm)) { + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflateInit() failed"); + } + while (1) { + status = inflate(&z_strm, Z_SYNC_FLUSH); + if (Z_STREAM_END==status) break; /*done*/ + if (Z_OK!=status) { + inflateEnd(&z_strm); + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflate() failed"); + } + if (Z_OK==status && 0==z_strm.avail_out) { + nalloc *= 2; + if (NULL==(outbuf = H5MM_realloc(outbuf, nalloc))) { + inflateEnd(&z_strm); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, + "memory allocation failed for deflate " + "uncompression"); + } + z_strm.next_out = (char*)outbuf + z_strm.total_out; + z_strm.avail_out = nalloc - z_strm.total_out; + } + } + + H5MM_xfree(*buf); + *buf = outbuf; + outbuf = NULL; + *buf_size = nalloc; + ret_value = z_strm.total_out; + inflateEnd(&z_strm); + + } else { + /* + * Output; compress but fail if the result would be larger than the + * input. The library doesn't provide in-place compression, so we + * must allocate a separate buffer for the result. + */ + const Bytef *z_src = (const Bytef*)(*buf); + Bytef *z_dst; /*destination buffer */ + uLongf z_dst_nbytes = (uLongf)nbytes; + uLong z_src_nbytes = (uLong)nbytes; + + if (NULL==(z_dst=outbuf=H5MM_malloc(nbytes))) { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, + "unable to allocate deflate destination buffer"); + } + status = compress2 (z_dst, &z_dst_nbytes, z_src, z_src_nbytes, + aggression); + if (Z_BUF_ERROR==status) { + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow"); + } else if (Z_MEM_ERROR==status) { + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "deflate memory error"); + } else if (Z_OK!=status) { + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "deflate error"); + } else { + H5MM_xfree(*buf); + *buf = outbuf; + outbuf = NULL; + *buf_size = nbytes; + ret_value = z_dst_nbytes; + } + } +#else + HGOTO_ERROR (H5E_PLINE, H5E_UNSUPPORTED, 0, + "hdf5 was not compiled with zlib-1.0.2 or better"); +#endif + + done: + H5MM_xfree(outbuf); + FUNC_LEAVE (ret_value); +} diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h index 4e22144..690bf9e 100644 --- a/src/H5Zprivate.h +++ b/src/H5Zprivate.h @@ -9,6 +9,7 @@ #define _H5Zprivate_H #include <H5Zpublic.h> +#include <H5Fprivate.h> /* * The filter table maps filter identification numbers to structs that diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h index ea9e62f..f88d1f5 100644 --- a/src/H5Zpublic.h +++ b/src/H5Zpublic.h @@ -55,6 +55,10 @@ extern "C" { __DLL__ herr_t H5Zregister(H5Z_filter_t id, const char *comment, H5Z_func_t filter); +size_t H5Z_filter_deflate(unsigned flags, size_t cd_nelmts, + const unsigned cd_values[], size_t nbytes, + size_t *buf_size, void **buf); + #ifdef __cplusplus } #endif diff --git a/src/Makefile.in b/src/Makefile.in index da03c0e..2c3be81 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -27,7 +27,8 @@ LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5D.c H5E.c H5F.c H5Farray.c H5Fistore.c \ H5Oattr.c H5Ocomp.c H5Ocont.c H5Odtype.c H5Oefl.c H5Ofill.c H5Olayout.c \ H5Omtime.c H5Oname.c H5Onull.c H5Osdspace.c H5Oshared.c H5Ostab.c H5P.c \ H5R.c H5RA.c H5S.c H5Sall.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \ - H5Sselect.c H5T.c H5Tbit.c H5Tconv.c H5Tinit.c H5Tvlen.c H5TB.c H5V.c H5Z.c + H5Sselect.c H5T.c H5Tbit.c H5Tconv.c H5Tinit.c H5Tvlen.c H5TB.c H5V.c \ + H5Z.c H5Zdeflate.c LIB_OBJ=$(LIB_SRC:.c=.lo) |