summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-08-28 15:24:12 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-08-28 15:24:12 (GMT)
commit1b1be9918c1a654225f2040619f0b26ae83028fb (patch)
treedb8bfa193965145aea917d4f06f122238324555d /src
parent69ed3c270a64d5c60544126b34431d1a7e9a7c8c (diff)
downloadhdf5-1b1be9918c1a654225f2040619f0b26ae83028fb.zip
hdf5-1b1be9918c1a654225f2040619f0b26ae83028fb.tar.gz
hdf5-1b1be9918c1a654225f2040619f0b26ae83028fb.tar.bz2
[svn-r627] Changes since 19980827
---------------------- ./src/H5G.c Fixed a link count on groups. Groups were always created with a link count of zero instead of one. ./src/H5Gpublic.h Added H5G_NTYPES so applications can easily declare arrays which are indexed by object type. ./src/H5O.c Calling `H5O_link(&ent,0)' will succeed when the file is open for read only because it's the only way to get the object's current link count. ./tools/h5ls.c Can take non-group object names on the command line (and multiple objects). Reorganized to be more extendible. The link count is displayed for `-v'. ./src/H5F.c Dumping of cache statistics is controlled by only the HDF5_DEBUG environment variable and not the H5F_ACC_DEBUG flag for H5Fopen() and H5Fcreate() since this makes it similar to the other debugging options. ./src/H5R.c ./test/ragged.c ./test/Makefile.in Tests pass but still a little work left to be done.
Diffstat (limited to 'src')
-rw-r--r--src/.distdep430
-rw-r--r--src/H5F.c6
-rw-r--r--src/H5G.c3
-rw-r--r--src/H5Gpublic.h1
-rw-r--r--src/H5O.c15
-rw-r--r--src/H5R.c128
6 files changed, 346 insertions, 237 deletions
diff --git a/src/.distdep b/src/.distdep
index adc5f19..a260d68 100644
--- a/src/.distdep
+++ b/src/.distdep
@@ -34,34 +34,6 @@ H5Fcore.o: \
H5Eprivate.h \
H5Epublic.h \
H5Ipublic.h
-H5Fmpio.o: \
- H5Fmpio.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5Ipublic.h \
- H5Dprivate.h \
- H5Dpublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Gprivate.h \
- H5Gpublic.h \
- H5Bprivate.h \
- H5Bpublic.h \
- H5Oprivate.h \
- H5Opublic.h \
- H5HGprivate.h \
- H5HGpublic.h \
- H5Tprivate.h \
- H5Tpublic.h \
- H5Sprivate.h \
- H5Spublic.h \
- H5Zprivate.h \
- H5Zpublic.h \
- H5MMprivate.h \
- H5MMpublic.h
H5Fsec2.o: \
H5Fsec2.c \
H5private.h \
@@ -612,34 +584,6 @@ H5HL.o: \
H5MFprivate.h \
H5MFpublic.h \
H5MMprivate.h
-H5O.o: \
- H5O.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5ACprivate.h \
- H5ACpublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Ipublic.h \
- H5Dpublic.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5MFprivate.h \
- H5MFpublic.h \
- H5MMprivate.h \
- H5MMpublic.h \
- H5Oprivate.h \
- H5Opublic.h \
- H5Gprivate.h \
- H5Gpublic.h \
- H5Bprivate.h \
- H5Bpublic.h \
- H5HGprivate.h \
- H5HGpublic.h \
- H5Tprivate.h \
- H5Tpublic.h \
- H5Sprivate.h
H5Omtime.o: \
H5Omtime.c \
H5private.h \
@@ -691,6 +635,108 @@ H5Fistore.o: \
H5Epublic.h \
H5MFprivate.h \
H5MFpublic.h
+H5E.o: \
+ H5E.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5Eprivate.h
+H5Flow.o: \
+ H5Flow.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h
+H5MF.o: \
+ H5MF.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h
+H5Shyper.o: \
+ H5Shyper.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h
+H5Tconv.o: \
+ H5Tconv.c \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5public.h \
+ H5config.h \
+ H5private.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Tpkg.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h
+H5Z.o: \
+ H5Z.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h
H5.o: \
H5.c \
H5private.h \
@@ -788,30 +834,21 @@ H5D.o: \
H5HLpublic.h \
H5MFprivate.h \
H5MFpublic.h
-H5E.o: \
- H5E.c \
+H5P.o: \
+ H5P.c \
H5private.h \
H5public.h \
H5config.h \
H5Iprivate.h \
H5Ipublic.h \
- H5Eprivate.h
-H5F.o: \
- H5F.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5Aprivate.h \
- H5Apublic.h \
- H5Ipublic.h \
- H5Gprivate.h \
- H5Gpublic.h \
H5Bprivate.h \
H5Bpublic.h \
H5Fprivate.h \
H5Fpublic.h \
H5Dpublic.h \
H5Dprivate.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
H5Oprivate.h \
H5Opublic.h \
H5HGprivate.h \
@@ -822,40 +859,46 @@ H5F.o: \
H5Spublic.h \
H5Zprivate.h \
H5Zpublic.h \
- H5Iprivate.h \
- H5ACprivate.h \
- H5ACpublic.h \
H5Eprivate.h \
H5Epublic.h \
- H5MMprivate.h \
- H5MMpublic.h
-H5Flow.o: \
- H5Flow.c \
+ H5MMprivate.h
+H5S.o: \
+ H5S.c \
H5private.h \
H5public.h \
H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
H5Eprivate.h \
H5Epublic.h \
- H5Ipublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
H5Fprivate.h \
H5Fpublic.h \
H5Dpublic.h \
- H5MMprivate.h \
- H5MMpublic.h
-H5G.o: \
- H5G.c \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h
+H5T.o: \
+ H5T.c \
H5private.h \
H5public.h \
H5config.h \
- H5Bprivate.h \
- H5Bpublic.h \
+ H5Dprivate.h \
+ H5Dpublic.h \
+ H5Ipublic.h \
H5Fprivate.h \
H5Fpublic.h \
- H5Ipublic.h \
- H5Dpublic.h \
- H5Dprivate.h \
H5Gprivate.h \
H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
H5Oprivate.h \
H5Opublic.h \
H5HGprivate.h \
@@ -866,38 +909,34 @@ H5G.o: \
H5Spublic.h \
H5Zprivate.h \
H5Zpublic.h \
+ H5Iprivate.h \
H5Eprivate.h \
H5Epublic.h \
- H5Gpkg.h \
- H5ACprivate.h \
- H5ACpublic.h \
- H5HLprivate.h \
- H5HLpublic.h \
- H5Iprivate.h \
H5MMprivate.h
-H5MF.o: \
- H5MF.c \
+H5TB.o: \
+ H5TB.c \
H5private.h \
H5public.h \
H5config.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5Ipublic.h
-H5P.o: \
- H5P.c \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5Eprivate.h
+H5F.o: \
+ H5F.c \
H5private.h \
H5public.h \
H5config.h \
- H5Iprivate.h \
+ H5Aprivate.h \
+ H5Apublic.h \
H5Ipublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
H5Bprivate.h \
H5Bpublic.h \
H5Fprivate.h \
H5Fpublic.h \
H5Dpublic.h \
H5Dprivate.h \
- H5Gprivate.h \
- H5Gpublic.h \
H5Oprivate.h \
H5Opublic.h \
H5HGprivate.h \
@@ -908,19 +947,23 @@ H5P.o: \
H5Spublic.h \
H5Zprivate.h \
H5Zpublic.h \
+ H5Iprivate.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
H5Eprivate.h \
H5Epublic.h \
- H5MMprivate.h
-H5R.o: \
- H5R.c \
- H5Rprivate.h \
- H5Rpublic.h \
- H5Ipublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h
+H5Fmpio.o: \
+ H5Fmpio.c \
+ H5private.h \
H5public.h \
H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
H5Dprivate.h \
H5Dpublic.h \
- H5private.h \
H5Fprivate.h \
H5Fpublic.h \
H5Gprivate.h \
@@ -937,54 +980,97 @@ H5R.o: \
H5Spublic.h \
H5Zprivate.h \
H5Zpublic.h \
- H5Eprivate.h \
- H5Epublic.h
-H5S.o: \
- H5S.c \
+ H5MMprivate.h \
+ H5MMpublic.h
+H5G.o: \
+ H5G.c \
H5private.h \
H5public.h \
H5config.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Ipublic.h \
+ H5Dpublic.h \
+ H5Dprivate.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Gpkg.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5HLprivate.h \
+ H5HLpublic.h \
H5Iprivate.h \
+ H5MMprivate.h
+H5O.o: \
+ H5O.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
H5Ipublic.h \
+ H5Dpublic.h \
H5Eprivate.h \
H5Epublic.h \
+ H5MFprivate.h \
+ H5MFpublic.h \
H5MMprivate.h \
H5MMpublic.h \
H5Oprivate.h \
H5Opublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Dpublic.h \
H5Gprivate.h \
H5Gpublic.h \
H5Bprivate.h \
H5Bpublic.h \
H5HGprivate.h \
H5HGpublic.h \
- H5Tprivate.h
-H5Shyper.o: \
- H5Shyper.c \
- H5private.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h
+H5R.o: \
+ H5R.c \
+ H5Rprivate.h \
+ H5Rpublic.h \
+ H5Ipublic.h \
H5public.h \
H5config.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5Ipublic.h \
- H5Sprivate.h \
- H5Spublic.h \
+ H5Dprivate.h \
+ H5Dpublic.h \
+ H5private.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
H5Gprivate.h \
H5Gpublic.h \
H5Bprivate.h \
H5Bpublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Dpublic.h \
H5Oprivate.h \
H5Opublic.h \
H5HGprivate.h \
H5HGpublic.h \
H5Tprivate.h \
- H5Tpublic.h
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h
H5Smpio.o: \
H5Smpio.c \
H5private.h \
@@ -1059,89 +1145,3 @@ H5Sselect.o: \
H5Tpublic.h \
H5Zprivate.h \
H5Zpublic.h
-H5T.o: \
- H5T.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5Dprivate.h \
- H5Dpublic.h \
- H5Ipublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Gprivate.h \
- H5Gpublic.h \
- H5Bprivate.h \
- H5Bpublic.h \
- H5Oprivate.h \
- H5Opublic.h \
- H5HGprivate.h \
- H5HGpublic.h \
- H5Tprivate.h \
- H5Tpublic.h \
- H5Sprivate.h \
- H5Spublic.h \
- H5Zprivate.h \
- H5Zpublic.h \
- H5Iprivate.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5MMprivate.h
-H5Tconv.o: \
- H5Tconv.c \
- H5Iprivate.h \
- H5Ipublic.h \
- H5public.h \
- H5config.h \
- H5private.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5MMprivate.h \
- H5MMpublic.h \
- H5Tpkg.h \
- H5HGprivate.h \
- H5HGpublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Dpublic.h \
- H5Tprivate.h \
- H5Tpublic.h \
- H5Gprivate.h \
- H5Gpublic.h \
- H5Bprivate.h \
- H5Bpublic.h
-H5TB.o: \
- H5TB.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5Iprivate.h \
- H5Ipublic.h \
- H5Eprivate.h
-H5Z.o: \
- H5Z.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5Ipublic.h \
- H5MMprivate.h \
- H5MMpublic.h \
- H5Oprivate.h \
- H5Opublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Dpublic.h \
- H5Gprivate.h \
- H5Gpublic.h \
- H5Bprivate.h \
- H5Bpublic.h \
- H5HGprivate.h \
- H5HGpublic.h \
- H5Tprivate.h \
- H5Tpublic.h \
- H5Sprivate.h \
- H5Spublic.h \
- H5Zprivate.h \
- H5Zpublic.h
diff --git a/src/H5F.c b/src/H5F.c
index f6492b1..b0fdf4e 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1562,10 +1562,8 @@ H5F_close(H5F_t *f)
}
/* Dump debugging info */
- if (f->intent & H5F_ACC_DEBUG) {
- H5AC_debug(f);
- H5F_istore_stats (f, FALSE);
- }
+ H5AC_debug(f);
+ H5F_istore_stats (f, FALSE);
/* Close files and release resources */
H5F_low_close(f->shared->lf, f->shared->access_parms);
diff --git a/src/H5G.c b/src/H5G.c
index 62cbd42..74af27d 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -1278,6 +1278,9 @@ H5G_create(H5G_t *loc, const char *name, size_t size_hint)
}
/* insert child name into parent */
+ if (1!=H5O_link(&(grp->ent), 1)) {
+ HRETURN_ERROR(H5E_SYM, H5E_LINK, NULL, "link inc failure");
+ }
if (H5G_stab_insert(&grp_ent, rest, &(grp->ent)) < 0) {
H5O_close(&(grp->ent));
grp = H5MM_xfree(grp);
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index d7b8c6c..586a50f 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -40,6 +40,7 @@ typedef enum H5G_link_t {
#define H5G_GROUP 1 /* Object is a group */
#define H5G_DATASET 2 /* Object is a dataset */
#define H5G_TYPE 3 /* Object is a named data type */
+#define H5G_NTYPES 4 /* THIS MUST BE LAST */
/* Information about an object */
typedef struct H5G_stat_t {
diff --git a/src/H5O.c b/src/H5O.c
index 81efca7..addd14b 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -779,6 +779,11 @@ H5O_copy (const H5O_class_t *type, const void *mesg, void *dst)
*
* Modifications:
*
+ * Robb Matzke, 1998-08-27
+ * This function can also be used to obtain the current number of links
+ * if zero is passed for ADJUST. If that's the case then we don't check
+ * for write access on the file.
+ *
*-------------------------------------------------------------------------
*/
intn
@@ -793,7 +798,7 @@ H5O_link(H5G_entry_t *ent, intn adjust)
assert(ent);
assert(ent->file);
assert(H5F_addr_defined(&(ent->header)));
- if (0==(ent->file->intent & H5F_ACC_RDWR)) {
+ if (adjust!=0 && 0==(ent->file->intent & H5F_ACC_RDWR)) {
HGOTO_ERROR (H5E_OHDR, H5E_WRITEERROR, FAIL,
"no write intent on file");
}
@@ -806,19 +811,19 @@ H5O_link(H5G_entry_t *ent, intn adjust)
}
/* adjust link count */
- if (adjust < 0) {
+ if (adjust<0) {
if (oh->nlink + adjust < 0) {
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL,
"link count would be negative");
}
oh->nlink += adjust;
- } else {
+ oh->dirty = TRUE;
+ } else if (adjust>0) {
oh->nlink += adjust;
+ oh->dirty = TRUE;
}
- oh->dirty = TRUE;
ret_value = oh->nlink;
-
done:
if (oh && H5AC_unprotect(ent->file, H5AC_OHDR, &(ent->header), oh) < 0) {
HRETURN_ERROR(H5E_OHDR, H5E_PROTECT, FAIL,
diff --git a/src/H5R.c b/src/H5R.c
index 02c4e25..9d31119 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -738,7 +738,7 @@ H5R_write(H5R_t *ra, hssize_t start_row, hsize_t nrows, H5T_t *type,
for (i=0; i<nrows; i++) {
if (size[i]>raw_cur_size[1]) {
H5R_fix_overflow(ra, type, meta+i, size[i]-raw_cur_size[1],
- (uint8*)(buf[i])+raw_cur_size[1]);
+ (uint8*)(buf[i])+raw_cur_size[1]*type_size);
}
meta[i].nelmts = size[i];
}
@@ -997,15 +997,18 @@ H5R_read(H5R_t *ra, hssize_t start_row, hsize_t nrows, H5T_t *type,
H5S_t *mm_space=NULL; /*meta memory data space */
H5S_t *rf_space=NULL; /*raw data file space */
H5S_t *rm_space=NULL; /*raw data memory space */
+ H5S_t *of_space=NULL; /*overflow data file space */
+ H5S_t *om_space=NULL; /*overflow data memory space */
hsize_t meta_cur_size; /*current meta data nelmts */
hsize_t meta_read_size; /*amount of meta data to read */
hsize_t raw_cur_size[2]; /*raw data current size */
- hsize_t raw_read_size; /*amount of raw data to read */
+ hsize_t raw_read_size[2]; /*amount of raw data to read */
hssize_t hs_offset[2]; /*hyperslab offset */
hsize_t hs_size[2]; /*hyperslab size */
uint8 *raw_buf=NULL; /*raw buffer */
size_t type_size; /*size of the TYPE argument */
- hsize_t i;
+ void **buf_out=NULL; /*output BUF values */
+ hsize_t i; /*counter */
FUNC_ENTER(H5R_read, FAIL);
@@ -1017,6 +1020,16 @@ H5R_read(H5R_t *ra, hssize_t start_row, hsize_t nrows, H5T_t *type,
if (0==nrows) HRETURN(SUCCEED);
type_size = H5T_get_size(type);
+ /*
+ * Malloc `buf_out' to hold the output values for `buf'. We have to do
+ * this because if we return failure we want `buf' to have the original
+ * values.
+ */
+ if (NULL==(buf_out=H5MM_calloc(nrows*sizeof(void*)))) {
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory allocation failed for BUF output values");
+ }
+
/* Read from the raw dataset */
if (NULL==(rf_space=H5D_get_space(ra->raw)) ||
H5S_extent_dims(rf_space, raw_cur_size, NULL)<0) {
@@ -1024,17 +1037,33 @@ H5R_read(H5R_t *ra, hssize_t start_row, hsize_t nrows, H5T_t *type,
"unable to determine current raw data extents");
}
if ((hsize_t)start_row>=raw_cur_size[0]) {
- raw_read_size = 0;
+ raw_read_size[0] = 0;
+ raw_read_size[1] = raw_cur_size[1];
} else {
- raw_read_size = MIN(nrows, raw_cur_size[0]-(hsize_t)start_row);
+ raw_read_size[0] = MIN(nrows, raw_cur_size[0]-(hsize_t)start_row);
+ raw_read_size[1] = raw_cur_size[1];
}
-
+ hs_offset[0] = start_row;
+ hs_offset[1] = 0;
+ if (NULL==(rm_space=H5S_create(H5S_SIMPLE)) ||
+ H5S_set_extent_simple(rm_space, 2, raw_read_size, NULL)<0 ||
+ H5S_select_hyperslab(rf_space, H5S_SELECT_SET, hs_offset, NULL,
+ raw_read_size, NULL)<0) {
+ HGOTO_ERROR(H5E_RAGGED, H5E_CANTINIT, FAIL,
+ "unable to set raw dataset selection");
+ }
+ if (NULL==(raw_buf=H5MM_malloc(nrows*raw_read_size[1]*type_size))) {
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory allocation failed for raw dataset");
+ }
+ if (H5D_read(ra->raw, type, rm_space, rf_space, &H5D_xfer_dflt,
+ raw_buf)<0) {
+ HGOTO_ERROR(H5E_RAGGED, H5E_READERROR, FAIL,
+ "unable to read raw dataset");
+ }
+ HDmemset(raw_buf+raw_read_size[0]*raw_read_size[1]*type_size, 0,
+ (nrows-raw_read_size[0])*raw_read_size[1]*type_size);
-
-
-
-
-
/* Get the meta data */
if (NULL==(meta=H5MM_malloc(nrows*sizeof(H5R_meta_t)))) {
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
@@ -1065,11 +1094,84 @@ H5R_read(H5R_t *ra, hssize_t start_row, hsize_t nrows, H5T_t *type,
HDmemset(meta+meta_read_size, 0,
(nrows-meta_read_size)*sizeof(H5R_meta_t));
+ /* Copy data into output buffers */
+ for (i=0; i<nrows; i++) {
+ /*
+ * If the caller didn't supply a buffer then allocate a buffer large
+ * enough to hold the entire row. Ignore the input value for the
+ * size and request the entire row.
+ */
+ if (NULL==(buf_out[i]=buf[i])) {
+ if (meta[i].nelmts>0 &&
+ NULL==(buf_out[i]=H5MM_malloc(meta[i].nelmts*type_size))) {
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory allocation failed for result");
+ }
+ size[i] = meta[i].nelmts;
+ } else {
+ size[i] = MIN(size[i], meta[i].nelmts);
+ }
+ if (0==size[i]) continue;
+
+ /* Copy the part of the row from the raw dataset */
+ HDmemcpy(buf_out[i], raw_buf+i*raw_read_size[1]*type_size,
+ MIN(size[i], raw_read_size[1])*type_size);
+
+ /* Copy the part of the row from the overflow dataset */
+ if (size[i]>raw_read_size[1]) {
+ if (!of_space && NULL==(of_space=H5D_get_space(ra->over))) {
+ HGOTO_ERROR(H5E_RAGGED, H5E_CANTINIT, FAIL,
+ "unable to get overflow extents");
+ }
+ hs_size[0] = size[i]-raw_read_size[1];
+ if (NULL==(om_space=H5S_create(H5S_SIMPLE)) ||
+ H5S_set_extent_simple(om_space, 1, size+i, NULL)<0 ||
+ H5S_select_hyperslab(om_space, H5S_SELECT_SET,
+ (hssize_t*)(raw_read_size+1), NULL,
+ hs_size, NULL)<0 ||
+ H5S_select_hyperslab(of_space, H5S_SELECT_SET,
+ &(meta[i].offset), NULL, hs_size,
+ NULL)<0) {
+ HGOTO_ERROR(H5E_RAGGED, H5E_CANTINIT, FAIL,
+ "unable to set overflow selection");
+ }
+ if (H5D_read(ra->over, type, om_space, of_space, &H5D_xfer_dflt,
+ buf_out[i])<0) {
+ HGOTO_ERROR(H5E_RAGGED, H5E_CANTINIT, FAIL,
+ "unable to read overflow dataset");
+ }
+ if (H5S_close(om_space)<0) {
+ om_space = NULL;
+ HGOTO_ERROR(H5E_RAGGED, H5E_CANTINIT, FAIL,
+ "unable to close overflow memory space");
+ }
+ om_space = NULL;
+ }
+
+ /* Actual row size */
+ size[i] = meta[i].nelmts;
+ }
- HGOTO_ERROR(H5E_RAGGED, H5E_UNSUPPORTED, FAIL,
- "not implemented yet");
+ /* Copy output buffers into BUF argument */
+ for (i=0; i<nrows; i++) buf[i] = buf_out[i];
+ ret_value = SUCCEED;
done:
+ if (rf_space) H5S_close(rf_space);
+ if (rm_space) H5S_close(rm_space);
+ if (mf_space) H5S_close(mf_space);
+ if (mm_space) H5S_close(mm_space);
+ if (of_space) H5S_close(of_space);
+ if (om_space) H5S_close(om_space);
+ H5MM_xfree(meta);
+ H5MM_xfree(raw_buf);
+ if (buf_out) {
+ for (i=0; i<nrows; i++) {
+ if (!buf[i]) H5MM_xfree(buf_out[i]);
+ }
+ H5MM_xfree(buf_out);
+ }
+
FUNC_LEAVE(ret_value);
}