summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5.c230
-rw-r--r--src/H5A.c61
-rw-r--r--src/H5AC.c55
-rw-r--r--src/H5ACprivate.h4
-rw-r--r--src/H5B.c68
-rw-r--r--src/H5Bprivate.h12
-rw-r--r--src/H5C.c14
-rw-r--r--src/H5CS.c7
-rw-r--r--src/H5Cprivate.h9
-rw-r--r--src/H5D.c56
-rw-r--r--src/H5Dcompact.c16
-rw-r--r--src/H5Dcontig.c119
-rw-r--r--src/H5Defl.c64
-rw-r--r--src/H5Dio.c136
-rw-r--r--src/H5Distore.c491
-rw-r--r--src/H5Dmpio.c2
-rw-r--r--src/H5Dpkg.h28
-rw-r--r--src/H5Dprivate.h8
-rw-r--r--src/H5Dpublic.h4
-rw-r--r--src/H5E.c10
-rw-r--r--src/H5Epublic.h8
-rw-r--r--src/H5F.c97
-rw-r--r--src/H5FD.c37
-rw-r--r--src/H5FDfamily.c6
-rw-r--r--src/H5FDlog.c10
-rw-r--r--src/H5FDmulti.c11
-rw-r--r--src/H5FDprivate.h2
-rw-r--r--src/H5FDstdio.c2
-rw-r--r--src/H5FL.c12
-rw-r--r--src/H5FS.c7
-rw-r--r--src/H5Fdbg.c16
-rw-r--r--src/H5Fpublic.h8
-rw-r--r--src/H5G.c7
-rw-r--r--src/H5Gnode.c44
-rw-r--r--src/H5Gpkg.h16
-rw-r--r--src/H5Gprivate.h2
-rw-r--r--src/H5HG.c19
-rw-r--r--src/H5HGprivate.h2
-rw-r--r--src/H5HL.c4
-rw-r--r--src/H5I.c175
-rw-r--r--src/H5Ipublic.h21
-rw-r--r--src/H5O.c16
-rw-r--r--src/H5Oattr.c4
-rw-r--r--src/H5Obogus.c4
-rw-r--r--src/H5Odtype.c5
-rw-r--r--src/H5Oefl.c4
-rw-r--r--src/H5Ofill.c9
-rw-r--r--src/H5Olayout.c6
-rw-r--r--src/H5Omtime.c9
-rw-r--r--src/H5Oname.c4
-rw-r--r--src/H5Opkg.h2
-rw-r--r--src/H5Opline.c4
-rw-r--r--src/H5Oprivate.h6
-rw-r--r--src/H5Osdspace.c4
-rw-r--r--src/H5Oshared.c4
-rw-r--r--src/H5Ostab.c4
-rw-r--r--src/H5Pdcpl.c26
-rw-r--r--src/H5Pfcpl.c283
-rw-r--r--src/H5Ppublic.h25
-rw-r--r--src/H5S.c40
-rw-r--r--src/H5SL.c6
-rw-r--r--src/H5SLprivate.h2
-rw-r--r--src/H5Sall.c18
-rw-r--r--src/H5Shyper.c422
-rw-r--r--src/H5Smpio.c6
-rw-r--r--src/H5Snone.c16
-rw-r--r--src/H5Spkg.h10
-rw-r--r--src/H5Spoint.c72
-rw-r--r--src/H5Sprivate.h20
-rw-r--r--src/H5Spublic.h8
-rw-r--r--src/H5Sselect.c44
-rw-r--r--src/H5T.c3
-rw-r--r--src/H5TS.c2
-rw-r--r--src/H5Tbit.c6
-rw-r--r--src/H5Tcommit.c70
-rw-r--r--src/H5Tcompound.c52
-rw-r--r--src/H5Tconv.c278
-rw-r--r--src/H5Tcset.c2
-rw-r--r--src/H5Tenum.c20
-rw-r--r--src/H5Tfields.c16
-rw-r--r--src/H5Tfixed.c2
-rw-r--r--src/H5Tfloat.c4
-rw-r--r--src/H5Tnative.c12
-rw-r--r--src/H5Toffset.c4
-rw-r--r--src/H5Torder.c4
-rw-r--r--src/H5Tpad.c2
-rw-r--r--src/H5Tpkg.h16
-rw-r--r--src/H5Tprecis.c7
-rw-r--r--src/H5Tprivate.h4
-rw-r--r--src/H5Tpublic.h23
-rw-r--r--src/H5Tstrpad.c2
-rw-r--r--src/H5Tvlen.c61
-rw-r--r--src/H5V.c390
-rw-r--r--src/H5Vprivate.h33
-rw-r--r--src/H5Z.c5
-rw-r--r--src/H5Ztrans.c377
-rw-r--r--src/H5config.h.in6
-rw-r--r--src/H5private.h2
-rw-r--r--src/H5public.h3
-rwxr-xr-xsrc/hdf5.lnt79
100 files changed, 2158 insertions, 2310 deletions
diff --git a/src/H5.c b/src/H5.c
index 44f46e1..a9829c5 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -32,8 +32,10 @@
#include "H5Tprivate.h" /* Datatypes */
#include "H5Zprivate.h" /* I/O pipeline filters */
+#ifdef H5_HAVE_PARALLEL
/* datatypes of predefined drivers needed by H5_trace() */
#include "H5FDmpio.h"
+#endif /* H5_HAVE_PARALLEL */
/* we need this for the struct rusage declaration */
#if defined(H5_HAVE_GETRUSAGE) && defined(H5_HAVE_SYS_RESOURCE_H)
@@ -53,7 +55,7 @@ hbool_t H5_MPEinit_g = FALSE; /* MPE Library hasn't been initialized */
#endif
char H5_lib_vers_info_g[] = H5_VERS_INFO;
-hbool_t dont_atexit_g = FALSE;
+static hbool_t H5_dont_atexit_g = FALSE;
H5_debug_t H5_debug_g; /*debugging info */
static void H5_debug_mask(const char*);
@@ -121,12 +123,12 @@ H5_init_library(void)
/*
* Install atexit() library cleanup routine unless the H5dont_atexit()
* has been called. Once we add something to the atexit() list it stays
- * there permanently, so we set dont_atexit_g after we add it to prevent
+ * there permanently, so we set H5_dont_atexit_g after we add it to prevent
* adding it again later if the library is cosed and reopened.
*/
- if (!dont_atexit_g) {
+ if (!H5_dont_atexit_g) {
(void)HDatexit(H5_term_library);
- dont_atexit_g = TRUE;
+ H5_dont_atexit_g = TRUE;
}
/*
@@ -319,10 +321,10 @@ H5dont_atexit(void)
FUNC_ENTER_API_NOINIT(H5dont_atexit)
H5TRACE0("e","");
- if (dont_atexit_g)
+ if (H5_dont_atexit_g)
ret_value=FAIL;
else
- dont_atexit_g = TRUE;
+ H5_dont_atexit_g = TRUE;
FUNC_LEAVE_API(ret_value)
}
@@ -464,9 +466,9 @@ H5_debug_mask(const char *s)
}
/* Get the name */
- for (i=0; HDisalpha(*s); i++, s++) {
- if (i<sizeof pkg_name) pkg_name[i] = *s;
- }
+ for (i=0; HDisalpha(*s); i++, s++)
+ if (i<sizeof pkg_name)
+ pkg_name[i] = *s;
pkg_name[MIN(sizeof(pkg_name)-1, i)] = '\0';
/* Trace, all, or one? */
@@ -479,26 +481,23 @@ H5_debug_mask(const char *s)
H5_debug_g.trace = stream;
H5_debug_g.ttimes = !clear;
} else if (!HDstrcmp(pkg_name, "all")) {
- for (i=0; i<H5_NPKGS; i++) {
+ for (i=0; i<(size_t)H5_NPKGS; i++)
H5_debug_g.pkg[i].stream = clear?NULL:stream;
- }
} else {
- for (i=0; i<H5_NPKGS; i++) {
+ for (i=0; i<(size_t)H5_NPKGS; i++) {
if (!HDstrcmp(H5_debug_g.pkg[i].name, pkg_name)) {
H5_debug_g.pkg[i].stream = clear?NULL:stream;
break;
}
}
- if (i>=H5_NPKGS) {
+ if (i>=(size_t)H5_NPKGS)
fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name);
- }
}
} else if (HDisdigit(*s)) {
int fd = (int)HDstrtol (s, &rest, 0);
- if ((stream=HDfdopen(fd, "w"))) {
+ if ((stream=HDfdopen(fd, "w"))!=NULL)
(void)HDsetvbuf (stream, NULL, _IOLBF, 0);
- }
s = rest;
} else {
s++;
@@ -1014,13 +1013,13 @@ HDfprintf(FILE *stream, const char *fmt, ...)
unsigned short x = (unsigned short)va_arg (ap, unsigned int);
n = fprintf (stream, format_templ, x);
} else if (!*modifier) {
- unsigned int x = va_arg (ap, unsigned int);
+ unsigned int x = va_arg (ap, unsigned int); /*lint !e732 Loss of sign not really occuring */
n = fprintf (stream, format_templ, x);
} else if (!HDstrcmp (modifier, "l")) {
- unsigned long x = va_arg (ap, unsigned long);
+ unsigned long x = va_arg (ap, unsigned long); /*lint !e732 Loss of sign not really occuring */
n = fprintf (stream, format_templ, x);
} else {
- uint64_t x = va_arg(ap, uint64_t);
+ uint64_t x = va_arg(ap, uint64_t); /*lint !e732 Loss of sign not really occuring */
n = fprintf (stream, format_templ, x);
}
break;
@@ -1053,7 +1052,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
case 'a':
{
- haddr_t x = va_arg (ap, haddr_t);
+ haddr_t x = va_arg (ap, haddr_t); /*lint !e732 Loss of sign not really occuring */
if (H5F_addr_defined(x)) {
sprintf(format_templ, "%%%s%s%s%s%s",
leftjust?"-":"", plussign?"+":"",
@@ -1095,7 +1094,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
case 's':
case 'p':
{
- char *x = va_arg (ap, char*);
+ char *x = va_arg (ap, char*); /*lint !e64 Type mismatch not really occuring */
n = fprintf (stream, format_templ, x);
}
break;
@@ -1564,7 +1563,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
* name is the null pointer then don't print the argument or the
* following `='. This is used for return values.
*/
- argname = va_arg (ap, char*);
+ argname = va_arg (ap, char*); /*lint !e64 Type mismatch not really occuring */
if (argname) {
unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname)-3); /*lint !e666 Allow expression with side effects */
if (!HDstrcmp (argname+n, "_id")) {
@@ -1578,7 +1577,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
}
/* The value */
- if (ptr) vp = va_arg (ap, void*);
+ if (ptr) vp = va_arg (ap, void*); /*lint !e64 Type mismatch not really occuring */
switch (type[0]) {
case 'a':
if (ptr) {
@@ -1588,7 +1587,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- haddr_t addr = va_arg(ap, haddr_t);
+ haddr_t addr = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occuring */
HDfprintf(out, "%a", addr);
}
break;
@@ -1601,7 +1600,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- hbool_t bool_var = va_arg (ap, hbool_t);
+ hbool_t bool_var = va_arg (ap, hbool_t); /*lint !e732 Loss of sign not really occuring */
if (TRUE==bool_var) fprintf (out, "TRUE");
else if (!bool_var) fprintf (out, "FALSE");
else fprintf (out, "TRUE(%u)", (unsigned)bool_var);
@@ -1631,7 +1630,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5D_alloc_time_t alloc_time = va_arg (ap, H5D_alloc_time_t);
+ H5D_alloc_time_t alloc_time = va_arg (ap, H5D_alloc_time_t); /*lint !e64 Type mismatch not really occuring */
switch (alloc_time) {
case H5D_ALLOC_TIME_ERROR:
fprintf (out, "H5D_ALLOC_TIME_ERROR");
@@ -1660,7 +1659,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5D_fill_time_t fill_time = va_arg (ap, H5D_fill_time_t);
+ H5D_fill_time_t fill_time = va_arg (ap, H5D_fill_time_t); /*lint !e64 Type mismatch not really occuring */
switch (fill_time) {
case H5D_FILL_TIME_ERROR:
fprintf (out, "H5D_FILL_TIME_ERROR");
@@ -1686,7 +1685,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5D_fill_value_t fill_value = va_arg (ap, H5D_fill_value_t);
+ H5D_fill_value_t fill_value = va_arg (ap, H5D_fill_value_t); /*lint !e64 Type mismatch not really occuring */
switch (fill_value) {
case H5D_FILL_VALUE_ERROR:
fprintf (out, "H5D_FILL_VALUE_ERROR");
@@ -1712,7 +1711,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5D_layout_t layout = va_arg (ap, H5D_layout_t);
+ H5D_layout_t layout = va_arg (ap, H5D_layout_t); /*lint !e64 Type mismatch not really occuring */
switch (layout) {
case H5D_LAYOUT_ERROR:
fprintf (out, "H5D_LAYOUT_ERROR");
@@ -1726,6 +1725,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case H5D_CHUNKED:
fprintf (out, "H5D_CHUNKED");
break;
+ case H5D_NLAYOUTS:
+ fprintf (out, "H5D_NLAYOUTS");
+ break;
default:
fprintf (out, "%ld", (long)layout);
break;
@@ -1741,7 +1743,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5D_space_status_t space_status = va_arg(ap, H5D_space_status_t);
+ H5D_space_status_t space_status = va_arg(ap, H5D_space_status_t); /*lint !e64 Type mismatch not really occuring */
switch (space_status) {
case H5D_SPACE_STATUS_NOT_ALLOCATED:
fprintf (out, "H5D_SPACE_STATUS_NOT_ALLOCATED");
@@ -1752,6 +1754,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case H5D_SPACE_STATUS_ALLOCATED:
fprintf (out, "H5D_SPACE_STATUS_ALLOCATED");
break;
+ case H5D_SPACE_STATUS_ERROR:
+ fprintf (out, "H5D_SPACE_STATUS_ERROR");
+ break;
default:
fprintf (out, "%ld", (long)space_status);
break;
@@ -1767,7 +1772,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5FD_mpio_xfer_t transfer = va_arg(ap, H5FD_mpio_xfer_t);
+ H5FD_mpio_xfer_t transfer = va_arg(ap, H5FD_mpio_xfer_t); /*lint !e64 Type mismatch not really occuring */
switch (transfer) {
case H5FD_MPIO_INDEPENDENT:
fprintf (out, "H5FD_MPIO_INDEPENDENT");
@@ -1812,7 +1817,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5E_direction_t direction = va_arg (ap, H5E_direction_t);
+ H5E_direction_t direction = va_arg (ap, H5E_direction_t); /*lint !e64 Type mismatch not really occuring */
switch (direction) {
case H5E_WALK_UPWARD:
fprintf (out, "H5E_WALK_UPWARD");
@@ -1835,7 +1840,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5E_error_t *error = va_arg (ap, H5E_error_t*);
+ H5E_error_t *error = va_arg (ap, H5E_error_t*); /*lint !e64 Type mismatch not really occuring */
fprintf (out, "0x%lx", (unsigned long)error);
}
break;
@@ -1848,7 +1853,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5E_type_t etype = va_arg (ap, H5E_type_t);
+ H5E_type_t etype = va_arg (ap, H5E_type_t); /*lint !e64 Type mismatch not really occuring */
switch (etype) {
case H5E_MAJOR:
fprintf (out, "H5E_MAJOR");
@@ -1879,7 +1884,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5F_close_degree_t degree = va_arg(ap, H5F_close_degree_t);
+ H5F_close_degree_t degree = va_arg(ap, H5F_close_degree_t); /*lint !e64 Type mismatch not really occuring */
switch (degree) {
case H5F_CLOSE_DEFAULT:
fprintf(out, "H5F_CLOSE_DEFAULT");
@@ -1905,7 +1910,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5F_scope_t scope = va_arg(ap, H5F_scope_t);
+ H5F_scope_t scope = va_arg(ap, H5F_scope_t); /*lint !e64 Type mismatch not really occuring */
switch (scope) {
case H5F_SCOPE_LOCAL:
fprintf(out, "H5F_SCOPE_LOCAL");
@@ -1937,7 +1942,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5G_link_t link_type = va_arg (ap, H5G_link_t);
+ H5G_link_t link_type = va_arg (ap, H5G_link_t); /*lint !e64 Type mismatch not really occuring */
switch (link_type) {
case H5G_LINK_ERROR:
fprintf (out, "H5G_LINK_ERROR");
@@ -1963,7 +1968,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5G_obj_t obj_type = va_arg (ap, H5G_obj_t);
+ H5G_obj_t obj_type = va_arg (ap, H5G_obj_t); /*lint !e64 Type mismatch not really occuring */
switch (obj_type) {
case H5G_UNKNOWN:
fprintf (out, "H5G_UNKNOWN");
@@ -1980,6 +1985,12 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case H5G_TYPE:
fprintf (out, "H5G_TYPE");
break;
+ case H5G_RESERVED_4:
+ case H5G_RESERVED_5:
+ case H5G_RESERVED_6:
+ case H5G_RESERVED_7:
+ fprintf (out, "H5G_RESERVED(%ld)",(long)obj_type);
+ break;
default:
fprintf (out, "%ld", (long)obj_type);
break;
@@ -1995,7 +2006,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5G_stat_t *statbuf = va_arg (ap, H5G_stat_t*);
+ H5G_stat_t *statbuf = va_arg (ap, H5G_stat_t*); /*lint !e64 Type mismatch not really occuring */
fprintf (out, "0x%lx", (unsigned long)statbuf);
}
break;
@@ -2026,7 +2037,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- hsize_t hsize = va_arg (ap, hsize_t);
+ hsize_t hsize = va_arg (ap, hsize_t); /*lint !e732 Loss of sign not really occuring */
if (H5S_UNLIMITED==hsize) {
HDfprintf(out, "H5S_UNLIMITED");
} else {
@@ -2081,12 +2092,18 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf (out, "FAIL");
} else {
switch (H5I_TYPE(obj)) { /* Use internal H5I macro instead of function call */
+ case H5I_UNINIT:
+ fprintf (out, "%ld (uninit - error)", (long)obj);
+ break;
case H5I_BADID:
fprintf (out, "%ld (error)", (long)obj);
break;
case H5I_FILE:
fprintf(out, "%ld (file)", (long)obj);
break;
+ case H5I_FILE_CLOSING:
+ fprintf(out, "%ld (file closing)", (long)obj);
+ break;
case H5I_GROUP:
fprintf(out, "%ld (group)", (long)obj);
break;
@@ -2219,6 +2236,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case H5I_ERROR_STACK:
fprintf(out, "%ld (err stack)", (long)obj);
break;
+ case H5I_NTYPES:
+ fprintf (out, "%ld (ntypes - error)", (long)obj);
+ break;
default:
fprintf(out, "%ld (unknown class)", (long)obj);
break;
@@ -2267,7 +2287,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- unsigned iu = va_arg (ap, unsigned);
+ unsigned iu = va_arg (ap, unsigned); /*lint !e732 Loss of sign not really occuring */
fprintf (out, "%u", iu);
asize[argno] = iu;
}
@@ -2281,14 +2301,20 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5I_type_t id_type = va_arg (ap, H5I_type_t);
+ H5I_type_t id_type = va_arg (ap, H5I_type_t); /*lint !e64 Type mismatch not really occuring */
switch (id_type) {
+ case H5I_UNINIT:
+ fprintf (out, "H5I_UNINIT");
+ break;
case H5I_BADID:
fprintf (out, "H5I_BADID");
break;
case H5I_FILE:
fprintf (out, "H5I_FILE");
break;
+ case H5I_FILE_CLOSING:
+ fprintf (out, "H5I_FILE_CLOSING");
+ break;
case H5I_GROUP:
fprintf (out, "H5I_GROUP");
break;
@@ -2379,7 +2405,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5FD_mem_t mt = va_arg(ap, H5FD_mem_t);
+ H5FD_mem_t mt = va_arg(ap, H5FD_mem_t); /*lint !e64 Type mismatch not really occuring */
switch (mt) {
case H5FD_MEM_NOLIST:
fprintf(out, "H5FD_MEM_NOLIST");
@@ -2405,6 +2431,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case H5FD_MEM_OHDR:
fprintf(out, "H5FD_MEM_OHDR");
break;
+ case H5FD_MEM_NTYPES:
+ fprintf(out, "H5FD_MEM_NTYPES");
+ break;
default:
fprintf(out, "%ld", (long)mt);
break;
@@ -2463,7 +2492,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- hobj_ref_t ref = va_arg (ap, hobj_ref_t);
+ hobj_ref_t ref = va_arg (ap, hobj_ref_t); /*lint !e732 Loss of sign not really occuring */
HDfprintf(out, "Reference Object=%a", ref);
}
break;
@@ -2478,7 +2507,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5R_type_t reftype = va_arg(ap, H5R_type_t);
+ H5R_type_t reftype = va_arg(ap, H5R_type_t); /*lint !e64 Type mismatch not really occuring */
switch (reftype) {
case H5R_BADTYPE:
fprintf(out, "H5R_BADTYPE");
@@ -2518,7 +2547,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5S_class_t cls = va_arg(ap, H5S_class_t);
+ H5S_class_t cls = va_arg(ap, H5S_class_t); /*lint !e64 Type mismatch not really occuring */
switch (cls) {
case H5S_NO_CLASS:
fprintf(out, "H5S_NO_CLASS");
@@ -2529,6 +2558,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case H5S_SIMPLE:
fprintf(out, "H5S_SIMPLE");
break;
+ case H5S_NULL:
+ fprintf(out, "H5S_NULL");
+ break;
case H5S_COMPLEX:
fprintf(out, "H5S_COMPLEX");
break;
@@ -2547,7 +2579,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5S_seloper_t so = va_arg(ap, H5S_seloper_t);
+ H5S_seloper_t so = va_arg(ap, H5S_seloper_t); /*lint !e64 Type mismatch not really occuring */
switch (so) {
case H5S_SELECT_NOOP:
fprintf(out, "H5S_NOOP");
@@ -2558,6 +2590,27 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case H5S_SELECT_OR:
fprintf(out, "H5S_SELECT_OR");
break;
+ case H5S_SELECT_AND:
+ fprintf(out, "H5S_SELECT_AND");
+ break;
+ case H5S_SELECT_XOR:
+ fprintf(out, "H5S_SELECT_XOR");
+ break;
+ case H5S_SELECT_NOTB:
+ fprintf(out, "H5S_SELECT_NOTB");
+ break;
+ case H5S_SELECT_NOTA:
+ fprintf(out, "H5S_SELECT_NOTA");
+ break;
+ case H5S_SELECT_APPEND:
+ fprintf(out, "H5S_SELECT_APPEND");
+ break;
+ case H5S_SELECT_PREPEND:
+ fprintf(out, "H5S_SELECT_PREPEND");
+ break;
+ case H5S_SELECT_INVALID:
+ fprintf(out, "H5S_SELECT_INVALID");
+ break;
default:
fprintf(out, "%ld", (long)so);
break;
@@ -2573,7 +2626,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5S_sel_type st = va_arg(ap, H5S_sel_type);
+ H5S_sel_type st = va_arg(ap, H5S_sel_type); /*lint !e64 Type mismatch not really occuring */
switch (st) {
case H5S_SEL_ERROR:
fprintf(out, "H5S_SEL_ERROR");
@@ -2590,6 +2643,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case H5S_SEL_ALL:
fprintf(out, "H5S_SEL_ALL");
break;
+ case H5S_SEL_N:
+ fprintf(out, "H5S_SEL_N");
+ break;
default:
fprintf(out, "%ld", (long)st);
break;
@@ -2611,7 +2667,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- const char *str = va_arg (ap, const char*);
+ const char *str = va_arg (ap, const char*); /*lint !e64 Type mismatch not really occuring */
fprintf (out, "\"%s\"", str);
}
break;
@@ -2626,7 +2682,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5T_cset_t cset = va_arg (ap, H5T_cset_t);
+ H5T_cset_t cset = va_arg (ap, H5T_cset_t); /*lint !e64 Type mismatch not really occuring */
switch (cset) {
case H5T_CSET_ERROR:
fprintf (out, "H5T_CSET_ERROR");
@@ -2634,6 +2690,23 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case H5T_CSET_ASCII:
fprintf (out, "H5T_CSET_ASCII");
break;
+ case H5T_CSET_RESERVED_1:
+ case H5T_CSET_RESERVED_2:
+ case H5T_CSET_RESERVED_3:
+ case H5T_CSET_RESERVED_4:
+ case H5T_CSET_RESERVED_5:
+ case H5T_CSET_RESERVED_6:
+ case H5T_CSET_RESERVED_7:
+ case H5T_CSET_RESERVED_8:
+ case H5T_CSET_RESERVED_9:
+ case H5T_CSET_RESERVED_10:
+ case H5T_CSET_RESERVED_11:
+ case H5T_CSET_RESERVED_12:
+ case H5T_CSET_RESERVED_13:
+ case H5T_CSET_RESERVED_14:
+ case H5T_CSET_RESERVED_15:
+ fprintf (out, "H5T_CSET_RESERVED(%ld)",(long)cset);
+ break;
default:
fprintf (out, "%ld", (long)cset);
break;
@@ -2649,7 +2722,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5T_direction_t direct = va_arg (ap, H5T_direction_t);
+ H5T_direction_t direct = va_arg (ap, H5T_direction_t); /*lint !e64 Type mismatch not really occuring */
switch (direct) {
case H5T_DIR_DEFAULT:
fprintf (out, "H5T_DIR_DEFAULT");
@@ -2675,7 +2748,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5T_pers_t pers = va_arg(ap, H5T_pers_t);
+ H5T_pers_t pers = va_arg(ap, H5T_pers_t); /*lint !e64 Type mismatch not really occuring */
switch (pers) {
case H5T_PERS_DONTCARE:
fprintf(out, "H5T_PERS_DONTCARE");
@@ -2701,7 +2774,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5T_norm_t norm = va_arg (ap, H5T_norm_t);
+ H5T_norm_t norm = va_arg (ap, H5T_norm_t); /*lint !e64 Type mismatch not really occuring */
switch (norm) {
case H5T_NORM_ERROR:
fprintf (out, "H5T_NORM_ERROR");
@@ -2730,7 +2803,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5T_order_t order = va_arg (ap, H5T_order_t);
+ H5T_order_t order = va_arg (ap, H5T_order_t); /*lint !e64 Type mismatch not really occuring */
switch (order) {
case H5T_ORDER_ERROR:
fprintf (out, "H5T_ORDER_ERROR");
@@ -2762,7 +2835,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5T_pad_t pad = va_arg (ap, H5T_pad_t);
+ H5T_pad_t pad = va_arg (ap, H5T_pad_t); /*lint !e64 Type mismatch not really occuring */
switch (pad) {
case H5T_PAD_ERROR:
fprintf (out, "H5T_PAD_ERROR");
@@ -2776,6 +2849,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case H5T_PAD_BACKGROUND:
fprintf (out, "H5T_PAD_BACKGROUND");
break;
+ case H5T_NPAD:
+ fprintf (out, "H5T_NPAD");
+ break;
default:
fprintf (out, "%ld", (long)pad);
break;
@@ -2791,7 +2867,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5T_sign_t sign = va_arg (ap, H5T_sign_t);
+ H5T_sign_t sign = va_arg (ap, H5T_sign_t); /*lint !e64 Type mismatch not really occuring */
switch (sign) {
case H5T_SGN_ERROR:
fprintf (out, "H5T_SGN_ERROR");
@@ -2802,6 +2878,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case H5T_SGN_2:
fprintf (out, "H5T_SGN_2");
break;
+ case H5T_NSGN:
+ fprintf (out, "H5T_NSGN");
+ break;
default:
fprintf (out, "%ld", (long)sign);
break;
@@ -2817,7 +2896,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5T_class_t type_class = va_arg(ap, H5T_class_t);
+ H5T_class_t type_class = va_arg(ap, H5T_class_t); /*lint !e64 Type mismatch not really occuring */
switch (type_class) {
case H5T_NO_CLASS:
fprintf(out, "H5T_NO_CLASS");
@@ -2843,9 +2922,21 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case H5T_COMPOUND:
fprintf(out, "H5T_COMPOUND");
break;
+ case H5T_REFERENCE:
+ fprintf(out, "H5T_REFERENCE");
+ break;
case H5T_ENUM:
fprintf(out, "H5T_ENUM");
break;
+ case H5T_VLEN:
+ fprintf(out, "H5T_VLEN");
+ break;
+ case H5T_ARRAY:
+ fprintf(out, "H5T_ARRAY");
+ break;
+ case H5T_NCLASSES:
+ fprintf(out, "H5T_NCLASSES");
+ break;
default:
fprintf(out, "%ld", (long)type_class);
break;
@@ -2861,7 +2952,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5T_str_t str = va_arg(ap, H5T_str_t);
+ H5T_str_t str = va_arg(ap, H5T_str_t); /*lint !e64 Type mismatch not really occuring */
switch (str) {
case H5T_STR_ERROR:
fprintf(out, "H5T_STR_ERROR");
@@ -2875,6 +2966,21 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case H5T_STR_SPACEPAD:
fprintf(out, "H5T_STR_SPACEPAD");
break;
+ case H5T_STR_RESERVED_3:
+ case H5T_STR_RESERVED_4:
+ case H5T_STR_RESERVED_5:
+ case H5T_STR_RESERVED_6:
+ case H5T_STR_RESERVED_7:
+ case H5T_STR_RESERVED_8:
+ case H5T_STR_RESERVED_9:
+ case H5T_STR_RESERVED_10:
+ case H5T_STR_RESERVED_11:
+ case H5T_STR_RESERVED_12:
+ case H5T_STR_RESERVED_13:
+ case H5T_STR_RESERVED_14:
+ case H5T_STR_RESERVED_15:
+ fprintf(out, "H5T_STR_RESERVED(%ld)",(long)str);
+ break;
default:
fprintf(out, "%ld", (long)str);
break;
@@ -2924,7 +3030,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- vp = va_arg (ap, void*);
+ vp = va_arg (ap, void*); /*lint !e64 Type mismatch not really occuring */
if (vp) {
fprintf (out, "0x%lx", (unsigned long)vp);
} else {
@@ -2949,7 +3055,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- size_t size = va_arg (ap, size_t);
+ size_t size = va_arg (ap, size_t); /*lint !e732 Loss of sign not really occuring */
HDfprintf (out, "%Zu", size);
asize[argno] = (hssize_t)size;
@@ -2966,7 +3072,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5Z_class_t *filter = va_arg (ap, H5Z_class_t*);
+ H5Z_class_t *filter = va_arg (ap, H5Z_class_t*); /*lint !e64 Type mismatch not really occuring */
fprintf (out, "0x%lx", (unsigned long)filter);
}
break;
@@ -2979,7 +3085,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5Z_EDC_t edc = va_arg (ap, H5Z_EDC_t);
+ H5Z_EDC_t edc = va_arg (ap, H5Z_EDC_t); /*lint !e64 Type mismatch not really occuring */
if (H5Z_DISABLE_EDC==edc) {
fprintf (out, "H5Z_DISABLE_EDC");
diff --git a/src/H5A.c b/src/H5A.c
index 5fdf112..e66428c 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -13,7 +13,6 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#define H5A_PACKAGE /*suppress error about including H5Apkg */
-#define H5S_PACKAGE /*suppress error about including H5Spkg */
/* Interface initialization */
#define H5_INTERFACE_INIT_FUNC H5A_init_interface
@@ -29,7 +28,7 @@
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
-#include "H5Spkg.h" /* Dataspace functions */
+#include "H5Sprivate.h" /* Dataspace functions */
/* PRIVATE PROTOTYPES */
static hid_t H5A_create(const H5G_entry_t *ent, const char *name,
@@ -81,7 +80,7 @@ H5A_init_interface(void)
/*
* Create attribute group.
*/
- if (H5I_register_type(H5I_ATTR, H5I_ATTRID_HASHSIZE, H5A_RESERVED_ATOMS, (H5I_free_t)H5A_close)<0)
+ if (H5I_register_type(H5I_ATTR, H5I_ATTRID_HASHSIZE, H5A_RESERVED_ATOMS, (H5I_free_t)H5A_close)<H5I_FILE)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to initialize interface")
done:
@@ -113,10 +112,10 @@ H5A_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5A_term_interface)
if (H5_interface_initialize_g) {
- if ((n=H5I_nmembers(H5I_ATTR))) {
- H5I_clear_type(H5I_ATTR, FALSE);
+ if ((n=H5I_nmembers(H5I_ATTR))>0) {
+ (void)H5I_clear_type(H5I_ATTR, FALSE);
} else {
- H5I_dec_type_ref(H5I_ATTR);
+ (void)H5I_dec_type_ref(H5I_ATTR);
H5_interface_initialize_g = 0;
n = 1;
}
@@ -161,7 +160,7 @@ H5A_term_interface(void)
*
* Modifications:
* Robb Matzke, 5 Jun 1998
- * The LOC_ID can also be a committed data type.
+ * The LOC_ID can also be a committed datatype.
*
--------------------------------------------------------------------------*/
/* ARGSUSED */
@@ -291,7 +290,7 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type,
else
attr->dt_size=H5O_raw_size(H5O_DTYPE_ID,attr->ent.file,type);
assert(attr->dt_size>0);
- attr->ds_size=H5O_raw_size(H5O_SDSPACE_ID,attr->ent.file,&(space->extent));
+ attr->ds_size=H5S_raw_size(attr->ent.file,space);
assert(attr->ds_size>0);
H5_ASSIGN_OVERFLOW(attr->data_size,H5S_GET_EXTENT_NPOINTS(attr->ds)*H5T_get_size(attr->dt),hssize_t,size_t);
@@ -436,7 +435,7 @@ done:
*
* Modifications:
* Robb Matzke, 5 Jun 1998
- * The LOC_ID can also be a named (committed) data type.
+ * The LOC_ID can also be a named (committed) datatype.
--------------------------------------------------------------------------*/
hid_t
H5Aopen_name(hid_t loc_id, const char *name)
@@ -493,7 +492,7 @@ done:
*
* Modifications:
* Robb Matzke, 5 Jun 1998
- * The LOC_ID can also be a named (committed) data type.
+ * The LOC_ID can also be a named (committed) datatype.
*
--------------------------------------------------------------------------*/
hid_t
@@ -614,7 +613,7 @@ H5Awrite(hid_t attr_id, hid_t type_id, const void *buf)
if (NULL == (attr = H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
if (NULL == (mem_type = H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
if (NULL == buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer")
@@ -648,7 +647,7 @@ done:
static herr_t
H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id)
{
- uint8_t *tconv_buf = NULL; /* data type conv buffer */
+ uint8_t *tconv_buf = NULL; /* datatype conv buffer */
uint8_t *bkg_buf = NULL; /* temp conversion buffer */
hssize_t snelmts; /* elements in attribute */
size_t nelmts; /* elements in attribute */
@@ -679,7 +678,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id)
/* Convert memory buffer into disk buffer */
/* Set up type conversion function */
if (NULL == (tpath = H5T_path_find(mem_type, attr->dt, NULL, NULL, dxpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types")
+ HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes")
/* Check for type conversion required */
if (!H5T_path_noop(tpath)) {
@@ -695,9 +694,9 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id)
/* Copy the user's data into the buffer for conversion */
HDmemcpy(tconv_buf,buf,(src_type_size*nelmts));
- /* Perform data type conversion */
+ /* Perform datatype conversion */
if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, tconv_buf, bkg_buf, dxpl_id)<0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "data type conversion failed")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed")
/* Free the previous attribute data buffer, if there is one */
if(attr->data)
@@ -776,7 +775,7 @@ H5Aread(hid_t attr_id, hid_t type_id, void *buf)
if (NULL == (attr = H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
if (NULL == (mem_type = H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
if (NULL == buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer")
@@ -810,7 +809,7 @@ done:
static herr_t
H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id)
{
- uint8_t *tconv_buf = NULL; /* data type conv buffer*/
+ uint8_t *tconv_buf = NULL; /* datatype conv buffer*/
uint8_t *bkg_buf = NULL; /* background buffer */
hssize_t snelmts; /* elements in attribute */
size_t nelmts; /* elements in attribute*/
@@ -845,7 +844,7 @@ H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id)
/* Convert memory buffer into disk buffer */
/* Set up type conversion function */
if (NULL == (tpath = H5T_path_find(attr->dt, mem_type, NULL, NULL, dxpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types")
+ HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes")
/* Check for type conversion required */
if (!H5T_path_noop(tpath)) {
@@ -861,9 +860,9 @@ H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id)
/* Copy the attribute data into the buffer for conversion */
HDmemcpy(tconv_buf,attr->data,(src_type_size*nelmts));
- /* Perform data type conversion. */
+ /* Perform datatype conversion. */
if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, tconv_buf, bkg_buf, dxpl_id)<0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "data type conversion failed")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed")
/* Copy the converted data into the user's buffer */
HDmemcpy(buf,tconv_buf,(dst_type_size*nelmts));
@@ -958,10 +957,10 @@ done:
*
* Modifications:
* Robb Matzke, 4 Jun 1998
- * The data type is reopened if it's a named type before returning it to
- * the application. The data types returned by this function are always
- * read-only. If an error occurs when atomizing the return data type
- * then the data type is closed.
+ * The datatype is reopened if it's a named type before returning it to
+ * the application. The datatypes returned by this function are always
+ * read-only. If an error occurs when atomizing the return datatype
+ * then the datatype is closed.
--------------------------------------------------------------------------*/
hid_t
H5Aget_type(hid_t attr_id)
@@ -978,7 +977,7 @@ H5Aget_type(hid_t attr_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
/*
- * Copy the attribute's data type. If the type is a named type then
+ * Copy the attribute's datatype. If the type is a named type then
* reopen the type before returning it to the user. Make the type
* read-only.
*/
@@ -989,7 +988,7 @@ H5Aget_type(hid_t attr_id)
if (H5T_set_loc(dst, NULL, H5T_LOC_MEMORY)<0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
if (H5T_lock(dst, FALSE)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient data type")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient datatype")
/* Atomize */
if ((ret_value=H5I_register(H5I_DATATYPE, dst))<0)
@@ -1160,7 +1159,7 @@ H5A_get_storage_size(const H5A_t *attr)
*
* Modifications:
* Robb Matzke, 5 Jun 1998
- * The LOC_ID can also be a named (committed) data type.
+ * The LOC_ID can also be a named (committed) datatype.
--------------------------------------------------------------------------*/
int
H5Aget_num_attrs(hid_t loc_id)
@@ -1183,14 +1182,14 @@ H5Aget_num_attrs(hid_t loc_id)
break;
case H5I_DATATYPE:
if (NULL==(ent=H5T_entof ((H5T_t*)obj)))
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "target data type is not committed")
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "target datatype is not committed")
break;
case H5I_GROUP:
ent = H5G_entof ((H5G_t*)obj);
break;
default:
HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "inappropriate attribute target")
- }
+ } /*lint !e788 All appropriate cases are covered */
/* Look up the attribute for the object */
ret_value=H5O_count(ent, H5O_ATTR_ID, H5AC_ind_dxpl_id);
@@ -1352,7 +1351,7 @@ done:
*
* Modifications:
* Robb Matzke, 5 Jun 1998
- * The LOC_ID can also be a named (committed) data type.
+ * The LOC_ID can also be a named (committed) datatype.
*
* Robb Matzke, 5 Jun 1998
* Like the group iterator, if ATTR_NUM is the null pointer then all
@@ -1433,7 +1432,7 @@ done:
*
* Modifications:
* Robb Matzke, 5 Jun 1998
- * The LOC_ID can also be a named (committed) data type.
+ * The LOC_ID can also be a named (committed) datatype.
*
--------------------------------------------------------------------------*/
herr_t
diff --git a/src/H5AC.c b/src/H5AC.c
index c0c22fc..125aaf0 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -89,7 +89,7 @@ hid_t H5AC_ind_dxpl_id=(-1);
* Private file-scope function declarations:
*/
-static herr_t H5AC_check_if_write_permitted(H5F_t *f,
+static herr_t H5AC_check_if_write_permitted(const H5F_t *f,
hid_t dxpl_id,
hbool_t * write_permitted_ptr);
@@ -340,7 +340,7 @@ H5AC_term_interface(void)
*-------------------------------------------------------------------------
*/
-const char * H5AC_entry_type_names[H5AC_NTYPES] =
+static const char * H5AC_entry_type_names[H5AC_NTYPES] =
{
"B-tree nodes",
"symbol table nodes",
@@ -349,10 +349,9 @@ const char * H5AC_entry_type_names[H5AC_NTYPES] =
"object headers"
};
-int
+herr_t
H5AC_create(const H5F_t *f, int UNUSED size_hint)
{
- H5AC_t * cache_ptr = NULL;
int ret_value = SUCCEED; /* Return value */
#if 1 /* JRM */ /* test code -- remove when done */
H5C_auto_size_ctl_t auto_size_ctl =
@@ -416,47 +415,29 @@ H5AC_create(const H5F_t *f, int UNUSED size_hint)
* in proper size hints.
* -- JRM
*/
- cache_ptr = H5C_create(H5C__DEFAULT_MAX_CACHE_SIZE,
+ f->shared->cache = H5C_create(H5C__DEFAULT_MAX_CACHE_SIZE,
H5C__DEFAULT_MIN_CLEAN_SIZE,
(H5AC_NTYPES - 1),
(const char **)H5AC_entry_type_names,
H5AC_check_if_write_permitted);
- if ( NULL == cache_ptr ) {
+ if ( NULL == f->shared->cache ) {
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- } else {
-
- f->shared->cache = cache_ptr;
-
}
#if 1 /* JRM */ /* test code -- remove when done */
- if ( cache_ptr ) {
+ if ( H5C_set_cache_auto_resize_config(f->shared->cache, &auto_size_ctl)
+ != SUCCEED ) {
- if ( H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl)
- != SUCCEED ) {
-
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, \
- "auto resize config test failed")
- }
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, \
+ "auto resize config test failed")
}
#endif /* JRM */
done:
- if ( ret_value < 0 ) {
-
- if ( cache_ptr != NULL ) {
-
- H5C_dest_empty(cache_ptr);
- f->shared->cache = NULL;
-
- } /* end if */
-
- } /* end if */
-
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_create() */
@@ -791,8 +772,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_rename(H5F_t *f, hid_t UNUSED dxpl_id, const H5AC_class_t *type, haddr_t old_addr,
- haddr_t new_addr)
+H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr)
{
herr_t result;
herr_t ret_value=SUCCEED; /* Return value */
@@ -826,8 +806,7 @@ H5AC_rename(H5F_t *f, hid_t UNUSED dxpl_id, const H5AC_class_t *type, haddr_t ol
#endif /* H5_HAVE_FPHDF5 */
#endif /* H5_HAVE_PARALLEL */
- result = H5C_rename_entry(f,
- f->shared->cache,
+ result = H5C_rename_entry(f->shared->cache,
type,
old_addr,
new_addr);
@@ -994,7 +973,7 @@ H5AC_protect(H5F_t *f,
HGOTO_ERROR(H5E_FPHDF5, H5E_CANTUNLOCK, NULL, \
"can't unlock data on SAP!")
- HGOTO_DONE(NULL);
+ HGOTO_DONE(NULL)
}
info = (H5AC_info_t *)thing;
@@ -1018,7 +997,7 @@ H5AC_protect(H5F_t *f,
info->aux_next = NULL;
info->aux_prev = NULL;
- HGOTO_DONE(thing);
+ HGOTO_DONE(thing)
}
}
#endif /* H5_HAVE_FPHDF5 */
@@ -1231,7 +1210,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_stats(H5F_t UNUSED *f)
+H5AC_stats(const H5F_t *f)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -1240,7 +1219,7 @@ H5AC_stats(H5F_t UNUSED *f)
HDassert(f);
HDassert(f->shared->cache);
- H5C_stats(f->shared->cache, f->name, FALSE); /* at present, this can't fail */
+ (void)H5C_stats(f->shared->cache, f->name, FALSE); /* at present, this can't fail */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1276,12 +1255,12 @@ done:
#ifdef H5_HAVE_PARALLEL
static herr_t
-H5AC_check_if_write_permitted(H5F_t *f,
+H5AC_check_if_write_permitted(const H5F_t *f,
hid_t dxpl_id,
hbool_t * write_permitted_ptr)
#else /* H5_HAVE_PARALLEL */
static herr_t
-H5AC_check_if_write_permitted(H5F_t UNUSED * f,
+H5AC_check_if_write_permitted(const H5F_t UNUSED * f,
hid_t UNUSED dxpl_id,
hbool_t * write_permitted_ptr)
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 214f38e..8c34d92 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -172,10 +172,10 @@ H5_DLL void *H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type,
H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
void *thing, hbool_t deleted);
H5_DLL herr_t H5AC_flush(H5F_t *f, hid_t dxpl_id, unsigned flags);
-H5_DLL herr_t H5AC_rename(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type,
+H5_DLL herr_t H5AC_rename(H5F_t *f, const H5AC_class_t *type,
haddr_t old_addr, haddr_t new_addr);
H5_DLL herr_t H5AC_dest(H5F_t *f, hid_t dxpl_id);
-H5_DLL herr_t H5AC_stats(H5F_t *f);
+H5_DLL herr_t H5AC_stats(const H5F_t *f);
#endif /* !_H5ACprivate_H */
diff --git a/src/H5B.c b/src/H5B.c
index 0162d7b..4626d0c 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -141,7 +141,7 @@ static herr_t H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt,
haddr_t old_addr, unsigned idx,
void *udata, haddr_t *new_addr/*out*/);
static H5B_t * H5B_copy(const H5B_t *old_bt);
-static herr_t H5B_serialize(H5F_t *f, H5B_t *bt);
+static herr_t H5B_serialize(const H5F_t *f, const H5B_t *bt);
#ifdef H5B_DEBUG
static herr_t H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type,
void *udata);
@@ -152,7 +152,7 @@ static H5B_t *H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type,
static herr_t H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *b);
static herr_t H5B_dest(H5F_t *f, H5B_t *b);
static herr_t H5B_clear(H5F_t *f, H5B_t *b, hbool_t destroy);
-static herr_t H5B_compute_size(H5F_t *f, H5B_t *bt, size_t *size_ptr);
+static herr_t H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr);
/* H5B inherits cache-like properties from H5AC */
static const H5AC_class_t H5AC_BT[1] = {{
@@ -324,7 +324,7 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
p += 4;
/* node type and level */
- if (*p++ != type->id)
+ if (*p++ != (uint8_t)type->id)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "incorrect B-tree node type")
bt->level = *p++;
@@ -383,7 +383,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B_serialize(H5F_t *f, H5B_t *bt)
+H5B_serialize(const H5F_t *f, const H5B_t *bt)
{
H5B_shared_t *shared=NULL; /* Pointer to shared B-tree info */
unsigned u;
@@ -407,7 +407,7 @@ H5B_serialize(H5F_t *f, H5B_t *bt)
p += 4;
/* node type and level */
- *p++ = shared->type->id;
+ *p++ = (uint8_t)shared->type->id;
H5_CHECK_OVERFLOW(bt->level, unsigned, uint8_t);
*p++ = (uint8_t)bt->level;
@@ -601,7 +601,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B_compute_size(H5F_t *f, H5B_t *bt, size_t *size_ptr)
+H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr)
{
H5B_shared_t *shared; /* Pointer to shared B-tree info */
size_t size;
@@ -618,23 +618,15 @@ H5B_compute_size(H5F_t *f, H5B_t *bt, size_t *size_ptr)
HDassert(shared->type);
HDassert(size_ptr);
- size = H5B_nodesize(f, shared, NULL);
+ /* Check node's size */
+ if ((size = H5B_nodesize(f, shared, NULL)) == 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, FAIL, "H5B_nodesize() failed")
- if ( size == 0 ) {
-
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, FAIL, \
- "H5B_nodesize() failed");
-
- } else {
-
- *size_ptr = size;
-
- }
+ /* Set size value */
+ *size_ptr = size;
done:
-
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5B_H5B_compute_size() */
@@ -733,7 +725,7 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u
HGOTO_DONE(FAIL)
#endif /* OLD_WAY */
} else {
- if ((type->found) (f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), udata, H5B_NKEY(bt,shared,idx+1)) < 0)
+ if ((type->found) (f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), udata) < 0)
/* Note: don't push error on stack, leave that to next higher level,
* since many times the B-tree is searched in order to determine
* if an object exists in the B-tree or not. -QAK
@@ -811,7 +803,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, haddr_t old_addr,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
/* Get B-tree split ratios */
- if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &split_ratios)<0)
+ if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &split_ratios[0])<0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve B-tree split ratios")
#ifdef H5B_DEBUG
@@ -971,9 +963,8 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
assert(type->sizeof_nkey <= sizeof _lt_key);
assert(H5F_addr_defined(addr));
- if ((my_ins = H5B_insert_helper(f, dxpl_id, addr, type, lt_key,
- &lt_key_changed, md_key, udata, rt_key, &rt_key_changed, &child/*out*/))<0 ||
- my_ins<0)
+ if ((int)(my_ins = H5B_insert_helper(f, dxpl_id, addr, type, lt_key,
+ &lt_key_changed, md_key, udata, rt_key, &rt_key_changed, &child/*out*/))<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to insert key")
if (H5B_INS_NOOP == my_ins)
HGOTO_DONE(SUCCEED)
@@ -1056,7 +1047,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
bt=NULL; /* Make certain future references will be caught */
/* Move the location of the old root on the disk */
- if (H5AC_rename(f, dxpl_id, H5AC_BT, addr, old_root) < 0)
+ if (H5AC_rename(f, H5AC_BT, addr, old_root) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node")
/* clear the old root info at the old address (we already copied it) */
@@ -1278,7 +1269,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
idx = 0;
if (type->follow_min) {
- if ((my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx),
+ if ((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx),
lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1),
rt_key_changed, &child_addr/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "unable to insert first leaf node")
@@ -1291,7 +1282,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* The value being inserted is less than any value in this tree.
* Follow the minimum branch out of this node to a subtree.
*/
- if ((my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type,
+ if ((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type,
H5B_NKEY(bt,shared,idx), lt_key_changed, md_key,
udata, H5B_NKEY(bt,shared,idx+1), rt_key_changed,
&child_addr/*out*/))<0)
@@ -1302,7 +1293,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* current node. Follow the minimum branch to a leaf node and let the
* subclass handle the problem.
*/
- if ((my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx),
+ if ((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx),
lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1),
rt_key_changed, &child_addr/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node")
@@ -1325,7 +1316,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* Follow the maximum branch out of this node to a subtree.
*/
idx = bt->nchildren - 1;
- if ((my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type,
+ if ((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type,
H5B_NKEY(bt,shared,idx), lt_key_changed, md_key, udata,
H5B_NKEY(bt,shared,idx+1), rt_key_changed, &child_addr/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum subtree")
@@ -1336,7 +1327,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* subclass handle the problem.
*/
idx = bt->nchildren - 1;
- if ((my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx),
+ if ((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx),
lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1),
rt_key_changed, &child_addr/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node")
@@ -1368,7 +1359,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* Follow a branch out of this node to another subtree.
*/
assert(idx < bt->nchildren);
- if ((my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type,
+ if ((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type,
H5B_NKEY(bt,shared,idx), lt_key_changed, md_key, udata,
H5B_NKEY(bt,shared,idx+1), rt_key_changed, &child_addr/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert subtree")
@@ -1377,12 +1368,12 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* Follow a branch out of this node to a leaf node of some other type.
*/
assert(idx < bt->nchildren);
- if ((my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx),
+ if ((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx),
lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1),
rt_key_changed, &child_addr/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert leaf node")
}
- assert(my_ins >= 0);
+ assert((int)my_ins >= 0);
/*
* Update the left and right keys of the current node.
@@ -1619,10 +1610,9 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
{
H5B_t *bt = NULL, *sibling = NULL;
H5B_shared_t *shared; /* Pointer to shared B-tree info */
- H5B_ins_t ret_value = H5B_INS_ERROR;
unsigned idx=0, lt=0, rt; /* Final, left & right indices */
int cmp=1; /* Key comparison value */
- size_t sizeof_rec;
+ H5B_ins_t ret_value = H5B_INS_ERROR;
FUNC_ENTER_NOAPI(H5B_remove_helper, H5B_INS_ERROR)
@@ -1631,7 +1621,6 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
assert(type);
assert(type->decode);
assert(type->cmp3);
- assert(type->found);
assert(lt_key && lt_key_changed);
assert(udata);
assert(rt_key && rt_key_changed);
@@ -1665,7 +1654,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
assert(idx<bt->nchildren);
if (bt->level>0) {
/* We're at an internal node -- call recursively */
- if ((ret_value=H5B_remove_helper(f, dxpl_id,
+ if ((int)(ret_value=H5B_remove_helper(f, dxpl_id,
bt->child[idx], type, level+1, H5B_NKEY(bt,shared,idx)/*out*/,
lt_key_changed/*out*/, udata, H5B_NKEY(bt,shared,idx+1)/*out*/,
rt_key_changed/*out*/))<0)
@@ -1676,7 +1665,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* has a removal method. Pass the removal request to the pointed-to
* object and let it decide how to progress.
*/
- if ((ret_value=(type->remove)(f, dxpl_id,
+ if ((int)(ret_value=(type->remove)(f, dxpl_id,
bt->child[idx], H5B_NKEY(bt,shared,idx), lt_key_changed, udata,
H5B_NKEY(bt,shared,idx+1), rt_key_changed))<0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in leaf node")
@@ -1742,7 +1731,6 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* If the subtree returned H5B_INS_REMOVE then we should remove the
* subtree entry from the current node. There are four cases:
*/
- sizeof_rec = shared->sizeof_rkey + H5F_SIZEOF_ADDR(f);
if (H5B_INS_REMOVE==ret_value && 1==bt->nchildren) {
/*
* The subtree is the only child of this node. Discard both
@@ -1997,7 +1985,7 @@ H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void
/* Call user's callback for each entry */
if ((type->remove)(f, dxpl_id,
bt->child[u], H5B_NKEY(bt,shared,u), &lt_key_changed, udata,
- H5B_NKEY(bt,shared,u+1), &rt_key_changed)<0)
+ H5B_NKEY(bt,shared,u+1), &rt_key_changed)<H5B_INS_NOOP)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't remove B-tree node")
} /* end for */
} /* end if */
diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h
index 87e57f3..b4b1a97 100644
--- a/src/H5Bprivate.h
+++ b/src/H5Bprivate.h
@@ -67,8 +67,8 @@ typedef enum H5B_ins_t {
#define H5B_ITER_STOP (1)
/* Define the operator callback function pointer for H5B_iterate() */
-typedef int (*H5B_operator_t)(H5F_t *f, hid_t, void *_lt_key, haddr_t addr,
- void *_rt_key, void *_udata);
+typedef int (*H5B_operator_t)(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
+ const void *_rt_key, void *_udata);
/* Typedef for B-tree in memory (defined in H5Bpkg.h) */
typedef struct H5B_t H5B_t;
@@ -98,11 +98,11 @@ typedef struct H5B_class_t {
H5B_subid_t id; /*id as found in file*/
size_t sizeof_nkey; /*size of native (memory) key*/
size_t (*get_sizeof_rkey)(const H5F_t*, const void*); /*raw key size */
- H5RC_t * (*get_shared)(H5F_t*, const void*); /*shared info for node */
+ H5RC_t * (*get_shared)(const H5F_t*, const void*); /*shared info for node */
herr_t (*new_node)(H5F_t*, hid_t, H5B_ins_t, void*, void*, void*, haddr_t*);
int (*cmp2)(H5F_t*, hid_t, void*, void*, void*); /*compare 2 keys */
int (*cmp3)(H5F_t*, hid_t, void*, void*, void*); /*compare 3 keys */
- herr_t (*found)(H5F_t*, hid_t, haddr_t, const void*, void*, const void*);
+ herr_t (*found)(H5F_t*, hid_t, haddr_t, const void*, void*);
/* insert new data */
H5B_ins_t (*insert)(H5F_t*, hid_t, haddr_t, void*, hbool_t*, void*, void*,
@@ -117,8 +117,8 @@ typedef struct H5B_class_t {
hbool_t*);
/* encode, decode, debug key values */
- herr_t (*decode)(H5F_t*, struct H5B_t*, uint8_t*, void*);
- herr_t (*encode)(H5F_t*, struct H5B_t*, uint8_t*, void*);
+ herr_t (*decode)(const H5F_t*, const struct H5B_t*, const uint8_t*, void*);
+ herr_t (*encode)(const H5F_t*, const struct H5B_t*, uint8_t*, void*);
herr_t (*debug_key)(FILE*, H5F_t*, hid_t, int, int, const void*, const void*);
} H5B_class_t;
diff --git a/src/H5C.c b/src/H5C.c
index 2b60248..575a6dd 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -1706,7 +1706,7 @@ static herr_t H5C_epoch_marker_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
haddr_t addr, void *thing);
static herr_t H5C_epoch_marker_dest(H5F_t *f, void *thing);
static herr_t H5C_epoch_marker_clear(H5F_t *f, void *thing, hbool_t dest);
-static herr_t H5C_epoch_marker_size(H5F_t *f, void *thing, size_t *size_ptr);
+static herr_t H5C_epoch_marker_size(const H5F_t *f, const void *thing, size_t *size_ptr);
const H5C_class_t epoch_marker_class =
{
@@ -1795,8 +1795,8 @@ done:
}
static herr_t
-H5C_epoch_marker_size(UNUSED H5F_t *f,
- UNUSED void *thing,
+H5C_epoch_marker_size(UNUSED const H5F_t *f,
+ UNUSED const void *thing,
UNUSED size_t *size_ptr)
{
herr_t ret_value = FAIL; /* Return value */
@@ -2940,8 +2940,7 @@ done:
*/
herr_t
-H5C_rename_entry(H5F_t * f,
- H5C_t * cache_ptr,
+H5C_rename_entry(H5C_t * cache_ptr,
const H5C_class_t * type,
haddr_t old_addr,
haddr_t new_addr)
@@ -2954,7 +2953,6 @@ H5C_rename_entry(H5F_t * f,
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( cache_ptr->skip_file_checks || f );
HDassert( type );
HDassert( H5F_addr_defined(old_addr) );
HDassert( H5F_addr_defined(new_addr) );
@@ -3546,7 +3544,6 @@ H5C_set_cache_auto_resize_config(H5C_t * cache_ptr,
default: /* should be unreachable */
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown incr_mode?!?!?.")
- break;
}
switch ( config_ptr->decr_mode )
@@ -3588,7 +3585,6 @@ H5C_set_cache_auto_resize_config(H5C_t * cache_ptr,
default: /* should be unreachable */
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown decr_mode?!?!?.")
- break;
}
if ( config_ptr->max_size == config_ptr->min_size ) {
@@ -4352,7 +4348,6 @@ H5C__auto_adjust_cache_size(H5C_t * cache_ptr,
default:
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode.")
- break;
}
/* If the decr_mode is either age out or age out with threshold, we
@@ -4478,7 +4473,6 @@ H5C__auto_adjust_cache_size(H5C_t * cache_ptr,
default:
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode.")
- break;
}
}
diff --git a/src/H5CS.c b/src/H5CS.c
index e0ad30b..6543fc5 100644
--- a/src/H5CS.c
+++ b/src/H5CS.c
@@ -25,13 +25,16 @@
* expected to be a rare condition.
*
*/
+
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5FS_mask
+
#include "H5private.h" /* Generic Functions */
#include "H5FSprivate.h" /* Private function stack routines */
#ifdef H5_HAVE_FUNCSTACK
-#define PABLO_MASK H5FS_mask
-
#ifdef H5_HAVE_THREADSAFE
/*
* The per-thread function stack. pthread_once() initializes a special
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 20d67f2..71cdc90 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -129,8 +129,8 @@ typedef herr_t (*H5C_dest_func_t)(H5F_t *f,
typedef herr_t (*H5C_clear_func_t)(H5F_t *f,
void *thing,
hbool_t dest);
-typedef herr_t (*H5C_size_func_t)(H5F_t *f,
- void *thing,
+typedef herr_t (*H5C_size_func_t)(const H5F_t *f,
+ const void *thing,
size_t *size_ptr);
typedef struct H5C_class_t {
@@ -145,7 +145,7 @@ typedef struct H5C_class_t {
/* Type defintions of call back functions used by the cache as a whole */
-typedef herr_t (*H5C_write_permitted_func_t)(H5F_t *f,
+typedef herr_t (*H5C_write_permitted_func_t)(const H5F_t *f,
hid_t dxpl_id,
hbool_t * write_permitted_ptr);
@@ -703,8 +703,7 @@ H5_DLL herr_t H5C_insert_entry(H5F_t * f,
haddr_t addr,
void * thing);
-H5_DLL herr_t H5C_rename_entry(H5F_t * f,
- H5C_t * cache_ptr,
+H5_DLL herr_t H5C_rename_entry(H5C_t * cache_ptr,
const H5C_class_t * type,
haddr_t old_addr,
haddr_t new_addr);
diff --git a/src/H5D.c b/src/H5D.c
index 149c021..a18c805 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -45,7 +45,7 @@ static hsize_t H5D_get_storage_size(H5D_t *dset, hid_t dxpl_id);
static haddr_t H5D_get_offset(const H5D_t *dset);
static herr_t H5D_extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id);
static herr_t H5D_set_extent(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id);
-static herr_t H5D_init_type(H5F_t *file, H5D_t *dset, hid_t type_id, const H5T_t *type);
+static herr_t H5D_init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type);
static int H5D_crt_fill_value_cmp(const void *value1, const void *value2, size_t size);
static int H5D_crt_ext_file_list_cmp(const void *value1, const void *value2, size_t size);
static int H5D_crt_data_pipeline_cmp(const void *value1, const void *value2, size_t size);
@@ -201,7 +201,7 @@ H5D_init_interface(void)
FUNC_ENTER_NOAPI_NOINIT(H5D_init_interface)
/* Initialize the atom group for the dataset IDs */
- if (H5I_register_type(H5I_DATASET, H5I_DATASETID_HASHSIZE, H5D_RESERVED_ATOMS, (H5I_free_t)H5D_close)<0)
+ if (H5I_register_type(H5I_DATASET, H5I_DATASETID_HASHSIZE, H5D_RESERVED_ATOMS, (H5I_free_t)H5D_close)<H5I_FILE)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* =========Dataset Transfer Property Class Initialization========= */
@@ -420,7 +420,7 @@ H5D_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_term_interface)
if (H5_interface_initialize_g) {
- if ((n=H5I_nmembers(H5I_DATASET))) {
+ if ((n=H5I_nmembers(H5I_DATASET))>0) {
/* The dataset API uses the "force" flag set to true because it
* is using the "file objects" (H5FO) API functions to track open
* objects in the file. Using the H5FO code means that dataset
@@ -471,6 +471,7 @@ H5D_term_interface(void)
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static herr_t
H5D_xfer_xform_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED size, void *value)
{
@@ -479,9 +480,6 @@ H5D_xfer_xform_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED
FUNC_ENTER_NOAPI(H5D_xfer_xform_del, FAIL)
assert(value);
-#ifdef H5Z_XFORM_DEBUG
- fprintf(stderr, "Freeing memory b/c of delete\n");
-#endif
if(H5Z_xform_destroy(*(H5Z_data_xform_t **)value)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing the parse tree")
@@ -510,6 +508,7 @@ done:
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static herr_t
H5D_xfer_xform_copy(const char UNUSED *name, size_t UNUSED size, void *value)
{
@@ -543,6 +542,7 @@ done:
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static herr_t
H5D_xfer_xform_close(const char UNUSED *name, size_t UNUSED size, void *value)
{
@@ -551,9 +551,6 @@ H5D_xfer_xform_close(const char UNUSED *name, size_t UNUSED size, void *value)
FUNC_ENTER_NOAPI(H5D_xfer_xform_close, FAIL)
assert(value);
-#ifdef H5Z_XFORM_DEBUG
- fprintf(stderr, "Freeing memory b/c of close\n");
-#endif
if(H5Z_xform_destroy(*(H5Z_data_xform_t **)value)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing the parse tree")
@@ -1748,7 +1745,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_init_type(H5F_t *file, H5D_t *dset, hid_t type_id, const H5T_t *type)
+H5D_init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
{
htri_t relocatable; /* Flag whether the type is relocatable */
htri_t immutable; /* Flag whether the type is immutable */
@@ -2359,7 +2356,7 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space
default:
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet")
- } /* end switch */
+ } /* end switch */ /*lint !e788 All appropriate cases are covered */
/* Update the dataset's entry info. */
if (H5D_update_entry_info(file, dxpl_id, new_dset, dc_plist) != SUCCEED)
@@ -2492,7 +2489,7 @@ done:
*-------------------------------------------------------------------------
*/
H5D_t*
-H5D_open(H5G_entry_t *ent, hid_t dxpl_id)
+H5D_open(const H5G_entry_t *ent, hid_t dxpl_id)
{
H5D_shared_t *shared_fo=NULL;
H5D_t *dataset=NULL;
@@ -2534,16 +2531,15 @@ H5D_open(H5G_entry_t *ent, hid_t dxpl_id)
ret_value = dataset;
done:
- if(ret_value==NULL) {
+ if(ret_value==NULL) {
if(dataset) {
- if(shared_fo==NULL) { /* Need to free shared fo */
+ if(shared_fo==NULL) /* Need to free shared fo */
H5FL_FREE(H5D_shared_t, dataset->shared);
- }
H5FL_FREE(H5D_t, dataset);
}
if(shared_fo)
shared_fo->fo_count--;
- }
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
}
@@ -2693,7 +2689,7 @@ H5D_open_oid(const H5G_entry_t *ent, hid_t dxpl_id)
default:
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet")
- } /* end switch */
+ } /* end switch */ /*lint !e788 All appropriate cases are covered */
/* Point at dataset's copy, to cache it for later */
fill_prop=&dataset->shared->fill;
@@ -2725,7 +2721,7 @@ H5D_open_oid(const H5G_entry_t *ent, hid_t dxpl_id)
default:
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet")
- } /* end switch */
+ } /* end switch */ /*lint !e788 All appropriate cases are covered */
/* Set the default fill time */
fill.fill_time=H5D_CRT_FILL_TIME_DEF;
@@ -2900,7 +2896,7 @@ H5D_close(H5D_t *dataset)
#ifdef NDEBUG
HGOTO_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
#endif /* NDEBUG */
- } /* end switch */
+ } /* end switch */ /*lint !e788 All appropriate cases are covered */
/*
* Release datatype, dataspace and creation property list -- there isn't
@@ -3224,7 +3220,7 @@ H5D_alloc_storage (H5F_t *f, hid_t dxpl_id, H5D_t *dset/*in,out*/, H5D_time_allo
#ifdef NDEBUG
HGOTO_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
#endif /* NDEBUG */
- } /* end switch */
+ } /* end switch */ /*lint !e788 All appropriate cases are covered */
/* Check if we need to initialize the space */
if(init_space) {
@@ -3349,7 +3345,7 @@ H5D_init_storage(H5D_t *dset, hbool_t full_overwrite, hid_t dxpl_id)
#ifdef NDEBUG
HGOTO_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
#endif /* NDEBUG */
- } /* end switch */
+ } /* end switch */ /*lint !e788 All appropriate cases are covered */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3443,7 +3439,7 @@ H5D_get_storage_size(H5D_t *dset, hid_t dxpl_id)
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataset type")
- }
+ } /*lint !e788 All appropriate cases are covered */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3539,7 +3535,7 @@ H5D_get_offset(const H5D_t *dset)
#ifdef NDEBUG
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "unknown dataset layout type")
#endif /* NDEBUG */
- }
+ } /*lint !e788 All appropriate cases are covered */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3574,14 +3570,14 @@ done:
* Operation information:
* H5D_operator_t is defined as:
* typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id,
- * hsize_t ndim, hssize_t *point, void *operator_data);
+ * unsigned ndim, const hsize_t *point, void *operator_data);
*
* H5D_operator_t parameters:
* void *elem; IN/OUT: Pointer to the element in memory containing
* the current point.
* hid_t type_id; IN: Datatype ID for the elements stored in ELEM.
- * hsize_t ndim; IN: Number of dimensions for POINT array
- * hssize_t *point; IN: Array containing the location of the element
+ * unsigned ndim; IN: Number of dimensions for POINT array
+ * const hsize_t *point; IN: Array containing the location of the element
* within the original dataspace.
* void *operator_data; IN/OUT: Pointer to any user-defined data
* associated with the operation.
@@ -3753,7 +3749,7 @@ done:
*/
/* ARGSUSED */
static herr_t
-H5D_vlen_get_buf_size(void UNUSED *elem, hid_t type_id, hsize_t UNUSED ndim, hssize_t *point, void *op_data)
+H5D_vlen_get_buf_size(void UNUSED *elem, hid_t type_id, unsigned UNUSED ndim, const hsize_t *point, void *op_data)
{
H5D_vlen_bufsize_t *vlen_bufsize=(H5D_vlen_bufsize_t *)op_data;
H5T_t *dt = NULL;
@@ -3773,7 +3769,7 @@ H5D_vlen_get_buf_size(void UNUSED *elem, hid_t type_id, hsize_t UNUSED ndim, hss
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't resize tbuf")
/* Select point to read in */
- if (H5Sselect_elements(vlen_bufsize->fspace_id,H5S_SELECT_SET,1,(const hssize_t **)point)<0)
+ if (H5Sselect_elements(vlen_bufsize->fspace_id,H5S_SELECT_SET,1,(const hsize_t **)point)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't select point")
/* Read in the point (with the custom VL memory allocator) */
@@ -4075,7 +4071,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D_flush(H5F_t *f, hid_t dxpl_id, unsigned flags)
+H5D_flush(const H5F_t *f, hid_t dxpl_id, unsigned flags)
{
int num_dsets; /* Number of datasets in file */
hid_t *id_list=NULL; /* list of dataset IDs */
@@ -4140,7 +4136,7 @@ H5D_flush(H5F_t *f, hid_t dxpl_id, unsigned flags)
#ifdef NDEBUG
HGOTO_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
#endif /* NDEBUG */
- } /* end switch */
+ } /* end switch */ /*lint !e788 All appropriate cases are covered */
}
} /* end if */
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index 658aae0..8a032e3 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -57,23 +57,23 @@
*-------------------------------------------------------------------------
*/
ssize_t
-H5D_compact_readvv(H5D_io_info_t *io_info,
+H5D_compact_readvv(const H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[],
void *buf)
{
ssize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5D_compact_readvv, FAIL);
+ FUNC_ENTER_NOAPI(H5D_compact_readvv, FAIL)
assert(io_info->dset);
/* Use the vectorized memory copy routine to do actual work */
if((ret_value=H5V_memcpyvv(buf,mem_max_nseq,mem_curr_seq,mem_size_arr,mem_offset_arr,io_info->dset->shared->layout.u.compact.buf,dset_max_nseq,dset_curr_seq,dset_size_arr,dset_offset_arr))<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_compact_readvv() */
@@ -101,23 +101,23 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5D_compact_writevv(H5D_io_info_t *io_info,
+H5D_compact_writevv(const H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[],
const void *buf)
{
ssize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5D_compact_writevv, FAIL);
+ FUNC_ENTER_NOAPI(H5D_compact_writevv, FAIL)
assert(io_info->dset);
/* Use the vectorized memory copy routine to do actual work */
if((ret_value=H5V_memcpyvv(io_info->dset->shared->layout.u.compact.buf,dset_max_nseq,dset_curr_seq,dset_size_arr,dset_offset_arr,buf,mem_max_nseq,mem_curr_seq,mem_size_arr,mem_offset_arr))<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed")
io_info->dset->shared->layout.u.compact.dirty = TRUE;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_compact_writevv() */
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 6cb3b39..18c6677 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -73,7 +73,7 @@ H5D_contig_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout /*out */ )
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_contig_create, FAIL);
+ FUNC_ENTER_NOAPI(H5D_contig_create, FAIL)
/* check args */
assert(f);
@@ -81,10 +81,10 @@ H5D_contig_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout /*out */ )
/* Allocate space for the contiguous data */
if (HADDR_UNDEF==(layout->u.contig.addr=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, layout->u.contig.size)))
- HGOTO_ERROR (H5E_IO, H5E_NOSPACE, FAIL, "unable to reserve file space");
+ HGOTO_ERROR (H5E_IO, H5E_NOSPACE, FAIL, "unable to reserve file space")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_contig_create */
@@ -129,7 +129,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id)
int non_zero_fill_f=(-1); /* Indicate that a non-zero fill-value was used */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_contig_fill, FAIL);
+ FUNC_ENTER_NOAPI(H5D_contig_fill, FAIL)
/* Check args */
assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
@@ -143,11 +143,11 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id)
if(IS_H5FD_MPI(dset->ent.file)) {
/* Get the MPI communicator */
if (MPI_COMM_NULL == (mpi_comm=H5F_mpi_get_comm(dset->ent.file)))
- HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator")
/* Get the MPI rank */
if ((mpi_rank=H5F_mpi_get_rank(dset->ent.file))<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank")
/* Set the MPI-capable file driver flag */
using_mpi=1;
@@ -194,7 +194,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id)
if(dset->shared->fill.buf) {
/* Allocate temporary buffer */
if ((buf=H5FL_BLK_MALLOC(non_zero_fill,bufsize))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer");
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer")
H5V_array_fill(buf, dset->shared->fill.buf, elmt_size, ptsperbuf);
@@ -214,7 +214,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id)
else
buf=H5FL_BLK_MALLOC(zero_fill,bufsize);
if(buf==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer");
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer")
/* Indicate that a zero fill buffer was used */
non_zero_fill_f=0;
@@ -234,7 +234,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id)
/* !! Use the internal "independent" DXPL!! -QAK */
if(H5_PAR_META_WRITE==mpi_rank) {
if (H5D_contig_write(dset, dxpl_cache, H5AC_ind_dxpl_id, &store, offset, size, buf)<0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset");
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset")
} /* end if */
/* Indicate that blocks are being written */
@@ -244,7 +244,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id)
#endif /* H5_HAVE_PARALLEL */
H5_CHECK_OVERFLOW(size,size_t,hsize_t);
if (H5D_contig_write(dset, dxpl_cache, dxpl_id, &store, offset, size, buf)<0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset");
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset")
#ifdef H5_HAVE_PARALLEL
} /* end else */
#endif /* H5_HAVE_PARALLEL */
@@ -262,7 +262,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id)
* in, getting bogus data.
*/
if (MPI_SUCCESS != (mpi_code=MPI_Barrier(mpi_comm)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code);
+ HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code)
} /* end if */
#endif /* H5_HAVE_PARALLEL */
@@ -276,7 +276,7 @@ done:
H5FL_BLK_FREE(zero_fill,buf);
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_contig_fill() */
@@ -299,7 +299,7 @@ H5D_contig_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_contig_delete, FAIL);
+ FUNC_ENTER_NOAPI(H5D_contig_delete, FAIL)
/* check args */
assert(f);
@@ -307,10 +307,10 @@ H5D_contig_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout)
/* Free the file space for the chunk */
if (H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, layout->u.contig.addr, layout->u.contig.size)<0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free object header");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free object header")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_contig_delete */
@@ -331,13 +331,13 @@ done:
haddr_t
H5D_contig_get_addr(const H5D_t *dset)
{
- FUNC_ENTER_NOAPI_NOFUNC(H5D_contig_get_addr);
+ FUNC_ENTER_NOAPI_NOFUNC(H5D_contig_get_addr)
/* check args */
assert(dset);
assert(dset->shared->layout.type==H5D_CONTIGUOUS);
- FUNC_LEAVE_NOAPI(dset->shared->layout.u.contig.addr);
+ FUNC_LEAVE_NOAPI(dset->shared->layout.u.contig.addr)
} /* end H5D_contig_get_addr */
@@ -372,7 +372,7 @@ H5D_contig_write(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache,
size_t mem_curr_seq=0; /* "Current sequence" in memory */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_contig_write, FAIL);
+ FUNC_ENTER_NOAPI(H5D_contig_write, FAIL)
assert (dset);
assert (dxpl_cache);
@@ -382,10 +382,10 @@ H5D_contig_write(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache,
H5D_BUILD_IO_INFO(&io_info,dset,dxpl_cache,dxpl_id,store);
if (H5D_contig_writevv(&io_info,
1, &dset_curr_seq, &dset_len, &dset_off, 1, &mem_curr_seq, &mem_len, &mem_off, buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vector write failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vector write failed")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_contig_write() */
@@ -410,7 +410,7 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5D_contig_readvv(H5D_io_info_t *io_info,
+H5D_contig_readvv(const H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
void *_buf)
@@ -420,12 +420,13 @@ H5D_contig_readvv(H5D_io_info_t *io_info,
const H5D_contig_storage_t *store_contig=&(io_info->store->contig); /* Contiguous storage info for this I/O operation */
unsigned char *buf=(unsigned char *)_buf; /* Pointer to buffer to fill */
haddr_t addr; /* Actual address to read */
+ size_t total_size=0; /* Total size of sequence in bytes */
size_t size; /* Size of sequence in bytes */
size_t u; /* Counting variable */
size_t v; /* Counting variable */
- ssize_t ret_value=0; /* Return value */
+ ssize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5D_contig_readvv, FAIL);
+ FUNC_ENTER_NOAPI(H5D_contig_readvv, FAIL)
/* Check args */
assert(io_info);
@@ -452,7 +453,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info,
sieve_size=dset_contig->sieve_size;
sieve_end=sieve_start+sieve_size;
} /* end if */
-
+
/* Works through sequences as fast as possible */
for(; u<dset_max_nseq && v<mem_max_nseq; ) {
/* Choose smallest buffer to write */
@@ -472,19 +473,19 @@ H5D_contig_readvv(H5D_io_info_t *io_info,
/* Check if we can actually hold the I/O request in the sieve buffer */
if(size>dset_contig->sieve_buf_size) {
if (H5F_block_read(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed");
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed")
} /* end if */
else {
/* Allocate room for the data sieve buffer */
if (NULL==(dset_contig->sieve_buf=H5FL_BLK_MALLOC(sieve_buf,dset_contig->sieve_buf_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Determine the new sieve buffer size & location */
dset_contig->sieve_loc=addr;
/* Make certain we don't read off the end of the file */
if (HADDR_UNDEF==(abs_eoa=H5F_get_eoa(file)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size")
/* Adjust absolute EOA address to relative EOA address */
rel_eoa=abs_eoa-H5F_get_base_addr(file);
@@ -497,7 +498,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info,
/* Read the new sieve buffer */
if (H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed");
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed")
/* Grab the data out of the buffer (must be first piece of data in buffer ) */
HDmemcpy(buf,dset_contig->sieve_buf,size);
@@ -533,7 +534,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info,
if(dset_contig->sieve_dirty) {
/* Write to file */
if (H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
/* Reset sieve buffer dirty flag */
dset_contig->sieve_dirty=0;
@@ -542,7 +543,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info,
/* Read directly into the user's buffer */
if (H5F_block_read(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed");
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed")
} /* end if */
/* Element size fits within the buffer size */
else {
@@ -550,7 +551,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info,
if(dset_contig->sieve_dirty) {
/* Write to file */
if (H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
/* Reset sieve buffer dirty flag */
dset_contig->sieve_dirty=0;
@@ -561,7 +562,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info,
/* Make certain we don't read off the end of the file */
if (HADDR_UNDEF==(abs_eoa=H5F_get_eoa(file)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size")
/* Adjust absolute EOA address to relative EOA address */
rel_eoa=abs_eoa-H5F_get_base_addr(file);
@@ -580,7 +581,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info,
/* Read the new sieve buffer */
if (H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed");
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed")
/* Grab the data out of the buffer (must be first piece of data in buffer ) */
HDmemcpy(buf,dset_contig->sieve_buf,size);
@@ -604,7 +605,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info,
u++;
/* Increment number of bytes copied */
- ret_value+=size;
+ total_size+=size;
} /* end for */
} /* end if */
else {
@@ -624,7 +625,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info,
/* Write data */
if (H5F_block_read(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
/* Update memory information */
mem_len_arr[v]-=size;
@@ -639,7 +640,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info,
u++;
/* Increment number of bytes copied */
- ret_value+=size;
+ total_size+=size;
} /* end for */
} /* end else */
@@ -647,8 +648,11 @@ H5D_contig_readvv(H5D_io_info_t *io_info,
*dset_curr_seq=u;
*mem_curr_seq=v;
+ /* Set return value */
+ H5_ASSIGN_OVERFLOW(ret_value,total_size,size_t,ssize_t);
+
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_contig_readvv() */
@@ -673,7 +677,7 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5D_contig_writevv(H5D_io_info_t *io_info,
+H5D_contig_writevv(const H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
const void *_buf)
@@ -683,12 +687,13 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
const H5D_contig_storage_t *store_contig=&(io_info->store->contig); /* Contiguous storage info for this I/O operation */
const unsigned char *buf=_buf; /* Pointer to buffer to fill */
haddr_t addr; /* Actual address to read */
+ size_t total_size=0; /* Size of sequence in bytes */
size_t size; /* Size of sequence in bytes */
size_t u; /* Counting variable */
size_t v; /* Counting variable */
- ssize_t ret_value=0; /* Return value */
+ ssize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5D_contig_writevv, FAIL);
+ FUNC_ENTER_NOAPI(H5D_contig_writevv, FAIL)
/* Check args */
assert(io_info);
@@ -735,19 +740,19 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
/* Check if we can actually hold the I/O request in the sieve buffer */
if(size>dset_contig->sieve_buf_size) {
if (H5F_block_write(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
} /* end if */
else {
/* Allocate room for the data sieve buffer */
if (NULL==(dset_contig->sieve_buf=H5FL_BLK_MALLOC(sieve_buf,dset_contig->sieve_buf_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Determine the new sieve buffer size & location */
dset_contig->sieve_loc=addr;
/* Make certain we don't read off the end of the file */
if (HADDR_UNDEF==(abs_eoa=H5F_get_eoa(file)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size")
/* Adjust absolute EOA address to relative EOA address */
rel_eoa=abs_eoa-H5F_get_base_addr(file);
@@ -762,7 +767,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
if(dset_contig->sieve_size>size) {
/* Read the new sieve buffer */
if (H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed");
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed")
} /* end if */
/* Grab the data out of the buffer (must be first piece of data in buffer ) */
@@ -790,7 +795,6 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
/* Set sieve buffer dirty flag */
dset_contig->sieve_dirty=1;
-
} /* end if */
/* Entire request is not within this data sieve buffer */
else {
@@ -803,7 +807,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
if(dset_contig->sieve_dirty) {
/* Write to file */
if (H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
/* Reset sieve buffer dirty flag */
dset_contig->sieve_dirty=0;
@@ -816,7 +820,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
/* Write directly from the user's buffer */
if (H5F_block_write(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
} /* end if */
/* Element size fits within the buffer size */
else {
@@ -827,7 +831,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
/* Prepend to existing sieve buffer */
if((addr+size)==sieve_start) {
/* Move existing sieve information to correct location */
- HDmemmove(dset_contig->sieve_buf+size,dset_contig->sieve_buf,sieve_size);
+ HDmemmove(dset_contig->sieve_buf+size,dset_contig->sieve_buf,dset_contig->sieve_size);
/* Copy in new information (must be first in sieve buffer) */
HDmemcpy(dset_contig->sieve_buf,buf,size);
@@ -849,7 +853,6 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
sieve_start=dset_contig->sieve_loc;
sieve_size=dset_contig->sieve_size;
sieve_end=sieve_start+sieve_size;
-
} /* end if */
/* Can't add the new data onto the existing sieve buffer */
else {
@@ -857,7 +860,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
if(dset_contig->sieve_dirty) {
/* Write to file */
if (H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
/* Reset sieve buffer dirty flag */
dset_contig->sieve_dirty=0;
@@ -868,7 +871,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
/* Make certain we don't read off the end of the file */
if (HADDR_UNDEF==(abs_eoa=H5F_get_eoa(file)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size")
/* Adjust absolute EOA address to relative EOA address */
rel_eoa=abs_eoa-H5F_get_base_addr(file);
@@ -889,7 +892,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
if(dset_contig->sieve_size>size) {
/* Read the new sieve buffer */
if (H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed");
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed")
} /* end if */
/* Grab the data out of the buffer (must be first piece of data in buffer ) */
@@ -897,7 +900,6 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
/* Set sieve buffer dirty flag */
dset_contig->sieve_dirty=1;
-
} /* end else */
} /* end else */
} /* end else */
@@ -916,7 +918,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
u++;
/* Increment number of bytes copied */
- ret_value+=size;
+ total_size+=size;
} /* end for */
} /* end if */
else {
@@ -936,7 +938,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
/* Write data */
if (H5F_block_write(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
/* Update memory information */
mem_len_arr[v]-=size;
@@ -951,7 +953,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
u++;
/* Increment number of bytes copied */
- ret_value+=size;
+ total_size+=size;
} /* end for */
} /* end else */
@@ -959,7 +961,10 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
*dset_curr_seq=u;
*mem_curr_seq=v;
+ /* Set return value */
+ H5_ASSIGN_OVERFLOW(ret_value,total_size,size_t,ssize_t);
+
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_contig_writevv() */
diff --git a/src/H5Defl.c b/src/H5Defl.c
index ab3e260..3a7b079 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -67,7 +67,7 @@ H5D_efl_read (const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf)
size_t u; /* Local index variable */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5D_efl_read);
+ FUNC_ENTER_NOAPI_NOINIT(H5D_efl_read)
/* Check args */
assert (efl && efl->nused>0);
@@ -86,14 +86,15 @@ H5D_efl_read (const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf)
/* Read the data */
while (size) {
+ assert(buf);
if (u>=efl->nused)
- HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file");
+ HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file")
if (H5F_OVERFLOW_HSIZET2OFFT (efl->slot[u].offset+skip))
- HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed");
+ HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed")
if ((fd=HDopen (efl->slot[u].name, O_RDONLY, 0))<0)
- HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file");
+ HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file")
if (HDlseek (fd, (off_t)(efl->slot[u].offset+skip), SEEK_SET)<0)
- HGOTO_ERROR (H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file");
+ HGOTO_ERROR (H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file")
#ifndef NDEBUG
tempto_read = MIN(efl->slot[u].size-skip,(hsize_t)size);
H5_CHECK_OVERFLOW(tempto_read,hsize_t,size_t);
@@ -102,7 +103,7 @@ H5D_efl_read (const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf)
to_read = MIN((size_t)(efl->slot[u].size-skip), size);
#endif /* NDEBUG */
if ((n=HDread (fd, buf, to_read))<0) {
- HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL, "read error in external raw data file");
+ HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL, "read error in external raw data file")
} else if ((size_t)n<to_read) {
HDmemset (buf+n, 0, to_read-n);
}
@@ -118,7 +119,7 @@ done:
if (fd>=0)
HDclose (fd);
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -153,7 +154,7 @@ H5D_efl_write (const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *b
size_t u; /* Local index variable */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5D_efl_write);
+ FUNC_ENTER_NOAPI_NOINIT(H5D_efl_write)
/* Check args */
assert (efl && efl->nused>0);
@@ -172,19 +173,20 @@ H5D_efl_write (const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *b
/* Write the data */
while (size) {
+ assert(buf);
if (u>=efl->nused)
- HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file");
+ HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file")
if (H5F_OVERFLOW_HSIZET2OFFT (efl->slot[u].offset+skip))
- HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed");
+ HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed")
if ((fd=HDopen (efl->slot[u].name, O_CREAT|O_RDWR, 0666))<0) {
if (HDaccess (efl->slot[u].name, F_OK)<0) {
- HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist");
+ HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist")
} else {
- HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file");
+ HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file")
}
}
if (HDlseek (fd, (off_t)(efl->slot[u].offset+skip), SEEK_SET)<0)
- HGOTO_ERROR (H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file");
+ HGOTO_ERROR (H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file")
#ifndef NDEBUG
tempto_write = MIN(efl->slot[u].size-skip,(hsize_t)size);
H5_CHECK_OVERFLOW(tempto_write,hsize_t,size_t);
@@ -193,7 +195,7 @@ H5D_efl_write (const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *b
to_write = MIN((size_t)(efl->slot[u].size-skip), size);
#endif /* NDEBUG */
if ((size_t)HDwrite (fd, buf, to_write)!=to_write)
- HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file");
+ HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file")
HDclose (fd);
fd = -1;
size -= to_write;
@@ -206,7 +208,7 @@ done:
if (fd>=0)
HDclose (fd);
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -228,7 +230,7 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5D_efl_readvv(H5D_io_info_t *io_info,
+H5D_efl_readvv(const H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
void *_buf)
@@ -236,12 +238,13 @@ H5D_efl_readvv(H5D_io_info_t *io_info,
const H5O_efl_t *efl=&(io_info->store->efl); /* Pointer to efl info */
unsigned char *buf; /* Pointer to buffer to write */
haddr_t addr; /* Actual address to read */
+ size_t total_size=0; /* Total size of sequence in bytes */
size_t size; /* Size of sequence in bytes */
size_t u; /* Counting variable */
size_t v; /* Counting variable */
- ssize_t ret_value=0; /* Return value */
+ ssize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5D_efl_readvv, FAIL);
+ FUNC_ENTER_NOAPI(H5D_efl_readvv, FAIL)
/* Check args */
assert (efl && efl->nused>0);
@@ -263,7 +266,7 @@ H5D_efl_readvv(H5D_io_info_t *io_info,
/* Read data */
if (H5D_efl_read(efl, addr, size, buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
/* Update memory information */
mem_len_arr[v]-=size;
@@ -278,15 +281,18 @@ H5D_efl_readvv(H5D_io_info_t *io_info,
u++;
/* Increment number of bytes copied */
- ret_value+=size;
+ total_size+=size;
} /* end for */
/* Update current sequence vectors */
*dset_curr_seq=u;
*mem_curr_seq=v;
+ /* Set return value */
+ H5_ASSIGN_OVERFLOW(ret_value,total_size,size_t,ssize_t);
+
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_efl_readvv() */
@@ -308,7 +314,7 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5D_efl_writevv(H5D_io_info_t *io_info,
+H5D_efl_writevv(const H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
const void *_buf)
@@ -316,12 +322,13 @@ H5D_efl_writevv(H5D_io_info_t *io_info,
const H5O_efl_t *efl=&(io_info->store->efl); /* Pointer to efl info */
const unsigned char *buf; /* Pointer to buffer to write */
haddr_t addr; /* Actual address to read */
+ size_t total_size=0; /* Total size of sequence in bytes */
size_t size; /* Size of sequence in bytes */
size_t u; /* Counting variable */
size_t v; /* Counting variable */
- ssize_t ret_value=0; /* Return value */
+ ssize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5D_efl_writevv, FAIL);
+ FUNC_ENTER_NOAPI(H5D_efl_writevv, FAIL)
/* Check args */
assert (efl && efl->nused>0);
@@ -343,7 +350,7 @@ H5D_efl_writevv(H5D_io_info_t *io_info,
/* Write data */
if (H5D_efl_write(efl, addr, size, buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
/* Update memory information */
mem_len_arr[v]-=size;
@@ -358,14 +365,17 @@ H5D_efl_writevv(H5D_io_info_t *io_info,
u++;
/* Increment number of bytes copied */
- ret_value+=size;
+ total_size+=size;
} /* end for */
/* Update current sequence vectors */
*dset_curr_seq=u;
*mem_curr_seq=v;
+ /* Set return value */
+ H5_ASSIGN_OVERFLOW(ret_value,total_size,size_t,ssize_t);
+
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_efl_writevv() */
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 1a1802e..7e8e1a0 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -44,7 +44,7 @@ typedef struct H5D_chunk_info_t {
hsize_t index; /* "Index" of chunk in dataset (must be first for TBBT routines) */
size_t chunk_points; /* Number of elements selected in chunk */
H5S_t *fspace; /* Dataspace describing chunk & selection in it */
- hssize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of chunk in file dataset's dataspace */
+ hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of chunk in file dataset's dataspace */
H5S_t *mspace; /* Dataspace describing selection in memory corresponding to this chunk */
unsigned mspace_shared; /* Indicate that the memory space for a chunk is shared and shouldn't be freed */
} H5D_chunk_info_t;
@@ -117,16 +117,16 @@ H5D_ioinfo_init(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
unsigned flags, hbool_t *use_par_opt_io, H5D_io_info_t *io_info);
/* Chunk operations */
-static herr_t H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type,
+static herr_t H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type,
const H5S_t *file_space, const H5S_t *mem_space, fm_map *fm);
static herr_t H5D_destroy_chunk_map(const fm_map *fm);
static void H5D_free_chunk_info(void *chunk_info);
-static herr_t H5D_create_chunk_file_map_hyper(fm_map *fm);
+static herr_t H5D_create_chunk_file_map_hyper(const fm_map *fm);
static herr_t H5D_create_chunk_mem_map_hyper(const fm_map *fm);
-static herr_t H5D_chunk_file_cb(void *elem, hid_t type_id, hsize_t ndims,
- hssize_t *coords, void *fm);
-static herr_t H5D_chunk_mem_cb(void *elem, hid_t type_id, hsize_t ndims,
- hssize_t *coords, void *fm);
+static herr_t H5D_chunk_file_cb(void *elem, hid_t type_id, unsigned ndims,
+ const hsize_t *coords, void *fm);
+static herr_t H5D_chunk_mem_cb(void *elem, hid_t type_id, unsigned ndims,
+ const hsize_t *coords, void *fm);
/* Declare a free list to manage blocks of single datatype element data */
H5FL_BLK_DEFINE(type_elem);
@@ -337,11 +337,7 @@ H5D_get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache)
/* Get B-tree split ratios */
if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &cache->btree_split_ratio)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type")
-
- /* Get B-tree split ratios */
- if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &cache->btree_split_ratio)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type")
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve B-tree split ratios")
/* Get I/O vector size */
if(H5P_get(dx_plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &cache->vec_size)<0)
@@ -2356,7 +2352,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_space,
+H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_space,
const H5S_t *mem_space, fm_map *fm)
{
H5S_t *tmp_mspace=NULL; /* Temporary memory dataspace */
@@ -2435,9 +2431,9 @@ H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_sp
fm->mem_space_copy=equiv_mspace_init; /* Make certain to copy memory dataspace if necessary */
/* Get type of selection on disk & in memory */
- if((fsel_type=H5S_GET_SELECT_TYPE(file_space))<0)
+ if((fsel_type=H5S_GET_SELECT_TYPE(file_space))<H5S_SEL_NONE)
HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space")
- if((fm->msel_type=H5S_GET_SELECT_TYPE(equiv_mspace))<0)
+ if((fm->msel_type=H5S_GET_SELECT_TYPE(equiv_mspace))<H5S_SEL_NONE)
HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space")
/* Check if file selection is a point selection */
@@ -2664,14 +2660,15 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_create_chunk_file_map_hyper(fm_map *fm)
+H5D_create_chunk_file_map_hyper(const fm_map *fm)
{
- hssize_t sel_points; /* Number of elements in file selection */
- hssize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
- hssize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
- hssize_t start_coords[H5O_LAYOUT_NDIMS]; /* Starting coordinates of selection */
- hssize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */
- hssize_t end[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */
+ hssize_t ssel_points; /* Number of elements in file selection */
+ hsize_t sel_points; /* Number of elements in file selection */
+ hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
+ hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
+ hsize_t start_coords[H5O_LAYOUT_NDIMS]; /* Starting coordinates of selection */
+ hsize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */
+ hsize_t end[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */
hsize_t chunk_index; /* Index of chunk */
int curr_dim; /* Current dimension to increment */
unsigned u; /* Local index variable */
@@ -2683,8 +2680,9 @@ H5D_create_chunk_file_map_hyper(fm_map *fm)
assert(fm->f_ndims>0);
/* Get number of elements selected in file */
- if((sel_points=H5S_GET_SELECT_NPOINTS(fm->file_space))<0)
+ if((ssel_points=H5S_GET_SELECT_NPOINTS(fm->file_space))<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements")
+ H5_ASSIGN_OVERFLOW(sel_points,ssel_points,hssize_t,hsize_t);
/* Get bounding box for selection (to reduce the number of chunks to iterate over) */
if(H5S_SELECT_BOUNDS(fm->file_space, sel_start, sel_end)<0)
@@ -2692,8 +2690,7 @@ H5D_create_chunk_file_map_hyper(fm_map *fm)
/* Set initial chunk location & hyperslab size */
for(u=0; u<fm->f_ndims; u++) {
- H5_CHECK_OVERFLOW(fm->layout->u.chunk.dim[u],hsize_t,hssize_t);
- start_coords[u]=(sel_start[u]/(hssize_t)fm->layout->u.chunk.dim[u])*(hssize_t)fm->layout->u.chunk.dim[u];
+ start_coords[u]=(sel_start[u]/fm->layout->u.chunk.dim[u])*fm->layout->u.chunk.dim[u];
coords[u]=start_coords[u];
end[u]=(coords[u]+fm->chunk_dim[u])-1;
} /* end for */
@@ -2716,12 +2713,16 @@ H5D_create_chunk_file_map_hyper(fm_map *fm)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
/* Make certain selections are stored in span tree form (not "optimized hyperslab" or "all") */
- if(H5S_hyper_convert(tmp_fchunk)<0)
+ if(H5S_hyper_convert(tmp_fchunk)<0) {
+ (void)H5S_close(tmp_fchunk);
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to convert selection to span trees")
+ } /* end if */
/* Normalize hyperslab selections by adjusting them by the offset */
- if(H5S_hyper_normalize_offset(tmp_fchunk)<0)
+ if(H5S_hyper_normalize_offset(tmp_fchunk)<0) {
+ (void)H5S_close(tmp_fchunk);
HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset")
+ } /* end if */
/* "AND" temporary chunk and current chunk */
if(H5S_select_hyperslab(tmp_fchunk,H5S_SELECT_AND,coords,NULL,fm->chunk_dim,NULL)<0) {
@@ -2736,7 +2737,7 @@ H5D_create_chunk_file_map_hyper(fm_map *fm)
} /* end if */
/* Move selection back to have correct offset in chunk */
- if(H5S_hyper_adjust(tmp_fchunk,coords)<0) {
+ if(H5S_hyper_adjust_u(tmp_fchunk,coords)<0) {
(void)H5S_close(tmp_fchunk);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
} /* end if */
@@ -2778,7 +2779,7 @@ H5D_create_chunk_file_map_hyper(fm_map *fm)
H5_ASSIGN_OVERFLOW(new_chunk_info->chunk_points,schunk_points,hssize_t,size_t);
/* Decrement # of points left in file selection */
- sel_points-=schunk_points;
+ sel_points-=(hsize_t)schunk_points;
/* Leave if we are done */
if(sel_points==0)
@@ -2794,8 +2795,8 @@ H5D_create_chunk_file_map_hyper(fm_map *fm)
/* Increment chunk location in fastest changing dimension */
H5_CHECK_OVERFLOW(fm->chunk_dim[curr_dim],hsize_t,hssize_t);
- coords[curr_dim]+=(hssize_t)fm->chunk_dim[curr_dim];
- end[curr_dim]+=(hssize_t)fm->chunk_dim[curr_dim];
+ coords[curr_dim]+=fm->chunk_dim[curr_dim];
+ end[curr_dim]+=fm->chunk_dim[curr_dim];
/* Bring chunk location back into bounds, if necessary */
if(coords[curr_dim]>sel_end[curr_dim]) {
@@ -2808,8 +2809,8 @@ H5D_create_chunk_file_map_hyper(fm_map *fm)
curr_dim--;
/* Increment chunk location in current dimension */
- coords[curr_dim]+=(hssize_t)fm->chunk_dim[curr_dim];
- end[curr_dim]=(coords[curr_dim]+(hssize_t)fm->chunk_dim[curr_dim])-1;
+ coords[curr_dim]+=fm->chunk_dim[curr_dim];
+ end[curr_dim]=(coords[curr_dim]+fm->chunk_dim[curr_dim])-1;
} while(coords[curr_dim]>sel_end[curr_dim]);
/* Re-Calculate the index of this chunk */
@@ -2845,10 +2846,10 @@ static herr_t
H5D_create_chunk_mem_map_hyper(const fm_map *fm)
{
H5TB_NODE *curr_node; /* Current node in TBBT */
- hssize_t file_sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
- hssize_t file_sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
- hssize_t mem_sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
- hssize_t mem_sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
+ hsize_t file_sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
+ hsize_t file_sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
+ hsize_t mem_sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
+ hsize_t mem_sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
hssize_t adjust[H5O_LAYOUT_NDIMS]; /* Adjustment to make to all file chunks */
hssize_t chunk_adjust[H5O_LAYOUT_NDIMS]; /* Adjustment to make to a particular chunk */
unsigned u; /* Local index variable */
@@ -2896,8 +2897,11 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm)
/* Calculate the adjustment for memory selection from file selection */
assert(fm->m_ndims==fm->f_ndims);
- for(u=0; u<fm->f_ndims; u++)
- adjust[u]=file_sel_start[u]-mem_sel_start[u];
+ for(u=0; u<fm->f_ndims; u++) {
+ H5_CHECK_OVERFLOW(file_sel_start[u],hsize_t,hssize_t);
+ H5_CHECK_OVERFLOW(mem_sel_start[u],hsize_t,hssize_t);
+ adjust[u]=(hssize_t)file_sel_start[u]-(hssize_t)mem_sel_start[u];
+ } /* end for */
/* Iterate over each chunk in the chunk list */
curr_node=H5TB_first(fm->fsel->root);
@@ -2923,11 +2927,13 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy selection")
/* Compensate for the chunk offset */
- for(u=0; u<fm->f_ndims; u++)
- chunk_adjust[u]=adjust[u]-chunk_info->coords[u]; /*lint !e771 The adjust array will always be initialized */
+ for(u=0; u<fm->f_ndims; u++) {
+ H5_CHECK_OVERFLOW(chunk_info->coords[u],hsize_t,hssize_t);
+ chunk_adjust[u]=adjust[u]-(hssize_t)chunk_info->coords[u]; /*lint !e771 The adjust array will always be initialized */
+ } /* end for */
/* Adjust the selection */
- if(H5S_hyper_adjust(chunk_info->mspace,chunk_adjust)<0) /*lint !e772 The chunk_adjust array will always be initialized */
+ if(H5S_hyper_adjust_s(chunk_info->mspace,chunk_adjust)<0) /*lint !e772 The chunk_adjust array will always be initialized */
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
/* Get the next chunk node in the TBBT */
@@ -2956,11 +2962,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize_t *coords, void *_fm)
+H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const hsize_t *coords, void *_fm)
{
fm_map *fm = (fm_map*)_fm; /* File<->memory chunk mapping info */
H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */
- hssize_t coords_in_chunk[H5O_LAYOUT_NDIMS]; /* Coordinates of element in chunk */
+ hsize_t coords_in_chunk[H5O_LAYOUT_NDIMS]; /* Coordinates of element in chunk */
hsize_t chunk_index; /* Chunk index */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2968,7 +2974,7 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize
FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_file_cb)
/* Calculate the index of this chunk */
- if(H5V_chunk_index((unsigned)ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index)<0)
+ if(H5V_chunk_index(ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index)<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
/* Find correct chunk in file & memory TBBTs */
@@ -3051,7 +3057,7 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize
coords_in_chunk[u]=coords[u]%fm->layout->u.chunk.dim[u];
/* Add point to file selection for chunk */
- if(H5S_select_elements(chunk_info->fspace,H5S_SELECT_APPEND,1,(const hssize_t **)coords_in_chunk)<0)
+ if(H5S_select_elements(chunk_info->fspace,H5S_SELECT_APPEND,1,(const hsize_t **)coords_in_chunk)<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
/* Increment the number of elemented selected in chunk */
@@ -3081,18 +3087,18 @@ done:
*/
/* ARGSUSED */
static herr_t
-H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize_t *coords, void *_fm)
+H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const hsize_t *coords, void *_fm)
{
fm_map *fm = (fm_map*)_fm; /* File<->memory chunk mapping info */
H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */
- hssize_t coords_in_mem[H5O_LAYOUT_NDIMS]; /* Coordinates of element in memory */
+ hsize_t coords_in_mem[H5O_LAYOUT_NDIMS]; /* Coordinates of element in memory */
hsize_t chunk_index; /* Chunk index */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_mem_cb)
/* Calculate the index of this chunk */
- if(H5V_chunk_index((unsigned)ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index)<0)
+ if(H5V_chunk_index(ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index)<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
/* Find correct chunk in file & memory TBBTs */
@@ -3133,7 +3139,7 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize_
/* Add point to memory selection for chunk */
if(fm->msel_type==H5S_SEL_POINTS) {
- if(H5S_select_elements(chunk_info->mspace,H5S_SELECT_APPEND,1,(const hssize_t **)coords_in_mem)<0)
+ if(H5S_select_elements(chunk_info->mspace,H5S_SELECT_APPEND,1,(const hsize_t **)coords_in_mem)<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
} /* end if */
else {
@@ -3151,7 +3157,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_get_collective_io_consensus
+ * Function: H5D_get_collective_io_consensus
*
* Purpose: Compare notes with all other processes involved in this I/O
* and see if all are go for collective I/O.
@@ -3248,7 +3254,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_chunk_mem_cb
+ * Function: H5D_ioinfo_init
*
* Purpose: Routine for determining correct I/O operations for
* each I/O action.
@@ -3264,15 +3270,34 @@ done:
*/
static herr_t
H5D_ioinfo_init(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
- const H5S_t *mem_space, const H5S_t *file_space,
- unsigned flags, hbool_t *use_par_opt_io, H5D_io_info_t *io_info)
+ const H5S_t
+#if !(defined H5_HAVE_PARALLEL || defined H5S_DEBUG)
+ UNUSED
+#endif /* H5_HAVE_PARALLEL */
+ *mem_space, const H5S_t
+#if !(defined H5_HAVE_PARALLEL || defined H5S_DEBUG)
+ UNUSED
+#endif /* H5_HAVE_PARALLEL */
+ *file_space, unsigned
+#ifndef H5_HAVE_PARALLEL
+ UNUSED
+#endif /* H5_HAVE_PARALLEL */
+ flags, hbool_t
+#ifndef H5_HAVE_PARALLEL
+ UNUSED
+#endif /* H5_HAVE_PARALLEL */
+ *use_par_opt_io, H5D_io_info_t *io_info)
{
#ifdef H5_HAVE_PARALLEL
htri_t opt; /* Flag whether a selection is optimizable */
#endif /* H5_HAVE_PARALLEL */
herr_t ret_value = SUCCEED; /* Return value */
+#if defined H5_HAVE_PARALLEL || defined H5S_DEBUG
FUNC_ENTER_NOAPI_NOINIT(H5D_ioinfo_init)
+#else /* defined H5_HAVE_PARALLEL || defined H5S_DEBUG */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_ioinfo_init)
+#endif /* defined H5_HAVE_PARALLEL || defined H5S_DEBUG */
/* check args */
HDassert(dset);
@@ -3325,7 +3350,6 @@ H5D_ioinfo_init(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
} /* end if */
else {
/* Indicate that the I/O will _NOT_ be parallel */
-
*use_par_opt_io=FALSE;
io_info->ops.read = H5D_select_read;
io_info->ops.write = H5D_select_write;
@@ -3343,6 +3367,8 @@ H5D_ioinfo_init(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "can't set up selection statistics");
#endif /* H5S_DEBUG */
+#if defined H5_HAVE_PARALLEL || defined H5S_DEBUG
done:
+#endif /* H5_HAVE_PARALLEL || H5S_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_ioinfo_init() */
diff --git a/src/H5Distore.c b/src/H5Distore.c
index 9fc906d..bcf384e 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -92,13 +92,13 @@
* Given a B-tree node return the dimensionality of the chunks pointed to by
* that node.
*/
-#define H5D_ISTORE_NDIMS(X) ((int)(((X)->sizeof_rkey-8)/8))
+#define H5D_ISTORE_NDIMS(X) (((X)->sizeof_rkey-8)/8)
/* Raw data chunks are cached. Each entry in the cache is: */
typedef struct H5D_rdcc_ent_t {
hbool_t locked; /*entry is locked in cache */
hbool_t dirty; /*needs to be written to disk? */
- hssize_t offset[H5O_LAYOUT_NDIMS]; /*chunk name */
+ hsize_t offset[H5O_LAYOUT_NDIMS]; /*chunk name */
size_t rd_count; /*bytes remaining to be read */
size_t wr_count; /*bytes remaining to be written */
size_t chunk_size; /*size of a chunk */
@@ -126,7 +126,7 @@ typedef H5D_rdcc_ent_t *H5D_rdcc_ent_ptr_t; /* For free lists */
*/
typedef struct H5D_istore_key_t {
size_t nbytes; /*size of stored data */
- hssize_t offset[H5O_LAYOUT_NDIMS]; /*logical offset to start*/
+ hsize_t offset[H5O_LAYOUT_NDIMS]; /*logical offset to start*/
unsigned filter_mask; /*excluded filters */
} H5D_istore_key_t;
@@ -148,16 +148,16 @@ static herr_t H5D_istore_shared_create (const H5F_t *f, H5O_layout_t *layout);
static herr_t H5D_istore_shared_free (void *page);
/* B-tree iterator callbacks */
-static int H5D_istore_iter_allocated(H5F_t *f, hid_t dxpl_id, void *left_key, haddr_t addr,
- void *right_key, void *_udata);
-static int H5D_istore_iter_dump(H5F_t *f, hid_t dxpl_id, void *left_key, haddr_t addr,
- void *right_key, void *_udata);
-static int H5D_istore_prune_extent(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t addr,
- void *_rt_key, void *_udata);
+static int H5D_istore_iter_allocated(H5F_t *f, hid_t dxpl_id, const void *left_key, haddr_t addr,
+ const void *right_key, void *_udata);
+static int H5D_istore_iter_dump(H5F_t *f, hid_t dxpl_id, const void *left_key, haddr_t addr,
+ const void *right_key, void *_udata);
+static int H5D_istore_prune_extent(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
+ const void *_rt_key, void *_udata);
/* B-tree callbacks */
static size_t H5D_istore_sizeof_rkey(const H5F_t *f, const void *_udata);
-static H5RC_t *H5D_istore_get_shared(H5F_t *f, const void *_udata);
+static H5RC_t *H5D_istore_get_shared(const H5F_t *f, const void *_udata);
static herr_t H5D_istore_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t, void *_lt_key,
void *_udata, void *_rt_key,
haddr_t *addr_p /*out*/);
@@ -166,7 +166,7 @@ static int H5D_istore_cmp2(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata,
static int H5D_istore_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata,
void *_rt_key);
static herr_t H5D_istore_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_lt_key,
- void *_udata, const void *_rt_key);
+ void *_udata);
static H5B_ins_t H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key,
hbool_t *lt_key_changed, void *_md_key,
void *_udata, void *_rt_key,
@@ -175,9 +175,9 @@ static H5B_ins_t H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *
static H5B_ins_t H5D_istore_remove( H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key,
hbool_t *lt_key_changed, void *_udata, void *_rt_key,
hbool_t *rt_key_changed);
-static herr_t H5D_istore_decode_key(H5F_t *f, H5B_t *bt, uint8_t *raw,
+static herr_t H5D_istore_decode_key(const H5F_t *f, const H5B_t *bt, const uint8_t *raw,
void *_key);
-static herr_t H5D_istore_encode_key(H5F_t *f, H5B_t *bt, uint8_t *raw,
+static herr_t H5D_istore_encode_key(const H5F_t *f, const H5B_t *bt, uint8_t *raw,
void *_key);
static herr_t H5D_istore_debug_key(FILE *stream, H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *key,
@@ -240,13 +240,14 @@ H5FL_BLK_DEFINE_STATIC(chunk_page);
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static size_t
H5D_istore_sizeof_rkey(const H5F_t UNUSED *f, const void *_udata)
{
const H5D_istore_ud1_t *udata = (const H5D_istore_ud1_t *) _udata;
size_t nbytes;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_sizeof_rkey);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_sizeof_rkey)
assert(udata);
assert(udata->mesg->u.chunk.ndims > 0 && udata->mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
@@ -255,7 +256,7 @@ H5D_istore_sizeof_rkey(const H5F_t UNUSED *f, const void *_udata)
4 + /*filter mask */
udata->mesg->u.chunk.ndims*8; /*dimension indices */
- FUNC_LEAVE_NOAPI(nbytes);
+ FUNC_LEAVE_NOAPI(nbytes)
} /* end H5D_istore_sizeof_rkey() */
@@ -275,12 +276,13 @@ H5D_istore_sizeof_rkey(const H5F_t UNUSED *f, const void *_udata)
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static H5RC_t *
-H5D_istore_get_shared(H5F_t UNUSED *f, const void *_udata)
+H5D_istore_get_shared(const H5F_t UNUSED *f, const void *_udata)
{
const H5D_istore_ud1_t *udata = (const H5D_istore_ud1_t *) _udata;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_get_shared);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_get_shared)
assert(udata);
assert(udata->mesg);
@@ -290,7 +292,7 @@ H5D_istore_get_shared(H5F_t UNUSED *f, const void *_udata)
H5RC_INC(udata->mesg->u.chunk.btree_shared);
/* Return the pointer to the ref-count object */
- FUNC_LEAVE_NOAPI(udata->mesg->u.chunk.btree_shared);
+ FUNC_LEAVE_NOAPI(udata->mesg->u.chunk.btree_shared)
} /* end H5D_istore_get_shared() */
@@ -309,14 +311,14 @@ H5D_istore_get_shared(H5F_t UNUSED *f, const void *_udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_istore_decode_key(H5F_t UNUSED *f, H5B_t *bt, uint8_t *raw, void *_key)
+H5D_istore_decode_key(const H5F_t UNUSED *f, const H5B_t *bt, const uint8_t *raw, void *_key)
{
H5D_istore_key_t *key = (H5D_istore_key_t *) _key;
H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ size_t ndims;
unsigned u;
- unsigned ndims;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_decode_key);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_decode_key)
/* check args */
assert(f);
@@ -334,7 +336,7 @@ H5D_istore_decode_key(H5F_t UNUSED *f, H5B_t *bt, uint8_t *raw, void *_key)
for (u=0; u<ndims; u++)
UINT64DECODE(raw, key->offset[u]);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D_istore_decode_key() */
@@ -353,14 +355,14 @@ H5D_istore_decode_key(H5F_t UNUSED *f, H5B_t *bt, uint8_t *raw, void *_key)
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_istore_encode_key(H5F_t UNUSED *f, H5B_t *bt, uint8_t *raw, void *_key)
+H5D_istore_encode_key(const H5F_t UNUSED *f, const H5B_t *bt, uint8_t *raw, void *_key)
{
H5D_istore_key_t *key = (H5D_istore_key_t *) _key;
H5B_shared_t *shared; /* Pointer to shared B-tree info */
- unsigned ndims;
+ size_t ndims;
unsigned u;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_encode_key);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_encode_key)
/* check args */
assert(f);
@@ -378,7 +380,7 @@ H5D_istore_encode_key(H5F_t UNUSED *f, H5B_t *bt, uint8_t *raw, void *_key)
for (u=0; u<ndims; u++)
UINT64ENCODE(raw, key->offset[u]);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D_istore_encode_key() */
@@ -396,6 +398,7 @@ H5D_istore_encode_key(H5F_t UNUSED *f, H5B_t *bt, uint8_t *raw, void *_key)
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static herr_t
H5D_istore_debug_key (FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth,
const void *_key, const void *_udata)
@@ -404,7 +407,7 @@ H5D_istore_debug_key (FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int i
const H5D_istore_ud1_t *udata = (const H5D_istore_ud1_t *)_udata;
unsigned u;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_debug_key);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_debug_key)
assert (key);
@@ -418,7 +421,7 @@ H5D_istore_debug_key (FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int i
HDfprintf (stream, "%s%Hd", u?", ":"", key->offset[u]);
HDfputs ("}\n", stream);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D_istore_debug_key() */
@@ -443,6 +446,7 @@ H5D_istore_debug_key (FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int i
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static int
H5D_istore_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata,
void *_rt_key)
@@ -452,7 +456,7 @@ H5D_istore_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_uda
H5D_istore_ud1_t *udata = (H5D_istore_ud1_t *) _udata;
int ret_value;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_cmp2);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_cmp2)
assert(lt_key);
assert(rt_key);
@@ -460,9 +464,9 @@ H5D_istore_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_uda
assert(udata->mesg->u.chunk.ndims > 0 && udata->mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
/* Compare the offsets but ignore the other fields */
- ret_value = H5V_vector_cmp_s(udata->mesg->u.chunk.ndims, lt_key->offset, rt_key->offset);
+ ret_value = H5V_vector_cmp_u(udata->mesg->u.chunk.ndims, lt_key->offset, rt_key->offset);
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_cmp2() */
@@ -495,6 +499,7 @@ H5D_istore_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_uda
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static int
H5D_istore_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata,
void *_rt_key)
@@ -504,7 +509,7 @@ H5D_istore_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_uda
H5D_istore_ud1_t *udata = (H5D_istore_ud1_t *) _udata;
int ret_value = 0;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_cmp3);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_cmp3)
assert(lt_key);
assert(rt_key);
@@ -527,15 +532,15 @@ H5D_istore_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_uda
ret_value=(-1);
} /* end if */
else {
- if (H5V_vector_ge_s(udata->mesg->u.chunk.ndims, udata->key.offset,
+ if (H5V_vector_ge_u(udata->mesg->u.chunk.ndims, udata->key.offset,
rt_key->offset))
ret_value = 1;
- else if (H5V_vector_lt_s(udata->mesg->u.chunk.ndims, udata->key.offset,
+ else if (H5V_vector_lt_u(udata->mesg->u.chunk.ndims, udata->key.offset,
lt_key->offset))
ret_value = -1;
} /* end else */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_cmp3() */
@@ -570,7 +575,7 @@ H5D_istore_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op,
unsigned u;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5D_istore_new_node);
+ FUNC_ENTER_NOAPI_NOINIT(H5D_istore_new_node)
/* check args */
assert(f);
@@ -584,7 +589,7 @@ H5D_istore_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op,
assert (udata->key.nbytes > 0);
H5_CHECK_OVERFLOW( udata->key.nbytes ,size_t, hsize_t);
if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->key.nbytes)))
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "couldn't allocate new file storage");
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "couldn't allocate new file storage")
udata->addr = *addr_p;
/*
@@ -604,15 +609,14 @@ H5D_istore_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op,
rt_key->nbytes = 0;
rt_key->filter_mask = 0;
for (u=0; u<udata->mesg->u.chunk.ndims; u++) {
- assert (udata->key.offset[u]+(hssize_t)(udata->mesg->u.chunk.dim[u]) >
+ assert (udata->key.offset[u]+udata->mesg->u.chunk.dim[u] >
udata->key.offset[u]);
- rt_key->offset[u] = udata->key.offset[u] +
- (hssize_t)(udata->mesg->u.chunk.dim[u]);
+ rt_key->offset[u] = udata->key.offset[u] + udata->mesg->u.chunk.dim[u];
}
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_new_node() */
@@ -643,16 +647,17 @@ done:
* The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static herr_t
H5D_istore_found(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t addr, const void *_lt_key,
- void *_udata, const void UNUSED *_rt_key)
+ void *_udata)
{
H5D_istore_ud1_t *udata = (H5D_istore_ud1_t *) _udata;
const H5D_istore_key_t *lt_key = (const H5D_istore_key_t *) _lt_key;
unsigned u;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_found);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_found)
/* Check arguments */
assert(f);
@@ -661,10 +666,9 @@ H5D_istore_found(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t addr, const void
assert(lt_key);
/* Is this *really* the requested chunk? */
- for (u=0; u<udata->mesg->u.chunk.ndims; u++) {
- if (udata->key.offset[u] >= lt_key->offset[u]+(hssize_t)(udata->mesg->u.chunk.dim[u]))
- HGOTO_DONE(FAIL);
- }
+ for (u=0; u<udata->mesg->u.chunk.ndims; u++)
+ if (udata->key.offset[u] >= lt_key->offset[u]+udata->mesg->u.chunk.dim[u])
+ HGOTO_DONE(FAIL)
/* Initialize return values */
udata->addr = addr;
@@ -675,7 +679,7 @@ H5D_istore_found(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t addr, const void
udata->key.offset[u] = lt_key->offset[u];
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_found() */
@@ -711,6 +715,7 @@ done:
* is renamed NEW_NODE_P.
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static H5B_ins_t
H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key,
hbool_t *lt_key_changed,
@@ -726,7 +731,7 @@ H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key,
unsigned u;
H5B_ins_t ret_value;
- FUNC_ENTER_NOAPI_NOINIT(H5D_istore_insert);
+ FUNC_ENTER_NOAPI_NOINIT(H5D_istore_insert)
/* check args */
assert(f);
@@ -736,7 +741,6 @@ H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key,
assert(md_key);
assert(udata);
assert(rt_key);
- assert(rt_key_changed);
assert(new_node_p);
cmp = H5D_istore_cmp3(f, dxpl_id, lt_key, udata, rt_key);
@@ -744,10 +748,9 @@ H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key,
if (cmp < 0) {
/* Negative indices not supported yet */
- assert("HDF5 INTERNAL ERROR -- see rpm" && 0);
- HGOTO_ERROR(H5E_STORAGE, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error");
+ HGOTO_ERROR(H5E_STORAGE, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error")
- } else if (H5V_vector_eq_s (udata->mesg->u.chunk.ndims,
+ } else if (H5V_vector_eq_u (udata->mesg->u.chunk.ndims,
udata->key.offset, lt_key->offset) &&
lt_key->nbytes>0) {
/*
@@ -767,14 +770,14 @@ H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key,
#ifdef OLD_WAY
if (HADDR_UNDEF==(*new_node_p=H5MF_realloc(f, H5FD_MEM_DRAW, addr,
(hsize_t)lt_key->nbytes, (hsize_t)udata->key.nbytes)))
- HGOTO_ERROR (H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk storage");
+ HGOTO_ERROR (H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk storage")
#else /* OLD_WAY */
H5_CHECK_OVERFLOW( lt_key->nbytes ,size_t, hsize_t);
if (H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes)<0)
- HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk");
+ HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk")
H5_CHECK_OVERFLOW( udata->key.nbytes ,size_t, hsize_t);
if (HADDR_UNDEF==(*new_node_p=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->key.nbytes)))
- HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk");
+ HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk")
#endif /* OLD_WAY */
lt_key->nbytes = udata->key.nbytes;
lt_key->filter_mask = udata->key.filter_mask;
@@ -808,17 +811,16 @@ H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key,
*/
H5_CHECK_OVERFLOW( udata->key.nbytes ,size_t, hsize_t);
if (HADDR_UNDEF==(*new_node_p=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->key.nbytes)))
- HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "file allocation failed");
+ HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "file allocation failed")
udata->addr = *new_node_p;
ret_value = H5B_INS_RIGHT;
} else {
- assert("HDF5 INTERNAL ERROR -- see rpm" && 0);
- HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error");
+ HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error")
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_insert() */
@@ -842,18 +844,19 @@ done:
* Changed to callback from H5B_iterate
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static int
-H5D_istore_iter_allocated (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, haddr_t UNUSED addr,
- void UNUSED *_rt_key, void *_udata)
+H5D_istore_iter_allocated (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_lt_key, haddr_t UNUSED addr,
+ const void UNUSED *_rt_key, void *_udata)
{
H5D_istore_ud1_t *bt_udata = (H5D_istore_ud1_t *)_udata;
- H5D_istore_key_t *lt_key = (H5D_istore_key_t *)_lt_key;
+ const H5D_istore_key_t *lt_key = (const H5D_istore_key_t *)_lt_key;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_iter_allocated);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_iter_allocated)
bt_udata->total_storage += lt_key->nbytes;
- FUNC_LEAVE_NOAPI(H5B_ITER_CONT);
+ FUNC_LEAVE_NOAPI(H5B_ITER_CONT)
} /* H5D_istore_iter_allocated() */
@@ -878,15 +881,16 @@ H5D_istore_iter_allocated (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key,
* Changed to callback from H5B_iterate
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static int
-H5D_istore_iter_dump (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, haddr_t UNUSED addr,
- void UNUSED *_rt_key, void *_udata)
+H5D_istore_iter_dump (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_lt_key, haddr_t UNUSED addr,
+ const void UNUSED *_rt_key, void *_udata)
{
H5D_istore_ud1_t *bt_udata = (H5D_istore_ud1_t *)_udata;
- H5D_istore_key_t *lt_key = (H5D_istore_key_t *)_lt_key;
+ const H5D_istore_key_t *lt_key = (const H5D_istore_key_t *)_lt_key;
unsigned u;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_iter_dump);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_iter_dump)
if (bt_udata->stream) {
if (0==bt_udata->total_storage) {
@@ -906,7 +910,7 @@ H5D_istore_iter_dump (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, hadd
bt_udata->total_storage++;
}
- FUNC_LEAVE_NOAPI(H5B_ITER_CONT);
+ FUNC_LEAVE_NOAPI(H5B_ITER_CONT)
} /* H5D_istore_iter_dump() */
@@ -926,26 +930,26 @@ H5D_istore_iter_dump (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, hadd
*-------------------------------------------------------------------------
*/
herr_t
-H5D_istore_init (const H5F_t *f, H5D_t *dset)
+H5D_istore_init (const H5F_t *f, const H5D_t *dset)
{
H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_istore_init, FAIL);
+ FUNC_ENTER_NOAPI(H5D_istore_init, FAIL)
if (H5F_RDCC_NBYTES(f)>0 && H5F_RDCC_NELMTS(f)>0) {
rdcc->nbytes=H5F_RDCC_NBYTES(f);
rdcc->nslots = H5F_RDCC_NELMTS(f);
rdcc->slot = H5FL_SEQ_CALLOC (H5D_rdcc_ent_ptr_t,rdcc->nslots);
if (NULL==rdcc->slot)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
} /* end if */
/* Allocate the shared structure */
if(H5D_istore_shared_create(f, &dset->shared->layout)<0)
HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_init() */
@@ -967,7 +971,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_istore_flush_entry(H5D_io_info_t *io_info, H5D_rdcc_ent_t *ent, hbool_t reset)
+H5D_istore_flush_entry(const H5D_io_info_t *io_info, H5D_rdcc_ent_t *ent, hbool_t reset)
{
herr_t ret_value=SUCCEED; /*return value */
unsigned u; /*counters */
@@ -975,7 +979,7 @@ H5D_istore_flush_entry(H5D_io_info_t *io_info, H5D_rdcc_ent_t *ent, hbool_t rese
size_t alloc; /*bytes allocated for BUF */
hbool_t point_of_no_return = FALSE;
- FUNC_ENTER_NOAPI_NOINIT(H5D_istore_flush_entry);
+ FUNC_ENTER_NOAPI_NOINIT(H5D_istore_flush_entry)
assert(io_info);
assert(io_info->dset);
@@ -1004,7 +1008,7 @@ H5D_istore_flush_entry(H5D_io_info_t *io_info, H5D_rdcc_ent_t *ent, hbool_t rese
*/
alloc = ent->chunk_size;
if (NULL==(buf = H5MM_malloc(alloc)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline")
HDmemcpy(buf, ent->chunk, ent->chunk_size);
} else {
/*
@@ -1027,9 +1031,9 @@ H5D_istore_flush_entry(H5D_io_info_t *io_info, H5D_rdcc_ent_t *ent, hbool_t rese
* its size changed. Then write the data into the file.
*/
if (H5B_insert(io_info->dset->ent.file, io_info->dxpl_id, H5B_ISTORE, io_info->dset->shared->layout.u.chunk.addr, &udata)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk")
if (H5F_block_write(io_info->dset->ent.file, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, io_info->dxpl_id, buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
/* Mark cache entry as clean */
ent->dirty = FALSE;
@@ -1063,7 +1067,7 @@ done:
ent->chunk = H5D_istore_chunk_xfree(ent->chunk,&(io_info->dset->shared->dcpl_cache.pline));
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_flush_entry() */
@@ -1086,12 +1090,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_istore_preempt(H5D_io_info_t *io_info, H5D_rdcc_ent_t * ent, hbool_t flush)
+H5D_istore_preempt(const H5D_io_info_t *io_info, H5D_rdcc_ent_t * ent, hbool_t flush)
{
H5D_rdcc_t *rdcc = &(io_info->dset->shared->cache.chunk);
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5D_istore_preempt);
+ FUNC_ENTER_NOAPI_NOINIT(H5D_istore_preempt)
assert(io_info);
assert(ent);
@@ -1101,7 +1105,7 @@ H5D_istore_preempt(H5D_io_info_t *io_info, H5D_rdcc_ent_t * ent, hbool_t flush)
if(flush) {
/* Flush */
if(H5D_istore_flush_entry(io_info, ent, TRUE) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer")
}
else {
/* Don't flush, just free chunk */
@@ -1130,7 +1134,7 @@ H5D_istore_preempt(H5D_io_info_t *io_info, H5D_rdcc_ent_t * ent, hbool_t flush)
H5FL_FREE(H5D_rdcc_ent_t, ent);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_preempt() */
@@ -1162,7 +1166,7 @@ H5D_istore_flush (H5D_t *dset, hid_t dxpl_id, unsigned flags)
H5D_rdcc_ent_t *ent=NULL, *next=NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_istore_flush, FAIL);
+ FUNC_ENTER_NOAPI(H5D_istore_flush, FAIL)
/* Fill the DXPL cache values for later use */
if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0)
@@ -1187,10 +1191,10 @@ H5D_istore_flush (H5D_t *dset, hid_t dxpl_id, unsigned flags)
} /* end for */
if (nerrors)
- HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks");
+ HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_flush() */
@@ -1222,7 +1226,7 @@ H5D_istore_dest (H5D_t *dset, hid_t dxpl_id)
H5D_rdcc_ent_t *ent=NULL, *next=NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_istore_dest, FAIL);
+ FUNC_ENTER_NOAPI(H5D_istore_dest, FAIL)
assert(dset);
@@ -1244,17 +1248,18 @@ H5D_istore_dest (H5D_t *dset, hid_t dxpl_id)
nerrors++;
}
if (nerrors)
- HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks");
+ HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
- H5FL_SEQ_FREE (H5D_rdcc_ent_ptr_t,rdcc->slot);
+ if(rdcc->slot)
+ H5FL_SEQ_FREE (H5D_rdcc_ent_ptr_t,rdcc->slot);
HDmemset (rdcc, 0, sizeof(H5D_rdcc_t));
/* Free the raw B-tree node buffer */
if(H5RC_DEC(dset->shared->layout.u.chunk.btree_shared)<0)
- HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page");
+ HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_dest() */
@@ -1306,14 +1311,14 @@ HDmemset(shared->page,0,shared->sizeof_rnode);
/* Initialize the offsets into the native key buffer */
for(u=0; u<(2*H5F_KVALUE(f,H5B_ISTORE)+1); u++)
- shared->nkey[u]=u*H5B_ISTORE->sizeof_nkey;
+ shared->nkey[u]=u*H5B_ISTORE[0].sizeof_nkey;
/* Make shared B-tree info reference counted */
if(NULL==(layout->u.chunk.btree_shared=H5RC_create(shared,H5D_istore_shared_free)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_shared_create() */
@@ -1370,7 +1375,7 @@ H5D_istore_shared_free (void *_shared)
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_istore_prune (H5D_io_info_t *io_info, size_t size)
+H5D_istore_prune (const H5D_io_info_t *io_info, size_t size)
{
int i, j, nerrors=0;
const H5D_rdcc_t *rdcc = &(io_info->dset->shared->cache.chunk);
@@ -1381,7 +1386,7 @@ H5D_istore_prune (H5D_io_info_t *io_info, size_t size)
H5D_rdcc_ent_t *n[2]; /*list next pointers */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5D_istore_prune);
+ FUNC_ENTER_NOAPI_NOINIT(H5D_istore_prune)
/*
* Preemption is accomplished by having multiple pointers (currently two)
@@ -1462,10 +1467,10 @@ H5D_istore_prune (H5D_io_info_t *io_info, size_t size)
}
if (nerrors)
- HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to preempt one or more raw data cache entry");
+ HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to preempt one or more raw data cache entry")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_prune() */
@@ -1504,7 +1509,7 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5D_istore_lock(H5D_io_info_t *io_info,
+H5D_istore_lock(const H5D_io_info_t *io_info,
H5D_istore_ud1_t *udata, hbool_t relax, unsigned *idx_hint/*in,out*/)
{
H5D_t *dset=io_info->dset; /* Local pointer to the dataset info */
@@ -1521,7 +1526,7 @@ H5D_istore_lock(H5D_io_info_t *io_info,
void *chunk=NULL; /*the file chunk */
void *ret_value; /*return value */
- FUNC_ENTER_NOAPI_NOINIT(H5D_istore_lock);
+ FUNC_ENTER_NOAPI_NOINIT(H5D_istore_lock)
assert(io_info);
assert(dset);
@@ -1556,7 +1561,7 @@ H5D_istore_lock(H5D_io_info_t *io_info,
rdcc->nhits++;
#endif /* H5D_ISTORE_DEBUG */
- } else if (!found && relax) {
+ } else if (relax) {
/*
* Not in the cache, but we're about to overwrite the whole thing
* anyway, so just allocate a buffer for it but don't initialize that
@@ -1569,7 +1574,7 @@ H5D_istore_lock(H5D_io_info_t *io_info,
rdcc->nhits++;
#endif
if (NULL==(chunk=H5D_istore_chunk_alloc (chunk_size,pline)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk");
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
} else {
H5D_istore_ud1_t tmp_udata; /*B-tree pass-through */
@@ -1598,14 +1603,14 @@ H5D_istore_lock(H5D_io_info_t *io_info,
* size in memory, so allocate memory big enough. */
chunk_alloc = udata->key.nbytes;
if (NULL==(chunk = H5D_istore_chunk_alloc (chunk_alloc,pline)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk");
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
if (H5F_block_read(dset->ent.file, H5FD_MEM_DRAW, chunk_addr, udata->key.nbytes, io_info->dxpl_id, chunk)<0)
- HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk");
+ HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk")
if (pline->nused)
if (H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &(udata->key.filter_mask), io_info->dxpl_cache->err_detect,
io_info->dxpl_cache->filter_cb, &(udata->key.nbytes), &chunk_alloc, &chunk)<0) {
- HGOTO_ERROR(H5E_PLINE, H5E_READERROR, NULL, "data pipeline read failed");
+ HGOTO_ERROR(H5E_PLINE, H5E_READERROR, NULL, "data pipeline read failed")
}
#ifdef H5D_ISTORE_DEBUG
rdcc->nmisses++;
@@ -1621,10 +1626,10 @@ H5D_istore_lock(H5D_io_info_t *io_info,
/* Chunk size on disk isn't [likely] the same size as the final chunk
* size in memory, so allocate memory big enough. */
if (NULL==(chunk = H5D_istore_chunk_alloc (chunk_size,pline)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk");
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
if (H5P_is_fill_value_defined(fill, &fill_status) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't tell if fill value defined");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't tell if fill value defined")
if(fill_time==H5D_FILL_TIME_ALLOC ||
(fill_time==H5D_FILL_TIME_IFSET && fill_status==H5D_FILL_VALUE_USER_DEFINED)) {
@@ -1666,10 +1671,10 @@ else
HDfflush(stderr);
#endif
if (H5D_istore_preempt(io_info, ent, TRUE)<0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk from cache");
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk from cache")
}
if (H5D_istore_prune(io_info, chunk_size)<0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk(s) from cache");
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk(s) from cache")
/* Create a new entry */
ent = H5FL_MALLOC(H5D_rdcc_ent_t);
@@ -1710,12 +1715,13 @@ else
ent = NULL;
idx = UINT_MAX;
- } else if (found) {
+ } else {
/*
* The chunk is not at the beginning of the cache; move it backward
* by one slot. This is how we implement the LRU preemption
* algorithm.
*/
+ assert(ent);
if (ent->next) {
if (ent->next->next)
ent->next->next->prev = ent;
@@ -1748,8 +1754,8 @@ else
done:
if (!ret_value)
if(chunk)
- H5D_istore_chunk_xfree (chunk,pline);
- FUNC_LEAVE_NOAPI(ret_value);
+ chunk=H5D_istore_chunk_xfree (chunk,pline);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_lock() */
@@ -1780,29 +1786,20 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_istore_unlock(H5D_io_info_t *io_info,
+H5D_istore_unlock(const H5D_io_info_t *io_info,
hbool_t dirty, unsigned idx_hint, uint8_t *chunk, size_t naccessed)
{
const H5O_layout_t *layout=&(io_info->dset->shared->layout); /* Dataset layout */
const H5D_rdcc_t *rdcc = &(io_info->dset->shared->cache.chunk);
H5D_rdcc_ent_t *ent = NULL;
- int found = -1;
unsigned u;
+ herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_unlock);
+ FUNC_ENTER_NOAPI_NOINIT(H5D_istore_unlock)
assert(io_info);
if (UINT_MAX==idx_hint) {
- /*not in cache*/
- } else {
- assert(idx_hint<rdcc->nslots);
- assert(rdcc->slot[idx_hint]);
- assert(rdcc->slot[idx_hint]->chunk==chunk);
- found = idx_hint;
- }
-
- if (found<0) {
/*
* It's not in the cache, probably because it's too big. If it's
* dirty then flush it to disk. In any case, free the chunk.
@@ -1821,16 +1818,22 @@ H5D_istore_unlock(H5D_io_info_t *io_info,
x.alloc_size = x.chunk_size;
x.chunk = chunk;
- H5D_istore_flush_entry (io_info, &x, TRUE);
+ if (H5D_istore_flush_entry(io_info, &x, TRUE)<0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer")
} else {
if(chunk)
- H5D_istore_chunk_xfree (chunk,&(io_info->dset->shared->dcpl_cache.pline));
+ chunk=H5D_istore_chunk_xfree (chunk,&(io_info->dset->shared->dcpl_cache.pline));
}
} else {
+ /* Sanity check */
+ assert(idx_hint<rdcc->nslots);
+ assert(rdcc->slot[idx_hint]);
+ assert(rdcc->slot[idx_hint]->chunk==chunk);
+
/*
* It's in the cache so unlock it.
*/
- ent = rdcc->slot[found];
+ ent = rdcc->slot[idx_hint];
assert (ent->locked);
if (dirty) {
ent->dirty = TRUE;
@@ -1841,7 +1844,8 @@ H5D_istore_unlock(H5D_io_info_t *io_info,
ent->locked = FALSE;
}
- FUNC_LEAVE_NOAPI(SUCCEED);
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_unlock() */
@@ -1861,7 +1865,7 @@ H5D_istore_unlock(H5D_io_info_t *io_info,
*-------------------------------------------------------------------------
*/
ssize_t
-H5D_istore_readvv(H5D_io_info_t *io_info,
+H5D_istore_readvv(const H5D_io_info_t *io_info,
size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
void *buf)
@@ -1872,7 +1876,7 @@ H5D_istore_readvv(H5D_io_info_t *io_info,
size_t u; /* Local index variables */
ssize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5D_istore_readvv, FAIL);
+ FUNC_ENTER_NOAPI(H5D_istore_readvv, FAIL)
/* Check args */
assert(io_info);
@@ -1886,11 +1890,6 @@ H5D_istore_readvv(H5D_io_info_t *io_info,
assert(mem_offset_arr);
assert(buf);
-#ifndef NDEBUG
- for (u=0; u<dset->shared->layout.u.chunk.ndims; u++)
- assert(io_info->store->chunk.offset[u]>=0); /*negative coordinates not supported (yet) */
-#endif
-
/* Get the address of this chunk on disk */
#ifdef QAK
HDfprintf(stderr,"%s: io_info->store->chunk.offset={",FUNC);
@@ -1932,7 +1931,7 @@ HDfprintf(stderr,"%s: buf=%p\n",FUNC,buf);
/* Do I/O directly on chunk without reading it into the cache */
if ((ret_value=H5D_contig_readvv(&chk_io_info, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, buf))<0)
- HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "unable to read raw data to file");
+ HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "unable to read raw data to file")
} /* end if */
else {
uint8_t *chunk; /* Pointer to cached chunk in memory */
@@ -1974,7 +1973,7 @@ HDfprintf(stderr,"%s: buf=%p\n",FUNC,buf);
if(!found) {
/* Check if the fill value is defined */
if (H5P_is_fill_value_defined(fill, &fill_status) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
/* If we are never to return fill values, or if we would return them
* but they aren't set, process the entire set of I/O vectors and
@@ -2014,7 +2013,7 @@ HDfprintf(stderr,"%s: buf=%p\n",FUNC,buf);
*mem_curr_seq=u;
*chunk_curr_seq=v;
- HGOTO_DONE(bytes_processed);
+ HGOTO_DONE(bytes_processed)
} /* end if */
} /* end if */
} /* end if */
@@ -2024,22 +2023,22 @@ HDfprintf(stderr,"%s: buf=%p\n",FUNC,buf);
* chunk.
*/
if (NULL==(chunk=H5D_istore_lock(io_info, &udata, FALSE, &idx_hint)))
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk");
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk")
/* Use the vectorized memory copy routine to do actual work */
if((naccessed=H5V_memcpyvv(buf,mem_max_nseq,mem_curr_seq,mem_len_arr,mem_offset_arr,chunk,chunk_max_nseq,chunk_curr_seq,chunk_len_arr,chunk_offset_arr))<0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "vectorized memcpy failed");
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "vectorized memcpy failed")
H5_CHECK_OVERFLOW(naccessed,ssize_t,size_t);
if (H5D_istore_unlock(io_info, FALSE, idx_hint, chunk, (size_t)naccessed)<0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk");
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk")
/* Set return value */
ret_value=naccessed;
} /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5D_istore_readvv() */
@@ -2059,7 +2058,7 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5D_istore_writevv(H5D_io_info_t *io_info,
+H5D_istore_writevv(const H5D_io_info_t *io_info,
size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
const void *buf)
@@ -2070,7 +2069,7 @@ H5D_istore_writevv(H5D_io_info_t *io_info,
size_t u; /* Local index variables */
ssize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5D_istore_writevv, FAIL);
+ FUNC_ENTER_NOAPI(H5D_istore_writevv, FAIL)
/* Check args */
assert(io_info);
@@ -2084,11 +2083,6 @@ H5D_istore_writevv(H5D_io_info_t *io_info,
assert(mem_offset_arr);
assert(buf);
-#ifndef NDEBUG
- for (u=0; u<dset->shared->layout.u.chunk.ndims; u++)
- assert(io_info->store->chunk.offset[u]>=0); /*negative coordinates not supported (yet) */
-#endif
-
/* Get the address of this chunk on disk */
#ifdef QAK
HDfprintf(stderr,"%s: io_info->store->chunk.offset={",FUNC);
@@ -2119,9 +2113,9 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a
/* Additional sanity checks when operating in parallel */
if(IS_H5FD_MPI(dset->ent.file)) {
if (chunk_addr==HADDR_UNDEF)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to locate raw data chunk");
+ HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to locate raw data chunk")
if (dset->shared->dcpl_cache.pline.nused>0)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "cannot write to chunked storage with filters in parallel");
+ HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "cannot write to chunked storage with filters in parallel")
} /* end if */
#endif /* H5_HAVE_PARALLEL */
@@ -2139,7 +2133,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a
/* Do I/O directly on chunk without reading it into the cache */
if ((ret_value=H5D_contig_writevv(&chk_io_info, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, buf))<0)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file");
+ HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
} /* end if */
else {
uint8_t *chunk; /* Pointer to cached chunk in memory */
@@ -2179,22 +2173,22 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a
#endif /* OLD_WAY */
if (NULL==(chunk=H5D_istore_lock(io_info, &udata, relax, &idx_hint)))
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk");
+ HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk")
/* Use the vectorized memory copy routine to do actual work */
if((naccessed=H5V_memcpyvv(chunk,chunk_max_nseq,chunk_curr_seq,chunk_len_arr,chunk_offset_arr,buf,mem_max_nseq,mem_curr_seq,mem_len_arr,mem_offset_arr))<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed")
H5_CHECK_OVERFLOW(naccessed,ssize_t,size_t);
if (H5D_istore_unlock(io_info, TRUE, idx_hint, chunk, (size_t)naccessed)<0)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "uanble to unlock raw data chunk");
+ HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "uanble to unlock raw data chunk")
/* Set return value */
ret_value=naccessed;
} /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5D_istore_writevv() */
@@ -2227,7 +2221,7 @@ H5D_istore_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout /*out */ )
#endif
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_istore_create, FAIL);
+ FUNC_ENTER_NOAPI(H5D_istore_create, FAIL)
/* Check args */
assert(f);
@@ -2242,10 +2236,10 @@ H5D_istore_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout /*out */ )
udata.mesg = layout;
if (H5B_create(f, dxpl_id, H5B_ISTORE, &udata, &(layout->u.chunk.addr)/*out*/) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "can't create B-tree");
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "can't create B-tree")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_create() */
@@ -2279,7 +2273,7 @@ H5D_istore_allocated(H5D_t *dset, hid_t dxpl_id)
H5D_istore_ud1_t udata;
hsize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5D_istore_allocated, 0);
+ FUNC_ENTER_NOAPI(H5D_istore_allocated, 0)
assert(dset);
@@ -2294,19 +2288,19 @@ H5D_istore_allocated(H5D_t *dset, hid_t dxpl_id)
for(ent = rdcc->head; ent; ent = ent->next) {
/* Flush the chunk out to disk, to make certain the size is correct later */
if (H5D_istore_flush_entry(&io_info, ent, FALSE)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, 0, "cannot flush indexed storage buffer");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, 0, "cannot flush indexed storage buffer")
} /* end for */
HDmemset(&udata, 0, sizeof udata);
udata.mesg = &dset->shared->layout;
if (H5B_iterate(dset->ent.file, dxpl_id, H5B_ISTORE, H5D_istore_iter_allocated, dset->shared->layout.u.chunk.addr, &udata)<0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over chunk B-tree");
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over chunk B-tree")
/* Set return value */
ret_value=udata.total_storage;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_allocated() */
@@ -2329,14 +2323,14 @@ done:
*-------------------------------------------------------------------------
*/
haddr_t
-H5D_istore_get_addr(H5D_io_info_t *io_info, H5D_istore_ud1_t *_udata)
+H5D_istore_get_addr(const H5D_io_info_t *io_info, H5D_istore_ud1_t *_udata)
{
H5D_istore_ud1_t tmp_udata; /* Information about a chunk */
H5D_istore_ud1_t *udata; /* Pointer to information about a chunk */
unsigned u;
haddr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_get_addr);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_get_addr)
assert(io_info);
assert(io_info->dset);
@@ -2361,7 +2355,7 @@ H5D_istore_get_addr(H5D_io_info_t *io_info, H5D_istore_ud1_t *_udata)
#ifdef OLD_WAY
H5E_clear_stack(NULL);
- HGOTO_ERROR(H5E_BTREE,H5E_NOTFOUND,HADDR_UNDEF,"Can't locate chunk info");
+ HGOTO_ERROR(H5E_BTREE,H5E_NOTFOUND,HADDR_UNDEF,"Can't locate chunk info")
#else /* OLD_WAY */
HGOTO_DONE(HADDR_UNDEF)
#endif /* OLD_WAY */
@@ -2371,7 +2365,7 @@ H5D_istore_get_addr(H5D_io_info_t *io_info, H5D_istore_ud1_t *_udata)
ret_value=udata->addr;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5D_istore_get_addr() */
@@ -2396,7 +2390,7 @@ H5D_istore_chunk_alloc(size_t size, const H5O_pline_t *pline)
{
void *ret_value=NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_chunk_alloc);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_chunk_alloc)
assert(size);
assert(pline);
@@ -2406,7 +2400,7 @@ H5D_istore_chunk_alloc(size_t size, const H5O_pline_t *pline)
else
ret_value=H5FL_BLK_MALLOC(chunk,size);
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5D_istore_chunk_alloc() */
@@ -2429,7 +2423,7 @@ H5D_istore_chunk_alloc(size_t size, const H5O_pline_t *pline)
static void *
H5D_istore_chunk_xfree(void *chk, const H5O_pline_t *pline)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_chunk_xfree);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_chunk_xfree)
assert(pline);
@@ -2440,7 +2434,7 @@ H5D_istore_chunk_xfree(void *chk, const H5O_pline_t *pline)
H5FL_BLK_FREE(chunk,chk);
} /* end if */
- FUNC_LEAVE_NOAPI(NULL);
+ FUNC_LEAVE_NOAPI(NULL)
} /* H5D_istore_chunk_xfree() */
@@ -2492,10 +2486,11 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
{
H5D_io_info_t io_info; /* Dataset I/O info */
H5D_storage_t store; /* Dataset storage information */
- hssize_t chunk_offset[H5O_LAYOUT_NDIMS]; /* Offset of current chunk */
+ hsize_t chunk_offset[H5O_LAYOUT_NDIMS]; /* Offset of current chunk */
hsize_t chunk_size; /* Size of chunk in bytes */
unsigned filter_mask=0; /* Filter mask for chunks that have them */
H5O_pline_t pline; /* I/O pipeline information */
+ hbool_t pline_initialized=FALSE; /* Flag to indicate that pline has valid info */
H5O_fill_t fill; /* Fill value information */
H5D_fill_time_t fill_time; /* When to write fill values */
H5D_fill_value_t fill_status; /* The fill value status */
@@ -2520,7 +2515,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
hsize_t space_dim[H5O_LAYOUT_NDIMS]; /* Dataset's dataspace dimensions */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_istore_allocate, FAIL);
+ FUNC_ENTER_NOAPI(H5D_istore_allocate, FAIL)
/* Check args */
assert(dset && H5D_CHUNKED==dset->shared->layout.type);
@@ -2539,11 +2534,12 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
/* Get necessary properties from dataset creation property list */
if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
- HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "can't get fill value");
+ HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "can't get fill value")
if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "can't get data pipeline");
+ HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "can't get data pipeline")
+ pline_initialized=TRUE;
if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill time");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill time")
/* Fill the DXPL cache values for later use */
if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0)
@@ -2554,11 +2550,11 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
if(IS_H5FD_MPI(dset->ent.file)) {
/* Get the MPI communicator */
if (MPI_COMM_NULL == (mpi_comm=H5F_mpi_get_comm(dset->ent.file)))
- HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator")
/* Get the MPI rank */
if ((mpi_rank=H5F_mpi_get_rank(dset->ent.file))<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank")
/* Set the MPI-capable file driver flag */
using_mpi=1;
@@ -2575,7 +2571,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
/* Check the dataset's fill-value status */
if (H5P_is_fill_value_defined(&fill, &fill_status) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
/* If we are filling the dataset on allocation or "if set" and
* the fill value _is_ set, _and_ we are not overwriting the new blocks,
@@ -2592,7 +2588,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
/* Allocate chunk buffer for processes to use when writing fill values */
H5_CHECK_OVERFLOW(chunk_size,hsize_t,size_t);
if (NULL==(chunk = H5D_istore_chunk_alloc((size_t)chunk_size,&pline)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for chunk");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for chunk")
/* Fill the chunk with the proper values */
if(fill.buf) {
@@ -2615,7 +2611,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
/* Push the chunk through the filters */
if (H5Z_pipeline(&pline, 0, &filter_mask, dxpl_cache->err_detect, dxpl_cache->filter_cb, &nbytes, &buf_size, &chunk)<0)
- HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed");
+ HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed")
/* Keep the number of bytes the chunk turned in to */
chunk_size=nbytes;
@@ -2661,7 +2657,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
/* Allocate the chunk with all processes */
if (H5B_insert(dset->ent.file, dxpl_id, H5B_ISTORE, dset->shared->layout.u.chunk.addr, &udata)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk")
/* Check if fill values should be written to blocks */
if(should_fill) {
@@ -2672,7 +2668,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
/* !! Use the internal "independent" DXPL!! -QAK */
if(H5_PAR_META_WRITE==mpi_rank) {
if (H5F_block_write(dset->ent.file, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, H5AC_ind_dxpl_id, chunk)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
} /* end if */
/* Indicate that blocks are being written */
@@ -2681,7 +2677,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
else {
#endif /* H5_HAVE_PARALLEL */
if (H5F_block_write(dset->ent.file, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, dxpl_id, chunk)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
#ifdef H5_HAVE_PARALLEL
} /* end else */
#endif /* H5_HAVE_PARALLEL */
@@ -2689,9 +2685,9 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
} /* end if */
/* Increment indices */
- for (i=dset->shared->layout.u.chunk.ndims-1, carry=1; i>=0 && carry; --i) {
+ for (i=(int)dset->shared->layout.u.chunk.ndims-1, carry=1; i>=0 && carry; --i) {
chunk_offset[i] += dset->shared->layout.u.chunk.dim[i];
- if (chunk_offset[i] >= (hssize_t)(space_dim[i]))
+ if (chunk_offset[i] >= space_dim[i])
chunk_offset[i] = 0;
else
carry = 0;
@@ -2713,10 +2709,10 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
done:
/* Free the chunk for fill values */
- if(chunk!=NULL)
- H5D_istore_chunk_xfree(chunk,&pline);
+ if(chunk!=NULL && pline_initialized)
+ chunk=H5D_istore_chunk_xfree(chunk,&pline);
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_allocate() */
@@ -2821,7 +2817,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D_istore_prune_by_extent(H5D_io_info_t *io_info)
+H5D_istore_prune_by_extent(const H5D_io_info_t *io_info)
{
H5D_t *dset=io_info->dset; /* Local pointer to the dataset info */
const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */
@@ -2832,7 +2828,7 @@ H5D_istore_prune_by_extent(H5D_io_info_t *io_info)
hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /*current dataspace dimensions */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_istore_prune_by_extent, FAIL);
+ FUNC_ENTER_NOAPI(H5D_istore_prune_by_extent, FAIL)
/* Check args */
assert(io_info);
@@ -2842,7 +2838,7 @@ H5D_istore_prune_by_extent(H5D_io_info_t *io_info)
/* Go get the rank & dimensions */
if(H5S_get_simple_extent_dims(dset->shared->space, curr_dims, NULL) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions");
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions")
/*-------------------------------------------------------------------------
* Figure out what chunks are no longer in use for the specified extent
@@ -2870,7 +2866,7 @@ H5D_istore_prune_by_extent(H5D_io_info_t *io_info)
/* Preempt the entry from the cache, but do not flush it to disk */
if(H5D_istore_preempt(io_info, ent, FALSE) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to preempt chunk");
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to preempt chunk")
found=0;
}
@@ -2887,10 +2883,10 @@ H5D_istore_prune_by_extent(H5D_io_info_t *io_info)
udata.dims = curr_dims;
if(H5B_iterate(dset->ent.file, io_info->dxpl_id, H5B_ISTORE, H5D_istore_prune_extent, dset->shared->layout.u.chunk.addr, &udata) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over B-tree");
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over B-tree")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_prune_by_extent() */
@@ -2911,12 +2907,13 @@ done:
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static int
-H5D_istore_prune_extent(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t UNUSED addr,
- void UNUSED *_rt_key, void *_udata)
+H5D_istore_prune_extent(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t UNUSED addr,
+ const void UNUSED *_rt_key, void *_udata)
{
H5D_istore_ud1_t *bt_udata = (H5D_istore_ud1_t *)_udata;
- H5D_istore_key_t *lt_key = (H5D_istore_key_t *)_lt_key;
+ const H5D_istore_key_t *lt_key = (const H5D_istore_key_t *)_lt_key;
unsigned u;
H5D_istore_ud1_t udata;
int ret_value=H5B_ITER_CONT; /* Return value */
@@ -2925,7 +2922,7 @@ H5D_istore_prune_extent(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t UNUSED a
* storage that contains the beginning of the logical address space represented by UDATA.
*/
- FUNC_ENTER_NOAPI_NOINIT(H5D_istore_prune_extent);
+ FUNC_ENTER_NOAPI_NOINIT(H5D_istore_prune_extent)
/* Figure out what chunks are no longer in use for the specified extent and release them */
for(u = 0; u < bt_udata->mesg->u.chunk.ndims - 1; u++)
@@ -2943,12 +2940,12 @@ H5D_istore_prune_extent(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t UNUSED a
/* Remove */
if(H5B_remove(f, dxpl_id, H5B_ISTORE, bt_udata->mesg->u.chunk.addr, &udata) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_ITER_ERROR, "unable to remove entry");
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_ITER_ERROR, "unable to remove entry")
break;
} /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_prune_extent() */
@@ -2970,6 +2967,7 @@ done:
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static H5B_ins_t
H5D_istore_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key /*in,out */ ,
hbool_t *lt_key_changed /*out */ ,
@@ -2978,17 +2976,20 @@ H5D_istore_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key /*in,out
hbool_t *rt_key_changed /*out */ )
{
H5D_istore_key_t *lt_key = (H5D_istore_key_t *)_lt_key;
+ H5B_ins_t ret_value=H5B_INS_REMOVE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_remove);
+ FUNC_ENTER_NOAPI_NOINIT(H5D_istore_remove)
/* Remove raw data chunk from file */
- H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes);
+ if(H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes)<0)
+ HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk")
/* Mark keys as unchanged */
*lt_key_changed = FALSE;
*rt_key_changed = FALSE;
- FUNC_LEAVE_NOAPI(H5B_INS_REMOVE);
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_remove() */
@@ -3022,13 +3023,13 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
const H5O_layout_t *layout=&(io_info->dset->shared->layout); /* Dataset layout */
uint8_t *chunk = NULL; /*the file chunk */
unsigned idx_hint = 0; /*input value for H5F_istore_lock */
- hssize_t chunk_offset[H5O_LAYOUT_NDIMS]; /*logical location of the chunks */
+ hsize_t chunk_offset[H5O_LAYOUT_NDIMS]; /*logical location of the chunks */
hsize_t idx_cur[H5O_LAYOUT_NDIMS]; /*multi-dimensional counters */
hsize_t idx_max[H5O_LAYOUT_NDIMS];
hsize_t sub_size[H5O_LAYOUT_NDIMS];
hsize_t naccessed; /*bytes accessed in chunk */
hsize_t end_chunk; /*chunk position counter */
- hssize_t start[H5O_LAYOUT_NDIMS]; /*starting location of hyperslab */
+ hsize_t start[H5O_LAYOUT_NDIMS]; /*starting location of hyperslab */
hsize_t count[H5O_LAYOUT_NDIMS]; /*element count of hyperslab */
hsize_t size[H5O_LAYOUT_NDIMS]; /*current size of dimensions */
H5S_t *space_chunk = NULL; /*dataspace for a chunk */
@@ -3048,7 +3049,7 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
H5D_storage_t store; /* Dataset storage information */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_istore_initialize_by_extent, FAIL);
+ FUNC_ENTER_NOAPI(H5D_istore_initialize_by_extent, FAIL)
/* Check args */
assert(io_info);
@@ -3062,11 +3063,11 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
/* Get necessary properties from property list */
if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value");
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value")
if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill time");
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill time")
if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data pipeline");
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data pipeline")
/* Reset start & count arrays */
HDmemset(start, 0, sizeof(start));
@@ -3094,7 +3095,7 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
for(u = 0; u < rank; u++)
chunk_dims[u] = layout->u.chunk.dim[u];
if(NULL == (space_chunk = H5S_create_simple(rank,chunk_dims,NULL)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
/*
* Set up multi-dimensional counters (idx_max, and idx_cur) and
@@ -3115,7 +3116,7 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
while(carry==0) {
for(u = 0, naccessed = 1; u < layout->u.chunk.ndims; u++) {
/* The location and size of the chunk being accessed */
- chunk_offset[u] = idx_cur[u] * (hssize_t)(layout->u.chunk.dim[u]);
+ chunk_offset[u] = idx_cur[u] * layout->u.chunk.dim[u];
sub_size[u] = MIN((idx_cur[u] + 1) * layout->u.chunk.dim[u],
size[u]) - chunk_offset[u];
naccessed *= sub_size[u];
@@ -3125,7 +3126,7 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
* Figure out what chunks have to be initialized. These are the chunks where the dataspace
* extent boundary is within the chunk
*/
- for(u = 0, found = 0; u < layout->u.chunk.ndims - 1; u++) {
+ for(u = 0, found = 0; u < rank; u++) {
end_chunk = chunk_offset[u] + layout->u.chunk.dim[u];
if(end_chunk > size[u]) {
found = 1;
@@ -3141,28 +3142,28 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
store.chunk.offset=chunk_offset;
if(NULL == (chunk = H5D_istore_lock(io_info, NULL, FALSE, &idx_hint)))
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk")
if(H5S_select_all(space_chunk,1) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to select space");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to select space")
for(u = 0; u < rank; u++)
count[u] = MIN((idx_cur[u] + 1) * layout->u.chunk.dim[u], size[u] - chunk_offset[u]);
#ifdef H5D_ISTORE_DEBUG
HDfputs("cache:initialize:offset:[", stdout);
- for(u = 0; u < layout->u.chunk.ndims - 1; u++)
+ for(u = 0; u < rank; u++)
HDfprintf(stdout, "%s%Hd", u ? ", " : "", chunk_offset[u]);
HDfputs("]", stdout);
HDfputs(":count:[", stdout);
- for(u = 0; u < layout->u.chunk.ndims - 1; u++)
+ for(u = 0; u < rank; u++)
HDfprintf(stdout, "%s%Hd", u ? ", " : "", count[u]);
HDfputs("]\n", stdout);
#endif
if(H5S_select_hyperslab(space_chunk, H5S_SELECT_NOTB, start, NULL,
count, NULL) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to select hyperslab");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to select hyperslab")
/* Fill the selection in the memory buffer */
/* Use the size of the elements in the chunk directly instead of */
@@ -3170,14 +3171,14 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
/* no fill-value defined for the dataset -QAK */
H5_CHECK_OVERFLOW(size[rank],hsize_t,size_t);
if(H5S_select_fill(fill.buf, (size_t)size[rank], space_chunk, chunk) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed");
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed")
if(H5D_istore_unlock(io_info, TRUE, idx_hint, chunk, (size_t)naccessed) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to unlock raw data chunk");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to unlock raw data chunk")
} /*found */
/* Increment indices */
- for(i = layout->u.chunk.ndims - 1, carry = 1; i >= 0 && carry; --i) {
+ for(i = (int)rank, carry = 1; i >= 0 && carry; --i) {
if(++idx_cur[i] >= idx_max[i])
idx_cur[i] = 0;
else
@@ -3187,9 +3188,10 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
done:
if(space_chunk)
- H5S_close(space_chunk);
+ if(H5S_close(space_chunk)<0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_initialize_by_extent() */
@@ -3213,7 +3215,7 @@ H5D_istore_delete(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_istore_delete, FAIL);
+ FUNC_ENTER_NOAPI(H5D_istore_delete, FAIL)
/* Check if the B-tree has been created in the file */
if(H5F_addr_defined(layout->u.chunk.addr)) {
@@ -3230,15 +3232,15 @@ H5D_istore_delete(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout)
/* Delete entire B-tree */
if(H5B_delete(f, dxpl_id, H5B_ISTORE, tmp_layout.u.chunk.addr, &udata)<0)
- HGOTO_ERROR(H5E_IO, H5E_CANTDELETE, 0, "unable to delete chunk B-tree");
+ HGOTO_ERROR(H5E_IO, H5E_CANTDELETE, 0, "unable to delete chunk B-tree")
/* Free the raw B-tree node buffer */
if(H5RC_DEC(tmp_layout.u.chunk.btree_shared)<0)
- HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page");
+ HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
} /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_delete() */
@@ -3267,7 +3269,6 @@ H5D_istore_update_cache(H5D_t *dset, hid_t dxpl_id)
H5D_rdcc_ent_t *old_ent; /* Old cache entry */
H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
H5D_dxpl_cache_t *dxpl_cache=&_dxpl_cache; /* Data transfer property cache */
- int srank; /*current # of dimensions (signed) */
unsigned rank; /*current # of dimensions */
hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /*current dataspace dimensions */
hsize_t chunks[H5O_LAYOUT_NDIMS]; /*current number of chunks in each dimension */
@@ -3277,16 +3278,16 @@ H5D_istore_update_cache(H5D_t *dset, hid_t dxpl_id)
unsigned u; /*counters */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_istore_update_cache, FAIL);
+ FUNC_ENTER_NOAPI(H5D_istore_update_cache, FAIL)
/* Check args */
assert(dset && H5D_CHUNKED == dset->shared->layout.type);
assert(dset->shared->layout.u.chunk.ndims > 0 && dset->shared->layout.u.chunk.ndims <= H5O_LAYOUT_NDIMS);
/* Go get the rank & dimensions */
- if((srank = H5S_get_simple_extent_dims(dset->shared->space, curr_dims, NULL)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions");
- H5_ASSIGN_OVERFLOW(rank,srank,int,unsigned);
+ rank = dset->shared->layout.u.chunk.ndims-1;
+ if(H5S_get_simple_extent_dims(dset->shared->space, curr_dims, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions")
/* Round up to the next integer # of chunks, to accomodate partial chunks */
for(u = 0; u < rank; u++)
@@ -3327,7 +3328,7 @@ H5D_istore_update_cache(H5D_t *dset, hid_t dxpl_id)
/* Remove the old entry from the cache */
if (H5D_istore_preempt(&io_info, old_ent, TRUE )<0)
- HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks");
+ HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
} /* end if */
/* Insert this chunk into correct location in hash table */
@@ -3339,7 +3340,7 @@ H5D_istore_update_cache(H5D_t *dset, hid_t dxpl_id)
} /* end for */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_istore_update_cache() */
@@ -3368,7 +3369,7 @@ H5D_istore_dump_btree(H5F_t *f, hid_t dxpl_id, FILE *stream, unsigned ndims, had
H5D_istore_ud1_t udata;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_istore_dump_btree, FAIL);
+ FUNC_ENTER_NOAPI(H5D_istore_dump_btree, FAIL)
HDmemset(&udata, 0, sizeof udata);
layout.u.chunk.ndims = ndims;
@@ -3377,10 +3378,10 @@ H5D_istore_dump_btree(H5F_t *f, hid_t dxpl_id, FILE *stream, unsigned ndims, had
if(stream)
HDfprintf(stream, " Address: %a\n",addr);
if(H5B_iterate(f, dxpl_id, H5B_ISTORE, H5D_istore_iter_dump, addr, &udata)<0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over chunk B-tree");
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over chunk B-tree")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_dump_btree() */
#ifdef H5D_ISTORE_DEBUG
@@ -3409,10 +3410,10 @@ H5D_istore_stats (H5D_t *dset, hbool_t headers)
char ascii[32];
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_istore_stats, FAIL);
+ FUNC_ENTER_NOAPI(H5D_istore_stats, FAIL)
if (!H5DEBUG(AC))
- HGOTO_DONE(SUCCEED);
+ HGOTO_DONE(SUCCEED)
if (headers) {
fprintf(H5DEBUG(AC), "H5D: raw data cache statistics\n");
@@ -3445,7 +3446,7 @@ H5D_istore_stats (H5D_t *dset, hbool_t headers)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_stats() */
#endif /* H5D_ISTORE_DEBUG */
@@ -3467,13 +3468,13 @@ done:
*/
herr_t
H5D_istore_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
- int fwidth, int ndims)
+ int fwidth, unsigned ndims)
{
H5O_layout_t layout;
H5D_istore_ud1_t udata;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_istore_debug,FAIL);
+ FUNC_ENTER_NOAPI(H5D_istore_debug,FAIL)
layout.u.chunk.ndims = ndims;
HDmemset (&udata, 0, sizeof udata);
@@ -3483,12 +3484,12 @@ H5D_istore_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int inden
if(H5D_istore_shared_create(f, &layout)<0)
HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info")
- H5B_debug (f, dxpl_id, addr, stream, indent, fwidth, H5B_ISTORE, &udata);
+ (void)H5B_debug (f, dxpl_id, addr, stream, indent, fwidth, H5B_ISTORE, &udata);
/* Free the raw B-tree node buffer */
if(H5RC_DEC(layout.u.chunk.btree_shared)<0)
- HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page");
+ HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_debug() */
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index 1b4d21b..9d1f65c 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -110,7 +110,7 @@ H5D_mpio_opt_possible( const H5D_t *dset, const H5S_t *mem_space, const H5S_t *f
if ((flags&H5S_CONV_STORAGE_MASK)==H5S_CONV_STORAGE_CHUNKED) {
hsize_t chunk_dim[H5O_LAYOUT_NDIMS]; /* Chunk dimensions */
- hssize_t startf[H5S_MAX_RANK], /* Selection start bounds */
+ hsize_t startf[H5S_MAX_RANK], /* Selection start bounds */
endf[H5S_MAX_RANK]; /* Selection end bounds */
unsigned dim_rankf; /* Number of dimensions of file dataspace */
int pcheck_hyper,check_hyper, /* Flags for checking if selection is in one chunk */
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 68c8742..a4b4574 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -78,11 +78,11 @@ typedef herr_t (*H5D_io_write_func_t)(struct H5D_io_info_t *io_info,
const void *buf);
/* Function pointers for I/O on particular types of dataset layouts */
-typedef ssize_t (*H5D_io_readvv_func_t)(struct H5D_io_info_t *io_info,
+typedef ssize_t (*H5D_io_readvv_func_t)(const struct H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
void *buf);
-typedef ssize_t (*H5D_io_writevv_func_t)(struct H5D_io_info_t *io_info,
+typedef ssize_t (*H5D_io_writevv_func_t)(const struct H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
const void *buf);
@@ -217,21 +217,21 @@ H5_DLL herr_t H5D_select_write(H5D_io_info_t *io_info,
H5_DLL herr_t H5D_contig_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout);
H5_DLL herr_t H5D_contig_fill(H5D_t *dset, hid_t dxpl_id);
H5_DLL haddr_t H5D_contig_get_addr(const H5D_t *dset);
-H5_DLL ssize_t H5D_contig_readvv(H5D_io_info_t *io_info,
+H5_DLL ssize_t H5D_contig_readvv(const H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
void *buf);
-H5_DLL ssize_t H5D_contig_writevv(H5D_io_info_t *io_info,
+H5_DLL ssize_t H5D_contig_writevv(const H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
const void *buf);
/* Functions that operate on compact dataset storage */
-H5_DLL ssize_t H5D_compact_readvv(H5D_io_info_t *io_info,
+H5_DLL ssize_t H5D_compact_readvv(const H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[],
void *buf);
-H5_DLL ssize_t H5D_compact_writevv(H5D_io_info_t *io_info,
+H5_DLL ssize_t H5D_compact_writevv(const H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[],
const void *buf);
@@ -239,14 +239,14 @@ H5_DLL ssize_t H5D_compact_writevv(H5D_io_info_t *io_info,
/* Functions that operate on indexed storage */
/* forward reference for collective-chunk IO use */
struct H5D_istore_ud1_t; /*define in H5Distore.c*/
-H5_DLL herr_t H5D_istore_init (const H5F_t *f, H5D_t *dset);
+H5_DLL herr_t H5D_istore_init (const H5F_t *f, const H5D_t *dset);
H5_DLL herr_t H5D_istore_flush (H5D_t *dset, hid_t dxpl_id, unsigned flags);
H5_DLL herr_t H5D_istore_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout);
H5_DLL herr_t H5D_istore_dest (H5D_t *dset, hid_t dxpl_id);
H5_DLL herr_t H5D_istore_allocate (H5D_t *dset, hid_t dxpl_id,
hbool_t full_overwrite);
H5_DLL hsize_t H5D_istore_allocated(H5D_t *dset, hid_t dxpl_id);
-H5_DLL herr_t H5D_istore_prune_by_extent(H5D_io_info_t *io_info);
+H5_DLL herr_t H5D_istore_prune_by_extent(const H5D_io_info_t *io_info);
H5_DLL herr_t H5D_istore_initialize_by_extent(H5D_io_info_t *io_info);
H5_DLL herr_t H5D_istore_update_cache(H5D_t *dset, hid_t dxpl_id);
H5_DLL herr_t H5D_istore_dump_btree(H5F_t *f, hid_t dxpl_id, FILE *stream, unsigned ndims,
@@ -254,23 +254,23 @@ H5_DLL herr_t H5D_istore_dump_btree(H5F_t *f, hid_t dxpl_id, FILE *stream, unsig
#ifdef H5D_ISTORE_DEBUG
H5_DLL herr_t H5D_istore_stats (H5D_t *dset, hbool_t headers);
#endif /* H5D_ISTORE_DEBUG */
-H5_DLL ssize_t H5D_istore_readvv(H5D_io_info_t *io_info,
+H5_DLL ssize_t H5D_istore_readvv(const H5D_io_info_t *io_info,
size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
void *buf);
-H5_DLL ssize_t H5D_istore_writevv(H5D_io_info_t *io_info,
+H5_DLL ssize_t H5D_istore_writevv(const H5D_io_info_t *io_info,
size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
const void *buf);
-H5_DLL haddr_t H5D_istore_get_addr(H5D_io_info_t *io_info,
+H5_DLL haddr_t H5D_istore_get_addr(const H5D_io_info_t *io_info,
struct H5D_istore_ud1_t *_udata);
/* Functions that operate on external file list (efl) storage */
-H5_DLL ssize_t H5D_efl_readvv(H5D_io_info_t *io_info,
+H5_DLL ssize_t H5D_efl_readvv(const H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
void *buf);
-H5_DLL ssize_t H5D_efl_writevv(H5D_io_info_t *io_info,
+H5_DLL ssize_t H5D_efl_writevv(const H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
const void *buf);
@@ -302,7 +302,7 @@ H5_DLL herr_t H5D_mpio_spaces_span_write(H5D_io_info_t *io_info,
/* MPI-IO function to check if a direct I/O transfer is possible between
* memory and the file */
-H5_DLL htri_t H5D_mpio_opt_possible(const H5D_t *file, const H5S_t *mem_space,
+H5_DLL htri_t H5D_mpio_opt_possible(const H5D_t *dset, const H5S_t *mem_space,
const H5S_t *file_space, const unsigned flags);
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index 4479c37..d6d2333 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -172,7 +172,7 @@ typedef struct H5D_t H5D_t;
/* Typedef for dataset storage information */
typedef struct {
hsize_t index; /* "Index" of chunk in dataset (must be first for TBBT routines) */
- hssize_t *offset; /* Chunk's coordinates in elements */
+ hsize_t *offset; /* Chunk's coordinates in elements */
} H5D_chunk_storage_t;
typedef struct {
@@ -211,7 +211,7 @@ typedef struct H5D_dcpl_cache_t {
/* Library-private functions defined in H5D package */
H5_DLL herr_t H5D_init(void);
-H5_DLL H5D_t *H5D_open(H5G_entry_t *ent, hid_t dxpl_id);
+H5_DLL H5D_t *H5D_open(const H5G_entry_t *ent, hid_t dxpl_id);
H5_DLL herr_t H5D_close(H5D_t *dataset);
H5_DLL htri_t H5D_isa(H5G_entry_t *ent, hid_t dxpl_id);
H5_DLL H5G_entry_t *H5D_entof(H5D_t *dataset);
@@ -223,7 +223,7 @@ H5_DLL herr_t H5D_xfer_create(hid_t dxpl_id, void *create_data);
H5_DLL herr_t H5D_xfer_copy(hid_t new_plist_id, hid_t old_plist_id,
void *copy_data);
H5_DLL herr_t H5D_xfer_close(hid_t dxpl_id, void *close_data);
-H5_DLL herr_t H5D_flush(H5F_t *f, hid_t dxpl_id, unsigned flags);
+H5_DLL herr_t H5D_flush(const H5F_t *f, hid_t dxpl_id, unsigned flags);
H5_DLL herr_t H5D_get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t **cache);
H5_DLL herr_t H5D_get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache);
@@ -235,6 +235,6 @@ H5_DLL herr_t H5D_contig_delete(H5F_t *f, hid_t dxpl_id,
H5_DLL herr_t H5D_istore_delete(H5F_t *f, hid_t dxpl_id,
const H5O_layout_t *layout);
H5_DLL herr_t H5D_istore_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream,
- int indent, int fwidth, int ndims);
+ int indent, int fwidth, unsigned ndims);
#endif
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index ec576fe..09556c2 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -70,8 +70,8 @@ extern "C" {
#endif
/* Define the operator function pointer for H5Diterate() */
-typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, hsize_t ndim,
- hssize_t *point, void *operator_data);
+typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim,
+ const hsize_t *point, void *operator_data);
H5_DLL hid_t H5Dcreate (hid_t file_id, const char *name, hid_t type_id,
hid_t space_id, hid_t plist_id);
diff --git a/src/H5E.c b/src/H5E.c
index a712645..47c86df 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -169,15 +169,15 @@ H5E_init_interface(void)
/* Initialize the atom group for the error class IDs */
if(H5I_register_type(H5I_ERROR_CLASS, H5I_ERRCLS_HASHSIZE, H5E_RESERVED_ATOMS,
- (H5I_free_t)H5E_unregister_class)<0)
+ (H5I_free_t)H5E_unregister_class)<H5I_FILE)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
/* Initialize the atom group for the major error IDs */
if(H5I_register_type(H5I_ERROR_MSG, H5I_ERRMSG_HASHSIZE, H5E_RESERVED_ATOMS,
- (H5I_free_t)H5E_close_msg)<0)
+ (H5I_free_t)H5E_close_msg)<H5I_FILE)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
/* Initialize the atom group for the error stacks */
if(H5I_register_type(H5I_ERROR_STACK, H5I_ERRSTK_HASHSIZE, H5E_RESERVED_ATOMS,
- (H5I_free_t)H5E_close_stack)<0)
+ (H5I_free_t)H5E_close_stack)<H5I_FILE)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
#ifndef H5_HAVE_THREADSAFE
@@ -809,7 +809,7 @@ H5Eget_major(H5E_major_t maj)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a major one");
/* Don't know who is going to free it */
- msg_str = (char*)H5MM_malloc((++size)*sizeof(char));
+ msg_str = (char*)H5MM_malloc((size_t)(++size)*sizeof(char));
if(H5E_get_msg(msg, NULL, msg_str, (size_t)size)<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
@@ -859,7 +859,7 @@ H5Eget_minor(H5E_minor_t min)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a minor one");
/* Don't know who is going to free it */
- msg_str = (char*)H5MM_malloc((++size)*sizeof(char));
+ msg_str = (char*)H5MM_malloc((size_t)(++size)*sizeof(char));
if(H5E_get_msg(msg, NULL, msg_str, (size_t)size)<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
diff --git a/src/H5Epublic.h b/src/H5Epublic.h
index d5581dd..461bc08 100644
--- a/src/H5Epublic.h
+++ b/src/H5Epublic.h
@@ -51,13 +51,13 @@ typedef struct H5E_error_t {
const char *desc; /*optional supplied description */
} H5E_error_t;
-/* When this header is included from H5Eprivate.h, don't make calls to H5open() */
+/* When this header is included from a private header, don't make calls to H5open() */
#undef H5OPEN
-#ifndef _H5Eprivate_H
+#ifndef _H5private_H
#define H5OPEN H5open(),
-#else /* _H5Eprivate_H */
+#else /* _H5private_H */
#define H5OPEN
-#endif /* _H5Eprivate_H */
+#endif /* _H5private_H */
/* HDF5 error class */
#define H5E_ERR_CLS (H5OPEN H5E_ERR_CLS_g)
diff --git a/src/H5F.c b/src/H5F.c
index 798a28e..9a83ca2 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -69,7 +69,7 @@ static herr_t H5F_flush_all(hbool_t invalidate);
static int H5F_flush_all_cb(void *f, hid_t fid, void *_invalidate);
#endif /* NOT_YET */
-static hsize_t H5F_init_superblock(H5F_t *f, hid_t dxpl_id);
+static hsize_t H5F_init_superblock(const H5F_t *f, hid_t dxpl_id);
static herr_t H5F_write_superblock(H5F_t *f, hid_t dxpl_id, uint8_t *buf);
static herr_t H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr, uint8_t *buf, size_t buf_size);
@@ -87,9 +87,6 @@ H5FL_DEFINE_STATIC(H5F_t);
/* Declare a free list to manage the H5F_file_t struct */
H5FL_DEFINE_STATIC(H5F_file_t);
-/* Declare the external free list for the H5G_t struct */
-H5FL_EXTERN(H5G_t);
-
/*-------------------------------------------------------------------------
* Function: H5F_init
@@ -229,8 +226,8 @@ H5F_init_interface(void)
* which are pending completion because there are object headers still
* open within the file.
*/
- if (H5I_register_type(H5I_FILE, H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<0 ||
- H5I_register_type(H5I_FILE_CLOSING, H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<0)
+ if (H5I_register_type(H5I_FILE, H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<H5I_FILE ||
+ H5I_register_type(H5I_FILE_CLOSING, H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<H5I_FILE)
HGOTO_ERROR (H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* ========== File Creation Property Class Initialization ============*/
@@ -429,7 +426,7 @@ H5F_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_term_interface)
if (H5_interface_initialize_g) {
- if ((n=H5I_nmembers(H5I_FILE))) {
+ if ((n=H5I_nmembers(H5I_FILE))!=0) {
H5I_clear_type(H5I_FILE, FALSE);
} else if (0==(n=H5I_nmembers(H5I_FILE_CLOSING))) {
H5I_dec_type_ref(H5I_FILE);
@@ -1564,7 +1561,10 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
} /* end if */
/* Free the memory for the root group */
- H5G_free(f->shared->root_grp);
+ if(H5G_free(f->shared->root_grp)<0) {
+ HERROR(H5E_FILE, H5E_CANTRELEASE, "problems closing file");
+ ret_value = FAIL; /*but keep going*/
+ } /* end if */
f->shared->root_grp=NULL;
}
if (H5AC_dest(f, dxpl_id)) {
@@ -1712,7 +1712,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
hbool_t driver_has_cmp; /*`cmp' callback defined? */
H5P_genplist_t *a_plist; /*file access property list */
H5F_close_degree_t fc_degree; /*file close degree */
- H5F_t *ret_value = NULL; /*actual return value */
+ H5F_t *ret_value; /*actual return value */
FUNC_ENTER_NOAPI(H5F_open, NULL)
@@ -1755,8 +1755,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
} /* end if */
/* Is the file already open? */
- if ((file=H5I_search(H5I_FILE, H5F_equal, lf)) ||
- (file=H5I_search(H5I_FILE_CLOSING, H5F_equal, lf))) {
+ if ((file=H5I_search(H5I_FILE, H5F_equal, lf))!=NULL ||
+ (file=H5I_search(H5I_FILE_CLOSING, H5F_equal, lf))!=NULL) {
/*
* The file is already open, so use that one instead of the one we
* just opened. We only one one H5FD_t* per file so one doesn't
@@ -1835,7 +1835,9 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
* empty or not.
*/
if (0==H5FD_get_eof(lf) && (flags & H5F_ACC_RDWR)) {
+#ifdef H5_HAVE_FPHDF5
hsize_t buf_size=0; /* Size of buffer needed to hold superblock info */
+#endif /* H5_HAVE_FPHDF5 */
void *buf=NULL; /* Buffer to hold superblock info */
/*
@@ -1846,7 +1848,11 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
if (!H5FD_is_fphdf5_driver(lf) || H5FD_fphdf5_is_captain(lf)) {
#endif /* H5_HAVE_FPHDF5 */
/* Initialize information about the superblock and allocate space for it */
- if ((buf_size=H5F_init_superblock(file, dxpl_id)) == 0)
+ if ((
+#ifdef H5_HAVE_FPHDF5
+ buf_size=
+#endif /* H5_HAVE_FPHDF5 */
+ H5F_init_superblock(file, dxpl_id)) == 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to allocate file superblock")
/* Create and open the root group */
@@ -1938,10 +1944,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
#endif /* H5_HAVE_FPHDF5 */
/* Read the superblock if it hasn't been read before. */
- if (HADDR_UNDEF == (shared->super_addr = H5F_locate_signature(lf,dxpl_id)))
- HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, NULL, "unable to find file signature")
-
- if (H5F_read_superblock(file, dxpl_id, &root_ent, shared->super_addr, NULL, 0) < 0)
+ if (H5F_read_superblock(file, dxpl_id, &root_ent, HADDR_UNDEF, NULL, 0) < 0)
HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock")
#ifdef H5_HAVE_FPHDF5
@@ -1957,7 +1960,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
#endif /* H5_HAVE_FPHDF5 */
/* Make sure we can open the root group */
- if (H5G_mkroot(file, dxpl_id, &root_ent) < 0)
+ if (H5G_mkroot(file, dxpl_id, &root_ent)<0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root group")
}
@@ -2361,25 +2364,20 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr
/* Superblock version */
super_vers = *p++;
-
if (super_vers > HDF5_SUPERBLOCK_VERSION_MAX)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad superblock version number")
-
if (H5P_set(c_plist, H5F_CRT_SUPER_VERS_NAME, &super_vers) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set superblock version")
/* Freespace version */
freespace_vers = *p++;
-
if (HDF5_FREESPACE_VERSION != freespace_vers)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad free space version number")
-
if (H5P_set(c_plist, H5F_CRT_FREESPACE_VERS_NAME, &freespace_vers) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to free space version")
/* Root group version number */
obj_dir_vers = *p++;
-
if (HDF5_OBJECTDIR_VERSION != obj_dir_vers)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad object directory version number")
if (H5P_set(c_plist, H5F_CRT_OBJ_DIR_VERS_NAME, &obj_dir_vers) < 0)
@@ -2390,35 +2388,27 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr
/* Shared header version number */
share_head_vers = *p++;
-
if (HDF5_SHAREDHEADER_VERSION != share_head_vers)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad shared-header format version number")
-
if (H5P_set(c_plist, H5F_CRT_SHARE_HEAD_VERS_NAME, &share_head_vers) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set shared-header format version")
/* Size of file addresses */
sizeof_addr = *p++;
-
if (sizeof_addr != 2 && sizeof_addr != 4 &&
sizeof_addr != 8 && sizeof_addr != 16 && sizeof_addr != 32)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad byte number in an address")
-
if (H5P_set(c_plist, H5F_CRT_ADDR_BYTE_NUM_NAME,&sizeof_addr) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set byte number in an address")
-
shared->sizeof_addr = sizeof_addr; /* Keep a local copy also */
/* Size of file sizes */
sizeof_size = *p++;
-
if (sizeof_size != 2 && sizeof_size != 4 &&
sizeof_size != 8 && sizeof_size != 16 && sizeof_size != 32)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad byte number for object size")
-
if (H5P_set(c_plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &sizeof_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set byte number for object size")
-
shared->sizeof_size = sizeof_size; /* Keep a local copy also */
/* Skip over reserved byte */
@@ -2426,24 +2416,18 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr
/* Various B-tree sizes */
UINT16DECODE(p, sym_leaf_k);
-
- if (sym_leaf_k < 1)
+ if (sym_leaf_k == 0)
HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "bad symbol table leaf node 1/2 rank")
-
if (H5P_set(c_plist, H5F_CRT_SYM_LEAF_NAME, &sym_leaf_k) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set rank for symbol table leaf nodes")
-
shared->sym_leaf_k = sym_leaf_k; /* Keep a local copy also */
/* Need 'get' call to set other array values */
if (H5P_get(c_plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get rank for btree internal nodes")
-
UINT16DECODE(p, btree_k[H5B_SNODE_ID]);
-
- if (btree_k[H5B_SNODE_ID] < 1)
+ if (btree_k[H5B_SNODE_ID] == 0)
HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "bad 1/2 rank for btree internal nodes")
-
/*
* Delay setting the value in the property list until we've checked
* for the indexed storage B-tree internal 'K' value later.
@@ -2477,21 +2461,19 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr
if (super_vers > 0) {
UINT16DECODE(p, btree_k[H5B_ISTORE_ID]);
p += 2; /* reserved */
- } else {
- btree_k[H5B_ISTORE_ID] = HDF5_BTREE_ISTORE_IK_DEF;
}
+ else
+ btree_k[H5B_ISTORE_ID] = HDF5_BTREE_ISTORE_IK_DEF;
/* Set the B-tree internal node values, etc */
if (H5P_set(c_plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set rank for btree internal nodes")
-
- HDmemcpy(shared->btree_k, btree_k, sizeof(unsigned) * H5B_NUM_BTREE_ID); /* Keep a local copy also */
+ HDmemcpy(shared->btree_k, btree_k, sizeof(unsigned) * (size_t)H5B_NUM_BTREE_ID); /* Keep a local copy also */
H5F_addr_decode(f, (const uint8_t **)&p, &shared->base_addr/*out*/);
H5F_addr_decode(f, (const uint8_t **)&p, &shared->freespace_addr/*out*/);
H5F_addr_decode(f, (const uint8_t **)&p, &stored_eoa/*out*/);
H5F_addr_decode(f, (const uint8_t **)&p, &shared->driver_addr/*out*/);
-
if (H5G_ent_decode(f, (const uint8_t **)&p, root_ent/*out*/) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read root symbol entry")
@@ -2512,7 +2494,6 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr
/* Compute super block checksum */
assert(sizeof(chksum) == sizeof(shared->super_chksum));
-
for (q = (uint8_t *)&chksum, chksum = 0, i = 0; i < fixed_size + variable_size; ++i)
q[i % sizeof(shared->super_chksum)] ^= start_p[i];
@@ -2567,7 +2548,6 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr
/* Compute driver info block checksum */
assert(sizeof(chksum) == sizeof(shared->drvr_chksum));
-
for (q = (uint8_t *)&chksum, chksum = 0, i = 0; i < (driver_size + 16); ++i)
q[i % sizeof(shared->drvr_chksum)] ^= driver_p[i];
@@ -2627,7 +2607,7 @@ done:
*-------------------------------------------------------------------------
*/
static hsize_t
-H5F_init_superblock(H5F_t *f, hid_t dxpl_id)
+H5F_init_superblock(const H5F_t *f, hid_t dxpl_id)
{
hsize_t userblock_size = 0; /* Size of userblock, in bytes */
size_t superblock_size; /* Size of superblock, in bytes */
@@ -2793,7 +2773,6 @@ H5F_write_superblock(H5F_t *f, hid_t dxpl_id, uint8_t *buf)
H5F_addr_encode(f, &p, f->shared->freespace_addr);
H5F_addr_encode(f, &p, H5FD_get_eoa(f->shared->lf));
H5F_addr_encode(f, &p, f->shared->driver_addr);
-
if(H5G_ent_encode(f, &p, H5G_entof(f->shared->root_grp))<0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode root group information")
@@ -2845,7 +2824,7 @@ H5F_write_superblock(H5F_t *f, hid_t dxpl_id, uint8_t *buf)
/* Update checksum information if different */
f->shared->super_chksum = chksum;
- }
+ } /* end if */
/* Check for driver info block */
if (HADDR_UNDEF != f->shared->driver_addr) {
@@ -3038,7 +3017,7 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags)
/* Write the superblock to disk */
if (H5F_write_superblock(f, dxpl_id, NULL) != SUCCEED)
- HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "unable to superblock to file")
+ HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "unable to write superblock to file")
/* Flush file buffers to disk. */
if (H5FD_flush(f->shared->lf, dxpl_id,
@@ -3227,7 +3206,7 @@ H5F_close(H5F_t *f)
int i; /* Local index variable */
/* Get the list of IDs of open dataset objects */
- while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_DATASET, (sizeof(objs)/sizeof(objs[0])), objs))) {
+ while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_DATASET, (sizeof(objs)/sizeof(objs[0])), objs))!=0) {
/* Try to close all the open objects */
for(i=0; i<obj_count; i++)
@@ -3236,7 +3215,7 @@ H5F_close(H5F_t *f)
} /* end while */
/* Get the list of IDs of open group objects */
- while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_GROUP, (sizeof(objs)/sizeof(objs[0])), objs))) {
+ while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_GROUP, (sizeof(objs)/sizeof(objs[0])), objs))!=0) {
/* Try to close all the open objects */
for(i=0; i<obj_count; i++)
@@ -3245,7 +3224,7 @@ H5F_close(H5F_t *f)
} /* end while */
/* Get the list of IDs of open named datatype objects */
- while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_DATATYPE, (sizeof(objs)/sizeof(objs[0])), objs))) {
+ while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_DATATYPE, (sizeof(objs)/sizeof(objs[0])), objs))!=0) {
/* Try to close all the open objects */
for(i=0; i<obj_count; i++)
@@ -3254,7 +3233,7 @@ H5F_close(H5F_t *f)
} /* end while */
/* Get the list of IDs of open attribute objects */
- while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_ATTR, (sizeof(objs)/sizeof(objs[0])), objs))) {
+ while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_ATTR, (sizeof(objs)/sizeof(objs[0])), objs))!=0) {
/* Try to close all the open objects */
for(i=0; i<obj_count; i++)
@@ -3419,7 +3398,7 @@ H5F_mount(H5G_entry_t *loc, const char *name, H5F_t *child,
if (child->mtab.parent)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "file is already mounted")
if (H5G_find(loc, name, NULL, &mp_open_ent/*out*/, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found");
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found")
if (NULL==(mount_point=H5G_open(&mp_open_ent, dxpl_id)))
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point not found")
@@ -3542,7 +3521,7 @@ H5F_unmount(H5G_entry_t *loc, const char *name, hid_t dxpl_id)
* then we must have found the mount point.
*/
if (H5G_find(loc, name, NULL, &mnt_open_ent/*out*/, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found");
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found")
if (NULL==(mounted=H5G_open(&mnt_open_ent, dxpl_id)))
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point not found")
child = H5G_fileof(mounted);
@@ -4188,7 +4167,7 @@ hbool_t H5F_has_feature(const H5F_t *f, unsigned feature)
assert(f);
assert(f->shared);
- FUNC_LEAVE_NOAPI(f->shared->lf->feature_flags&feature);
+ FUNC_LEAVE_NOAPI((hbool_t)(f->shared->lf->feature_flags&feature))
} /* end H5F_has_feature() */
@@ -4295,7 +4274,7 @@ H5F_get_id(H5F_t *file)
} else {
/* Increment reference count on atom. */
if (H5I_inc_ref(file->file_id)<0)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed");
+ HGOTO_ERROR (H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed")
}
ret_value = file->file_id;
@@ -4784,7 +4763,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size)
size_t len=0;
ssize_t ret_value;
- FUNC_ENTER_API (H5Fget_name, FAIL);
+ FUNC_ENTER_API (H5Fget_name, FAIL)
H5TRACE3("Zs","ixz",obj_id,name,size);
/* get symbol table entry */
@@ -4803,5 +4782,5 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size)
ret_value=(ssize_t)len;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Fget_name() */
diff --git a/src/H5FD.c b/src/H5FD.c
index 2c5465b..30ec0eb 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -50,7 +50,7 @@
#include "H5FDstream.h" /* In-memory files streamed via sockets */
#include "H5FLprivate.h" /* Free lists */
#ifdef H5_HAVE_FPHDF5
-#include "H5FPprivate.h" /*Flexible Parallel HDF5 */
+#include "H5FPprivate.h" /* Flexible Parallel HDF5 */
#endif /* H5_HAVE_FPHDF5 */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
@@ -121,7 +121,7 @@ H5FD_init_interface(void)
FUNC_ENTER_NOAPI_NOINIT(H5FD_init_interface)
- if (H5I_register_type(H5I_VFL, H5I_VFL_HASHSIZE, 0, (H5I_free_t)H5FD_free_cls)<0)
+ if (H5I_register_type(H5I_VFL, H5I_VFL_HASHSIZE, 0, (H5I_free_t)H5FD_free_cls)<H5I_FILE)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* Reset the file serial numbers */
@@ -160,7 +160,7 @@ H5FD_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_term_interface)
if (H5_interface_initialize_g) {
- if ((n=H5I_nmembers(H5I_VFL))) {
+ if ((n=H5I_nmembers(H5I_VFL))!=0) {
H5I_clear_type(H5I_VFL, FALSE);
/* Reset the VFL drivers, if they've been closed */
@@ -634,7 +634,8 @@ H5FD_pl_close(hid_t driver_id, herr_t (*free_func)(void *), void *pl)
H5MM_xfree(pl);
/* Decrement reference count for driver */
- H5I_dec_ref(driver_id);
+ if(H5I_dec_ref(driver_id)<0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't decrement reference count for driver")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1472,7 +1473,7 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* Check args */
if (!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
- if (type<0 || type>=H5FD_MEM_NTYPES)
+ if (type<H5FD_MEM_DEFAULT || type>=H5FD_MEM_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid request type")
if (size==0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request")
@@ -1533,7 +1534,7 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* check args */
assert(file);
assert(file->cls);
- assert(type >= 0 && type < H5FD_MEM_NTYPES);
+ assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
assert(size > 0);
#ifdef H5_HAVE_FPHDF5
@@ -1614,7 +1615,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type,
FUNC_ENTER_NOAPI(H5FD_alloc_from_free_list, HADDR_UNDEF)
assert(file);
- assert(type >= 0 && type < H5FD_MEM_NTYPES);
+ assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
assert(size > 0);
/*
@@ -1636,7 +1637,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type,
* 2. block address is aligned with smallest size > requested size;
* 3. block address is not aligned with smallest size >= requested size.
*/
- if (mapped_type >= 0 && (file->maxsize == 0 || size <= file->maxsize)) {
+ if (mapped_type >= H5FD_MEM_DEFAULT && (file->maxsize == 0 || size <= file->maxsize)) {
H5FD_free_t *prev = NULL, *best = NULL;
H5FD_free_t *cur = file->fl[mapped_type];
int found_aligned = 0;
@@ -1792,7 +1793,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type,
if((tmp = H5FL_MALLOC(H5FD_free_t))==NULL)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "free block allocation failed")
- if ((tmp->size = (best->size - (head + size)))) {
+ if ((tmp->size = (best->size - (head + size)))!=0) {
tmp->addr = best->addr + (head + size);
tmp->next = best->next;
best->next = tmp;
@@ -1836,7 +1837,7 @@ H5FD_alloc_metadata(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* check args */
assert(file);
- assert(type >= 0 && type < H5FD_MEM_NTYPES);
+ assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
assert(size > 0);
/*
@@ -1951,7 +1952,7 @@ H5FD_alloc_raw(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* check args */
assert(file);
- assert(type >= 0 && type < H5FD_MEM_NTYPES);
+ assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
assert(size > 0);
/*
@@ -2068,7 +2069,7 @@ H5FD_real_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* check args */
assert(file);
assert(file->cls);
- assert(type >= 0 && type < H5FD_MEM_NTYPES);
+ assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
assert(size > 0);
/*
@@ -2114,7 +2115,7 @@ H5FD_update_eoa(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* check args */
assert(file);
assert(file->cls);
- assert(type >= 0 && type < H5FD_MEM_NTYPES);
+ assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
assert(size > 0);
eoa = file->cls->get_eoa(file);
@@ -2206,7 +2207,7 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz
/* Check args */
if (!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
- if (type<0 || type>=H5FD_MEM_NTYPES)
+ if (type<H5FD_MEM_DEFAULT || type>=H5FD_MEM_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request type")
if (H5P_DEFAULT == dxpl_id)
dxpl_id= H5P_DATASET_XFER_DEFAULT;
@@ -2254,7 +2255,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
/* Check args */
assert(file);
assert(file->cls);
- assert(type >= 0 && type < H5FD_MEM_NTYPES);
+ assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
#ifdef H5_HAVE_FPHDF5
/*
@@ -2296,7 +2297,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
* without ever telling the driver that it was freed. Otherwise let the
* driver deallocate the memory.
*/
- if (mapped_type>=0) {
+ if (mapped_type>=H5FD_MEM_DEFAULT) {
H5FD_free_t *last; /* Last merged node */
H5FD_free_t *last_prev=NULL;/* Pointer to node before merged node */
H5FD_free_t *curr; /* Current free block being inspected */
@@ -3751,7 +3752,7 @@ done:
*-------------------------------------------------------------------------
*/
hssize_t
-H5FD_get_freespace(H5FD_t *file)
+H5FD_get_freespace(const H5FD_t *file)
{
H5FD_free_t *free_node; /* Pointer to node on free list */
H5FD_mem_t type; /* Type of memory */
@@ -3771,7 +3772,7 @@ H5FD_get_freespace(H5FD_t *file)
/* Iterate through the free list, accumulating the amount of free space for this type */
free_node = file->fl[type];
while(free_node) {
- ret_value+=free_node->size;
+ ret_value+=(hssize_t)free_node->size;
free_node=free_node->next;
} /* end while */
} /* end for */
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 100e06c..d60eca8 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -638,7 +638,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
/* Enlarge member array */
if (file->nmembs>=file->amembs) {
- int n = MAX(64, 2*file->amembs);
+ unsigned n = MAX(64, 2*file->amembs);
H5FD_t **x = H5MM_realloc(file->memb, n*sizeof(H5FD_t*));
if (!x)
@@ -911,7 +911,7 @@ H5FD_family_set_eoa(H5FD_t *_file, haddr_t eoa)
/* Enlarge member array */
if (u>=file->amembs) {
- int n = MAX(64, 2*file->amembs);
+ unsigned n = MAX(64, 2*file->amembs);
H5FD_t **x = H5MM_realloc(file->memb, n*sizeof(H5FD_t*));
if (!x)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block")
@@ -989,7 +989,7 @@ H5FD_family_get_eof(H5FD_t *_file)
*/
assert(file->nmembs>0);
for (i=(int)file->nmembs-1; i>=0; --i) {
- if ((eof=H5FD_get_eof(file->memb[i])))
+ if ((eof=H5FD_get_eof(file->memb[i]))!=0)
break;
if (0==i)
break;
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index cd1fbac..7bc3827 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -859,7 +859,7 @@ H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, hsize_t siz
if(file->fa.flags&H5FD_LOG_FLAVOR) {
assert(addr<file->iosize);
H5_CHECK_OVERFLOW(size,hsize_t,size_t);
- HDmemset(&file->flavor[addr],type,(size_t)size);
+ HDmemset(&file->flavor[addr],(int)type,(size_t)size);
} /* end if */
if(file->fa.flags&H5FD_LOG_ALLOC)
@@ -1164,8 +1164,8 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t add
assert(buf);
/* Verify that we are writing out the type of data we allocated in this location */
- assert(type==H5FD_MEM_DEFAULT || type==file->flavor[addr] || file->flavor[addr]==H5FD_MEM_DEFAULT);
- assert(type==H5FD_MEM_DEFAULT || type==file->flavor[(addr+size)-1] || file->flavor[(addr+size)-1]==H5FD_MEM_DEFAULT);
+ assert(type==H5FD_MEM_DEFAULT || type==(H5FD_mem_t)file->flavor[addr] || (H5FD_mem_t)file->flavor[addr]==H5FD_MEM_DEFAULT);
+ assert(type==H5FD_MEM_DEFAULT || type==(H5FD_mem_t)file->flavor[(addr+size)-1] || (H5FD_mem_t)file->flavor[(addr+size)-1]==H5FD_MEM_DEFAULT);
/* Check for overflow conditions */
if (HADDR_UNDEF==addr)
@@ -1266,8 +1266,8 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t add
/* Check if this is the first write into a "default" section, grabbed by the metadata agregation algorithm */
if(file->fa.flags&H5FD_LOG_FLAVOR) {
- if(file->flavor[orig_addr]==H5FD_MEM_DEFAULT)
- HDmemset(&file->flavor[orig_addr],type,orig_size);
+ if((H5FD_mem_t)file->flavor[orig_addr]==H5FD_MEM_DEFAULT)
+ HDmemset(&file->flavor[orig_addr],(int)type,orig_size);
} /* end if */
#ifdef H5_HAVE_GETTIMEOFDAY
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index d1d0b6e..e54faf6 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -30,7 +30,7 @@
/*lint --emacro( {534, 830}, H5P_DEFAULT, H5P_FILE_ACCESS, H5P_DATASET_XFER) */
/*lint --emacro( {534, 830}, H5F_ACC_DEBUG, H5F_ACC_RDWR) */
/*lint --emacro( {534, 830}, H5FD_MULTI) */
-/*lint -esym( 534, H5Eclear, H5Epush) */
+/*lint -esym( 534, H5Eclear_stack, H5Epush_stack) */
#include "hdf5.h"
@@ -1497,7 +1497,7 @@ H5FD_multi_set_eoa(H5FD_t *_file, haddr_t eoa)
status = H5FDset_eoa(file->memb[mmt], eoa-file->fa.memb_addr[mmt]);
} H5E_END_TRY;
if (status<0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1)
}
/* Save new eoa for return later */
@@ -1541,7 +1541,7 @@ H5FD_multi_get_eof(H5FD_t *_file)
tmp = H5FDget_eof(file->memb[mt]);
} H5E_END_TRY;
if (HADDR_UNDEF==tmp)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof", HADDR_UNDEF)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof", HADDR_UNDEF)
if (tmp>0) tmp += file->fa.memb_addr[mt];
} else if (file->fa.relax) {
@@ -1553,7 +1553,7 @@ H5FD_multi_get_eof(H5FD_t *_file)
assert(HADDR_UNDEF!=tmp);
} else {
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF)
}
if (tmp>eof) eof = tmp;
@@ -1623,9 +1623,8 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
mmt = file->fa.memb_map[type];
if (H5FD_MEM_DEFAULT==mmt) mmt = type;
- if (HADDR_UNDEF==(addr=H5FDalloc(file->memb[mmt], type, dxpl_id, size))) {
+ if (HADDR_UNDEF==(addr=H5FDalloc(file->memb[mmt], type, dxpl_id, size)))
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file can't alloc", HADDR_UNDEF)
- }
addr += file->fa.memb_addr[mmt];
if (addr+size>file->eoa) file->eoa = addr+size;
return addr;
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index cd8d4fe..2a412cc 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -69,7 +69,7 @@ H5_DLL herr_t H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t a
H5_DLL herr_t H5FD_flush(H5FD_t *file, hid_t dxpl_id, unsigned closing);
H5_DLL herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum);
H5_DLL herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle);
-H5_DLL hssize_t H5FD_get_freespace(H5FD_t *file);
+H5_DLL hssize_t H5FD_get_freespace(const H5FD_t *file);
H5_DLL htri_t H5FD_can_extend(H5FD_t *file, H5FD_mem_t type, haddr_t addr,
hsize_t size, hsize_t extra_requested);
H5_DLL herr_t H5FD_extend(H5FD_t *file, H5FD_mem_t type, haddr_t addr,
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index 5b5747f..9c86c39 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -30,7 +30,7 @@
/* Disable certain warnings in PC-Lint: */
/*lint --emacro( {534, 830}, H5P_FILE_ACCESS) */
/*lint --emacro( {534, 830}, H5F_ACC_RDWR, H5F_ACC_EXCL) */
-/*lint -esym( 534, H5Eclear, H5Epush) */
+/*lint -esym( 534, H5Eclear_stack, H5Epush_stack) */
#include "hdf5.h"
diff --git a/src/H5FL.c b/src/H5FL.c
index b5261f7..b8fc9ab 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -1659,16 +1659,11 @@ printf("H5FL_arr_term: head->name=%s, head->allocated=%d\n", H5FL_arr_gc_head.fi
void *
H5FL_seq_free(H5FL_seq_head_t *head, void *obj)
{
- void *ret_value=NULL; /* Return value */
-
- FUNC_ENTER_NOAPI(H5FL_seq_free, NULL)
-
- /* The H5MM_xfree code allows obj to null */
- if (!obj)
- HGOTO_DONE (NULL)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FL_seq_free)
/* Double check parameters */
assert(head);
+ assert(obj);
/* Make certain that the free list is initialized */
assert(head->queue.init);
@@ -1676,8 +1671,7 @@ H5FL_seq_free(H5FL_seq_head_t *head, void *obj)
/* Use block routine */
H5FL_blk_free(&(head->queue),obj);
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(NULL)
} /* end H5FL_seq_free() */
diff --git a/src/H5FS.c b/src/H5FS.c
index e0ad30b..6543fc5 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -25,13 +25,16 @@
* expected to be a rare condition.
*
*/
+
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5FS_mask
+
#include "H5private.h" /* Generic Functions */
#include "H5FSprivate.h" /* Private function stack routines */
#ifdef H5_HAVE_FUNCSTACK
-#define PABLO_MASK H5FS_mask
-
#ifdef H5_HAVE_THREADSAFE
/*
* The per-thread function stack. pthread_once() initializes a special
diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c
index 3e738d1..b14d580 100644
--- a/src/H5Fdbg.c
+++ b/src/H5Fdbg.c
@@ -63,7 +63,7 @@ H5F_debug(H5F_t *f, hid_t dxpl_id, FILE * stream, int indent, int fwidth)
H5P_genplist_t *plist; /* Property list */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5F_debug, FAIL);
+ FUNC_ENTER_NOAPI(H5F_debug, FAIL)
/* check args */
assert(f);
@@ -73,18 +73,18 @@ H5F_debug(H5F_t *f, hid_t dxpl_id, FILE * stream, int indent, int fwidth)
/* Get property list */
if(NULL == (plist = H5I_object(f->shared->fcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
if(H5P_get(plist, H5F_CRT_USER_BLOCK_NAME, &userblock_size)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get user block size");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get user block size")
if(H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, &super_vers)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get super block version");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get super block version")
if(H5P_get(plist, H5F_CRT_FREESPACE_VERS_NAME, &freespace_vers)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get super block version");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get super block version")
if(H5P_get(plist, H5F_CRT_OBJ_DIR_VERS_NAME, &obj_dir_vers)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object directory version");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object directory version")
if(H5P_get(plist, H5F_CRT_SHARE_HEAD_VERS_NAME, &share_head_vers)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get shared-header format version");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get shared-header format version")
/* debug */
HDfprintf(stream, "%*sFile Super Block...\n", indent, "");
@@ -140,6 +140,6 @@ H5F_debug(H5F_t *f, hid_t dxpl_id, FILE * stream, int indent, int fwidth)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index c83f12e..4718aa3 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -35,13 +35,13 @@
*
*/
-/* When this header is included from H5Fprivate.h, don't make calls to H5check() */
+/* When this header is included from a private header, don't make calls to H5check() */
#undef H5CHECK
-#ifndef _H5Fprivate_H
+#ifndef _H5private_H
#define H5CHECK H5check(),
-#else /* _H5Fprivate_H */
+#else /* _H5private_H */
#define H5CHECK
-#endif /* _H5Fprivate_H */
+#endif /* _H5private_H */
#define H5F_ACC_RDONLY (H5CHECK 0x0000u) /*absence of rdwr => rd-only */
#define H5F_ACC_RDWR (H5CHECK 0x0001u) /*open for read and write */
diff --git a/src/H5G.c b/src/H5G.c
index 23405d6..2ee2a30 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -285,7 +285,6 @@ H5Gopen(hid_t loc_id, const char *name)
H5G_t *grp = NULL;
H5G_entry_t *loc = NULL;
H5G_entry_t ent;
- hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open group */
FUNC_ENTER_API(H5Gopen, FAIL);
H5TRACE2("i","is",loc_id,name);
@@ -297,12 +296,13 @@ H5Gopen(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name");
/* Open the parent group, making sure it's a group */
- if (H5G_find(loc, name, NULL, &ent/*out*/, dxpl_id) < 0)
+ if (H5G_find(loc, name, NULL, &ent/*out*/, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found");
/* Open the group */
if ((grp = H5G_open(&ent, H5AC_dxpl_id))==NULL)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group");
+
/* Register an atom for the group */
if ((ret_value = H5I_register(H5I_GROUP, grp)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group");
@@ -2155,6 +2155,7 @@ herr_t
H5G_free(H5G_t *grp)
{
herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5G_free, FAIL);
assert(grp && grp->shared);
@@ -3405,7 +3406,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_replace_name(int type, H5G_entry_t *loc,
+H5G_replace_name(H5G_obj_t type, H5G_entry_t *loc,
H5RS_str_t *src_name, H5G_entry_t *src_loc,
H5RS_str_t *dst_name, H5G_entry_t *dst_loc, H5G_names_op_t op )
{
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index e690108..e6c1776 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -65,7 +65,7 @@ typedef struct H5G_node_key_t {
/* PRIVATE PROTOTYPES */
static herr_t H5G_node_serialize(H5F_t *f, H5G_node_t *sym, size_t size, uint8_t *buf);
-static size_t H5G_node_size(H5F_t *f);
+static size_t H5G_node_size(const H5F_t *f);
static herr_t H5G_node_shared_free(void *shared);
/* Metadata cache callbacks */
@@ -75,11 +75,11 @@ static herr_t H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t a
H5G_node_t *sym);
static herr_t H5G_node_dest(H5F_t *f, H5G_node_t *sym);
static herr_t H5G_node_clear(H5F_t *f, H5G_node_t *sym, hbool_t destroy);
-static herr_t H5G_compute_size(H5F_t *f, H5G_node_t *sym, size_t *size_ptr);
+static herr_t H5G_compute_size(const H5F_t *f, const H5G_node_t *sym, size_t *size_ptr);
/* B-tree callbacks */
static size_t H5G_node_sizeof_rkey(const H5F_t *f, const void *_udata);
-static H5RC_t *H5G_node_get_shared(H5F_t *f, const void *_udata);
+static H5RC_t *H5G_node_get_shared(const H5F_t *f, const void *_udata);
static herr_t H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, void *_lt_key,
void *_udata, void *_rt_key,
haddr_t *addr_p/*out*/);
@@ -88,7 +88,7 @@ static int H5G_node_cmp2(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata,
static int H5G_node_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata,
void *_rt_key);
static herr_t H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_lt_key,
- void *_udata, const void *_rt_key);
+ void *_udata);
static H5B_ins_t H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key,
hbool_t *lt_key_changed, void *_md_key,
void *_udata, void *_rt_key,
@@ -97,9 +97,9 @@ static H5B_ins_t H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_l
static H5B_ins_t H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *lt_key,
hbool_t *lt_key_changed, void *udata,
void *rt_key, hbool_t *rt_key_changed);
-static herr_t H5G_node_decode_key(H5F_t *f, H5B_t *bt, uint8_t *raw,
+static herr_t H5G_node_decode_key(const H5F_t *f, const H5B_t *bt, const uint8_t *raw,
void *_key);
-static herr_t H5G_node_encode_key(H5F_t *f, H5B_t *bt, uint8_t *raw,
+static herr_t H5G_node_encode_key(const H5F_t *f, const H5B_t *bt, uint8_t *raw,
void *_key);
static herr_t H5G_node_debug_key(FILE *stream, H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *key,
@@ -199,7 +199,7 @@ H5G_node_sizeof_rkey(const H5F_t *f, const void UNUSED * udata)
*-------------------------------------------------------------------------
*/
static H5RC_t *
-H5G_node_get_shared(H5F_t *f, const void UNUSED *_udata)
+H5G_node_get_shared(const H5F_t *f, const void UNUSED *_udata)
{
H5RC_t *rc;
@@ -232,7 +232,7 @@ H5G_node_get_shared(H5F_t *f, const void UNUSED *_udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_decode_key(H5F_t *f, H5B_t UNUSED *bt, uint8_t *raw, void *_key)
+H5G_node_decode_key(const H5F_t *f, const H5B_t UNUSED *bt, const uint8_t *raw, void *_key)
{
H5G_node_key_t *key = (H5G_node_key_t *) _key;
@@ -264,7 +264,7 @@ H5G_node_decode_key(H5F_t *f, H5B_t UNUSED *bt, uint8_t *raw, void *_key)
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_encode_key(H5F_t *f, H5B_t UNUSED *bt, uint8_t *raw, void *_key)
+H5G_node_encode_key(const H5F_t *f, const H5B_t UNUSED *bt, uint8_t *raw, void *_key)
{
H5G_node_key_t *key = (H5G_node_key_t *) _key;
@@ -344,7 +344,7 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5G_node_size(H5F_t *f)
+H5G_node_size(const H5F_t *f)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_size);
@@ -686,7 +686,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_compute_size(H5F_t *f, H5G_node_t UNUSED *sym, size_t *size_ptr)
+H5G_compute_size(const H5F_t *f, const H5G_node_t UNUSED *sym, size_t *size_ptr)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_compute_size);
@@ -932,7 +932,7 @@ done:
*/
static herr_t
H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key,
- void *_udata, const void UNUSED *_rt_key)
+ void *_udata)
{
H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t *) _udata;
H5G_node_t *sn = NULL;
@@ -1043,7 +1043,7 @@ done:
static H5B_ins_t
H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
hbool_t UNUSED *lt_key_changed, void *_md_key,
- void *_udata, void *_rt_key, hbool_t UNUSED *rt_key_changed,
+ void *_udata, void *_rt_key, hbool_t *rt_key_changed,
haddr_t *new_node_p)
{
H5G_node_key_t *md_key = (H5G_node_key_t *) _md_key;
@@ -1458,8 +1458,8 @@ done:
*-------------------------------------------------------------------------
*/
int
-H5G_node_iterate (H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr,
- void UNUSED *_rt_key, void *_udata)
+H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
+ const void UNUSED *_rt_key, void *_udata)
{
H5G_bt_ud2_t *bt_udata = (H5G_bt_ud2_t *)_udata;
H5G_node_t *sn = NULL;
@@ -1486,7 +1486,7 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr,
if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node");
nsyms = sn->nsyms;
- if (NULL==(name_off = H5FL_SEQ_MALLOC(size_t, nsyms)))
+ if (NULL==(name_off = H5FL_SEQ_MALLOC(size_t, (size_t)nsyms)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed");
for (i=0; i<nsyms; i++)
name_off[i] = sn->entry[i].name_off;
@@ -1566,8 +1566,8 @@ done:
*-------------------------------------------------------------------------
*/
int
-H5G_node_sumup(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr,
- void UNUSED *_rt_key, void *_udata)
+H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
+ const void UNUSED *_rt_key, void *_udata)
{
hsize_t *num_objs = (hsize_t *)_udata;
H5G_node_t *sn = NULL;
@@ -1613,8 +1613,8 @@ done:
*-------------------------------------------------------------------------
*/
int
-H5G_node_name(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr,
- void UNUSED *_rt_key, void *_udata)
+H5G_node_name(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
+ const void UNUSED *_rt_key, void *_udata)
{
H5G_bt_ud3_t *bt_udata = (H5G_bt_ud3_t *)_udata;
const H5HL_t *heap = NULL;
@@ -1682,8 +1682,8 @@ done:
*-------------------------------------------------------------------------
*/
int
-H5G_node_type(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr,
- void UNUSED *_rt_key, void *_udata)
+H5G_node_type(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
+ const void UNUSED *_rt_key, void *_udata)
{
H5G_bt_ud3_t *bt_udata = (H5G_bt_ud3_t*)_udata;
hsize_t loc_idx;
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index b9693a3..9bee5ee 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -152,12 +152,12 @@ H5_DLL herr_t H5G_ent_encode_vec(H5F_t *f, uint8_t **pp,
const H5G_entry_t *ent, int n);
/* Functions that understand symbol table nodes */
-H5_DLL int H5G_node_iterate (H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t addr,
- void *_rt_key, void *_udata);
-H5_DLL int H5G_node_sumup(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t addr,
- void *_rt_key, void *_udata);
-H5_DLL int H5G_node_name(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t addr,
- void *_rt_key, void *_udata);
-H5_DLL int H5G_node_type(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t addr,
- void *_rt_key, void *_udata);
+H5_DLL int H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
+ const void *_rt_key, void *_udata);
+H5_DLL int H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
+ const void *_rt_key, void *_udata);
+H5_DLL int H5G_node_name(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
+ const void *_rt_key, void *_udata);
+H5_DLL int H5G_node_type(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
+ const void *_rt_key, void *_udata);
#endif
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index b2c96d0..53bbae9 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -152,7 +152,7 @@ H5_DLL herr_t H5G_insert(H5G_entry_t *loc, const char *name,
H5_DLL herr_t H5G_find(H5G_entry_t *loc, const char *name,
H5G_entry_t *grp_ent/*out*/, H5G_entry_t *ent/*out*/, hid_t dxpl_id);
H5_DLL H5F_t *H5G_insertion_file(H5G_entry_t *loc, const char *name, hid_t dxpl_id);
-H5_DLL herr_t H5G_replace_name(int type, H5G_entry_t *loc,
+H5_DLL herr_t H5G_replace_name(H5G_obj_t type, H5G_entry_t *loc,
H5RS_str_t *src_name, H5G_entry_t *src_loc,
H5RS_str_t *dst_name, H5G_entry_t *dst_loc, H5G_names_op_t op);
H5_DLL herr_t H5G_free_grp_name(H5G_t *grp);
diff --git a/src/H5HG.c b/src/H5HG.c
index 3cb20a7..5939369 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -132,7 +132,7 @@ static herr_t H5HG_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
H5HG_heap_t *heap);
static herr_t H5HG_dest(H5F_t *f, H5HG_heap_t *heap);
static herr_t H5HG_clear(H5F_t *f, H5HG_heap_t *heap, hbool_t destroy);
-static herr_t H5HG_compute_size(H5F_t *f, H5HG_heap_t *heap, size_t *size_ptr);
+static herr_t H5HG_compute_size(const H5F_t *f, const H5HG_heap_t *heap, size_t *size_ptr);
/*
* H5HG inherits cache-like properties from H5AC
@@ -628,7 +628,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5HG_compute_size(H5F_t UNUSED *f, H5HG_heap_t *heap, size_t *size_ptr)
+H5HG_compute_size(const H5F_t UNUSED *f, const H5HG_heap_t *heap, size_t *size_ptr)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HG_compute_size);
@@ -662,13 +662,13 @@ H5HG_compute_size(H5F_t UNUSED *f, H5HG_heap_t *heap, size_t *size_ptr)
*
*-------------------------------------------------------------------------
*/
-static unsigned
+static size_t
H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, size_t size)
{
- unsigned idx;
+ size_t idx;
uint8_t *p = NULL;
size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size);
- unsigned ret_value; /* Return value */
+ size_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HG_alloc);
@@ -897,7 +897,7 @@ H5HG_insert (H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out*
{
size_t need; /*total space needed for object */
int cwfsno;
- unsigned idx;
+ size_t idx;
haddr_t addr = HADDR_UNDEF;
H5HG_heap_t *heap = NULL;
hbool_t found=0; /* Flag to indicate a heap with enough space was found */
@@ -1004,7 +1004,6 @@ H5HG_insert (H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out*
/* Split the free space to make room for the new object */
idx = H5HG_alloc (f, heap, size);
- assert (idx>0);
/* Copy data into the heap */
if(size>0) {
@@ -1067,7 +1066,7 @@ H5HG_read (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/)
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap");
- assert (hobj->idx>0 && hobj->idx<heap->nused);
+ assert (hobj->idx<heap->nused);
assert (heap->obj[hobj->idx].begin);
size = heap->obj[hobj->idx].size;
p = heap->obj[hobj->idx].begin + H5HG_SIZEOF_OBJHDR (f);
@@ -1141,7 +1140,7 @@ H5HG_link (H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust)
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap");
- assert (hobj->idx>0 && hobj->idx<heap->nused);
+ assert (hobj->idx<heap->nused);
assert (heap->obj[hobj->idx].begin);
if (heap->obj[hobj->idx].nrefs+adjust<0)
HGOTO_ERROR (H5E_HEAP, H5E_BADRANGE, FAIL, "new link count would be out of range");
@@ -1199,7 +1198,7 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj)
if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap");
- assert (hobj->idx>0 && hobj->idx<heap->nused);
+ assert (hobj->idx<heap->nused);
assert (heap->obj[hobj->idx].begin);
obj_start = heap->obj[hobj->idx].begin;
/* Include object header size */
diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h
index 56589f9..2cfa773 100644
--- a/src/H5HGprivate.h
+++ b/src/H5HGprivate.h
@@ -34,7 +34,7 @@
/* Information to locate object in global heap */
typedef struct H5HG_t {
haddr_t addr; /*address of collection */
- unsigned idx; /*object ID within collection */
+ size_t idx; /*object ID within collection */
} H5HG_t;
/* Typedef for heap in memory (defined in H5HGpkg.h) */
diff --git a/src/H5HL.c b/src/H5HL.c
index 0c8e4a6..b88effb 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -72,7 +72,7 @@ static H5HL_t *H5HL_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udat
static herr_t H5HL_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, H5HL_t *heap);
static herr_t H5HL_dest(H5F_t *f, H5HL_t *heap);
static herr_t H5HL_clear(H5F_t *f, H5HL_t *heap, hbool_t destroy);
-static herr_t H5HL_compute_size(H5F_t *f, H5HL_t *heap, size_t *size_ptr);
+static herr_t H5HL_compute_size(const H5F_t *f, const H5HL_t *heap, size_t *size_ptr);
/*
* H5HL inherits cache-like properties from H5AC
@@ -695,7 +695,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5HL_compute_size(H5F_t *f, H5HL_t *heap, size_t *size_ptr)
+H5HL_compute_size(const H5F_t *f, const H5HL_t *heap, size_t *size_ptr)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_compute_size);
diff --git a/src/H5I.c b/src/H5I.c
index aaa1e54..e30cdc0 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -1099,95 +1099,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Iget_file_id
- *
- * Purpose: The public version of H5I_get_file_id(), obtains the file
- * ID given an object ID. User has to close this ID.
- *
- * Return: Success: file ID
- *
- * Failure: a negative value
- *
- * Programmer: Raymond Lu
- * Oct 27, 2003
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-H5Iget_file_id(hid_t obj_id)
-{
- hid_t ret_value;
-
- FUNC_ENTER_API(H5Iget_file_id, FAIL);
- H5TRACE1("i","i",obj_id);
-
- if((ret_value = H5I_get_file_id(obj_id))<0)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve file ID");
-
-done:
- FUNC_LEAVE_API(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5I_get_file_id
- *
- * Purpose: The private version of H5Iget_file_id(), obtains the file
- * ID given an object ID.
- *
- * Return: Success: file ID
- *
- * Failure: a negative value
- *
- * Programmer: Raymond Lu
- * Oct 27, 2003
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static hid_t
-H5I_get_file_id(hid_t obj_id)
-{
- H5G_entry_t *ent;
- hid_t ret_value;
- H5I_type_t type;
-
- FUNC_ENTER_NOAPI_NOINIT(H5I_get_file_id);
-
- /* Get object type */
- type = H5I_TYPE(obj_id);
- if(type == H5I_FILE)
- {
- ret_value = obj_id;
-
- /* Increment reference count on atom. */
- if (H5I_inc_ref(ret_value)<0)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed");
- }
- else if(type == H5I_DATATYPE)
- {
- if((ent = H5G_loc(obj_id))==NULL)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "not a named datatype");
- ret_value = H5F_get_id(ent->file);
- }
- else if(type == H5I_GROUP || type == H5I_DATASET || type == H5I_ATTR)
- {
- if((ent = H5G_loc(obj_id))==NULL)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't get symbol table info");
- ret_value = H5F_get_id(ent->file);
- }
- else
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid object ID");
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
* Function: H5Iremove_verify
*
* Purpose: Removes the specified ID from its type, first checking that the
@@ -2219,3 +2130,89 @@ done:
}
#endif /* H5I_DEBUG_OUTPUT */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Iget_file_id
+ *
+ * Purpose: The public version of H5I_get_file_id(), obtains the file
+ * ID given an object ID. User has to close this ID.
+ *
+ * Return: Success: file ID
+ *
+ * Failure: a negative value
+ *
+ * Programmer: Raymond Lu
+ * Oct 27, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Iget_file_id(hid_t obj_id)
+{
+ hid_t ret_value;
+
+ FUNC_ENTER_API(H5Iget_file_id, FAIL);
+ H5TRACE1("i","i",obj_id);
+
+ if((ret_value = H5I_get_file_id(obj_id))<0)
+ HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve file ID");
+
+done:
+ FUNC_LEAVE_API(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_get_file_id
+ *
+ * Purpose: The private version of H5Iget_file_id(), obtains the file
+ * ID given an object ID.
+ *
+ * Return: Success: file ID
+ *
+ * Failure: a negative value
+ *
+ * Programmer: Raymond Lu
+ * Oct 27, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static hid_t
+H5I_get_file_id(hid_t obj_id)
+{
+ H5G_entry_t *ent;
+ H5I_type_t type;
+ hid_t ret_value;
+
+ FUNC_ENTER_NOAPI_NOINIT(H5I_get_file_id);
+
+ /* Get object type */
+ type = H5I_TYPE(obj_id);
+ if(type == H5I_FILE) {
+ ret_value = obj_id;
+
+ /* Increment reference count on atom. */
+ if (H5I_inc_ref(ret_value)<0)
+ HGOTO_ERROR (H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed");
+ }
+ else if(type == H5I_DATATYPE) {
+ if((ent = H5G_loc(obj_id))==NULL)
+ HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "not a named datatype");
+ ret_value = H5F_get_id(ent->file);
+ }
+ else if(type == H5I_GROUP || type == H5I_DATASET || type == H5I_ATTR) {
+ if((ent = H5G_loc(obj_id))==NULL)
+ HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't get symbol table info");
+ ret_value = H5F_get_id(ent->file);
+ }
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid object ID");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+}
+
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index d6ed95b..0f6e1b7 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -32,25 +32,24 @@
* to verify that the H5I{inc|dec|get}_ref() routines work correctly with in.
*
*/
-typedef enum {
- H5I_UNINIT = (-2), /*uninitialized type */
+typedef enum H5I_type_t {
+ H5I_UNINIT = (-2), /*uninitialized type */
H5I_BADID = (-1), /*invalid Type */
H5I_FILE = 1, /*type ID for File objects */
H5I_FILE_CLOSING, /*files pending close due to open objhdrs */
H5I_GROUP, /*type ID for Group objects */
H5I_DATATYPE, /*type ID for Datatype objects */
- H5I_DATASPACE, /*type ID for Dataspace objects */
+ H5I_DATASPACE, /*type ID for Dataspace objects */
H5I_DATASET, /*type ID for Dataset objects */
- H5I_ATTR, /*type ID for Attribute objects */
- H5I_TEMPBUF, /*type ID for Temporary buffer objects */
- H5I_REFERENCE, /*type ID for Reference objects */
+ H5I_ATTR, /*type ID for Attribute objects */
+ H5I_REFERENCE, /*type ID for Reference objects */
H5I_VFL, /*type ID for virtual file layer */
H5I_GENPROP_CLS, /*type ID for generic property list classes */
- H5I_GENPROP_LST, /*type ID for generic property lists */
- H5I_ERROR_CLASS, /*type ID for error classes */
- H5I_ERROR_MSG, /*type ID for error messages */
- H5I_ERROR_STACK, /*type ID for error stacks */
- H5I_NTYPES /*number of library types, MUST BE LAST! */
+ H5I_GENPROP_LST, /*type ID for generic property lists */
+ H5I_ERROR_CLASS, /*type ID for error classes */
+ H5I_ERROR_MSG, /*type ID for error messages */
+ H5I_ERROR_STACK, /*type ID for error stacks */
+ H5I_NTYPES /*number of library types, MUST BE LAST! */
} H5I_type_t;
/* Type of atoms to return to users */
diff --git a/src/H5O.c b/src/H5O.c
index 6c84e26..2dbd2fe 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -91,7 +91,7 @@ static H5O_t *H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata
static herr_t H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh);
static herr_t H5O_dest(H5F_t *f, H5O_t *oh);
static herr_t H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy);
-static herr_t H5O_compute_size(H5F_t *f, H5O_t *oh, size_t *size_ptr);
+static herr_t H5O_compute_size(const H5F_t *f, const H5O_t *oh, size_t *size_ptr);
/* H5O inherits cache-like properties from H5AC */
static const H5AC_class_t H5AC_OHDR[1] = {{
@@ -833,7 +833,8 @@ H5O_dest(H5F_t UNUSED *f, H5O_t *oh)
oh->chunk[i].image = H5FL_BLK_FREE(chunk_image,oh->chunk[i].image);
}
- oh->chunk = H5FL_SEQ_FREE(H5O_chunk_t,oh->chunk);
+ if(oh->chunk)
+ oh->chunk = H5FL_SEQ_FREE(H5O_chunk_t,oh->chunk);
/* destroy messages */
for (i = 0; i < oh->nmesgs; i++) {
@@ -845,7 +846,8 @@ H5O_dest(H5F_t UNUSED *f, H5O_t *oh)
else
H5O_free_real(oh->mesg[i].type, oh->mesg[i].native);
}
- oh->mesg = H5FL_SEQ_FREE(H5O_mesg_t,oh->mesg);
+ if(oh->mesg)
+ oh->mesg = H5FL_SEQ_FREE(H5O_mesg_t,oh->mesg);
/* destroy object header */
H5FL_FREE(H5O_t,oh);
@@ -923,7 +925,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_compute_size(H5F_t *f, H5O_t *oh, size_t *size_ptr)
+H5O_compute_size(const H5F_t *f, const H5O_t *oh, size_t *size_ptr)
{
unsigned u;
size_t size;
@@ -938,9 +940,7 @@ H5O_compute_size(H5F_t *f, H5O_t *oh, size_t *size_ptr)
size = H5O_SIZEOF_HDR(f);
for (u = 0; u < oh->nchunks; u++)
- {
size += oh->chunk[u].size;
- }
HDassert(size >= H5O_SIZEOF_HDR(f));
@@ -3130,7 +3130,7 @@ done:
*-------------------------------------------------------------------------
*/
size_t
-H5O_raw_size(unsigned type_id, H5F_t *f, const void *mesg)
+H5O_raw_size(unsigned type_id, const H5F_t *f, const void *mesg)
{
const H5O_class_t *type; /* Actual H5O class type for the ID */
size_t ret_value; /* Return value */
@@ -3487,7 +3487,7 @@ done:
*-------------------------------------------------------------------------
*/
void*
-H5O_decode(H5F_t *f, unsigned char *buf, unsigned type_id)
+H5O_decode(H5F_t *f, const unsigned char *buf, unsigned type_id)
{
const H5O_class_t *type; /* Actual H5O class type for the ID */
void *ret_value=NULL; /* Return value */
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index 476589c..4487985 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -33,7 +33,7 @@
static herr_t H5O_attr_encode (H5F_t *f, uint8_t *p, const void *mesg);
static void *H5O_attr_decode (H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static void *H5O_attr_copy (const void *_mesg, void *_dest, unsigned update_flags);
-static size_t H5O_attr_size (H5F_t *f, const void *_mesg);
+static size_t H5O_attr_size (const H5F_t *f, const void *_mesg);
static herr_t H5O_attr_reset (void *_mesg);
static herr_t H5O_attr_free (void *mesg);
static herr_t H5O_attr_delete (H5F_t *f, hid_t dxpl_id, const void *_mesg);
@@ -412,7 +412,7 @@ done:
* Added padding between message parts for alignment.
--------------------------------------------------------------------------*/
static size_t
-H5O_attr_size(H5F_t UNUSED *f, const void *_mesg)
+H5O_attr_size(const H5F_t UNUSED *f, const void *_mesg)
{
const H5A_t *attr = (const H5A_t *)_mesg;
size_t name_len;
diff --git a/src/H5Obogus.c b/src/H5Obogus.c
index e6f7931..63b002b 100644
--- a/src/H5Obogus.c
+++ b/src/H5Obogus.c
@@ -42,7 +42,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_bogus_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_bogus_encode(H5F_t *f, uint8_t *p, const void *_mesg);
-static size_t H5O_bogus_size(H5F_t *f, const void *_mesg);
+static size_t H5O_bogus_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_bogus_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
int indent, int fwidth);
@@ -172,7 +172,7 @@ H5O_bogus_encode(H5F_t UNUSED *f, uint8_t *p, const void UNUSED *mesg)
*-------------------------------------------------------------------------
*/
static size_t
-H5O_bogus_size(H5F_t UNUSED *f, const void UNUSED *mesg)
+H5O_bogus_size(const H5F_t UNUSED *f, const void UNUSED *mesg)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_bogus_size);
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 25b9c05..f155273 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -29,7 +29,7 @@
static herr_t H5O_dtype_encode (H5F_t *f, uint8_t *p, const void *mesg);
static void *H5O_dtype_decode (H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static void *H5O_dtype_copy (const void *_mesg, void *_dest, unsigned update_flags);
-static size_t H5O_dtype_size (H5F_t *f, const void *_mesg);
+static size_t H5O_dtype_size (const H5F_t *f, const void *_mesg);
static herr_t H5O_dtype_reset (void *_mesg);
static herr_t H5O_dtype_free (void *_mesg);
static herr_t H5O_dtype_get_share (H5F_t *f, const void *_mesg,
@@ -453,7 +453,6 @@ done:
if(dt != NULL)
H5FL_FREE(H5T_t, dt);
}
-
FUNC_LEAVE_NOAPI(ret_value);
}
@@ -985,7 +984,7 @@ done:
sized "properties" field.
--------------------------------------------------------------------------*/
static size_t
-H5O_dtype_size(H5F_t *f, const void *mesg)
+H5O_dtype_size(const H5F_t *f, const void *mesg)
{
unsigned i;
size_t ret_value = 8;
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index 7472084..2e8e365 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -34,7 +34,7 @@
static void *H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_efl_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static void *H5O_efl_copy(const void *_mesg, void *_dest, unsigned update_flags);
-static size_t H5O_efl_size(H5F_t *f, const void *_mesg);
+static size_t H5O_efl_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_efl_reset(void *_mesg);
static herr_t H5O_efl_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
int indent, int fwidth);
@@ -314,7 +314,7 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5O_efl_size(H5F_t *f, const void *_mesg)
+H5O_efl_size(const H5F_t *f, const void *_mesg)
{
const H5O_efl_t *mesg = (const H5O_efl_t *) _mesg;
size_t ret_value = 0;
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index c1d1fd1..7e3c4da 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -34,7 +34,7 @@
static void *H5O_fill_new_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static void *H5O_fill_new_copy(const void *_mesg, void *_dest, unsigned update_flags);
-static size_t H5O_fill_new_size(H5F_t *f, const void *_mesg);
+static size_t H5O_fill_new_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_fill_new_reset(void *_mesg);
static herr_t H5O_fill_new_free(void *_mesg);
static herr_t H5O_fill_new_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
@@ -43,7 +43,7 @@ static herr_t H5O_fill_new_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FIL
static void *H5O_fill_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_fill_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static void *H5O_fill_copy(const void *_mesg, void *_dest, unsigned update_flags);
-static size_t H5O_fill_size(H5F_t *f, const void *_mesg);
+static size_t H5O_fill_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_fill_reset(void *_mesg);
static herr_t H5O_fill_free(void *_mesg);
static herr_t H5O_fill_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
@@ -467,7 +467,7 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5O_fill_new_size(H5F_t UNUSED *f, const void *_mesg)
+H5O_fill_new_size(const H5F_t UNUSED *f, const void *_mesg)
{
const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg;
size_t ret_value;
@@ -508,7 +508,7 @@ H5O_fill_new_size(H5F_t UNUSED *f, const void *_mesg)
*-------------------------------------------------------------------------
*/
static size_t
-H5O_fill_size(H5F_t UNUSED *f, const void *_mesg)
+H5O_fill_size(const H5F_t UNUSED *f, const void *_mesg)
{
const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
@@ -579,7 +579,6 @@ static herr_t
H5O_fill_reset(void *_mesg)
{
H5O_fill_t *mesg = (H5O_fill_t *)_mesg;
- herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_reset);
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 28db75c..fa7d40e 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -36,7 +36,7 @@
static void *H5O_layout_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_layout_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static void *H5O_layout_copy(const void *_mesg, void *_dest, unsigned update_flags);
-static size_t H5O_layout_size(H5F_t *f, const void *_mesg);
+static size_t H5O_layout_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_layout_reset (void *_mesg);
static herr_t H5O_layout_free (void *_mesg);
static herr_t H5O_layout_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg);
@@ -396,7 +396,7 @@ done:
*-------------------------------------------------------------------------
*/
size_t
-H5O_layout_meta_size(H5F_t *f, const void *_mesg)
+H5O_layout_meta_size(const H5F_t *f, const void *_mesg)
{
const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg;
size_t ret_value;
@@ -461,7 +461,7 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5O_layout_size(H5F_t *f, const void *_mesg)
+H5O_layout_size(const H5F_t *f, const void *_mesg)
{
const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg;
size_t ret_value;
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index 57e1de1..a6cc127 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -35,12 +35,12 @@
static void *H5O_mtime_new_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_mtime_new_encode(H5F_t *f, uint8_t *p, const void *_mesg);
-static size_t H5O_mtime_new_size(H5F_t *f, const void *_mesg);
+static size_t H5O_mtime_new_size(const H5F_t *f, const void *_mesg);
static void *H5O_mtime_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_mtime_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static void *H5O_mtime_copy(const void *_mesg, void *_dest, unsigned update_flags);
-static size_t H5O_mtime_size(H5F_t *f, const void *_mesg);
+static size_t H5O_mtime_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_mtime_reset(void *_mesg);
static herr_t H5O_mtime_free(void *_mesg);
static herr_t H5O_mtime_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
@@ -229,6 +229,7 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p,
/* Irix5.3 */
{
struct timezone tz;
+
if (HDBSDgettimeofday(NULL, &tz)<0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information");
the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0);
@@ -430,7 +431,7 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5O_mtime_new_size(H5F_t UNUSED * f, const void UNUSED * mesg)
+H5O_mtime_new_size(const H5F_t UNUSED * f, const void UNUSED * mesg)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_mtime_new_size);
@@ -463,7 +464,7 @@ H5O_mtime_new_size(H5F_t UNUSED * f, const void UNUSED * mesg)
*-------------------------------------------------------------------------
*/
static size_t
-H5O_mtime_size(H5F_t UNUSED * f, const void UNUSED * mesg)
+H5O_mtime_size(const H5F_t UNUSED * f, const void UNUSED * mesg)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_mtime_size);
diff --git a/src/H5Oname.c b/src/H5Oname.c
index b58246a..a675eff 100644
--- a/src/H5Oname.c
+++ b/src/H5Oname.c
@@ -38,7 +38,7 @@
static void *H5O_name_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_name_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static void *H5O_name_copy(const void *_mesg, void *_dest, unsigned update_flags);
-static size_t H5O_name_size(H5F_t *f, const void *_mesg);
+static size_t H5O_name_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_name_reset(void *_mesg);
static herr_t H5O_name_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
int indent, int fwidth);
@@ -213,7 +213,7 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5O_name_size(H5F_t UNUSED *f, const void *_mesg)
+H5O_name_size(const H5F_t UNUSED *f, const void *_mesg)
{
const H5O_name_t *mesg = (const H5O_name_t *) _mesg;
size_t ret_value;
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 6ddfd92..5735d9c 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -63,7 +63,7 @@ typedef struct H5O_class_t {
void *(*decode)(H5F_t*, hid_t, const uint8_t*, struct H5O_shared_t*);
herr_t (*encode)(H5F_t*, uint8_t*, const void*);
void *(*copy)(const void*, void*, unsigned); /*copy native value */
- size_t (*raw_size)(H5F_t*, const void*);/*sizeof raw val */
+ size_t (*raw_size)(const H5F_t*, const void*);/*sizeof raw val */
herr_t (*reset)(void *); /*free nested data structs */
herr_t (*free)(void *); /*free main data struct */
herr_t (*del)(H5F_t *, hid_t, const void *); /* Delete space in file referenced by this message */
diff --git a/src/H5Opline.c b/src/H5Opline.c
index 5319a92..1fa304f 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -35,7 +35,7 @@
static herr_t H5O_pline_encode (H5F_t *f, uint8_t *p, const void *mesg);
static void *H5O_pline_decode (H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static void *H5O_pline_copy (const void *_mesg, void *_dest, unsigned update_flags);
-static size_t H5O_pline_size (H5F_t *f, const void *_mesg);
+static size_t H5O_pline_size (const H5F_t *f, const void *_mesg);
static herr_t H5O_pline_reset (void *_mesg);
static herr_t H5O_pline_free (void *_mesg);
static herr_t H5O_pline_debug (H5F_t *f, hid_t dxpl_id, const void *_mesg,
@@ -321,7 +321,7 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5O_pline_size (H5F_t UNUSED *f, const void *mesg)
+H5O_pline_size (const H5F_t UNUSED *f, const void *mesg)
{
const H5O_pline_t *pline = (const H5O_pline_t*)mesg;
size_t i, name_len;
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 3e256e2..568f67b 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -256,9 +256,9 @@ H5_DLL herr_t H5O_remove(H5G_entry_t *ent, unsigned type_id, int sequence,
H5_DLL herr_t H5O_reset(unsigned type_id, void *native);
H5_DLL void *H5O_free(unsigned type_id, void *mesg);
H5_DLL herr_t H5O_encode(H5F_t *f, unsigned char *buf, void *obj, unsigned type_id);
-H5_DLL void* H5O_decode(H5F_t *f, unsigned char *buf, unsigned type_id);
+H5_DLL void* H5O_decode(H5F_t *f, const unsigned char *buf, unsigned type_id);
H5_DLL void *H5O_copy(unsigned type_id, const void *mesg, void *dst);
-H5_DLL size_t H5O_raw_size(unsigned type_id, H5F_t *f, const void *mesg);
+H5_DLL size_t H5O_raw_size(unsigned type_id, const H5F_t *f, const void *mesg);
H5_DLL herr_t H5O_get_share(unsigned type_id, H5F_t *f, const void *mesg, H5O_shared_t *share);
H5_DLL herr_t H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr);
H5_DLL herr_t H5O_get_info(H5G_entry_t *ent, H5O_stat_t *ostat, hid_t dxpl_id);
@@ -269,7 +269,7 @@ H5_DLL herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, in
int fwidth);
/* Layout operators */
-H5_DLL size_t H5O_layout_meta_size(H5F_t *f, const void *_mesg);
+H5_DLL size_t H5O_layout_meta_size(const H5F_t *f, const void *_mesg);
/* EFL operators */
H5_DLL hsize_t H5O_efl_total_size(H5O_efl_t *efl);
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 53f8c80..a02033a 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -29,7 +29,7 @@
static void *H5O_sdspace_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static void *H5O_sdspace_copy(const void *_mesg, void *_dest, unsigned update_flags);
-static size_t H5O_sdspace_size(H5F_t *f, const void *_mesg);
+static size_t H5O_sdspace_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_sdspace_reset(void *_mesg);
static herr_t H5O_sdspace_free (void *_mesg);
static herr_t H5O_sdspace_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
@@ -324,7 +324,7 @@ done:
instead of just four bytes.
--------------------------------------------------------------------------*/
static size_t
-H5O_sdspace_size(H5F_t *f, const void *mesg)
+H5O_sdspace_size(const H5F_t *f, const void *mesg)
{
const H5S_extent_t *space = (const H5S_extent_t *) mesg;
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index 59c8278..2f30ae6 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -42,7 +42,7 @@
static void *H5O_shared_decode (H5F_t*, hid_t dxpl_id, const uint8_t*, H5O_shared_t *sh);
static herr_t H5O_shared_encode (H5F_t*, uint8_t*, const void*);
static void *H5O_shared_copy(const void *_mesg, void *_dest, unsigned update_flags);
-static size_t H5O_shared_size (H5F_t*, const void *_mesg);
+static size_t H5O_shared_size (const H5F_t*, const void *_mesg);
static herr_t H5O_shared_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg);
static herr_t H5O_shared_link(H5F_t *f, hid_t dxpl_id, const void *_mesg);
static herr_t H5O_shared_debug (H5F_t*, hid_t dxpl_id, const void*, FILE*, int, int);
@@ -385,7 +385,7 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5O_shared_size (H5F_t *f, const void *_mesg)
+H5O_shared_size (const H5F_t *f, const void *_mesg)
{
const H5O_shared_t *shared = (const H5O_shared_t *) _mesg;
size_t ret_value;
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index 0fbda05..e880694 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -41,7 +41,7 @@
static void *H5O_stab_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
static herr_t H5O_stab_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static void *H5O_stab_copy(const void *_mesg, void *_dest, unsigned update_flags);
-static size_t H5O_stab_size(H5F_t *f, const void *_mesg);
+static size_t H5O_stab_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_stab_free (void *_mesg);
static herr_t H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg);
static herr_t H5O_stab_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
@@ -264,7 +264,7 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5O_stab_size(H5F_t *f, const void UNUSED *_mesg)
+H5O_stab_size(const H5F_t *f, const void UNUSED *_mesg)
{
size_t ret_value; /* Return value */
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index a5e1c3a..7a71c29 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -490,26 +490,16 @@ done:
*
*-------------------------------------------------------------------------
*/
-#ifdef H5_WANT_H5_V1_6_COMPAT
-herr_t
-H5Pget_external(hid_t plist_id, int idx, size_t name_size, char *name/*out*/,
- off_t *offset/*out*/, hsize_t *size/*out*/)
-#else /* H5_WANT_H5_V1_6_COMPAT */
herr_t
H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name/*out*/,
off_t *offset/*out*/, hsize_t *size/*out*/)
-#endif /* H5_WANT_H5_V1_6_COMPAT */
{
H5O_efl_t efl;
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
FUNC_ENTER_API(H5Pget_external, FAIL);
-#ifdef H5_WANT_H5_V1_6_COMPAT
- H5TRACE6("e","iIszxxx",plist_id,idx,name_size,name,offset,size);
-#else /* H5_WANT_H5_V1_6_COMPAT */
H5TRACE6("e","iIuzxxx",plist_id,idx,name_size,name,offset,size);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
@@ -519,13 +509,8 @@ H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name/*out*
if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list");
-#ifdef H5_WANT_H5_V1_6_COMPAT
- if (idx<0 || (size_t)idx>=efl.nused)
- HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, "external file index is out of range");
-#else /* H5_WANT_H5_V1_6_COMPAT */
if (idx>=efl.nused)
HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, "external file index is out of range");
-#endif /* H5_WANT_H5_V1_6_COMPAT */
/* Return values */
if (name_size>0 && name)
@@ -788,7 +773,7 @@ done:
*/
#ifdef H5_WANT_H5_V1_6_COMPAT
H5Z_filter_t
-H5Pget_filter(hid_t plist_id, int idx, unsigned int *flags/*out*/,
+H5Pget_filter(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
size_t namelen, char name[]/*out*/)
#else /* H5_WANT_H5_V1_6_COMPAT */
@@ -807,7 +792,7 @@ H5Pget_filter(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
FUNC_ENTER_API(H5Pget_filter, H5Z_FILTER_ERROR);
#ifdef H5_WANT_H5_V1_6_COMPAT
- H5TRACE7("Zf","iIsx*zxzx",plist_id,idx,flags,cd_nelmts,cd_values,namelen,
+ H5TRACE7("Zf","iIux*zxzx",plist_id,idx,flags,cd_nelmts,cd_values,namelen,
name);
#else /* H5_WANT_H5_V1_6_COMPAT */
H5TRACE7("Zf","iIux*zxzx",plist_id,idx,flags,cd_nelmts,cd_values,namelen,
@@ -845,13 +830,8 @@ H5Pget_filter(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline");
/* Check more args */
-#ifdef H5_WANT_H5_V1_6_COMPAT
- if (idx<0 || (size_t)idx>=pline.nused)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid");
-#else /* H5_WANT_H5_V1_6_COMPAT */
if (idx>=pline.nused)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid");
-#endif /* H5_WANT_H5_V1_6_COMPAT */
/* Set pointer to particular filter to query */
filter=&pline.filter[idx];
@@ -898,7 +878,7 @@ done:
* Function: H5Pget_filter_by_id
*
* Purpose: This is an additional query counterpart of H5Pset_filter() and
- * returns information about a particular filter in a permanent
+ * returns information about a particular filter in a permanent
* or transient pipeline depending on whether PLIST_ID is a
* dataset creation or transfer property list. On input,
* CD_NELMTS indicates the number of entries in the CD_VALUES
diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c
index 25e7b3f..2d20d3f 100644
--- a/src/H5Pfcpl.c
+++ b/src/H5Pfcpl.c
@@ -29,78 +29,6 @@
/* Static function prototypes */
-#ifdef H5_WANT_H5_V1_6_COMPAT
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_version
- *
- * Purpose: Retrieves version information for various parts of a file.
- *
- * SUPER: The file super block.
- * HEAP: The global heap.
- * FREELIST: The global free list.
- * STAB: The root symbol table entry.
- * SHHDR: Shared object headers.
- *
- * Any (or even all) of the output arguments can be null
- * pointers.
- *
- * Return: Success: Non-negative, version information is returned
- * through the arguments.
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Wednesday, January 7, 1998
- *
- * Modifications:
- *
- * Raymond Lu, Oct 14, 2001
- * Change to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_version(hid_t plist_id, int *_super/*out*/, int *_freelist/*out*/,
- int *_stab/*out*/, int *_shhdr/*out*/)
-{
- unsigned super,freelist,stab,shhdr; /* Unsigned versions to query into */
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Pget_version, FAIL);
- H5TRACE5("e","ixxxx",plist_id,_super,_freelist,_stab,_shhdr);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get values */
- if (_super) {
- if(H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, &super) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get superblock version");
- *_super=(int)super;
- } /* end if */
- if (_freelist) {
- if(H5P_get(plist, H5F_CRT_FREESPACE_VERS_NAME, &freelist) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get free-space version");
- *_freelist=(int)freelist;
- } /* end if */
- if (_stab) {
- if(H5P_get(plist, H5F_CRT_OBJ_DIR_VERS_NAME, &stab) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object directory version");
- *_stab=(int)stab;
- } /* end if */
- if (_shhdr) {
- if(H5P_get(plist, H5F_CRT_SHARE_HEAD_VERS_NAME, &shhdr) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get shared-header version");
- *_shhdr=(int)shhdr;
- } /* end if */
-
-done:
- FUNC_LEAVE_API(ret_value);
-}
-#else /* H5_WANT_H5_V1_6_COMPAT */
/*-------------------------------------------------------------------------
* Function: H5Pget_version
@@ -162,7 +90,6 @@ H5Pget_version(hid_t plist_id, unsigned *super/*out*/, unsigned *freelist/*out*/
done:
FUNC_LEAVE_API(ret_value);
}
-#endif /* H5_WANT_H5_V1_6_COMPAT */
/*-------------------------------------------------------------------------
@@ -357,117 +284,6 @@ done:
FUNC_LEAVE_API(ret_value);
}
-#ifdef H5_WANT_H5_V1_6_COMPAT
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_sym_k
- *
- * Purpose: IK is one half the rank of a tree that stores a symbol
- * table for a group. Internal nodes of the symbol table are on
- * average 75% full. That is, the average rank of the tree is
- * 1.5 times the value of IK.
- *
- * LK is one half of the number of symbols that can be stored in
- * a symbol table node. A symbol table node is the leaf of a
- * symbol table tree which is used to store a group. When
- * symbols are inserted randomly into a group, the group's
- * symbol table nodes are 75% full on average. That is, they
- * contain 1.5 times the number of symbols specified by LK.
- *
- * Either (or even both) of IK and LK can be zero in which case
- * that value is left unchanged.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, January 6, 1998
- *
- * Modifications:
- *
- * Raymond Lu, Oct 14, 2001
- * Changed to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_sym_k(hid_t plist_id, int ik, unsigned lk)
-{
- unsigned btree_k[H5B_NUM_BTREE_ID];
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Pset_sym_k, FAIL);
- H5TRACE3("e","iIsIu",plist_id,ik,lk);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set values */
- if (ik > 0) {
- if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes");
- btree_k[H5B_SNODE_ID] = (unsigned)ik;
- if(H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree nodes");
- }
- if (lk > 0)
- if(H5P_set(plist, H5F_CRT_SYM_LEAF_NAME, &lk) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for symbol table leaf nodes");
-
-done:
- FUNC_LEAVE_API(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_sym_k
- *
- * Purpose: Retrieves the symbol table B-tree 1/2 rank (IK) and the
- * symbol table leaf node 1/2 size (LK). See H5Pset_sym_k() for
- * details. Either (or even both) IK and LK may be null
- * pointers.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Wednesday, January 7, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Changed to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_sym_k(hid_t plist_id, int *ik /*out */ , unsigned *lk /*out */ )
-{
- unsigned btree_k[H5B_NUM_BTREE_ID];
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Pget_sym_k, FAIL);
- H5TRACE3("e","ixx",plist_id,ik,lk);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get values */
- if (ik) {
- if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree nodes");
- *ik = (int)btree_k[H5B_SNODE_ID];
- }
- if (lk)
- if(H5P_get(plist, H5F_CRT_SYM_LEAF_NAME, lk) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for symbol table leaf nodes");
-
-done:
- FUNC_LEAVE_API(ret_value);
-}
-#else /* H5_WANT_H5_V1_6_COMPAT */
/*-------------------------------------------------------------------------
* Function: H5Pset_sym_k
@@ -577,105 +393,7 @@ H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out */ , unsigned *lk /*out */ )
done:
FUNC_LEAVE_API(ret_value);
}
-#endif /* H5_WANT_H5_V1_6_COMPAT */
-
-#ifdef H5_WANT_H5_V1_6_COMPAT
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_istore_k
- *
- * Purpose: IK is one half the rank of a tree that stores chunked raw
- * data. On average, such a tree will be 75% full, or have an
- * average rank of 1.5 times the value of IK.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, January 6, 1998
- *
- * Modifications:
- *
- * Raymond Lu, Oct 14, 2001
- * Changed to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_istore_k(hid_t plist_id, int ik)
-{
- unsigned btree_k[H5B_NUM_BTREE_ID];
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pset_istore_k, FAIL);
- H5TRACE2("e","iIs",plist_id,ik);
-
- /* Check arguments */
- if (ik <= 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "istore IK value must be positive");
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set value */
- if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes");
- btree_k[H5B_ISTORE_ID] = (unsigned)ik;
- if(H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree interanl nodes");
-
-done:
- FUNC_LEAVE_API(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_istore_k
- *
- * Purpose: Queries the 1/2 rank of an indexed storage B-tree. See
- * H5Pset_istore_k() for details. The argument IK may be the
- * null pointer.
- *
- * Return: Success: Non-negative, size returned through IK
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Wednesday, January 7, 1998
- *
- * Modifications:
- *
- * Raymond Lu, Oct 14, 2001
- * Changed to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_istore_k(hid_t plist_id, int *ik /*out */ )
-{
- unsigned btree_k[H5B_NUM_BTREE_ID];
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_istore_k, FAIL);
- H5TRACE2("e","ix",plist_id,ik);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get value */
- if (ik) {
- if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes");
- *ik = (int)btree_k[H5B_ISTORE_ID];
- }
-
-done:
- FUNC_LEAVE_API(ret_value);
-}
-#else /* H5_WANT_H5_V1_6_COMPAT */
/*-------------------------------------------------------------------------
* Function: H5Pset_istore_k
@@ -771,5 +489,4 @@ H5Pget_istore_k(hid_t plist_id, unsigned *ik /*out */ )
done:
FUNC_LEAVE_API(ret_value);
}
-#endif /* H5_WANT_H5_V1_6_COMPAT */
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index e4e3c78..849c34f 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -75,9 +75,9 @@ typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data);
#undef H5OPEN
#ifndef _H5private_H
#define H5OPEN H5open(),
-#else /* _H5Pprivate_H */
+#else /* _H5private_H */
#define H5OPEN
-#endif /* _H5Pprivate_H */
+#endif /* _H5private_H */
#define H5P_NO_CLASS (H5OPEN H5P_CLS_NO_CLASS_g)
#define H5P_FILE_CREATE (H5OPEN H5P_CLS_FILE_CREATE_g)
@@ -163,15 +163,9 @@ H5_DLL herr_t H5Pclose_class(hid_t plist_id);
H5_DLL herr_t H5Pclose(hid_t plist_id);
H5_DLL hid_t H5Pcopy(hid_t plist_id);
-#ifdef H5_WANT_H5_V1_6_COMPAT
-H5_DLL herr_t H5Pget_version(hid_t plist_id, int *boot/*out*/,
- int *freelist/*out*/, int *stab/*out*/,
- int *shhdr/*out*/);
-#else /* H5_WANT_H5_V1_6_COMPAT */
H5_DLL herr_t H5Pget_version(hid_t plist_id, unsigned *boot/*out*/,
unsigned *freelist/*out*/, unsigned *stab/*out*/,
unsigned *shhdr/*out*/);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
H5_DLL herr_t H5Pset_userblock(hid_t plist_id, hsize_t size);
H5_DLL herr_t H5Pget_userblock(hid_t plist_id, hsize_t *size);
H5_DLL herr_t H5Pset_alignment(hid_t fapl_id, hsize_t threshold,
@@ -182,17 +176,10 @@ H5_DLL herr_t H5Pset_sizes(hid_t plist_id, size_t sizeof_addr,
size_t sizeof_size);
H5_DLL herr_t H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr/*out*/,
size_t *sizeof_size/*out*/);
-#ifdef H5_WANT_H5_V1_6_COMPAT
-H5_DLL herr_t H5Pset_sym_k(hid_t plist_id, int ik, unsigned lk);
-H5_DLL herr_t H5Pget_sym_k(hid_t plist_id, int *ik/*out*/, unsigned *lk/*out*/);
-H5_DLL herr_t H5Pset_istore_k(hid_t plist_id, int ik);
-H5_DLL herr_t H5Pget_istore_k(hid_t plist_id, int *ik/*out*/);
-#else /* H5_WANT_H5_V1_6_COMPAT */
H5_DLL herr_t H5Pset_sym_k(hid_t plist_id, unsigned ik, unsigned lk);
H5_DLL herr_t H5Pget_sym_k(hid_t plist_id, unsigned *ik/*out*/, unsigned *lk/*out*/);
H5_DLL herr_t H5Pset_istore_k(hid_t plist_id, unsigned ik);
H5_DLL herr_t H5Pget_istore_k(hid_t plist_id, unsigned *ik/*out*/);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
H5_DLL herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout);
H5_DLL H5D_layout_t H5Pget_layout(hid_t plist_id);
H5_DLL herr_t H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[]);
@@ -202,15 +189,9 @@ H5_DLL ssize_t H5Pget_data_transform(hid_t plist_id, char* expression /*out*/, s
H5_DLL herr_t H5Pset_external(hid_t plist_id, const char *name, off_t offset,
hsize_t size);
H5_DLL int H5Pget_external_count(hid_t plist_id);
-#ifdef H5_WANT_H5_V1_6_COMPAT
-H5_DLL herr_t H5Pget_external(hid_t plist_id, int idx, size_t name_size,
- char *name/*out*/, off_t *offset/*out*/,
- hsize_t *size/*out*/);
-#else /* H5_WANT_H5_V1_6_COMPAT */
H5_DLL herr_t H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size,
char *name/*out*/, off_t *offset/*out*/,
hsize_t *size/*out*/);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id,
const void *driver_info);
H5_DLL hid_t H5Pget_driver(hid_t plist_id);
@@ -233,7 +214,7 @@ H5_DLL herr_t H5Pset_filter(hid_t plist_id, H5Z_filter_t filter,
const unsigned int c_values[]);
H5_DLL int H5Pget_nfilters(hid_t plist_id);
#ifdef H5_WANT_H5_V1_6_COMPAT
-H5_DLL H5Z_filter_t H5Pget_filter(hid_t plist_id, int filter,
+H5_DLL H5Z_filter_t H5Pget_filter(hid_t plist_id, unsigned filter,
unsigned int *flags/*out*/,
size_t *cd_nelmts/*out*/,
unsigned cd_values[]/*out*/,
diff --git a/src/H5S.c b/src/H5S.c
index 6c3b353..4c5daa1 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -69,9 +69,6 @@ H5FL_DEFINE(H5S_t);
/* Declare a free list to manage the array's of hsize_t's */
H5FL_ARR_DEFINE(hsize_t,H5S_MAX_RANK);
-/* Declare a free list to manage the array's of hssize_t's */
-H5FL_ARR_DEFINE(hssize_t,H5S_MAX_RANK);
-
/*--------------------------------------------------------------------------
NAME
@@ -1737,7 +1734,6 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc)
{
size_t extent_size;
hssize_t select_size;
- H5S_class_t space_type;
H5F_t f; /* fake file structure*/
herr_t ret_value = SUCCEED;
@@ -1751,9 +1747,6 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc)
if((extent_size=H5O_raw_size(H5O_SDSPACE_ID, &f, obj))==0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size");
- /* Get space type */
- space_type = H5S_GET_EXTENT_TYPE(obj);
-
if((select_size=H5S_SELECT_SERIAL_SIZE(obj))<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size");
@@ -1771,7 +1764,7 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc)
*buf++ = H5S_ENCODE_VERSION;
/* Encode the "size of size" information */
- *buf++ = f.shared->sizeof_size;
+ *buf++ = (unsigned char)f.shared->sizeof_size;
/* Encode size of extent information. Pointer is actually moved in this macro. */
UINT32ENCODE(buf, extent_size);
@@ -1917,6 +1910,37 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5S_raw_size
+ *
+ * Purpose: Compute the 'raw' size of the extent, as stored on disk.
+ *
+ * Return: Success: non-zero
+ * Failure: zero
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * October 14, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+size_t
+H5S_raw_size(const H5F_t *f, const H5S_t *space)
+{
+ size_t ret_value;
+
+ FUNC_ENTER_NOAPI(H5S_raw_size, 0);
+
+ /* Find out the size of buffer needed for extent */
+ ret_value=H5O_raw_size(H5O_SDSPACE_ID, f, &(space->extent));
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5S_raw_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5S_get_simple_extent_type
*
* Purpose: Internal function for retrieving the type of extent for a dataspace object
diff --git a/src/H5SL.c b/src/H5SL.c
index fb406db..ab9764e 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -352,11 +352,11 @@ done:
PURPOSE
Count the number of objects in a skip list
USAGE
- ssize_t H5SL_count(slist)
+ size_t H5SL_count(slist)
H5SL_t *slist; IN: Pointer to skip list to count
RETURNS
- Returns non-negative on success, negative on failure.
+ Returns number of objects on success, can't fail
DESCRIPTION
Count elements in a skip list.
GLOBAL VARIABLES
@@ -364,7 +364,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-ssize_t
+size_t
H5SL_count(H5SL_t *slist)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SL_count);
diff --git a/src/H5SLprivate.h b/src/H5SLprivate.h
index 633e3e5..5ee6ac4 100644
--- a/src/H5SLprivate.h
+++ b/src/H5SLprivate.h
@@ -58,7 +58,7 @@ typedef herr_t (*H5SL_operator_t)(void *item, void *key,
/* Private routines */
/********************/
H5_DLL H5SL_t *H5SL_create(H5SL_type_t type, double p, size_t max_level);
-H5_DLL ssize_t H5SL_count(H5SL_t *slist);
+H5_DLL size_t H5SL_count(H5SL_t *slist);
H5_DLL herr_t H5SL_insert(H5SL_t *slist, void *item, void *key);
H5_DLL void *H5SL_remove(H5SL_t *slist, void *key);
H5_DLL void *H5SL_search(H5SL_t *slist, void *key);
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 5c124a6..5472d42 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -43,15 +43,15 @@ static htri_t H5S_all_is_valid(const H5S_t *space);
static hssize_t H5S_all_serial_size(const H5S_t *space);
static herr_t H5S_all_serialize(const H5S_t *space, uint8_t *buf);
static herr_t H5S_all_deserialize(H5S_t *space, const uint8_t *buf);
-static herr_t H5S_all_bounds(const H5S_t *space, hssize_t *start, hssize_t *end);
+static herr_t H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static htri_t H5S_all_is_contiguous(const H5S_t *space);
static htri_t H5S_all_is_single(const H5S_t *space);
static htri_t H5S_all_is_regular(const H5S_t *space);
static herr_t H5S_all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
/* Selection iteration callbacks */
-static herr_t H5S_all_iter_coords(const H5S_sel_iter_t *iter, hssize_t *coords);
-static herr_t H5S_all_iter_block(const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end);
+static herr_t H5S_all_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
+static herr_t H5S_all_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
static hsize_t H5S_all_iter_nelmts(const H5S_sel_iter_t *iter);
static htri_t H5S_all_iter_has_next_block(const H5S_sel_iter_t *iter);
static herr_t H5S_all_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
@@ -145,7 +145,7 @@ H5S_all_iter_init (H5S_sel_iter_t *iter, const H5S_t *space)
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_all_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords)
+H5S_all_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords)
{
herr_t ret_value=SUCCEED; /* Return value */
@@ -180,7 +180,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_all_iter_block (const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end)
+H5S_all_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
{
unsigned u; /* Local index variable */
@@ -565,8 +565,8 @@ done:
USAGE
herr_t H5S_all_bounds(space, start, end)
H5S_t *space; IN: Dataspace pointer of selection to query
- hssize_t *start; OUT: Starting coordinate of bounding box
- hssize_t *end; OUT: Opposite coordinate of bounding box
+ hsize_t *start; OUT: Starting coordinate of bounding box
+ hsize_t *end; OUT: Opposite coordinate of bounding box
RETURNS
Non-negative on success, negative on failure
DESCRIPTION
@@ -583,7 +583,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_all_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
+H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
{
int rank; /* Dataspace rank */
int i; /* index variable */
@@ -600,7 +600,7 @@ H5S_all_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
/* Just copy over the complete extent */
for(i=0; i<rank; i++) {
start[i]=0;
- H5_ASSIGN_OVERFLOW(end[i],space->extent.size[i]-1,hsize_t,hssize_t);
+ end[i]=space->extent.size[i]-1;
} /* end for */
FUNC_LEAVE_NOAPI(SUCCEED);
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 5a01f6a..fac113c 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -41,7 +41,7 @@ static H5S_hyper_span_info_t *H5S_hyper_copy_span (H5S_hyper_span_info_t *spans)
static herr_t H5S_hyper_span_scratch (H5S_hyper_span_info_t *spans, void *scr_value);
static herr_t H5S_hyper_span_precompute (H5S_hyper_span_info_t *spans, size_t elmt_size);
static herr_t H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
- const hssize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]);
+ const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]);
static herr_t H5S_hyper_generate_spans(H5S_t *space);
/* Needed for use in hyperslab code (H5Shyper.c) */
#ifdef NEW_HYPERSLAB_API
@@ -58,15 +58,15 @@ static htri_t H5S_hyper_is_valid(const H5S_t *space);
static hssize_t H5S_hyper_serial_size(const H5S_t *space);
static herr_t H5S_hyper_serialize(const H5S_t *space, uint8_t *buf);
static herr_t H5S_hyper_deserialize(H5S_t *space, const uint8_t *buf);
-static herr_t H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end);
+static herr_t H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static htri_t H5S_hyper_is_contiguous(const H5S_t *space);
static htri_t H5S_hyper_is_single(const H5S_t *space);
static htri_t H5S_hyper_is_regular(const H5S_t *space);
static herr_t H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
/* Selection iteration callbacks */
-static herr_t H5S_hyper_iter_coords(const H5S_sel_iter_t *iter, hssize_t *coords);
-static herr_t H5S_hyper_iter_block(const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end);
+static herr_t H5S_hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
+static herr_t H5S_hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
static hsize_t H5S_hyper_iter_nelmts(const H5S_sel_iter_t *iter);
static htri_t H5S_hyper_iter_has_next_block(const H5S_sel_iter_t *sel_iter);
static herr_t H5S_hyper_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
@@ -415,7 +415,7 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_hyper_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords)
+H5S_hyper_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_iter_coords);
@@ -435,17 +435,16 @@ H5S_hyper_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords)
flat_dim=iter->u.hyp.iter_rank-1;
/* Copy the coordinates up to where things got flattened */
- HDmemcpy(coords,iter->u.hyp.off,sizeof(hssize_t)*flat_dim);
+ HDmemcpy(coords,iter->u.hyp.off,sizeof(hsize_t)*flat_dim);
/* Compute the coordinates for the flattened dimensions */
- H5_CHECK_OVERFLOW(iter->u.hyp.off[flat_dim],hssize_t,hsize_t);
- H5V_array_calc((hsize_t)iter->u.hyp.off[flat_dim],iter->rank-flat_dim,&(iter->dims[flat_dim]),&(coords[flat_dim]));
+ H5V_array_calc(iter->u.hyp.off[flat_dim],iter->rank-flat_dim,&(iter->dims[flat_dim]),&(coords[flat_dim]));
} /* end if */
else
- HDmemcpy(coords,iter->u.hyp.off,sizeof(hssize_t)*iter->rank);
+ HDmemcpy(coords,iter->u.hyp.off,sizeof(hsize_t)*iter->rank);
} /* end if */
else
- HDmemcpy(coords,iter->u.hyp.off,sizeof(hssize_t)*iter->rank);
+ HDmemcpy(coords,iter->u.hyp.off,sizeof(hsize_t)*iter->rank);
FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_hyper_iter_coords() */
@@ -470,7 +469,7 @@ H5S_hyper_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords)
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_hyper_iter_block (const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end)
+H5S_hyper_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
{
unsigned u; /* Local index variable */
@@ -562,7 +561,7 @@ H5S_hyper_iter_has_next_block(const H5S_sel_iter_t *iter)
/* Check for a single "regular" hyperslab */
if(iter->u.hyp.diminfo_valid) {
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- const hssize_t *toff; /* Temporary offset in selection */
+ const hsize_t *toff; /* Temporary offset in selection */
/* Check if the offset of the iterator is at the last location in all dimensions */
tdiminfo=iter->u.hyp.diminfo;
@@ -571,8 +570,7 @@ H5S_hyper_iter_has_next_block(const H5S_sel_iter_t *iter)
/* If there is only one block, continue */
if(tdiminfo[u].count==1)
continue;
- H5_CHECK_OVERFLOW(tdiminfo[u].start+((tdiminfo[u].count-1)*tdiminfo[u].stride),hsize_t,hssize_t);
- if(toff[u]!=(hssize_t)(tdiminfo[u].start+((tdiminfo[u].count-1)*tdiminfo[u].stride)))
+ if(toff[u]!=(tdiminfo[u].start+((tdiminfo[u].count-1)*tdiminfo[u].stride)))
HGOTO_DONE(TRUE);
} /* end for */
} /* end if */
@@ -705,7 +703,7 @@ H5S_hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
else {
H5S_hyper_span_t *curr_span; /* Current hyperslab span node */
H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */
- hssize_t *abs_arr; /* Absolute hyperslab span position */
+ hsize_t *abs_arr; /* Absolute hyperslab span position */
int curr_dim; /* Temporary rank holder */
/* Set the rank of the fastest changing dimension */
@@ -905,7 +903,7 @@ H5S_hyper_iter_next_block(H5S_sel_iter_t *iter)
else {
H5S_hyper_span_t *curr_span; /* Current hyperslab span node */
H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */
- hssize_t *abs_arr; /* Absolute hyperslab span position */
+ hsize_t *abs_arr; /* Absolute hyperslab span position */
int curr_dim; /* Temporary rank holder */
/* Set the rank of the fastest changing dimension */
@@ -1031,7 +1029,7 @@ H5S_hyper_iter_release (H5S_sel_iter_t *iter)
Make a new hyperslab span node
USAGE
H5S_hyper_span_t *H5S_hyper_new_span(low, high, down, next)
- hssize_t low, high; IN: Low and high bounds for new span node
+ hsize_t low, high; IN: Low and high bounds for new span node
H5S_hyper_span_info_t *down; IN: Down span tree for new node
H5S_hyper_span_t *next; IN: Next span for new node
RETURNS
@@ -1046,7 +1044,7 @@ H5S_hyper_iter_release (H5S_sel_iter_t *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static H5S_hyper_span_t *
-H5S_hyper_new_span (hssize_t low, hssize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next)
+H5S_hyper_new_span (hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next)
{
H5S_hyper_span_t *ret_value;
@@ -1665,10 +1663,10 @@ H5S_hyper_is_valid_helper (const H5S_hyper_span_info_t *spans, const hssize_t *o
while(curr!=NULL && ret_value==TRUE) {
/* Check if an offset has been defined */
/* Bounds check the selected point + offset against the extent */
- if(((curr->low+offset[rank])>=(hssize_t)size[rank])
- || ((curr->low+offset[rank])<0)
- || ((curr->high+offset[rank])>=(hssize_t)size[rank])
- || ((curr->high+offset[rank])<0)) {
+ if((((hssize_t)curr->low+offset[rank])>=(hssize_t)size[rank])
+ || (((hssize_t)curr->low+offset[rank])<0)
+ || (((hssize_t)curr->high+offset[rank])>=(hssize_t)size[rank])
+ || (((hssize_t)curr->high+offset[rank])<0)) {
ret_value=FALSE;
break;
} /* end if */
@@ -1730,12 +1728,12 @@ H5S_hyper_is_valid (const H5S_t *space)
/* no data point is chosen */
if (diminfo[u].count && diminfo[u].block) {
/* Bounds check the start point in this dimension */
- if((diminfo[u].start+space->select.offset[u])<0 ||
- (diminfo[u].start+space->select.offset[u])>=(hssize_t)space->extent.size[u])
+ if(((hssize_t)diminfo[u].start+space->select.offset[u])<0 ||
+ ((hssize_t)diminfo[u].start+space->select.offset[u])>=(hssize_t)space->extent.size[u])
HGOTO_DONE(FALSE)
/* Compute the largest location in this dimension */
- end=diminfo[u].start+diminfo[u].stride*(diminfo[u].count-1)+(diminfo[u].block-1)+space->select.offset[u];
+ end=(hssize_t)(diminfo[u].start+diminfo[u].stride*(diminfo[u].count-1)+(diminfo[u].block-1))+space->select.offset[u];
/* Bounds check the end point in this dimension */
if(end<0 || end>=(hssize_t)space->extent.size[u])
@@ -1956,7 +1954,7 @@ H5S_hyper_serial_size (const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hssize_t *start, hssize_t *end, hsize_t rank, uint8_t **buf)
+H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hsize_t *start, hsize_t *end, hsize_t rank, uint8_t **buf)
{
H5S_hyper_span_t *curr; /* Pointer to current hyperslab span */
hsize_t u; /* Index variable */
@@ -2035,10 +2033,10 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t *buf)
{
const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */
- hssize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
- hssize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */
- hssize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */
- hssize_t temp_off; /* Offset in a given dimension */
+ hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
+ hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */
+ hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */
+ hsize_t temp_off; /* Offset in a given dimension */
uint8_t *lenp; /* pointer to length location for later storage */
uint32_t len=0; /* number of bytes used */
int i; /* local counting variable */
@@ -2194,13 +2192,13 @@ H5S_hyper_deserialize (H5S_t *space, const uint8_t *buf)
{
uint32_t rank; /* rank of points */
size_t num_elem=0; /* number of elements in selection */
- hssize_t start[H5O_LAYOUT_NDIMS]; /* hyperslab start information */
- hssize_t end[H5O_LAYOUT_NDIMS]; /* hyperslab end information */
+ hsize_t start[H5O_LAYOUT_NDIMS]; /* hyperslab start information */
+ hsize_t end[H5O_LAYOUT_NDIMS]; /* hyperslab end information */
hsize_t stride[H5O_LAYOUT_NDIMS]; /* hyperslab stride information */
hsize_t count[H5O_LAYOUT_NDIMS]; /* hyperslab count information */
hsize_t block[H5O_LAYOUT_NDIMS]; /* hyperslab block information */
- hssize_t *tstart=NULL; /* temporary hyperslab pointers */
- hssize_t *tend=NULL; /* temporary hyperslab pointers */
+ hsize_t *tstart=NULL; /* temporary hyperslab pointers */
+ hsize_t *tend=NULL; /* temporary hyperslab pointers */
hsize_t *tstride=NULL; /* temporary hyperslab pointers */
hsize_t *tcount=NULL; /* temporary hyperslab pointers */
hsize_t *tblock=NULL; /* temporary hyperslab pointers */
@@ -2258,8 +2256,8 @@ done:
USAGE
herr_t H5S_hyper_span_blocklist(spans, start, end, rank, startblock, numblocks, buf)
H5S_hyper_span_info_t *spans; IN: Dataspace pointer of selection to query
- hssize_t start[]; IN/OUT: Accumulated start points
- hssize_t end[]; IN/OUT: Accumulated end points
+ hsize_t start[]; IN/OUT: Accumulated start points
+ hsize_t end[]; IN/OUT: Accumulated end points
hsize_t rank; IN: Rank of dataspace
hsize_t *startblock; IN/OUT: Hyperslab block to start with
hsize_t *numblocks; IN/OUT: Number of hyperslab blocks to get
@@ -2284,7 +2282,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_span_blocklist(H5S_hyper_span_info_t *spans, hssize_t start[], hssize_t end[], hsize_t rank, hsize_t *startblock, hsize_t *numblocks, hsize_t **buf)
+H5S_hyper_span_blocklist(H5S_hyper_span_info_t *spans, hsize_t start[], hsize_t end[], hsize_t rank, hsize_t *startblock, hsize_t *numblocks, hsize_t **buf)
{
H5S_hyper_span_t *curr; /* Pointer to current hyperslab span */
hsize_t u; /* Index variable */
@@ -2389,10 +2387,10 @@ H5S_get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startbloc
{
H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */
- hssize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
- hssize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */
- hssize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */
- hssize_t temp_off; /* Offset in a given dimension */
+ hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
+ hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */
+ hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */
+ hsize_t temp_off; /* Offset in a given dimension */
int i; /* Counter */
int fast_dim; /* Rank of the fastest changing dimension for the dataspace */
int temp_dim; /* Temporary rank holder */
@@ -2592,12 +2590,12 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_bounds_helper (const H5S_hyper_span_info_t *spans, const hssize_t *offset, hsize_t rank, hssize_t *start, hssize_t *end)
+H5S_hyper_bounds_helper (const H5S_hyper_span_info_t *spans, const hssize_t *offset, hsize_t rank, hsize_t *start, hsize_t *end)
{
H5S_hyper_span_t *curr; /* Hyperslab information nodes */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_bounds_helper);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_bounds_helper)
assert(spans);
assert(offset);
@@ -2608,6 +2606,10 @@ H5S_hyper_bounds_helper (const H5S_hyper_span_info_t *spans, const hssize_t *off
/* Check each point to determine whether selection+offset is within extent */
curr=spans->head;
while(curr!=NULL) {
+ /* Check for offset moving selection negative */
+ if(((hssize_t)curr->low+offset[rank])<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
+
/* Check if the current span extends the bounding box */
if((curr->low+offset[rank])<start[rank])
start[rank]=curr->low+offset[rank];
@@ -2617,7 +2619,7 @@ H5S_hyper_bounds_helper (const H5S_hyper_span_info_t *spans, const hssize_t *off
/* Recurse if this node has down spans */
if(curr->down!=NULL) {
if(H5S_hyper_bounds_helper(curr->down,offset,rank+1,start,end)<0)
- HGOTO_DONE(FAIL)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "failure in lower dimension")
} /* end if */
/* Advance to next node */
@@ -2625,7 +2627,7 @@ H5S_hyper_bounds_helper (const H5S_hyper_span_info_t *spans, const hssize_t *off
} /* end while */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_hyper_bounds_helper() */
@@ -2656,13 +2658,13 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
+H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
{
int rank; /* Dataspace rank */
int i; /* index variable */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_bounds);
+ FUNC_ENTER_NOAPI(H5S_hyper_bounds,FAIL)
assert(space);
assert(start);
@@ -2671,8 +2673,8 @@ H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
/* Set the start and end arrays up */
rank=space->extent.rank;
for(i=0; i<rank; i++) {
- start[i]=HSSIZET_MAX;
- end[i]=HSSIZET_MIN;
+ start[i]=HSIZET_MAX;
+ end[i]=0;
} /* end for */
/* Check for a "regular" hyperslab selection */
@@ -2681,6 +2683,10 @@ H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
/* Check each dimension */
for(i=0; i<rank; i++) {
+ /* Check for offset moving selection negative */
+ if((space->select.offset[i]+(hssize_t)diminfo[i].start)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
+
/* Compute the smallest location in this dimension */
start[i]=diminfo[i].start+space->select.offset[i];
@@ -2693,7 +2699,8 @@ H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
ret_value=H5S_hyper_bounds_helper(space->select.sel_info.hslab->span_lst,space->select.offset,(hsize_t)0,start,end);
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_bounds() */
@@ -2819,7 +2826,7 @@ H5S_hyper_is_contiguous(const H5S_t *space)
} /* end if */
else {
/* If this span doesn't cover the entire dimension, then this selection isn't contiguous */
- if(((span->high-span->low)+1)!=(hssize_t)space->extent.size[u]) {
+ if(((span->high-span->low)+1)!=space->extent.size[u]) {
large_contiguous=FALSE;
break;
} /* end if */
@@ -3088,7 +3095,7 @@ H5S_hyper_recover_span (unsigned *recover, H5S_hyper_span_t **curr_span, H5S_hyp
USAGE
H5S_hyper_span_t *H5S_hyper_coord_to_span(rank, coords)
unsigned rank; IN: Number of dimensions of coordinate
- hssize_t *coords; IN: Location of element
+ hsize_t *coords; IN: Location of element
RETURNS
Non-negative on success, negative on failure
DESCRIPTION
@@ -3099,7 +3106,7 @@ H5S_hyper_recover_span (unsigned *recover, H5S_hyper_span_t **curr_span, H5S_hyp
REVISION LOG
--------------------------------------------------------------------------*/
static H5S_hyper_span_t *
-H5S_hyper_coord_to_span(unsigned rank, hssize_t *coords)
+H5S_hyper_coord_to_span(unsigned rank, hsize_t *coords)
{
H5S_hyper_span_t *new_span; /* Pointer to new span tree for coordinate */
H5S_hyper_span_info_t *down=NULL; /* Pointer to new span tree for next level down */
@@ -3153,7 +3160,7 @@ done:
herr_t H5S_hyper_add_span_element_helper(prev_span, span_tree, rank, coords)
H5S_hyper_span_info_t *span_tree; IN/OUT: Pointer to span tree to append to
unsigned rank; IN: Number of dimensions of coordinates
- hssize_t *coords; IN: Location of element to add to span tree
+ hsize_t *coords; IN: Location of element to add to span tree
RETURNS
Non-negative on success, negative on failure
DESCRIPTION
@@ -3165,7 +3172,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned rank, hssize_t *coords)
+H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned rank, hsize_t *coords)
{
H5S_hyper_span_info_t *tspan_info; /* Temporary pointer to span info */
H5S_hyper_span_info_t *prev_span_info; /* Pointer to span info for level above current position */
@@ -3355,7 +3362,7 @@ done:
herr_t H5S_hyper_add_span_element(space, span_tree, rank, coords)
H5S_t *space; IN/OUT: Pointer to dataspace to add coordinate to
unsigned rank; IN: Number of dimensions of coordinates
- hssize_t *coords; IN: Location of element to add to span tree
+ hsize_t *coords; IN: Location of element to add to span tree
RETURNS
Non-negative on success, negative on failure
DESCRIPTION
@@ -3367,7 +3374,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_hyper_add_span_element(H5S_t *space, unsigned rank, hssize_t *coords)
+H5S_hyper_add_span_element(H5S_t *space, unsigned rank, hsize_t *coords)
{
herr_t ret_value=SUCCEED; /* Return value */
@@ -3496,7 +3503,7 @@ H5S_hyper_convert(H5S_t *space)
case H5S_SEL_ALL: /* All elements selected in dataspace */
/* Convert current "all" selection to "real" hyperslab selection */
{
- hssize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
+ hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */
hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */
@@ -3658,9 +3665,9 @@ done:
htri_t H5S_hyper_intersect_block_helper(spans, start, end)
H5S_hyper_span_info_t *spans; IN: First span tree to operate with
hssize_t *offset; IN: Selection offset coordinate
- hssize_t *start; IN: Starting coordinate for block
- hssize_t *end; IN: Ending coordinate for block
- RETURNS
+ hsize_t *start; IN: Starting coordinate for block
+ hsize_t *end; IN: Ending coordinate for block
+ RETURN
Non-negative on success, negative on failure
DESCRIPTION
Quickly detect intersections between span tree and block
@@ -3670,7 +3677,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_hyper_intersect_block_helper (const H5S_hyper_span_info_t *spans, hssize_t *offset, hssize_t *start, hssize_t *end)
+H5S_hyper_intersect_block_helper (const H5S_hyper_span_info_t *spans, hssize_t *offset, hsize_t *start, hsize_t *end)
{
H5S_hyper_span_t *curr; /* Pointer to current span in 1st span tree */
htri_t status; /* Status from recursive call */
@@ -3690,11 +3697,11 @@ H5S_hyper_intersect_block_helper (const H5S_hyper_span_info_t *spans, hssize_t *
/* Iterate over the spans in the tree */
while(curr!=NULL) {
/* Check for span entirely before block */
- if((curr->high+*offset)<*start)
+ if(((hssize_t)curr->high+*offset)<(hssize_t)*start)
/* Advance to next span in this dimension */
curr=curr->next;
/* If this span is past the end of the block, then we're done in this dimension */
- else if((curr->low+*offset)>*end)
+ else if(((hssize_t)curr->low+*offset)>(hssize_t)*end)
HGOTO_DONE(FALSE)
/* block & span overlap */
else {
@@ -3740,7 +3747,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5S_hyper_intersect_block (H5S_t *space, hssize_t *start, hssize_t *end)
+H5S_hyper_intersect_block (H5S_t *space, hsize_t *start, hsize_t *end)
{
htri_t ret_value=FAIL; /* Return value */
@@ -3756,7 +3763,7 @@ H5S_hyper_intersect_block (H5S_t *space, hssize_t *start, hssize_t *end)
if(H5S_GET_SELECT_TYPE(space)==H5S_SEL_ALL)
HGOTO_DONE(TRUE);
- /* Check that the space selections both have span trees */
+ /* Check that the space selection has a span tree */
if(space->select.sel_info.hslab->span_lst==NULL)
if(H5S_hyper_generate_spans(space)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree");
@@ -3772,11 +3779,120 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5S_hyper_adjust_helper
+ H5S_hyper_adjust_helper_u
PURPOSE
Helper routine to adjust offsets in span trees
USAGE
- herr_t H5S_hyper_adjust_helper(spans, offset)
+ herr_t H5S_hyper_adjust_helper_u(spans, offset)
+ H5S_hyper_span_info_t *spans; IN: Span tree to operate with
+ const hsize_t *offset; IN: Offset to subtract
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Adjust the location of the spans in a span tree by subtracting an offset
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S_hyper_adjust_helper_u (H5S_hyper_span_info_t *spans, const hsize_t *offset)
+{
+ H5S_hyper_span_t *span; /* Pointer to current span in span tree */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_adjust_helper_u);
+
+ /* Sanity check */
+ assert(spans);
+ assert(offset);
+
+ /* Check if we've already set this down span tree */
+ if(spans->scratch!=(H5S_hyper_span_info_t *)~((size_t)NULL)) {
+ /* Set the tree's scratch pointer */
+ spans->scratch=(H5S_hyper_span_info_t *)~((size_t)NULL);
+
+ /* Get the span lists for each span in this tree */
+ span=spans->head;
+
+ /* Iterate over the spans in tree */
+ while(span!=NULL) {
+ /* Adjust span offset */
+ assert(span->low>=*offset);
+ span->low-=*offset;
+ span->high-=*offset;
+
+ /* Recursively adjust spans in next dimension down */
+ if(span->down!=NULL)
+ H5S_hyper_adjust_helper_u(span->down,offset+1);
+
+ /* Advance to next span in this dimension */
+ span=span->next;
+ } /* end while */
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(SUCCEED);
+} /* H5S_hyper_adjust_helper_u() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_hyper_adjust_u
+ PURPOSE
+ Adjust a hyperslab selection by subtracting an offset
+ USAGE
+ herr_t H5S_hyper_adjust_u(space,offset)
+ H5S_t *space; IN/OUT: Pointer to dataspace to adjust
+ const hsize_t *offset; IN: Offset to subtract
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Moves a hyperslab selection by subtracting an offset from it.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5S_hyper_adjust_u(H5S_t *space, const hsize_t *offset)
+{
+ unsigned u; /* Local index variable */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_adjust_u);
+
+ assert(space);
+ assert(offset);
+
+ /* Subtract the offset from the "regular" coordinates, if they exist */
+ if(space->select.sel_info.hslab->diminfo_valid) {
+ for(u=0; u<space->extent.rank; u++) {
+ assert(space->select.sel_info.hslab->opt_diminfo[u].start>=offset[u]);
+ space->select.sel_info.hslab->opt_diminfo[u].start-=offset[u];
+ } /* end for */
+ } /* end if */
+
+ /* Subtract the offset from the span tree coordinates, if they exist */
+ if(space->select.sel_info.hslab->span_lst) {
+ if(H5S_hyper_adjust_helper_u(space->select.sel_info.hslab->span_lst,offset)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab offset adjustment");
+
+ /* Reset the scratch pointers for the next routine which needs them */
+ if(H5S_hyper_span_scratch(space->select.sel_info.hslab->span_lst,NULL)==FAIL)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't reset hyperslab scratch pointer");
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* H5S_hyper_adjust_u() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_hyper_adjust_helper_s
+ PURPOSE
+ Helper routine to adjust offsets in span trees
+ USAGE
+ herr_t H5S_hyper_adjust_helper_s(spans, offset)
H5S_hyper_span_info_t *spans; IN: Span tree to operate with
const hssize_t *offset; IN: Offset to subtract
RETURNS
@@ -3789,11 +3905,11 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_adjust_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset)
+H5S_hyper_adjust_helper_s (H5S_hyper_span_info_t *spans, const hssize_t *offset)
{
H5S_hyper_span_t *span; /* Pointer to current span in span tree */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_adjust_helper);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_adjust_helper_s);
/* Sanity check */
assert(spans);
@@ -3810,14 +3926,13 @@ H5S_hyper_adjust_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset)
/* Iterate over the spans in tree */
while(span!=NULL) {
/* Adjust span offset */
+ assert((hssize_t)span->low>=*offset);
span->low-=*offset;
- assert(span->low>=0);
span->high-=*offset;
- assert(span->high>=0);
/* Recursively adjust spans in next dimension down */
if(span->down!=NULL)
- H5S_hyper_adjust_helper(span->down,offset+1);
+ H5S_hyper_adjust_helper_s(span->down,offset+1);
/* Advance to next span in this dimension */
span=span->next;
@@ -3825,16 +3940,16 @@ H5S_hyper_adjust_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset)
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED);
-} /* H5S_hyper_adjust_helper() */
+} /* H5S_hyper_adjust_helper_s() */
/*--------------------------------------------------------------------------
NAME
- H5S_hyper_adjust
+ H5S_hyper_adjust_s
PURPOSE
Adjust a hyperslab selection by subtracting an offset
USAGE
- herr_t H5S_hyper_adjust(space,offset)
+ herr_t H5S_hyper_adjust_s(space,offset)
H5S_t *space; IN/OUT: Pointer to dataspace to adjust
const hssize_t *offset; IN: Offset to subtract
RETURNS
@@ -3847,12 +3962,12 @@ H5S_hyper_adjust_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_hyper_adjust(H5S_t *space, const hssize_t *offset)
+H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset)
{
unsigned u; /* Local index variable */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_adjust);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_adjust_s);
assert(space);
assert(offset);
@@ -3860,14 +3975,14 @@ H5S_hyper_adjust(H5S_t *space, const hssize_t *offset)
/* Subtract the offset from the "regular" coordinates, if they exist */
if(space->select.sel_info.hslab->diminfo_valid) {
for(u=0; u<space->extent.rank; u++) {
+ assert((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start>=offset[u]);
space->select.sel_info.hslab->opt_diminfo[u].start-=offset[u];
- assert(space->select.sel_info.hslab->opt_diminfo[u].start>=0);
} /* end for */
} /* end if */
/* Subtract the offset from the span tree coordinates, if they exist */
if(space->select.sel_info.hslab->span_lst) {
- if(H5S_hyper_adjust_helper(space->select.sel_info.hslab->span_lst,offset)<0)
+ if(H5S_hyper_adjust_helper_s(space->select.sel_info.hslab->span_lst,offset)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab offset adjustment");
/* Reset the scratch pointers for the next routine which needs them */
@@ -3877,7 +3992,7 @@ H5S_hyper_adjust(H5S_t *space, const hssize_t *offset)
done:
FUNC_LEAVE_NOAPI(ret_value);
-} /* H5S_hyper_adjust() */
+} /* H5S_hyper_adjust_s() */
/*--------------------------------------------------------------------------
@@ -3921,10 +4036,9 @@ H5S_hyper_move_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset)
/* Iterate over the spans in tree */
while(span!=NULL) {
/* Adjust span location */
+ assert(*offset>=0);
span->high=*offset+(span->high-span->low);
- assert(span->high>=0);
span->low=*offset;
- assert(span->low>=0);
/* Recursively move spans in next dimension down */
if(span->down!=NULL)
@@ -3971,8 +4085,8 @@ H5S_hyper_move(H5S_t *space, const hssize_t *offset)
/* Move to the offset with the "regular" coordinates, if they exist */
if(space->select.sel_info.hslab->diminfo_valid) {
for(u=0; u<space->extent.rank; u++) {
+ assert(offset[u]>=0);
space->select.sel_info.hslab->opt_diminfo[u].start=offset[u];
- assert(space->select.sel_info.hslab->opt_diminfo[u].start>=0);
} /* end for */
} /* end if */
@@ -4028,7 +4142,7 @@ H5S_hyper_normalize_offset(H5S_t *space)
space->select.offset[u] =- space->select.offset[u];
/* Call the existing 'adjust' routine */
- if(H5S_hyper_adjust(space, space->select.offset)<0)
+ if(H5S_hyper_adjust_s(space, space->select.offset)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab normalization");
/* Zero out the selection offset */
@@ -4050,7 +4164,7 @@ done:
herr_t H5S_hyper_append_span(prev_span, span_tree, low, high, down, next)
H5S_hyper_span_t **prev_span; IN/OUT: Pointer to previous span in list
H5S_hyper_span_info_t **span_tree; IN/OUT: Pointer to span tree to append to
- hssize_t low, high; IN: Low and high bounds for new span node
+ hsize_t low, high; IN: Low and high bounds for new span node
H5S_hyper_span_info_t *down; IN: Down span tree for new node
H5S_hyper_span_t *next; IN: Next span for new node
RETURNS
@@ -4064,7 +4178,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_append_span (H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t ** span_tree, hssize_t low, hssize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next)
+H5S_hyper_append_span (H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t ** span_tree, hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next)
{
H5S_hyper_span_t *new_span;
herr_t ret_value=SUCCEED; /* Return value */
@@ -5022,7 +5136,7 @@ H5S_hyper_merge_spans (H5S_t *space, H5S_hyper_span_info_t *new_spans, hbool_t c
PURPOSE
Count the number of elements in a span tree
USAGE
- hssize_t H5S_hyper_spans_nelem(spans)
+ hsize_t H5S_hyper_spans_nelem(spans)
const H5S_hyper_span_info_t *spans; IN: Hyperslan span tree to count elements of
RETURNS
Number of elements in span tree on success; negative on failure
@@ -5033,11 +5147,11 @@ H5S_hyper_merge_spans (H5S_t *space, H5S_hyper_span_info_t *new_spans, hbool_t c
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static hssize_t
+static hsize_t
H5S_hyper_spans_nelem (H5S_hyper_span_info_t *spans)
{
H5S_hyper_span_t *span; /* Hyperslab span */
- hssize_t ret_value;
+ hsize_t ret_value;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_spans_nelem);
@@ -5072,7 +5186,7 @@ H5S_hyper_spans_nelem (H5S_hyper_span_info_t *spans)
USAGE
H5S_hyper_span_t *H5S_hyper_make_spans(rank, start, stride, count, block)
unsigned rank; IN: # of dimensions of the space
- const hssize_t *start; IN: Starting location of the hyperslabs
+ const hsize_t *start; IN: Starting location of the hyperslabs
const hsize_t *stride; IN: Stride from the beginning of one block to
the next
const hsize_t *count; IN: Number of blocks
@@ -5090,7 +5204,7 @@ H5S_hyper_spans_nelem (H5S_hyper_span_info_t *spans)
REVISION LOG
--------------------------------------------------------------------------*/
static H5S_hyper_span_info_t *
-H5S_hyper_make_spans (unsigned rank, const hssize_t *start, const hsize_t *stride,
+H5S_hyper_make_spans (unsigned rank, const hsize_t *start, const hsize_t *stride,
const hsize_t *count, const hsize_t *block)
{
H5S_hyper_span_info_t *down;/* Pointer to spans in next dimension down */
@@ -5320,7 +5434,7 @@ H5S_hyper_rebuild (H5S_t *space)
static herr_t
H5S_hyper_generate_spans(H5S_t *space)
{
- hssize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
+ hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */
hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */
@@ -5366,7 +5480,7 @@ done:
*/
static herr_t
H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
- const hssize_t start[],
+ const hsize_t start[],
const hsize_t stride[],
const hsize_t count[],
const hsize_t block[])
@@ -5375,7 +5489,6 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
H5S_hyper_span_info_t *a_not_b=NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */
H5S_hyper_span_info_t *a_and_b=NULL; /* Span tree for hyperslab spans in both old and new span trees */
H5S_hyper_span_info_t *b_not_a=NULL; /* Span tree for hyperslab spans in new span tree and not in old span tree */
- hssize_t nelem; /* Number of elements in hyperslab span tree */
htri_t status; /* Status from internal calls */
herr_t ret_value=SUCCEED; /* Return value */
@@ -5400,9 +5513,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Set the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(new_spans))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- space->select.num_elem=nelem;
+ space->select.num_elem=H5S_hyper_spans_nelem(new_spans);
/* Indicate that the new_spans are owned */
new_spans=NULL;
@@ -5420,9 +5531,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(b_not_a))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- space->select.num_elem+=nelem;
+ space->select.num_elem+=H5S_hyper_spans_nelem(b_not_a);
} /* end if */
break;
@@ -5441,9 +5550,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(a_and_b))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- space->select.num_elem=nelem;
+ space->select.num_elem=H5S_hyper_spans_nelem(a_and_b);
/* Indicate that the a_and_b spans are owned */
a_and_b=NULL;
@@ -5465,18 +5572,14 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(a_not_b))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- space->select.num_elem=nelem;
+ space->select.num_elem=H5S_hyper_spans_nelem(a_not_b);
} /* end if */
if(b_not_a!=NULL) {
if(H5S_hyper_merge_spans(space,b_not_a,FALSE)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(b_not_a))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- space->select.num_elem+=nelem;
+ space->select.num_elem+=H5S_hyper_spans_nelem(b_not_a);
} /* end if */
break;
@@ -5495,9 +5598,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(a_not_b))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- space->select.num_elem=nelem;
+ space->select.num_elem=H5S_hyper_spans_nelem(a_not_b);
/* Indicate that the a_not_b are owned */
a_not_b=NULL;
@@ -5519,9 +5620,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(b_not_a))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- space->select.num_elem=nelem;
+ space->select.num_elem=H5S_hyper_spans_nelem(b_not_a);
/* Indicate that the b_not_a are owned */
b_not_a=NULL;
@@ -5602,7 +5701,7 @@ done:
*/
herr_t
H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
- const hssize_t start[],
+ const hsize_t start[],
const hsize_t *stride,
const hsize_t count[],
const hsize_t *block)
@@ -5701,7 +5800,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Convert current "all" selection to "real" hyperslab selection */
/* Then allow operation to proceed */
{
- hssize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
+ hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */
hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */
@@ -5810,10 +5909,10 @@ done:
herr_t H5Sselect_hyperslab(dsid, op, start, stride, count, block)
hid_t dsid; IN: Dataspace ID of selection to modify
H5S_seloper_t op; IN: Operation to perform on current selection
- const hssize_t *start; IN: Offset of start of hyperslab
- const hssize_t *stride; IN: Hyperslab stride
- const hssize_t *count; IN: Number of blocks included in hyperslab
- const hssize_t *block; IN: Size of block in hyperslab
+ const hsize_t *start; IN: Offset of start of hyperslab
+ const hsize_t *stride; IN: Hyperslab stride
+ const hsize_t *count; IN: Number of blocks included in hyperslab
+ const hsize_t *block; IN: Size of block in hyperslab
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -5828,7 +5927,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[],
+H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
const hsize_t stride[], const hsize_t count[], const hsize_t block[])
{
H5S_t *space = NULL; /* Dataspace to modify selection of */
@@ -5836,7 +5935,7 @@ H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[],
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(H5Sselect_hyperslab, FAIL);
- H5TRACE6("e","iSs*Hs*h*h*h",space_id,op,start,stride,count,block);
+ H5TRACE6("e","iSs*h*h*h*h",space_id,op,start,stride,count,block);
/* Check args */
if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE)))
@@ -5887,7 +5986,6 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
H5S_hyper_span_info_t *a_not_b=NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */
H5S_hyper_span_info_t *a_and_b=NULL; /* Span tree for hyperslab spans in both old and new span trees */
H5S_hyper_span_info_t *b_not_a=NULL; /* Span tree for hyperslab spans in new span tree and not in old span tree */
- hssize_t nelem; /* Number of elements in hyperslab span tree */
htri_t status; /* Status from internal calls */
herr_t ret_value=SUCCEED; /* Return value */
@@ -5905,9 +6003,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(spans2))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- result->select.num_elem=nelem;
+ result->select.num_elem=H5S_hyper_spans_nelem(spans2);
/* Indicate that we took ownership of span2, if allowed */
if(can_own_span2)
@@ -5929,9 +6025,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(spans1))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- result->select.num_elem=nelem;
+ result->select.num_elem=H5S_hyper_spans_nelem(spans1);
} /* end if */
/* Add any new spans from spans2 to current selection */
@@ -5940,9 +6034,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(b_not_a))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- result->select.num_elem+=nelem;
+ result->select.num_elem+=H5S_hyper_spans_nelem(b_not_a);
} /* end if */
break;
@@ -5953,9 +6045,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(a_and_b))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- result->select.num_elem=nelem;
+ result->select.num_elem=H5S_hyper_spans_nelem(a_and_b);
/* Indicate that the result owns the a_and_b spans */
a_and_b=NULL;
@@ -5969,18 +6059,14 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(a_not_b))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- result->select.num_elem=nelem;
+ result->select.num_elem=H5S_hyper_spans_nelem(a_not_b);
} /* end if */
if(b_not_a!=NULL) {
if(H5S_hyper_merge_spans(result,b_not_a,FALSE)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(b_not_a))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- result->select.num_elem+=nelem;
+ result->select.num_elem+=H5S_hyper_spans_nelem(b_not_a);
} /* end if */
break;
@@ -5991,9 +6077,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(a_not_b))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- result->select.num_elem=nelem;
+ result->select.num_elem=H5S_hyper_spans_nelem(a_not_b);
/* Indicate that the result owns the a_not_b spans */
a_not_b=NULL;
@@ -6007,9 +6091,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(b_not_a))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- result->select.num_elem=nelem;
+ result->select.num_elem=H5S_hyper_spans_nelem(b_not_a);
/* Indicate that the result owns the b_not_a spans */
b_not_a=NULL;
@@ -6085,7 +6167,7 @@ done:
*/
static herr_t
H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
- const hssize_t start[],
+ const hsize_t start[],
const hsize_t stride[],
const hsize_t count[],
const hsize_t block[])
@@ -6158,7 +6240,7 @@ done:
*/
herr_t
H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
- const hssize_t start[],
+ const hsize_t start[],
const hsize_t *stride,
const hsize_t count[],
const hsize_t *block)
@@ -6257,7 +6339,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Convert current "all" selection to "real" hyperslab selection */
/* Then allow operation to proceed */
{
- hssize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
+ hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */
hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */
@@ -6368,10 +6450,10 @@ done:
herr_t H5Sselect_hyperslab(dsid, op, start, stride, count, block)
hid_t dsid; IN: Dataspace ID of selection to modify
H5S_seloper_t op; IN: Operation to perform on current selection
- const hssize_t *start; IN: Offset of start of hyperslab
- const hssize_t *stride; IN: Hyperslab stride
- const hssize_t *count; IN: Number of blocks included in hyperslab
- const hssize_t *block; IN: Size of block in hyperslab
+ const hsize_t *start; IN: Offset of start of hyperslab
+ const hsize_t *stride; IN: Hyperslab stride
+ const hsize_t *count; IN: Number of blocks included in hyperslab
+ const hsize_t *block; IN: Size of block in hyperslab
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -6386,14 +6468,14 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[],
+H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
const hsize_t stride[], const hsize_t count[], const hsize_t block[])
{
H5S_t *space = NULL; /* Dataspace to modify selection of */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(H5Sselect_hyperslab, FAIL);
- H5TRACE6("e","iSs*Hs*h*h*h",space_id,op,start,stride,count,block);
+ H5TRACE6("e","iSs*h*h*h*h",space_id,op,start,stride,count,block);
/* Check args */
if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE)))
@@ -6435,10 +6517,10 @@ done:
hid_t H5Srefine_hyperslab(dsid, op, start, stride, count, block)
hid_t dsid; IN: Dataspace ID of selection to use
H5S_seloper_t op; IN: Operation to perform on current selection
- const hssize_t *start; IN: Offset of start of hyperslab
- const hssize_t *stride; IN: Hyperslab stride
- const hssize_t *count; IN: Number of blocks included in hyperslab
- const hssize_t *block; IN: Size of block in hyperslab
+ const hsize_t *start; IN: Offset of start of hyperslab
+ const hsize_t *stride; IN: Hyperslab stride
+ const hsize_t *count; IN: Number of blocks included in hyperslab
+ const hsize_t *block; IN: Size of block in hyperslab
RETURNS
Dataspace ID on success/Negative on failure
DESCRIPTION
@@ -6454,7 +6536,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
hid_t
-H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[],
+H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
const hsize_t stride[], const hsize_t count[], const hsize_t block[])
{
H5S_t *space = NULL; /* Dataspace to modify selection of */
@@ -6462,7 +6544,7 @@ H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[],
hid_t ret_value;
FUNC_ENTER_API(H5Scombine_hyperslab, FAIL);
- H5TRACE6("i","iSs*Hs*h*h*h",space_id,op,start,stride,count,block);
+ H5TRACE6("i","iSs*h*h*h*h",space_id,op,start,stride,count,block);
/* Check args */
if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE)))
@@ -6781,7 +6863,7 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
hsize_t acc; /* Accumulator for computing cumulative sizes */
hsize_t loc_off; /* Element offset in the dataspace */
hsize_t last_span_end=0; /* The offset of the end of the last span */
- hssize_t *abs_arr; /* Absolute hyperslab span position */
+ hsize_t *abs_arr; /* Absolute hyperslab span position */
const hssize_t *off_arr; /* Offset within the dataspace extent */
size_t span_size=0; /* Number of bytes in current span to actually process */
size_t io_left; /* Number of elements left to process */
@@ -7210,16 +7292,16 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
hsize_t *mem_size; /* Size of the source buffer */
hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */
const hssize_t *sel_off; /* Selection offset in dataspace */
- hssize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */
+ hsize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */
hsize_t tmp_count[H5O_LAYOUT_NDIMS];/* Temporary block count */
hsize_t tmp_block[H5O_LAYOUT_NDIMS];/* Temporary block offset */
- hssize_t wrap[H5O_LAYOUT_NDIMS]; /* Bytes to wrap around at the end of a row */
+ hsize_t wrap[H5O_LAYOUT_NDIMS]; /* Bytes to wrap around at the end of a row */
hsize_t skip[H5O_LAYOUT_NDIMS]; /* Bytes to skip between blocks */
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- hssize_t fast_dim_start, /* Local copies of fastest changing dimension info */
+ hsize_t fast_dim_start, /* Local copies of fastest changing dimension info */
+ fast_dim_stride,
+ fast_dim_block,
fast_dim_offset;
- hsize_t fast_dim_stride, /* Local copies of fastest changing dimension info */
- fast_dim_block;
size_t fast_dim_buf_off; /* Local copy of amount to move fastest dimension buffer offset */
size_t fast_dim_count; /* Number of blocks left in fastest changing dimension */
size_t tot_blk_count; /* Total number of blocks left to output */
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index cc9fc09..5491a6d 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -667,7 +667,7 @@ H5S_mpio_span_hyper_type( const H5S_t *space, size_t elmt_size,
MPI_Aint extent,lb;
- FUNC_ENTER_NOAPI_NOINIT(H5S_mpio_span_hyper_type);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_mpio_span_hyper_type);
printf("coming to hyper type \n");
/* Check args */
@@ -729,15 +729,15 @@ static herr_t obtain_datatype(const hsize_t size[], H5S_hyper_span_t* span,MPI_D
MPI_Datatype temp_type;
MPI_Datatype tempinner_type;
MPI_Datatype *inner_type;
- int inner_blocklen;
- MPI_Aint inner_disp;
int *blocklen;
MPI_Aint *disp;
MPI_Aint stride;
MPI_Aint extent,lb;
H5S_hyper_span_info_t *down;
H5S_hyper_span_t *tspan;
+#ifdef H5_HAVE_MPI2
MPI_Aint sizeaint,sizedtype;
+#endif /* H5_HAVE_MPI2 */
hsize_t total_lowd,total_lowd1;
int i;
int ret;
diff --git a/src/H5Snone.c b/src/H5Snone.c
index f2cc04f..2cc2a1e 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -44,15 +44,15 @@ static htri_t H5S_none_is_valid(const H5S_t *space);
static hssize_t H5S_none_serial_size(const H5S_t *space);
static herr_t H5S_none_serialize(const H5S_t *space, uint8_t *buf);
static herr_t H5S_none_deserialize(H5S_t *space, const uint8_t *buf);
-static herr_t H5S_none_bounds(const H5S_t *space, hssize_t *start, hssize_t *end);
+static herr_t H5S_none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static htri_t H5S_none_is_contiguous(const H5S_t *space);
static htri_t H5S_none_is_single(const H5S_t *space);
static htri_t H5S_none_is_regular(const H5S_t *space);
static herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
/* Selection iteration callbacks */
-static herr_t H5S_none_iter_coords(const H5S_sel_iter_t *iter, hssize_t *coords);
-static herr_t H5S_none_iter_block(const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end);
+static herr_t H5S_none_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
+static herr_t H5S_none_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
static hsize_t H5S_none_iter_nelmts(const H5S_sel_iter_t *iter);
static htri_t H5S_none_iter_has_next_block(const H5S_sel_iter_t *iter);
static herr_t H5S_none_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
@@ -139,7 +139,7 @@ H5S_none_iter_init (H5S_sel_iter_t *iter, const H5S_t UNUSED *space)
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_iter_coords (const H5S_sel_iter_t UNUSED *iter, hssize_t UNUSED *coords)
+H5S_none_iter_coords (const H5S_sel_iter_t UNUSED *iter, hsize_t UNUSED *coords)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_iter_coords);
@@ -167,7 +167,7 @@ H5S_none_iter_coords (const H5S_sel_iter_t UNUSED *iter, hssize_t UNUSED *coords
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_iter_block (const H5S_sel_iter_t UNUSED *iter, hssize_t UNUSED *start, hssize_t UNUSED *end)
+H5S_none_iter_block (const H5S_sel_iter_t UNUSED *iter, hsize_t UNUSED *start, hsize_t UNUSED *end)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_iter_block);
@@ -533,8 +533,8 @@ done:
USAGE
herr_t H5S_none_bounds(space, start, end)
H5S_t *space; IN: Dataspace pointer of selection to query
- hssize_t *start; OUT: Starting coordinate of bounding box
- hssize_t *end; OUT: Opposite coordinate of bounding box
+ hsize_t *start; OUT: Starting coordinate of bounding box
+ hsize_t *end; OUT: Opposite coordinate of bounding box
RETURNS
Non-negative on success, negative on failure
DESCRIPTION
@@ -551,7 +551,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_bounds(const H5S_t UNUSED *space, hssize_t UNUSED *start, hssize_t UNUSED *end)
+H5S_none_bounds(const H5S_t UNUSED *space, hsize_t UNUSED *start, hsize_t UNUSED *end)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_bounds);
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index dc67f81..ce858a2 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -54,7 +54,7 @@ typedef struct {
*/
/* Node in point selection list (typedef'd in H5Sprivate.h) */
struct H5S_pnt_node_t {
- hssize_t *pnt; /* Pointer to a selected point */
+ hsize_t *pnt; /* Pointer to a selected point */
struct H5S_pnt_node_t *next; /* pointer to next point in list */
};
@@ -67,7 +67,7 @@ typedef struct {
/* Information a particular hyperslab span */
struct H5S_hyper_span_t {
- hssize_t low, high; /* Low & high bounds of span */
+ hsize_t low, high; /* Low & high bounds of span */
hsize_t nelem; /* Number of elements in span (only needed during I/O) */
hsize_t pstride; /* Pseudo-stride from start of previous span (only used during I/O) */
struct H5S_hyper_span_info_t *down; /* Pointer to list of spans in next dimension down */
@@ -118,7 +118,7 @@ typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t *buf);
/* Method to store create selection from "serialized" form (a byte sequence suitable for storing on disk) */
typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t *space, const uint8_t *buf);
/* Method to determine to smallest n-D bounding box containing the current selection */
-typedef herr_t (*H5S_sel_bounds_func_t)(const H5S_t *space, hssize_t *start, hssize_t *end);
+typedef herr_t (*H5S_sel_bounds_func_t)(const H5S_t *space, hsize_t *start, hsize_t *end);
/* Method to determine if current selection is contiguous */
typedef htri_t (*H5S_sel_is_contiguous_func_t)(const H5S_t *space);
/* Method to determine if current selection is a single block */
@@ -166,9 +166,9 @@ struct H5S_t {
/* Selection iteration methods */
/* Method to retrieve the current coordinates of iterator for current selection */
-typedef herr_t (*H5S_sel_iter_coords_func_t)(const H5S_sel_iter_t *iter, hssize_t *coords);
+typedef herr_t (*H5S_sel_iter_coords_func_t)(const H5S_sel_iter_t *iter, hsize_t *coords);
/* Method to retrieve the current block of iterator for current selection */
-typedef herr_t (*H5S_sel_iter_block_func_t)(const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end);
+typedef herr_t (*H5S_sel_iter_block_func_t)(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
/* Method to determine number of elements left in iterator for current selection */
typedef hsize_t (*H5S_sel_iter_nelmts_func_t)(const H5S_sel_iter_t *iter);
/* Method to determine if there are more blocks left in the current selection */
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 4970321..b824875 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -45,15 +45,15 @@ static htri_t H5S_point_is_valid(const H5S_t *space);
static hssize_t H5S_point_serial_size(const H5S_t *space);
static herr_t H5S_point_serialize(const H5S_t *space, uint8_t *buf);
static herr_t H5S_point_deserialize(H5S_t *space, const uint8_t *buf);
-static herr_t H5S_point_bounds(const H5S_t *space, hssize_t *start, hssize_t *end);
+static herr_t H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static htri_t H5S_point_is_contiguous(const H5S_t *space);
static htri_t H5S_point_is_single(const H5S_t *space);
static htri_t H5S_point_is_regular(const H5S_t *space);
static herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
/* Selection iteration callbacks */
-static herr_t H5S_point_iter_coords(const H5S_sel_iter_t *iter, hssize_t *coords);
-static herr_t H5S_point_iter_block(const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end);
+static herr_t H5S_point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
+static herr_t H5S_point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
static hsize_t H5S_point_iter_nelmts(const H5S_sel_iter_t *iter);
static htri_t H5S_point_iter_has_next_block(const H5S_sel_iter_t *iter);
static herr_t H5S_point_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
@@ -152,7 +152,7 @@ H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords)
+H5S_point_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_coords);
@@ -161,7 +161,7 @@ H5S_point_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords)
assert (coords);
/* Copy the offset of the current point */
- HDmemcpy(coords,iter->u.pnt.curr->pnt,sizeof(hssize_t)*iter->rank);
+ HDmemcpy(coords,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank);
FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_point_iter_coords() */
@@ -183,7 +183,7 @@ H5S_point_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords)
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_iter_block (const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end)
+H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_block);
@@ -193,8 +193,8 @@ H5S_point_iter_block (const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end
assert (end);
/* Copy the current point as a block */
- HDmemcpy(start,iter->u.pnt.curr->pnt,sizeof(hssize_t)*iter->rank);
- HDmemcpy(end,iter->u.pnt.curr->pnt,sizeof(hssize_t)*iter->rank);
+ HDmemcpy(start,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank);
+ HDmemcpy(end,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank);
FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_point_iter_block() */
@@ -369,7 +369,7 @@ H5S_point_iter_release (H5S_sel_iter_t UNUSED * iter)
herr_t H5S_point_add(space, num_elem, coord)
H5S_t *space; IN: Dataspace of selection to modify
size_t num_elem; IN: Number of elements in COORD array.
- const hssize_t *coord[]; IN: The location of each element selected
+ const hsize_t *coord[]; IN: The location of each element selected
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -380,10 +380,10 @@ H5S_point_iter_release (H5S_sel_iter_t UNUSED * iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hssize_t **_coord)
+H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t **_coord)
{
H5S_pnt_node_t *top, *curr, *new_node; /* Point selection nodes */
- const hssize_t *coord=(const hssize_t *)_coord; /* Pointer to the actual coordinates */
+ const hsize_t *coord=(const hsize_t *)_coord; /* Pointer to the actual coordinates */
unsigned i; /* Counter */
herr_t ret_value=SUCCEED; /* Return value */
@@ -400,11 +400,11 @@ H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hssize_t *
if((new_node = H5FL_MALLOC(H5S_pnt_node_t))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node");
- if((new_node->pnt = H5MM_malloc(space->extent.rank*sizeof(hssize_t)))==NULL)
+ if((new_node->pnt = H5MM_malloc(space->extent.rank*sizeof(hsize_t)))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information");
/* Copy over the coordinates */
- HDmemcpy(new_node->pnt,coord+(i*space->extent.rank),(space->extent.rank*sizeof(hssize_t)));
+ HDmemcpy(new_node->pnt,coord+(i*space->extent.rank),(space->extent.rank*sizeof(hsize_t)));
/* Link into list */
new_node->next=NULL;
@@ -505,7 +505,7 @@ H5S_point_release (H5S_t *space)
hid_t dsid; IN: Dataspace ID of selection to modify
H5S_seloper_t op; IN: Operation to perform on current selection
size_t num_elem; IN: Number of elements in COORD array.
- const hssize_t **coord; IN: The location of each element selected
+ const hsize_t **coord; IN: The location of each element selected
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -527,7 +527,7 @@ H5S_point_release (H5S_t *space)
--------------------------------------------------------------------------*/
herr_t
H5S_select_elements (H5S_t *space, H5S_seloper_t op, size_t num_elem,
- const hssize_t **coord)
+ const hsize_t **coord)
{
herr_t ret_value=SUCCEED; /* return value */
@@ -603,9 +603,9 @@ H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t UNUSED share_selection)
/* Create each point */
if((new_node=H5FL_MALLOC(H5S_pnt_node_t))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node");
- if((new_node->pnt = H5MM_malloc(src->extent.rank*sizeof(hssize_t)))==NULL)
+ if((new_node->pnt = H5MM_malloc(src->extent.rank*sizeof(hsize_t)))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information");
- HDmemcpy(new_node->pnt,curr->pnt,(src->extent.rank*sizeof(hssize_t)));
+ HDmemcpy(new_node->pnt,curr->pnt,(src->extent.rank*sizeof(hsize_t)));
new_node->next=NULL;
/* Keep the order the same when copying */
@@ -662,8 +662,8 @@ H5S_point_is_valid (const H5S_t *space)
for(u=0; u<space->extent.rank; u++) {
/* Check if an offset has been defined */
/* Bounds check the selected point + offset against the extent */
- if(((curr->pnt[u]+space->select.offset[u])>(hssize_t)space->extent.size[u])
- || ((curr->pnt[u]+space->select.offset[u])<0))
+ if(((curr->pnt[u]+space->select.offset[u])>space->extent.size[u])
+ || (((hssize_t)curr->pnt[u]+space->select.offset[u])<0))
HGOTO_DONE(FALSE)
} /* end for */
@@ -852,7 +852,7 @@ H5S_point_deserialize (H5S_t *space, const uint8_t *buf)
H5S_seloper_t op=H5S_SELECT_SET; /* Selection operation */
uint32_t rank; /* Rank of points */
size_t num_elem=0; /* Number of elements in selection */
- hssize_t *coord=NULL, *tcoord; /* Pointer to array of elements */
+ hsize_t *coord=NULL, *tcoord; /* Pointer to array of elements */
unsigned i,j; /* local counting variables */
herr_t ret_value; /* return value */
@@ -870,7 +870,7 @@ H5S_point_deserialize (H5S_t *space, const uint8_t *buf)
UINT32DECODE(buf,num_elem); /* decode the number of points */
/* Allocate space for the coordinates */
- if((coord = H5MM_malloc(num_elem*rank*sizeof(hssize_t)))==NULL)
+ if((coord = H5MM_malloc(num_elem*rank*sizeof(hsize_t)))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information");
/* Retrieve the coordinates from the buffer */
@@ -879,7 +879,7 @@ H5S_point_deserialize (H5S_t *space, const uint8_t *buf)
UINT32DECODE(buf, *tcoord);
/* Select points */
- if((ret_value=H5S_select_elements(space,op,num_elem,(const hssize_t **)coord))<0)
+ if((ret_value=H5S_select_elements(space,op,num_elem,(const hsize_t **)coord))<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection");
done:
@@ -945,7 +945,7 @@ H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoint
/* Iterate through the node, copying each hyperslab's information */
while(node!=NULL && numpoints>0) {
- HDmemcpy(buf,node->pnt,sizeof(hssize_t)*rank);
+ HDmemcpy(buf,node->pnt,sizeof(hsize_t)*rank);
buf+=rank;
numpoints--;
node=node->next;
@@ -1016,8 +1016,8 @@ done:
USAGE
herr_t H5S_point_bounds(space, start, end)
H5S_t *space; IN: Dataspace pointer of selection to query
- hssize_t *start; OUT: Starting coordinate of bounding box
- hssize_t *end; OUT: Opposite coordinate of bounding box
+ hsize_t *start; OUT: Starting coordinate of bounding box
+ hsize_t *end; OUT: Opposite coordinate of bounding box
RETURNS
Non-negative on success, negative on failure
DESCRIPTION
@@ -1035,13 +1035,14 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
+H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
{
H5S_pnt_node_t *node; /* Point node */
int rank; /* Dataspace rank */
int i; /* index variable */
+ herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_bounds);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_point_bounds);
assert(space);
assert(start);
@@ -1052,14 +1053,18 @@ H5S_point_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
/* Set the start and end arrays up */
for(i=0; i<rank; i++) {
- start[i]=HSSIZET_MAX;
- end[i]=HSSIZET_MIN;
+ start[i]=HSIZET_MAX;
+ end[i]=0;
} /* end for */
/* Iterate through the node, checking the bounds on each element */
node=space->select.sel_info.pnt_lst->head;
while(node!=NULL) {
for(i=0; i<rank; i++) {
+ /* Check for offset moving selection negative */
+ if(((hssize_t)node->pnt[i]+space->select.offset[i])<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
+
if(start[i]>(node->pnt[i]+space->select.offset[i]))
start[i]=node->pnt[i]+space->select.offset[i];
if(end[i]<(node->pnt[i]+space->select.offset[i]))
@@ -1068,7 +1073,8 @@ H5S_point_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
node=node->next;
} /* end while */
- FUNC_LEAVE_NOAPI(SUCCEED);
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_point_bounds() */
@@ -1200,7 +1206,7 @@ H5S_point_is_regular(const H5S_t *space)
hid_t dsid; IN: Dataspace ID of selection to modify
H5S_seloper_t op; IN: Operation to perform on current selection
size_t num_elem; IN: Number of elements in COORD array.
- const hssize_t **coord; IN: The location of each element selected
+ const hsize_t **coord; IN: The location of each element selected
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -1222,13 +1228,13 @@ H5S_point_is_regular(const H5S_t *space)
--------------------------------------------------------------------------*/
herr_t
H5Sselect_elements(hid_t spaceid, H5S_seloper_t op, size_t num_elem,
- const hssize_t **coord)
+ const hsize_t **coord)
{
H5S_t *space = NULL; /* Dataspace to modify selection of */
herr_t ret_value; /* return value */
FUNC_ENTER_API(H5Sselect_elements, FAIL);
- H5TRACE4("e","iSsz**Hs",spaceid,op,num_elem,coord);
+ H5TRACE4("e","iSsz**h",spaceid,op,num_elem,coord);
/* Check args */
if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE)))
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 61eb9a9..06c9f02 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -48,7 +48,7 @@ typedef struct H5S_hyper_span_info_t H5S_hyper_span_info_t;
/* Information about one dimension in a hyperslab selection */
typedef struct H5S_hyper_dim_t {
- hssize_t start;
+ hsize_t start;
hsize_t stride;
hsize_t count;
hsize_t block;
@@ -62,7 +62,7 @@ typedef struct {
/* Hyperslab selection iteration container */
typedef struct {
/* Common fields for all hyperslab selections */
- hssize_t off[H5S_MAX_RANK]; /* Offset in span node (used as position for regular hyperslabs) */
+ hsize_t off[H5S_MAX_RANK]; /* Offset in span node (used as position for regular hyperslabs) */
unsigned iter_rank; /* Rank of iterator information */
/* (This should always be the same as the dataspace
* rank, except for regular hyperslab selections in
@@ -201,6 +201,7 @@ H5_DLL int H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[]/*out*/,
H5_DLL herr_t H5S_modify(struct H5G_entry_t *ent, const H5S_t *space,
hbool_t update_time, hid_t dxpl_id);
H5_DLL herr_t H5S_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, const H5S_t *ds);
+H5_DLL size_t H5S_raw_size(const H5F_t *f, const H5S_t *space);
H5_DLL H5S_t *H5S_read(struct H5G_entry_t *ent, hid_t dxpl_id);
H5_DLL int H5S_extend(H5S_t *space, const hsize_t *size);
H5_DLL int H5S_set_extent(H5S_t *space, const hsize_t *size);
@@ -219,7 +220,7 @@ H5_DLL herr_t H5S_select_fill(void *fill, size_t fill_size,
const H5S_t *space, void *buf);
H5_DLL htri_t H5S_select_valid(const H5S_t *space);
H5_DLL hssize_t H5S_get_select_npoints(const H5S_t *space);
-H5_DLL herr_t H5S_get_select_bounds(const H5S_t *space, hssize_t *start, hssize_t *end);
+H5_DLL herr_t H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
H5_DLL herr_t H5S_select_offset(H5S_t *space, const hssize_t *offset);
H5_DLL herr_t H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
H5_DLL htri_t H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2);
@@ -241,26 +242,27 @@ H5_DLL herr_t H5S_select_none(H5S_t *space);
/* Operations on point selections */
H5_DLL herr_t H5S_select_elements (H5S_t *space, H5S_seloper_t op,
- size_t num_elem, const hssize_t **coord);
+ size_t num_elem, const hsize_t **coord);
/* Operations on hyperslab selections */
-H5_DLL herr_t H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, const hssize_t start[],
+H5_DLL herr_t H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, const hsize_t start[],
const hsize_t *stride, const hsize_t count[], const hsize_t *block);
H5_DLL herr_t H5S_hyper_add_span_element(H5S_t *space, unsigned rank,
- hssize_t *coords);
+ hsize_t *coords);
H5_DLL herr_t H5S_hyper_reset_scratch(H5S_t *space);
H5_DLL herr_t H5S_hyper_convert(H5S_t *space);
#ifdef LATER
H5_DLL htri_t H5S_hyper_intersect (H5S_t *space1, H5S_t *space2);
#endif /* LATER */
-H5_DLL htri_t H5S_hyper_intersect_block (H5S_t *space, hssize_t *start, hssize_t *end);
-H5_DLL herr_t H5S_hyper_adjust(H5S_t *space, const hssize_t *offset);
+H5_DLL htri_t H5S_hyper_intersect_block (H5S_t *space, hsize_t *start, hsize_t *end);
+H5_DLL herr_t H5S_hyper_adjust_u(H5S_t *space, const hsize_t *offset);
+H5_DLL herr_t H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset);
H5_DLL herr_t H5S_hyper_move(H5S_t *space, const hssize_t *offset);
H5_DLL herr_t H5S_hyper_normalize_offset(H5S_t *space);
/* Operations on selection iterators */
H5_DLL herr_t H5S_select_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size);
-H5_DLL herr_t H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hssize_t *coords);
+H5_DLL herr_t H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords);
H5_DLL hsize_t H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter);
H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
H5_DLL herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter);
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 84ed534..9efaeab 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -110,14 +110,14 @@ H5_DLL htri_t H5Sis_simple(hid_t space_id);
H5_DLL herr_t H5Sset_space(hid_t space_id, int rank, const hsize_t *dims);
H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid);
H5_DLL herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op,
- const hssize_t start[],
+ const hsize_t start[],
const hsize_t _stride[],
const hsize_t count[],
const hsize_t _block[]);
/* #define NEW_HYPERSLAB_API */
#ifdef NEW_HYPERSLAB_API
H5_DLL hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op,
- const hssize_t start[],
+ const hsize_t start[],
const hsize_t _stride[],
const hsize_t count[],
const hsize_t _block[]);
@@ -128,7 +128,7 @@ H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op,
#endif /* NEW_HYPERSLAB_API */
H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op,
size_t num_elemn,
- const hssize_t **coord);
+ const hsize_t **coord);
H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id);
H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
H5_DLL herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id);
@@ -140,7 +140,7 @@ H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid);
H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numblocks, hsize_t *buf);
H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, hsize_t numpoints, hsize_t *buf);
-H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hssize_t *start, hssize_t *end);
+H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t *start, hsize_t *end);
H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
#ifdef __cplusplus
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 9ff1ac0..1d9e68e 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -33,7 +33,7 @@
/* Local functions */
#ifdef LATER
-static herr_t H5S_select_iter_block (const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end);
+static herr_t H5S_select_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
static htri_t H5S_select_iter_has_next_block (const H5S_sel_iter_t *iter);
static herr_t H5S_select_iter_next_block(H5S_sel_iter_t *iter);
#endif /* LATER */
@@ -488,8 +488,8 @@ done:
USAGE
herr_t H5S_get_select_bounds(space, start, end)
hid_t dsid; IN: Dataspace ID of selection to query
- hssize_t *start; OUT: Starting coordinate of bounding box
- hssize_t *end; OUT: Opposite coordinate of bounding box
+ hsize_t *start; OUT: Starting coordinate of bounding box
+ hsize_t *end; OUT: Opposite coordinate of bounding box
RETURNS
Non-negative on success, negative on failure
DESCRIPTION
@@ -511,13 +511,13 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Sget_select_bounds(hid_t spaceid, hssize_t *start, hssize_t *end)
+H5Sget_select_bounds(hid_t spaceid, hsize_t *start, hsize_t *end)
{
H5S_t *space = NULL; /* Dataspace to modify selection of */
herr_t ret_value; /* return value */
FUNC_ENTER_API(H5Sget_select_bounds, FAIL);
- H5TRACE3("e","i*Hs*Hs",spaceid,start,end);
+ H5TRACE3("e","i*h*h",spaceid,start,end);
/* Check args */
if(start==NULL || end==NULL)
@@ -540,8 +540,8 @@ done:
USAGE
herr_t H5S_get_select_bounds(space, start, end)
H5S_t *space; IN: Dataspace ID of selection to query
- hssize_t *start; OUT: Starting coordinate of bounding box
- hssize_t *end; OUT: Opposite coordinate of bounding box
+ hsize_t *start; OUT: Starting coordinate of bounding box
+ hsize_t *end; OUT: Opposite coordinate of bounding box
RETURNS
Non-negative on success, negative on failure
DESCRIPTION
@@ -560,7 +560,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_get_select_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
+H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
{
herr_t ret_value; /* return value */
@@ -746,7 +746,7 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s
USAGE
herr_t H5S_select_iter_coords(sel_iter,coords)
H5S_sel_iter_t *sel_iter; IN: Selection iterator to query
- hssize_t *coords; OUT: Array to place iterator coordinates in
+ hsize_t *coords; OUT: Array to place iterator coordinates in
RETURNS
Non-negative on success, negative on failure.
DESCRIPTION
@@ -761,7 +761,7 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_select_iter_coords (const H5S_sel_iter_t *sel_iter, hssize_t *coords)
+H5S_select_iter_coords (const H5S_sel_iter_t *sel_iter, hsize_t *coords)
{
herr_t ret_value; /* return value */
@@ -787,8 +787,8 @@ H5S_select_iter_coords (const H5S_sel_iter_t *sel_iter, hssize_t *coords)
USAGE
herr_t H5S_select_iter_block(sel_iter,start,end)
const H5S_sel_iter_t *sel_iter; IN: Selection iterator to query
- hssize_t *start; OUT: Array to place iterator start block coordinates
- hssize_t *end; OUT: Array to place iterator end block coordinates
+ hsize_t *start; OUT: Array to place iterator start block coordinates
+ hsize_t *end; OUT: Array to place iterator end block coordinates
RETURNS
Non-negative on success, negative on failure.
DESCRIPTION
@@ -803,7 +803,7 @@ H5S_select_iter_coords (const H5S_sel_iter_t *sel_iter, hssize_t *coords)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_select_iter_block (const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end)
+H5S_select_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
{
herr_t ret_value; /* return value */
@@ -1057,7 +1057,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t
H5S_sel_iter_t iter; /* Selection iteration info */
hbool_t iter_init=0; /* Selection iteration info has been initialized */
uint8_t *loc; /* Current element location in buffer */
- hssize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of element in dataspace */
+ hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of element in dataspace */
hssize_t nelmts; /* Number of elements in selection */
hsize_t space_size[H5O_LAYOUT_NDIMS]; /* Dataspace size */
hsize_t off[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence offsets */
@@ -1070,7 +1070,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t
size_t nelem; /* Number of elements used in sequences */
size_t max_elem; /* Maximum number of elements allowed in sequences */
size_t elmt_size; /* Datatype size */
- int ndims; /* Number of dimensions in dataspace */
+ unsigned ndims; /* Number of dimensions in dataspace */
int i; /* Local Index variable */
herr_t user_ret=0; /* User's return value */
herr_t ret_value=SUCCEED; /* Return value */
@@ -1137,7 +1137,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t
loc=(unsigned char *)buf+curr_off;
/* Call user's callback routine */
- user_ret=(*op)(loc,type_id,(hsize_t)ndims,coords,operator_data);
+ user_ret=(*op)(loc,type_id,ndims,coords,operator_data);
/* Increment offset in dataspace */
curr_off+=elmt_size;
@@ -1315,12 +1315,12 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
} /* end if */
/* Iterate through all the blocks in the selection */
else {
- hssize_t start1[H5O_LAYOUT_NDIMS]; /* Start point of selection block in dataspace #1 */
- hssize_t start2[H5O_LAYOUT_NDIMS]; /* Start point of selection block in dataspace #2 */
- hssize_t end1[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #1 */
- hssize_t end2[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #2 */
- hssize_t off1[H5O_LAYOUT_NDIMS]; /* Offset of selection #1 blocks */
- hssize_t off2[H5O_LAYOUT_NDIMS]; /* Offset of selection #2 blocks */
+ hsize_t start1[H5O_LAYOUT_NDIMS]; /* Start point of selection block in dataspace #1 */
+ hsize_t start2[H5O_LAYOUT_NDIMS]; /* Start point of selection block in dataspace #2 */
+ hsize_t end1[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #1 */
+ hsize_t end2[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #2 */
+ hsize_t off1[H5O_LAYOUT_NDIMS]; /* Offset of selection #1 blocks */
+ hsize_t off2[H5O_LAYOUT_NDIMS]; /* Offset of selection #2 blocks */
htri_t status1,status2; /* Status from next block checks */
unsigned first_block=1; /* Flag to indicate the first block */
diff --git a/src/H5T.c b/src/H5T.c
index aac188f..1d25984 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -2609,12 +2609,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Tencode(hid_t obj_id, void *buf, size_t* nalloc)
+H5Tencode(hid_t obj_id, void *buf, size_t *nalloc)
{
H5T_t *dtype;
herr_t ret_value=SUCCEED;
FUNC_ENTER_API (H5Tencode, FAIL);
+ H5TRACE3("e","ix*z",obj_id,buf,nalloc);
/* Check argument and retrieve object */
if (NULL==(dtype=H5I_object_verify(obj_id, H5I_DATATYPE)))
diff --git a/src/H5TS.c b/src/H5TS.c
index 51fc0a9..812f8ce 100644
--- a/src/H5TS.c
+++ b/src/H5TS.c
@@ -105,8 +105,10 @@ H5TS_first_thread_init(void)
/* initialize key for thread-specific error stacks */
pthread_key_create(&H5TS_errstk_key_g, H5TS_key_destructor);
+
/* initialize key for thread-specific function stacks */
pthread_key_create(&H5TS_funcstk_key_g, H5TS_key_destructor);
+
/* initialize key for thread cancellability mechanism */
pthread_key_create(&H5TS_cancel_key_g, H5TS_key_destructor);
}
diff --git a/src/H5Tbit.c b/src/H5Tbit.c
index 452d44a..ded80a5 100644
--- a/src/H5Tbit.c
+++ b/src/H5Tbit.c
@@ -75,7 +75,7 @@ H5T_bit_copy (uint8_t *dst, size_t dst_offset, const uint8_t *src,
* ... v v v v v V V V V V
* ...+---------------+---------------+
* ...|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|
- ...+---------------+---------------+
+ * ...+---------------+---------------+
* dst[d_idx+1] dst[d_idx]
*/
while (src_offset && size>0) {
@@ -492,8 +492,8 @@ done:
*
* Failure: Negative
*
- * Programmer: Raymond Lu
- * Mar 17, 2004
+ * Programmer: Robb Matzke
+ * Friday, June 26, 1998
*
* Modifications:
*
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 75e8b8f..3fed9c0 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -53,16 +53,16 @@ DESCRIPTION
static herr_t
H5T_init_commit_interface(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_commit_interface);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_commit_interface)
- FUNC_LEAVE_NOAPI(H5T_init());
+ FUNC_LEAVE_NOAPI(H5T_init())
} /* H5T_init_commit_interface() */
/*-------------------------------------------------------------------------
* Function: H5Tcommit
*
- * Purpose: Save a transient data type to a file and turn the type handle
+ * Purpose: Save a transient datatype to a file and turn the type handle
* into a named, immutable type.
*
* Return: Non-negative on success/Negative on failure
@@ -81,23 +81,23 @@ H5Tcommit(hid_t loc_id, const char *name, hid_t type_id)
H5T_t *type = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tcommit, FAIL);
+ FUNC_ENTER_API(H5Tcommit, FAIL)
H5TRACE3("e","isi",loc_id,name,type_id);
/* Check arguments */
if (NULL==(loc=H5G_loc (loc_id)))
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a location");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if (!name || !*name)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
if (NULL==(type=H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Commit the type */
if (H5T_commit (loc, name, type, H5AC_dxpl_id)<0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit data type");
+ HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -122,11 +122,11 @@ H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id)
H5F_t *file = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5T_commit);
+ FUNC_ENTER_NOAPI_NOINIT(H5T_commit)
- assert (loc);
- assert (name && *name);
- assert (type);
+ HDassert (loc);
+ HDassert (name && *name);
+ HDassert (type);
/*
* Check arguments. We cannot commit an immutable type because H5Tclose()
@@ -134,17 +134,17 @@ H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id)
* a named type should always succeed.
*/
if (H5T_STATE_NAMED==type->shared->state || H5T_STATE_OPEN==type->shared->state)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "data type is already committed");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is already committed")
if (H5T_STATE_IMMUTABLE==type->shared->state)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "data type is immutable");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is immutable")
/* Find the insertion file */
if (NULL==(file=H5G_insertion_file(loc, name, dxpl_id)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to find insertion point");
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to find insertion point")
/* Check for a "sensible" datatype to store on disk */
- if(H5T_is_sensible(type)!=TRUE)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "datatype is not sensible");
+ if(H5T_is_sensible(type)<=0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "datatype is not sensible")
/* Mark datatype as being on disk now. This step changes the size of datatype as
* stored on disk. */
@@ -156,11 +156,11 @@ H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id)
* type message and then give the object header a name.
*/
if (H5O_create (file, dxpl_id, 64, &(type->ent))<0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create data type object header");
+ HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header")
if (H5O_modify (&(type->ent), H5O_DTYPE_ID, 0, H5O_FLAG_CONSTANT, H5O_UPDATE_TIME, type, dxpl_id)<0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message");
+ HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message")
if (H5G_insert (loc, name, &(type->ent), dxpl_id)<0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to name data type");
+ HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to name datatype")
type->shared->state = H5T_STATE_OPEN;
type->shared->fo_count=1;
@@ -177,21 +177,21 @@ done:
if (ret_value<0) {
if ((type->shared->state==H5T_STATE_TRANSIENT || type->shared->state==H5T_STATE_RDONLY) && H5F_addr_defined(type->ent.header)) {
if(H5O_close(&(type->ent))<0)
- HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release object header");
+ HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release object header")
if(H5O_delete(file, dxpl_id,type->ent.header)<0)
- HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to delete object header");
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to delete object header")
type->ent.header = HADDR_UNDEF;
}
}
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
/*-------------------------------------------------------------------------
* Function: H5Tcommitted
*
- * Purpose: Determines if a data type is committed or not.
+ * Purpose: Determines if a datatype is committed or not.
*
* Return: Success: TRUE if committed, FALSE otherwise.
*
@@ -210,25 +210,25 @@ H5Tcommitted(hid_t type_id)
H5T_t *type = NULL;
htri_t ret_value; /* Return value */
- FUNC_ENTER_API(H5Tcommitted, FAIL);
+ FUNC_ENTER_API(H5Tcommitted, FAIL)
H5TRACE1("t","i",type_id);
/* Check arguments */
if (NULL==(type=H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Set return value */
ret_value= H5T_committed(type);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
/*-------------------------------------------------------------------------
* Function: H5T_committed
*
- * Purpose: Determines if a data type is committed or not.
+ * Purpose: Determines if a datatype is committed or not.
*
* Return: Success: TRUE if committed, FALSE otherwise.
*
@@ -240,14 +240,14 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5T_committed(H5T_t *type)
+H5T_committed(const H5T_t *type)
{
/* Use no-init for efficiency */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_committed);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_committed)
assert (type);
- FUNC_LEAVE_NOAPI(H5T_STATE_OPEN==type->shared->state || H5T_STATE_NAMED==type->shared->state);
+ FUNC_LEAVE_NOAPI(H5T_STATE_OPEN==type->shared->state || H5T_STATE_NAMED==type->shared->state)
} /* end H5T_committed() */
@@ -274,15 +274,15 @@ H5T_link(const H5T_t *type, int adjust, hid_t dxpl_id)
int ret_value; /* Return value */
/* Use no-init for efficiency */
- FUNC_ENTER_NOAPI(H5T_link,FAIL);
+ FUNC_ENTER_NOAPI(H5T_link,FAIL)
assert (type);
/* Adjust the link count on the named datatype */
if((ret_value=H5O_link(&(type->ent),adjust,dxpl_id))<0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_LINK, FAIL, "unable to adjust named datatype link count");
+ HGOTO_ERROR (H5E_DATATYPE, H5E_LINK, FAIL, "unable to adjust named datatype link count")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T_link() */
diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c
index 48feb6c..467798f 100644
--- a/src/H5Tcompound.c
+++ b/src/H5Tcompound.c
@@ -36,7 +36,7 @@
#define H5T_COMPND_INC 64 /*typical max numb of members per struct */
/* Static local functions */
-static herr_t H5T_pack(H5T_t *dt);
+static herr_t H5T_pack(const H5T_t *dt);
/*--------------------------------------------------------------------------
@@ -81,17 +81,9 @@ H5T_init_compound_interface(void)
*
*-------------------------------------------------------------------------
*/
-#ifdef H5_WANT_H5_V1_6_COMPAT
-size_t
-H5Tget_member_offset(hid_t type_id, int _membno)
-#else /* H5_WANT_H5_V1_6_COMPAT */
size_t
H5Tget_member_offset(hid_t type_id, unsigned membno)
-#endif /* H5_WANT_H5_V1_6_COMPAT */
{
-#ifdef H5_WANT_H5_V1_6_COMPAT
- unsigned membno = (unsigned)_membno;
-#endif /* H5_WANT_H5_V1_6_COMPAT */
H5T_t *dt = NULL;
size_t ret_value;
@@ -138,7 +130,7 @@ H5T_get_member_offset(const H5T_t *dt, unsigned membno)
{
size_t ret_value;
- FUNC_ENTER_NOAPI(H5T_get_member_offset, 0)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_get_member_offset)
assert(dt);
assert(membno < dt->shared->u.compnd.nmembs);
@@ -146,7 +138,6 @@ H5T_get_member_offset(const H5T_t *dt, unsigned membno)
/* Value */
ret_value = dt->shared->u.compnd.memb[membno].offset;
-done:
FUNC_LEAVE_NOAPI(ret_value)
}
@@ -167,17 +158,9 @@ done:
*
*-------------------------------------------------------------------------
*/
-#ifdef H5_WANT_H5_V1_6_COMPAT
-H5T_class_t
-H5Tget_member_class(hid_t type_id, int _membno)
-#else /* H5_WANT_H5_V1_6_COMPAT */
H5T_class_t
H5Tget_member_class(hid_t type_id, unsigned membno)
-#endif /* H5_WANT_H5_V1_6_COMPAT */
{
-#ifdef H5_WANT_H5_V1_6_COMPAT
- unsigned membno = (unsigned)_membno;
-#endif /* H5_WANT_H5_V1_6_COMPAT */
H5T_t *dt = NULL;
H5T_class_t ret_value;
@@ -222,22 +205,14 @@ done:
*
*-------------------------------------------------------------------------
*/
-#ifdef H5_WANT_H5_V1_6_COMPAT
-hid_t
-H5Tget_member_type(hid_t type_id, int _membno)
-#else /* H5_WANT_H5_V1_6_COMPAT */
hid_t
H5Tget_member_type(hid_t type_id, unsigned membno)
-#endif /* H5_WANT_H5_V1_6_COMPAT */
{
-#ifdef H5_WANT_H5_V1_6_COMPAT
- unsigned membno = (unsigned)_membno;
-#endif /* H5_WANT_H5_V1_6_COMPAT */
H5T_t *dt = NULL, *memb_dt = NULL;
hid_t ret_value;
FUNC_ENTER_API(H5Tget_member_type, FAIL)
- H5TRACE2("i","iIs",type_id,membno);
+ H5TRACE2("i","iIu",type_id,membno);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type)
@@ -250,8 +225,7 @@ H5Tget_member_type(hid_t type_id, unsigned membno)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable register datatype atom")
done:
- if(ret_value<0)
-{
+ if(ret_value<0) {
if(memb_dt!=NULL)
if(H5T_close(memb_dt)<0)
HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype")
@@ -316,11 +290,11 @@ done:
*-------------------------------------------------------------------------
*/
size_t
-H5T_get_member_size(H5T_t *dt, unsigned membno)
+H5T_get_member_size(const H5T_t *dt, unsigned membno)
{
size_t ret_value = 0;
- FUNC_ENTER_NOAPI(H5T_get_member_size, 0);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_get_member_size)
assert(dt);
assert(membno < dt->shared->u.compnd.nmembs);
@@ -328,8 +302,7 @@ H5T_get_member_size(H5T_t *dt, unsigned membno)
/* Value */
ret_value = dt->shared->u.compnd.memb[membno].type->shared->size;
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -444,7 +417,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member)
+H5T_insert(const H5T_t *parent, const char *name, size_t offset, const H5T_t *member)
{
unsigned idx, i;
size_t total_size;
@@ -481,7 +454,7 @@ H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member)
/* Increase member array if necessary */
if (parent->shared->u.compnd.nmembs >= parent->shared->u.compnd.nalloc) {
- size_t na = parent->shared->u.compnd.nalloc + H5T_COMPND_INC;
+ unsigned na = parent->shared->u.compnd.nalloc + H5T_COMPND_INC;
H5T_cmemb_t *x = H5MM_realloc (parent->shared->u.compnd.memb,
na * sizeof(H5T_cmemb_t));
@@ -551,7 +524,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T_pack(H5T_t *dt)
+H5T_pack(const H5T_t *dt)
{
unsigned i;
size_t offset;
@@ -564,7 +537,7 @@ H5T_pack(H5T_t *dt)
if(H5T_detect_class(dt,H5T_COMPOUND)>0) {
/* If datatype has been packed, skip packing it and indicate success */
if(H5T_is_packed(dt)== TRUE)
- HGOTO_DONE(SUCCEED);
+ HGOTO_DONE(SUCCEED)
/* Check for packing unmodifiable datatype */
if (H5T_STATE_TRANSIENT!=dt->shared->state)
@@ -627,7 +600,7 @@ H5T_is_packed(const H5T_t *dt)
{
htri_t ret_value=TRUE; /* Return value */
- FUNC_ENTER_NOAPI(H5T_is_packed,FAIL)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_is_packed)
assert(dt);
@@ -639,7 +612,6 @@ H5T_is_packed(const H5T_t *dt)
if(dt->shared->type==H5T_COMPOUND)
ret_value=(htri_t)dt->shared->u.compnd.packed;
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T_is_packed() */
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 871e8e1..a9c463f 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -187,44 +187,56 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
}
#define H5T_CONV_Xx_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S) > (DT)(D_MAX)) { \
- if(cb_struct.func) { /*If user's exception handler is present, use it*/ \
+ if (*((ST*)S) > (DT)(D_MAX)) { \
+ if(cb_struct.func) { \
+ H5T_conv_ret_t except_ret; /*callback return*/ \
+ \
except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
+ if(except_ret == H5T_CONV_UNHANDLED) \
+ /* Let compiler convert if case is ignored by user handler*/ \
+ *((DT*)D) = (D_MAX); \
+ else if(except_ret == H5T_CONV_ABORT) \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
+ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} \
- \
- if(except_ret == H5T_CONV_UNHANDLED) { \
- /*let compiler convert if case is ignored by user handler*/ \
+ else \
*((DT*)D) = (D_MAX); \
- } else if(except_ret == H5T_CONV_ABORT) \
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
- } else if (*((ST*)S) < (D_MIN)) { \
- if(cb_struct.func) { /*If user's exception handler is present, use it*/ \
+ } else if (*((ST*)S) < (D_MIN)) { \
+ if(cb_struct.func) { \
+ H5T_conv_ret_t except_ret; /*callback return*/ \
+ \
except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \
src_id, dst_id, S, D, cb_struct.user_data); \
+ if(except_ret == H5T_CONV_UNHANDLED) \
+ /* Let compiler convert if case is ignored by user handler*/ \
+ *((DT*)D) = (D_MIN); \
+ else if(except_ret == H5T_CONV_ABORT) \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
+ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} \
- \
- if(except_ret == H5T_CONV_UNHANDLED) { \
- /*let compiler convert if case is ignored by user handler*/ \
+ else \
*((DT*)D) = (D_MIN); \
- } else if(except_ret == H5T_CONV_ABORT) \
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
} else \
*((DT*)D) = (DT)(*((ST*)S)); \
-}
+}
#define H5T_CONV_Ux_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S) > (D_MAX)) { \
- if(cb_struct.func) { /*If user's exception handler is present, use it*/ \
+ if (*((ST*)S) > (DT)(D_MAX)) { \
+ if(cb_struct.func) { \
+ H5T_conv_ret_t except_ret; /*callback return*/ \
+ \
except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
+ if(except_ret == H5T_CONV_UNHANDLED) \
+ /* Let compiler convert if case is ignored by user handler*/ \
+ *((DT*)D) = (D_MAX); \
+ else if(except_ret == H5T_CONV_ABORT) \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
+ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} \
- \
- if(except_ret == H5T_CONV_UNHANDLED) { \
- /*let compiler convert if case is ignored by user handler*/ \
+ else \
*((DT*)D) = (D_MAX); \
- } else if(except_ret == H5T_CONV_ABORT) \
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
} else \
*((DT*)D) = (DT)(*((ST*)S)); \
}
@@ -235,17 +247,21 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
}
#define H5T_CONV_sU_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S)<0) { \
- if(cb_struct.func) { /*If user's exception handler is present, use it*/ \
+ if (*((ST*)S) < 0) { \
+ if(cb_struct.func) { \
+ H5T_conv_ret_t except_ret; /*callback return*/ \
+ \
except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \
src_id, dst_id, S, D, cb_struct.user_data); \
+ if(except_ret == H5T_CONV_UNHANDLED) \
+ /* Let compiler convert if case is ignored by user handler*/ \
+ *((DT*)D) = 0; \
+ else if(except_ret == H5T_CONV_ABORT) \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
+ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} \
- \
- if(except_ret == H5T_CONV_UNHANDLED) { \
- /*let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = 0; \
- } else if(except_ret == H5T_CONV_ABORT) \
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
+ else \
+ *((DT*)D) = 0; \
} else \
*((DT*)D) = (DT)(*((ST*)S)); \
}
@@ -256,17 +272,21 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
}
#define H5T_CONV_uS_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- if (sizeof(ST)==sizeof(DT) && *((ST*)S) > (D_MAX)) { \
- if(cb_struct.func) { /*If user's exception handler is present, use it*/ \
- except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
- src_id, dst_id, S, D, cb_struct.user_data); \
+ if (sizeof(ST)==sizeof(DT) && *((ST*)S) > (D_MAX)) { \
+ if(cb_struct.func) { \
+ H5T_conv_ret_t except_ret; /*callback return*/ \
+ \
+ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
+ src_id, dst_id, S, D, cb_struct.user_data); \
+ if(except_ret == H5T_CONV_UNHANDLED) \
+ /* Let compiler convert if case is ignored by user handler*/ \
+ *((DT*)D) = (D_MAX); \
+ else if(except_ret == H5T_CONV_ABORT) \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
+ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} \
- \
- if(except_ret == H5T_CONV_UNHANDLED) { \
- /*let compiler convert if case is ignored by user handler*/ \
+ else \
*((DT*)D) = (D_MAX); \
- } else if(except_ret == H5T_CONV_ABORT) \
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
} else \
*((DT*)D) = (DT)(*((ST*)S)); \
}
@@ -287,29 +307,36 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
}
#define H5T_CONV_Su_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S) < 0) { \
- if(cb_struct.func) { /*If user's exception handler is present, use it*/ \
+ if (*((ST*)S) < 0) { \
+ if(cb_struct.func) { \
+ H5T_conv_ret_t except_ret; /*callback return*/ \
+ \
except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \
src_id, dst_id, S, D, cb_struct.user_data); \
+ if(except_ret == H5T_CONV_UNHANDLED) \
+ /* Let compiler convert if case is ignored by user handler*/ \
+ *((DT*)D) = 0; \
+ else if(except_ret == H5T_CONV_ABORT) \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
+ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} \
+ else \
+ *((DT*)D) = 0; \
+ } else if (sizeof(ST)>sizeof(DT) && *((ST*)S) > (D_MAX)) { \
+ if(cb_struct.func) { \
+ H5T_conv_ret_t except_ret; /*callback return*/ \
\
- if(except_ret == H5T_CONV_UNHANDLED) { \
- /*let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = 0; \
- } else if(except_ret == H5T_CONV_ABORT) \
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
- } else if (sizeof(ST)>sizeof(DT) && *((ST*)S)>(ST)(D_MAX)) { \
- /*sign vs. unsign ok in previous line*/ \
- if(cb_struct.func) { /*If user's exception handler is present, use it*/ \
except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
+ if(except_ret == H5T_CONV_UNHANDLED) \
+ /* Let compiler convert if case is ignored by user handler*/ \
+ *((DT*)D) = (D_MAX); \
+ else if(except_ret == H5T_CONV_ABORT) \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
+ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} \
- \
- if(except_ret == H5T_CONV_UNHANDLED) { \
- /*let compiler convert if case is ignored by user handler*/ \
+ else \
*((DT*)D) = (D_MAX); \
- } else if(except_ret == H5T_CONV_ABORT) \
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
} else \
*((DT*)D) = (DT)(*((ST*)S)); \
}
@@ -331,17 +358,21 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
#define H5T_CONV_su_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
/* Assumes memory format of unsigned & signed integers is same */ \
- if (*((ST*)S)<0) { \
- if(cb_struct.func) { /*If user's exception handler is present, use it*/ \
+ if (*((ST*)S) < 0) { \
+ if(cb_struct.func) { \
+ H5T_conv_ret_t except_ret; /*callback return*/ \
+ \
except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \
src_id, dst_id, S, D, cb_struct.user_data); \
+ if(except_ret == H5T_CONV_UNHANDLED) \
+ /* Let compiler convert if case is ignored by user handler*/ \
+ *((DT*)D) = 0; \
+ else if(except_ret == H5T_CONV_ABORT) \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
+ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} \
- \
- if(except_ret == H5T_CONV_UNHANDLED) { \
- /*let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = 0; \
- } else if(except_ret == H5T_CONV_ABORT) \
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
+ else \
+ *((DT*)D) = 0; \
} \
}
@@ -352,17 +383,21 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
#define H5T_CONV_us_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
/* Assumes memory format of unsigned & signed integers is same */ \
- if (*((ST*)S) > (D_MAX)) { \
- if(cb_struct.func) { /*If user's exception handler is present, use it*/ \
+ if (*((ST*)S) > (D_MAX)) { \
+ if(cb_struct.func) { \
+ H5T_conv_ret_t except_ret; /*callback return*/ \
+ \
except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
- } \
- \
- if(except_ret == H5T_CONV_UNHANDLED) { \
- /*let compiler convert if case is ignored by user handler*/ \
+ if(except_ret == H5T_CONV_UNHANDLED) \
+ /* Let compiler convert if case is ignored by user handler*/ \
+ *((DT*)D) = (D_MAX); \
+ else if(except_ret == H5T_CONV_ABORT) \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
+ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
+ } \
+ else \
*((DT*)D) = (D_MAX); \
- } else if(except_ret == H5T_CONV_ABORT) \
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
} \
}
@@ -380,28 +415,36 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
* when an overflow occurs, use the 'float' infinity values.
*/
#define H5T_CONV_Ff_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S) > (DT)(D_MAX)) { \
- if(cb_struct.func) { /*If user's exception handler is present, use it*/ \
+ if (*((ST*)S) > (DT)(D_MAX)) { \
+ if(cb_struct.func) { \
+ H5T_conv_ret_t except_ret; /*callback return*/ \
+ \
except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
+ if(except_ret == H5T_CONV_UNHANDLED) \
+ /* Let compiler convert if case is ignored by user handler*/ \
+ *((DT*)D) = (H5T_NATIVE_FLOAT_POS_INF_g); \
+ else if(except_ret == H5T_CONV_ABORT) \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
+ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} \
- \
- if(except_ret == H5T_CONV_UNHANDLED) { \
- /*let compiler convert if case is ignored by user handler*/ \
+ else \
*((DT*)D) = (H5T_NATIVE_FLOAT_POS_INF_g); \
- } else if(except_ret == H5T_CONV_ABORT) \
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
- } else if (*((ST*)S) < (D_MIN)) { \
- if(cb_struct.func) { /*If user's exception handler is present, use it*/ \
+ } else if (*((ST*)S) < (D_MIN)) { \
+ if(cb_struct.func) { \
+ H5T_conv_ret_t except_ret; /*callback return*/ \
+ \
except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \
src_id, dst_id, S, D, cb_struct.user_data); \
+ if(except_ret == H5T_CONV_UNHANDLED) \
+ /* Let compiler convert if case is ignored by user handler*/ \
+ *((DT*)D) = (H5T_NATIVE_FLOAT_NEG_INF_g); \
+ else if(except_ret == H5T_CONV_ABORT) \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
+ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} \
- \
- if(except_ret == H5T_CONV_UNHANDLED) { \
- /*let compiler convert if case is ignored by user handler*/ \
+ else \
*((DT*)D) = (H5T_NATIVE_FLOAT_NEG_INF_g); \
- } else if(except_ret == H5T_CONV_ABORT) \
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
} else \
*((DT*)D) = (DT)(*((ST*)S)); \
}
@@ -431,7 +474,6 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
size_t safe; /*how many elements are safe to process in each pass */ \
H5P_genplist_t *plist; /*Property list pointer */ \
H5T_conv_cb_t cb_struct; /*conversion callback structure */ \
- H5T_conv_ret_t except_ret; /*callback return*/ \
\
switch (cdata->command) { \
case H5T_CONV_INIT: \
@@ -440,7 +482,7 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
if (NULL==(st=H5I_object(src_id)) || NULL==(dt=H5I_object(dst_id))) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \
"unable to dereference datatype object ID") \
- if (st->shared->size!=sizeof(ST) || dt->shared->size!=sizeof(DT)) \
+ if (st->shared->size!=sizeof(ST) || dt->shared->size!=sizeof(DT)) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \
"disagreement about datatype size") \
CI_ALLOC_PRIV \
@@ -457,7 +499,8 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
if (buf_stride) { \
assert(buf_stride>=sizeof(ST)); \
assert(buf_stride>=sizeof(DT)); \
- s_stride = d_stride = buf_stride; \
+ H5_CHECK_OVERFLOW(buf_stride,size_t,ssize_t); \
+ s_stride = d_stride = (ssize_t)buf_stride; \
} else { \
s_stride = sizeof(ST); \
d_stride = sizeof(DT); \
@@ -514,8 +557,6 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
safe=nelmts; \
} /* end else */ \
\
- except_ret = H5T_CONV_UNHANDLED; \
- \
/* Perform loop over elements to convert */ \
if (s_mv && d_mv) { \
/* Alignment is required for both source and dest */ \
@@ -1237,7 +1278,7 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
uint8_t dbuf[256]; /*temp destination buffer */
size_t msb_pad_offset; /*offset for dest MSB padding */
size_t i;
- uint8_t *src_rev; /*order-reversed source buffer */
+ uint8_t *src_rev=NULL; /*order-reversed source buffer */
H5P_genplist_t *plist; /*property list pointer */
H5T_conv_cb_t cb_struct={NULL, NULL}; /*conversion callback structure */
H5T_conv_ret_t except_ret; /*return of callback function */
@@ -1432,8 +1473,6 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
}
- H5MM_free(src_rev);
-
break;
default:
@@ -1441,6 +1480,8 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
done:
+ if(src_rev)
+ H5MM_free(src_rev);
FUNC_LEAVE_NOAPI(ret_value);
}
@@ -2322,7 +2363,6 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
n = *((int*)s);
}
n -= priv->base;
-
if (n<0 || n>=priv->length || priv->src2dst[n]<0) {
/*overflow*/
except_ret = H5T_CONV_UNHANDLED;
@@ -2494,14 +2534,19 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
if (buf_stride) {
assert(buf_stride>=src->shared->size);
assert(buf_stride>=dst->shared->size);
- s_stride = d_stride = buf_stride;
+ H5_CHECK_OVERFLOW(buf_stride,size_t,ssize_t);
+ s_stride = d_stride = (ssize_t)buf_stride;
} else {
- s_stride = src->shared->size;
- d_stride = dst->shared->size;
+ H5_CHECK_OVERFLOW(src->shared->size,size_t,ssize_t);
+ H5_CHECK_OVERFLOW(dst->shared->size,size_t,ssize_t);
+ s_stride = (ssize_t)src->shared->size;
+ d_stride = (ssize_t)dst->shared->size;
}
if(bkg) {
- if(bkg_stride)
- b_stride=bkg_stride;
+ if(bkg_stride) {
+ H5_CHECK_OVERFLOW(bkg_stride,size_t,ssize_t);
+ b_stride=(ssize_t)bkg_stride;
+ } /* end if */
else
b_stride=d_stride;
} /* end if */
@@ -2911,7 +2956,7 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
size_t half_size; /*half the type size */
size_t olap; /*num overlapping elements */
uint8_t *s, *sp, *d, *dp; /*source and dest traversal ptrs*/
- uint8_t *src_rev; /*order-reversed source buffer */
+ uint8_t *src_rev=NULL; /*order-reversed source buffer */
uint8_t dbuf[64]; /*temp destination buffer */
size_t first;
ssize_t sfirst; /*a signed version of `first' */
@@ -3266,8 +3311,6 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
}
- H5MM_free(src_rev);
-
break;
default:
@@ -3275,6 +3318,8 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
done:
+ if(src_rev)
+ H5MM_free(src_rev);
FUNC_LEAVE_NOAPI(ret_value);
}
@@ -3323,7 +3368,7 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
size_t olap; /*num overlapping elements */
ssize_t bitno; /*bit number */
uint8_t *s, *sp, *d, *dp; /*source and dest traversal ptrs*/
- uint8_t *src_rev; /*order-reversed source buffer */
+ uint8_t *src_rev=NULL; /*order-reversed source buffer */
uint8_t dbuf[64]; /*temp destination buffer */
/* Conversion-related variables */
@@ -3539,7 +3584,7 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
*/
if (H5T_NORM_NONE==dst.u.f.norm)
mrsh++;
-
+
/*
* Calculate the destination exponent by adding the destination
* bias and clipping by the minimum and maximum possible
@@ -3723,8 +3768,6 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
}
- H5MM_free(src_rev);
-
break;
default:
@@ -3732,6 +3775,9 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
done:
+ if(src_rev)
+ H5MM_free(src_rev);
+
FUNC_LEAVE_NOAPI(ret_value);
}
@@ -8686,13 +8732,13 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
ssize_t bitno; /*bit number */
size_t olap; /*num overlapping elements */
uint8_t *s, *sp, *d, *dp; /*source and dest traversal ptrs*/
- uint8_t *src_rev; /*order-reversed source buffer */
+ uint8_t *src_rev=NULL; /*order-reversed source buffer */
uint8_t dbuf[64]; /*temp destination buffer */
/* Conversion-related variables */
hssize_t expo; /*source exponent */
hssize_t sign; /*source sign bit value */
- uint8_t *int_buf; /*buffer for temporary value */
+ uint8_t *int_buf=NULL; /*buffer for temporary value */
size_t buf_size; /*buffer size for temporary value */
size_t i; /*miscellaneous counters */
size_t first; /*first bit(MSB) in an integer */
@@ -9102,9 +9148,6 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
HDmemset(int_buf, 0, buf_size);
}
- H5MM_xfree(int_buf);
- H5MM_free(src_rev);
-
break;
default:
@@ -9112,6 +9155,10 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
done:
+ if(int_buf)
+ H5MM_xfree(int_buf);
+ if(src_rev)
+ H5MM_free(src_rev);
FUNC_LEAVE_NOAPI(ret_value);
}
@@ -9152,7 +9199,7 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
size_t half_size; /*half the type size */
size_t olap; /*num overlapping elements */
uint8_t *s, *sp, *d, *dp; /*source and dest traversal ptrs*/
- uint8_t *src_rev; /*order-reversed source buffer */
+ uint8_t *src_rev=NULL; /*order-reversed source buffer */
uint8_t dbuf[64]; /*temp destination buffer */
/* Conversion-related variables */
@@ -9161,7 +9208,7 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
size_t sign; /*source sign bit value */
hbool_t is_max_neg; /*source is maximal negative value*/
hbool_t do_round; /*whether there is roundup */
- uint8_t *int_buf; /*buffer for temporary value */
+ uint8_t *int_buf=NULL; /*buffer for temporary value */
size_t buf_size; /*buffer size for temporary value */
size_t i; /*miscellaneous counters */
size_t first; /*first bit(MSB) in an integer */
@@ -9512,9 +9559,6 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
HDmemset(int_buf, 0, buf_size);
}
- H5MM_xfree(int_buf);
- H5MM_free(src_rev);
-
break;
default:
@@ -9522,6 +9566,10 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
done:
+ if(int_buf)
+ H5MM_xfree(int_buf);
+ if(src_rev)
+ H5MM_free(src_rev);
FUNC_LEAVE_NOAPI(ret_value);
}
diff --git a/src/H5Tcset.c b/src/H5Tcset.c
index 1a9e39d..5d9c857 100644
--- a/src/H5Tcset.c
+++ b/src/H5Tcset.c
@@ -134,7 +134,7 @@ H5Tset_cset(hid_t type_id, H5T_cset_t cset)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
if (H5T_STATE_TRANSIENT!=dt->shared->state)
HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only")
- if (cset < 0 || cset >= H5T_NCSET)
+ if (cset < H5T_CSET_ASCII || cset >= H5T_NCSET)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal character set type")
while (dt->shared->parent && !H5T_IS_STRING(dt->shared))
dt = dt->shared->parent; /*defer to parent*/
diff --git a/src/H5Tenum.c b/src/H5Tenum.c
index 83a3615..db1daa4 100644
--- a/src/H5Tenum.c
+++ b/src/H5Tenum.c
@@ -38,9 +38,9 @@ H5FL_EXTERN(H5T_t);
H5FL_EXTERN(H5T_shared_t);
/* Static local functions */
-static char *H5T_enum_nameof(H5T_t *dt, const void *value, char *name/*out*/,
+static char *H5T_enum_nameof(const H5T_t *dt, const void *value, char *name/*out*/,
size_t size);
-static herr_t H5T_enum_valueof(H5T_t *dt, const char *name,
+static herr_t H5T_enum_valueof(const H5T_t *dt, const char *name,
void *value/*out*/);
@@ -141,7 +141,7 @@ H5T_enum_create(const H5T_t *parent)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
if (NULL==(ret_value->shared=H5FL_CALLOC(H5T_shared_t))) {
H5FL_FREE(H5T_t, ret_value);
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
}
ret_value->shared->type = H5T_ENUM;
ret_value->shared->parent = H5T_copy(parent, H5T_COPY_ALL);
@@ -223,7 +223,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5T_enum_insert(H5T_t *dt, const char *name, const void *value)
+H5T_enum_insert(const H5T_t *dt, const char *name, const void *value)
{
unsigned i;
char **names=NULL;
@@ -285,17 +285,9 @@ done:
*
*-------------------------------------------------------------------------
*/
-#ifdef H5_WANT_H5_V1_6_COMPAT
-herr_t
-H5Tget_member_value(hid_t type, int _membno, void *value/*out*/)
-#else /* H5_WANT_H5_V1_6_COMPAT */
herr_t
H5Tget_member_value(hid_t type, unsigned membno, void *value/*out*/)
-#endif /* H5_WANT_H5_V1_6_COMPAT */
{
-#ifdef H5_WANT_H5_V1_6_COMPAT
- unsigned membno = (unsigned)_membno;
-#endif /* H5_WANT_H5_V1_6_COMPAT */
H5T_t *dt=NULL;
herr_t ret_value=SUCCEED; /* Return value */
@@ -429,7 +421,7 @@ done:
*-------------------------------------------------------------------------
*/
static char *
-H5T_enum_nameof(H5T_t *dt, const void *value, char *name/*out*/, size_t size)
+H5T_enum_nameof(const H5T_t *dt, const void *value, char *name/*out*/, size_t size)
{
unsigned lt, md=0, rt; /*indices for binary search */
int cmp=(-1); /*comparison result */
@@ -549,7 +541,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T_enum_valueof(H5T_t *dt, const char *name, void *value/*out*/)
+H5T_enum_valueof(const H5T_t *dt, const char *name, void *value/*out*/)
{
unsigned lt, md=0, rt; /*indices for binary search */
int cmp=(-1); /*comparison result */
diff --git a/src/H5Tfields.c b/src/H5Tfields.c
index 48a7e22..d2c2082 100644
--- a/src/H5Tfields.c
+++ b/src/H5Tfields.c
@@ -158,17 +158,9 @@ done:
* Also works with enumeration datatypes.
*-------------------------------------------------------------------------
*/
-#ifdef H5_WANT_H5_V1_6_COMPAT
-char *
-H5Tget_member_name(hid_t type_id, int _membno)
-#else /* H5_WANT_H5_V1_6_COMPAT */
char *
H5Tget_member_name(hid_t type_id, unsigned membno)
-#endif /* H5_WANT_H5_V1_6_COMPAT */
{
-#ifdef H5_WANT_H5_V1_6_COMPAT
- unsigned membno = (unsigned)_membno;
-#endif /* H5_WANT_H5_V1_6_COMPAT */
H5T_t *dt = NULL;
char *ret_value;
@@ -229,7 +221,7 @@ H5T_get_member_name(H5T_t const *dt, unsigned membno)
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "operation not supported for type class")
- }
+ } /*lint !e788 All appropriate cases are covered */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -285,7 +277,7 @@ H5Tget_member_index(hid_t type_id, const char *name)
break;
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for this type")
- }
+ } /*lint !e788 All appropriate cases are covered */
done:
FUNC_LEAVE_API(ret_value)
@@ -311,7 +303,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5T_sort_value(H5T_t *dt, int *map)
+H5T_sort_value(const H5T_t *dt, int *map)
{
unsigned i, j, nmembs;
size_t size;
@@ -422,7 +414,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5T_sort_name(H5T_t *dt, int *map)
+H5T_sort_name(const H5T_t *dt, int *map)
{
unsigned i, j, nmembs;
size_t size;
diff --git a/src/H5Tfixed.c b/src/H5Tfixed.c
index 361ba8d..99fc26a 100644
--- a/src/H5Tfixed.c
+++ b/src/H5Tfixed.c
@@ -164,7 +164,7 @@ H5Tset_sign(hid_t type_id, H5T_sign_t sign)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an integer datatype")
if (H5T_STATE_TRANSIENT!=dt->shared->state)
HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only")
- if (sign < 0 || sign >= H5T_NSGN)
+ if (sign < H5T_SGN_NONE || sign >= H5T_NSGN)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal sign type")
if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined")
diff --git a/src/H5Tfloat.c b/src/H5Tfloat.c
index 0e54468..6be73da 100644
--- a/src/H5Tfloat.c
+++ b/src/H5Tfloat.c
@@ -337,7 +337,7 @@ H5Tset_norm(hid_t type_id, H5T_norm_t norm)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
if (H5T_STATE_TRANSIENT!=dt->shared->state)
HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only")
- if (norm < 0 || norm > H5T_NORM_NONE)
+ if (norm < H5T_NORM_IMPLIED || norm > H5T_NORM_NONE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal normalization")
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
@@ -431,7 +431,7 @@ H5Tset_inpad(hid_t type_id, H5T_pad_t pad)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
if (H5T_STATE_TRANSIENT!=dt->shared->state)
HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only")
- if (pad < 0 || pad >= H5T_NPAD)
+ if (pad < H5T_PAD_ZERO || pad >= H5T_NPAD)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal internal pad type")
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index 1ece922..291c41b 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -170,7 +170,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
assert(dtype);
- if((h5_class = H5T_get_class(dtype))<0)
+ if((h5_class = H5T_get_class(dtype))==H5T_NO_CLASS)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid class")
if((size = H5T_get_size(dtype))==0)
@@ -478,6 +478,8 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
}
break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "data type doesn't match any native type")
}
@@ -647,9 +649,9 @@ H5T_get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
align = H5T_NATIVE_LLONG_COMP_ALIGN_g;
break;
+ case H5T_NATIVE_INT_MATCH_UNKNOWN:
default:
- assert(0 && "Unknown native integer match!");
- break;
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "Unknown native integer match")
} /* end switch */
/* Create new native type */
@@ -764,9 +766,9 @@ H5T_get_native_float(size_t size, H5T_direction_t direction, size_t *struct_alig
align = H5T_NATIVE_LDOUBLE_COMP_ALIGN_g;
break;
+ case H5T_NATIVE_FLOAT_MATCH_UNKNOWN:
default:
- assert(0 && "Unknown native floating-point match!");
- break;
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "Unknown native floating-point match")
} /* end switch */
/* Create new native type */
diff --git a/src/H5Toffset.c b/src/H5Toffset.c
index 943415e..99046cf 100644
--- a/src/H5Toffset.c
+++ b/src/H5Toffset.c
@@ -32,7 +32,7 @@
#include "H5Tpkg.h" /* Datatypes */
/* Static local functions */
-static herr_t H5T_set_offset(H5T_t *dt, size_t offset);
+static herr_t H5T_set_offset(const H5T_t *dt, size_t offset);
/*--------------------------------------------------------------------------
@@ -225,7 +225,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T_set_offset(H5T_t *dt, size_t offset)
+H5T_set_offset(const H5T_t *dt, size_t offset)
{
herr_t ret_value=SUCCEED; /* Return value */
diff --git a/src/H5Torder.c b/src/H5Torder.c
index 1c23de8..c43fc3c 100644
--- a/src/H5Torder.c
+++ b/src/H5Torder.c
@@ -127,14 +127,14 @@ H5Tset_order(hid_t type_id, H5T_order_t order)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
if (H5T_STATE_TRANSIENT!=dt->shared->state)
HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only")
- if (order < 0 || order > H5T_ORDER_NONE)
+ if (order < H5T_ORDER_LE || order > H5T_ORDER_NONE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal byte order")
if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined")
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
if (!H5T_IS_ATOMIC(dt->shared))
- HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "operation not defined for specified data type")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type")
/* Commit */
dt->shared->u.atomic.order = order;
diff --git a/src/H5Tpad.c b/src/H5Tpad.c
index a4fe620..254831e 100644
--- a/src/H5Tpad.c
+++ b/src/H5Tpad.c
@@ -130,7 +130,7 @@ H5Tset_pad(hid_t type_id, H5T_pad_t lsb, H5T_pad_t msb)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
if (H5T_STATE_TRANSIENT!=dt->shared->state)
HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only")
- if (lsb < 0 || lsb >= H5T_NPAD || msb < 0 || msb >= H5T_NPAD)
+ if (lsb < H5T_PAD_ZERO || lsb >= H5T_NPAD || msb < H5T_PAD_ZERO || msb >= H5T_NPAD)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pad type")
if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined")
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index bde3403..c08f5db 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -143,9 +143,9 @@ typedef struct H5T_enum_t {
} H5T_enum_t;
/* VL function pointers */
-typedef ssize_t (*H5T_vlen_getlenfunc_t)(void *vl_addr);
+typedef ssize_t (*H5T_vlen_getlenfunc_t)(const void *vl_addr);
typedef void * (*H5T_vlen_getptrfunc_t)(void *vl_addr);
-typedef htri_t (*H5T_vlen_isnullfunc_t)(H5F_t *f, void *vl_addr);
+typedef htri_t (*H5T_vlen_isnullfunc_t)(const H5F_t *f, void *vl_addr);
typedef herr_t (*H5T_vlen_readfunc_t)(H5F_t *f, hid_t dxpl_id, void *_vl, void *buf, size_t len);
typedef herr_t (*H5T_vlen_writefunc_t)(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size);
typedef herr_t (*H5T_vlen_setnullfunc_t)(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg);
@@ -329,14 +329,14 @@ H5_DLL H5T_t *H5T_get_super(H5T_t *dt);
H5_DLL char *H5T_get_member_name(H5T_t const *dt, unsigned membno);
H5_DLL herr_t H5T_get_member_value(const H5T_t *dt, unsigned membno, void *value);
H5_DLL int H5T_get_nmembers(const H5T_t *dt);
-H5_DLL herr_t H5T_insert(H5T_t *parent, const char *name, size_t offset,
+H5_DLL herr_t H5T_insert(const H5T_t *parent, const char *name, size_t offset,
const H5T_t *member);
H5_DLL H5T_t *H5T_enum_create(const H5T_t *parent);
-H5_DLL herr_t H5T_enum_insert(H5T_t *dt, const char *name, const void *value);
+H5_DLL herr_t H5T_enum_insert(const H5T_t *dt, const char *name, const void *value);
H5_DLL int H5T_get_array_ndims(H5T_t *dt);
H5_DLL int H5T_get_array_dims(H5T_t *dt, hsize_t dims[], int perm[]);
-H5_DLL herr_t H5T_sort_value(H5T_t *dt, int *map);
-H5_DLL herr_t H5T_sort_name(H5T_t *dt, int *map);
+H5_DLL herr_t H5T_sort_value(const H5T_t *dt, int *map);
+H5_DLL herr_t H5T_sort_name(const H5T_t *dt, int *map);
H5_DLL herr_t H5T_set_size(H5T_t *dt, size_t size);
/* Conversion functions */
@@ -1082,7 +1082,7 @@ H5_DLL void H5T_bit_neg(uint8_t *buf, size_t start, size_t size);
/* VL functions */
H5_DLL H5T_t * H5T_vlen_create(const H5T_t *base);
-H5_DLL htri_t H5T_vlen_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc);
+H5_DLL htri_t H5T_vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc);
/* Array functions */
H5_DLL H5T_t * H5T_array_create(H5T_t *base, int ndims,
@@ -1091,7 +1091,7 @@ H5_DLL H5T_t * H5T_array_create(H5T_t *base, int ndims,
/* Compound functions */
H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno);
H5_DLL size_t H5T_get_member_offset(const H5T_t *dt, unsigned membno);
-H5_DLL size_t H5T_get_member_size(H5T_t *dt, unsigned membno);
+H5_DLL size_t H5T_get_member_size(const H5T_t *dt, unsigned membno);
H5_DLL htri_t H5T_is_packed(const H5T_t *dt);
#endif
diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c
index f5e1ef5..9728172 100644
--- a/src/H5Tprecis.c
+++ b/src/H5Tprecis.c
@@ -32,7 +32,7 @@
#include "H5Tpkg.h" /* Datatypes */
/* Static local functions */
-static herr_t H5T_set_precision(H5T_t *dt, size_t prec);
+static herr_t H5T_set_precision(const H5T_t *dt, size_t prec);
/*--------------------------------------------------------------------------
@@ -195,7 +195,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T_set_precision(H5T_t *dt, size_t prec)
+H5T_set_precision(const H5T_t *dt, size_t prec)
{
size_t offset, size;
herr_t ret_value=SUCCEED; /* Return value */
@@ -252,9 +252,8 @@ H5T_set_precision(H5T_t *dt, size_t prec)
break;
default:
- assert("not implemented yet" && 0);
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class")
- } /* end switch */
+ } /* end switch */ /*lint !e788 All appropriate cases are covered */
/* Commit */
dt->shared->size = size;
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 282b61e..e09be78 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -87,11 +87,11 @@ H5_DLL H5T_bkg_t H5T_path_bkg(const H5T_path_t *p);
H5_DLL herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id,
size_t nelmts, size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg, hid_t dset_xfer_plist);
-H5_DLL herr_t H5T_vlen_reclaim(void *elem, hid_t type_id, hsize_t ndim, hssize_t *point, void *_op_data);
+H5_DLL herr_t H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *_op_data);
H5_DLL herr_t H5T_vlen_get_alloc_info(hid_t dxpl_id, H5T_vlen_alloc_info_t **vl_alloc_info);
H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc);
H5_DLL htri_t H5T_is_sensible(const H5T_t *dt);
-H5_DLL htri_t H5T_committed(H5T_t *type);
+H5_DLL htri_t H5T_committed(const H5T_t *type);
H5_DLL int H5T_link(const H5T_t *type, int adjust, hid_t dxpl_id);
/* Reference specific functions */
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index c4daeb1..951d49b 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -94,7 +94,7 @@ typedef enum H5T_cset_t {
H5T_CSET_RESERVED_14 = 14, /*reserved for later use */
H5T_CSET_RESERVED_15 = 15 /*reserved for later use */
} H5T_cset_t;
-#define H5T_NCSET 1 /*Number of character sets actually defined */
+#define H5T_NCSET H5T_CSET_RESERVED_1 /*Number of character sets actually defined */
/*
* Type of padding to use in character strings. Do not change these values
@@ -119,7 +119,7 @@ typedef enum H5T_str_t {
H5T_STR_RESERVED_14 = 14, /*reserved for later use */
H5T_STR_RESERVED_15 = 15 /*reserved for later use */
} H5T_str_t;
-#define H5T_NSTR 3 /*num H5T_str_t types actually defined */
+#define H5T_NSTR H5T_STR_RESERVED_3 /*num H5T_str_t types actually defined */
/* Type of padding to use in other atomic types */
typedef enum H5T_pad_t {
@@ -207,13 +207,13 @@ typedef herr_t (*H5T_conv_t) (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
typedef H5T_conv_ret_t (*H5T_conv_except_func_t)(int except_type, hid_t src_id,
hid_t dst_id, void *src_buf, void *dst_buf, void *user_data);
-/* When this header is included from H5Tprivate.h, don't make calls to H5open() */
+/* When this header is included from a private header, don't make calls to H5open() */
#undef H5OPEN
-#ifndef _H5Tprivate_H
+#ifndef _H5private_H
#define H5OPEN H5open(),
-#else /* _H5Tprivate_H */
+#else /* _H5private_H */
#define H5OPEN
-#endif /* _H5Tprivate_H */
+#endif /* _H5private_H */
/*
* The IEEE floating point types in various byte orders.
@@ -533,23 +533,12 @@ H5_DLL H5T_norm_t H5Tget_norm(hid_t type_id);
H5_DLL H5T_pad_t H5Tget_inpad(hid_t type_id);
H5_DLL H5T_str_t H5Tget_strpad(hid_t type_id);
H5_DLL int H5Tget_nmembers(hid_t type_id);
-#ifdef H5_WANT_H5_V1_6_COMPAT
-H5_DLL char *H5Tget_member_name(hid_t type_id, int membno);
-#else /* H5_WANT_H5_V1_6_COMPAT */
H5_DLL char *H5Tget_member_name(hid_t type_id, unsigned membno);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
H5_DLL int H5Tget_member_index(hid_t type_id, const char *name);
-#ifdef H5_WANT_H5_V1_6_COMPAT
-H5_DLL size_t H5Tget_member_offset(hid_t type_id, int membno);
-H5_DLL H5T_class_t H5Tget_member_class(hid_t type_id, int membno);
-H5_DLL hid_t H5Tget_member_type(hid_t type_id, int membno);
-H5_DLL herr_t H5Tget_member_value(hid_t type_id, int membno, void *value/*out*/);
-#else /* H5_WANT_H5_V1_6_COMPAT */
H5_DLL size_t H5Tget_member_offset(hid_t type_id, unsigned membno);
H5_DLL H5T_class_t H5Tget_member_class(hid_t type_id, unsigned membno);
H5_DLL hid_t H5Tget_member_type(hid_t type_id, unsigned membno);
H5_DLL herr_t H5Tget_member_value(hid_t type_id, unsigned membno, void *value/*out*/);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
H5_DLL H5T_cset_t H5Tget_cset(hid_t type_id);
H5_DLL htri_t H5Tis_variable_str(hid_t type_id);
H5_DLL hid_t H5Tget_native_type(hid_t type_id, H5T_direction_t direction);
diff --git a/src/H5Tstrpad.c b/src/H5Tstrpad.c
index c764a75..c79b60d 100644
--- a/src/H5Tstrpad.c
+++ b/src/H5Tstrpad.c
@@ -146,7 +146,7 @@ H5Tset_strpad(hid_t type_id, H5T_str_t strpad)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
if (H5T_STATE_TRANSIENT!=dt->shared->state)
HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only")
- if (strpad < 0 || strpad >= H5T_NSTR)
+ if (strpad < H5T_STR_NULLTERM || strpad >= H5T_NSTR)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal string pad type")
while (dt->shared->parent && !H5T_IS_STRING(dt->shared))
dt = dt->shared->parent; /*defer to parent*/
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 467327e..186b14f 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -38,21 +38,21 @@
/* Local functions */
static herr_t H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, void *free_info);
-static ssize_t H5T_vlen_seq_mem_getlen(void *_vl);
+static ssize_t H5T_vlen_seq_mem_getlen(const void *_vl);
static void * H5T_vlen_seq_mem_getptr(void *_vl);
-static htri_t H5T_vlen_seq_mem_isnull(H5F_t *f, void *_vl);
+static htri_t H5T_vlen_seq_mem_isnull(const H5F_t *f, void *_vl);
static herr_t H5T_vlen_seq_mem_read(H5F_t *f, hid_t dxpl_id, void *_vl, void *_buf, size_t len);
static herr_t H5T_vlen_seq_mem_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size);
static herr_t H5T_vlen_seq_mem_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg);
-static ssize_t H5T_vlen_str_mem_getlen(void *_vl);
+static ssize_t H5T_vlen_str_mem_getlen(const void *_vl);
static void * H5T_vlen_str_mem_getptr(void *_vl);
-static htri_t H5T_vlen_str_mem_isnull(H5F_t *f, void *_vl);
+static htri_t H5T_vlen_str_mem_isnull(const H5F_t *f, void *_vl);
static herr_t H5T_vlen_str_mem_read(H5F_t *f, hid_t dxpl_id, void *_vl, void *_buf, size_t len);
static herr_t H5T_vlen_str_mem_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size);
static herr_t H5T_vlen_str_mem_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg);
-static ssize_t H5T_vlen_disk_getlen(void *_vl);
+static ssize_t H5T_vlen_disk_getlen(const void *_vl);
static void * H5T_vlen_disk_getptr(void *_vl);
-static htri_t H5T_vlen_disk_isnull(H5F_t *f, void *_vl);
+static htri_t H5T_vlen_disk_isnull(const H5F_t *f, void *_vl);
static herr_t H5T_vlen_disk_read(H5F_t *f, hid_t dxpl_id, void *_vl, void *_buf, size_t len);
static herr_t H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size);
static herr_t H5T_vlen_disk_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg);
@@ -217,7 +217,7 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5T_vlen_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
+H5T_vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
{
htri_t ret_value = 0; /* Indicate that success, but no location change */
@@ -297,7 +297,7 @@ H5T_vlen_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
default:
HGOTO_ERROR (H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid VL datatype location")
- } /* end switch */
+ } /* end switch */ /*lint !e788 All appropriate cases are covered */
} /* end if */
done:
@@ -320,9 +320,9 @@ done:
*-------------------------------------------------------------------------
*/
static ssize_t
-H5T_vlen_seq_mem_getlen(void *_vl)
+H5T_vlen_seq_mem_getlen(const void *_vl)
{
- hvl_t *vl=(hvl_t *)_vl; /* Pointer to the user's hvl_t information */
+ const hvl_t *vl=(const hvl_t *)_vl; /* Pointer to the user's hvl_t information */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_vlen_seq_mem_getlen)
@@ -377,7 +377,7 @@ H5T_vlen_seq_mem_getptr(void *_vl)
*/
/* ARGSUSED */
static htri_t
-H5T_vlen_seq_mem_isnull(H5F_t UNUSED *f, void *_vl)
+H5T_vlen_seq_mem_isnull(const H5F_t UNUSED *f, void *_vl)
{
hvl_t *vl=(hvl_t *)_vl; /* Pointer to the user's hvl_t information */
@@ -532,9 +532,9 @@ H5T_vlen_seq_mem_setnull(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_vl, void
*-------------------------------------------------------------------------
*/
static ssize_t
-H5T_vlen_str_mem_getlen(void *_vl)
+H5T_vlen_str_mem_getlen(const void *_vl)
{
- char *s=*(char **)_vl; /* Pointer to the user's string information */
+ const char *s=*(const char * const *)_vl; /* Pointer to the user's string information */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_vlen_str_mem_getlen)
@@ -589,13 +589,13 @@ H5T_vlen_str_mem_getptr(void *_vl)
*/
/* ARGSUSED */
static htri_t
-H5T_vlen_str_mem_isnull(H5F_t UNUSED *f, void *_vl)
+H5T_vlen_str_mem_isnull(const H5F_t UNUSED *f, void *_vl)
{
char *s=*(char **)_vl; /* Pointer to the user's string information */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_vlen_str_mem_isnull)
- FUNC_LEAVE_NOAPI(s==NULL ? TRUE : FALSE);
+ FUNC_LEAVE_NOAPI(s==NULL ? TRUE : FALSE)
} /* end H5T_vlen_str_mem_isnull() */
@@ -726,9 +726,9 @@ H5T_vlen_str_mem_setnull(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_vl, void
*-------------------------------------------------------------------------
*/
static ssize_t
-H5T_vlen_disk_getlen(void *_vl)
+H5T_vlen_disk_getlen(const void *_vl)
{
- uint8_t *vl=(uint8_t *)_vl; /* Pointer to the disk VL information */
+ const uint8_t *vl=(const uint8_t *)_vl; /* Pointer to the disk VL information */
size_t seq_len; /* Sequence length */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_vlen_disk_getlen)
@@ -756,6 +756,7 @@ H5T_vlen_disk_getlen(void *_vl)
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static void *
H5T_vlen_disk_getptr(void UNUSED *vl)
{
@@ -783,7 +784,7 @@ H5T_vlen_disk_getptr(void UNUSED *vl)
*-------------------------------------------------------------------------
*/
static htri_t
-H5T_vlen_disk_isnull(H5F_t *f, void *_vl)
+H5T_vlen_disk_isnull(const H5F_t *f, void *_vl)
{
uint8_t *vl=(uint8_t *)_vl; /* Pointer to the disk VL information */
haddr_t addr; /* Sequence's heap address */
@@ -823,7 +824,6 @@ H5T_vlen_disk_read(H5F_t *f, hid_t dxpl_id, void *_vl, void *buf, size_t UNUSED
{
uint8_t *vl=(uint8_t *)_vl; /* Pointer to the user's hvl_t information */
H5HG_t hobjid;
- uint32_t seq_len;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5T_vlen_disk_read)
@@ -833,8 +833,8 @@ H5T_vlen_disk_read(H5F_t *f, hid_t dxpl_id, void *_vl, void *buf, size_t UNUSED
assert(buf);
assert(f);
- /* Get the length of the sequence */
- UINT32DECODE(vl, seq_len); /* Not used */
+ /* Skip the length of the sequence */
+ vl += 4;
/* Get the heap information */
H5F_addr_decode(f,(const uint8_t **)&vl,&(hobjid.addr));
@@ -870,6 +870,7 @@ done:
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static herr_t
H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t UNUSED *vl_alloc_info, void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size)
{
@@ -888,11 +889,10 @@ H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t UNUSED
/* Free heap object for old data. */
if(bg!=NULL) {
- size_t bg_seq_len; /* "Background" VL info sequence's length */
H5HG_t bg_hobjid; /* "Background" VL info sequence's ID info */
- /* Get the length of the sequence and heap object ID from background data. */
- UINT32DECODE(bg, bg_seq_len);
+ /* Skip the length of the sequence and heap object ID from background data. */
+ bg += 4;
/* Get heap information */
H5F_addr_decode(f, (const uint8_t **)&bg, &(bg_hobjid.addr));
@@ -953,11 +953,10 @@ H5T_vlen_disk_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg)
/* Free heap object for old data. */
if(bg!=NULL) {
- hsize_t bg_seq_len=0; /* "Background" VL info sequence's length */
H5HG_t bg_hobjid; /* "Background" VL info sequence's ID info */
- /* Get the length of the sequence and heap object ID from background data. */
- UINT32DECODE(bg, bg_seq_len);
+ /* Skip the length of the sequence and heap object ID from background data. */
+ bg += 4;
/* Get heap information */
H5F_addr_decode(f, (const uint8_t **)&bg, &(bg_hobjid.addr));
@@ -1085,7 +1084,7 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi
default:
break;
- } /* end switch */
+ } /* end switch */ /*lint !e788 All appropriate cases are covered */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1101,8 +1100,8 @@ done:
herr_t H5T_vlen_reclaim(elem,type_id,ndim,point,op_data)
void *elem; IN/OUT: Pointer to the dataset element
hid_t type_id; IN: Datatype of dataset element
- hsize_t ndim; IN: Number of dimensions in dataspace
- hssize_t *point; IN: Coordinate location of element in dataspace
+ unsigned ndim; IN: Number of dimensions in dataspace
+ hsize_t *point; IN: Coordinate location of element in dataspace
void *op_data IN: Operator data
RETURNS
@@ -1118,7 +1117,7 @@ done:
--------------------------------------------------------------------------*/
/* ARGSUSED */
herr_t
-H5T_vlen_reclaim(void *elem, hid_t type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void *op_data)
+H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned UNUSED ndim, const hsize_t UNUSED *point, void *op_data)
{
H5T_vlen_alloc_info_t *vl_alloc_info = (H5T_vlen_alloc_info_t *)op_data; /* VL allocation info from iterator */
H5T_t *dt;
diff --git a/src/H5V.c b/src/H5V.c
index ccdfffc..b2720f5 100644
--- a/src/H5V.c
+++ b/src/H5V.c
@@ -32,15 +32,15 @@
/* Local prototypes */
static void
H5V_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
- const hsize_t *size, hssize_t *stride1);
+ const hsize_t *size, hsize_t *stride1);
static void
H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
- const hsize_t *size, hssize_t *stride1, hssize_t *stride2);
+ const hsize_t *size, hsize_t *stride1, hsize_t *stride2);
#ifdef LATER
static void
H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
- unsigned dst_n, const hsize_t *dst_size, const hssize_t *dst_stride, void *_dst,
- unsigned src_n, const hsize_t *src_size, const hssize_t *src_stride, const void *_src);
+ unsigned dst_n, const hsize_t *dst_size, const ssize_t *dst_stride, void *_dst,
+ unsigned src_n, const hsize_t *src_size, const ssize_t *src_stride, const void *_src);
#endif /* LATER */
@@ -66,7 +66,7 @@ H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
*/
static void
H5V_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
- const hsize_t *size, hssize_t *stride1)
+ const hsize_t *size, hsize_t *stride1)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_stride_optimize1);
@@ -82,10 +82,8 @@ H5V_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
while (*np && stride1[*np-1]>0 &&
(hsize_t)(stride1[*np-1])==*elmt_size) {
*elmt_size *= size[*np-1];
- if (--*np) {
- H5_CHECK_OVERFLOW(size[*np],hsize_t,hssize_t);
- stride1[*np-1] += (hssize_t)size[*np] * stride1[*np];
- }
+ if (--*np)
+ stride1[*np-1] += size[*np] * stride1[*np];
}
FUNC_LEAVE_NOAPI_VOID
@@ -117,7 +115,7 @@ H5V_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
*/
static void
H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
- const hsize_t *size, hssize_t *stride1, hssize_t *stride2)
+ const hsize_t *size, hsize_t *stride1, hsize_t *stride2)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_stride_optimize2)
@@ -135,24 +133,20 @@ H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
/* Unroll loop for common cases */
switch(*np) {
case 1: /* For 0-D datasets (dunno if this ever gets used...) */
- if((hsize_t)(stride1[0]) == *elmt_size &&
- (hsize_t)(stride2[0]) == *elmt_size) {
+ if(stride1[0] == *elmt_size && stride2[0] == *elmt_size) {
*elmt_size *= size[0];
--*np; /* *np decrements to a value of 0 now */
} /* end if */
break;
case 2: /* For 1-D datasets */
- if((hsize_t)(stride1[1]) == *elmt_size &&
- (hsize_t)(stride2[1]) == *elmt_size) {
+ if(stride1[1] == *elmt_size && stride2[1] == *elmt_size) {
*elmt_size *= size[1];
--*np; /* *np decrements to a value of 1 now */
- H5_CHECK_OVERFLOW(size[1],hsize_t,hssize_t);
- stride1[0] += (hssize_t)size[1] * stride1[1];
- stride2[0] += (hssize_t)size[1] * stride2[1];
+ stride1[0] += size[1] * stride1[1];
+ stride2[0] += size[1] * stride2[1];
- if((hsize_t)(stride1[0]) == *elmt_size &&
- (hsize_t)(stride2[0]) == *elmt_size) {
+ if(stride1[0] == *elmt_size && stride2[0] == *elmt_size) {
*elmt_size *= size[0];
--*np; /* *np decrements to a value of 0 now */
} /* end if */
@@ -160,24 +154,19 @@ H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
break;
case 3: /* For 2-D datasets */
- if((hsize_t)(stride1[2]) == *elmt_size &&
- (hsize_t)(stride2[2]) == *elmt_size) {
+ if(stride1[2] == *elmt_size && stride2[2] == *elmt_size) {
*elmt_size *= size[2];
--*np; /* *np decrements to a value of 2 now */
- H5_CHECK_OVERFLOW(size[2],hsize_t,hssize_t);
- stride1[1] += (hssize_t)size[2] * stride1[2];
- stride2[1] += (hssize_t)size[2] * stride2[2];
+ stride1[1] += size[2] * stride1[2];
+ stride2[1] += size[2] * stride2[2];
- if((hsize_t)(stride1[1]) == *elmt_size &&
- (hsize_t)(stride2[1]) == *elmt_size) {
+ if(stride1[1] == *elmt_size && stride2[1] == *elmt_size) {
*elmt_size *= size[1];
--*np; /* *np decrements to a value of 1 now */
- H5_CHECK_OVERFLOW(size[1],hsize_t,hssize_t);
- stride1[0] += (hssize_t)size[1] * stride1[1];
- stride2[0] += (hssize_t)size[1] * stride2[1];
+ stride1[0] += size[1] * stride1[1];
+ stride2[0] += size[1] * stride2[1];
- if((hsize_t)(stride1[0]) == *elmt_size &&
- (hsize_t)(stride2[0]) == *elmt_size) {
+ if(stride1[0] == *elmt_size && stride2[0] == *elmt_size) {
*elmt_size *= size[0];
--*np; /* *np decrements to a value of 0 now */
} /* end if */
@@ -186,32 +175,25 @@ H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
break;
case 4: /* For 3-D datasets */
- if((hsize_t)(stride1[3]) == *elmt_size &&
- (hsize_t)(stride2[3]) == *elmt_size) {
+ if(stride1[3] == *elmt_size && stride2[3] == *elmt_size) {
*elmt_size *= size[3];
--*np; /* *np decrements to a value of 3 now */
- H5_CHECK_OVERFLOW(size[3],hsize_t,hssize_t);
- stride1[2] += (hssize_t)size[3] * stride1[3];
- stride2[2] += (hssize_t)size[3] * stride2[3];
+ stride1[2] += size[3] * stride1[3];
+ stride2[2] += size[3] * stride2[3];
- if((hsize_t)(stride1[2]) == *elmt_size &&
- (hsize_t)(stride2[2]) == *elmt_size) {
+ if(stride1[2] == *elmt_size && stride2[2] == *elmt_size) {
*elmt_size *= size[2];
--*np; /* *np decrements to a value of 2 now */
- H5_CHECK_OVERFLOW(size[2],hsize_t,hssize_t);
- stride1[1] += (hssize_t)size[2] * stride1[2];
- stride2[1] += (hssize_t)size[2] * stride2[2];
+ stride1[1] += size[2] * stride1[2];
+ stride2[1] += size[2] * stride2[2];
- if((hsize_t)(stride1[1]) == *elmt_size &&
- (hsize_t)(stride2[1]) == *elmt_size) {
+ if(stride1[1] == *elmt_size && stride2[1] == *elmt_size) {
*elmt_size *= size[1];
--*np; /* *np decrements to a value of 1 now */
- H5_CHECK_OVERFLOW(size[1],hsize_t,hssize_t);
- stride1[0] += (hssize_t)size[1] * stride1[1];
- stride2[0] += (hssize_t)size[1] * stride2[1];
+ stride1[0] += size[1] * stride1[1];
+ stride2[0] += size[1] * stride2[1];
- if((hsize_t)(stride1[0]) == *elmt_size &&
- (hsize_t)(stride2[0]) == *elmt_size) {
+ if(stride1[0] == *elmt_size && stride2[0] == *elmt_size) {
*elmt_size *= size[0];
--*np; /* *np decrements to a value of 0 now */
} /* end if */
@@ -222,13 +204,12 @@ H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
default:
while (*np &&
- (hsize_t)(stride1[*np-1]) == *elmt_size &&
- (hsize_t)(stride2[*np-1]) == *elmt_size) {
+ stride1[*np-1] == *elmt_size &&
+ stride2[*np-1] == *elmt_size) {
*elmt_size *= size[*np-1];
if (--*np) {
- H5_CHECK_OVERFLOW(size[*np],hsize_t,hssize_t);
- stride1[*np-1] += (hssize_t)size[*np] * stride1[*np];
- stride2[*np-1] += (hssize_t)size[*np] * stride2[*np];
+ stride1[*np-1] += size[*np] * stride1[*np];
+ stride2[*np-1] += size[*np] * stride2[*np];
}
}
break;
@@ -272,12 +253,11 @@ H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
*/
hsize_t
H5V_hyper_stride(unsigned n, const hsize_t *size,
- const hsize_t *total_size, const hssize_t *offset,
- hssize_t *stride/*out*/)
+ const hsize_t *total_size, const hsize_t *offset,
+ hsize_t *stride/*out*/)
{
hsize_t skip; /*starting point byte offset */
hsize_t acc; /*accumulator */
- hsize_t tmp;
int i; /*counter */
hsize_t ret_value; /* Return value */
@@ -291,47 +271,41 @@ H5V_hyper_stride(unsigned n, const hsize_t *size,
/* init */
assert(n>0);
stride[n-1] = 1;
- skip = offset ? (hsize_t)offset[n-1] : 0;
+ skip = offset ? offset[n-1] : 0;
switch(n) {
case 2: /* 1-D dataset */
- tmp = total_size[1] - size[1];
- assert (tmp<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- stride[0] = (hssize_t)tmp; /*overflow checked*/
+ assert (total_size[1]>=size[1]);
+ stride[0] = total_size[1]-size[1]; /*overflow checked*/
acc = total_size[1];
- skip += acc * (offset ? (hsize_t)offset[0] : 0);
+ skip += acc * (offset ? offset[0] : 0);
break;
case 3: /* 2-D dataset */
- tmp = total_size[2] - size[2];
- assert (tmp<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- stride[1] = (hssize_t)tmp; /*overflow checked*/
+ assert (total_size[2]>=size[2]);
+ stride[1] = total_size[2]-size[2]; /*overflow checked*/
acc = total_size[2];
skip += acc * (offset ? (hsize_t)offset[1] : 0);
- tmp = acc * (total_size[1] - size[1]);
- assert (tmp<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- stride[0] = (hssize_t)tmp; /*overflow checked*/
+ assert (total_size[1]>=size[1]);
+ stride[0] = acc * (total_size[1] - size[1]); /*overflow checked*/
acc *= total_size[1];
skip += acc * (offset ? (hsize_t)offset[0] : 0);
break;
case 4: /* 3-D dataset */
- tmp = total_size[3] - size[3];
- assert (tmp<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- stride[2] = (hssize_t)tmp; /*overflow checked*/
+ assert (total_size[3]>=size[3]);
+ stride[2] = total_size[3]-size[3]; /*overflow checked*/
acc = total_size[3];
skip += acc * (offset ? (hsize_t)offset[2] : 0);
- tmp = acc * (total_size[2] - size[2]);
- assert (tmp<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- stride[1] = (hssize_t)tmp; /*overflow checked*/
+ assert (total_size[2]>=size[2]);
+ stride[1] = acc * (total_size[2] - size[2]); /*overflow checked*/
acc *= total_size[2];
skip += acc * (offset ? (hsize_t)offset[1] : 0);
- tmp = acc * (total_size[1] - size[1]);
- assert (tmp<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- stride[0] = (hssize_t)tmp; /*overflow checked*/
+ assert (total_size[1]>=size[1]);
+ stride[0] = acc * (total_size[1] - size[1]); /*overflow checked*/
acc *= total_size[1];
skip += acc * (offset ? (hsize_t)offset[0] : 0);
break;
@@ -339,9 +313,8 @@ H5V_hyper_stride(unsigned n, const hsize_t *size,
default:
/* others */
for (i=(int)(n-2), acc=1; i>=0; --i) {
- tmp = acc * (total_size[i+1] - size[i+1]);
- assert (tmp<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- stride[i] = (hssize_t)tmp; /*overflow checked*/
+ assert (total_size[i+1]>=size[i+1]);
+ stride[i] = acc * (total_size[i+1] - size[i+1]); /*overflow checked*/
acc *= total_size[i+1];
skip += acc * (offset ? (hsize_t)offset[i] : 0);
}
@@ -379,18 +352,18 @@ H5V_hyper_stride(unsigned n, const hsize_t *size,
*-------------------------------------------------------------------------
*/
htri_t
-H5V_hyper_eq(int n,
- const hssize_t *offset1, const hsize_t *size1,
- const hssize_t *offset2, const hsize_t *size2)
+H5V_hyper_eq(unsigned n,
+ const hsize_t *offset1, const hsize_t *size1,
+ const hsize_t *offset2, const hsize_t *size2)
{
hsize_t nelmts1 = 1, nelmts2 = 1;
- int i;
+ unsigned i;
htri_t ret_value=TRUE; /* Return value */
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_hyper_eq)
- if (n <= 0) HGOTO_DONE(TRUE)
+ if (n == 0) HGOTO_DONE(TRUE)
for (i=0; i<n; i++) {
if ((offset1 ? offset1[i] : 0) != (offset2 ? offset2[i] : 0))
@@ -428,8 +401,8 @@ done:
*/
htri_t
H5V_hyper_disjointp(unsigned n,
- const hssize_t *offset1, const size_t *size1,
- const hssize_t *offset2, const size_t *size2)
+ const hsize_t *offset1, const size_t *size1,
+ const hsize_t *offset2, const size_t *size2)
{
unsigned u;
htri_t ret_value=FALSE; /* Return value */
@@ -440,17 +413,15 @@ H5V_hyper_disjointp(unsigned n,
if (!n || !size1 || !size2) HGOTO_DONE(TRUE)
for (u=0; u<n; u++) {
- assert (size1[u]<HSSIZET_MAX);
- assert (size2[u]<HSSIZET_MAX);
+ assert (size1[u]<HSIZET_MAX);
+ assert (size2[u]<HSIZET_MAX);
if (0==size1[u] || 0==size2[u])
HGOTO_DONE(TRUE)
if (((offset1?offset1[u]:0) < (offset2?offset2[u]:0) &&
- ((offset1?offset1[u]:0) + (hssize_t)size1[u] <=
- (offset2?offset2[u]:0))) ||
+ ((offset1?offset1[u]:0) + size1[u] <= (offset2?offset2[u]:0))) ||
((offset2?offset2[u]:0) < (offset1?offset1[u]:0) &&
- ((offset2?offset2[u]:0) + (hssize_t)size2[u] <=
- (offset1?offset1[u]:0))))
+ ((offset2?offset2[u]:0) + size2[u] <= (offset1?offset1[u]:0))))
HGOTO_DONE(TRUE)
}
@@ -482,12 +453,12 @@ done:
*/
herr_t
H5V_hyper_fill(unsigned n, const hsize_t *_size,
- const hsize_t *total_size, const hssize_t *offset, void *_dst,
+ const hsize_t *total_size, const hsize_t *offset, void *_dst,
unsigned fill_value)
{
uint8_t *dst = (uint8_t*)_dst; /*cast for ptr arithmetic */
hsize_t size[H5V_HYPER_NDIMS]; /*a modifiable copy of _size */
- hssize_t dst_stride[H5V_HYPER_NDIMS]; /*destination stride info */
+ hsize_t dst_stride[H5V_HYPER_NDIMS]; /*destination stride info */
hsize_t dst_start; /*byte offset to start of stride*/
hsize_t elmt_size = 1; /*bytes per element */
herr_t ret_value; /*function return status */
@@ -562,22 +533,20 @@ herr_t
H5V_hyper_copy(unsigned n, const hsize_t *_size,
/*destination*/
- const hsize_t *dst_size, const hssize_t *dst_offset,
+ const hsize_t *dst_size, const hsize_t *dst_offset,
void *_dst,
/*source*/
- const hsize_t *src_size, const hssize_t *src_offset,
+ const hsize_t *src_size, const hsize_t *src_offset,
const void *_src)
{
const uint8_t *src = (const uint8_t*)_src; /*cast for ptr arithmtc */
uint8_t *dst = (uint8_t*) _dst; /*cast for ptr arithmtc */
hsize_t size[H5V_HYPER_NDIMS]; /*a modifiable _size */
- hssize_t src_stride[H5V_HYPER_NDIMS]; /*source stride info */
- hssize_t dst_stride[H5V_HYPER_NDIMS]; /*dest stride info */
+ hsize_t src_stride[H5V_HYPER_NDIMS]; /*source stride info */
+ hsize_t dst_stride[H5V_HYPER_NDIMS]; /*dest stride info */
hsize_t dst_start, src_start; /*offset to start at */
hsize_t elmt_size = 1; /*element size in bytes */
- hsize_t tmp1;
- hsize_t tmp2;
herr_t ret_value; /*return status */
#ifndef NDEBUG
unsigned u;
@@ -618,96 +587,82 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
assert(n>0);
dst_stride[n-1] = 1;
src_stride[n-1] = 1;
- dst_start = dst_offset ? (hsize_t)dst_offset[n-1] : 0;
- src_start = src_offset ? (hsize_t)src_offset[n-1] : 0;
+ dst_start = dst_offset ? dst_offset[n-1] : 0;
+ src_start = src_offset ? src_offset[n-1] : 0;
/* Unroll loop for common cases */
switch(n) {
case 2:
- tmp1 = (dst_size[1] - size[1]);
- tmp2 = (src_size[1] - size[1]);
- assert (tmp1<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- assert (tmp2<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- dst_stride[0] = (hssize_t)tmp1; /*overflow checked*/
- src_stride[0] = (hssize_t)tmp2; /*overflow checked*/
+ assert (dst_size[1]>=size[1]);
+ assert (src_size[1]>=size[1]);
+ dst_stride[0] = dst_size[1] - size[1]; /*overflow checked*/
+ src_stride[0] = src_size[1] - size[1]; /*overflow checked*/
dst_acc = dst_size[1];
src_acc = src_size[1];
- dst_start += dst_acc * (dst_offset ? (hsize_t)dst_offset[0] : 0);
- src_start += src_acc * (src_offset ? (hsize_t)src_offset[0] : 0);
+ dst_start += dst_acc * (dst_offset ? dst_offset[0] : 0);
+ src_start += src_acc * (src_offset ? src_offset[0] : 0);
break;
case 3:
- tmp1 = (dst_size[2] - size[2]);
- tmp2 = (src_size[2] - size[2]);
- assert (tmp1<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- assert (tmp2<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- dst_stride[1] = (hssize_t)tmp1; /*overflow checked*/
- src_stride[1] = (hssize_t)tmp2; /*overflow checked*/
+ assert (dst_size[2]>=size[2]);
+ assert (src_size[2]>=size[2]);
+ dst_stride[1] = dst_size[2] - size[2]; /*overflow checked*/
+ src_stride[1] = src_size[2] - size[2]; /*overflow checked*/
dst_acc = dst_size[2];
src_acc = src_size[2];
- dst_start += dst_acc * (dst_offset ? (hsize_t)dst_offset[1] : 0);
- src_start += src_acc * (src_offset ? (hsize_t)src_offset[1] : 0);
-
- tmp1 = dst_acc * (dst_size[1] - size[1]);
- tmp2 = src_acc * (src_size[1] - size[1]);
- assert (tmp1<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- assert (tmp2<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- dst_stride[0] = (hssize_t)tmp1; /*overflow checked*/
- src_stride[0] = (hssize_t)tmp2; /*overflow checked*/
+ dst_start += dst_acc * (dst_offset ? dst_offset[1] : 0);
+ src_start += src_acc * (src_offset ? src_offset[1] : 0);
+
+ assert (dst_size[1]>=size[1]);
+ assert (src_size[1]>=size[1]);
+ dst_stride[0] = dst_acc * (dst_size[1] - size[1]); /*overflow checked*/
+ src_stride[0] = src_acc * (src_size[1] - size[1]); /*overflow checked*/
dst_acc *= dst_size[1];
src_acc *= src_size[1];
- dst_start += dst_acc * (dst_offset ? (hsize_t)dst_offset[0] : 0);
- src_start += src_acc * (src_offset ? (hsize_t)src_offset[0] : 0);
+ dst_start += dst_acc * (dst_offset ? dst_offset[0] : 0);
+ src_start += src_acc * (src_offset ? src_offset[0] : 0);
break;
case 4:
- tmp1 = (dst_size[3] - size[3]);
- tmp2 = (src_size[3] - size[3]);
- assert (tmp1<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- assert (tmp2<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- dst_stride[2] = (hssize_t)tmp1; /*overflow checked*/
- src_stride[2] = (hssize_t)tmp2; /*overflow checked*/
+ assert (dst_size[3]>=size[3]);
+ assert (src_size[3]>=size[3]);
+ dst_stride[2] = dst_size[3] - size[3]; /*overflow checked*/
+ src_stride[2] = src_size[3] - size[3]; /*overflow checked*/
dst_acc = dst_size[3];
src_acc = src_size[3];
- dst_start += dst_acc * (dst_offset ? (hsize_t)dst_offset[2] : 0);
- src_start += src_acc * (src_offset ? (hsize_t)src_offset[2] : 0);
-
- tmp1 = dst_acc * (dst_size[2] - size[2]);
- tmp2 = src_acc * (src_size[2] - size[2]);
- assert (tmp1<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- assert (tmp2<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- dst_stride[1] = (hssize_t)tmp1; /*overflow checked*/
- src_stride[1] = (hssize_t)tmp2; /*overflow checked*/
+ dst_start += dst_acc * (dst_offset ? dst_offset[2] : 0);
+ src_start += src_acc * (src_offset ? src_offset[2] : 0);
+
+ assert (dst_size[2]>=size[2]);
+ assert (src_size[2]>=size[2]);
+ dst_stride[1] = dst_acc * (dst_size[2] - size[2]); /*overflow checked*/
+ src_stride[1] = src_acc * (src_size[2] - size[2]); /*overflow checked*/
dst_acc *= dst_size[2];
src_acc *= src_size[2];
- dst_start += dst_acc * (dst_offset ? (hsize_t)dst_offset[1] : 0);
- src_start += src_acc * (src_offset ? (hsize_t)src_offset[1] : 0);
-
- tmp1 = dst_acc * (dst_size[1] - size[1]);
- tmp2 = src_acc * (src_size[1] - size[1]);
- assert (tmp1<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- assert (tmp2<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- dst_stride[0] = (hssize_t)tmp1; /*overflow checked*/
- src_stride[0] = (hssize_t)tmp2; /*overflow checked*/
+ dst_start += dst_acc * (dst_offset ? dst_offset[1] : 0);
+ src_start += src_acc * (src_offset ? src_offset[1] : 0);
+
+ assert (dst_size[1]>=size[1]);
+ assert (src_size[1]>=size[1]);
+ dst_stride[0] = dst_acc * (dst_size[1] - size[1]); /*overflow checked*/
+ src_stride[0] = src_acc * (src_size[1] - size[1]); /*overflow checked*/
dst_acc *= dst_size[1];
src_acc *= src_size[1];
- dst_start += dst_acc * (dst_offset ? (hsize_t)dst_offset[0] : 0);
- src_start += src_acc * (src_offset ? (hsize_t)src_offset[0] : 0);
+ dst_start += dst_acc * (dst_offset ? dst_offset[0] : 0);
+ src_start += src_acc * (src_offset ? src_offset[0] : 0);
break;
default:
/* others */
for (ii=(int)(n-2), dst_acc=1, src_acc=1; ii>=0; --ii) {
- tmp1 = dst_acc * (dst_size[ii+1] - size[ii+1]);
- tmp2 = src_acc * (src_size[ii+1] - size[ii+1]);
- assert (tmp1<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- assert (tmp2<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
- dst_stride[ii] = (hssize_t)tmp1; /*overflow checked*/
- src_stride[ii] = (hssize_t)tmp2; /*overflow checked*/
+ assert (dst_size[ii+1]>=size[ii+1]);
+ assert (src_size[ii+1]>=size[ii+1]);
+ dst_stride[ii] = dst_acc * (dst_size[ii+1] - size[ii+1]); /*overflow checked*/
+ src_stride[ii] = src_acc * (src_size[ii+1] - size[ii+1]); /*overflow checked*/
dst_acc *= dst_size[ii+1];
src_acc *= src_size[ii+1];
- dst_start += dst_acc * (dst_offset ? (hsize_t)dst_offset[ii] : 0);
- src_start += src_acc * (src_offset ? (hsize_t)src_offset[ii] : 0);
+ dst_start += dst_acc * (dst_offset ? dst_offset[ii] : 0);
+ src_start += src_acc * (src_offset ? src_offset[ii] : 0);
}
break;
} /* end switch */
@@ -742,7 +697,7 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
*/
herr_t
H5V_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size,
- const hssize_t *stride, void *_dst, unsigned fill_value)
+ const hsize_t *stride, void *_dst, unsigned fill_value)
{
uint8_t *dst = (uint8_t*)_dst; /*cast for ptr arithmetic */
hsize_t idx[H5V_HYPER_NDIMS]; /*1-origin indices */
@@ -801,6 +756,74 @@ H5V_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size,
*/
herr_t
H5V_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size,
+ const hsize_t *dst_stride, void *_dst,
+ const hsize_t *src_stride, const void *_src)
+{
+ uint8_t *dst = (uint8_t*)_dst; /*cast for ptr arithmetic*/
+ const uint8_t *src = (const uint8_t*) _src; /*cast for ptr arithmetic*/
+ hsize_t idx[H5V_HYPER_NDIMS]; /*1-origin indices */
+ hsize_t nelmts; /*num elements to copy */
+ hsize_t i; /*counter */
+ int j; /*counters */
+ hbool_t carry; /*carray for subtraction*/
+
+ FUNC_ENTER_NOAPI_NOFUNC(H5V_stride_copy)
+ assert (elmt_size<SIZET_MAX);
+
+ if (n) {
+ H5V_vector_cpy(n, idx, size);
+ nelmts = H5V_vector_reduce_product(n, size);
+ for (i=0; i<nelmts; i++) {
+
+ /* Copy an element */
+ H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
+ HDmemcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+
+ /* Decrement indices and advance pointers */
+ for (j=(int)(n-1), carry=TRUE; j>=0 && carry; --j) {
+ src += src_stride[j];
+ dst += dst_stride[j];
+
+ if (--idx[j])
+ carry = FALSE;
+ else {
+ assert(size);
+ idx[j] = size[j];
+ }
+ }
+ }
+ } else {
+ H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
+ HDmemcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+ }
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5V_stride_copy_s
+ *
+ * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays
+ * DST and SRC while copying bytes from SRC to DST. This
+ * function minimizes the number of calls to memcpy() by
+ * combining various strides, but it will never touch memory
+ * outside the hyperslab defined by the strides.
+ *
+ * Note: If the src_stride is all zero and elmt_size is one, then it's
+ * probably more efficient to use H5V_stride_fill() instead.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5V_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size,
const hssize_t *dst_stride, void *_dst,
const hssize_t *src_stride, const void *_src)
{
@@ -812,7 +835,7 @@ H5V_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size,
int j; /*counters */
hbool_t carry; /*carray for subtraction*/
- FUNC_ENTER_NOAPI_NOFUNC(H5V_stride_copy)
+ FUNC_ENTER_NOAPI_NOFUNC(H5V_stride_copy_s)
assert (elmt_size<SIZET_MAX);
if (n) {
@@ -869,12 +892,12 @@ H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
/* destination */
unsigned dst_n, const hsize_t *dst_size,
- const hssize_t *dst_stride,
+ const hsize_t *dst_stride,
void *_dst,
/* source */
unsigned src_n, const hsize_t *src_size,
- const hssize_t *src_stride,
+ const hsize_t *src_stride,
const void *_src)
{
uint8_t *dst = (uint8_t *) _dst;
@@ -1046,9 +1069,8 @@ H5V_array_down(unsigned n, const hsize_t *total_size, hsize_t *down)
*-------------------------------------------------------------------------
*/
hsize_t
-H5V_array_offset_pre(unsigned n, const hsize_t *acc, const hssize_t *offset)
+H5V_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset)
{
- hsize_t skip; /*starting point byte offset */
int i; /*counter */
hsize_t ret_value; /* Return value */
@@ -1059,13 +1081,8 @@ H5V_array_offset_pre(unsigned n, const hsize_t *acc, const hssize_t *offset)
assert(offset);
/* Compute offset in array */
- for (i=(int)(n-1), skip=0; i>=0; --i) {
- H5_CHECK_OVERFLOW(offset[i],hssize_t,hsize_t);
- skip += acc[i] * (hsize_t)offset[i];
- } /* end for */
-
- /* Set return value */
- ret_value=skip;
+ for (i=(int)(n-1), ret_value=0; i>=0; --i)
+ ret_value += acc[i] * offset[i];
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5V_array_offset_pre() */
@@ -1092,7 +1109,7 @@ H5V_array_offset_pre(unsigned n, const hsize_t *acc, const hssize_t *offset)
*-------------------------------------------------------------------------
*/
hsize_t
-H5V_array_offset(unsigned n, const hsize_t *total_size, const hssize_t *offset)
+H5V_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset)
{
hsize_t acc_arr[H5V_HYPER_NDIMS]; /* Accumulated size of down dimensions */
hsize_t ret_value; /* Return value */
@@ -1136,7 +1153,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5V_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hssize_t *coords)
+H5V_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hsize_t *coords)
{
hsize_t idx[H5V_HYPER_NDIMS]; /* Size of each dimension in bytes */
hsize_t acc; /* Size accumulator */
@@ -1159,8 +1176,7 @@ H5V_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hssize_t *
/* Compute the coordinates from the offset */
for(u=0; u<n; u++) {
- H5_CHECK_OVERFLOW(offset/idx[u],hsize_t,hssize_t); /*lint !e771 idx will always be initialized */
- coords[u]=(hssize_t)(offset/idx[u]);
+ coords[u]=offset/idx[u];
offset %= idx[u];
} /* end for */
@@ -1211,10 +1227,10 @@ H5V_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hssize_t *
*-------------------------------------------------------------------------
*/
herr_t
-H5V_chunk_index(unsigned ndims, const hssize_t *coord, const size_t *chunk,
+H5V_chunk_index(unsigned ndims, const hsize_t *coord, const size_t *chunk,
const hsize_t *down_nchunks, hsize_t *chunk_idx)
{
- hssize_t scaled_coord[H5V_HYPER_NDIMS]; /* Scaled, coordinates, in terms of chunks */
+ hsize_t scaled_coord[H5V_HYPER_NDIMS]; /* Scaled, coordinates, in terms of chunks */
unsigned u; /* Local index variable */
FUNC_ENTER_NOAPI_NOFUNC(H5V_chunk_index)
@@ -1226,10 +1242,8 @@ H5V_chunk_index(unsigned ndims, const hssize_t *coord, const size_t *chunk,
assert(chunk_idx);
/* Compute the scaled coordinates for actual coordinates */
- for(u=0; u<ndims; u++) {
- H5_CHECK_OVERFLOW(chunk[u],size_t,hssize_t);
- scaled_coord[u]=coord[u]/(hssize_t)chunk[u];
- } /* end for */
+ for(u=0; u<ndims; u++)
+ scaled_coord[u]=coord[u]/chunk[u];
/* Compute the chunk index */
*chunk_idx=H5V_array_offset_pre(ndims,down_nchunks,scaled_coord); /*lint !e772 scaled_coord will always be initialized */
@@ -1268,9 +1282,10 @@ H5V_memcpyvv(void *_dst,
{
unsigned char *dst; /* Destination buffer pointer */
const unsigned char *src; /* Source buffer pointer */
+ size_t total_size=0; /* Total size of sequence in bytes */
size_t size; /* Size of sequence in bytes */
size_t u,v; /* Local index variables */
- ssize_t ret_value=0; /* Return value */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOFUNC(H5V_memcpyvv)
@@ -1316,13 +1331,16 @@ H5V_memcpyvv(void *_dst,
u++;
/* Increment number of bytes copied */
- ret_value+=(ssize_t)size;
+ total_size+=size;
} /* end for */
/* Update current sequence vectors */
*dst_curr_seq=u;
*src_curr_seq=v;
+ /* Set return value */
+ H5_ASSIGN_OVERFLOW(ret_value,total_size,size_t,ssize_t);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5V_memcpyvv() */
diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h
index 24cfc19..52f9d6b 100644
--- a/src/H5Vprivate.h
+++ b/src/H5Vprivate.h
@@ -47,28 +47,31 @@
H5_DLL hsize_t H5V_hyper_stride(unsigned n, const hsize_t *size,
const hsize_t *total_size,
- const hssize_t *offset,
- hssize_t *stride);
-H5_DLL htri_t H5V_hyper_disjointp(unsigned n, const hssize_t *offset1,
+ const hsize_t *offset,
+ hsize_t *stride);
+H5_DLL htri_t H5V_hyper_disjointp(unsigned n, const hsize_t *offset1,
const size_t *size1,
- const hssize_t *offset2,
+ const hsize_t *offset2,
const size_t *size2);
-H5_DLL htri_t H5V_hyper_eq(int n, const hssize_t *offset1,
- const hsize_t *size1, const hssize_t *offset2,
+H5_DLL htri_t H5V_hyper_eq(unsigned n, const hsize_t *offset1,
+ const hsize_t *size1, const hsize_t *offset2,
const hsize_t *size2);
H5_DLL herr_t H5V_hyper_fill(unsigned n, const hsize_t *_size,
const hsize_t *total_size,
- const hssize_t *offset, void *_dst,
+ const hsize_t *offset, void *_dst,
unsigned fill_value);
H5_DLL herr_t H5V_hyper_copy(unsigned n, const hsize_t *size,
const hsize_t *dst_total_size,
- const hssize_t *dst_offset, void *_dst,
+ const hsize_t *dst_offset, void *_dst,
const hsize_t *src_total_size,
- const hssize_t *src_offset, const void *_src);
+ const hsize_t *src_offset, const void *_src);
H5_DLL herr_t H5V_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size,
- const hssize_t *stride, void *_dst,
+ const hsize_t *stride, void *_dst,
unsigned fill_value);
H5_DLL herr_t H5V_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *_size,
+ const hsize_t *dst_stride, void *_dst,
+ const hsize_t *src_stride, const void *_src);
+H5_DLL herr_t H5V_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *_size,
const hssize_t *dst_stride, void *_dst,
const hssize_t *src_stride, const void *_src);
H5_DLL herr_t H5V_array_fill(void *_dst, const void *src, size_t size,
@@ -76,12 +79,12 @@ H5_DLL herr_t H5V_array_fill(void *_dst, const void *src, size_t size,
H5_DLL herr_t H5V_array_down(unsigned n, const hsize_t *total_size,
hsize_t *down);
H5_DLL hsize_t H5V_array_offset_pre(unsigned n,
- const hsize_t *acc, const hssize_t *offset);
+ const hsize_t *acc, const hsize_t *offset);
H5_DLL hsize_t H5V_array_offset(unsigned n, const hsize_t *total_size,
- const hssize_t *offset);
+ const hsize_t *offset);
H5_DLL herr_t H5V_array_calc(hsize_t offset, unsigned n,
- const hsize_t *total_size, hssize_t *coords);
-H5_DLL herr_t H5V_chunk_index(unsigned ndims, const hssize_t *coord,
+ const hsize_t *total_size, hsize_t *coords);
+H5_DLL herr_t H5V_chunk_index(unsigned ndims, const hsize_t *coord,
const size_t *chunk, const hsize_t *down_nchunks, hsize_t *chunk_idx);
H5_DLL ssize_t H5V_memcpyvv(void *_dst,
size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], hsize_t dst_off_arr[],
@@ -213,7 +216,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5_inline int UNUSED
-H5V_vector_cmp_u (int n, const hsize_t *v1, const hsize_t *v2)
+H5V_vector_cmp_u (unsigned n, const hsize_t *v1, const hsize_t *v2)
{
int ret_value=0; /* Return value */
diff --git a/src/H5Z.c b/src/H5Z.c
index 4dddca8..675e7ce 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -1198,8 +1198,10 @@ herr_t H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags
fclass = H5Z_find(filter);
#ifdef H5_WANT_H5_V1_6_COMPAT
- if(fclass == NULL && filter_config_flags != NULL)
+ if(fclass == NULL && filter_config_flags != NULL) {
*filter_config_flags = 0;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
#else
if(fclass == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Filter not defined")
@@ -1218,3 +1220,4 @@ herr_t H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags
done:
FUNC_LEAVE_API(ret_value)
}
+
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index c1feb7a..8f1cfd0 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -118,12 +118,12 @@ static void H5Z_print(H5Z_node *tree, FILE *stream);
\
if((RESL).type == H5Z_XFORM_SYMBOL) \
{ \
- tree_val = ((RESR).type==H5Z_XFORM_INTEGER ? (RESR).value.int_val : (RESR).value.float_val); \
+ tree_val = ((RESR).type==H5Z_XFORM_INTEGER ? (double)(RESR).value.int_val : (RESR).value.float_val); \
p = (TYPE*)(RESL).value.dat_val; \
} \
else \
{ \
- tree_val = ((RESL).type==H5Z_XFORM_INTEGER ? (RESL).value.int_val : (RESL).value.float_val); \
+ tree_val = ((RESL).type==H5Z_XFORM_INTEGER ? (double)(RESL).value.int_val : (RESL).value.float_val); \
p = (TYPE*)(RESR).value.dat_val; \
} \
\
@@ -226,8 +226,8 @@ static void H5Z_print(H5Z_node *tree, FILE *stream);
( (tree->rchild->type == H5Z_XFORM_FLOAT) || (tree->rchild->type == H5Z_XFORM_INTEGER))) \
{ \
tree->type = H5Z_XFORM_FLOAT; \
- tree->value.float_val = ((tree->lchild->type == H5Z_XFORM_FLOAT) ? tree->lchild->value.float_val : tree->lchild->value.int_val) OP \
- ((tree->rchild->type == H5Z_XFORM_FLOAT) ? tree->rchild->value.float_val : tree->rchild->value.int_val); \
+ tree->value.float_val = ((tree->lchild->type == H5Z_XFORM_FLOAT) ? tree->lchild->value.float_val : (double)tree->lchild->value.int_val) OP \
+ ((tree->rchild->type == H5Z_XFORM_FLOAT) ? tree->rchild->value.float_val : (double)tree->rchild->value.int_val); \
H5MM_xfree(tree->lchild); \
H5MM_xfree(tree->rchild); \
tree->lchild = NULL; \
@@ -249,9 +249,9 @@ static void H5Z_print(H5Z_node *tree, FILE *stream);
#define H5Z_XFORM_DO_OP5(TYPE, SIZE) \
{ \
- TYPE val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val; \
+ TYPE val = ((tree->type == H5Z_XFORM_INTEGER) ? (TYPE)tree->value.int_val : (TYPE)tree->value.float_val); \
H5V_array_fill(array, &val, sizeof(TYPE), (SIZE)); \
-}
+}
@@ -532,7 +532,7 @@ static H5Z_node *
H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
{
H5Z_node *expr;
- void* ret_value=NULL;
+ void* ret_value;
FUNC_ENTER_NOAPI_NOINIT(H5Z_parse_expression)
@@ -540,65 +540,63 @@ H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
for (;;) {
H5Z_node *new_node;
- new_node = NULL;
current = H5Z_get_token(current);
switch (current->tok_type) {
- case H5Z_XFORM_PLUS:
- new_node = H5Z_new_node(H5Z_XFORM_PLUS);
+ case H5Z_XFORM_PLUS:
+ new_node = H5Z_new_node(H5Z_XFORM_PLUS);
- if (!new_node) {
- H5Z_xform_destroy_parse_tree(expr);
- expr = NULL;
- HGOTO_DONE(expr)
- }
+ if (!new_node) {
+ H5Z_xform_destroy_parse_tree(expr);
+ HGOTO_DONE(expr)
+ }
- new_node->lchild = expr;
- new_node->rchild = H5Z_parse_term(current, dat_val_pointers);
+ new_node->lchild = expr;
+ new_node->rchild = H5Z_parse_term(current, dat_val_pointers);
- if (!new_node->rchild) {
- H5Z_xform_destroy_parse_tree(new_node);
- expr = NULL;
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
- }
+ if (!new_node->rchild) {
+ H5Z_xform_destroy_parse_tree(new_node);
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
+ }
- expr = new_node;
- break;
- case H5Z_XFORM_MINUS:
- new_node = H5Z_new_node(H5Z_XFORM_MINUS);
+ expr = new_node;
+ break;
- if (!new_node) {
- H5Z_xform_destroy_parse_tree(expr);
- expr = NULL;
+ case H5Z_XFORM_MINUS:
+ new_node = H5Z_new_node(H5Z_XFORM_MINUS);
+
+ if (!new_node) {
+ H5Z_xform_destroy_parse_tree(expr);
+ HGOTO_DONE(expr)
+ }
+
+ new_node->lchild = expr;
+ new_node->rchild = H5Z_parse_term(current, dat_val_pointers);
+
+ if (!new_node->rchild) {
+ H5Z_xform_destroy_parse_tree(new_node);
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
+ }
+
+ expr = new_node;
+ break;
+
+ case H5Z_XFORM_RPAREN:
+ H5Z_unget_token(current);
HGOTO_DONE(expr)
- }
- new_node->lchild = expr;
- new_node->rchild = H5Z_parse_term(current, dat_val_pointers);
+ case H5Z_XFORM_END:
+ HGOTO_DONE(expr)
- if (!new_node->rchild) {
- H5Z_xform_destroy_parse_tree(new_node);
- expr = NULL;
+ default:
+ H5Z_xform_destroy_parse_tree(expr);
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
- }
-
- expr = new_node;
- break;
- case H5Z_XFORM_RPAREN:
- H5Z_unget_token(current);
- HGOTO_DONE(expr)
- case H5Z_XFORM_END:
- HGOTO_DONE(expr)
- default:
- H5Z_xform_destroy_parse_tree(expr);
- expr = NULL;
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
}
}
done:
- FUNC_LEAVE_NOAPI(expr)
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -621,72 +619,69 @@ static H5Z_node *
H5Z_parse_term(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
{
H5Z_node *term = NULL;
- void* ret_value=NULL;
+ void* ret_value;
FUNC_ENTER_NOAPI(H5Z_parse_term, NULL);
term = H5Z_parse_factor(current, dat_val_pointers);
for (;;) {
H5Z_node *new_node;
- new_node = NULL;
current = H5Z_get_token(current);
switch (current->tok_type) {
- case H5Z_XFORM_MULT:
- new_node = H5Z_new_node(H5Z_XFORM_MULT);
+ case H5Z_XFORM_MULT:
+ new_node = H5Z_new_node(H5Z_XFORM_MULT);
- if (!new_node) {
- H5Z_xform_destroy_parse_tree(term);
- term = NULL;
- HGOTO_DONE(term)
- }
+ if (!new_node) {
+ H5Z_xform_destroy_parse_tree(term);
+ HGOTO_DONE(term)
+ }
- new_node->lchild = term;
- new_node->rchild = H5Z_parse_factor(current, dat_val_pointers);
+ new_node->lchild = term;
+ new_node->rchild = H5Z_parse_factor(current, dat_val_pointers);
- if (!new_node->rchild) {
- H5Z_xform_destroy_parse_tree(term);
- term = NULL;
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
- }
+ if (!new_node->rchild) {
+ H5Z_xform_destroy_parse_tree(term);
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
+ }
- term = new_node;
- break;
- case H5Z_XFORM_DIVIDE:
- new_node = H5Z_new_node(H5Z_XFORM_DIVIDE);
+ term = new_node;
+ break;
- if (!new_node) {
- H5Z_xform_destroy_parse_tree(term);
- term = NULL;
- HGOTO_DONE(term)
- }
+ case H5Z_XFORM_DIVIDE:
+ new_node = H5Z_new_node(H5Z_XFORM_DIVIDE);
- new_node->lchild = term;
- new_node->rchild = H5Z_parse_factor(current, dat_val_pointers);
- term = new_node;
+ if (!new_node) {
+ H5Z_xform_destroy_parse_tree(term);
+ HGOTO_DONE(term)
+ }
- if (!new_node->rchild) {
- H5Z_xform_destroy_parse_tree(term);
- term = NULL;
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
- }
+ new_node->lchild = term;
+ new_node->rchild = H5Z_parse_factor(current, dat_val_pointers);
+ term = new_node;
- break;
- case H5Z_XFORM_RPAREN:
- H5Z_unget_token(current);
- HGOTO_DONE(term)
- case H5Z_XFORM_END:
- HGOTO_DONE(term)
- default:
- H5Z_unget_token(current);
- HGOTO_DONE(term)
+ if (!new_node->rchild) {
+ H5Z_xform_destroy_parse_tree(term);
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
+ }
+ break;
+
+ case H5Z_XFORM_RPAREN:
+ H5Z_unget_token(current);
+ HGOTO_DONE(term)
+
+ case H5Z_XFORM_END:
+ HGOTO_DONE(term)
+
+ default:
+ H5Z_unget_token(current);
+ HGOTO_DONE(term)
}
}
done:
- FUNC_LEAVE_NOAPI(term)
-
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -709,12 +704,12 @@ done:
*
*-------------------------------------------------------------------------
*/
- static H5Z_node *
+static H5Z_node *
H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
{
H5Z_node *factor=NULL;
- H5Z_node *new_node=NULL;
- void* ret_value=NULL;
+ H5Z_node *new_node;
+ void* ret_value;
FUNC_ENTER_NOAPI(H5Z_parse_factor, NULL);
@@ -726,118 +721,115 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
if (!factor)
HGOTO_DONE(factor)
-
- sscanf(current->tok_begin, "%ld", &factor->value.int_val);
+ sscanf(current->tok_begin, "%ld", &factor->value.int_val);
break;
+
case H5Z_XFORM_FLOAT:
factor = H5Z_new_node(H5Z_XFORM_FLOAT);
if (!factor)
HGOTO_DONE(factor)
-
- sscanf(current->tok_begin, "%lf", &factor->value.float_val);
+ sscanf(current->tok_begin, "%lf", &factor->value.float_val);
break;
+
case H5Z_XFORM_SYMBOL:
factor = H5Z_new_node(H5Z_XFORM_SYMBOL);
if (!factor)
HGOTO_DONE(factor)
- factor->value.dat_val = &(dat_val_pointers->ptr_dat_val[dat_val_pointers->num_ptrs]);
+ factor->value.dat_val = &(dat_val_pointers->ptr_dat_val[dat_val_pointers->num_ptrs]);
dat_val_pointers->num_ptrs++;
-
break;
+
case H5Z_XFORM_LPAREN:
factor = H5Z_parse_expression(current, dat_val_pointers);
if (!factor)
HGOTO_DONE(factor)
- current = H5Z_get_token(current);
+ current = H5Z_get_token(current);
if (current->tok_type != H5Z_XFORM_RPAREN) {
H5Z_xform_destroy_parse_tree(factor);
- factor = NULL;
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error in data transform expression")
}
-
break;
+
case H5Z_XFORM_RPAREN:
/* We shouldn't see a ) right now */
H5Z_xform_destroy_parse_tree(factor);
- factor = NULL;
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error: unexpected ')' ")
+
case H5Z_XFORM_PLUS:
- /* unary + */
- new_node = H5Z_parse_factor(current, dat_val_pointers);
-
- if (new_node) {
- if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT &&
- new_node->type != H5Z_XFORM_SYMBOL) {
- H5Z_xform_destroy_parse_tree(new_node);
- H5Z_xform_destroy_parse_tree(factor);
- factor=NULL;
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
- }
-
- factor = new_node;
- new_node = H5Z_new_node(H5Z_XFORM_PLUS);
-
- if (!new_node) {
- H5Z_xform_destroy_parse_tree(factor);
- factor = NULL;
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
- }
-
- new_node->rchild = factor;
- factor = new_node;
- } else {
- H5Z_xform_destroy_parse_tree(factor);
- factor = NULL;
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
- }
+ /* unary + */
+ new_node = H5Z_parse_factor(current, dat_val_pointers);
+
+ if (new_node) {
+ if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT &&
+ new_node->type != H5Z_XFORM_SYMBOL) {
+ H5Z_xform_destroy_parse_tree(new_node);
+ H5Z_xform_destroy_parse_tree(factor);
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
+ }
+
+ factor = new_node;
+ new_node = H5Z_new_node(H5Z_XFORM_PLUS);
+
+ if (!new_node) {
+ H5Z_xform_destroy_parse_tree(factor);
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
+ }
+
+ new_node->rchild = factor;
+ factor = new_node;
+ } else {
+ H5Z_xform_destroy_parse_tree(factor);
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
+ }
+ break;
- break;
case H5Z_XFORM_MINUS:
- /* unary - */
- new_node = H5Z_parse_factor(current, dat_val_pointers);
-
- if (new_node) {
- if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT &&
- new_node->type != H5Z_XFORM_SYMBOL) {
- H5Z_xform_destroy_parse_tree(new_node);
- H5Z_xform_destroy_parse_tree(factor);
- factor = NULL;
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
- }
-
- factor = new_node;
- new_node = H5Z_new_node(H5Z_XFORM_MINUS);
-
- if (!new_node) {
- H5Z_xform_destroy_parse_tree(factor);
- factor = NULL;
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
- }
-
- new_node->rchild = factor;
- factor = new_node;
- } else {
- H5Z_xform_destroy_parse_tree(factor);
- factor = NULL;
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
- }
+ /* unary - */
+ new_node = H5Z_parse_factor(current, dat_val_pointers);
+
+ if (new_node) {
+ if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT &&
+ new_node->type != H5Z_XFORM_SYMBOL) {
+ H5Z_xform_destroy_parse_tree(new_node);
+ H5Z_xform_destroy_parse_tree(factor);
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
+ }
+
+ factor = new_node;
+ new_node = H5Z_new_node(H5Z_XFORM_MINUS);
+
+ if (!new_node) {
+ H5Z_xform_destroy_parse_tree(factor);
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
+ }
+
+ new_node->rchild = factor;
+ factor = new_node;
+ } else {
+ H5Z_xform_destroy_parse_tree(factor);
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
+ }
+ break;
- break;
case H5Z_XFORM_END:
- HGOTO_DONE(factor)
+ break;
+
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Invalid token while parsing data transform expression")
}
+ /* Set return value */
+ ret_value=factor;
+
done:
- FUNC_LEAVE_NOAPI(factor);
+ FUNC_LEAVE_NOAPI(ret_value);
}
@@ -853,7 +845,7 @@ done:
*
*-------------------------------------------------------------------------
*/
- static H5Z_node *
+static H5Z_node *
H5Z_new_node(H5Z_token_type type)
{
H5Z_node* new_node;
@@ -882,7 +874,7 @@ H5Z_new_node(H5Z_token_type type)
*-------------------------------------------------------------------------
*/
- herr_t
+herr_t
H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size, const H5T_t *buf_type)
{
H5Z_node *tree;
@@ -1095,7 +1087,8 @@ done:
*
*-------------------------------------------------------------------------
*/
-static hid_t H5Z_xform_find_type(const H5T_t* type)
+static hid_t
+H5Z_xform_find_type(const H5T_t* type)
{
hid_t ret_value = SUCCEED;
@@ -1180,7 +1173,8 @@ done:
*
*-------------------------------------------------------------------------
*/
-void* H5Z_xform_copy_tree(H5Z_node* tree, H5Z_datval_ptrs* dat_val_pointers, H5Z_datval_ptrs* new_dat_val_pointers)
+void *
+H5Z_xform_copy_tree(H5Z_node* tree, H5Z_datval_ptrs* dat_val_pointers, H5Z_datval_ptrs* new_dat_val_pointers)
{
H5Z_node* ret_value=NULL;
@@ -1257,38 +1251,30 @@ void* H5Z_xform_copy_tree(H5Z_node* tree, H5Z_datval_ptrs* dat_val_pointers, H5Z
*
*-------------------------------------------------------------------------
*/
-void H5Z_xform_reduce_tree(H5Z_node* tree)
+void
+H5Z_xform_reduce_tree(H5Z_node* tree)
{
- hid_t ret_value = SUCCEED;
-
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5Z_xform_reduce_tree)
- if(!tree)
- HGOTO_DONE(SUCCEED)
-
- if((tree->type == H5Z_XFORM_PLUS) || (tree->type == H5Z_XFORM_DIVIDE) ||(tree->type == H5Z_XFORM_MULT) ||(tree->type == H5Z_XFORM_MINUS))
- {
- if(((tree->lchild->type == H5Z_XFORM_INTEGER) || (tree->lchild->type == H5Z_XFORM_FLOAT)) && ((tree->rchild->type == H5Z_XFORM_INTEGER) || (tree->rchild->type == H5Z_XFORM_FLOAT)))
- H5Z_do_op(tree);
- else
+ if(tree) {
+ if((tree->type == H5Z_XFORM_PLUS) || (tree->type == H5Z_XFORM_DIVIDE) ||(tree->type == H5Z_XFORM_MULT) ||(tree->type == H5Z_XFORM_MINUS))
{
- H5Z_xform_reduce_tree(tree->lchild);
- if(((tree->lchild->type == H5Z_XFORM_INTEGER) || (tree->lchild->type == H5Z_XFORM_FLOAT)) && ((tree->rchild->type == H5Z_XFORM_INTEGER) || (tree->rchild->type == H5Z_XFORM_FLOAT)))
- {
- H5Z_do_op(tree);
- HGOTO_DONE(SUCCEED)
- }
-
- H5Z_xform_reduce_tree(tree->rchild);
if(((tree->lchild->type == H5Z_XFORM_INTEGER) || (tree->lchild->type == H5Z_XFORM_FLOAT)) && ((tree->rchild->type == H5Z_XFORM_INTEGER) || (tree->rchild->type == H5Z_XFORM_FLOAT)))
- {
- H5Z_do_op(tree);
- HGOTO_DONE(SUCCEED)
- }
+ H5Z_do_op(tree);
+ else
+ {
+ H5Z_xform_reduce_tree(tree->lchild);
+ if(((tree->lchild->type == H5Z_XFORM_INTEGER) || (tree->lchild->type == H5Z_XFORM_FLOAT)) && ((tree->rchild->type == H5Z_XFORM_INTEGER) || (tree->rchild->type == H5Z_XFORM_FLOAT)))
+ H5Z_do_op(tree);
+ else {
+ H5Z_xform_reduce_tree(tree->rchild);
+ if(((tree->lchild->type == H5Z_XFORM_INTEGER) || (tree->lchild->type == H5Z_XFORM_FLOAT)) && ((tree->rchild->type == H5Z_XFORM_INTEGER) || (tree->rchild->type == H5Z_XFORM_FLOAT)))
+ H5Z_do_op(tree);
+ }
+ }
}
}
-done:
FUNC_LEAVE_NOAPI_VOID;
}
@@ -1307,7 +1293,8 @@ done:
*
*-------------------------------------------------------------------------
*/
-static void H5Z_do_op(H5Z_node* tree)
+static void
+H5Z_do_op(H5Z_node* tree)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5Z_do_op)
diff --git a/src/H5config.h.in b/src/H5config.h.in
index d884a20..4d95197 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -15,6 +15,9 @@
long long values. */
#undef FP_TO_ULLONG_RIGHT_MAXIMUM
+/* Define if gettimeofday() populates the tz pointer passed in */
+#undef GETTIMEOFDAY_GIVES_TZ
+
/* Define if the __attribute__(()) extension is present */
#undef HAVE_ATTRIBUTE
@@ -377,9 +380,6 @@
/* Define if `__tm_gmtoff' is a member of `struct tm' */
#undef HAVE___TM_GMTOFF
-/* Define if gettimeofday() populates the tz pointer passed in */
-#undef GETTIMEOFDAY_GIVES_TZ
-
/* Define if your system's `MPI_File_set_size' function works for files over
2GB. */
#undef MPI_FILE_SET_SIZE_BIG
diff --git a/src/H5private.h b/src/H5private.h
index 5421b6c..d144a95 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -289,7 +289,7 @@
# define FALSE 0
#endif
#ifndef TRUE
-# define TRUE (!FALSE)
+# define TRUE 1
#endif
/*
diff --git a/src/H5public.h b/src/H5public.h
index dd08099..d3b7589 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -12,9 +12,6 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* $Id$ */
-
-
/*
* This file contains public declarations for the HDF5 module.
*/
diff --git a/src/hdf5.lnt b/src/hdf5.lnt
index b3576ce..aa8f241 100755
--- a/src/hdf5.lnt
+++ b/src/hdf5.lnt
@@ -1,48 +1,21 @@
-// Define the __FUNCTION__ so we don't get warnings about using it.
--d__FUNCTION__="NoFunctionName"
-
-// Turn off warnings about not using the return value from these functions:
--esym(534, HDfprintf, HDsnprintf, HDvsnprintf)
--esym(534, H5E_clear_stack, H5E_push_stack)
--esym(534, H5FL_arr_free, H5FL_blk_free, H5FL_reg_free)
--esym(534, H5I_clear_group, H5I_destroy_group)
--esym(534, H5MM_xfree)
--esym(534, H5TB_dfree)
--esym(534, H5V_array_fill)
+// Lint options shared by both PC-Lint for Windows and Flexelint for Linux
// Turn off warnings about not using the inlined H5V* functions:
-esym(528, H5V_vector_reduce_product, H5V_vector_inc)
-esym(528, H5V_vector_cmp, H5V_vector_cmp_s, H5V_vector_cmp_u)
-esym(528, H5V_vector_zerop_s, H5V_vector_zerop_u)
-// Turn off warnings about "Ignoring return value of function" for
-// H5open() in public error macros
--emacro(534, H5Epush_ret, H5Epush_goto)
-
-// Turn off warnings about "Expression-like macro not parenthesized" for
-// enumerated type increment & decrement macros:
--esym(773, H5_INC_ENUM, H5_DEC_ENUM)
-
-// Turn off warnings about not using PABLO_MASK macro
--esym(750, PABLO_MASK)
-
-// Suppress message about our use of 'goto' in our error macros
--emacro(801,HGOTO_DONE, H5Epush_goto)
-
// Suppress message about using 'goto' in a few functions
-efunc(801,H5_term_library,H5_trace)
// Suppress message about "boolean test of a paranthesized assignment"
--e820
+-efunc(820,H5_term_library)
// Suppress message about "Constant value boolean" in FUNC_ENTER* macros
-emacro(506,FUNC_ENTER_API,FUNC_ENTER_API_NOCLEAR, FUNC_ENTER_NOAPI)
-// Suppress message about "Suspicious cast" in FUNC_ENTER* macros
--emacro(611,FUNC_ENTER_API,FUNC_ENTER_NOAPI)
-
-// Suppress message about "Boolean within 'if' always evaluates false" in FUNC_ENTER* macros
--emacro(774,FUNC_ENTER_API,FUNC_ENTER_NOAPI)
+// Suppress message about "Constant value boolean" in TRUE macros
+-emacro(506,TRUE)
// Suppress message about "Constant value boolean" in IS_H5FD_MPI* macros
-emacro(506,IS_H5FD_MPI)
@@ -50,38 +23,39 @@
// Suppress message about "Boolean within 'if' always evaluates false" in IS_H5FD_MPI* macros
-emacro((774),IS_H5FD_MPI)
-// Suppress message about "Static variable found within inline function" in FUNC_ENTER* macros
--emacro(1534,FUNC_ENTER_NOINIT)
-
-// Suppress message about "Shift right of signed quantity" in H5I_GRP macro
--emacro(702,H5I_GRP)
-
-// Suppress message about "Constant expression evaluates to 0 in expression" in H5FL_ARR* macros
--emacro(778,H5FL_ARR_DEFINE_COMMON)
-
-// Suppress message about "Union initialization" in H5FL_ARR* macros
--emacro(708,H5FL_ARR_DEFINE_COMMON)
+// Suppress message about our use of 'goto' in our error macros
+-emacro(801,HGOTO_DONE, H5Epush_goto)
-// Suppress message about "enum constant not used within defaulted switch"
--e788
+// Turn off warnings about not using the return value from these functions:
+-esym(534, HDfprintf, HDsnprintf, HDvsnprintf)
+-esym(534, H5E_clear_stack, H5E_push_stack)
+-esym(534, H5FL_arr_free, H5FL_blk_free, H5FL_reg_free, H5FL_seq_free)
+-esym(534, H5FS_push, H5FS_pop)
+-esym(534, H5I_clear_type, H5I_dec_type_ref)
+-esym(534, H5MM_xfree)
+-esym(534, H5RC_decr)
+-esym(534, H5TB_dfree)
+-esym(534, H5V_array_fill)
-// Indicate functions that are like printf()
--printf(2,HDfprintf)
+// Turn off warnings about not using PABLO_MASK macro
+-esym(750, PABLO_MASK)
-// Tell lint about additional printf() format codes that HDfprintf understands
--printf_code(a,haddr_t)
--printf_code(Hu,hsize_t)
--printf_code(Hd,hssize_t)
--printf_code(Zu,size_t)
--printf_code(Zd,ssize_t)
+// Turn off warnings about "Expression-like macro not parenthesized" for
+// enumerated type increment & decrement macros:
+-esym(773, H5_INC_ENUM, H5_DEC_ENUM)
/* So far, the following files have been linted with these options:
H5.c
H5A.c
H5AC.c
H5B.c
+
H5D.c
+ H5Dcompact.c
+ H5Dcontig.c
+ H5Defl.c
H5Dio.c
+ H5Distore.c
H5E.c
H5F.c
H5FD.c
@@ -94,6 +68,7 @@
H5FL.c
H5FO.c
+ H5Tcommit.c
H5Tcompound.c
H5Tcset.c