summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5.c245
-rw-r--r--src/H5A.c71
-rw-r--r--src/H5AC.c61
-rw-r--r--src/H5ACprivate.h4
-rw-r--r--src/H5B.c74
-rw-r--r--src/H5Bprivate.h12
-rw-r--r--src/H5C.c8
-rw-r--r--src/H5Cprivate.h9
-rw-r--r--src/H5D.c66
-rw-r--r--src/H5Dcompact.c20
-rw-r--r--src/H5Dcontig.c127
-rw-r--r--src/H5Defl.c68
-rw-r--r--src/H5Dio.c158
-rw-r--r--src/H5Distore.c495
-rw-r--r--src/H5Dmpio.c228
-rw-r--r--src/H5Dpkg.h38
-rw-r--r--src/H5Dprivate.h8
-rw-r--r--src/H5Dpublic.h6
-rw-r--r--src/H5Dselect.c4
-rw-r--r--src/H5Dtest.c4
-rw-r--r--src/H5E.c151
-rw-r--r--src/H5Eprivate.h49
-rw-r--r--src/H5F.c1293
-rw-r--r--src/H5FD.c45
-rw-r--r--src/H5FDcore.c7
-rw-r--r--src/H5FDfamily.c58
-rw-r--r--src/H5FDgass.c7
-rw-r--r--src/H5FDlog.c16
-rw-r--r--src/H5FDmpi.c4
-rw-r--r--src/H5FDmpio.c7
-rw-r--r--src/H5FDmpiposix.c7
-rw-r--r--src/H5FDmulti.c81
-rw-r--r--src/H5FDprivate.h2
-rw-r--r--src/H5FDsec2.c8
-rw-r--r--src/H5FDsrb.c7
-rw-r--r--src/H5FDstdio.c51
-rw-r--r--src/H5FDstream.c6
-rw-r--r--src/H5FL.c73
-rw-r--r--src/H5FO.c13
-rw-r--r--src/H5FS.c18
-rw-r--r--src/H5Fpkg.h2
-rw-r--r--src/H5Fprivate.h8
-rw-r--r--src/H5Fpublic.h8
-rw-r--r--src/H5G.c24
-rw-r--r--src/H5Gent.c27
-rw-r--r--src/H5Gnode.c50
-rw-r--r--src/H5Gpkg.h22
-rw-r--r--src/H5Gstab.c8
-rw-r--r--src/H5HG.c23
-rw-r--r--src/H5HGdbg.c4
-rw-r--r--src/H5HGprivate.h4
-rw-r--r--src/H5HL.c10
-rw-r--r--src/H5HLdbg.c4
-rw-r--r--src/H5HLprivate.h2
-rw-r--r--src/H5HP.c26
-rw-r--r--src/H5I.c24
-rw-r--r--src/H5Iprivate.h1
-rw-r--r--src/H5Ipublic.h1
-rw-r--r--src/H5MF.c16
-rw-r--r--src/H5MM.c4
-rw-r--r--src/H5O.c22
-rw-r--r--src/H5Oattr.c7
-rw-r--r--src/H5Obogus.c8
-rw-r--r--src/H5Ocont.c3
-rw-r--r--src/H5Odtype.c34
-rw-r--r--src/H5Oefl.c7
-rw-r--r--src/H5Ofill.c15
-rw-r--r--src/H5Olayout.c9
-rw-r--r--src/H5Omtime.c11
-rw-r--r--src/H5Oname.c7
-rw-r--r--src/H5Opkg.h2
-rw-r--r--src/H5Opline.c7
-rw-r--r--src/H5Oprivate.h4
-rw-r--r--src/H5Osdspace.c12
-rw-r--r--src/H5Oshared.c7
-rw-r--r--src/H5Ostab.c7
-rw-r--r--src/H5P.c14
-rw-r--r--src/H5Pdcpl.c70
-rw-r--r--src/H5Pdxpl.c11
-rw-r--r--src/H5Pfapl.c13
-rw-r--r--src/H5Pfcpl.c39
-rw-r--r--src/H5Pprivate.h2
-rw-r--r--src/H5Ppublic.h22
-rw-r--r--src/H5Ptest.c11
-rw-r--r--src/H5R.c25
-rw-r--r--src/H5RC.c4
-rw-r--r--src/H5RS.c55
-rw-r--r--src/H5Rpublic.h4
-rw-r--r--src/H5S.c48
-rw-r--r--src/H5SL.c7
-rw-r--r--src/H5SLprivate.h2
-rw-r--r--src/H5ST.c18
-rw-r--r--src/H5Sall.c104
-rw-r--r--src/H5Shyper.c393
-rw-r--r--src/H5Smpio.c360
-rw-r--r--src/H5Snone.c125
-rw-r--r--src/H5Spkg.h10
-rw-r--r--src/H5Spoint.c141
-rw-r--r--src/H5Sprivate.h29
-rw-r--r--src/H5Spublic.h19
-rw-r--r--src/H5Sselect.c142
-rw-r--r--src/H5Stest.c6
-rw-r--r--src/H5T.c116
-rw-r--r--src/H5TB.c43
-rw-r--r--src/H5TS.c7
-rw-r--r--src/H5Tarray.c8
-rw-r--r--src/H5Tbit.c27
-rw-r--r--src/H5Tcommit.c80
-rw-r--r--src/H5Tcompound.c73
-rw-r--r--src/H5Tconv.c77
-rw-r--r--src/H5Tcset.c52
-rw-r--r--src/H5Tenum.c38
-rw-r--r--src/H5Tfields.c128
-rw-r--r--src/H5Tfixed.c46
-rw-r--r--src/H5Tfloat.c134
-rw-r--r--src/H5Tnative.c382
-rw-r--r--src/H5Toffset.c59
-rw-r--r--src/H5Topaque.c46
-rw-r--r--src/H5Torder.c52
-rw-r--r--src/H5Tpad.c52
-rw-r--r--src/H5Tpkg.h39
-rw-r--r--src/H5Tprecis.c102
-rw-r--r--src/H5Tprivate.h4
-rw-r--r--src/H5Tpublic.h22
-rw-r--r--src/H5Tstrpad.c60
-rw-r--r--src/H5Tvlen.c96
-rw-r--r--src/H5V.c504
-rw-r--r--src/H5Vprivate.h77
-rw-r--r--src/H5Z.c16
-rw-r--r--src/H5Zdeflate.c75
-rw-r--r--src/H5Zfletcher32.c22
-rw-r--r--src/H5Zpublic.h2
-rw-r--r--src/H5Zshuffle.c32
-rw-r--r--src/H5Zszip.c59
-rw-r--r--src/H5config.h.in3
-rw-r--r--src/H5detect.c34
-rw-r--r--src/H5private.h74
-rw-r--r--src/H5public.h19
-rw-r--r--src/Makefile.in2
139 files changed, 4390 insertions, 3985 deletions
diff --git a/src/H5.c b/src/H5.c
index 37beb7f..47f6907 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,14 +55,10 @@ 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*);
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/*--------------------------------------------------------------------------
* NAME
* H5_init_library -- Initialize library-global information
@@ -125,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;
}
/*
@@ -223,7 +221,6 @@ H5_term_library(void)
pending += DOWN(G);
pending += DOWN(A);
pending += DOWN(S);
- pending += DOWN(TN);
pending += DOWN(T);
/* Don't shut down the file code until objects in files are shut down */
if(pending==0)
@@ -319,10 +316,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)
}
@@ -360,7 +357,7 @@ H5garbage_collect(void)
/* Call the garbage collection routines in the library */
if(H5FL_garbage_coll()<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't garbage collect objects")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect objects")
done:
FUNC_LEAVE_API(ret_value)
@@ -464,9 +461,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 +476,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 +1008,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 +1047,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?"+":"",
@@ -1061,6 +1055,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
zerofill?"0":"");
if (fwidth>0)
sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth);
+
/*lint --e{506} Don't issue warnings about constant value booleans */
/*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */
if (sizeof(x)==H5_SIZEOF_INT) {
@@ -1094,7 +1089,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;
@@ -1563,7 +1558,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")) {
@@ -1577,7 +1572,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) {
@@ -1587,7 +1582,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;
@@ -1600,7 +1595,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);
@@ -1630,7 +1625,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");
@@ -1659,7 +1654,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");
@@ -1685,7 +1680,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");
@@ -1711,7 +1706,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");
@@ -1725,6 +1720,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;
@@ -1740,7 +1738,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");
@@ -1751,6 +1749,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;
@@ -1766,7 +1767,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");
@@ -1811,7 +1812,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");
@@ -1834,7 +1835,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;
@@ -1881,7 +1882,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");
@@ -1907,7 +1908,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");
@@ -1939,7 +1940,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");
@@ -1965,7 +1966,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;
@@ -1996,7 +1997,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 {
@@ -2057,6 +2058,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
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;
@@ -2168,18 +2172,21 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case H5I_ATTR:
fprintf(out, "%ld (attr)", (long)obj);
break;
- case H5I_TEMPBUF:
- fprintf(out, "%ld", (long)obj);
- if (HDstrcmp(argname, "tbuf")) {
- fprintf(out, " (tbuf");
- }
- break;
case H5I_REFERENCE:
fprintf(out, "%ld (reference)", (long)obj);
break;
case H5I_VFL:
fprintf(out, "%ld (file driver)", (long)obj);
break;
+ case H5I_GENPROP_CLS:
+ fprintf(out, "%ld (genprop class)", (long)obj);
+ break;
+ case H5I_GENPROP_LST:
+ fprintf(out, "%ld (genprop list)", (long)obj);
+ break;
+ case H5I_NGROUPS:
+ fprintf (out, "%ld (ngroups - error)", (long)obj);
+ break;
default:
fprintf(out, "%ld (unknown class)", (long)obj);
break;
@@ -2228,7 +2235,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;
}
@@ -2242,7 +2249,7 @@ 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_BADID:
fprintf (out, "H5I_BADID");
@@ -2250,6 +2257,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
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;
@@ -2265,9 +2275,6 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case H5I_ATTR:
fprintf (out, "H5I_ATTR");
break;
- case H5I_TEMPBUF:
- fprintf (out, "H5I_TEMPBUF");
- break;
case H5I_REFERENCE:
fprintf (out, "H5I_REFERENCE");
break;
@@ -2334,7 +2341,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");
@@ -2360,6 +2367,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;
@@ -2418,7 +2428,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;
@@ -2433,7 +2443,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");
@@ -2473,7 +2483,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");
@@ -2502,7 +2512,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");
@@ -2513,6 +2523,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;
@@ -2528,7 +2559,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");
@@ -2545,6 +2576,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;
@@ -2566,7 +2600,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;
@@ -2581,7 +2615,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");
@@ -2589,6 +2623,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;
@@ -2604,7 +2655,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");
@@ -2630,7 +2681,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");
@@ -2656,7 +2707,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");
@@ -2685,7 +2736,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");
@@ -2717,7 +2768,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");
@@ -2731,6 +2782,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;
@@ -2746,7 +2800,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");
@@ -2757,6 +2811,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;
@@ -2772,7 +2829,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");
@@ -2798,9 +2855,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;
@@ -2816,7 +2885,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");
@@ -2830,6 +2899,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;
@@ -2879,7 +2963,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 {
@@ -2904,7 +2988,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;
@@ -2913,6 +2997,19 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
case 'Z':
switch (type[1]) {
+ case 'c':
+ if (ptr) {
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
+ } else {
+ 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;
+
case 'e':
if (ptr) {
if (vp) {
@@ -2921,7 +3018,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 af55838..ebdca4f 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -13,7 +13,9 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#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
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
@@ -26,12 +28,7 @@
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
-#include "H5Spkg.h" /* Dataspace functions */
-
-/* Is the interface initialized? */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5A_init_interface
-static herr_t H5A_init_interface(void);
+#include "H5Sprivate.h" /* Dataspace functions */
/* PRIVATE PROTOTYPES */
static hid_t H5A_create(const H5G_entry_t *ent, const char *name,
@@ -114,12 +111,12 @@ H5A_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5A_term_interface)
- if (interface_initialize_g) {
- if ((n=H5I_nmembers(H5I_ATTR))) {
- H5I_clear_group(H5I_ATTR, FALSE);
+ if (H5_interface_initialize_g) {
+ if ((n=H5I_nmembers(H5I_ATTR))>0) {
+ (void)H5I_clear_group(H5I_ATTR, FALSE);
} else {
- H5I_destroy_group(H5I_ATTR);
- interface_initialize_g = 0;
+ (void)H5I_destroy_group(H5I_ATTR);
+ H5_interface_initialize_g = 0;
n = 1;
}
}
@@ -163,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 */
@@ -293,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);
@@ -438,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)
@@ -495,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
@@ -616,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")
@@ -650,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 */
@@ -681,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)) {
@@ -697,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)
@@ -778,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")
@@ -812,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*/
@@ -847,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)) {
@@ -863,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));
@@ -960,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)
@@ -980,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.
*/
@@ -991,7 +988,7 @@ H5Aget_type(hid_t attr_id)
if (H5T_vlen_mark(dst, NULL, H5T_VLEN_MEMORY)<0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid VL 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)
@@ -1162,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)
@@ -1185,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);
@@ -1354,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
@@ -1435,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 dced1ab..21b85c0 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -44,6 +44,9 @@
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5AC_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5AC_mask
@@ -57,10 +60,6 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Pprivate.h" /* Property lists */
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5AC_init_interface
-static herr_t H5AC_init_interface(void);
/*
* Private file-scope variables.
@@ -86,7 +85,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);
@@ -262,7 +261,7 @@ H5AC_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5AC_term_interface)
- if (interface_initialize_g) {
+ if (H5_interface_initialize_g) {
#ifdef H5_HAVE_PARALLEL
if(H5AC_dxpl_id>0 || H5AC_noblock_dxpl_id>0 || H5AC_ind_dxpl_id>0) {
/* Indicate more work to do */
@@ -280,7 +279,7 @@ H5AC_term_interface(void)
H5AC_ind_dxpl_id=(-1);
/* Reset interface initialization flag */
- interface_initialize_g = 0;
+ H5_interface_initialize_g = 0;
} /* end else */
} /* end if */
else
@@ -292,7 +291,7 @@ H5AC_term_interface(void)
#endif /* H5_HAVE_PARALLEL */
/* Reset interface initialization flag */
- interface_initialize_g = 0;
+ H5_interface_initialize_g = 0;
} /* end if */
FUNC_LEAVE_NOAPI(n)
@@ -337,7 +336,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",
@@ -346,10 +345,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 = NULL;
int ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_create, FAIL)
@@ -361,35 +359,20 @@ H5AC_create(const H5F_t *f, int UNUSED size_hint)
* in proper size hints.
* -- JRM
*/
- cache = 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 ) {
+ if ( NULL == f->shared->cache ) {
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- } else {
-
- f->shared->cache = cache;
-
}
done:
- if ( ret_value < 0 ) {
-
- if ( cache != NULL ) {
-
- H5C_dest_empty(cache);
- f->shared->cache = NULL;
-
- } /* end if */
-
- } /* end if */
-
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_create() */
@@ -613,7 +596,7 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *
if ( result < 0 ) {
- HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "H5C_insert_entry() failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C_insert_entry() failed")
}
done:
@@ -654,8 +637,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 */
@@ -669,15 +651,14 @@ H5AC_rename(H5F_t *f, hid_t UNUSED dxpl_id, const H5AC_class_t *type, haddr_t ol
HDassert(H5F_addr_defined(new_addr));
HDassert(H5F_addr_ne(old_addr, new_addr));
- result = H5C_rename_entry(f,
- f->shared->cache,
+ result = H5C_rename_entry(f->shared->cache,
type,
old_addr,
new_addr);
if ( result < 0 ) {
- HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, \
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTRENAME, FAIL, \
"H5C_rename_entry() failed.")
}
@@ -783,7 +764,7 @@ H5AC_protect(H5F_t *f,
if ( thing == NULL ) {
- HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, NULL, "H5C_protect() failed.")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_protect() failed.")
}
/* Set return value */
@@ -886,7 +867,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
if ( result < 0 ) {
- HGOTO_ERROR(H5E_CACHE, H5E_NOTCACHED, FAIL, \
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
"H5C_unprotect() failed.")
}
@@ -919,7 +900,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_stats(H5F_t UNUSED *f)
+H5AC_stats(const H5F_t *f)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -928,7 +909,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)
@@ -964,12 +945,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 1da136d..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] = {{
@@ -164,10 +164,6 @@ static const H5AC_class_t H5AC_BT[1] = {{
(H5AC_size_func_t)H5B_compute_size,
}};
-/* Interface initialization? */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/* Declare a PQ free list to manage the native block information */
H5FL_BLK_DEFINE_STATIC(native_block);
@@ -328,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++;
@@ -387,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;
@@ -411,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;
@@ -492,7 +488,7 @@ H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt)
if (bt->cache_info.is_dirty) {
if (H5B_serialize(f, bt) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to serialize B-tree")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTSERIALIZE, FAIL, "unable to serialize B-tree")
/*
* Write the disk page. We always write the header, but we don't
@@ -605,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;
@@ -622,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);
-
- if ( size == 0 ) {
-
- HGOTO_ERROR(H5E_RESOURCE, H5E_BADSIZE, FAIL, \
- "H5B_nodesize() failed");
-
- } else {
-
- *size_ptr = size;
+ /* Check node's size */
+ if ((size = H5B_nodesize(f, shared, NULL)) == 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, FAIL, "H5B_nodesize() failed")
- }
+ /* Set size value */
+ *size_ptr = size;
done:
-
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5B_H5B_compute_size() */
@@ -737,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
@@ -815,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
@@ -975,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)
@@ -1060,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) */
@@ -1282,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")
@@ -1295,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)
@@ -1306,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")
@@ -1329,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")
@@ -1340,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")
@@ -1372,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")
@@ -1381,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.
@@ -1623,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)
@@ -1635,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);
@@ -1669,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)
@@ -1680,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")
@@ -1746,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
@@ -2001,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 394ddde..a608505 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -99,10 +99,6 @@
#include "H5Pprivate.h" /* Property lists */
#include "H5SLprivate.h" /* Skip lists */
-/* Interface initialization? */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/****************************************************************************
*
@@ -2800,8 +2796,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)
@@ -2814,7 +2809,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) );
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 7ae6b58..affd433 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -124,8 +124,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 {
@@ -140,7 +140,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);
@@ -377,8 +377,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 0e0e94b..ddf21d5 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -14,6 +14,9 @@
#define H5D_PACKAGE /*suppress error about including H5Dpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5D_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5D_mask
@@ -31,12 +34,7 @@
/*#define H5D_DEBUG*/
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5D_init_interface
-
/* Local functions */
-static herr_t H5D_init_interface(void);
static herr_t H5D_init_storage(H5D_t *dataset, hbool_t full_overwrite, hid_t dxpl_id);
static H5D_shared_t * H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type);
static H5D_t * H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id,
@@ -47,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);
@@ -420,8 +418,8 @@ H5D_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_term_interface)
- if (interface_initialize_g) {
- if ((n=H5I_nmembers(H5I_DATASET))) {
+ if (H5_interface_initialize_g) {
+ 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
@@ -447,7 +445,7 @@ H5D_term_interface(void)
H5I_clear_group(H5I_DATASET, TRUE);
} else {
H5I_destroy_group(H5I_DATASET);
- interface_initialize_g = 0;
+ H5_interface_initialize_g = 0;
n = 1; /*H5I*/
}
}
@@ -1640,7 +1638,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 */
@@ -1981,6 +1979,10 @@ done:
* whether we're working with an external file or not. Between the
* two, there is a conditional call to allocate space which isn't
* part of updating the cache.
+ *
+ * Nat Furrer and James Laird
+ * June 7, 2004
+ * Added checked_filters flag
*
*-------------------------------------------------------------------------
*/
@@ -2253,7 +2255,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)
@@ -2386,7 +2388,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;
@@ -2399,7 +2401,6 @@ H5D_open(H5G_entry_t *ent, hid_t dxpl_id)
/* Check if dataset was already open */
if((shared_fo=H5FO_opened(ent->file,ent->header))==NULL) {
-
/* Clear any errors from H5FO_opened() */
H5E_clear();
@@ -2429,16 +2430,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)
}
@@ -2588,7 +2588,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;
@@ -2620,7 +2620,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;
@@ -2795,7 +2795,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
@@ -3119,7 +3119,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) {
@@ -3244,7 +3244,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)
@@ -3338,7 +3338,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)
@@ -3434,7 +3434,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)
@@ -3469,14 +3469,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.
@@ -3648,7 +3648,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;
@@ -3668,7 +3668,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) */
@@ -3970,7 +3970,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 */
@@ -4035,7 +4035,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 */
@@ -4065,13 +4065,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Ddebug(hid_t dset_id, unsigned UNUSED flags)
+H5Ddebug(hid_t dset_id)
{
H5D_t *dset=NULL;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(H5Ddebug, FAIL)
- H5TRACE2("e","iIu",dset_id,flags);
+ H5TRACE1("e","i",dset_id);
/* Check args */
if (NULL==(dset=H5I_object_verify(dset_id, H5I_DATASET)))
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index bf56acc..8a032e3 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -35,10 +35,6 @@
#include "H5Oprivate.h" /* Object headers */
#include "H5Vprivate.h" /* Vector and array functions */
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/*-------------------------------------------------------------------------
* Function: H5D_compact_readvv
@@ -61,23 +57,23 @@ static int interface_initialize_g = 0;
*-------------------------------------------------------------------------
*/
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() */
@@ -105,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 be2c45b..18c6677 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -44,10 +44,6 @@
static herr_t H5D_contig_write(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache,
hid_t dxpl_id, const H5D_storage_t *store, hsize_t offset, size_t size, const void *buf);
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/* Declare a PQ free list to manage the sieve buffer information */
H5FL_BLK_DEFINE(sieve_buf);
@@ -77,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);
@@ -85,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 */
@@ -133,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));
@@ -147,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;
@@ -198,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);
@@ -218,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;
@@ -238,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 */
@@ -248,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 */
@@ -266,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 */
@@ -280,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() */
@@ -303,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);
@@ -311,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 */
@@ -335,19 +331,13 @@ done:
haddr_t
H5D_contig_get_addr(const H5D_t *dset)
{
- haddr_t ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(H5D_contig_get_addr, HADDR_UNDEF);
+ FUNC_ENTER_NOAPI_NOFUNC(H5D_contig_get_addr)
/* check args */
assert(dset);
assert(dset->shared->layout.type==H5D_CONTIGUOUS);
- /* Get the address */
- ret_value=dset->shared->layout.u.contig.addr;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(dset->shared->layout.u.contig.addr)
} /* end H5D_contig_get_addr */
@@ -382,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);
@@ -392,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() */
@@ -420,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)
@@ -430,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 */
-
- FUNC_ENTER_NOAPI(H5D_contig_readvv, FAIL);
+ ssize_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5D_contig_readvv, FAIL)
/* Check args */
assert(io_info);
@@ -482,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);
@@ -507,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);
@@ -543,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;
@@ -552,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 {
@@ -560,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;
@@ -571,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);
@@ -590,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);
@@ -614,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 {
@@ -634,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;
@@ -649,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 */
@@ -657,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() */
@@ -683,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)
@@ -693,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);
@@ -745,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);
@@ -772,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 ) */
@@ -812,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;
@@ -825,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 {
@@ -836,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);
@@ -859,14 +854,13 @@ H5D_contig_writevv(H5D_io_info_t *io_info,
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 {
/* Flush the sieve buffer if it's dirty */
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;
@@ -877,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);
@@ -898,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 ) */
@@ -924,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 {
@@ -944,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;
@@ -959,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 */
@@ -967,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 474ac2f..3a7b079 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -34,10 +34,6 @@ static herr_t H5D_efl_read (const H5O_efl_t *efl, haddr_t addr, size_t size,
static herr_t H5D_efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size,
const uint8_t *buf);
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/*-------------------------------------------------------------------------
* Function: H5D_efl_read
@@ -71,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);
@@ -90,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);
@@ -106,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);
}
@@ -122,7 +119,7 @@ done:
if (fd>=0)
HDclose (fd);
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -157,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);
@@ -176,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);
@@ -197,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;
@@ -210,7 +208,7 @@ done:
if (fd>=0)
HDclose (fd);
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -232,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)
@@ -240,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);
@@ -267,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;
@@ -282,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() */
@@ -312,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)
@@ -320,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);
@@ -347,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;
@@ -362,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 f96d26e..c00e1b7 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;
@@ -69,10 +69,6 @@ typedef struct fm_map {
H5S_sel_type msel_type; /* Selection type in memory */
} fm_map;
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/* Local functions */
static herr_t H5D_fill(const void *fill, const H5T_t *fill_type, void *buf,
const H5T_t *buf_type, const H5S_t *space, hid_t dxpl_id);
@@ -121,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);
@@ -341,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)
@@ -2328,7 +2320,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 */
@@ -2407,9 +2399,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 */
@@ -2636,14 +2628,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 */
@@ -2655,8 +2648,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)
@@ -2664,8 +2658,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 */
@@ -2688,12 +2681,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) {
@@ -2708,7 +2705,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 */
@@ -2750,7 +2747,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)
@@ -2766,8 +2763,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]) {
@@ -2780,8 +2777,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 */
@@ -2817,10 +2814,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 */
@@ -2868,8 +2865,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);
@@ -2895,11 +2895,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 */
@@ -2928,11 +2930,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 */
@@ -2940,7 +2942,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 */
@@ -3023,7 +3025,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 */
@@ -3053,18 +3055,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 */
@@ -3105,7 +3107,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 {
@@ -3123,7 +3125,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.
@@ -3220,7 +3222,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_chunk_mem_cb
+ * Function: H5D_ioinfo_init
*
* Purpose: Routine for determining correct I/O operations for
* each I/O action.
@@ -3236,15 +3238,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);
@@ -3280,21 +3301,32 @@ H5D_ioinfo_init(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
/* Check if we can use the optimized parallel I/O routines */
if(opt==TRUE) {
/* Set the pointers to the MPI-specific routines */
+ if((H5S_SELECT_IS_REGULAR(file_space) == TRUE) &&
+ (H5S_SELECT_IS_REGULAR(mem_space) == TRUE)){
io_info->ops.read = H5D_mpio_spaces_read;
io_info->ops.write = H5D_mpio_spaces_write;
-
+ }
+
+ #ifdef KYANG
+ else {
+ io_info->ops.read = H5D_mpio_spaces_span_read;
+ io_info->ops.write = H5D_mpio_spaces_span_write;
+ }
+ #endif
/* Indicate that the I/O will be parallel */
*use_par_opt_io=TRUE;
} /* end if */
else {
/* Indicate that the I/O will _NOT_ be parallel */
*use_par_opt_io=FALSE;
-
-#endif /* H5_HAVE_PARALLEL */
io_info->ops.read = H5D_select_read;
io_info->ops.write = H5D_select_write;
-#ifdef H5_HAVE_PARALLEL
+
+
} /* end else */
+#else
+ io_info->ops.read = H5D_select_read;
+ io_info->ops.write = H5D_select_write;
#endif /* H5_HAVE_PARALLEL */
#ifdef H5S_DEBUG
@@ -3303,6 +3335,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 22bba76..96d5a46 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -88,21 +88,17 @@
/*#define H5D_ISTORE_DEBUG */
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/*
* 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 */
@@ -130,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;
@@ -152,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*/);
@@ -170,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,
@@ -179,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,
@@ -244,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);
@@ -259,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() */
@@ -279,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);
@@ -294,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() */
@@ -313,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);
@@ -338,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() */
@@ -357,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);
@@ -382,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() */
@@ -400,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)
@@ -408,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);
@@ -422,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() */
@@ -447,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)
@@ -456,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);
@@ -464,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() */
@@ -499,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)
@@ -508,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);
@@ -531,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() */
@@ -574,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);
@@ -588,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;
/*
@@ -608,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() */
@@ -647,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);
@@ -665,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;
@@ -679,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() */
@@ -715,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,
@@ -730,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);
@@ -740,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);
@@ -748,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) {
/*
@@ -771,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;
@@ -812,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() */
@@ -846,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() */
@@ -882,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) {
@@ -910,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() */
@@ -930,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() */
@@ -971,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 */
@@ -979,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);
@@ -1008,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 {
/*
@@ -1031,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;
@@ -1067,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() */
@@ -1090,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);
@@ -1105,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 */
@@ -1134,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() */
@@ -1166,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)
@@ -1191,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() */
@@ -1226,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);
@@ -1248,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() */
@@ -1310,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() */
@@ -1374,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);
@@ -1385,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)
@@ -1466,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() */
@@ -1508,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 */
@@ -1525,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);
@@ -1560,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
@@ -1573,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 */
@@ -1602,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++;
@@ -1625,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)) {
@@ -1670,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);
@@ -1714,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;
@@ -1752,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() */
@@ -1784,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.
@@ -1825,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;
@@ -1845,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() */
@@ -1865,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)
@@ -1876,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);
@@ -1890,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);
@@ -1936,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 */
@@ -1978,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
@@ -2018,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 */
@@ -2028,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() */
@@ -2063,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)
@@ -2074,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);
@@ -2088,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);
@@ -2123,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 */
@@ -2143,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 */
@@ -2183,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() */
@@ -2231,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);
@@ -2246,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() */
@@ -2283,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);
@@ -2298,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() */
@@ -2333,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);
@@ -2365,7 +2355,7 @@ H5D_istore_get_addr(H5D_io_info_t *io_info, H5D_istore_ud1_t *_udata)
#ifdef OLD_WAY
H5E_clear();
- 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 */
@@ -2375,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() */
@@ -2400,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);
@@ -2410,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() */
@@ -2433,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);
@@ -2444,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() */
@@ -2496,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 */
@@ -2524,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);
@@ -2543,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)
@@ -2558,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;
@@ -2579,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,
@@ -2596,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) {
@@ -2619,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;
@@ -2665,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) {
@@ -2676,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 */
@@ -2685,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 */
@@ -2693,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;
@@ -2717,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() */
@@ -2825,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 */
@@ -2836,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);
@@ -2846,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
@@ -2874,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;
}
@@ -2891,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() */
@@ -2915,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 */
@@ -2929,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++)
@@ -2947,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() */
@@ -2974,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 */ ,
@@ -2982,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() */
@@ -3026,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 */
@@ -3052,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);
@@ -3066,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));
@@ -3098,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
@@ -3119,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];
@@ -3129,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;
@@ -3145,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 */
@@ -3174,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
@@ -3191,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() */
@@ -3217,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)) {
@@ -3234,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() */
@@ -3271,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 */
@@ -3281,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++)
@@ -3331,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 */
@@ -3343,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() */
@@ -3372,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;
@@ -3381,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
@@ -3413,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");
@@ -3449,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 */
@@ -3471,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);
@@ -3487,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 b96d32e..9d1f65c 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -39,16 +39,18 @@
#ifdef H5_HAVE_PARALLEL
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
static herr_t
H5D_mpio_spaces_xfer(H5D_io_info_t *io_info, size_t elmt_size,
const H5S_t *file_space, const H5S_t *mem_space,
void *buf/*out*/,
hbool_t do_write);
+
+static herr_t
+H5D_mpio_spaces_span_xfer(H5D_io_info_t *io_info, size_t elmt_size,
+ const H5S_t *file_space, const H5S_t *mem_space,
+ void *buf/*out*/,
+ hbool_t do_write);
/*-------------------------------------------------------------------------
* Function: H5D_mpio_opt_possible
@@ -89,13 +91,14 @@ H5D_mpio_opt_possible( const H5D_t *dset, const H5S_t *mem_space, const H5S_t *f
HGOTO_DONE(FALSE);
/* Check whether both selections are "regular" */
+#ifndef KYANG
c1=H5S_SELECT_IS_REGULAR(file_space);
c2=H5S_SELECT_IS_REGULAR(mem_space);
if(c1==FAIL || c2==FAIL)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "invalid check for single selection blocks");
if(c1==FALSE || c2==FALSE)
HGOTO_DONE(FALSE);
-
+#endif
/* Can't currently handle point selections */
if (H5S_SEL_POINTS==H5S_GET_SELECT_TYPE(mem_space) || H5S_SEL_POINTS==H5S_GET_SELECT_TYPE(file_space))
HGOTO_DONE(FALSE);
@@ -107,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 */
@@ -368,6 +371,129 @@ done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5D_mpio_spaces_xfer() */
+
+/** The following function has been tested, don't call this
+ function until you don't see this line. Nov. 11,2004, KY**/
+
+static herr_t
+H5D_mpio_spaces_span_xfer(H5D_io_info_t *io_info, size_t elmt_size,
+ const H5S_t *file_space, const H5S_t *mem_space,
+ void *_buf /*out*/, hbool_t do_write )
+{
+ haddr_t addr; /* Address of dataset (or selection) within file */
+ size_t mpi_buf_count, mpi_file_count; /* Number of "objects" to transfer */
+ hsize_t mpi_buf_offset, mpi_file_offset; /* Offset within dataset where selection (ie. MPI type) begins */
+ MPI_Datatype mpi_buf_type, mpi_file_type; /* MPI types for buffer (memory) and file */
+ hbool_t mbt_is_derived=0, /* Whether the buffer (memory) type is derived and needs to be free'd */
+ mft_is_derived=0; /* Whether the file type is derived and needs to be free'd */
+ hbool_t plist_is_setup=0; /* Whether the dxpl has been customized */
+ uint8_t *buf=(uint8_t *)_buf; /* Alias for pointer arithmetic */
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5D_mpio_spaces_span_xfer);
+
+ /* Check args */
+ assert (io_info);
+ assert (io_info->dset);
+ assert (file_space);
+ assert (mem_space);
+ assert (buf);
+ assert (IS_H5FD_MPIO(io_info->dset->ent.file));
+ /* Make certain we have the correct type of property list */
+ assert(TRUE==H5P_isa_class(io_info->dxpl_id,H5P_DATASET_XFER));
+
+ printf("coming to span tree xfer \n");
+ /* create the MPI buffer type */
+ if(H5S_SELECT_IS_REGULAR(mem_space)==TRUE){
+ if (H5S_mpio_space_type( mem_space, elmt_size,
+ /* out: */
+ &mpi_buf_type,
+ &mpi_buf_count,
+ &mpi_buf_offset,
+ &mbt_is_derived )<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't create MPI buf type");}
+ else {
+ if (H5S_mpio_space_span_type( mem_space, elmt_size,
+ /* out: */
+ &mpi_buf_type,
+ &mpi_buf_count,
+ &mpi_buf_offset,
+ &mbt_is_derived )<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't create MPI buf type");
+ }
+ printf("mpi_buf_count %d\n",mpi_buf_count);
+ /* create the MPI file type */
+
+ if(H5S_SELECT_IS_REGULAR(file_space)== TRUE){
+ if ( H5S_mpio_space_type( file_space, elmt_size,
+ /* out: */
+ &mpi_file_type,
+ &mpi_file_count,
+ &mpi_file_offset,
+ &mft_is_derived )<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't create MPI file type");
+ }
+ else {
+ if ( H5S_mpio_space_span_type( file_space, elmt_size,
+ /* out: */
+ &mpi_file_type,
+ &mpi_file_count,
+ &mpi_file_offset,
+ &mft_is_derived )<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't create MPI file type");
+ }
+ /* Get the base address of the contiguous dataset or the chunk */
+ if(io_info->dset->shared->layout.type == H5D_CONTIGUOUS)
+ addr = H5D_contig_get_addr(io_info->dset) + mpi_file_offset;
+ else {
+ haddr_t chunk_addr; /* for collective chunk IO */
+
+ assert(io_info->dset->shared->layout.type == H5D_CHUNKED);
+ chunk_addr=H5D_istore_get_addr(io_info,NULL);
+ addr = H5F_BASE_ADDR(io_info->dset->ent.file) + chunk_addr + mpi_file_offset;
+ }
+
+ /*
+ * Pass buf type, file type to the file driver. Request an MPI type
+ * transfer (instead of an elementary byteblock transfer).
+ */
+ if(H5FD_mpi_setup_collective(io_info->dxpl_id, mpi_buf_type, mpi_file_type)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O properties");
+ plist_is_setup=1;
+
+ /* Adjust the buffer pointer to the beginning of the selection */
+ buf+=mpi_buf_offset;
+
+ /* transfer the data */
+ if (do_write) {
+ if (H5F_block_write(io_info->dset->ent.file, H5FD_MEM_DRAW, addr, mpi_buf_count, io_info->dxpl_id, buf) <0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,"MPI write failed");
+ } else {
+ if (H5F_block_read (io_info->dset->ent.file, H5FD_MEM_DRAW, addr, mpi_buf_count, io_info->dxpl_id, buf) <0)
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL,"MPI read failed");
+ }
+
+done:
+ /* Reset the dxpl settings */
+ if(plist_is_setup) {
+ if(H5FD_mpi_teardown_collective(io_info->dxpl_id)<0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to reset dxpl values");
+ } /* end if */
+
+ /* free the MPI buf and file types */
+ if (mbt_is_derived) {
+ if (MPI_SUCCESS != (mpi_code= MPI_Type_free( &mpi_buf_type )))
+ HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code);
+ }
+ if (mft_is_derived) {
+ if (MPI_SUCCESS != (mpi_code= MPI_Type_free( &mpi_file_type )))
+ HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code);
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5D_mpio_spaces_span_xfer() */
+
/*-------------------------------------------------------------------------
* Function: H5D_mpio_spaces_read
@@ -397,12 +523,11 @@ H5D_mpio_spaces_read(H5D_io_info_t *io_info,
{
herr_t ret_value;
- FUNC_ENTER_NOAPI(H5D_mpio_spaces_read, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5D_mpio_spaces_read);
ret_value = H5D_mpio_spaces_xfer(io_info, elmt_size, file_space,
mem_space, buf, 0/*read*/);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5D_mpio_spaces_read() */
@@ -435,14 +560,97 @@ H5D_mpio_spaces_write(H5D_io_info_t *io_info,
{
herr_t ret_value;
- FUNC_ENTER_NOAPI(H5D_mpio_spaces_write, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5D_mpio_spaces_write);
/*OKAY: CAST DISCARDS CONST QUALIFIER*/
ret_value = H5D_mpio_spaces_xfer(io_info, elmt_size, file_space,
mem_space, (void*)buf, 1/*write*/);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5D_mpio_spaces_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D_mpio_spaces_span_read
+ *
+ * Purpose: MPI-IO function to read directly from app buffer to file for
+ span-tree
+ *
+ * Return: non-negative on success, negative on failure.
+ *
+ * Programmer: KY
+ * Note : Don't call this routine
+ * until you don't see this line. 11/11/2004, KY
+ *
+ * Modifications:
+ *
+ * rky 980918
+ * Added must_convert parameter to let caller know we can't optimize the xfer.
+ *
+ * QAK - 2002/04/02
+ * Removed the must_convert parameter and move preconditions to
+ * H5S_mpio_opt_possible() routine
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D_mpio_spaces_span_read(H5D_io_info_t *io_info,
+ size_t UNUSED nelmts, size_t elmt_size,
+ const H5S_t *file_space, const H5S_t *mem_space,
+ void *buf/*out*/)
+{
+ herr_t ret_value;
+
+ FUNC_ENTER_NOAPI_NOFUNC(H5D_mpio_spaces_span_read);
+
+ ret_value = H5D_mpio_spaces_span_xfer(io_info, elmt_size, file_space,
+ mem_space, buf, 0/*read*/);
+
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5D_mpio_spaces_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D_mpio_spaces_span_write
+ *
+ * Purpose: MPI-IO function to write directly from app buffer to file.
+ *
+ * Return: non-negative on success, negative on failure.
+ *
+ * Programmer: KY
+ * Note: Don't call this funtion until you don't see this line.
+ * KY, 11/11/04
+
+ *
+ * Modifications:
+ *
+ * rky 980918
+ * Added must_convert parameter to let caller know we can't optimize the xfer.
+ *
+ * QAK - 2002/04/02
+ * Removed the must_convert parameter and move preconditions to
+ * H5S_mpio_opt_possible() routine
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D_mpio_spaces_span_write(H5D_io_info_t *io_info,
+ size_t UNUSED nelmts, size_t elmt_size,
+ const H5S_t *file_space, const H5S_t *mem_space,
+ const void *buf)
+{
+ herr_t ret_value;
+
+ FUNC_ENTER_NOAPI_NOFUNC(H5D_mpio_spaces_span_write);
+
+ printf(" coming to spaces_span_write function\n");
+ fflush(stdout);
+ /*OKAY: CAST DISCARDS CONST QUALIFIER*/
+ printf("element size %d\n",elmt_size);
+ ret_value = H5D_mpio_spaces_span_xfer(io_info, elmt_size, file_space,
+ mem_space, (void*)buf, 1/*write*/);
+
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5D_mpio_spaces_span_write() */
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 52664f3..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);
@@ -288,6 +288,18 @@ H5_DLL herr_t H5D_mpio_spaces_write(H5D_io_info_t *io_info,
const struct H5S_t *file_space, const struct H5S_t *mem_space,
const void *buf);
+/* MPI-IO function to read directly from app buffer to file rky980813 */
+H5_DLL herr_t H5D_mpio_spaces_span_read(H5D_io_info_t *io_info,
+ size_t nelmts, size_t elmt_size,
+ const struct H5S_t *file_space, const struct H5S_t *mem_space,
+ void *buf/*out*/);
+
+/* MPI-IO function to write directly from app buffer to file rky980813 */
+H5_DLL herr_t H5D_mpio_spaces_span_write(H5D_io_info_t *io_info,
+ size_t nelmts, size_t elmt_size,
+ const struct H5S_t *file_space, const struct H5S_t *mem_space,
+ const void *buf);
+
/* 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 *dset, const H5S_t *mem_space,
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index 82ba23c..d6708f1 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -174,7 +174,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 {
@@ -212,7 +212,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);
@@ -224,7 +224,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);
@@ -236,6 +236,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 5987b79..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);
@@ -95,8 +95,8 @@ H5_DLL herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, voi
H5_DLL herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size);
H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type, void *buf,
hid_t buf_type, hid_t space);
-H5_DLL herr_t H5Ddebug(hid_t dset_id, unsigned int flags);
H5_DLL herr_t H5Dset_extent (hid_t dset_id, const hsize_t *size);
+H5_DLL herr_t H5Ddebug(hid_t dset_id);
#ifdef __cplusplus
diff --git a/src/H5Dselect.c b/src/H5Dselect.c
index a9b9228..a12823e 100644
--- a/src/H5Dselect.c
+++ b/src/H5Dselect.c
@@ -35,10 +35,6 @@ H5FL_SEQ_DEFINE_STATIC(size_t);
/* Declare a free list to manage sequences of hsize_t */
H5FL_SEQ_DEFINE_STATIC(hsize_t);
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/*-------------------------------------------------------------------------
* Function: H5D_select_fscat
diff --git a/src/H5Dtest.c b/src/H5Dtest.c
index e22be5d..c155e95 100644
--- a/src/H5Dtest.c
+++ b/src/H5Dtest.c
@@ -30,10 +30,6 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* ID Functions */
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/*--------------------------------------------------------------------------
NAME
diff --git a/src/H5E.c b/src/H5E.c
index daf45ae..d0c5ea7 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -39,13 +39,19 @@
* errors within the H5E package.
*
*/
+
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5E_init_interface
+
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5E_mask
+
#include "H5private.h" /* Generic Functions */
#include "H5Iprivate.h" /* IDs */
#include "H5Eprivate.h" /* Private error routines */
#include "H5MMprivate.h" /* Memory management */
-#define PABLO_MASK H5E_mask
-
static const H5E_major_mesg_t H5E_major_mesg_g[] = {
{H5E_NONE_MAJOR, "No error"},
{H5E_ARGS, "Function arguments"},
@@ -203,7 +209,6 @@ static const H5E_minor_mesg_t H5E_minor_mesg_g[] = {
/* Interface initialization? */
static int interface_initialize_g = 0;
#define INTERFACE_INIT H5E_init_interface
-static herr_t H5E_init_interface (void);
#ifdef H5_HAVE_THREADSAFE
/*
@@ -215,16 +220,16 @@ static herr_t H5E_init_interface (void);
* In order for this macro to work, H5E_get_my_stack() must be preceeded
* by "H5E_t *estack =".
*/
-H5E_t *H5E_get_stack(void);
+static H5E_t * H5E_get_stack(void);
#define H5E_get_my_stack() H5E_get_stack()
-#else
+#else /* H5_HAVE_THREADSAFE */
/*
- * The error stack. Eventually we'll have some sort of global table so each
- * thread has it's own stack. The stacks will be created on demand when the
- * thread first calls H5E_push(). */
+ * The current error stack.
+ */
H5E_t H5E_stack_g[1];
-#define H5E_get_my_stack() (H5E_stack_g+0)
-#endif
+#define H5E_get_my_stack() (H5E_stack_g+0)
+#endif /* H5_HAVE_THREADSAFE */
+
#ifdef H5_HAVE_PARALLEL
/*
@@ -244,9 +249,39 @@ void *H5E_auto_data_g = NULL;
/* Static function declarations */
+static herr_t H5E_walk (H5E_direction_t direction, H5E_walk_t func, void *client_data);
static herr_t H5E_walk_cb (int n, H5E_error_t *err_desc, void *client_data);
+/*-------------------------------------------------------------------------
+ * Function: H5E_init_interface
+ *
+ * Purpose: Initialize the H5E interface. `stderr' is an extern or
+ * function on some systems so we can't initialize
+ * H5E_auto_data_g statically.
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Friday, June 11, 1999
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5E_init_interface (void)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_init_interface)
+
+ H5E_auto_data_g = stderr;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+}
+
+
#ifdef H5_HAVE_THREADSAFE
/*-------------------------------------------------------------------------
* Function: H5E_get_stack
@@ -265,15 +300,16 @@ static herr_t H5E_walk_cb (int n, H5E_error_t *err_desc, void *client_data);
*
*-------------------------------------------------------------------------
*/
-H5E_t *
+static H5E_t *
H5E_get_stack(void)
{
H5E_t *estack;
H5E_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5E_get_stack,NULL);
+ FUNC_ENTER_NOAPI(H5E_get_stack,NULL)
estack = pthread_getspecific(H5TS_errstk_key_g);
+
if (!estack) {
/* no associated value with current thread - create one */
estack = (H5E_t *)H5MM_malloc(sizeof(H5E_t));
@@ -284,41 +320,12 @@ H5E_get_stack(void)
ret_value=estack;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
#endif /* H5_HAVE_THREADSAFE */
/*-------------------------------------------------------------------------
- * Function: H5E_init_interface
- *
- * Purpose: Initialize the H5E interface. `stderr' is an extern or
- * function on some systems so we can't initialize
- * H5E_auto_data_g statically.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Friday, June 11, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5E_init_interface (void)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_init_interface);
-
- H5E_auto_data_g = stderr;
-
- FUNC_LEAVE_NOAPI(SUCCEED);
-}
-
-
-/*-------------------------------------------------------------------------
* Function: H5Eset_auto
*
* Purpose: Turns on or off automatic printing of errors. When turned on
@@ -349,14 +356,14 @@ H5Eset_auto(H5E_auto_t func, void *client_data)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Eset_auto, FAIL);
+ FUNC_ENTER_API(H5Eset_auto, FAIL)
H5TRACE2("e","xx",func,client_data);
H5E_auto_g = func;
H5E_auto_data_g = client_data;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -381,14 +388,14 @@ H5Eget_auto(H5E_auto_t *func, void **client_data)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Eget_auto, FAIL);
+ FUNC_ENTER_API(H5Eget_auto, FAIL)
H5TRACE2("e","*xx",func,client_data);
if (func) *func = H5E_auto_g;
if (client_data) *client_data = H5E_auto_data_g;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -412,12 +419,12 @@ H5Eclear(void)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Eclear, FAIL);
+ FUNC_ENTER_API(H5Eclear, FAIL)
H5TRACE0("e","");
/* FUNC_ENTER() does all the work */
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -449,7 +456,7 @@ H5Eprint(FILE *stream)
herr_t ret_value = FAIL;
/* Don't clear the error stack! :-) */
- FUNC_ENTER_API_NOCLEAR(H5Eprint, FAIL);
+ FUNC_ENTER_API_NOCLEAR(H5Eprint, FAIL)
/*NO TRACE*/
if (!stream) stream = stderr;
@@ -475,7 +482,7 @@ H5Eprint(FILE *stream)
ret_value = H5E_walk (H5E_WALK_DOWNWARD, H5E_walk_cb, (void*)stream);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -500,13 +507,13 @@ H5Ewalk(H5E_direction_t direction, H5E_walk_t func, void *client_data)
herr_t ret_value;
/* Don't clear the error stack! :-) */
- FUNC_ENTER_API_NOCLEAR(H5Ewalk, FAIL);
+ FUNC_ENTER_API_NOCLEAR(H5Ewalk, FAIL)
H5TRACE3("e","Edxx",direction,func,client_data);
ret_value = H5E_walk (direction, func, client_data);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -551,7 +558,7 @@ H5E_walk_cb(int n, H5E_error_t *err_desc, void *client_data)
const char *min_str = NULL;
const int indent = 2;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_walk_cb);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_walk_cb)
/*NO TRACE*/
/* Check arguments */
@@ -571,7 +578,7 @@ H5E_walk_cb(int n, H5E_error_t *err_desc, void *client_data)
fprintf (stream, "%*sminor(%02d): %s\n",
indent*2, "", err_desc->min_num, min_str);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
}
@@ -605,15 +612,14 @@ H5Eget_major (H5E_major_t n)
* traversal and adding/removing entries as the result of an
* error would most likely mess things up.
*/
- FUNC_ENTER_API_NOINIT(H5Eget_major);
+ FUNC_ENTER_API_NOINIT(H5Eget_major)
- for (i=0; i<NELMTS (H5E_major_mesg_g); i++) {
+ for (i=0; i<NELMTS (H5E_major_mesg_g); i++)
if (H5E_major_mesg_g[i].error_code==n)
- HGOTO_DONE(H5E_major_mesg_g[i].str);
- }
+ HGOTO_DONE(H5E_major_mesg_g[i].str)
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -647,15 +653,14 @@ H5Eget_minor (H5E_minor_t n)
* traversal and adding/removing entries as the result of an
* error would most likely mess things up.
*/
- FUNC_ENTER_API_NOINIT(H5Eget_minor);
+ FUNC_ENTER_API_NOINIT(H5Eget_minor)
- for (i=0; i<NELMTS (H5E_minor_mesg_g); i++) {
+ for (i=0; i<NELMTS (H5E_minor_mesg_g); i++)
if (H5E_minor_mesg_g[i].error_code==n)
- HGOTO_DONE(H5E_minor_mesg_g[i].str);
- }
+ HGOTO_DONE(H5E_minor_mesg_g[i].str)
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -694,7 +699,7 @@ H5E_push(H5E_major_t maj_num, H5E_minor_t min_num, const char *function_name,
* HERROR(). HERROR() is called by HRETURN_ERROR() which could
* be called by FUNC_ENTER().
*/
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_push);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_push)
/*
* Don't fail if arguments are bad. Instead, substitute some default
@@ -718,7 +723,7 @@ H5E_push(H5E_major_t maj_num, H5E_minor_t min_num, const char *function_name,
estack->nused++;
}
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
}
@@ -750,13 +755,13 @@ H5Epush(const char *file, const char *func, unsigned line, H5E_major_t maj,
{
herr_t ret_value;
- FUNC_ENTER_API(H5Epush, FAIL);
+ FUNC_ENTER_API(H5Epush, FAIL)
H5TRACE6("e","ssIuEjEns",file,func,line,maj,min,str);
ret_value = H5E_push(maj, min, func, file, line, str);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -780,12 +785,12 @@ H5E_clear(void)
H5E_t *estack = H5E_get_my_stack ();
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5E_clear, FAIL);
+ FUNC_ENTER_NOAPI(H5E_clear, FAIL)
if (estack) estack->nused = 0;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -815,7 +820,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5E_walk (H5E_direction_t direction, H5E_walk_t func, void *client_data)
{
H5E_t *estack = H5E_get_my_stack ();
@@ -823,7 +828,7 @@ H5E_walk (H5E_direction_t direction, H5E_walk_t func, void *client_data)
herr_t status;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5E_walk, FAIL);
+ FUNC_ENTER_NOAPI(H5E_walk, FAIL)
/* check args, but rather than failing use some default value */
if (direction!=H5E_WALK_UPWARD && direction!=H5E_WALK_DOWNWARD) {
@@ -843,6 +848,6 @@ H5E_walk (H5E_direction_t direction, H5E_walk_t func, void *client_data)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index ebfec54..df08fea 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -26,6 +26,27 @@
#define H5E_NSLOTS 32 /*number of slots in an error stack */
/*
+ * The list of error messages in the system is kept as an array of
+ * error_code/message pairs, one for major error numbers and another for
+ * minor error numbers.
+ */
+typedef struct H5E_major_mesg_t {
+ H5E_major_t error_code;
+ const char *str;
+} H5E_major_mesg_t;
+
+typedef struct H5E_minor_mesg_t {
+ H5E_minor_t error_code;
+ const char *str;
+} H5E_minor_mesg_t;
+
+/* An error stack */
+typedef struct H5E_t {
+ int nused; /*num slots currently used in stack */
+ H5E_error_t slot[H5E_NSLOTS]; /*array of error records */
+} H5E_t;
+
+/*
* HERROR macro, used to facilitate error reporting between a FUNC_ENTER()
* and a FUNC_LEAVE() within a function body. The arguments are the major
* error number, the minor error number, and a description of the error.
@@ -47,6 +68,8 @@
* "done:" label. The arguments are
* the major error number, the minor error number, a return value, and a
* description of the error.
+ * (This macro can also be used to push an error and set the return value
+ * without jumping to any labels)
*/
#define HDONE_ERROR(maj, min, ret_val, str) { \
HCOMMON_ERROR (maj, min, str); \
@@ -62,7 +85,7 @@
*/
#define HGOTO_ERROR(maj, min, ret_val, str) { \
HCOMMON_ERROR (maj, min, str); \
- HGOTO_DONE (ret_val); \
+ HGOTO_DONE (ret_val) \
}
/*
@@ -73,37 +96,15 @@
*/
#define HGOTO_DONE(ret_val) {ret_value = ret_val; goto done;}
-/*
- * The list of error messages in the system is kept as an array of
- * error_code/message pairs, one for major error numbers and another for
- * minor error numbers.
- */
-typedef struct H5E_major_mesg_t {
- H5E_major_t error_code;
- const char *str;
-} H5E_major_mesg_t;
-
-typedef struct H5E_minor_mesg_t {
- H5E_minor_t error_code;
- const char *str;
-} H5E_minor_mesg_t;
-
-/* An error stack */
-typedef struct H5E_t {
- int nused; /*num slots currently used in stack */
- H5E_error_t slot[H5E_NSLOTS]; /*array of error records */
-} H5E_t;
-
H5_DLLVAR const hbool_t H5E_clearable_g;/*safe to call H5E_clear() on enter?*/
H5_DLLVAR herr_t (*H5E_auto_g)(void *client_data);
H5_DLLVAR void *H5E_auto_data_g;
+/* Library-private functions defined in H5E package */
H5_DLL herr_t H5E_push (H5E_major_t maj_num, H5E_minor_t min_num,
const char *func_name, const char *file_name,
unsigned line, const char *desc);
H5_DLL herr_t H5E_clear (void);
-H5_DLL herr_t H5E_walk (H5E_direction_t dir, H5E_walk_t func,
- void *client_data);
#ifdef H5_HAVE_PARALLEL
/*
diff --git a/src/H5F.c b/src/H5F.c
index c68c83b..85d5c99 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -14,6 +14,9 @@
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5F_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5F_mask
@@ -45,11 +48,6 @@
#include "H5FDstdio.h" /* Standard C buffered I/O */
#include "H5FDstream.h" /*in-memory files streamed via sockets */
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5F_init_interface
-static herr_t H5F_init_interface(void);
-
/* Struct only used by functions H5F_get_objects and H5F_get_objects_cb */
typedef struct H5F_olist_t {
H5I_type_t obj_type; /* Type of object to look for */
@@ -64,13 +62,16 @@ typedef struct H5F_olist_t {
static H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id,
hid_t fapl_id, hid_t dxpl_id);
static herr_t H5F_close(H5F_t *f);
-static herr_t H5F_close_all(void);
#ifdef NOT_YET
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 herr_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);
+static herr_t H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent);
+
static H5F_t *H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id);
static herr_t H5F_dest(H5F_t *f, hid_t dxpl_id);
static herr_t H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags);
@@ -85,9 +86,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
@@ -426,13 +424,13 @@ H5F_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_term_interface)
- if (interface_initialize_g) {
- if ((n=H5I_nmembers(H5I_FILE))) {
- H5F_close_all();
+ if (H5_interface_initialize_g) {
+ if ((n=H5I_nmembers(H5I_FILE))!=0) {
+ H5I_clear_group(H5I_FILE, FALSE);
} else if (0==(n=H5I_nmembers(H5I_FILE_CLOSING))) {
H5I_destroy_group(H5I_FILE);
H5I_destroy_group(H5I_FILE_CLOSING);
- interface_initialize_g = 0;
+ H5_interface_initialize_g = 0;
n = 1; /*H5I*/
}
}
@@ -652,39 +650,6 @@ done:
}
#endif /* NOT_YET */
-
-/*-------------------------------------------------------------------------
- * Function: H5F_close_all
- *
- * Purpose: Close all open files. Any file which has open object headers
- * will be moved from the H5I_FILE group to the H5I_FILE_CLOSING
- * group.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Friday, February 19, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5F_close_all(void)
-{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5F_close_all, FAIL);
-
- if (H5I_clear_group(H5I_FILE, FALSE)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "unable to close one or more files");
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
-
#ifdef NOT_YET
/*--------------------------------------------------------------------------
@@ -1595,7 +1560,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)) {
@@ -1734,37 +1702,16 @@ done:
static H5F_t *
H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id)
{
- H5F_t *file=NULL; /*the success return value */
- H5F_t *ret_value; /*actual return value */
- H5F_file_t *shared=NULL; /*shared part of `file' */
- H5FD_t *lf=NULL; /*file driver part of `shared' */
- uint8_t buf[256]; /*temporary I/O buffer */
- const uint8_t *p; /*ptr into temp I/O buffer */
- uint8_t *q; /*ptr into temp I/O buffer */
- size_t fixed_size=24; /*fixed sizeof superblock */
- size_t variable_size; /*variable sizeof superblock */
- size_t driver_size; /*size of driver info block */
- H5G_entry_t root_ent; /*root symbol table entry */
- haddr_t eof; /*end of file address */
- haddr_t stored_eoa; /*relative end-of-addr in file */
- unsigned tent_flags; /*tentative flags */
- char driver_name[9]; /*file driver name/version */
- H5FD_class_t *drvr; /* File driver class info */
- hbool_t driver_has_cmp; /*`cmp' callback defined? */
- hsize_t userblock_size = 0;
- unsigned super_vers; /* Superblock version # */
- unsigned freespace_vers; /* File freespace version # */
- unsigned obj_dir_vers;
- unsigned share_head_vers;
- size_t sizeof_addr = 0;
- size_t sizeof_size = 0;
- unsigned sym_leaf_k = 0;
- unsigned btree_k[H5B_NUM_BTREE_ID]; /* B-tree internal node 'K' values */
- H5P_genplist_t *c_plist; /* File creation property list */
- H5P_genplist_t *a_plist; /* File access property list */
- H5F_close_degree_t fc_degree; /* File close degree */
- unsigned chksum; /* Checksum temporary variable */
- unsigned i; /* Index variable */
+ H5F_t *file = NULL; /*the success return value */
+ H5F_file_t *shared = NULL; /*shared part of `file' */
+ H5FD_t *lf = NULL; /*file driver part of `shared' */
+ H5G_entry_t root_ent; /*root symbol table entry */
+ unsigned tent_flags; /*tentative flags */
+ H5FD_class_t *drvr; /*file driver class info */
+ 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; /*actual return value */
FUNC_ENTER_NOAPI(H5F_open, NULL)
@@ -1807,8 +1754,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
@@ -1882,10 +1829,6 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
file->intent = flags;
file->name = H5MM_xstrdup(name);
- /* Get the shared file creation property list */
- if(NULL == (c_plist = H5I_object(shared->fcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "can't get property list");
-
/*
* Read or write the file superblock, depending on whether the file is
* empty or not.
@@ -1896,232 +1839,29 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
* to create & write the superblock.
*/
- /*
- * The superblock starts immediately after the user-defined header,
- * which we have already insured is a proper size. The base address
- * is set to the same thing as the superblock for now.
- */
- if(H5P_get(c_plist, H5F_CRT_USER_BLOCK_NAME, &userblock_size) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get user block size");
- shared->super_addr = userblock_size;
- shared->base_addr = shared->super_addr;
- shared->consist_flags = 0x03;
-
- if (H5F_flush(file, dxpl_id, H5F_SCOPE_LOCAL, H5F_FLUSH_ALLOC_ONLY) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to write file superblock");
+ /* Initialize information about the superblock and allocate space for it */
+ if (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 */
if (H5G_mkroot(file, dxpl_id, NULL)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group")
- } else if (1==shared->nrefs) {
- /* 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 (H5FD_set_eoa(lf, shared->super_addr+fixed_size)<0 ||
- H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, shared->super_addr, fixed_size, buf)<0)
- HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock");
-
- /* Signature, already checked */
- p = buf + H5F_SIGNATURE_LEN;
-
- /* Superblock version */
- super_vers = *p++;
- if(super_vers>HDF5_SUPERBLOCK_VERSION_MAX)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad superblock version number");
- if(H5P_set(c_plist, H5F_CRT_SUPER_VERS_NAME, &super_vers) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, "unable to set superblock version");
-
- /* Freespace version */
- freespace_vers = *p++;
- if(HDF5_FREESPACE_VERSION != freespace_vers)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad free space version number");
- if(H5P_set(c_plist, H5F_CRT_FREESPACE_VERS_NAME, &freespace_vers)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, "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, NULL, "bad object directory version number");
- if(H5P_set(c_plist, H5F_CRT_OBJ_DIR_VERS_NAME, &obj_dir_vers) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, "unable to set object directory version");
-
- /* Skip over reserved byte */
- p++;
-
- /* Shared header version number */
- share_head_vers = *p++;
- if(HDF5_SHAREDHEADER_VERSION != share_head_vers)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "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, NULL, "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, NULL, "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, NULL, "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, NULL, "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, NULL, "unable to set byte number for object size");
- shared->sizeof_size=sizeof_size; /* Keep a local copy also */
-
- /* Skip over reserved byte */
- p++;
-
- /* Various B-tree sizes */
- UINT16DECODE(p, sym_leaf_k);
- if(sym_leaf_k < 1)
- HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, NULL, "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, NULL, "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, NULL, "unable to get rank for btree internal nodes");
- UINT16DECODE(p, btree_k[H5B_SNODE_ID]);
- if(btree_k[H5B_SNODE_ID] < 1)
- HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, NULL, "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.
- */
-
- /* File consistency flags. Not really used yet */
- UINT32DECODE(p, shared->consist_flags);
- assert((hsize_t)(p-buf) == fixed_size);
-
- /* Decode the variable-length part of the superblock... */
- variable_size = (super_vers>0 ? 4 : 0) + /* Potential indexed storage B-tree internal 'K' value */
- H5F_SIZEOF_ADDR(file) + /*base addr*/
- H5F_SIZEOF_ADDR(file) + /*global free list*/
- H5F_SIZEOF_ADDR(file) + /*end-of-address*/
- H5F_SIZEOF_ADDR(file) + /*reserved address*/
- H5G_SIZEOF_ENTRY(file); /*root group ptr*/
- assert((fixed_size+variable_size)<=sizeof(buf));
- if (H5FD_set_eoa(lf, shared->super_addr+fixed_size+variable_size)<0 ||
- H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, shared->super_addr+fixed_size, variable_size, &buf[fixed_size])<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read superblock");
-
- /* If the superblock version # is greater than 0, read in the indexed storage B-tree internal 'K' value */
- if(super_vers>0) {
- UINT16DECODE(p, btree_k[H5B_ISTORE_ID]);
-
- /* Skip over reserved bytes */
- p+=2;
- } /* end if */
- 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, NULL, "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 */
-
- H5F_addr_decode(file, &p, &(shared->base_addr)/*out*/);
- H5F_addr_decode(file, &p, &(shared->freespace_addr)/*out*/);
- H5F_addr_decode(file, &p, &stored_eoa/*out*/);
- H5F_addr_decode(file, &p, &(shared->driver_addr)/*out*/);
- if (H5G_ent_decode(file, &p, &root_ent/*out*/)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root symbol entry");
-
- /* Check if superblock address is different from base address and
- * adjust base address and "end of address" address if so.
+ /* Write the superblock to the file */
+ /* (This must be after the root group is created, since the root
+ * group's symbol table entry is part of the superblock)
*/
- if(!H5F_addr_eq(shared->super_addr,shared->base_addr)) {
- /* Check if the superblock moved earlier in the file */
- if(H5F_addr_lt(shared->super_addr,shared->base_addr))
- stored_eoa -= (shared->base_addr-shared->super_addr);
- /* The superblock moved later in the file */
- else
- stored_eoa += (shared->super_addr-shared->base_addr);
- shared->base_addr = shared->super_addr;
- } /* end if */
-
- /* 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)] ^= buf[i];
-
- /* Set the super block checksum */
- shared->super_chksum=chksum;
-
- /* Decode the optional driver information block */
- if (H5F_addr_defined(shared->driver_addr)) {
- haddr_t drv_addr = shared->base_addr + shared->driver_addr;
+ if (H5F_write_superblock(file, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to write file superblock")
- if (H5FD_set_eoa(lf, drv_addr+16)<0 ||
- H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, drv_addr, 16, buf)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read driver information block");
- p = buf;
-
- /* Version number */
- if (HDF5_DRIVERINFO_VERSION!=*p++)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "bad driver information block version number");
-
- /* Reserved */
- p += 3;
-
- /* Driver info size */
- UINT32DECODE(p, driver_size);
-
- /* Driver name and/or version */
- HDstrncpy(driver_name, (const char *)p, 8);
- driver_name[8] = '\0';
-
- /* Read driver information and decode */
- assert((driver_size+16)<=sizeof(buf));
- if (H5FD_set_eoa(lf, drv_addr+16+driver_size)<0 ||
- H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, drv_addr+16, driver_size, &buf[16])<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read file driver information");
- if (H5FD_sb_decode(lf, driver_name, &buf[16])<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to decode driver information");
-
- /* 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)] ^= buf[i];
-
- /* Set the driver info block checksum */
- shared->drvr_chksum=chksum;
+ } else if (1 == shared->nrefs) {
+ /* Read the superblock if it hasn't been read before. */
+ if (H5F_read_superblock(file, dxpl_id, &root_ent) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock")
- } /* end if */
-
/* Make sure we can open the root group */
if (H5G_mkroot(file, dxpl_id, &root_ent)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root group");
-
- /*
- * The user-defined data is the area of the file before the base
- * address.
- */
- if(H5P_set(c_plist, H5F_CRT_USER_BLOCK_NAME, &(shared->base_addr)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, "unable to set usr block size");
-
- /*
- * Make sure that the data is not truncated. One case where this is
- * possible is if the first file of a family of files was opened
- * individually.
- */
- if (HADDR_UNDEF==(eof=H5FD_get_eof(lf)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to determine file size");
- if (eof<stored_eoa)
- HGOTO_ERROR(H5E_FILE, H5E_TRUNCATED, NULL, "truncated file");
-
- /*
- * Tell the file driver how much address space has already been
- * allocated so that it knows how to allocate additional memory.
- */
- if (H5FD_set_eoa(lf, stored_eoa)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to set end-of-address marker for file");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root group")
}
/*
@@ -2443,6 +2183,537 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5F_read_superblock
+ *
+ * Purpose: Reads the superblock from the file or from the BUF. If
+ * ADDR is a valid address, then it reads it from the file.
+ * If not, then BUF must be non-NULL for it to read from the
+ * BUF.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Bill Wendling
+ * wendling@ncsa.uiuc.edu
+ * Sept 12, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent)
+{
+ haddr_t stored_eoa; /*relative end-of-addr in file */
+ haddr_t eof; /*end of file address */
+ uint8_t *q; /*ptr into temp I/O buffer */
+ size_t sizeof_addr = 0;
+ size_t sizeof_size = 0;
+ const size_t fixed_size = 24; /*fixed sizeof superblock */
+ unsigned sym_leaf_k = 0;
+ size_t variable_size; /*variable sizeof superblock */
+ unsigned btree_k[H5B_NUM_BTREE_ID]; /* B-tree internal node 'K' values */
+ H5F_file_t *shared = NULL; /* shared part of `file' */
+ H5FD_t *lf = NULL; /* file driver part of `shared' */
+ uint8_t *p; /* Temporary pointer into encoding buffers */
+ unsigned i; /* Index variable */
+ unsigned chksum; /* Checksum temporary variable */
+ size_t driver_size; /* Size of driver info block, in bytes */
+ char driver_name[9]; /* Name of driver, for driver info block */
+ unsigned super_vers; /* Super block version */
+ unsigned freespace_vers; /* Freespace info version */
+ unsigned obj_dir_vers; /* Object header info version */
+ unsigned share_head_vers; /* Shared header info version */
+ uint8_t buf[H5F_SUPERBLOCK_SIZE]; /* Local buffer */
+ H5P_genplist_t *c_plist; /* File creation property list */
+ herr_t ret_value = SUCCEED;
+
+ /* Decoding */
+ FUNC_ENTER_NOAPI(H5F_read_superblock, FAIL)
+
+ /* Short cuts */
+ shared = f->shared;
+ lf = shared->lf;
+
+ /* Get the shared file creation property list */
+ if (NULL == (c_plist = H5I_object(shared->fcpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+
+ /* 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, FAIL, "unable to find file signature")
+ if (H5FD_set_eoa(lf, shared->super_addr + fixed_size) < 0 ||
+ H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, shared->super_addr, fixed_size, buf) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "unable to read superblock")
+
+ /* Signature, already checked */
+ p = buf + H5F_SIGNATURE_LEN;
+
+ /* 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)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set object directory version")
+
+ /* Skip over reserved byte */
+ p++;
+
+ /* 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 */
+ p++;
+
+ /* Various B-tree sizes */
+ UINT16DECODE(p, sym_leaf_k);
+ 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] == 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.
+ */
+
+ /* File consistency flags. Not really used yet */
+ UINT32DECODE(p, shared->consist_flags);
+ assert(((size_t)(p - buf)) == fixed_size);
+
+ /* Decode the variable-length part of the superblock... */
+ variable_size = (super_vers>0 ? 4 : 0) + /* Potential indexed storage B-tree internal 'K' value */
+ H5F_SIZEOF_ADDR(f) + /*base addr*/
+ H5F_SIZEOF_ADDR(f) + /*global free list*/
+ H5F_SIZEOF_ADDR(f) + /*end-of-address*/
+ H5F_SIZEOF_ADDR(f) + /*reserved address*/
+ H5G_SIZEOF_ENTRY(f); /*root group ptr*/
+ assert(fixed_size + variable_size <= sizeof(buf));
+ if (H5FD_set_eoa(lf, shared->super_addr + fixed_size+variable_size) < 0 ||
+ H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, shared->super_addr + fixed_size, variable_size, p) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read superblock")
+
+ /*
+ * If the superblock version # is greater than 0, read in the indexed
+ * storage B-tree internal 'K' value
+ */
+ 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;
+
+ /* 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) * (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")
+
+ /*
+ * Check if superblock address is different from base address and
+ * adjust base address and "end of address" address if so.
+ */
+ if (!H5F_addr_eq(shared->super_addr,shared->base_addr)) {
+ /* Check if the superblock moved earlier in the file */
+ if (H5F_addr_lt(shared->super_addr, shared->base_addr))
+ stored_eoa -= (shared->base_addr - shared->super_addr);
+ else
+ /* The superblock moved later in the file */
+ stored_eoa += (shared->super_addr - shared->base_addr);
+
+ shared->base_addr = shared->super_addr;
+ } /* end if */
+
+ /* 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)] ^= buf[i];
+
+ /* Set the super block checksum */
+ shared->super_chksum = chksum;
+
+ /* Decode the optional driver information block */
+ if (H5F_addr_defined(shared->driver_addr)) {
+ haddr_t drv_addr = shared->base_addr + shared->driver_addr;
+ uint8_t dbuf[H5F_DRVINFOBLOCK_SIZE]; /* Local buffer */
+
+ if (H5FD_set_eoa(lf, drv_addr + 16) < 0 ||
+ H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, drv_addr, 16, dbuf) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read driver information block")
+ p = dbuf;
+
+ /* Version number */
+ if (HDF5_DRIVERINFO_VERSION != *p++)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "bad driver information block version number")
+
+ p += 3; /* reserved */
+
+ /* Driver info size */
+ UINT32DECODE(p, driver_size);
+
+ /* Driver name and/or version */
+ HDstrncpy(driver_name, (const char *)p, 8);
+ driver_name[8] = '\0';
+ p += 8; /* advance past name/version */
+
+ /* Read driver information and decode */
+ assert((driver_size + 16) <= sizeof(dbuf));
+ if (H5FD_set_eoa(lf, drv_addr + 16 + driver_size) < 0 ||
+ H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, drv_addr+16, driver_size, p) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read file driver information")
+
+ if (H5FD_sb_decode(lf, driver_name, p) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to decode driver information")
+
+ /* 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)] ^= dbuf[i];
+
+ /* Set the driver info block checksum */
+ shared->drvr_chksum = chksum;
+ } /* end if */
+
+ /*
+ * The user-defined data is the area of the file before the base
+ * address.
+ */
+ if (H5P_set(c_plist, H5F_CRT_USER_BLOCK_NAME, &shared->base_addr) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set usr block size")
+
+ /*
+ * Make sure that the data is not truncated. One case where this is
+ * possible is if the first file of a family of files was opened
+ * individually.
+ */
+ if (HADDR_UNDEF == (eof = H5FD_get_eof(lf)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size")
+ if (eof < stored_eoa)
+ HGOTO_ERROR(H5E_FILE, H5E_TRUNCATED, FAIL, "truncated file")
+
+ /*
+ * Tell the file driver how much address space has already been
+ * allocated so that it knows how to allocate additional memory.
+ */
+ if (H5FD_set_eoa(lf, stored_eoa) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to set end-of-address marker for file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_init_superblock
+ *
+ * Purpose: Allocates the superblock for the file and initializes
+ * information about the superblock in memory. Does not write
+ * any superblock information to the file.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Sept 15, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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 */
+ size_t driver_size; /* Size of driver info block (bytes)*/
+ unsigned super_vers; /* Super block version */
+ haddr_t addr; /* Address of superblock */
+ H5P_genplist_t *plist; /* Property list */
+ herr_t ret_value=SUCCEED;
+
+ /* Encoding */
+ FUNC_ENTER_NOAPI(H5F_init_superblock, FAIL)
+
+ /* Get the shared file creation property list */
+ if (NULL == (plist = H5I_object(f->shared->fcpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+
+ /*
+ * The superblock starts immediately after the user-defined
+ * header, which we have already insured is a proper size. The
+ * base address is set to the same thing as the superblock for
+ * now.
+ */
+ if(H5P_get(plist, H5F_CRT_USER_BLOCK_NAME, &userblock_size) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get user block size")
+ f->shared->super_addr = userblock_size;
+ f->shared->base_addr = f->shared->super_addr;
+ f->shared->consist_flags = 0x03;
+
+ /* Grab superblock version from property list */
+ if (H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, &super_vers) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get super block version")
+
+ /* Compute the size of the superblock */
+ superblock_size=H5F_SIGNATURE_LEN /* Signature length (8 bytes) */
+ + 16 /* Length of required fixed-size portion */
+ + ((super_vers>0) ? 4 : 0) /* Version specific fixed-size portion */
+ + 4 * H5F_sizeof_addr(f) /* Variable-sized addresses */
+ + H5G_SIZEOF_ENTRY(f); /* Size of root group symbol table entry */
+
+ /* Compute the size of the driver information block. */
+ H5_ASSIGN_OVERFLOW(driver_size, H5FD_sb_size(f->shared->lf), hsize_t, size_t);
+ if (driver_size > 0)
+ driver_size += 16; /* Driver block header */
+
+ /*
+ * Allocate space for the userblock, superblock, and driver info
+ * block. We do it with one allocation request because the
+ * userblock and superblock need to be at the beginning of the
+ * file and only the first allocation request is required to
+ * return memory at format address zero.
+ */
+
+ H5_CHECK_OVERFLOW(f->shared->base_addr, haddr_t, hsize_t);
+ addr = H5FD_alloc(f->shared->lf, H5FD_MEM_SUPER, dxpl_id,
+ ((hsize_t)f->shared->base_addr + superblock_size + driver_size));
+
+ if (HADDR_UNDEF == addr)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL,
+ "unable to allocate file space for userblock and/or superblock")
+
+ if (0 != addr)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL,
+ "file driver failed to allocate userblock and/or superblock at address zero")
+
+ /*
+ * The file driver information block begins immediately after the
+ * superblock.
+ */
+ if (driver_size > 0)
+ f->shared->driver_addr = superblock_size;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F_init_superblock() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_write_superblock
+ *
+ * Purpose: Writes (and optionally allocates) the superblock for the file.
+ * If BUF is non-NULL, then write the serialized superblock
+ * information into it. It should be a buffer of size
+ * H5F_SUPERBLOCK_SIZE + H5F_DRVINFOBLOCK_SIZE or larger.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Bill Wendling
+ * wendling@ncsa.uiuc.edu
+ * Sept 12, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5F_write_superblock(H5F_t *f, hid_t dxpl_id)
+{
+ uint8_t sbuf[H5F_SUPERBLOCK_SIZE]; /* Superblock encoding buffer */
+ uint8_t dbuf[H5F_DRVINFOBLOCK_SIZE];/* Driver info block encoding buffer*/
+ uint8_t *p = NULL; /* Ptr into encoding buffers */
+ unsigned i; /* Index variable */
+ unsigned chksum; /* Checksum temporary variable */
+ size_t superblock_size; /* Size of superblock, in bytes */
+ size_t driver_size; /* Size of driver info block (bytes)*/
+ char driver_name[9]; /* Name of driver, for driver info block */
+ unsigned super_vers; /* Super block version */
+ unsigned freespace_vers; /* Freespace info version */
+ unsigned obj_dir_vers; /* Object header info version */
+ unsigned share_head_vers; /* Shared header info version */
+ H5P_genplist_t *plist; /* Property list */
+ herr_t ret_value = SUCCEED;
+
+ /* Encoding */
+ FUNC_ENTER_NOAPI(H5F_write_superblock, FAIL)
+
+ /* Get the shared file creation property list */
+ if (NULL == (plist = H5I_object(f->shared->fcpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Grab values from property list */
+ if (H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, &super_vers) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get super block version")
+ if (H5P_get(plist, H5F_CRT_FREESPACE_VERS_NAME, &freespace_vers) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get free space version")
+ if (H5P_get(plist, H5F_CRT_OBJ_DIR_VERS_NAME, &obj_dir_vers) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to 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, "unable to get shared-header format version")
+
+ /* Encode the file super block */
+ p = sbuf;
+ HDmemcpy(p, H5F_SIGNATURE, H5F_SIGNATURE_LEN);
+ p += H5F_SIGNATURE_LEN;
+ *p++ = (uint8_t)super_vers;
+ *p++ = (uint8_t)freespace_vers;
+ *p++ = (uint8_t)obj_dir_vers;
+ *p++ = 0; /* reserved*/
+ *p++ = (uint8_t)share_head_vers;
+ assert (H5F_SIZEOF_ADDR(f) <= 255);
+ *p++ = (uint8_t)H5F_SIZEOF_ADDR(f);
+ assert (H5F_SIZEOF_SIZE(f) <= 255);
+ *p++ = (uint8_t)H5F_SIZEOF_SIZE(f);
+ *p++ = 0; /* reserved */
+ UINT16ENCODE(p, f->shared->sym_leaf_k);
+ UINT16ENCODE(p, f->shared->btree_k[H5B_SNODE_ID]);
+ UINT32ENCODE(p, f->shared->consist_flags);
+
+ /*
+ * Versions of the superblock >0 have the indexed storage B-tree
+ * internal 'K' value stored
+ */
+ if (super_vers > 0) {
+ UINT16ENCODE(p, f->shared->btree_k[H5B_ISTORE_ID]);
+ *p++ = 0; /*reserved */
+ *p++ = 0; /*reserved */
+ }
+
+ H5F_addr_encode(f, &p, f->shared->base_addr);
+ 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")
+
+ H5_ASSIGN_OVERFLOW(superblock_size, p - sbuf, int, size_t);
+
+ /* Double check we didn't overrun the block (unlikely) */
+ assert(superblock_size <= sizeof(sbuf));
+
+ /* Encode the driver information block. */
+ H5_ASSIGN_OVERFLOW(driver_size, H5FD_sb_size(f->shared->lf), hsize_t, size_t);
+
+ if (driver_size > 0) {
+ driver_size += 16; /* Driver block header */
+
+ /* Double check we didn't overrun the block (unlikely) */
+ assert(driver_size <= sizeof(dbuf));
+
+ /* Encode the driver information block */
+ p = dbuf;
+
+ *p++ = HDF5_DRIVERINFO_VERSION; /* Version */
+ *p++ = 0; /* reserved */
+ *p++ = 0; /* reserved */
+ *p++ = 0; /* reserved */
+
+ /* Driver info size, excluding header */
+ UINT32ENCODE(p, driver_size - 16);
+
+ /* Encode driver-specific data */
+ if (H5FD_sb_encode(f->shared->lf, driver_name, dbuf + 16) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information")
+
+ /* Driver name */
+ HDmemcpy(dbuf + 8, driver_name, 8);
+ } /* end if */
+
+ /* Compute super block checksum */
+ assert(sizeof(chksum) == sizeof(f->shared->super_chksum));
+
+ for (p = (uint8_t *)&chksum, chksum = 0, i = 0; i < superblock_size; ++i)
+ p[i % sizeof(f->shared->super_chksum)] ^= sbuf[i];
+
+ /* Compare with current checksums */
+ if (chksum != f->shared->super_chksum) {
+ /* Write superblock */
+ if (H5FD_write(f->shared->lf, H5FD_MEM_SUPER, dxpl_id,
+ f->shared->super_addr, superblock_size, sbuf) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write superblock")
+
+ /* Update checksum information if different */
+ f->shared->super_chksum = chksum;
+ } /* end if */
+
+ /* Check for driver info block */
+ if (HADDR_UNDEF != f->shared->driver_addr) {
+ /* Compute driver info block checksum */
+ assert(sizeof(chksum) == sizeof(f->shared->drvr_chksum));
+
+ for (p = (uint8_t *)&chksum, chksum = 0, i = 0; i < driver_size; ++i)
+ p[i % sizeof(f->shared->drvr_chksum)] ^= dbuf[i];
+
+ /* Compare with current checksums */
+ if (chksum != f->shared->drvr_chksum) {
+ /* Write driver information block */
+ if (H5FD_write(f->shared->lf, H5FD_MEM_SUPER, dxpl_id,
+ f->shared->base_addr + f->shared->driver_addr, driver_size, dbuf) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write driver information block")
+
+ /* Update checksum information if different */
+ f->shared->drvr_chksum = chksum;
+ } /* end if */
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_flush
*
* Purpose: Flushes (and optionally invalidates) cached data plus the
@@ -2499,20 +2770,8 @@ done:
static herr_t
H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags)
{
- uint8_t sbuf[H5F_SUPERBLOCK_SIZE]; /* Superblock encoding buffer */
- uint8_t dbuf[H5F_DRVINFOBLOCK_SIZE]; /* Driver info block encoding buffer */
- uint8_t *p=NULL; /* Temporary pointer into encoding buffers */
unsigned nerrors = 0; /* Errors from nested flushes */
unsigned i; /* Index variable */
- unsigned chksum; /* Checksum temporary variable */
- size_t superblock_size;/* Size of superblock, in bytes */
- size_t driver_size; /* Size of driver info block, in bytes */
- char driver_name[9]; /* Name of driver, for driver info block */
- unsigned super_vers; /* Super block version */
- unsigned freespace_vers; /* Freespace info version */
- unsigned obj_dir_vers; /* Object header info version */
- unsigned share_head_vers;/* Shared header info version */
- H5P_genplist_t *plist; /* Property list */
herr_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5F_flush)
@@ -2540,220 +2799,57 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags)
if (H5F_SCOPE_DOWN == scope)
for (i = 0; i < f->mtab.nmounts; i++)
- /* Flush but don't pass down the ALLOC_ONLY flag if there */
- if (H5F_flush(f->mtab.child[i].file, dxpl_id, scope,
- flags & ~H5F_FLUSH_ALLOC_ONLY) < 0)
+ if (H5F_flush(f->mtab.child[i].file, dxpl_id, scope, flags) < 0)
nerrors++;
- /* Avoid flushing buffers & caches when alloc_only set */
- if ((flags & H5F_FLUSH_ALLOC_ONLY) == 0) {
- /* flush any cached dataset storage raw data */
- if (H5D_flush(f, dxpl_id, flags) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush dataset cache");
-
- /*
- * If we are invalidating everything (which only happens just
- * before the file closes), release the unused portion of the
- * metadata and "small data" blocks back to the free lists in the
- * file.
- */
- if (flags & H5F_FLUSH_INVALIDATE) {
-
- if (f->shared->lf->feature_flags & H5FD_FEAT_AGGREGATE_METADATA) {
- /* Return the unused portion of the metadata block to a free list */
- if (f->shared->lf->eoma != 0)
- if (H5FD_free(f->shared->lf, H5FD_MEM_DEFAULT, dxpl_id,
- f->shared->lf->eoma,
- f->shared->lf->cur_meta_block_size) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL,
- "can't free metadata block");
-
- /* Reset metadata block information, just in case */
- f->shared->lf->eoma=0;
- f->shared->lf->cur_meta_block_size=0;
- } /* end if */
-
- if (f->shared->lf->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA) {
- /* Return the unused portion of the "small data" block to a free list */
- if (f->shared->lf->eosda != 0)
- if (H5FD_free(f->shared->lf, H5FD_MEM_DRAW, dxpl_id,
- f->shared->lf->eosda,
- f->shared->lf->cur_sdata_block_size) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL,
- "can't free 'small data' block");
-
- /* Reset "small data" block information, just in case */
- f->shared->lf->eosda=0;
- f->shared->lf->cur_sdata_block_size=0;
- } /* end if */
-
- } /* end if */
-
- /* flush (and invalidate) the entire meta data cache */
- if (H5AC_flush(f, dxpl_id, flags & (H5F_FLUSH_INVALIDATE|H5F_FLUSH_CLEAR_ONLY)) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush meta data cache");
- } /* end if */
-
- /* Get the shared file creation property list */
- if(NULL == (plist = H5I_object(f->shared->fcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
-
- if(H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, &super_vers) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get super block version");
- if(H5P_get(plist, H5F_CRT_FREESPACE_VERS_NAME, &freespace_vers) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get free space version");
- if(H5P_get(plist, H5F_CRT_OBJ_DIR_VERS_NAME, &obj_dir_vers) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to 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, "unable to get shared-header format version");
-
- /* encode the file super block */
- p = sbuf;
- HDmemcpy(p, H5F_SIGNATURE, H5F_SIGNATURE_LEN);
- p += H5F_SIGNATURE_LEN;
- *p++ = super_vers;
- *p++ = freespace_vers;
- *p++ = obj_dir_vers;
- *p++ = 0; /*reserved*/
- *p++ = share_head_vers;
- assert (H5F_SIZEOF_ADDR(f)<=255);
- *p++ = (uint8_t)H5F_SIZEOF_ADDR(f);
- assert (H5F_SIZEOF_SIZE(f)<=255);
- *p++ = (uint8_t)H5F_SIZEOF_SIZE(f);
- *p++ = 0; /*reserved */
- UINT16ENCODE(p, f->shared->sym_leaf_k);
- UINT16ENCODE(p, f->shared->btree_k[H5B_SNODE_ID]);
- UINT32ENCODE(p, f->shared->consist_flags);
-
- /* Versions of the superblock >0 have the indexed storage B-tree internal 'K' value stored */
- if(super_vers>0) {
- UINT16ENCODE(p, f->shared->btree_k[H5B_ISTORE_ID]);
- *p++ = 0; /*reserved */
- *p++ = 0; /*reserved */
- } /* end if */
-
- H5F_addr_encode(f, &p, f->shared->base_addr);
- 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);
- H5G_ent_encode(f, &p, H5G_entof(f->shared->root_grp));
- superblock_size = p-sbuf;
-
- /* Double check we didn't overrun the block (unlikely) */
- assert(superblock_size<=sizeof(sbuf));
+ /* Flush any cached dataset storage raw data */
+ if (H5D_flush(f, dxpl_id, flags) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush dataset cache")
/*
- * Encode the driver information block.
+ * If we are invalidating everything (which only happens just before
+ * the file closes), release the unused portion of the metadata and
+ * "small data" blocks back to the free lists in the file.
*/
- H5_ASSIGN_OVERFLOW(driver_size,H5FD_sb_size(f->shared->lf),hsize_t,size_t);
-
- if (driver_size > 0) {
- driver_size += 16; /*driver block header */
-
- /* Double check we didn't overrun the block (unlikely) */
- assert(driver_size<=sizeof(dbuf));
-
- /* Encode the driver information block */
- p = dbuf;
-
- /* Version */
- *p++ = HDF5_DRIVERINFO_VERSION;
+ if (flags & H5F_FLUSH_INVALIDATE) {
+ if (f->shared->lf->feature_flags & H5FD_FEAT_AGGREGATE_METADATA) {
+ /* Return the unused portion of the metadata block to a free list */
+ if (f->shared->lf->eoma != 0)
+ if (H5FD_free(f->shared->lf, H5FD_MEM_DEFAULT, dxpl_id,
+ f->shared->lf->eoma, f->shared->lf->cur_meta_block_size) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "can't free metadata block")
+
+ /* Reset metadata block information, just in case */
+ f->shared->lf->eoma=0;
+ f->shared->lf->cur_meta_block_size=0;
+ } /* end if */
- /* Reserved*/
- p += 3;
+ if (f->shared->lf->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA) {
+ /* Return the unused portion of the "small data" block to a free list */
+ if (f->shared->lf->eosda != 0)
+ if (H5FD_free(f->shared->lf, H5FD_MEM_DRAW, dxpl_id,
+ f->shared->lf->eosda, f->shared->lf->cur_sdata_block_size) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "can't free 'small data' block")
- /* Driver info size, excluding header */
- UINT32ENCODE(p, driver_size-16);
-
- /* Encode driver-specific data */
- if (H5FD_sb_encode(f->shared->lf, driver_name, dbuf+16)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information");
+ /* Reset "small data" block information, just in case */
+ f->shared->lf->eosda=0;
+ f->shared->lf->cur_sdata_block_size=0;
+ } /* end if */
- /* Driver name */
- HDmemcpy(dbuf+8, driver_name, 8);
} /* end if */
- if (flags & H5F_FLUSH_ALLOC_ONLY) {
- haddr_t addr;
+ /* flush (and invalidate) the entire meta data cache */
+ if (H5AC_flush(f, dxpl_id, flags & (H5F_FLUSH_INVALIDATE | H5F_FLUSH_CLEAR_ONLY)) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush meta data cache")
- /*
- * Allocate space for the userblock, superblock, and driver info
- * block. We do it with one allocation request because the
- * userblock and superblock need to be at the beginning of the
- * file and only the first allocation request is required to
- * return memory at format address zero.
- *
- * Note: This is safe for FPHDF5. We only set H5F_FLUSH_ALLOC_ONLY
- * from the H5F_open function. That function sets it so that only
- * the captain process will actually perform any allocations,
- * which is what we want here. In the H5FD_alloc function, the
- * allocated address is broadcast to the other processes.
- */
- H5_CHECK_OVERFLOW(f->shared->base_addr,haddr_t,hsize_t);
-
- addr = H5FD_alloc(f->shared->lf, H5FD_MEM_SUPER, dxpl_id,
- ((hsize_t)f->shared->base_addr + superblock_size + driver_size));
-
- if (HADDR_UNDEF == addr)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL,
- "unable to allocate file space for userblock and/or superblock");
- if (0 != addr)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL,
- "file driver failed to allocate userblock and/or superblock at address zero");
-
- /*
- * The file driver information block begins immediately after
- * the superblock.
- */
- if (driver_size > 0)
- f->shared->driver_addr = superblock_size;
- } else {
- /* Compute super block checksum */
- assert(sizeof(chksum)==sizeof(f->shared->super_chksum));
-
- for (p=(uint8_t *)&chksum, chksum=0, i=0; i<superblock_size; i++)
- p[i%sizeof(f->shared->super_chksum)] ^= sbuf[i];
+ /* Write the superblock to disk */
+ if (H5F_write_superblock(f, dxpl_id) != SUCCEED)
+ HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "unable to write superblock to file")
- /* Compare with current checksums */
- if (chksum!=f->shared->super_chksum) {
- /* Write superblock */
- if (H5FD_write(f->shared->lf, H5FD_MEM_SUPER, dxpl_id,
- f->shared->super_addr, superblock_size, sbuf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write superblock");
-
- /* Update checksum information if different */
- f->shared->super_chksum=chksum;
- } /* end if */
-
- /* Check for driver info block */
- if (HADDR_UNDEF!=f->shared->driver_addr) {
- /* Compute driver info block checksum */
- assert(sizeof(chksum)==sizeof(f->shared->drvr_chksum));
-
- for(p=(uint8_t *)&chksum, chksum=0, i=0; i<driver_size; i++)
- p[i%sizeof(f->shared->drvr_chksum)] ^= dbuf[i];
-
- /* Compare with current checksums */
- if(chksum!=f->shared->drvr_chksum) {
- /* Write driver information block */
- if (H5FD_write(f->shared->lf, H5FD_MEM_SUPER, dxpl_id,
- f->shared->base_addr + f->shared->driver_addr,
- driver_size, dbuf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
- "unable to write driver information block");
-
- /* Update checksum information if different */
- f->shared->drvr_chksum=chksum;
- } /* end if */
- } /* end if */
- } /* end else */
-
- /* If we're not just allocating... */
- if ((flags & H5F_FLUSH_ALLOC_ONLY) == 0)
- /* ...flush file buffers to disk. */
- if (H5FD_flush(f->shared->lf, dxpl_id,
- (unsigned)((flags & H5F_FLUSH_CLOSING) > 0)) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level flush failed")
+ /* Flush file buffers to disk. */
+ if (H5FD_flush(f->shared->lf, dxpl_id,
+ (unsigned)((flags & H5F_FLUSH_CLOSING) > 0)) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level flush failed")
/* Check flush errors for children - errors are already on the stack */
ret_value = (nerrors ? FAIL : SUCCEED);
@@ -2841,7 +2937,7 @@ H5F_close(H5F_t *f)
for (u=0; u<f->mtab.nmounts; u++) {
f->mtab.child[u].file->mtab.parent = NULL;
if(H5G_close(f->mtab.child[u].group)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close child group")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close child group")
if(H5F_close(f->mtab.child[u].file)<0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close child file")
} /* end if */
@@ -2937,7 +3033,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++)
@@ -2946,7 +3042,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++)
@@ -2955,7 +3051,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++)
@@ -2964,7 +3060,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++)
@@ -2985,21 +3081,18 @@ H5F_close(H5F_t *f)
f->file_id = -1;
/* Only flush at this point if the file will be closed */
- if (closing) {
- /* Dump debugging info */
+ assert(closing);
+ /* Dump debugging info */
#if H5AC_DUMP_STATS_ON_CLOSE
H5AC_stats(f);
#endif /* H5AC_DUMP_STATS_ON_CLOSE */
- /* Only try to flush the file if it was opened with write access */
- if(f->intent&H5F_ACC_RDWR) {
-
- /* Flush and destroy all caches */
- if (H5F_flush(f, H5AC_dxpl_id, H5F_SCOPE_LOCAL,
- H5F_FLUSH_INVALIDATE | H5F_FLUSH_CLOSING) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache");
-
- } /* end if */
+ /* Only try to flush the file if it was opened with write access */
+ if(f->intent&H5F_ACC_RDWR) {
+ /* Flush and destroy all caches */
+ if (H5F_flush(f, H5AC_dxpl_id, H5F_SCOPE_LOCAL,
+ H5F_FLUSH_INVALIDATE | H5F_FLUSH_CLOSING) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
} /* end if */
/*
@@ -3111,7 +3204,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")
@@ -3177,7 +3270,7 @@ H5F_mount(H5G_entry_t *loc, const char *name, H5F_t *child,
done:
if (ret_value<0 && mount_point)
if(H5G_close(mount_point)<0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close mounted group")
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close mounted group")
FUNC_LEAVE_NOAPI(ret_value)
}
@@ -3234,7 +3327,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);
@@ -3257,7 +3350,7 @@ H5F_unmount(H5G_entry_t *loc, const char *name, hid_t dxpl_id)
/* Unmount the child */
parent->mtab.nmounts -= 1;
if(H5G_close(parent->mtab.child[i].group)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close unmounted group")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close unmounted group")
child->mtab.parent = NULL;
if(H5F_close(child)<0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close unmounted file")
@@ -3293,7 +3386,7 @@ H5F_unmount(H5G_entry_t *loc, const char *name, hid_t dxpl_id)
/* Unmount the child */
parent->mtab.nmounts -= 1;
if(H5G_close(parent->mtab.child[md].group)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close unmounted group")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close unmounted group")
parent->mtab.child[md].file->mtab.parent = NULL;
if(H5F_close(parent->mtab.child[md].file)<0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close unmounted file")
@@ -3305,7 +3398,7 @@ H5F_unmount(H5G_entry_t *loc, const char *name, hid_t dxpl_id)
done:
if (mounted)
if(H5G_close(mounted)<0 && ret_value>=0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close group")
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close group")
FUNC_LEAVE_NOAPI(ret_value)
}
@@ -3880,7 +3973,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() */
@@ -3987,7 +4080,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;
@@ -4387,7 +4480,7 @@ H5F_addr_pack(H5F_t UNUSED *f, haddr_t *addr_p/*out*/,
const unsigned long objno[2])
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_addr_pack);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_addr_pack)
assert(f);
assert(objno);
@@ -4398,7 +4491,7 @@ H5F_addr_pack(H5F_t UNUSED *f, haddr_t *addr_p/*out*/,
*addr_p |= ((uint64_t)objno[1]) << (8*sizeof(long));
#endif
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
}
@@ -4513,7 +4606,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 */
@@ -4532,120 +4625,6 @@ 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() */
-
-/*-------------------------------------------------------------------------
- * Function: H5F_debug
- *
- * Purpose: Prints a file header to the specified stream. Each line
- * is indented and the field name occupies the specified width
- * number of characters.
- *
- * Errors:
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 1 1997
- *
- * Modifications:
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
- *
- * Raymond Lu, 2001-10-14
- * Changed to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5F_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE * stream, int indent,
- int fwidth)
-{
- hsize_t userblock_size;
- int super_vers, freespace_vers, obj_dir_vers, share_head_vers;
- H5P_genplist_t *plist; /* Property list */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5F_debug, FAIL);
-
- /* check args */
- assert(f);
- assert(H5F_addr_defined(addr));
- assert(stream);
- assert(indent >= 0);
- assert(fwidth >= 0);
-
- /* Get property list */
- if(NULL == (plist = H5I_object(f->shared->fcpl_id)))
- 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");
- 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");
- 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");
- 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");
- 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");
-
- /* debug */
- HDfprintf(stream, "%*sFile Super Block...\n", indent, "");
-
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "File name:",
- f->name);
- HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth,
- "File access flags",
- (unsigned) (f->shared->flags));
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "File open reference count:",
- (unsigned) (f->shared->nrefs));
- HDfprintf(stream, "%*s%-*s %a (abs)\n", indent, "", fwidth,
- "Address of super block:", f->shared->super_addr);
- HDfprintf(stream, "%*s%-*s %lu bytes\n", indent, "", fwidth,
- "Size of user block:", (unsigned long) userblock_size);
-
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Super block version number:", (unsigned) super_vers);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Free list version number:", (unsigned) freespace_vers);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Root group symbol table entry version number:", (unsigned) obj_dir_vers);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Shared header version number:", (unsigned) share_head_vers);
- HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth,
- "Size of file offsets (haddr_t type):", (unsigned) f->shared->sizeof_addr);
- HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth,
- "Size of file lengths (hsize_t type):", (unsigned) f->shared->sizeof_size);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Symbol table leaf node 1/2 rank:", f->shared->sym_leaf_k);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Symbol table internal node 1/2 rank:",
- (unsigned) (f->shared->btree_k[H5B_SNODE_ID]));
- HDfprintf(stream, "%*s%-*s 0x%08lx\n", indent, "", fwidth,
- "File consistency flags:",
- (unsigned long) (f->shared->consist_flags));
- HDfprintf(stream, "%*s%-*s %a (abs)\n", indent, "", fwidth,
- "Base address:", f->shared->base_addr);
- HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,
- "Free list address:", f->shared->freespace_addr);
-
- HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,
- "Address of driver information block:", f->shared->driver_addr);
-
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Root group symbol table entry:",
- f->shared->root_grp ? "" : "(none)");
- if (f->shared->root_grp) {
- H5G_ent_debug(f, dxpl_id, H5G_entof(f->shared->root_grp), stream,
- indent+3, MAX(0, fwidth-3), HADDR_UNDEF);
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
diff --git a/src/H5FD.c b/src/H5FD.c
index ebf5af2..7a8869a 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -25,6 +25,9 @@
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5FD_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5FD_mask
@@ -50,12 +53,7 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
-/* Interface initialization */
-#define INTERFACE_INIT H5FD_init_interface
-static int interface_initialize_g = 0;
-
/* static prototypes */
-static herr_t H5FD_init_interface(void);
static herr_t H5FD_pl_copy(void *(*copy_func)(const void *), size_t pl_size,
const void *old_pl, void **copied_pl);
static herr_t H5FD_pl_close(hid_t driver_id, herr_t (*free_func)(void *),
@@ -158,8 +156,8 @@ H5FD_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_term_interface)
- if (interface_initialize_g) {
- if ((n=H5I_nmembers(H5I_VFL))) {
+ if (H5_interface_initialize_g) {
+ if ((n=H5I_nmembers(H5I_VFL))!=0) {
H5I_clear_group(H5I_VFL, FALSE);
/* Reset the VFL drivers, if they've been closed */
@@ -186,7 +184,7 @@ H5FD_term_interface(void)
} /* end if */
} else {
H5I_destroy_group(H5I_VFL);
- interface_initialize_g = 0;
+ H5_interface_initialize_g = 0;
n = 1; /*H5I*/
}
}
@@ -630,7 +628,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)
@@ -1469,7 +1468,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")
@@ -1516,7 +1515,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);
@@ -1579,7 +1578,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);
/*
@@ -1601,7 +1600,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;
@@ -1757,7 +1756,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;
@@ -1801,7 +1800,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);
/*
@@ -1916,7 +1915,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);
/*
@@ -2033,7 +2032,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);
/*
@@ -2079,7 +2078,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);
@@ -2171,7 +2170,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;
@@ -2219,7 +2218,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);
if (!H5F_addr_defined(addr) || addr>file->maxaddr ||
H5F_addr_overflow(addr, size) || addr+size>file->maxaddr)
@@ -2241,7 +2240,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 */
@@ -3696,7 +3695,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 */
@@ -3716,7 +3715,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/H5FDcore.c b/src/H5FDcore.c
index d34b5a5..1b3d877 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -21,6 +21,9 @@
* access to small, temporary hdf5 files.
*/
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5FD_core_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5FD_core_mask
@@ -131,10 +134,6 @@ static const H5FD_class_t H5FD_core_g = {
H5FD_FLMAP_SINGLE /*fl_map */
};
-/* Interface initialization */
-#define INTERFACE_INIT H5FD_core_init_interface
-static int interface_initialize_g = 0;
-
/*--------------------------------------------------------------------------
NAME
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index d6d2f3f..2e05203 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -33,6 +33,9 @@
*
*/
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5FD_family_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5FD_family_mask
@@ -132,10 +135,6 @@ static const H5FD_class_t H5FD_family_g = {
H5FD_FLMAP_SINGLE /*fl_map */
};
-/* Interface initialization */
-#define INTERFACE_INIT H5FD_family_init_interface
-static int interface_initialize_g = 0;
-
/*--------------------------------------------------------------------------
NAME
@@ -568,6 +567,13 @@ done:
* Wednesday, August 4, 1999
*
* Modifications:
+ * Raymond Lu
+ * Thursday, November 18, 2004
+ * When file is re-opened, member size passed in from access property
+ * is checked to see if it's reasonable. If there is only 1 member
+ * file, member size can't be smaller than current member size.
+ * If there are at least 2 member files, member size can only be equal
+ * the 1st member size.
*
*-------------------------------------------------------------------------
*/
@@ -578,10 +584,10 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
H5FD_family_t *file=NULL;
H5FD_t *ret_value=NULL;
char memb_name[4096], temp[4096];
- hsize_t eof;
+ hsize_t eof1=HADDR_UNDEF, eof2=HADDR_UNDEF;
unsigned t_flags = flags & ~H5F_ACC_CREAT;
H5P_genplist_t *plist; /* Property list pointer */
-
+
FUNC_ENTER_NOAPI(H5FD_family_open, NULL)
/* Check arguments */
@@ -631,7 +637,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)
@@ -657,14 +663,28 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
}
file->nmembs++;
}
-
- /*
- * The size of the first member determines the size of all the members,
- * but if the size of the first member is zero then use the member size
- * from the file access property list.
+
+ /*
+ * Get file size of the first 2 member files if exist. Check if user sets
+ * reasonable member size.
*/
- if ((eof=H5FDget_eof(file->memb[0])))
- file->memb_size = eof;
+ if(HADDR_UNDEF==(eof1 = H5FD_get_eof(file->memb[0])))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "file get eof1 request failed")
+ if(file->memb[1] && (HADDR_UNDEF==(eof2 = H5FD_get_eof(file->memb[1]))))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "file get eof2 request failed")
+
+ if(eof1 && (eof2==HADDR_UNDEF || !eof2)) {
+ /* If there is only 1 member file, new member size can't be smaller than
+ * current member size.
+ */
+ if(file->memb_size<eof1)
+ file->memb_size = eof1;
+ } else if(eof1 && eof2) {
+ /* If there are at least 2 member files, new member size can only be equal
+ * to the 1st member size
+ */
+ file->memb_size = eof1;
+ }
ret_value=(H5FD_t *)file;
@@ -676,7 +696,7 @@ done:
for (u=0; u<file->nmembs; u++)
if (file->memb[u])
- if (H5FDclose(file->memb[u])<0)
+ if (H5FD_close(file->memb[u])<0)
nerrors++;
if (nerrors)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "unable to close member files")
@@ -813,7 +833,9 @@ H5FD_family_query(const H5FD_t UNUSED * _f, unsigned long *flags /* out */)
if(flags) {
*flags=0;
*flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */
- *flags|=H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */
+ /**flags|=H5FD_FEAT_ACCUMULATE_METADATA;*/ /* OK to accumulate metadata for faster writes.
+ * - Turn it off temporarily because there's a bug
+ * when trying to flush metadata during closing. */
*flags|=H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */
*flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
}
@@ -888,7 +910,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")
@@ -966,7 +988,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/H5FDgass.c b/src/H5FDgass.c
index fb2c776..9da489c 100644
--- a/src/H5FDgass.c
+++ b/src/H5FDgass.c
@@ -20,6 +20,9 @@
*
*/
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5FD_gass_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5FD_gass_mask
@@ -174,10 +177,6 @@ static const H5FD_class_t H5FD_gass_g = {
H5FD_FLMAP_SINGLE /*fl_map */
};
-/* Interface initialization */
-#define INTERFACE_INIT H5FD_gass_init_interface
-static int interface_initialize_g = 0;
-
/*--------------------------------------------------------------------------
NAME
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 795ac65..541baaa 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -25,6 +25,8 @@
* With custom modifications...
*/
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5FD_log_init_interface
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
@@ -237,10 +239,6 @@ static const H5FD_class_t H5FD_log_g = {
H5FD_FLMAP_NOLIST /*fl_map */
};
-/* Interface initialization */
-#define INTERFACE_INIT H5FD_log_init_interface
-static int interface_initialize_g = 0;
-
/*--------------------------------------------------------------------------
NAME
@@ -910,7 +908,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)
@@ -1215,8 +1213,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)
@@ -1317,8 +1315,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/H5FDmpi.c b/src/H5FDmpi.c
index 6afc65c..e738a82 100644
--- a/src/H5FDmpi.c
+++ b/src/H5FDmpi.c
@@ -38,10 +38,6 @@ char H5FD_mpi_native_g[] = "native";
#ifdef H5_HAVE_PARALLEL
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/*-------------------------------------------------------------------------
* Function: H5FD_mpi_get_rank
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 2fb7285..9d5c48a 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -20,6 +20,9 @@
*
*/
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5FD_mpio_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5FD_mpio_mask
@@ -149,10 +152,6 @@ static int H5FD_mpio_Debug[256] =
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
#endif
-/* Interface initialization */
-#define INTERFACE_INIT H5FD_mpio_init_interface
-static int interface_initialize_g = 0;
-
/*--------------------------------------------------------------------------
NAME
diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c
index baef534..6500a85 100644
--- a/src/H5FDmpiposix.c
+++ b/src/H5FDmpiposix.c
@@ -32,6 +32,9 @@
*
*/
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5FD_mpiposix_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5FD_mpiposix_mask
@@ -237,10 +240,6 @@ static const H5FD_class_mpi_t H5FD_mpiposix_g = {
H5FD_mpiposix_communicator /*get_comm */
};
-/* Interface initialization */
-#define INTERFACE_INIT H5FD_mpiposix_init_interface
-static int interface_initialize_g = 0;
-
/*--------------------------------------------------------------------------
NAME
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index b03248d..0289096 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -449,7 +449,7 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map,
/* Check arguments and supply default values */
if(H5I_GENPROP_LST != H5Iget_type(fapl_id) ||
TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
- H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "not an access list", -1);
+ H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "not an access list", -1)
if (!memb_map) {
for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1))
_memb_map[mt] = H5FD_MEM_DEFAULT;
@@ -478,7 +478,7 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map,
/* Map usage type */
mmt = memb_map[mt];
if (mmt<0 || mmt>=H5FD_MEM_NTYPES)
- H5Epush_ret(func, H5E_INTERNAL, H5E_BADRANGE, "file resource type out of range", -1);
+ H5Epush_ret(func, H5E_INTERNAL, H5E_BADRANGE, "file resource type out of range", -1)
if (H5FD_MEM_DEFAULT==mmt) mmt = mt;
/*
@@ -486,11 +486,11 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map,
* access property lists.
*/
if (H5P_DEFAULT!=memb_fapl[mmt] && TRUE!=H5Pisa_class(memb_fapl[mmt], H5P_FILE_ACCESS))
- H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "file resource type incorrect", -1);
+ H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "file resource type incorrect", -1)
/* All names must be defined */
if (!memb_name[mmt] || !memb_name[mmt][0])
- H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "file resource type not set", -1);
+ H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "file resource type not set", -1)
}
/*
@@ -549,11 +549,11 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/,
if(H5I_GENPROP_LST != H5Iget_type(fapl_id) ||
TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
- H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not an access list", -1);
+ H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not an access list", -1)
if (H5FD_MULTI!=H5Pget_driver(fapl_id))
- H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1);
+ H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1)
if (NULL==(fa=H5Pget_driver_info(fapl_id)))
- H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1);
+ H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1)
if (memb_map)
memcpy(memb_map, fa->memb_map, H5FD_MEM_NTYPES*sizeof(H5FD_mem_t));
@@ -616,12 +616,12 @@ H5Pset_dxpl_multi(hid_t dxpl_id, const hid_t *memb_dxpl)
/* Check arguments */
if (TRUE!=H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
- H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1);
+ H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1)
if (!memb_dxpl)
- H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "invalid pointer", -1);
+ H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "invalid pointer", -1)
for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) {
if (memb_dxpl[mt]!=H5P_DEFAULT && TRUE!=H5Pisa_class(memb_dxpl[mt], H5P_DATASET_XFER))
- H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1);
+ H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1)
}
/* Initialize the data transfer property list */
@@ -667,11 +667,11 @@ H5Pget_dxpl_multi(hid_t dxpl_id, hid_t *memb_dxpl/*out*/)
H5Eclear();
if (TRUE!=H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
- H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1);
+ H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1)
if (H5FD_MULTI!=H5Pget_driver(dxpl_id))
- H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1);
+ H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1)
if (NULL==(dx=H5Pget_driver_info(dxpl_id)))
- H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1);
+ H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1)
if (memb_dxpl) {
for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) {
@@ -800,7 +800,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/,
} END_MEMBERS;
if (H5Tconvert(H5T_NATIVE_HADDR, H5T_STD_U64LE, nseen*2, buf+8, NULL,
H5P_DEFAULT)<0)
- H5Epush_ret(func, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1);
+ H5Epush_ret(func, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1)
/* Encode all name templates */
p = buf + 8 + nseen*2*8;
@@ -858,7 +858,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
/* Make sure the name/version number is correct */
if (strcmp(name, "NCSAmult"))
- H5Epush_ret(func, H5E_FILE, H5E_BADVALUE, "invalid multi superblock", -1);
+ H5Epush_ret(func, H5E_FILE, H5E_BADVALUE, "invalid multi superblock", -1)
/* Set default values */
ALL_MEMBERS(mt) {
@@ -886,7 +886,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
memcpy(x, buf, (nseen*2*8));
buf += nseen*2*8;
if (H5Tconvert(H5T_STD_U64LE, H5T_NATIVE_HADDR, nseen*2, x, NULL, H5P_DEFAULT)<0)
- H5Epush_ret(func, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1);
+ H5Epush_ret(func, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1)
ap = (haddr_t*)x;
UNIQUE_MEMBERS(map, mt) {
memb_addr[_unmapped] = *ap++;
@@ -954,17 +954,17 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
}
} END_MEMBERS;
if (compute_next(file)<0)
- H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "compute_next() failed", -1);
+ H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "compute_next() failed", -1)
/* Open all necessary files */
if (open_members(file)<0)
- H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", -1);
+ H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", -1)
/* Set the EOA marker for all open files */
UNIQUE_MEMBERS(file->fa.memb_map, mt) {
if (file->memb[mt])
if(H5FDset_eoa(file->memb[mt], memb_eoa[mt])<0)
- H5Epush_ret(func, H5E_INTERNAL, H5E_CANTSET, "set_eoa() failed", -1);
+ H5Epush_ret(func, H5E_INTERNAL, H5E_CANTSET, "set_eoa() failed", -1)
} END_MEMBERS;
return 0;
@@ -1051,7 +1051,7 @@ H5FD_multi_fapl_copy(const void *_old_fa)
if (new_fa->memb_name[mt]) free(new_fa->memb_name[mt]);
}
free(new_fa);
- H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "invalid freespace objects", NULL);
+ H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "invalid freespace objects", NULL)
}
return new_fa;
}
@@ -1086,7 +1086,7 @@ H5FD_multi_fapl_free(void *_fa)
for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) {
if (fa->memb_fapl[mt]>=0)
if(H5Pclose(fa->memb_fapl[mt])<0)
- H5Epush_ret(func, H5E_FILE, H5E_CLOSEERROR, "can't close property list", -1);
+ H5Epush_ret(func, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", -1)
if (fa->memb_name[mt])
free(fa->memb_name[mt]);
}
@@ -1138,7 +1138,7 @@ H5FD_multi_dxpl_copy(const void *_old_dx)
for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1))
(void)H5Pclose(new_dx->memb_dxpl[mt]);
free(new_dx);
- H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "invalid freespace objects", NULL);
+ H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "invalid freespace objects", NULL)
}
return new_dx;
}
@@ -1173,7 +1173,7 @@ H5FD_multi_dxpl_free(void *_dx)
for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1))
if (dx->memb_dxpl[mt]>=0)
if(H5Pclose(dx->memb_dxpl[mt])<0)
- H5Epush_ret(func, H5E_FILE, H5E_CLOSEERROR, "can't close property list", -1);
+ H5Epush_ret(func, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", -1)
free(dx);
return 0;
}
@@ -1212,20 +1212,20 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id,
/* Check arguments */
if (!name || !*name)
- H5Epush_ret(func, H5E_ARGS, H5E_BADVALUE, "invalid file name", NULL);
+ H5Epush_ret(func, H5E_ARGS, H5E_BADVALUE, "invalid file name", NULL)
if (0==maxaddr || HADDR_UNDEF==maxaddr)
- H5Epush_ret(func, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL);
+ H5Epush_ret(func, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL)
/*
* Initialize the file from the file access properties, using default
* values if necessary.
*/
if (NULL==(file=calloc(1, sizeof(H5FD_multi_t))))
- H5Epush_ret(func, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL);
+ H5Epush_ret(func, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL)
if (H5P_FILE_ACCESS_DEFAULT==fapl_id || H5FD_MULTI!=H5Pget_driver(fapl_id)) {
close_fapl = fapl_id = H5Pcreate(H5P_FILE_ACCESS);
if(H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE)<0)
- H5Epush_goto(func, H5E_FILE, H5E_CANTSET, "can't set property value", error);
+ H5Epush_goto(func, H5E_FILE, H5E_CANTSET, "can't set property value", error)
}
fa = H5Pget_driver_info(fapl_id);
assert(fa);
@@ -1246,13 +1246,13 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id,
file->name = my_strdup(name);
if (close_fapl>=0)
if(H5Pclose(close_fapl)<0)
- H5Epush_goto(func, H5E_FILE, H5E_CLOSEERROR, "can't close property list", error);
+ H5Epush_goto(func, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", error)
/* Compute derived properties and open member files */
if (compute_next(file)<0)
- H5Epush_goto(func, H5E_INTERNAL, H5E_BADVALUE, "compute_next() failed", error);
+ H5Epush_goto(func, H5E_INTERNAL, H5E_BADVALUE, "compute_next() failed", error)
if (open_members(file)<0)
- H5Epush_goto(func, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", error);
+ H5Epush_goto(func, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", error)
/* We must have opened at least the superblock file */
if (H5FD_MEM_DEFAULT==(m=file->fa.memb_map[H5FD_MEM_SUPER]))
@@ -1326,7 +1326,7 @@ H5FD_multi_close(H5FD_t *_file)
}
} END_MEMBERS;
if (nerrors)
- H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "error closing member files", -1);
+ H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "error closing member files", -1)
/* Clean up other stuff */
ALL_MEMBERS(mt) {
@@ -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_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1);
+ H5Epush_ret(func, 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_INTERNAL, H5E_BADVALUE, "member file has unknown eof", HADDR_UNDEF);
+ H5Epush_ret(func, 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_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF);
+ H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF)
}
if (tmp>eof) eof = tmp;
@@ -1586,9 +1586,9 @@ H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle)
/* Get data type for multi driver */
if(H5Pget_multi_type(fapl, &type) < 0)
- H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "can't get data type for multi driver", -1);
+ H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "can't get data type for multi driver", -1)
if(type<H5FD_MEM_DEFAULT || type>=H5FD_MEM_NTYPES)
- H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "data type is out of range", -1);
+ H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "data type is out of range", -1)
mmt = file->fa.memb_map[type];
if(H5FD_MEM_DEFAULT==mmt) mmt = type;
@@ -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))) {
- H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "member file can't alloc", HADDR_UNDEF);
- }
+ if (HADDR_UNDEF==(addr=H5FDalloc(file->memb[mmt], type, dxpl_id, size)))
+ H5Epush_ret(func, 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;
@@ -1845,7 +1844,7 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing)
}
}
if (nerrors)
- H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "error flushing member files", -1);
+ H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "error flushing member files", -1)
return 0;
}
@@ -1949,7 +1948,7 @@ open_members(H5FD_multi_t *file)
}
} END_MEMBERS;
if (nerrors)
- H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "error opening member files", -1);
+ H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "error opening member files", -1)
return 0;
}
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/H5FDsec2.c b/src/H5FDsec2.c
index 36362fd..94babea 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -24,6 +24,9 @@
* application to the same file).
*/
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5FD_sec2_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5FD_sec2_mask
@@ -187,10 +190,6 @@ static const H5FD_class_t H5FD_sec2_g = {
H5FD_FLMAP_SINGLE /*fl_map */
};
-/* Interface initialization */
-#define INTERFACE_INIT H5FD_sec2_init_interface
-static int interface_initialize_g = 0;
-
/* Declare a free list to manage the H5FD_sec2_t struct */
H5FL_DEFINE_STATIC(H5FD_sec2_t);
@@ -376,7 +375,6 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t UNUSED fapl_id,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct")
file->fd = fd;
-
H5_ASSIGN_OVERFLOW(file->eof,sb.st_size,h5_stat_size_t,haddr_t);
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
diff --git a/src/H5FDsrb.c b/src/H5FDsrb.c
index 6ae7cbf..f739500 100644
--- a/src/H5FDsrb.c
+++ b/src/H5FDsrb.c
@@ -19,6 +19,9 @@
* Purpose: SRB I/O driver.
*/
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5FD_srb_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5FD_srb_mask
@@ -157,10 +160,6 @@ static const H5FD_class_t H5FD_srb_g = {
H5FD_FLMAP_SINGLE /*fl_map */
};
-/* Interface initialization */
-#define INTERFACE_INIT H5FD_srb_init_interface
-static int interface_initialize_g = 0;
-
/*--------------------------------------------------------------------------
NAME
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index 1e60d08..c144476 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -275,7 +275,7 @@ H5Pset_fapl_stdio(hid_t fapl_id)
H5Eclear();
if(0 == H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
- H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1);
+ H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1)
return H5Pset_driver(fapl_id, H5FD_STDIO, NULL);
}
@@ -336,21 +336,21 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id,
/* Check arguments */
if (!name || !*name)
- H5Epush_ret(func, H5E_ARGS, H5E_BADVALUE, "invalid file name", NULL);
+ H5Epush_ret(func, H5E_ARGS, H5E_BADVALUE, "invalid file name", NULL)
if (0==maxaddr || HADDR_UNDEF==maxaddr)
- H5Epush_ret(func, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL);
+ H5Epush_ret(func, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL)
if (ADDR_OVERFLOW(maxaddr))
- H5Epush_ret(func, H5E_ARGS, H5E_OVERFLOW, "maxaddr too large", NULL);
+ H5Epush_ret(func, H5E_ARGS, H5E_OVERFLOW, "maxaddr too large", NULL)
if (access(name, F_OK) < 0) {
if ((flags & H5F_ACC_CREAT) && (flags & H5F_ACC_RDWR)) {
f = fopen(name, "wb+");
write_access=1; /* Note the write access */
- } else {
- H5Epush_ret(func, H5E_IO, H5E_CANTOPENFILE, "file doesn't exist and CREAT wasn't specified", NULL);
}
+ else
+ H5Epush_ret(func, H5E_IO, H5E_CANTOPENFILE, "file doesn't exist and CREAT wasn't specified", NULL)
} else if ((flags & H5F_ACC_CREAT) && (flags & H5F_ACC_EXCL)) {
- H5Epush_ret(func, H5E_IO, H5E_FILEEXISTS, "file exists but CREAT and EXCL were specified", NULL);
+ H5Epush_ret(func, H5E_IO, H5E_FILEEXISTS, "file exists but CREAT and EXCL were specified", NULL)
} else if (flags & H5F_ACC_RDWR) {
if (flags & H5F_ACC_TRUNC)
f = fopen(name, "wb+");
@@ -361,11 +361,11 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id,
f = fopen(name, "rb");
}
if (!f)
- H5Epush_ret(func, H5E_IO, H5E_CANTOPENFILE, "fopen failed", NULL);
+ H5Epush_ret(func, H5E_IO, H5E_CANTOPENFILE, "fopen failed", NULL)
/* Build the return value */
if (NULL==(file = calloc(1,sizeof(H5FD_stdio_t))))
- H5Epush_ret(func, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL);
+ H5Epush_ret(func, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL)
file->fp = f;
file->op = H5FD_STDIO_OP_SEEK;
file->pos = HADDR_UNDEF;
@@ -423,7 +423,7 @@ H5FD_stdio_close(H5FD_t *_file)
H5Eclear();
if (fclose(file->fp) < 0)
- H5Epush_ret(func, H5E_IO, H5E_CLOSEERROR, "fclose failed", -1);
+ H5Epush_ret(func, H5E_IO, H5E_CLOSEERROR, "fclose failed", -1)
free(file);
@@ -647,7 +647,7 @@ H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle)
*file_handle = &(file->fp);
if(*file_handle==NULL)
- H5Epush_ret(func, H5E_IO, H5E_WRITEERROR, "get handle failed", -1);
+ H5Epush_ret(func, H5E_IO, H5E_WRITEERROR, "get handle failed", -1)
return(0);
}
@@ -693,11 +693,11 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz
/* Check for overflow */
if (HADDR_UNDEF==addr)
- H5Epush_ret (func, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1);
+ H5Epush_ret (func, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1)
if (REGION_OVERFLOW(addr, size))
- H5Epush_ret (func, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1);
+ H5Epush_ret (func, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1)
if (addr+size>file->eoa)
- H5Epush_ret (func, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1);
+ H5Epush_ret (func, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1)
/* Check easy cases */
if (0 == size)
@@ -715,7 +715,7 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz
if (fseek(file->fp, (long)addr, SEEK_SET) < 0) {
file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
- H5Epush_ret(func, H5E_IO, H5E_SEEKERROR, "fseek failed", -1);
+ H5Epush_ret(func, H5E_IO, H5E_SEEKERROR, "fseek failed", -1)
}
file->pos = addr;
}
@@ -738,7 +738,7 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz
if (n == 0 && ferror(file->fp)) {
file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
- H5Epush_ret(func, H5E_IO, H5E_READERROR, "fread failed", -1);
+ H5Epush_ret(func, H5E_IO, H5E_READERROR, "fread failed", -1)
} else if (n < size) {
memset((unsigned char *)buf + n, 0, (size - n));
}
@@ -791,11 +791,11 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
/* Check for overflow conditions */
if (HADDR_UNDEF==addr)
- H5Epush_ret (func, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1);
+ H5Epush_ret (func, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1)
if (REGION_OVERFLOW(addr, size))
- H5Epush_ret (func, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1);
+ H5Epush_ret (func, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1)
if (addr+size>file->eoa)
- H5Epush_ret (func, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1);
+ H5Epush_ret (func, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1)
/*
* Seek to the correct file position.
@@ -805,7 +805,7 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
if (fseek(file->fp, (long)addr, SEEK_SET) < 0) {
file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
- H5Epush_ret(func, H5E_IO, H5E_SEEKERROR, "fseek failed", -1);
+ H5Epush_ret(func, H5E_IO, H5E_SEEKERROR, "fseek failed", -1)
}
file->pos = addr;
}
@@ -818,7 +818,7 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
if (size != fwrite(buf, 1, size, file->fp)) {
file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
- H5Epush_ret(func, H5E_IO, H5E_WRITEERROR, "fwrite failed", -1);
+ H5Epush_ret(func, H5E_IO, H5E_WRITEERROR, "fwrite failed", -1)
}
/*
@@ -883,13 +883,14 @@ H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing)
li.QuadPart = (LONGLONG)file->eoa;
(void)SetFilePointer((HANDLE)filehandle,li.LowPart,&li.HighPart,FILE_BEGIN);
if(SetEndOfFile((HANDLE)filehandle)==0)
- H5Epush_ret(func, H5E_IO, H5E_SEEKERROR, "unable to extend file properly", -1);
+ H5Epush_ret(func, H5E_IO, H5E_SEEKERROR, "unable to extend file properly", -1)
#else /* WIN32 */
int fd=fileno(file->fp); /* File descriptor for HDF5 file */
if (-1==file_truncate(fd, (file_offset_t)file->eoa))
- H5Epush_ret(func, H5E_IO, H5E_SEEKERROR, "unable to extend file properly", -1);
+ H5Epush_ret(func, H5E_IO, H5E_SEEKERROR, "unable to extend file properly", -1)
#endif /* WIN32 */
+
/* Update the eof value */
file->eof = file->eoa;
@@ -903,13 +904,13 @@ H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing)
*/
if(!closing) {
if (fflush(file->fp) < 0)
- H5Epush_ret(func, H5E_IO, H5E_WRITEERROR, "fflush failed", -1);
+ H5Epush_ret(func, H5E_IO, H5E_WRITEERROR, "fflush failed", -1)
} /* end if */
} /* end if */
else {
/* Double-check for problems */
if (file->eoa>file->eof)
- H5Epush_ret(func, H5E_IO, H5E_TRUNCATED, "eoa>eof!", -1);
+ H5Epush_ret(func, H5E_IO, H5E_TRUNCATED, "eoa>eof!", -1)
} /* end else */
return(0);
diff --git a/src/H5FDstream.c b/src/H5FDstream.c
index d3dad5e..5e02623 100644
--- a/src/H5FDstream.c
+++ b/src/H5FDstream.c
@@ -19,6 +19,8 @@
*
*/
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5FD_stream_init_interface
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
@@ -202,10 +204,6 @@ static const H5FD_class_t H5FD_stream_g = {
H5FD_FLMAP_SINGLE /*fl_map */
};
-/* Interface initialization */
-#define INTERFACE_INIT H5FD_stream_init_interface
-static int interface_initialize_g = 0;
-
/*--------------------------------------------------------------------------
NAME
diff --git a/src/H5FL.c b/src/H5FL.c
index 1d49064..b8fc9ab 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -26,6 +26,9 @@
* move frequently accessed free lists to the head of the queue.
*/
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5FL_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5FL_mask
@@ -37,9 +40,6 @@
#include "H5FLprivate.h" /* Free Lists */
#include "H5MMprivate.h" /* Memory management */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/*
* Private type definitions
*/
@@ -112,6 +112,31 @@ static herr_t H5FL_blk_gc_list(H5FL_blk_head_t *head);
H5FL_DEFINE(H5FL_blk_node_t);
+/*--------------------------------------------------------------------------
+NAME
+ H5FL_init_interface -- Initialize interface-specific information
+USAGE
+ herr_t H5FL_init_interface()
+
+RETURNS
+ Non-negative on success/Negative on failure
+DESCRIPTION
+ Initializes any interface-specific data or routines.
+
+--------------------------------------------------------------------------*/
+static herr_t
+H5FL_init_interface(void)
+{
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FL_init_interface)
+
+ /* Nothing currently... */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5FL_init_interface() */
+
+
/*-------------------------------------------------------------------------
* Function: H5FL_malloc
*
@@ -139,7 +164,7 @@ H5FL_malloc(size_t mem_size)
if(NULL==(ret_value=H5MM_malloc(mem_size))) {
/* If we can't allocate the memory now, try garbage collecting first */
if(H5FL_garbage_coll()<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, NULL, "garbage collection failed during allocation")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during allocation")
/* Now try allocating the memory again */
if(NULL==(ret_value=H5MM_malloc(mem_size)))
@@ -252,12 +277,12 @@ H5FL_reg_free(H5FL_reg_head_t *head, void *obj)
/* First check this particular list */
if(head->list_mem>H5FL_reg_lst_mem_lim)
if(H5FL_reg_gc_list(head)<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, NULL, "garbage collection failed during free")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free")
/* Then check the global amount memory on regular free lists */
if(H5FL_reg_gc_head.mem_freed>H5FL_reg_glb_mem_lim)
if(H5FL_reg_gc()<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, NULL, "garbage collection failed during free")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -448,7 +473,7 @@ H5FL_reg_gc(void)
while(gc_node!=NULL) {
/* Release the free nodes on the list */
if(H5FL_reg_gc_list(gc_node->list)<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "garbage collection of list failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed")
/* Go on to the next free list to garbage collect */
gc_node=gc_node->next;
@@ -495,7 +520,7 @@ H5FL_reg_term(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FL_reg_term)
- if (interface_initialize_g) {
+ if (H5_interface_initialize_g) {
/* Free the nodes on the garbage collection list, keeping nodes with allocations outstanding */
left=NULL;
while(H5FL_reg_gc_head.first!=NULL) {
@@ -525,7 +550,7 @@ H5FL_reg_term(void)
/* Point to the list of nodes left with allocations open, if any */
H5FL_reg_gc_head.first=left;
if (!left)
- interface_initialize_g = 0; /*this layer has reached its initial state*/
+ H5_interface_initialize_g = 0; /*this layer has reached its initial state*/
}
/* Terminating this layer never affects other layers; rather, other layers affect
@@ -911,12 +936,12 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block)
/* First check this particular list */
if(head->list_mem>H5FL_blk_lst_mem_lim)
if(H5FL_blk_gc_list(head)<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, NULL, "garbage collection failed during free")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free")
/* Then check the global amount memory on block free lists */
if(H5FL_blk_gc_head.mem_freed>H5FL_blk_glb_mem_lim)
if(H5FL_blk_gc()<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, NULL, "garbage collection failed during free")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1072,7 +1097,7 @@ H5FL_blk_gc(void)
while(gc_node!=NULL) {
/* For each free list being garbage collected, walk through the nodes and free them */
if(H5FL_blk_gc_list(gc_node->pq)<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "garbage collection of list failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed")
/* Go on to the next free list to garbage collect */
gc_node=gc_node->next;
@@ -1263,12 +1288,12 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj)
/* First check this particular list */
if(head->list_mem>H5FL_arr_lst_mem_lim)
if(H5FL_arr_gc_list(head)<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, NULL, "garbage collection failed during free")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free")
/* Then check the global amount memory on array free lists */
if(H5FL_arr_gc_head.mem_freed>H5FL_arr_glb_mem_lim)
if(H5FL_arr_gc()<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, NULL, "garbage collection failed during free")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1539,7 +1564,7 @@ H5FL_arr_gc(void)
while(gc_arr_node!=NULL) {
/* Release the free nodes on the list */
if(H5FL_arr_gc_list(gc_arr_node->list)<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "garbage collection of list failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed")
/* Go on to the next free list to garbage collect */
gc_arr_node=gc_arr_node->next;
@@ -1634,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);
@@ -1651,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() */
@@ -1782,15 +1801,15 @@ H5FL_garbage_coll(void)
/* Garbage collect the free lists for array objects */
if(H5FL_arr_gc()<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't garbage collect array objects")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect array objects")
/* Garbage collect free lists for blocks */
if(H5FL_blk_gc()<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't garbage collect block objects")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect block objects")
/* Garbage collect the free lists for regular objects */
if(H5FL_reg_gc()<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't garbage collect regular objects")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect regular objects")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5FO.c b/src/H5FO.c
index 3eb6720..dbfdd58 100644
--- a/src/H5FO.c
+++ b/src/H5FO.c
@@ -32,10 +32,6 @@
#include "H5FOprivate.h" /* File objects */
#include "H5Oprivate.h" /* Object headers */
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/* Private typedefs */
/* Information about object objects in a file */
@@ -113,7 +109,7 @@ H5FO_opened(const H5F_t *f, haddr_t addr)
H5FO_open_obj_t *open_obj; /* Information about open object */
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5FO_opened,NULL)
+ FUNC_ENTER_NOAPI_NOFUNC(H5FO_opened)
/* Sanity check */
assert(f);
@@ -129,7 +125,6 @@ H5FO_opened(const H5F_t *f, haddr_t addr)
else
ret_value=NULL;
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FO_opened() */
@@ -264,7 +259,7 @@ H5FO_mark(const H5F_t *f, haddr_t addr, hbool_t deleted)
H5FO_open_obj_t *open_obj; /* Information about open object */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FO_mark,FAIL)
+ FUNC_ENTER_NOAPI_NOFUNC(H5FO_mark)
/* Sanity check */
assert(f);
@@ -278,7 +273,6 @@ H5FO_mark(const H5F_t *f, haddr_t addr, hbool_t deleted)
else
ret_value=FAIL;
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FO_mark() */
@@ -309,7 +303,7 @@ H5FO_marked(const H5F_t *f, haddr_t addr)
H5FO_open_obj_t *open_obj; /* Information about open object */
htri_t ret_value=FAIL; /* Return value */
- FUNC_ENTER_NOAPI(H5FO_marked,FAIL)
+ FUNC_ENTER_NOAPI_NOFUNC(H5FO_marked)
/* Sanity check */
assert(f);
@@ -321,7 +315,6 @@ H5FO_marked(const H5F_t *f, haddr_t addr)
if((open_obj=H5SL_search(f->shared->open_objs,&addr))!=NULL)
ret_value=open_obj->deleted;
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FO_marked() */
diff --git a/src/H5FS.c b/src/H5FS.c
index 0c02034..6543fc5 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -25,16 +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
-
-/* Interface initialization? */
-#define INTERFACE_INIT NULL
-
#ifdef H5_HAVE_THREADSAFE
/*
* The per-thread function stack. pthread_once() initializes a special
@@ -80,7 +80,7 @@ H5FS_get_stack(void)
{
H5FS_t *fstack;
- FUNC_ENTER_NOAPI_NOFS(H5FS_get_stack);
+ FUNC_ENTER_NOAPI_NOFUNC_NOFS(H5FS_get_stack);
fstack = pthread_getspecific(H5TS_funcstk_key_g);
if (!fstack) {
@@ -116,7 +116,7 @@ H5FS_print(FILE *stream)
int i; /* Local index ariable */
/* Don't push this function on the function stack... :-) */
- FUNC_ENTER_NOAPI_NOFS(H5FS_print);
+ FUNC_ENTER_NOAPI_NOFUNC_NOFS(H5FS_print);
/* Sanity check */
assert(fstack);
@@ -164,7 +164,7 @@ H5FS_push(const char *func_name)
H5FS_t *fstack = H5FS_get_my_stack ();
/* Don't push this function on the function stack... :-) */
- FUNC_ENTER_NOAPI_NOFS(H5FS_push);
+ FUNC_ENTER_NOAPI_NOFUNC_NOFS(H5FS_push);
/* Sanity check */
assert (fstack);
@@ -201,7 +201,7 @@ H5FS_pop(void)
H5FS_t *fstack = H5FS_get_my_stack ();
/* Don't push this function on the function stack... :-) */
- FUNC_ENTER_NOAPI_NOFS(H5FS_pop);
+ FUNC_ENTER_NOAPI_NOFUNC_NOFS(H5FS_pop);
/* Sanity check */
assert (fstack);
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 87be161..7997524 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -159,8 +159,6 @@ union H5D_storage_t;
H5_DLL void H5F_encode_length_unusual(const H5F_t *f, uint8_t **p, uint8_t *l);
#endif /* NOT_YET */
H5_DLL herr_t H5F_mountpoint(struct H5G_entry_t *find/*in,out*/);
-H5_DLL herr_t H5F_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream,
- int indent, int fwidth);
#endif
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 8c369fb..5c1909f 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -43,9 +43,8 @@ typedef struct H5F_t H5F_t;
*/
#define H5F_FLUSH_NONE (0U) /* No flags specified */
#define H5F_FLUSH_INVALIDATE (1U << 0) /* Invalidate cached data */
-#define H5F_FLUSH_ALLOC_ONLY (1U << 1) /* Allocate space for user and super blocks */
-#define H5F_FLUSH_CLOSING (1U << 2) /* Closing the file */
-#define H5F_FLUSH_CLEAR_ONLY (1U << 3) /* Don't write, just clear dirty flags */
+#define H5F_FLUSH_CLOSING (1U << 1) /* Closing the file */
+#define H5F_FLUSH_CLEAR_ONLY (1U << 2) /* Don't write, just clear dirty flags */
/*
* Encode and decode macros for file meta-data.
@@ -459,4 +458,7 @@ H5_DLL herr_t H5F_acs_close(hid_t fapl_id, void *close_data);
H5_DLL herr_t H5F_acs_copy(hid_t new_fapl_id, hid_t old_fapl_id,
void *close_data);
+/* Debugging functions */
+H5_DLL herr_t H5F_debug(H5F_t *f, hid_t dxpl_id, FILE * stream, int indent, int fwidth);
+
#endif
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 5e473f8..04282de 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -88,6 +88,9 @@
#define H5G_PACKAGE /*suppress error message about including H5Gpkg.h */
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5G_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5G_mask
@@ -121,11 +124,6 @@
#define H5G_TARGET_SLINK 0x0001
#define H5G_TARGET_MOUNT 0x0002
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5G_init_interface
-static herr_t H5G_init_interface(void);
-
/* Local typedefs */
/* Struct only used by change name callback function */
@@ -287,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);
@@ -299,11 +296,11 @@ 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, dxpl_id)) ==NULL)
+ 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 */
@@ -620,7 +617,7 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx)
H5G_obj_t ret_value;
FUNC_ENTER_API(H5Gget_objtype_by_idx, H5G_UNKNOWN);
- H5TRACE2("Is","ih",loc_id,idx);
+ H5TRACE2("Go","ih",loc_id,idx);
/* Check args */
if (NULL==(loc=H5G_loc (loc_id)))
@@ -1067,7 +1064,7 @@ H5G_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_term_interface);
- if (interface_initialize_g) {
+ if (H5_interface_initialize_g) {
if ((n=H5I_nmembers(H5I_GROUP))) {
H5I_clear_group(H5I_GROUP, FALSE);
} else {
@@ -1085,7 +1082,7 @@ H5G_term_interface(void)
H5G_comp_alloc_g = 0;
/* Mark closed */
- interface_initialize_g = 0;
+ H5_interface_initialize_g = 0;
n = 1; /*H5I*/
}
}
@@ -2199,6 +2196,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);
@@ -2469,8 +2467,8 @@ H5G_loc (hid_t loc_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get symbol table entry of attribute");
break;
- case H5I_TEMPBUF:
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get symbol table entry of buffer");
+ case H5I_REFERENCE:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get symbol table entry of reference");
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object ID");
diff --git a/src/H5Gent.c b/src/H5Gent.c
index 4d9fe62..4aaaf70 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -30,9 +30,6 @@
#include "H5HLprivate.h" /* Local Heaps */
#include "H5MMprivate.h" /* Memory management */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/* Private prototypes */
#ifdef NOT_YET
static herr_t H5G_ent_modified(H5G_entry_t *ent, H5G_type_t cache_type);
@@ -190,9 +187,8 @@ H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent)
{
const uint8_t *p_ret = *pp;
uint32_t tmp;
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5G_ent_decode, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5G_ent_decode);
/* check arguments */
assert(f);
@@ -229,8 +225,7 @@ H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent)
*pp = p_ret + H5G_SIZEOF_ENTRY(f);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
}
@@ -310,9 +305,8 @@ herr_t
H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent)
{
uint8_t *p_ret = *pp + H5G_SIZEOF_ENTRY(f);
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5G_ent_encode, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5G_ent_encode);
/* check arguments */
assert(f);
@@ -354,8 +348,7 @@ H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent)
while (*pp < p_ret) *(*pp)++ = 0;
*pp = p_ret;
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
}
@@ -398,9 +391,8 @@ herr_t
H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5G_ent_copy_depth_t depth)
{
H5RS_str_t *tmp_user_path_r=NULL; /* Temporary string pointer for entry's user path */
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5G_ent_copy, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5G_ent_copy);
/* Check arguments */
assert(src);
@@ -427,8 +419,7 @@ H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5G_ent_copy_depth_t dept
dst->canon_path_r=NULL;
} /* end if */
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
}
@@ -456,9 +447,8 @@ H5G_ent_debug(H5F_t UNUSED *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * str
{
const char *lval = NULL;
int nested_indent, nested_fwidth;
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5G_ent_debug, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5G_ent_debug);
/* Calculate the indent & field width values for nested information */
nested_indent=indent+3;
@@ -519,6 +509,5 @@ H5G_ent_debug(H5F_t UNUSED *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * str
break;
}
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
}
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 9fdcc5c..72893cd 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,
@@ -134,10 +134,6 @@ H5B_class_t H5B_SNODE[1] = {{
H5G_node_debug_key, /*debug */
}};
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/* Declare a free list to manage the H5B_shared_t struct */
H5FL_EXTERN(H5B_shared_t);
@@ -203,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;
@@ -236,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;
@@ -268,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;
@@ -348,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);
@@ -513,7 +509,7 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
if (H5G_node_serialize(f, sym, size, buf) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "node serialization failed");
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSERIALIZE, FAIL, "node serialization failed");
if (H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "unable to write symbol table node to the file");
@@ -690,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);
@@ -936,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;
@@ -1047,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;
@@ -1462,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;
@@ -1490,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;
@@ -1570,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;
@@ -1617,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;
@@ -1686,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 7010aa6..c0f00ee 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -58,8 +58,8 @@ struct H5G_shared_t {
* above the H5G layer.
*/
struct H5G_t {
- H5G_shared_t* shared; /*shared file object data */
- H5G_entry_t ent; /*info about the group */
+ H5G_shared_t* shared; /*shared file object data */
+ H5G_entry_t ent; /*info about the group */
};
/*
@@ -113,7 +113,7 @@ typedef struct H5G_bt_ud2_t {
typedef struct H5G_bt_ud3_t {
/* downward */
H5G_entry_t *ent; /*the entry of group being queried */
- hsize_t idx; /*index of group member to be querried */
+ hsize_t idx; /*index of group member to be queried */
hsize_t num_objs; /*the number of objects having been traversed*/
/* upward */
@@ -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/H5Gstab.c b/src/H5Gstab.c
index fcfcb35..71b5603 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -19,6 +19,10 @@
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5G_stab_mask
+
#include "H5private.h"
#include "H5Eprivate.h"
#include "H5Fpkg.h" /*file access */
@@ -28,10 +32,6 @@
#include "H5MMprivate.h"
#include "H5Oprivate.h"
-#define PABLO_MASK H5G_stab_mask
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/* Declare extern the PQ free list for the wrapped strings */
H5FL_BLK_EXTERN(str_buf);
diff --git a/src/H5HG.c b/src/H5HG.c
index 42a38ab..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
@@ -146,10 +146,6 @@ const H5AC_class_t H5AC_GHEAP[1] = {{
(H5AC_size_func_t)H5HG_compute_size,
}};
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/* Declare a free list to manage the H5HG_t struct */
H5FL_DEFINE_STATIC(H5HG_heap_t);
@@ -632,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);
@@ -666,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);
@@ -901,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 */
@@ -1008,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) {
@@ -1071,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);
@@ -1145,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");
@@ -1203,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/H5HGdbg.c b/src/H5HGdbg.c
index bb01709..68a3e85 100644
--- a/src/H5HGdbg.c
+++ b/src/H5HGdbg.c
@@ -29,10 +29,6 @@
#include "H5HGpkg.h" /* Global heaps */
#include "H5Iprivate.h" /* ID Functions */
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/*-------------------------------------------------------------------------
* Function: H5HG_debug
diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h
index 93e7793..2cfa773 100644
--- a/src/H5HGprivate.h
+++ b/src/H5HGprivate.h
@@ -34,10 +34,10 @@
/* 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 H5HG.c) */
+/* Typedef for heap in memory (defined in H5HGpkg.h) */
typedef struct H5HG_heap_t H5HG_heap_t;
H5_DLL herr_t H5HG_insert(H5F_t *f, hid_t dxpl_id, size_t size, void *obj,
diff --git a/src/H5HL.c b/src/H5HL.c
index f217eb5..10e7a6e 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
@@ -86,10 +86,6 @@ const H5AC_class_t H5AC_LHEAP[1] = {{
(H5AC_size_func_t)H5HL_compute_size,
}};
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/* Declare a free list to manage the H5HL_free_t struct */
H5FL_DEFINE_STATIC(H5HL_free_t);
@@ -572,7 +568,7 @@ H5HL_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HL_t *heap)
/* Write the header */
if (H5HL_serialize(f, heap, heap->chunk) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_WRITEERROR, FAIL, "unable to serialize local heap")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTSERIALIZE, FAIL, "unable to serialize local heap")
/* Copy buffer to disk */
hdr_end_addr = addr + (hsize_t)sizeof_hdr;
@@ -699,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/H5HLdbg.c b/src/H5HLdbg.c
index 8a81b9f..aefa7c1 100644
--- a/src/H5HLdbg.c
+++ b/src/H5HLdbg.c
@@ -30,10 +30,6 @@
#include "H5Iprivate.h" /* ID Functions */
#include "H5MMprivate.h" /* Memory management */
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/*-------------------------------------------------------------------------
* Function: H5HL_debug
diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h
index baf9561..5b56ad7 100644
--- a/src/H5HLprivate.h
+++ b/src/H5HLprivate.h
@@ -55,7 +55,7 @@
/* Library Private Typedefs */
/****************************/
-/* Typedef for local heap in memory (defined in H5HL.c) */
+/* Typedef for local heap in memory (defined in H5HLpkg.h) */
typedef struct H5HL_t H5HL_t;
/*
diff --git a/src/H5HP.c b/src/H5HP.c
index 26b6f39..5b35924 100644
--- a/src/H5HP.c
+++ b/src/H5HP.c
@@ -30,10 +30,6 @@
#include "H5HPprivate.h" /* Heap routines */
#include "H5FLprivate.h" /* Memory management functions */
-/* Interface initialization? */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/* Local Macros */
#define H5HP_START_SIZE 16 /* Initial number of entries for heaps */
@@ -62,7 +58,7 @@ static herr_t H5HP_sink_min(H5HP_t *heap, size_t loc);
/* Declare a free list to manage the H5HP_t struct */
H5FL_DEFINE_STATIC(H5HP_t);
-/* Declare a free list to manage arrays of H5HP_ent_t */
+/* Declare a free list to manage sequences of H5HP_ent_t */
H5FL_SEQ_DEFINE_STATIC(H5HP_ent_t);
@@ -419,7 +415,7 @@ H5HP_count(const H5HP_t *heap)
{
ssize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5HP_count,FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5HP_count);
/* Check args */
assert(heap);
@@ -436,9 +432,7 @@ H5HP_count(const H5HP_t *heap)
H5_CHECK_OVERFLOW(heap->nobjs,size_t,ssize_t);
ret_value=(ssize_t)heap->nobjs;
-done:
/* No post-condition check necessary, since heap is constant */
-
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_count() */
@@ -547,9 +541,7 @@ done:
herr_t
H5HP_top(const H5HP_t *heap, int *val)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5HP_top,FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5HP_top);
/* Check args */
assert(heap);
@@ -566,11 +558,8 @@ H5HP_top(const H5HP_t *heap, int *val)
/* Get value of the top object in the heap */
*val=heap->heap[1].val;
-done:
-
/* No post-condition check necessary, since heap is constant */
-
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* end H5HP_top() */
@@ -909,9 +898,7 @@ done:
herr_t
H5HP_close(H5HP_t *heap)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5HP_close,FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5HP_close);
/* Check args */
assert(heap);
@@ -930,7 +917,6 @@ H5HP_close(H5HP_t *heap)
/* Free actual heap object */
H5FL_FREE(H5HP_t,heap);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* end H5HP_close() */
diff --git a/src/H5I.c b/src/H5I.c
index aa342a7..3b17a3c 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -34,6 +34,13 @@
#define H5I_PACKAGE /*suppress error about including H5Ipkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5I_init_interface
+
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5I_mask
+
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
@@ -51,13 +58,6 @@
#include "H5Tprivate.h" /* Datatypes */
#endif /* H5I_DEBUG_OUTPUT */
-/* Pablo information */
-#define PABLO_MASK H5I_mask
-
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5I_init_interface
-
/* Local Macros */
/*
@@ -115,7 +115,6 @@ static H5I_id_group_t *H5I_id_group_list_g[H5I_NGROUPS];
H5FL_DEFINE_STATIC(H5I_id_info_t);
/*--------------------- Local function prototypes ---------------------------*/
-static herr_t H5I_init_interface(void);
static H5I_id_info_t *H5I_find_id(hid_t id);
static hid_t H5I_get_file_id(hid_t obj_id);
static int H5I_get_ref(hid_t id);
@@ -181,7 +180,7 @@ H5I_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5I_term_interface);
- if (interface_initialize_g) {
+ if (H5_interface_initialize_g) {
/* How many groups are still being used? */
for (grp=(H5I_type_t)0; grp<H5I_NGROUPS; H5_INC_ENUM(H5I_type_t,grp)) {
if ((grp_ptr=H5I_id_group_list_g[grp]) && grp_ptr->id_list)
@@ -198,7 +197,7 @@ H5I_term_interface(void)
}
/* Mark interface closed */
- interface_initialize_g = 0;
+ H5_interface_initialize_g = 0;
}
FUNC_LEAVE_NOAPI(n);
}
@@ -1294,7 +1293,9 @@ done:
*
* Purpose: Gets a name of an object from its ID.
*
- * Return: Success: 0, Failure: -1
+ * Return: Success: The length of name.
+ *
+ * Failure: -1
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
@@ -1435,7 +1436,6 @@ done:
}
#endif /* H5I_DEBUG_OUTPUT */
-
/*-------------------------------------------------------------------------
* Function: H5Iget_file_id
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index 766d7df..a244d31 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.h
@@ -37,7 +37,6 @@
#define H5I_OID_HASHSIZE 64
#define H5I_GROUPID_HASHSIZE 64
#define H5I_ATTRID_HASHSIZE 64
-#define H5I_TEMPBUFID_HASHSIZE 64
#define H5I_REFID_HASHSIZE 64
#define H5I_VFL_HASHSIZE 64
#define H5I_GENPROPCLS_HASHSIZE 64
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index 6069fd1..ce29be3 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -41,7 +41,6 @@ typedef enum {
H5I_DATASPACE, /*group ID for Dataspace objects */
H5I_DATASET, /*group ID for Dataset objects */
H5I_ATTR, /*group ID for Attribute objects */
- H5I_TEMPBUF, /*group ID for Temporary buffer objects */
H5I_REFERENCE, /*group ID for Reference objects */
H5I_VFL, /*group ID for virtual file layer */
H5I_GENPROP_CLS, /*group ID for generic property list classes */
diff --git a/src/H5MF.c b/src/H5MF.c
index 9da1a0f..3de5afe 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -42,10 +42,6 @@
#include "H5FDprivate.h"
#include "H5MFprivate.h"
-/* Is the interface initialized? */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/*-------------------------------------------------------------------------
* Function: H5MF_alloc
@@ -127,7 +123,7 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5MF_xfree, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5MF_xfree);
/* check arguments */
assert(f);
@@ -281,9 +277,7 @@ done:
herr_t
H5MF_free_reserved(H5F_t *f, hsize_t size)
{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(H5MF_free_reserved,FAIL)
+ FUNC_ENTER_NOAPI_NOFUNC(H5MF_free_reserved)
/* Check arguments */
assert(f);
@@ -295,8 +289,7 @@ H5MF_free_reserved(H5F_t *f, hsize_t size)
f->shared->lf->reserved_alloc -= size;
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
}
/*-------------------------------------------------------------------------
@@ -323,7 +316,7 @@ H5MF_alloc_overflow(H5F_t *f, hsize_t size)
size_t c; /* Local index variable */
hbool_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5MF_alloc_overflow,FALSE)
+ FUNC_ENTER_NOAPI_NOFUNC(H5MF_alloc_overflow)
/* Start with the current end of the file's address. */
space_needed = (hsize_t)H5F_get_eoa(f);
@@ -361,7 +354,6 @@ H5MF_alloc_overflow(H5F_t *f, hsize_t size)
else
ret_value=FALSE;
-done:
FUNC_LEAVE_NOAPI(ret_value)
}
diff --git a/src/H5MM.c b/src/H5MM.c
index 312c86e..5a191b3 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -33,10 +33,6 @@
#include "H5Eprivate.h"
#include "H5MMprivate.h"
-/* Interface initialization? */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
#ifndef NDEBUG
/*-------------------------------------------------------------------------
diff --git a/src/H5O.c b/src/H5O.c
index 326be7d..1ee6067 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -28,6 +28,9 @@
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#define H5O_PACKAGE /*suppress error about including H5Opkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5O_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5O_mask
@@ -88,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] = {{
@@ -100,11 +103,6 @@ static const H5AC_class_t H5AC_OHDR[1] = {{
(H5AC_size_func_t)H5O_compute_size,
}};
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5O_init_interface
-static herr_t H5O_init_interface(void);
-
/* ID to type mapping */
static const H5O_class_t *const message_type_g[] = {
H5O_NULL, /*0x0000 Null */
@@ -835,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++) {
@@ -847,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);
@@ -925,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;
@@ -940,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));
@@ -3132,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 */
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index c4ae58a..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);
@@ -68,9 +68,6 @@ const H5O_class_t H5O_ATTR[1] = {{
/* Flags for attribute flag encoding */
#define H5O_ATTR_FLAG_TYPE_SHARED 0x01
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-
/* Declare extern the free list for H5A_t's */
H5FL_EXTERN(H5A_t);
@@ -415,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 e1139c4..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);
@@ -64,10 +64,6 @@ const H5O_class_t H5O_BOGUS[1] = {{
H5O_bogus_debug, /*debug the message */
}};
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/*-------------------------------------------------------------------------
* Function: H5O_bogus_decode
@@ -176,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/H5Ocont.c b/src/H5Ocont.c
index 47a1d03..79da2f7 100644
--- a/src/H5Ocont.c
+++ b/src/H5Ocont.c
@@ -63,9 +63,6 @@ const H5O_class_t H5O_CONT[1] = {{
H5O_cont_debug, /*debugging */
}};
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-
/* Declare the free list for H5O_cont_t's */
H5FL_DEFINE(H5O_cont_t);
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 7579d70..3df93b9 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,
@@ -66,9 +66,6 @@ const H5O_class_t H5O_DTYPE[1] = {{
* class objects (array definitely, potentially compound & vlen sequences also) */
#define H5O_DTYPE_VERSION_UPDATED 2
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-
/* Declare external the free list for H5T_t's */
H5FL_EXTERN(H5T_t);
H5FL_EXTERN(H5T_shared_t);
@@ -93,7 +90,7 @@ static herr_t
H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt)
{
unsigned flags, version;
- int i, j;
+ unsigned i, j;
size_t z;
herr_t ret_value=SUCCEED; /* Return value */
@@ -195,7 +192,7 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt)
if (NULL==dt->shared->u.compnd.memb)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
for (i = 0; i < dt->shared->u.compnd.nmembs; i++) {
- int ndims=0; /* Number of dimensions of the array field */
+ unsigned ndims=0; /* Number of dimensions of the array field */
hsize_t dim[H5O_LAYOUT_NDIMS]; /* Dimensions of the array */
int perm[H5O_LAYOUT_NDIMS]; /* Dimension permutations */
unsigned perm_word=0; /* Dimension permutation information */
@@ -256,7 +253,7 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt)
perm[j]=(perm_word>>(j*8))&0xff;
/* Create the array datatype for the field */
- if ((array_dt=H5T_array_create(temp_type,ndims,dim,perm))==NULL) {
+ if ((array_dt=H5T_array_create(temp_type,(int)ndims,dim,perm))==NULL) {
for (j=0; j<=i; j++)
H5MM_xfree(dt->shared->u.compnd.memb[j].name);
H5MM_xfree(dt->shared->u.compnd.memb);
@@ -314,7 +311,6 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt)
* Enumeration data types...
*/
dt->shared->u.enumer.nmembs = dt->shared->u.enumer.nalloc = flags & 0xffff;
- assert(dt->shared->u.enumer.nmembs>=0);
if (NULL==(dt->shared->parent=H5FL_CALLOC(H5T_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
if(NULL== (dt->shared->parent->shared= H5FL_CALLOC (H5T_shared_t))) {
@@ -408,13 +404,13 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt)
*pp += 3;
/* Decode array dimension sizes & compute number of elements */
- for (j=0, dt->shared->u.array.nelem=1; j<dt->shared->u.array.ndims; j++) {
+ for (j=0, dt->shared->u.array.nelem=1; j<(unsigned)dt->shared->u.array.ndims; j++) {
UINT32DECODE(*pp, dt->shared->u.array.dim[j]);
dt->shared->u.array.nelem *= dt->shared->u.array.dim[j];
} /* end for */
/* Decode array dimension permutations (even though they are unused currently) */
- for (j=0; j<dt->shared->u.array.ndims; j++)
+ for (j=0; j<(unsigned)dt->shared->u.array.ndims; j++)
UINT32DECODE(*pp, dt->shared->u.array.perm[j]);
/* Decode base type of array */
@@ -432,7 +428,7 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt)
* Set the "force conversion" flag if a VL base datatype is used or
* or if any components of the base datatype are VL types.
*/
- if(dt->shared->parent->shared->type==H5T_VLEN || dt->shared->parent->shared->force_conv==TRUE)
+ if(dt->shared->parent->shared->force_conv==TRUE)
dt->shared->force_conv=TRUE;
break;
@@ -473,7 +469,7 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt)
htri_t has_array=FALSE; /* Whether a compound datatype has an array inside it */
unsigned flags = 0;
char *hdr = (char *)*pp;
- int i, j;
+ unsigned i, j;
size_t n, z, aligned;
herr_t ret_value=SUCCEED; /* Return value */
@@ -790,11 +786,11 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt)
*(*pp)++ = '\0';
/* Encode array dimensions */
- for (j=0; j<dt->shared->u.array.ndims; j++)
+ for (j=0; j<(unsigned)dt->shared->u.array.ndims; j++)
UINT32ENCODE(*pp, dt->shared->u.array.dim[j]);
/* Encode array dimension permutations */
- for (j=0; j<dt->shared->u.array.ndims; j++)
+ for (j=0; j<(unsigned)dt->shared->u.array.ndims; j++)
UINT32ENCODE(*pp, dt->shared->u.array.perm[j]);
/* Encode base type of array's information */
@@ -979,9 +975,9 @@ 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)
{
- int i;
+ unsigned i;
size_t ret_value = 8;
const H5T_t *dt = (const H5T_t *) mesg;
@@ -1218,7 +1214,7 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream,
const H5T_t *dt = (const H5T_t*)mesg;
const char *s;
char buf[256];
- int i;
+ unsigned i;
size_t k;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_dtype_debug);
@@ -1353,12 +1349,12 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream,
"Rank:",
dt->shared->u.array.ndims);
fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:");
- for (i=0; i<dt->shared->u.array.ndims; i++) {
+ for (i=0; i<(unsigned)dt->shared->u.array.ndims; i++) {
fprintf (stream, "%s%u", i?", ":"", (unsigned)dt->shared->u.array.dim[i]);
}
fprintf (stream, "}\n");
fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Permutation:");
- for (i=0; i<dt->shared->u.array.ndims; i++) {
+ for (i=0; i<(unsigned)dt->shared->u.array.ndims; i++) {
fprintf (stream, "%s%d", i?", ":"", dt->shared->u.array.perm[i]);
}
fprintf (stream, "}\n");
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index 0f53058..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);
@@ -59,9 +59,6 @@ const H5O_class_t H5O_EFL[1] = {{
#define H5O_EFL_VERSION 1
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-
/*-------------------------------------------------------------------------
* Function: H5O_efl_decode
@@ -317,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 bf01af8..8599d82 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,
@@ -90,10 +90,6 @@ const H5O_class_t H5O_FILL_NEW[1] = {{
/* Revised version of the "new" fill value information */
#define H5O_FILL_VERSION_2 2
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/* Declare a free list to manage the H5O_fill_new_t struct */
H5FL_DEFINE(H5O_fill_new_t);
@@ -469,7 +465,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;
@@ -509,7 +505,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;
@@ -580,7 +576,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);
@@ -594,7 +589,7 @@ H5O_fill_reset(void *_mesg)
mesg->type = NULL;
}
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
}
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 4a19b5b..00fd2ab 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);
@@ -68,9 +68,6 @@ const H5O_class_t H5O_LAYOUT[1] = {{
#define H5O_LAYOUT_VERSION_2 2
#define H5O_LAYOUT_VERSION_3 3
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-
/* Declare a free list to manage the H5O_layout_t struct */
H5FL_DEFINE(H5O_layout_t);
@@ -427,7 +424,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)
{
/* Casting away const OK - QAK */
H5O_layout_t *mesg = (H5O_layout_t *) _mesg;
@@ -536,7 +533,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 c272d05..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,
@@ -83,9 +83,6 @@ const H5O_class_t H5O_MTIME_NEW[1] = {{
H5O_mtime_debug, /*debug the message */
}};
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-
/* Current version of new mtime information */
#define H5O_MTIME_VERSION 1
@@ -434,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);
@@ -467,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 04a5a03..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);
@@ -61,9 +61,6 @@ const H5O_class_t H5O_NAME[1] = {{
H5O_name_debug, /*debug the message */
}};
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-
/*-------------------------------------------------------------------------
* Function: H5O_name_decode
@@ -216,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 e4101cd..1fa304f 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -30,15 +30,12 @@
/* Pablo mask */
#define PABLO_MASK H5O_pline_mask
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-
#define H5O_PLINE_VERSION 1
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,
@@ -324,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 e32a734..e6f55cf 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -261,7 +261,7 @@ 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 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);
@@ -272,7 +272,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 8150a88..1b2e351 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,
@@ -55,9 +55,6 @@ const H5O_class_t H5O_SDSPACE[1] = {{
#define H5O_SDSPACE_VERSION 1
-/* Is the interface initialized? */
-#define INTERFACE_INIT NULL
-
/* Declare external the free list for H5S_extent_t's */
H5FL_EXTERN(H5S_extent_t);
@@ -240,6 +237,11 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *mesg)
DESCRIPTION
This function copies a native (memory) simple dimensionality message,
allocating the destination structure if necessary.
+ MODIFICATIONS
+ Raymond Lu
+ April 8, 2004
+ Changed operation on H5S_simple_t to H5S_extent_t.
+
--------------------------------------------------------------------------*/
static void *
H5O_sdspace_copy(const void *mesg, void *dest, unsigned UNUSED update_flags)
@@ -289,7 +291,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 92d959b..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);
@@ -71,9 +71,6 @@ const H5O_class_t H5O_SHARED[1] = {{
/* New version, with just address of object as link for object header sharing */
#define H5O_SHARED_VERSION 2
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-
/*-------------------------------------------------------------------------
* Function: H5O_shared_read
@@ -388,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 cd34fcb..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,
@@ -65,9 +65,6 @@ const H5O_class_t H5O_STAB[1] = {{
H5O_stab_debug, /*debug the message */
}};
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-
/* Declare a free list to manage the H5O_stab_t struct */
H5FL_DEFINE_STATIC(H5O_stab_t);
@@ -267,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/H5P.c b/src/H5P.c
index f5a5ccd..c4d3289 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -19,6 +19,9 @@
#define H5P_PACKAGE /*suppress error about including H5Ppkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5P_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5P_mask
@@ -33,11 +36,6 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Ppkg.h" /* Property lists */
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5P_init_interface
-static herr_t H5P_init_interface(void);
-
/* Local variables */
/*
@@ -313,7 +311,7 @@ H5P_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_term_interface);
- if (interface_initialize_g) {
+ if (H5_interface_initialize_g) {
/* Destroy HDF5 library property classes & lists */
/* Check if there are any open property list classes or lists */
@@ -358,7 +356,7 @@ H5P_term_interface(void)
H5I_destroy_group(H5I_GENPROP_CLS);
n++; /*H5I*/
- interface_initialize_g = 0;
+ H5_interface_initialize_g = 0;
}
}
FUNC_LEAVE_NOAPI(n);
@@ -2201,6 +2199,7 @@ done:
size_t size, void *value);
where the parameters to the callback function are:
hid_t prop_id; IN: The ID of the property list being modified.
+ const char *name; IN: The name of the property being modified.
size_t size; IN: The size of the property value
void *new_value; IN/OUT: The value being set for the property.
The 'set' routine may modify the value to be set and those changes will be
@@ -2413,6 +2412,7 @@ done:
size_t size, void *value);
where the parameters to the callback function are:
hid_t prop_id; IN: The ID of the property list being modified.
+ const char *name; IN: The name of the property being modified.
size_t size; IN: The size of the property value
void *new_value; IN/OUT: The value being set for the property.
The 'set' routine may modify the value to be set and those changes will be
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index b08577f..1751436 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -27,10 +27,6 @@
#include "H5Ppkg.h" /* Property lists */
#include "H5Zprivate.h" /* Data filters */
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/* Local datatypes */
/* Static function prototypes */
@@ -495,7 +491,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_external(hid_t plist_id, int idx, size_t name_size, char *name/*out*/,
+H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name/*out*/,
off_t *offset/*out*/, hsize_t *size/*out*/)
{
H5O_efl_t efl;
@@ -503,7 +499,7 @@ H5Pget_external(hid_t plist_id, int idx, size_t name_size, char *name/*out*/,
herr_t ret_value=SUCCEED; /* return value */
FUNC_ENTER_API(H5Pget_external, FAIL);
- H5TRACE6("e","iIszxxx",plist_id,idx,name_size,name,offset,size);
+ H5TRACE6("e","iIuzxxx",plist_id,idx,name_size,name,offset,size);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
@@ -513,7 +509,7 @@ H5Pget_external(hid_t plist_id, int 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");
- if (idx<0 || (size_t)idx>=efl.nused)
+ if (idx>=efl.nused)
HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, "external file index is out of range");
/* Return values */
@@ -551,6 +547,8 @@ done:
* failed; the filter will not participate in the pipeline
* during an H5Dread() of the chunk. If this bit is clear and
* the filter fails then the entire I/O operation fails.
+ * If this bit is set but encoding is disabled for a filter,
+ * attempting to write will generate an error.
*
* Note: This function currently supports only the permanent filter
* pipeline. That is, PLIST_ID must be a dataset creation
@@ -627,6 +625,8 @@ done:
* failed; the filter will not participate in the pipeline
* during an H5Dread() of the chunk. If this bit is clear and
* the filter fails then the entire I/O operation fails.
+ * If this bit is set but encoding is disabled for a filter,
+ * attempting to write will generate an error.
*
* Note: This function currently supports only the permanent filter
* pipeline. That is, PLIST_ID must be a dataset creation
@@ -767,7 +767,7 @@ done:
*-------------------------------------------------------------------------
*/
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*/)
{
@@ -778,7 +778,7 @@ H5Pget_filter(hid_t plist_id, int idx, unsigned int *flags/*out*/,
H5Z_filter_t ret_value; /* return value */
FUNC_ENTER_API(H5Pget_filter, H5Z_FILTER_ERROR);
- 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);
/* Check args */
@@ -811,7 +811,7 @@ H5Pget_filter(hid_t plist_id, int idx, unsigned int *flags/*out*/,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline");
/* Check more args */
- if (idx<0 || (size_t)idx>=pline.nused)
+ if (idx>=pline.nused)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid");
/* Set pointer to particular filter to query */
@@ -1434,45 +1434,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5P_fill_value_defined
- *
- * Purpose: Check if fill value is defined. Internal version of function
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Raymond Lu
- * Wednesday, January 16, 2002
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5P_fill_value_defined(H5P_genplist_t *plist, H5D_fill_value_t *status)
-{
- herr_t ret_value = SUCCEED;
- H5O_fill_t fill;
-
- FUNC_ENTER_NOAPI(H5P_fill_value_defined, FAIL);
-
- assert(plist);
- assert(status);
-
- /* Get the fill value struct */
- if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
-
- /* Get the fill-value status */
- if(H5P_is_fill_value_defined(&fill, status) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't check fill value status");
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
-} /* end H5P_fill_value_defined() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Pfill_value_defined
*
* Purpose: Check if fill value is defined.
@@ -1491,6 +1452,7 @@ herr_t
H5Pfill_value_defined(hid_t plist_id, H5D_fill_value_t *status)
{
H5P_genplist_t *plist;
+ H5O_fill_t fill;
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(H5Pfill_value_defined, FAIL);
@@ -1502,9 +1464,13 @@ H5Pfill_value_defined(hid_t plist_id, H5D_fill_value_t *status)
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- /* Call the internal function */
- if(H5P_fill_value_defined(plist, status) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value info");
+ /* Get the fill value struct */
+ if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
+
+ /* Get the fill-value status */
+ if(H5P_is_fill_value_defined(&fill, status) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't check fill value status");
done:
FUNC_LEAVE_API(ret_value);
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index 6c042c8..3b8d12f 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -14,19 +14,16 @@
#define H5P_PACKAGE /*suppress error about including H5Ppkg */
+/* Pablo mask */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5P_dxpl_mask
+
/* Private header files */
#include "H5private.h" /* Generic Functions */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Ppkg.h" /* Property lists */
-/* Pablo mask */
-#define PABLO_MASK H5Pdxpl_mask
-
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/* Local datatypes */
/* Static function prototypes */
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 0d4a884..89a9004 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -12,10 +12,12 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* $Id$ */
-
#define H5P_PACKAGE /*suppress error about including H5Ppkg */
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5P_fapl_mask
+
/* Private header files */
#include "H5private.h" /* Generic Functions */
#include "H5Dprivate.h" /* Datasets */
@@ -28,13 +30,6 @@
/* Default file driver - see H5Pget_driver() */
#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */
-/* Pablo mask */
-#define PABLO_MASK H5Pfapl_mask
-
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/* Local datatypes */
/* Static function prototypes */
diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c
index 1567e53..76ca4ed 100644
--- a/src/H5Pfcpl.c
+++ b/src/H5Pfcpl.c
@@ -12,10 +12,12 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* $Id$ */
-
#define H5P_PACKAGE /*suppress error about including H5Ppkg */
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5P_fcpl_mask
+
/* Private header files */
#include "H5private.h" /* Generic Functions */
#include "H5Bprivate.h" /* B-tree subclass names */
@@ -23,13 +25,6 @@
#include "H5Fprivate.h" /* Files */
#include "H5Ppkg.h" /* Property lists */
-/* Pablo mask */
-#define PABLO_MASK H5Pfcpl_mask
-
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/* Local datatypes */
/* Static function prototypes */
@@ -65,8 +60,8 @@ static int interface_initialize_g = 0;
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_version(hid_t plist_id, int *super/*out*/, int *freelist/*out*/,
- int *stab/*out*/, int *shhdr/*out*/)
+H5Pget_version(hid_t plist_id, unsigned *super/*out*/, unsigned *freelist/*out*/,
+ unsigned *stab/*out*/, unsigned *shhdr/*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* Return value */
@@ -432,14 +427,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_sym_k(hid_t plist_id, int ik, unsigned lk)
+H5Pset_sym_k(hid_t plist_id, unsigned ik, unsigned lk)
{
- int btree_k[H5B_NUM_BTREE_ID];
+ 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);
+ H5TRACE3("e","iIuIu",plist_id,ik,lk);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
@@ -483,9 +478,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_sym_k(hid_t plist_id, int *ik /*out */ , unsigned *lk /*out */ )
+H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out */ , unsigned *lk /*out */ )
{
- int btree_k[H5B_NUM_BTREE_ID];
+ unsigned btree_k[H5B_NUM_BTREE_ID];
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* Return value */
@@ -532,17 +527,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_istore_k(hid_t plist_id, int ik)
+H5Pset_istore_k(hid_t plist_id, unsigned ik)
{
- int btree_k[H5B_NUM_BTREE_ID];
+ 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);
+ H5TRACE2("e","iIu",plist_id,ik);
/* Check arguments */
- if (ik <= 0)
+ if (ik == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "istore IK value must be positive");
/* Get the plist structure */
@@ -583,9 +578,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_istore_k(hid_t plist_id, int *ik /*out */ )
+H5Pget_istore_k(hid_t plist_id, unsigned *ik /*out */ )
{
- int btree_k[H5B_NUM_BTREE_ID];
+ unsigned btree_k[H5B_NUM_BTREE_ID];
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index e087624..69990e3 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -60,8 +60,6 @@ H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist,
void *free_info);
H5_DLL herr_t H5P_is_fill_value_defined(const struct H5O_fill_t *fill,
H5D_fill_value_t *status);
-H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist,
- H5D_fill_value_t *status);
/* *SPECIAL* Don't make more of these! -QAK */
H5_DLL htri_t H5P_isa_class(hid_t plist_id, hid_t pclass_id);
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 1c5fc0c..c13d8f8 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -87,9 +87,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)
@@ -159,9 +159,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);
-H5_DLL herr_t H5Pget_version(hid_t plist_id, int *boot/*out*/,
- int *freelist/*out*/, int *stab/*out*/,
- int *shhdr/*out*/);
+H5_DLL herr_t H5Pget_version(hid_t plist_id, unsigned *boot/*out*/,
+ unsigned *freelist/*out*/, unsigned *stab/*out*/,
+ unsigned *shhdr/*out*/);
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,
@@ -176,11 +176,11 @@ H5_DLL herr_t H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr/*out*/,
H5_DLL herr_t H5Pset_sym_k(hid_t plist_id, int ik, int lk);
H5_DLL herr_t H5Pget_sym_k(hid_t plist_id, int *ik/*out*/, int *lk/*out*/);
#else /* H5_WANT_H5_V1_4_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_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*/);
#endif /* H5_WANT_H5_V1_4_COMPAT */
-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*/);
+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*/);
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[]);
@@ -188,7 +188,7 @@ H5_DLL int H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[]/*out*/);
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);
-H5_DLL herr_t H5Pget_external(hid_t plist_id, int idx, size_t name_size,
+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*/);
H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id,
@@ -219,7 +219,7 @@ H5_DLL herr_t H5Pset_filter(hid_t plist_id, H5Z_filter_t filter,
unsigned int flags, size_t cd_nelmts,
const unsigned int c_values[]);
H5_DLL int H5Pget_nfilters(hid_t plist_id);
-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/H5Ptest.c b/src/H5Ptest.c
index 56a5f1c..f92ee48 100644
--- a/src/H5Ptest.c
+++ b/src/H5Ptest.c
@@ -21,19 +21,16 @@
#define H5P_PACKAGE /*suppress error about including H5Ppkg */
#define H5P_TESTING /*suppress warning about H5P testing funcs*/
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5P_test_mask
+
/* Private header files */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5Ppkg.h" /* Property lists */
-/* Pablo mask */
-#define PABLO_MASK H5Ptest_mask
-
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/* Local variables */
/* Local typedefs */
diff --git a/src/H5R.c b/src/H5R.c
index f23afa4..f8c2974 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -14,6 +14,13 @@
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5R_init_interface
+
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5R_mask
+
#include "H5private.h" /* Generic Functions */
#include "H5Iprivate.h" /* ID Functions */
#include "H5Dprivate.h" /* Datasets */
@@ -26,12 +33,6 @@
#include "H5Sprivate.h" /* Dataspace functions */
#include "H5Tprivate.h" /* Datatypes */
-/* Interface initialization */
-#define PABLO_MASK H5R_mask
-#define INTERFACE_INIT H5R_init_interface
-static int interface_initialize_g = 0;
-static herr_t H5R_init_interface(void);
-
/* Static functions */
static herr_t H5R_create(void *ref, H5G_entry_t *loc, const char *name,
H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id);
@@ -93,12 +94,12 @@ H5R_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5R_term_interface);
- if (interface_initialize_g) {
+ if (H5_interface_initialize_g) {
if ((n=H5I_nmembers(H5I_REFERENCE))) {
H5I_clear_group(H5I_REFERENCE, FALSE);
} else {
H5I_destroy_group(H5I_REFERENCE);
- interface_initialize_g = 0;
+ H5_interface_initialize_g = 0;
n = 1; /*H5I*/
}
}
@@ -401,7 +402,7 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
if(H5O_link(&ent,0,dxpl_id)<=0)
HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object");
- /* Open the dataset object */
+ /* Open the object */
oid_type=H5G_get_type(&ent,dxpl_id);
switch(oid_type) {
case H5G_GROUP:
@@ -416,7 +417,7 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
break;
case H5G_TYPE:
- if ((type=H5T_open(&ent, dxpl_id)) ==NULL)
+ if ((type=H5T_open(&ent, dxpl_id)) == NULL)
HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "not found");
/* Create an atom for the datatype */
@@ -428,7 +429,7 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
case H5G_DATASET:
/* Open the dataset */
- if ((dset=H5D_open(&ent,dxpl_id)) ==NULL)
+ if ((dset=H5D_open(&ent,dxpl_id))==NULL)
HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found");
/* Create an atom for the dataset */
@@ -659,7 +660,7 @@ H5R_get_object_type(H5F_t *file, hid_t dxpl_id, void *_ref)
uint8_t *p; /* Pointer to OID to store */
int ret_value;
- FUNC_ENTER_NOAPI_NOINIT(H5R_get_object_type);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5R_get_object_type);
assert(ref);
assert(file);
diff --git a/src/H5RC.c b/src/H5RC.c
index 644ef3a..8ab1818 100644
--- a/src/H5RC.c
+++ b/src/H5RC.c
@@ -27,10 +27,6 @@
#include "H5FLprivate.h" /* Free lists */
#include "H5RCprivate.h" /* Reference-counted buffers */
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/* Private typedefs & structs */
/* Declare a free list to manage the H5RC_t struct */
diff --git a/src/H5RS.c b/src/H5RS.c
index d55d725..1a7b332 100644
--- a/src/H5RS.c
+++ b/src/H5RS.c
@@ -19,16 +19,13 @@
*
*/
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5RSprivate.h" /* Reference-counted strings */
-
/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5RS_mask
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5RSprivate.h" /* Reference-counted strings */
/* Private typedefs & structs */
struct H5RS_str_t {
@@ -226,9 +223,7 @@ done:
herr_t
H5RS_decr(H5RS_str_t *rs)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5RS_decr,FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5RS_decr);
/* Sanity check */
assert(rs);
@@ -241,8 +236,7 @@ H5RS_decr(H5RS_str_t *rs)
H5FL_FREE(H5RS_str_t,rs);
} /* end if */
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* end H5RS_decr() */
@@ -267,9 +261,7 @@ done:
herr_t
H5RS_incr(H5RS_str_t *rs)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5RS_incr,FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5RS_incr);
/* Sanity check */
assert(rs);
@@ -287,8 +279,7 @@ H5RS_incr(H5RS_str_t *rs)
/* Increment reference count for string */
rs->n++;
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* end H5RS_incr() */
@@ -314,14 +305,13 @@ done:
H5RS_str_t *
H5RS_dup(H5RS_str_t *ret_value)
{
- FUNC_ENTER_NOAPI(H5RS_dup,NULL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5RS_dup);
/* Check for valid reference counted string */
if(ret_value!=NULL)
/* Increment reference count for string */
ret_value->n++;
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5RS_dup() */
@@ -384,18 +374,13 @@ H5RS_cmp(const H5RS_str_t *rs1, const H5RS_str_t *rs2)
ssize_t
H5RS_len(const H5RS_str_t *rs)
{
- ssize_t ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(H5RS_len,FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5RS_len);
/* Sanity check */
assert(rs);
assert(rs->s);
- ret_value=(ssize_t)HDstrlen(rs->s);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI((ssize_t)HDstrlen(rs->s));
} /* end H5RS_len() */
@@ -423,18 +408,13 @@ done:
char *
H5RS_get_str(const H5RS_str_t *rs)
{
- char *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(H5RS_get_str,NULL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5RS_get_str);
/* Sanity check */
assert(rs);
assert(rs->s);
- ret_value=rs->s;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(rs->s);
} /* end H5RS_get_str() */
@@ -460,17 +440,12 @@ done:
unsigned
H5RS_get_count(const H5RS_str_t *rs)
{
- unsigned ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(H5RS_get_count,0);
+ FUNC_ENTER_NOAPI_NOFUNC(H5RS_get_count);
/* Sanity check */
assert(rs);
assert(rs->n>0);
- ret_value=rs->n;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(rs->n);
} /* end H5RS_get_count() */
diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h
index 9cdd56e..006523e 100644
--- a/src/H5Rpublic.h
+++ b/src/H5Rpublic.h
@@ -49,8 +49,8 @@ typedef struct {
* them. -QAK
*/
#define H5R_OBJ_REF_BUF_SIZE sizeof(haddr_t)
-typedef haddr_t hobj_ref_t; /* Buffer to store OID of object referenced */
- /* Needs to be large enough to store largest haddr_t in a worst case machine (ie. 8 bytes currently) */
+/* Object reference structure for user's code */
+typedef haddr_t hobj_ref_t; /* Needs to be large enough to store largest haddr_t in a worst case machine (ie. 8 bytes currently) */
#define H5R_DSET_REG_REF_BUF_SIZE (sizeof(haddr_t)+4)
/* 4 is used instead of sizeof(int) to permit portability between
diff --git a/src/H5S.c b/src/H5S.c
index 273676a..09f5f8e 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -14,6 +14,9 @@
#define H5S_PACKAGE /*suppress error about including H5Spkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5S_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5S_mask
@@ -33,11 +36,6 @@ static herr_t H5S_set_extent_simple (H5S_t *space, unsigned rank,
const hsize_t *dims, const hsize_t *max);
static htri_t H5S_is_simple(const H5S_t *sdim);
-/* Interface initialization */
-#define INTERFACE_INIT H5S_init_interface
-static int interface_initialize_g = 0;
-static herr_t H5S_init_interface(void);
-
#ifdef H5S_DEBUG
/* Names of the selection names, for debugging */
static const char *H5S_sel_names[]={
@@ -64,9 +62,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
@@ -132,11 +127,11 @@ H5S_term_interface(void)
int j, nprints=0;
H5S_iostats_t *path=NULL;
char buf[256];
-#endif
+#endif /* H5S_DEBUG */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_term_interface);
- if (interface_initialize_g) {
+ if (H5_interface_initialize_g) {
if ((n=H5I_nmembers(H5I_DATASPACE))) {
H5I_clear_group(H5I_DATASPACE, FALSE);
} else {
@@ -269,7 +264,7 @@ H5S_term_interface(void)
#endif /* H5S_DEBUG */
/* Shut down interface */
- interface_initialize_g = 0;
+ H5_interface_initialize_g = 0;
n = 1; /*H5I*/
}
}
@@ -1653,6 +1648,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 96f09f2..85c1e37 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -146,12 +146,7 @@ struct H5SL_t {
H5SL_node_t *header; /* Header for nodes in skip list */
};
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5SL_init_interface
-
/* Static functions */
-static herr_t H5SL_init_interface(void);
static size_t H5SL_random_level(int p1, size_t max_level);
static H5SL_node_t * H5SL_new_node(size_t lvl, void *item, void *key);
@@ -369,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/H5ST.c b/src/H5ST.c
index 90d61a3..e88af28 100644
--- a/src/H5ST.c
+++ b/src/H5ST.c
@@ -25,10 +25,6 @@ Bentley and Robert Sedgewick in the April, 1998, Dr. Dobb's Journal.
#include "H5FLprivate.h" /* Free lists */
#include "H5STprivate.h" /* Ternary search trees */
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/* Declare a free list to manage the H5ST_node_t struct */
H5FL_DEFINE_STATIC(H5ST_node_t);
@@ -253,7 +249,7 @@ H5ST_search(H5ST_tree_t *tree, const char *s)
H5ST_ptr_t p; /* Temporary pointer to TST node */
htri_t ret_value=FALSE; /* Return value */
- FUNC_ENTER_NOAPI(H5ST_search,FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5ST_search);
p = tree->root;
while (p) {
@@ -550,7 +546,7 @@ H5ST_findnext(H5ST_ptr_t p)
H5ST_ptr_t q; /* Temporary pointer to TST node */
H5ST_ptr_t ret_value=NULL; /* Return value */
- FUNC_ENTER_NOAPI(H5ST_findnext,NULL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5ST_findnext);
/* Find the next node at the current level, or go back up the tree */
do {
@@ -743,7 +739,7 @@ done:
herr_t
H5ST_dump_internal(H5ST_ptr_t p)
{
- FUNC_ENTER_NOAPI_NOINIT(H5ST_dump_internal);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5ST_dump_internal);
if (p) {
printf("p=%p\n",p);
@@ -762,7 +758,6 @@ H5ST_dump_internal(H5ST_ptr_t p)
H5ST_dump_internal(p->hikid);
} /* end if */
-done:
FUNC_LEAVE_NOAPI(SUCCEED);
} /* end H5ST_dump_internal() */
@@ -788,14 +783,11 @@ done:
herr_t
H5ST_dump(H5ST_tree_t *tree)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5ST_dump,NULL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5ST_dump,NULL);
/* Dump the tree */
H5ST_dump_internal(tree->root);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* end H5ST_dump() */
#endif /* H5ST_DEBUG */
diff --git a/src/H5Sall.c b/src/H5Sall.c
index e004800..5472d42 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -23,7 +23,7 @@
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
-#define PABLO_MASK H5Sall_mask
+#define PABLO_MASK H5S_all_mask
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
@@ -31,10 +31,6 @@
#include "H5Spkg.h" /* Dataspace functions */
#include "H5Vprivate.h" /* Vector functions */
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/* Static function prototypes */
/* Selection callbacks */
@@ -47,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);
@@ -113,9 +109,7 @@ static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{
herr_t
H5S_all_iter_init (H5S_sel_iter_t *iter, const H5S_t *space)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_all_iter_init, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_all_iter_init);
/* Check args */
assert (space && H5S_SEL_ALL==H5S_GET_SELECT_TYPE(space));
@@ -131,8 +125,7 @@ H5S_all_iter_init (H5S_sel_iter_t *iter, const H5S_t *space)
/* Initialize type of selection iterator */
iter->type=H5S_sel_iter_all;
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_all_iter_init() */
@@ -152,7 +145,7 @@ done:
*-------------------------------------------------------------------------
*/
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 */
@@ -187,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 */
@@ -380,9 +373,7 @@ H5S_all_iter_release (H5S_sel_iter_t UNUSED * iter)
herr_t
H5S_all_release (H5S_t UNUSED * space)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_all_release, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_all_release);
/* Check args */
assert (space);
@@ -390,8 +381,7 @@ H5S_all_release (H5S_t UNUSED * space)
/* Reset the number of elements in the selection */
space->select.num_elem=0;
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_all_release() */
@@ -417,9 +407,7 @@ done:
herr_t
H5S_all_copy(H5S_t *dst, const H5S_t UNUSED *src, hbool_t UNUSED share_selection)
{
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_NOAPI(H5S_all_copy, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_all_copy);
assert(src);
assert(dst);
@@ -427,8 +415,7 @@ H5S_all_copy(H5S_t *dst, const H5S_t UNUSED *src, hbool_t UNUSED share_selection
/* Set number of elements in selection */
dst->select.num_elem=(hsize_t)H5S_GET_EXTENT_NPOINTS(dst);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* end H5S_all_copy() */
@@ -455,14 +442,11 @@ done:
htri_t
H5S_all_is_valid (const H5S_t UNUSED *space)
{
- htri_t ret_value=TRUE; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_all_is_valid, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_all_is_valid);
assert(space);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(TRUE);
} /* end H5S_all_is_valid() */
@@ -488,9 +472,7 @@ done:
hssize_t
H5S_all_serial_size (const H5S_t UNUSED *space)
{
- hssize_t ret_value=FAIL; /* return value */
-
- FUNC_ENTER_NOAPI(H5S_all_serial_size, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_all_serial_size);
assert(space);
@@ -498,10 +480,7 @@ H5S_all_serial_size (const H5S_t UNUSED *space)
* <type (4 bytes)> + <version (4 bytes)> + <padding (4 bytes)> +
* <length (4 bytes)> = 16 bytes
*/
- ret_value=16;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(16);
} /* end H5S_all_serial_size() */
@@ -527,9 +506,7 @@ done:
herr_t
H5S_all_serialize (const H5S_t *space, uint8_t *buf)
{
- herr_t ret_value=FAIL; /* return value */
-
- FUNC_ENTER_NOAPI(H5S_all_serialize, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_all_serialize);
assert(space);
@@ -539,11 +516,7 @@ H5S_all_serialize (const H5S_t *space, uint8_t *buf)
UINT32ENCODE(buf, (uint32_t)0); /* Store the un-used padding */
UINT32ENCODE(buf, (uint32_t)0); /* Store the additional information length */
- /* Set success */
- ret_value=SUCCEED;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_all_serialize() */
@@ -592,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
@@ -610,13 +583,12 @@ 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 */
- herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_NOAPI(H5S_all_bounds, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_all_bounds);
assert(space);
assert(start);
@@ -628,11 +600,10 @@ 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 */
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5Sget_all_bounds() */
@@ -657,14 +628,11 @@ done:
htri_t
H5S_all_is_contiguous(const H5S_t UNUSED *space)
{
- htri_t ret_value=TRUE; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_all_is_contiguous, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_all_is_contiguous);
assert(space);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(TRUE);
} /* H5S_all_is_contiguous() */
@@ -689,14 +657,11 @@ done:
htri_t
H5S_all_is_single(const H5S_t UNUSED *space)
{
- htri_t ret_value=TRUE; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_all_is_single, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_all_is_single);
assert(space);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(TRUE);
} /* H5S_all_is_single() */
@@ -722,15 +687,12 @@ done:
htri_t
H5S_all_is_regular(const H5S_t UNUSED *space)
{
- htri_t ret_value=TRUE; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_all_is_regular, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_all_is_regular);
/* Check args */
assert(space);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(TRUE);
} /* H5S_all_is_regular() */
@@ -852,9 +814,8 @@ H5S_all_get_seq_list(const H5S_t UNUSED *space, unsigned UNUSED flags, H5S_sel_i
hsize_t *off, size_t *len)
{
size_t elem_used; /* The number of elements used */
- herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_NOAPI (H5S_all_get_seq_list, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_all_get_seq_list);
/* Check args */
assert(space);
@@ -885,7 +846,6 @@ H5S_all_get_seq_list(const H5S_t UNUSED *space, unsigned UNUSED flags, H5S_sel_i
iter->u.all.elmt_offset+=elem_used;
iter->u.all.byte_offset+=len[0];
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* end H5S_all_get_seq_list() */
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 510f26d..eb25a8c 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -32,10 +32,6 @@
#include "H5Spkg.h" /* Dataspace functions */
#include "H5Vprivate.h" /* Vector functions */
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/* Local datatypes */
/* Static function prototypes */
@@ -45,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);
/* Selection callbacks */
@@ -58,15 +54,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);
@@ -132,7 +128,7 @@ H5FL_DEFINE_STATIC(H5S_hyper_span_info_t);
static herr_t
H5S_hyper_print_spans_helper(FILE *f, struct H5S_hyper_span_t *span,unsigned depth)
{
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_print_spans_helper);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_print_spans_helper);
while(span) {
HDfprintf(f,"%s: depth=%u, span=%p, (%d, %d), nelem=%u, pstride=%u\n",FUNC,depth,span,(int)span->low,(int)span->high,(unsigned)span->nelem,(unsigned)span->pstride);
@@ -149,7 +145,7 @@ H5S_hyper_print_spans_helper(FILE *f, struct H5S_hyper_span_t *span,unsigned dep
herr_t
H5S_hyper_print_spans(FILE *f, const struct H5S_hyper_span_info_t *span_lst)
{
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_print_spans);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_print_spans);
if(span_lst!=NULL) {
HDfprintf(f,"%s: spans=%p, count=%u, scratch=%p, head=%p\n",FUNC,span_lst,span_lst->count,span_lst->scratch,span_lst->head);
@@ -174,7 +170,7 @@ H5S_hyper_print_diminfo_helper(FILE *f, const char *field, unsigned ndims, const
{
unsigned u; /* Local index variable */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_print_diminfo_helper);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_print_diminfo_helper);
if(dinfo!=NULL) {
HDfprintf(f,"%s: %s: start=[",FUNC,field);
@@ -236,9 +232,8 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
unsigned rank; /* Dataspace's dimension rank */
unsigned u; /* Index variable */
int i; /* Index variable */
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5S_hyper_iter_init, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_iter_init);
/* Check args */
assert(space && H5S_SEL_HYPERSLABS==H5S_GET_SELECT_TYPE(space));
@@ -396,8 +391,7 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
/* Initialize type of selection iterator */
iter->type=H5S_sel_iter_hyper;
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_hyper_iter_init() */
@@ -417,7 +411,7 @@ done:
*-------------------------------------------------------------------------
*/
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);
@@ -437,17 +431,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() */
@@ -472,7 +465,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 */
@@ -564,7 +557,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;
@@ -573,8 +566,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 */
@@ -707,7 +699,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 */
@@ -907,7 +899,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 */
@@ -1033,7 +1025,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
@@ -1048,7 +1040,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;
@@ -1667,10 +1659,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 */
@@ -1717,7 +1709,7 @@ H5S_hyper_is_valid (const H5S_t *space)
unsigned u; /* Counter */
htri_t ret_value=TRUE; /* return value */
- FUNC_ENTER_NOAPI(H5S_hyper_is_valid, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_is_valid);
assert(space);
@@ -1732,12 +1724,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])
@@ -1908,7 +1900,7 @@ H5S_hyper_serial_size (const H5S_t *space)
hssize_t block_count; /* block counter for regular hyperslabs */
hssize_t ret_value; /* return value */
- FUNC_ENTER_NOAPI(H5S_hyper_serial_size, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_serial_size);
assert(space);
@@ -1931,7 +1923,6 @@ H5S_hyper_serial_size (const H5S_t *space)
ret_value+=8*space->extent.rank*block_count;
} /* end else */
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5S_hyper_serial_size() */
@@ -1959,7 +1950,7 @@ done:
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 */
@@ -2038,10 +2029,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 */
@@ -2050,9 +2041,8 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t *buf)
int temp_dim; /* Temporary rank holder */
int ndims; /* Rank of the dataspace */
int done; /* Whether we are done with the iteration */
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5S_hyper_serialize, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_serialize);
assert(space);
@@ -2170,8 +2160,7 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t *buf)
/* Encode length */
UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_hyper_serialize() */
@@ -2199,13 +2188,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 */
@@ -2263,8 +2252,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
@@ -2289,7 +2278,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 */
@@ -2394,10 +2383,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 */
@@ -2597,12 +2586,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);
@@ -2613,6 +2602,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];
@@ -2622,7 +2615,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 */
@@ -2630,7 +2623,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() */
@@ -2661,13 +2654,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(H5S_hyper_bounds, FAIL);
+ FUNC_ENTER_NOAPI(H5S_hyper_bounds,FAIL)
assert(space);
assert(start);
@@ -2676,8 +2669,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 */
@@ -2686,6 +2679,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];
@@ -2699,7 +2696,7 @@ H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
} /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_bounds() */
@@ -2731,7 +2728,7 @@ H5S_hyper_is_contiguous(const H5S_t *space)
large_contiguous; /* Flag for large contiguous block */
htri_t ret_value=FALSE; /* return value */
- FUNC_ENTER_NOAPI(H5S_hyper_is_contiguous, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_is_contiguous);
assert(space);
@@ -2825,7 +2822,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 */
@@ -2883,7 +2880,6 @@ H5S_hyper_is_contiguous(const H5S_t *space)
ret_value=TRUE;
} /* end else */
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_hyper_is_contiguous() */
@@ -2914,7 +2910,7 @@ H5S_hyper_is_single(const H5S_t *space)
unsigned u; /* index variable */
htri_t ret_value=TRUE; /* return value */
- FUNC_ENTER_NOAPI(H5S_hyper_is_single, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_is_single);
assert(space);
@@ -2981,7 +2977,7 @@ H5S_hyper_is_regular(const H5S_t *space)
{
htri_t ret_value; /* return value */
- FUNC_ENTER_NOAPI(H5S_hyper_is_regular, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_is_regular);
/* Check args */
assert(space);
@@ -2992,7 +2988,6 @@ H5S_hyper_is_regular(const H5S_t *space)
else
ret_value=FALSE;
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_hyper_is_regular() */
@@ -3096,7 +3091,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
@@ -3107,7 +3102,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 */
@@ -3161,7 +3156,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
@@ -3173,7 +3168,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 */
@@ -3363,7 +3358,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
@@ -3375,7 +3370,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 */
@@ -3504,7 +3499,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 */
@@ -3666,9 +3661,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
@@ -3678,7 +3673,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 */
@@ -3698,11 +3693,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 {
@@ -3748,7 +3743,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 */
@@ -3764,7 +3759,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");
@@ -3780,11 +3775,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_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(spans, offset)
+ 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
@@ -3797,11 +3901,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);
@@ -3818,14 +3922,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;
@@ -3833,16 +3936,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
@@ -3855,12 +3958,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);
@@ -3868,14 +3971,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 */
@@ -3885,7 +3988,7 @@ H5S_hyper_adjust(H5S_t *space, const hssize_t *offset)
done:
FUNC_LEAVE_NOAPI(ret_value);
-} /* H5S_hyper_adjust() */
+} /* H5S_hyper_adjust_s() */
/*--------------------------------------------------------------------------
@@ -3929,10 +4032,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)
@@ -3979,8 +4081,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 */
@@ -4036,7 +4138,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 */
@@ -4058,7 +4160,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
@@ -4072,7 +4174,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 */
@@ -5030,7 +5132,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
@@ -5041,11 +5143,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);
@@ -5080,7 +5182,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
@@ -5098,7 +5200,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 */
@@ -5328,7 +5430,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 */
@@ -5373,7 +5475,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[])
@@ -5382,7 +5484,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 */
@@ -5407,9 +5508,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;
@@ -5427,9 +5526,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;
@@ -5448,9 +5545,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;
@@ -5472,18 +5567,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;
@@ -5502,9 +5593,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;
@@ -5526,9 +5615,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;
@@ -5609,7 +5696,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)
@@ -5708,7 +5795,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 */
@@ -5817,10 +5904,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
@@ -5835,7 +5922,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 */
@@ -5843,7 +5930,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)))
@@ -5911,7 +5998,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 */
@@ -6340,16 +6427,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 f1f171b..da285cd 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -39,10 +39,6 @@
#ifdef H5_HAVE_PARALLEL
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
static herr_t
H5S_mpio_all_type( const H5S_t *space, size_t elmt_size,
/* out: */
@@ -65,6 +61,18 @@ H5S_mpio_hyper_type( const H5S_t *space, size_t elmt_size,
hsize_t *extra_offset,
hbool_t *is_derived_type );
+static herr_t
+H5S_mpio_span_hyper_type( const H5S_t *space, size_t elmt_size,
+ /* out: */
+ MPI_Datatype *new_type,
+ size_t *count,
+ hsize_t *extra_offset,
+ hbool_t *is_derived_type );
+
+static herr_t obtain_datatype(const hsize_t size[],
+ H5S_hyper_span_t* span,MPI_Datatype *span_type,
+ size_t elmt_size,int dimindex);
+
/*-------------------------------------------------------------------------
* Function: H5S_mpio_all_type
@@ -542,4 +550,348 @@ H5S_mpio_space_type( const H5S_t *space, size_t elmt_size,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5S_mpio_space_span_ type
+ *
+ * Purpose: Translate an HDF5 dataspace selection into a general
+ MPI derivewd datatype built with span-tree.
+ *
+ * Currently handle only hyperslab and "all" selections.
+ *
+ * Return: non-negative on success, negative on failure.
+ *
+ * Outputs: *new_type the MPI type corresponding to the selection
+ * *count how many objects of the new_type in selection
+ * (useful if this is the buffer type for xfer)
+ * *extra_offset Number of bytes of offset within dataset
+ * *is_derived_type 0 if MPI primitive type, 1 if derived
+ *
+ * Programmer: KY
+ *
+ * Modifications:
+ *
+ * Quincey Koziol, June 18, 2002
+ * Added 'extra_offset' parameter
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5S_mpio_space_span_type( const H5S_t *space, size_t elmt_size,
+ /* out: */
+ MPI_Datatype *new_type,
+ size_t *count,
+ hsize_t *extra_offset,
+ hbool_t *is_derived_type )
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT(H5S_mpio_space_span_type);
+
+ /* Check args */
+ assert (space);
+
+ /* Creat MPI type based on the kind of selection */
+ switch (H5S_GET_EXTENT_TYPE(space)) {
+ case H5S_SCALAR:
+ case H5S_SIMPLE:
+ switch(H5S_GET_SELECT_TYPE(space)) {
+ case H5S_SEL_NONE:
+ if ( H5S_mpio_none_type( space, elmt_size,
+ /* out: */ new_type, count, extra_offset, is_derived_type ) <0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert \"all\" selection to MPI type");
+ break;
+
+ case H5S_SEL_ALL:
+ if ( H5S_mpio_all_type( space, elmt_size,
+ /* out: */ new_type, count, extra_offset, is_derived_type ) <0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert \"all\" selection to MPI type");
+ break;
+
+ case H5S_SEL_POINTS:
+ /* not yet implemented */
+ ret_value = FAIL;
+ break;
+
+ case H5S_SEL_HYPERSLABS:
+ if(H5S_mpio_span_hyper_type( space, elmt_size,
+ /* out: */ new_type, count, extra_offset, is_derived_type )<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert \"all\" selection to MPI type");
+ break;
+
+ default:
+ assert("unknown selection type" && 0);
+ break;
+ } /* end switch */
+ break;
+
+ case H5S_COMPLEX:
+ /* not yet implemented */
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "complex data spaces are not supported yet");
+
+ default:
+ assert("unknown data space type" && 0);
+ break;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+}
+
+
+/* The following codes have been used by Kent to test
+ general collective derived datatype functionality.
+ It should NOT be called by other routines except with
+ macro #ifdef KENT #endif
+ Nov. 11th, 2004 */
+
+
+static herr_t
+H5S_mpio_span_hyper_type( const H5S_t *space, size_t elmt_size,
+ /* out: */
+ MPI_Datatype *new_type,
+ size_t *count,
+ hsize_t *extra_offset,
+ hbool_t *is_derived_type ){
+
+ MPI_Datatype span_type;
+ H5S_hyper_span_t *ospan;
+ H5S_hyper_span_info_t *odown;
+ hsize_t *size;
+ int rank;
+ herr_t ret_value = SUCCEED;
+
+ MPI_Aint extent,lb;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_mpio_span_hyper_type);
+
+ printf("coming to hyper type \n");
+ /* Check args */
+ assert (space);
+ /* assert(sizeof(MPI_Aint) >= sizeof(elmt_size));?? */
+
+ /* Only for simple extent
+ rank = space->extent.u.simple.rank;
+ */
+ rank = space->extent.rank;
+
+ /* size = HDcalloc((size_t)rank,sizeof(hsize_t)); */
+ if (0==elmt_size)
+ goto empty;
+ size = space->extent.size;
+
+
+ odown = space->select.sel_info.hslab->span_lst;
+ if(odown == NULL)
+ goto empty;
+ ospan = odown->head;
+ if(ospan == NULL)
+ goto empty;
+
+ obtain_datatype(space->extent.size,ospan,&span_type,elmt_size,rank);
+ MPI_Type_commit(&span_type);
+
+ MPI_Type_lb(span_type,&lb);
+ printf("lb %d\n",lb);
+ MPI_Type_extent(span_type,&extent);
+ printf("extent %d\n",extent);
+ *new_type = span_type;
+ /* fill in the remaining return values */
+ *count = 1;
+ *extra_offset = 0;
+ *is_derived_type = 1;
+ printf("before freeing size\n");
+ /* HDfree(size);*/
+ printf("after freeing size\n");
+ HGOTO_DONE(SUCCEED);
+
+empty:
+ /* special case: empty hyperslab */
+ *new_type = MPI_BYTE;
+ *count = 0;
+ *extra_offset = 0;
+ *is_derived_type = 0;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+ }
+
+
+static herr_t obtain_datatype(const hsize_t size[], H5S_hyper_span_t* span,MPI_Datatype *span_type,
+ size_t elmt_size,int dimindex) {
+
+ int innercount,outercount;
+ MPI_Datatype bas_type;
+ MPI_Datatype temp_type;
+ MPI_Datatype tempinner_type;
+ MPI_Datatype *inner_type;
+ 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;
+
+ assert(span);
+
+ inner_type = NULL;
+ down = NULL;
+ tspan= NULL;
+ down = span->down;
+ tspan = span;
+
+ outercount = 0;
+ while(tspan) {
+ if(tspan) {
+ HDfprintf(stdout, " span->low %Hd\n",tspan->low);
+ HDfprintf(stdout, " span->high %Hd\n",tspan->high);
+ HDfprintf(stdout, " span->nelm %Hu\n",tspan->nelem);
+ }
+ tspan = tspan->next;
+ outercount ++;
+ }
+
+ if(outercount == 0) {
+ span_type = NULL;
+ return 0;
+ }
+ printf("outercount %d\n",outercount);
+#ifdef H5_HAVE_MPI2
+ printf("coming into HAVE_MPI2\n");
+ fflush(stdout);
+
+ MPI_Type_extent(MPI_Aint,&sizeaint);
+ MPI_Type_extent(MPI_Datatype,&sizedtype);
+ printf("coming into HAVE_MPI2 type extent\n");
+ fflush(stdout);
+
+ blocklen = (int *)HDcalloc((size_t)outercount,sizeof(int));
+ disp = (MPI_Aint *)HDcalloc((size_t)outercount,sizeaint);
+ inner_type = (MPI_Datatype *)HDcalloc((size_t)outercount,sizedtype);
+#else
+ printf("coming to MPI2 else \n");
+ blocklen = (int *)HDcalloc((size_t)outercount,sizeof(int));
+ disp = (MPI_Aint *)HDcalloc((size_t)outercount,sizeof(int));
+ inner_type = (MPI_Datatype *)HDcalloc((size_t)outercount,sizeof(int));
+ printf("end of calloc \n");
+#endif
+
+
+ tspan = span;
+ outercount = 0;
+
+ if(down == NULL){
+ printf("coming to down = NULL \n");
+ if(dimindex > 1) printf("wrong area \n");
+ MPI_Type_contiguous((int)elmt_size,MPI_BYTE,&bas_type);
+ MPI_Type_commit(&bas_type);
+ printf("after type commit \n");
+ while(tspan){
+ disp[outercount] = (MPI_Aint)elmt_size * tspan->low;
+ blocklen[outercount] = tspan->nelem;
+ tspan = tspan->next;
+ outercount ++;
+ }
+ /* printf("outercount %d\n",outercount);
+ printf("after while loop \n");*/
+ ret = MPI_Type_hindexed(outercount,blocklen,disp,bas_type,span_type);
+ if(ret < 0) printf("type hindexed doesn't work\n");
+ printf("after hindexed \n");
+
+
+ }
+ else {/* dimindex is the rank of the dimension */
+
+ if(dimindex <2) printf("something is wrong \n");
+ /* Calculate the total bytes of the lower dimension */
+ total_lowd = 1; /* one dimension down */
+ total_lowd1 = 1; /* two dimensions down */
+
+ for ( i = dimindex-1; i > 0; i--)
+ total_lowd = total_lowd * size[i];
+
+ for ( i = dimindex-1; i > 1; i--)
+ total_lowd1 = total_lowd1 * size[i];
+
+ HDfprintf(stdout, " one dimension down size %Hu\n",total_lowd);
+ HDfprintf(stdout, " two dimension down size %Hu\n",total_lowd1);
+
+ while(tspan){
+/* Displacement should be in byte and should have dimension information */
+/* First using MPI Type vector to build derived data type for this span only */
+/* Need to calculate the disp in byte for this dimension. */
+ /* Calculate the total bytes of the lower dimension */
+
+ disp[outercount] = tspan->low*total_lowd*elmt_size;
+ blocklen[outercount] = 1;
+ printf("displacement the 0 rank %d\n",disp[0]);
+ /* generating inner derived datatype by using MPI_Type_hvector */
+ obtain_datatype(size,tspan->down->head,&temp_type,elmt_size,dimindex-1);
+ ret= MPI_Type_commit(&temp_type);
+ if(ret < 0) printf("cannot commit temp_type\n");
+/* inner_type[count] = temp_type; */
+
+#ifdef H5_HAVE_MPI2
+ MPI_Type_get_extent(temp_type,&lb,&extent);
+#else
+ MPI_Type_lb(temp_type,&lb);
+ printf("lb %d\n",lb);
+ MPI_Type_extent(temp_type,&extent);
+ printf("extent %d\n",extent);
+#endif
+ /* building the inner vector datatype */
+ /* The following calculation of stride is wrong since stride is calculated
+ from the first element of the block to the first element of the next
+ block. */
+ /*stride = total_lowd1 * (size[dimindex-1]*elmt_size-extent-lb);*/
+ stride = total_lowd*elmt_size;
+ innercount = tspan->nelem;
+ printf("stride %d\n",stride);
+ printf("innercount %d\n",innercount);
+ fflush(stdout);
+ ret = MPI_Type_hvector(innercount,1,stride,temp_type,&tempinner_type);
+
+ /* MPI_Type_contiguous(2,temp_type,&tempinner_type);*/
+ if(ret < 0) printf("wrong vector \n");
+ MPI_Type_commit(&tempinner_type);
+ printf("after tempinner_type commit\n");
+ MPI_Type_free(&temp_type);
+ printf("after free \n");
+ inner_type[outercount] = tempinner_type;
+ outercount ++;
+ tspan = tspan->next;
+ }
+
+ /* building the whole vector datatype */
+ MPI_Type_struct(outercount,blocklen,disp,inner_type,span_type);
+ printf("after type struct \n");
+ }
+
+
+ if(inner_type != NULL){
+ if(down != NULL) {
+ for(i=0;i<outercount;i++)
+ MPI_Type_free(&inner_type[i]);
+
+ }
+ }
+
+ if(inner_type != NULL)
+ HDfree(inner_type);
+ if(blocklen != NULL)
+ HDfree(blocklen);
+ if(disp != NULL)
+ HDfree(disp);
+ printf("after obtaining type \n");
+ return 0;
+}
+
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Snone.c b/src/H5Snone.c
index 6a07a47..2cc2a1e 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -23,7 +23,7 @@
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
-#define PABLO_MASK H5Snone_mask
+#define PABLO_MASK H5S_none_mask
#include "H5private.h"
#include "H5Eprivate.h"
@@ -32,10 +32,6 @@
#include "H5Vprivate.h"
#include "H5Dprivate.h"
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/* Static function prototypes */
/* Selection callbacks */
@@ -48,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);
@@ -114,9 +110,7 @@ static const H5S_sel_iter_class_t H5S_sel_iter_none[1] = {{
herr_t
H5S_none_iter_init (H5S_sel_iter_t *iter, const H5S_t UNUSED *space)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_none_iter_init, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_none_iter_init);
/* Check args */
assert (space && H5S_SEL_NONE==H5S_GET_SELECT_TYPE(space));
@@ -125,8 +119,7 @@ H5S_none_iter_init (H5S_sel_iter_t *iter, const H5S_t UNUSED *space)
/* Initialize type of selection iterator */
iter->type=H5S_sel_iter_none;
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_none_iter_init() */
@@ -146,7 +139,7 @@ done:
*-------------------------------------------------------------------------
*/
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);
@@ -174,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);
@@ -348,18 +341,15 @@ H5S_none_iter_release (H5S_sel_iter_t UNUSED * iter)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_none_release (H5S_t UNUSED * space)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_none_release, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_release);
/* Check args */
assert (space);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_none_release() */
@@ -382,12 +372,10 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_none_copy(H5S_t *dst, const H5S_t UNUSED *src, hbool_t UNUSED share_selection)
{
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_NOAPI(H5S_none_copy, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_copy);
assert(src);
assert(dst);
@@ -395,8 +383,7 @@ H5S_none_copy(H5S_t *dst, const H5S_t UNUSED *src, hbool_t UNUSED share_selectio
/* Set number of elements in selection */
dst->select.num_elem=0;
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* end H5S_none_copy() */
@@ -420,17 +407,14 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_none_is_valid (const H5S_t UNUSED *space)
{
- htri_t ret_value=TRUE; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_none_is_valid, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_is_valid);
assert(space);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(TRUE);
} /* end H5S_none_is_valid() */
@@ -453,12 +437,10 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-hssize_t
+static hssize_t
H5S_none_serial_size (const H5S_t UNUSED *space)
{
- hssize_t ret_value; /* return value */
-
- FUNC_ENTER_NOAPI(H5S_none_serial_size, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_serial_size);
assert(space);
@@ -466,10 +448,7 @@ H5S_none_serial_size (const H5S_t UNUSED *space)
* <type (4 bytes)> + <version (4 bytes)> + <padding (4 bytes)> +
* <length (4 bytes)> = 16 bytes
*/
- ret_value=16;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(16);
} /* end H5S_none_serial_size() */
@@ -492,12 +471,10 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_none_serialize (const H5S_t *space, uint8_t *buf)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_none_serialize, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_serialize);
assert(space);
@@ -507,8 +484,7 @@ H5S_none_serialize (const H5S_t *space, uint8_t *buf)
UINT32ENCODE(buf, (uint32_t)0); /* Store the un-used padding */
UINT32ENCODE(buf, (uint32_t)0); /* Store the additional information length */
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_none_serialize() */
@@ -531,12 +507,12 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_none_deserialize (H5S_t *space, const uint8_t UNUSED *buf)
{
herr_t ret_value; /* return value */
- FUNC_ENTER_NOAPI(H5S_none_deserialize, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_none_deserialize);
assert(space);
@@ -557,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
@@ -574,19 +550,16 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
-H5S_none_bounds(const H5S_t UNUSED *space, hssize_t UNUSED *start, hssize_t UNUSED *end)
+static herr_t
+H5S_none_bounds(const H5S_t UNUSED *space, hsize_t UNUSED *start, hsize_t UNUSED *end)
{
- herr_t ret_value=FAIL; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_none_bounds, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_bounds);
assert(space);
assert(start);
assert(end);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(FAIL);
} /* H5Sget_none_bounds() */
@@ -608,17 +581,14 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_none_is_contiguous(const H5S_t UNUSED *space)
{
- htri_t ret_value=FALSE; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_none_is_contiguous, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_is_contiguous);
assert(space);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(FALSE);
} /* H5S_none_is_contiguous() */
@@ -640,17 +610,14 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_none_is_single(const H5S_t UNUSED *space)
{
- htri_t ret_value=FALSE; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_none_is_single, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_is_single);
assert(space);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(FALSE);
} /* H5S_none_is_single() */
@@ -673,18 +640,15 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_none_is_regular(const H5S_t UNUSED *space)
{
- htri_t ret_value=TRUE; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_none_is_regular, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_is_regular);
/* Check args */
assert(space);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(TRUE);
} /* H5S_none_is_regular() */
@@ -797,14 +761,12 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_none_get_seq_list(const H5S_t UNUSED *space, unsigned UNUSED flags, H5S_sel_iter_t UNUSED *iter,
size_t UNUSED maxseq, size_t UNUSED maxelem, size_t *nseq, size_t *nelem,
hsize_t UNUSED *off, size_t UNUSED *len)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI (H5S_none_get_seq_list, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_get_seq_list);
/* Check args */
assert(space);
@@ -822,6 +784,5 @@ H5S_none_get_seq_list(const H5S_t UNUSED *space, unsigned UNUSED flags, H5S_sel_
/* They don't use any elements, either */
*nelem=0;
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* end H5S_all_get_seq_list() */
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 d34b8a8..a79bea7 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -23,7 +23,7 @@
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
-#define PABLO_MASK H5Spoint_mask
+#define PABLO_MASK H5S_point_mask
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
@@ -33,10 +33,6 @@
#include "H5Spkg.h" /* Dataspace functions */
#include "H5Vprivate.h" /* Vector functions */
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/* Static function prototypes */
/* Selection callbacks */
@@ -49,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);
@@ -121,9 +117,7 @@ H5FL_DEFINE_STATIC(H5S_pnt_list_t);
herr_t
H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_point_iter_init, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_point_iter_init);
/* Check args */
assert (space && H5S_SEL_POINTS==H5S_GET_SELECT_TYPE(space));
@@ -138,8 +132,7 @@ H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
/* Initialize type of selection iterator */
iter->type=H5S_sel_iter_point;
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_point_iter_init() */
@@ -159,7 +152,7 @@ done:
*-------------------------------------------------------------------------
*/
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);
@@ -168,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() */
@@ -190,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);
@@ -200,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() */
@@ -376,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
@@ -387,14 +380,14 @@ 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 */
- FUNC_ENTER_NOAPI(H5S_point_add, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_point_add);
assert(space);
assert(num_elem>0);
@@ -407,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;
@@ -472,13 +465,12 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_point_release (H5S_t *space)
{
H5S_pnt_node_t *curr, *next; /* Point selection nodes */
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5S_point_release, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_release);
/* Check args */
assert (space);
@@ -499,8 +491,7 @@ H5S_point_release (H5S_t *space)
/* Reset the number of elements in the selection */
space->select.num_elem=0;
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_point_release() */
@@ -514,7 +505,7 @@ done:
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
@@ -536,7 +527,7 @@ done:
--------------------------------------------------------------------------*/
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 */
@@ -591,13 +582,13 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t UNUSED share_selection)
{
H5S_pnt_node_t *curr, *new_node, *new_head; /* Point information nodes */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_NOAPI(H5S_point_copy, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_point_copy);
assert(src);
assert(dst);
@@ -612,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 */
@@ -653,14 +644,14 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_point_is_valid (const H5S_t *space)
{
H5S_pnt_node_t *curr; /* Point information nodes */
unsigned u; /* Counter */
htri_t ret_value=TRUE; /* return value */
- FUNC_ENTER_NOAPI(H5S_point_is_valid, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_valid);
assert(space);
@@ -671,11 +662,9 @@ 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)) {
- ret_value=FALSE;
- break;
- } /* end if */
+ 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 */
curr=curr->next;
@@ -744,13 +733,13 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-hssize_t
+static hssize_t
H5S_point_serial_size (const H5S_t *space)
{
H5S_pnt_node_t *curr; /* Point information nodes */
hssize_t ret_value; /* return value */
- FUNC_ENTER_NOAPI(H5S_point_serial_size, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_serial_size);
assert(space);
@@ -768,7 +757,6 @@ H5S_point_serial_size (const H5S_t *space)
curr=curr->next;
} /* end while */
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5S_point_serial_size() */
@@ -792,16 +780,15 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_point_serialize (const H5S_t *space, uint8_t *buf)
{
H5S_pnt_node_t *curr; /* Point information nodes */
uint8_t *lenp; /* pointer to length location for later storage */
uint32_t len=0; /* number of bytes used */
unsigned u; /* local counting variable */
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5S_point_serialize, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_serialize);
assert(space);
@@ -836,8 +823,7 @@ H5S_point_serialize (const H5S_t *space, uint8_t *buf)
/* Encode length */
UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_point_serialize() */
@@ -860,17 +846,17 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
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 */
- FUNC_ENTER_NOAPI(H5S_point_deserialize, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_point_deserialize);
/* Check args */
assert(space);
@@ -884,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 */
@@ -893,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:
@@ -959,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;
@@ -1030,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
@@ -1048,15 +1034,15 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-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)
{
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(H5S_point_bounds, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_point_bounds);
assert(space);
assert(start);
@@ -1067,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]))
@@ -1109,12 +1099,12 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_point_is_contiguous(const H5S_t *space)
{
htri_t ret_value; /* return value */
- FUNC_ENTER_NOAPI(H5S_point_is_contiguous, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_contiguous);
assert(space);
@@ -1124,7 +1114,6 @@ H5S_point_is_contiguous(const H5S_t *space)
else /* More than one point might be contiguous, but it's complex to check and we don't need it right now */
ret_value=FALSE;
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_point_is_contiguous() */
@@ -1147,12 +1136,12 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_point_is_single(const H5S_t *space)
{
htri_t ret_value; /* return value */
- FUNC_ENTER_NOAPI(H5S_point_is_single, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_single);
assert(space);
@@ -1162,7 +1151,6 @@ H5S_point_is_single(const H5S_t *space)
else
ret_value=FALSE;
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_point_is_single() */
@@ -1188,12 +1176,12 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_point_is_regular(const H5S_t *space)
{
htri_t ret_value; /* return value */
- FUNC_ENTER_NOAPI(H5S_point_is_regular, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_regular);
/* Check args */
assert(space);
@@ -1204,7 +1192,6 @@ H5S_point_is_regular(const H5S_t *space)
else
ret_value=FALSE;
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_point_is_regular() */
@@ -1219,7 +1206,7 @@ done:
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
@@ -1241,13 +1228,13 @@ done:
--------------------------------------------------------------------------*/
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)))
@@ -1299,7 +1286,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
hsize_t *off, size_t *len)
@@ -1315,7 +1302,7 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
int i; /* Local index variable */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_NOAPI (H5S_point_get_seq_list, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_point_get_seq_list);
/* Check args */
assert(space);
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index a0fdf09..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);
@@ -279,6 +281,15 @@ H5S_mpio_space_type( const H5S_t *space, size_t elmt_size,
size_t *count,
hsize_t *extra_offset,
hbool_t *is_derived_type );
+
+H5_DLL herr_t
+H5S_mpio_space_span_type( const H5S_t *space, size_t elmt_size,
+ /* out: */
+ MPI_Datatype *new_type,
+ size_t *count,
+ hsize_t *extra_offset,
+ hbool_t *is_derived_type );
+
#endif /* H5_HAVE_PARALLEL */
#endif /* _H5Sprivate_H */
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 8272dfa..704f1f4 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -107,24 +107,13 @@ 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[]);
-#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 _stride[],
- const hsize_t count[],
- const hsize_t _block[]);
-H5_DLL herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op,
- hid_t space2_id);
-H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op,
- hid_t space2_id);
-#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);
@@ -136,11 +125,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);
-#ifdef H5_WANT_H5_V1_4_COMPAT
H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t *start, hsize_t *end);
-#else /* H5_WANT_H5_V1_4_COMPAT */
-H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hssize_t *start, hssize_t *end);
-#endif /* H5_WANT_H5_V1_4_COMPAT */
H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
#ifdef __cplusplus
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index ea78fac..1d9e68e 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -31,13 +31,9 @@
#include "H5Spkg.h" /* Dataspaces */
#include "H5Vprivate.h" /* Vector and array functions */
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/* 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 */
@@ -68,9 +64,7 @@ H5FL_BLK_EXTERN(type_elem);
herr_t
H5S_select_offset(H5S_t *space, const hssize_t *offset)
{
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_NOAPI(H5S_select_offset, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_select_offset);
/* Check args */
assert(space);
@@ -80,8 +74,7 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset)
/* Copy the offset over */
HDmemcpy(space->select.offset,offset,sizeof(hssize_t)*space->extent.rank);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_select_offset() */
@@ -155,14 +148,13 @@ H5S_select_release(H5S_t *ds)
{
herr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5S_select_release, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_select_release);
assert(ds);
/* Call the selection type's release function */
ret_value=(*ds->select.type->release)(ds);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5S_select_release() */
@@ -193,14 +185,13 @@ H5S_select_get_seq_list(const H5S_t *space, unsigned flags,
{
herr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5S_select_get_seq_list, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_select_get_seq_list);
assert(space);
/* Call the selection type's get_seq_list function */
ret_value=(*space->select.type->get_seq_list)(space,flags,iter,maxseq,maxbytes,nseq,nbytes,off,len);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5S_select_get_seq_list() */
@@ -229,14 +220,13 @@ H5S_select_serial_size(const H5S_t *space)
{
hssize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5S_select_serial_size, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_select_serial_size);
assert(space);
/* Call the selection type's serial_size function */
ret_value=(*space->select.type->serial_size)(space);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5S_select_serial_size() */
@@ -268,7 +258,7 @@ H5S_select_serialize(const H5S_t *space, uint8_t *buf)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5S_select_serialize, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_select_serialize);
assert(space);
assert(buf);
@@ -276,7 +266,6 @@ H5S_select_serialize(const H5S_t *space, uint8_t *buf)
/* Call the selection type's serialize function */
ret_value=(*space->select.type->serialize)(space,buf);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5S_select_serialize() */
@@ -341,18 +330,12 @@ done:
hssize_t
H5S_get_select_npoints(const H5S_t *space)
{
- hssize_t ret_value; /* return value */
-
- FUNC_ENTER_NOAPI(H5S_get_select_npoints, 0);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_get_select_npoints);
/* Check args */
assert(space);
- /* Set return value */
- ret_value=space->select.num_elem;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(space->select.num_elem);
} /* H5S_get_select_npoints() */
@@ -424,13 +407,12 @@ H5S_select_valid(const H5S_t *space)
{
htri_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5S_select_valid, 0);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_select_valid);
assert(space);
ret_value = (*space->select.type->is_valid)(space);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_select_valid() */
@@ -506,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
@@ -528,47 +510,14 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-#ifdef H5_WANT_H5_V1_4_COMPAT
herr_t
H5Sget_select_bounds(hid_t spaceid, hsize_t *start, hsize_t *end)
{
- hssize_t tstart[H5O_LAYOUT_NDIMS]; /* Temporary starting coordinates */
- hssize_t tend[H5O_LAYOUT_NDIMS]; /* Temporary ending coordinates */
- H5S_t *space = NULL; /* Dataspace to modify selection of */
- unsigned u; /* Local index variable */
- herr_t ret_value; /* return value */
-
- FUNC_ENTER_API(H5Sget_select_bounds, FAIL);
- H5TRACE3("e","i*h*h",spaceid,start,end);
-
- /* Check args */
- if(start==NULL || end==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer");
- if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace");
-
- ret_value = H5S_SELECT_BOUNDS(space,tstart,tend);
-
- if(ret_value>=0) {
- /* Copy over the start & end values */
- for(u=0; u<space->extent.rank; u++) {
- H5_ASSIGN_OVERFLOW(start[u],tstart[u],hssize_t,hsize_t);
- H5_ASSIGN_OVERFLOW(end[u],tend[u],hssize_t,hsize_t);
- } /* end for */
- } /* end if */
-
-done:
- FUNC_LEAVE_API(ret_value);
-} /* H5Sget_select_bounds() */
-#else /* H5_WANT_H5_V1_4_COMPAT */
-herr_t
-H5Sget_select_bounds(hid_t spaceid, hssize_t *start, hssize_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)
@@ -581,7 +530,6 @@ H5Sget_select_bounds(hid_t spaceid, hssize_t *start, hssize_t *end)
done:
FUNC_LEAVE_API(ret_value);
} /* H5Sget_select_bounds() */
-#endif /* H5_WANT_H5_V1_4_COMPAT */
/*--------------------------------------------------------------------------
@@ -592,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
@@ -612,11 +560,11 @@ 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 */
- FUNC_ENTER_NOAPI(H5S_get_select_bounds, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_get_select_bounds);
/* Check args */
assert(space);
@@ -625,7 +573,6 @@ H5S_get_select_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
ret_value = (*space->select.type->bounds)(space,start,end);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_get_select_bounds() */
@@ -656,14 +603,13 @@ H5S_select_is_contiguous(const H5S_t *space)
{
herr_t ret_value; /* return value */
- FUNC_ENTER_NOAPI(H5S_select_is_contiguous, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_select_is_contiguous);
/* Check args */
assert(space);
ret_value = (*space->select.type->is_contiguous)(space);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_select_is_contiguous() */
@@ -694,14 +640,13 @@ H5S_select_is_single(const H5S_t *space)
{
herr_t ret_value; /* return value */
- FUNC_ENTER_NOAPI(H5S_select_is_single, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_select_is_single);
/* Check args */
assert(space);
ret_value = (*space->select.type->is_single)(space);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_select_is_single() */
@@ -732,14 +677,13 @@ H5S_select_is_regular(const H5S_t *space)
{
herr_t ret_value; /* return value */
- FUNC_ENTER_NOAPI(H5S_select_is_regular, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_select_is_regular);
/* Check args */
assert(space);
ret_value = (*space->select.type->is_regular)(space);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_select_is_regular() */
@@ -766,7 +710,7 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s
{
herr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5S_select_iter_init, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_select_iter_init);
/* Check args */
assert(sel_iter);
@@ -790,7 +734,6 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s
/* Call initialization routine for selection type */
ret_value= (*space->select.type->iter_init)(sel_iter, space);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_select_iter_init() */
@@ -803,7 +746,7 @@ done:
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
@@ -818,11 +761,11 @@ done:
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 */
- FUNC_ENTER_NOAPI(H5S_select_iter_coords, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_select_iter_coords);
/* Check args */
assert(sel_iter);
@@ -831,7 +774,6 @@ H5S_select_iter_coords (const H5S_sel_iter_t *sel_iter, hssize_t *coords)
/* Call iter_coords routine for selection type */
ret_value = (*sel_iter->type->iter_coords)(sel_iter,coords);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_select_iter_coords() */
@@ -845,8 +787,8 @@ done:
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
@@ -861,7 +803,7 @@ done:
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 */
@@ -905,7 +847,7 @@ H5S_select_iter_nelmts (const H5S_sel_iter_t *sel_iter)
{
hsize_t ret_value; /* return value */
- FUNC_ENTER_NOAPI(H5S_select_iter_nelmts, 0);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_select_iter_nelmts);
/* Check args */
assert(sel_iter);
@@ -913,7 +855,6 @@ H5S_select_iter_nelmts (const H5S_sel_iter_t *sel_iter)
/* Call iter_nelmts routine for selection type */
ret_value = (*sel_iter->type->iter_nelmts)(sel_iter);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_select_iter_nelmts() */
@@ -985,7 +926,7 @@ H5S_select_iter_next(H5S_sel_iter_t *iter, size_t nelem)
{
herr_t ret_value; /* return value */
- FUNC_ENTER_NOAPI(H5S_select_iter_next, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_select_iter_next);
/* Check args */
assert(iter);
@@ -997,7 +938,6 @@ H5S_select_iter_next(H5S_sel_iter_t *iter, size_t nelem)
/* Decrement the number of elements left in selection */
iter->elmt_left-=nelem;
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_select_iter_next() */
@@ -1069,7 +1009,7 @@ H5S_select_iter_release(H5S_sel_iter_t *sel_iter)
{
herr_t ret_value; /* return value */
- FUNC_ENTER_NOAPI(H5S_select_iter_release, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_select_iter_release);
/* Check args */
assert(sel_iter);
@@ -1077,7 +1017,6 @@ H5S_select_iter_release(H5S_sel_iter_t *sel_iter)
/* Call selection type-specific release routine */
ret_value = (*sel_iter->type->iter_release)(sel_iter);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_select_iter_release() */
@@ -1118,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 */
@@ -1131,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 */
@@ -1198,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;
@@ -1286,7 +1225,7 @@ H5S_get_select_type(const H5S_t *space)
{
H5S_sel_type ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5S_get_select_type, H5S_SEL_ERROR);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_get_select_type);
/* Check args */
assert(space);
@@ -1294,7 +1233,6 @@ H5S_get_select_type(const H5S_t *space)
/* Set return value */
ret_value=H5S_GET_SELECT_TYPE(space);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5S_get_select_type() */
@@ -1377,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/H5Stest.c b/src/H5Stest.c
index 9062565..7580a0f 100644
--- a/src/H5Stest.c
+++ b/src/H5Stest.c
@@ -23,17 +23,13 @@
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
-#define PABLO_MASK H5Stest_mask
+#define PABLO_MASK H5S_test_mask
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* ID Functions */
#include "H5Spkg.h" /* Dataspace functions */
-/* Interface initialization */
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/*--------------------------------------------------------------------------
NAME
diff --git a/src/H5T.c b/src/H5T.c
index 20eb663..ca14bb3 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -21,6 +21,9 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5T_mask
@@ -41,10 +44,6 @@
#include <sys/fpu.h>
#endif /* H5_HAVE_SYS_FPU_H */
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_interface
-
/*
* Predefined data types. These are initialized at runtime in H5Tinit.c and
* by H5T_init_interface() in this source file.
@@ -245,7 +244,10 @@ static struct {
/* The overflow handler */
H5T_overflow_t H5T_overflow_g = NULL;
-/* Declare the free lists for H5T_t's and H5T_shared_t's */
+/* The native endianess of the platform */
+H5T_order_t H5T_native_order_g = H5T_ORDER_ERROR;
+
+/* Declare the free list for H5T_t's and H5T_shared_t's */
H5FL_DEFINE(H5T_t);
H5FL_DEFINE(H5T_shared_t);
@@ -518,7 +520,7 @@ H5T_init_inf(void)
dst = &dst_p->shared->u.atomic;
/* Check that we can re-order the bytes correctly */
- if (H5T_ORDER_LE!=dst->order && H5T_ORDER_BE!=dst->order)
+ if (H5T_ORDER_LE!=H5T_native_order_g && H5T_ORDER_BE!=H5T_native_order_g)
HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order");
/* +Inf */
@@ -528,7 +530,7 @@ H5T_init_inf(void)
H5T_bit_set (d, dst->u.f.mpos, dst->u.f.msize, FALSE);
/* Swap the bytes if the machine architecture is big-endian */
- if (H5T_ORDER_BE==dst->order) {
+ if (H5T_ORDER_BE==H5T_native_order_g) {
half_size = dst_p->shared->size/2;
for (u=0; u<half_size; u++) {
uint8_t tmp = d[dst_p->shared->size-(u+1)];
@@ -544,7 +546,7 @@ H5T_init_inf(void)
H5T_bit_set (d, dst->u.f.mpos, dst->u.f.msize, FALSE);
/* Swap the bytes if the machine architecture is big-endian */
- if (H5T_ORDER_BE==dst->order) {
+ if (H5T_ORDER_BE==H5T_native_order_g) {
half_size = dst_p->shared->size/2;
for (u=0; u<half_size; u++) {
uint8_t tmp = d[dst_p->shared->size-(u+1)];
@@ -559,7 +561,7 @@ H5T_init_inf(void)
dst = &dst_p->shared->u.atomic;
/* Check that we can re-order the bytes correctly */
- if (H5T_ORDER_LE!=dst->order && H5T_ORDER_BE!=dst->order)
+ if (H5T_ORDER_LE!=H5T_native_order_g && H5T_ORDER_BE!=H5T_native_order_g)
HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order");
/* +Inf */
@@ -569,7 +571,7 @@ H5T_init_inf(void)
H5T_bit_set (d, dst->u.f.mpos, dst->u.f.msize, FALSE);
/* Swap the bytes if the machine architecture is big-endian */
- if (H5T_ORDER_BE==dst->order) {
+ if (H5T_ORDER_BE==H5T_native_order_g) {
half_size = dst_p->shared->size/2;
for (u=0; u<half_size; u++) {
uint8_t tmp = d[dst_p->shared->size-(u+1)];
@@ -585,7 +587,7 @@ H5T_init_inf(void)
H5T_bit_set (d, dst->u.f.mpos, dst->u.f.msize, FALSE);
/* Swap the bytes if the machine architecture is big-endian */
- if (H5T_ORDER_BE==dst->order) {
+ if (H5T_ORDER_BE==H5T_native_order_g) {
half_size = dst_p->shared->size/2;
for (u=0; u<half_size; u++) {
uint8_t tmp = d[dst_p->shared->size-(u+1)];
@@ -1183,7 +1185,7 @@ H5T_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_term_interface);
- if (interface_initialize_g) {
+ if (H5_interface_initialize_g) {
/* Unregister all conversion functions */
for (i=0; i<H5T_g.npaths; i++) {
path = H5T_g.path[i];
@@ -1318,7 +1320,7 @@ H5T_term_interface(void)
H5T_NATIVE_UINT_FAST64_g = FAIL;
/* Mark interface as closed */
- interface_initialize_g = 0;
+ H5_interface_initialize_g = 0;
n = 1; /*H5I*/
}
FUNC_LEAVE_NOAPI(n);
@@ -1760,7 +1762,7 @@ done:
htri_t
H5T_detect_class (const H5T_t *dt, H5T_class_t cls)
{
- int i;
+ unsigned i;
htri_t ret_value=FALSE; /* Return value */
FUNC_ENTER_NOAPI(H5T_detect_class, FAIL);
@@ -2564,7 +2566,6 @@ done:
FUNC_LEAVE_API(ret_value);
}
-
/*-------------------------------------------------------------------------
* API functions are above; library-private functions are below...
*-------------------------------------------------------------------------
@@ -2781,7 +2782,6 @@ done:
if(shared_fo)
shared_fo->fo_count--;
}
-
FUNC_LEAVE_NOAPI(ret_value);
}
@@ -2877,7 +2877,7 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
{
H5T_t *new_dt=NULL, *tmp=NULL;
H5T_shared_t *reopened_fo;
- int i;
+ unsigned i;
char *s;
H5T_t *ret_value;
@@ -2972,7 +2972,7 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
new_dt->shared->u.compnd.nmembs * sizeof(H5T_cmemb_t));
for (i=0; i<new_dt->shared->u.compnd.nmembs; i++) {
- int j;
+ unsigned j;
int old_match;
s = new_dt->shared->u.compnd.memb[i].name;
@@ -3060,7 +3060,7 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
/* Deep copy of the symbol table entry, if there was one */
if (H5F_addr_defined(old_dt->ent.header))
- if (H5G_ent_copy(&(new_dt->ent), &(old_dt->ent), H5G_COPY_DEEP)<0)
+ if (H5G_ent_copy(&(new_dt->ent), &(old_dt->ent),H5G_COPY_DEEP)<0)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to copy entry");
/* Set return value */
@@ -3143,7 +3143,7 @@ done:
herr_t
H5T_free(H5T_t *dt)
{
- int i;
+ unsigned i;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_free, FAIL);
@@ -3503,9 +3503,11 @@ H5T_get_size(const H5T_t *dt)
int
H5T_cmp(const H5T_t *dt1, const H5T_t *dt2)
{
- int *idx1 = NULL, *idx2 = NULL;
+ unsigned *idx1 = NULL, *idx2 = NULL;
int ret_value = 0;
- int i, j, tmp;
+ int i, j;
+ unsigned u;
+ int tmp;
hbool_t swapped;
size_t base_size;
@@ -3542,11 +3544,11 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2)
HGOTO_DONE(1);
/* Build an index for each type so the names are sorted */
- if (NULL==(idx1 = H5MM_malloc(dt1->shared->u.compnd.nmembs * sizeof(int))) ||
- NULL==(idx2 = H5MM_malloc(dt1->shared->u.compnd.nmembs * sizeof(int))))
+ if (NULL==(idx1 = H5MM_malloc(dt1->shared->u.compnd.nmembs * sizeof(unsigned))) ||
+ NULL==(idx2 = H5MM_malloc(dt1->shared->u.compnd.nmembs * sizeof(unsigned))))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed");
- for (i=0; i<dt1->shared->u.compnd.nmembs; i++)
- idx1[i] = idx2[i] = i;
+ for (u=0; u<dt1->shared->u.compnd.nmembs; u++)
+ idx1[u] = idx2[u] = u;
for (i=dt1->shared->u.compnd.nmembs-1, swapped=TRUE; swapped && i>=0; --i) {
for (j=0, swapped=FALSE; j<i; j++) {
if (HDstrcmp(dt1->shared->u.compnd.memb[idx1[j]].name,
@@ -3572,35 +3574,31 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2)
#ifdef H5T_DEBUG
/* I don't quite trust the code above yet :-) --RPM */
- for (i=0; i<dt1->shared->u.compnd.nmembs-1; i++) {
- assert(HDstrcmp(dt1->shared->u.compnd.memb[idx1[i]].name,
- dt1->shared->u.compnd.memb[idx1[i + 1]].name));
- assert(HDstrcmp(dt2->shared->u.compnd.memb[idx2[i]].name,
- dt2->shared->u.compnd.memb[idx2[i + 1]].name));
+ for (u=0; u<dt1->shared->u.compnd.nmembs-1; u++) {
+ assert(HDstrcmp(dt1->shared->u.compnd.memb[idx1[u]].name,
+ dt1->shared->u.compnd.memb[idx1[u + 1]].name));
+ assert(HDstrcmp(dt2->shared->u.compnd.memb[idx2[u]].name,
+ dt2->shared->u.compnd.memb[idx2[u + 1]].name));
}
#endif
/* Compare the members */
- for (i=0; i<dt1->shared->u.compnd.nmembs; i++) {
- tmp = HDstrcmp(dt1->shared->u.compnd.memb[idx1[i]].name,
- dt2->shared->u.compnd.memb[idx2[i]].name);
+ for (u=0; u<dt1->shared->u.compnd.nmembs; u++) {
+ tmp = HDstrcmp(dt1->shared->u.compnd.memb[idx1[u]].name,
+ dt2->shared->u.compnd.memb[idx2[u]].name);
if (tmp < 0)
HGOTO_DONE(-1);
if (tmp > 0)
HGOTO_DONE(1);
- if (dt1->shared->u.compnd.memb[idx1[i]].offset <
- dt2->shared->u.compnd.memb[idx2[i]].offset) HGOTO_DONE(-1);
- if (dt1->shared->u.compnd.memb[idx1[i]].offset >
- dt2->shared->u.compnd.memb[idx2[i]].offset) HGOTO_DONE(1);
+ if (dt1->shared->u.compnd.memb[idx1[u]].offset < dt2->shared->u.compnd.memb[idx2[u]].offset) HGOTO_DONE(-1);
+ if (dt1->shared->u.compnd.memb[idx1[u]].offset > dt2->shared->u.compnd.memb[idx2[u]].offset) HGOTO_DONE(1);
- if (dt1->shared->u.compnd.memb[idx1[i]].size <
- dt2->shared->u.compnd.memb[idx2[i]].size) HGOTO_DONE(-1);
- if (dt1->shared->u.compnd.memb[idx1[i]].size >
- dt2->shared->u.compnd.memb[idx2[i]].size) HGOTO_DONE(1);
+ if (dt1->shared->u.compnd.memb[idx1[u]].size < dt2->shared->u.compnd.memb[idx2[u]].size) HGOTO_DONE(-1);
+ if (dt1->shared->u.compnd.memb[idx1[u]].size > dt2->shared->u.compnd.memb[idx2[u]].size) HGOTO_DONE(1);
- tmp = H5T_cmp(dt1->shared->u.compnd.memb[idx1[i]].type,
- dt2->shared->u.compnd.memb[idx2[i]].type);
+ tmp = H5T_cmp(dt1->shared->u.compnd.memb[idx1[u]].type,
+ dt2->shared->u.compnd.memb[idx2[u]].type);
if (tmp < 0) HGOTO_DONE(-1);
if (tmp > 0) HGOTO_DONE(1);
}
@@ -3616,11 +3614,11 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2)
HGOTO_DONE(1);
/* Build an index for each type so the names are sorted */
- if (NULL==(idx1 = H5MM_malloc(dt1->shared->u.enumer.nmembs * sizeof(int))) ||
- NULL==(idx2 = H5MM_malloc(dt1->shared->u.enumer.nmembs * sizeof(int))))
+ if (NULL==(idx1 = H5MM_malloc(dt1->shared->u.enumer.nmembs * sizeof(unsigned))) ||
+ NULL==(idx2 = H5MM_malloc(dt1->shared->u.enumer.nmembs * sizeof(unsigned))))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed");
- for (i=0; i<dt1->shared->u.enumer.nmembs; i++)
- idx1[i] = idx2[i] = i;
+ for (u=0; u<dt1->shared->u.enumer.nmembs; u++)
+ idx1[u] = idx2[u] = u;
for (i=dt1->shared->u.enumer.nmembs-1, swapped=TRUE; swapped && i>=0; --i) {
for (j=0, swapped=FALSE; j<i; j++) {
if (HDstrcmp(dt1->shared->u.enumer.name[idx1[j]],
@@ -3646,24 +3644,24 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2)
#ifdef H5T_DEBUG
/* I don't quite trust the code above yet :-) --RPM */
- for (i=0; i<dt1->shared->u.enumer.nmembs-1; i++) {
- assert(HDstrcmp(dt1->shared->u.enumer.name[idx1[i]],
- dt1->shared->u.enumer.name[idx1[i+1]]));
- assert(HDstrcmp(dt2->shared->u.enumer.name[idx2[i]],
- dt2->shared->u.enumer.name[idx2[i+1]]));
+ for (u=0; u<dt1->shared->u.enumer.nmembs-1; u++) {
+ assert(HDstrcmp(dt1->shared->u.enumer.name[idx1[u]],
+ dt1->shared->u.enumer.name[idx1[u+1]]));
+ assert(HDstrcmp(dt2->shared->u.enumer.name[idx2[u]],
+ dt2->shared->u.enumer.name[idx2[u+1]]));
}
#endif
/* Compare the members */
base_size = dt1->shared->parent->shared->size;
- for (i=0; i<dt1->shared->u.enumer.nmembs; i++) {
- tmp = HDstrcmp(dt1->shared->u.enumer.name[idx1[i]],
- dt2->shared->u.enumer.name[idx2[i]]);
+ for (u=0; u<dt1->shared->u.enumer.nmembs; u++) {
+ tmp = HDstrcmp(dt1->shared->u.enumer.name[idx1[u]],
+ dt2->shared->u.enumer.name[idx2[u]]);
if (tmp<0) HGOTO_DONE(-1);
if (tmp>0) HGOTO_DONE(1);
- tmp = HDmemcmp(dt1->shared->u.enumer.value+idx1[i]*base_size,
- dt2->shared->u.enumer.value+idx2[i]*base_size,
+ tmp = HDmemcmp(dt1->shared->u.enumer.value+idx1[u]*base_size,
+ dt2->shared->u.enumer.value+idx2[u]*base_size,
base_size);
if (tmp<0) HGOTO_DONE(-1);
if (tmp>0) HGOTO_DONE(1);
@@ -4573,7 +4571,7 @@ herr_t
H5T_debug(const H5T_t *dt, FILE *stream)
{
const char *s1="", *s2="";
- int i;
+ unsigned i;
size_t k, base_size;
uint64_t tmp;
herr_t ret_value=SUCCEED; /* Return value */
diff --git a/src/H5TB.c b/src/H5TB.c
index c2b3bed..7e6f946 100644
--- a/src/H5TB.c
+++ b/src/H5TB.c
@@ -119,9 +119,6 @@ H5FL_DEFINE_STATIC(H5TB_NODE);
/* Declare a free list to manage the H5TB_TREE struct */
H5FL_DEFINE_STATIC(H5TB_TREE);
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/*-------------------------------------------------------------------------
* Function: H5TB_strcmp
@@ -424,7 +421,7 @@ H5TB_dfind(H5TB_TREE * tree, const void * key, H5TB_NODE ** pp)
{
H5TB_NODE *ret_value;
- FUNC_ENTER_NOAPI(H5TB_dfind, NULL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5TB_dfind);
assert(tree);
@@ -439,7 +436,6 @@ H5TB_dfind(H5TB_TREE * tree, const void * key, H5TB_NODE ** pp)
ret_value=NULL;
} /* end else */
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5TB_dfind() */
@@ -477,9 +473,9 @@ H5TB_find(H5TB_NODE * ptr, const void * key,
{
H5TB_NODE *parent = NULL;
int cmp = 1;
- H5TB_NODE *ret_value;
- FUNC_ENTER_NOAPI(H5TB_find, NULL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5TB_find);
+
if(ptr) {
while (0 != (cmp = KEYcmp(key, ptr->key, arg))) {
@@ -504,11 +500,7 @@ H5TB_find(H5TB_NODE * ptr, const void * key,
if (NULL != pp)
*pp = parent;
- /* Set return value */
- ret_value=ptr;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ptr);
} /* end H5TB_find() */
@@ -543,14 +535,13 @@ H5TB_dless(H5TB_TREE * tree, void * key, H5TB_NODE ** pp)
{
H5TB_NODE *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5TB_dless,NULL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5TB_dless);
assert(tree);
/* Set return value */
ret_value= H5TB_less(tree->root, key, tree->compar, tree->cmparg, pp);
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5TB_dless() */
@@ -593,7 +584,7 @@ H5TB_less(H5TB_NODE * root, void * key, H5TB_cmp_t compar, int arg, H5TB_NODE **
int side;
H5TB_NODE *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5TB_less,NULL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5TB_less);
/* Try to find an exact match */
if (ptr) {
@@ -630,7 +621,6 @@ H5TB_less(H5TB_NODE * root, void * key, H5TB_cmp_t compar, int arg, H5TB_NODE **
/* Set return value */
ret_value= (0 == cmp) ? ptr : NULL;
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5TB_less */
@@ -662,7 +652,7 @@ H5TB_index(H5TB_NODE * root, unsigned indx)
H5TB_NODE *ptr = root;
H5TB_NODE *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5TB_index,NULL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5TB_index);
if (NULL != ptr) {
/* Termination condition is if the index equals the number of children on
@@ -688,7 +678,6 @@ H5TB_index(H5TB_NODE * root, unsigned indx)
/* Set return value */
ret_value=ptr;
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5TB_index() */
@@ -719,7 +708,7 @@ H5TB_dins(H5TB_TREE * tree, void * item, void * key)
{
H5TB_NODE *ret_value; /* the node to return */
- FUNC_ENTER_NOAPI(H5TB_dins,NULL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5TB_dins);
assert(tree);
@@ -730,7 +719,6 @@ H5TB_dins(H5TB_TREE * tree, void * item, void * key)
if (ret_value != NULL)
tree->count++;
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5TB_dins() */
@@ -1030,7 +1018,7 @@ H5TB_dfree(H5TB_TREE * tree, void(*fd) (void * /* item */), void(*fk) (void * /*
{
H5TB_TREE *ret_value=NULL; /* Return value */
- FUNC_ENTER_NOAPI(H5TB_dfree,NULL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5TB_dfree);
if (tree != NULL) {
/* Free the actual tree */
@@ -1040,7 +1028,6 @@ H5TB_dfree(H5TB_TREE * tree, void(*fd) (void * /* item */), void(*fk) (void * /*
H5FL_FREE(H5TB_TREE,tree);
} /* end if */
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5TB_dfree() */
@@ -1076,7 +1063,7 @@ H5TB_free(H5TB_NODE ** root, void(*fd) (void * /* item */), void(*fk) (void * /*
H5TB_NODE *par, *node = *root;
void *ret_value=NULL; /* Return value */
- FUNC_ENTER_NOAPI(H5TB_free,NULL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5TB_free);
/* While nodes left to be free()d */
while (NULL != *root) {
@@ -1112,7 +1099,6 @@ H5TB_free(H5TB_NODE ** root, void(*fd) (void * /* item */), void(*fk) (void * /*
} while (NULL != par); /* While moving back up tree */
} /* end while */
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5TB_free() */
@@ -1139,12 +1125,11 @@ H5TB_count(H5TB_TREE * tree)
{
long ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5TB_count,FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5TB_count);
/* Set return value */
ret_value= (tree==NULL) ? FAIL : (long)tree->count;
-done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5TB_count() */
@@ -1174,7 +1159,7 @@ done:
herr_t
H5TB_dump(H5TB_TREE *tree, void (*key_dump)(void *,void *), int method)
{
- FUNC_ENTER_NOAPI(H5TB_dump,FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5TB_dump);
printf("H5TB-tree dump %p:\n",tree);
printf("capacity = %ld\n\n",(long)tree->count);
@@ -1205,7 +1190,7 @@ H5TB_printNode(H5TB_NODE * node, void(*key_dump)(void *,void *))
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5TB_printNode);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5TB_printNode);
if (node == NULL) {
printf("ERROR: null node pointer\n");
@@ -1249,7 +1234,7 @@ H5TB_dumpNode(H5TB_NODE *node, void (*key_dump)(void *,void *),
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5TB_dumpNode);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5TB_dumpNode);
if (node == NULL)
HGOTO_DONE(FAIL);
diff --git a/src/H5TS.c b/src/H5TS.c
index 943e21b..27ce315 100644
--- a/src/H5TS.c
+++ b/src/H5TS.c
@@ -12,8 +12,6 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* $Id$ */
-
/* private headers */
#include "H5private.h" /*library */
#include "H5Eprivate.h" /*error handling */
@@ -148,7 +146,7 @@ H5TS_mutex_lock(H5TS_mutex_t *mutex)
ret_value = pthread_mutex_lock(&mutex->atomic_lock);
if (ret_value)
- return ret_value;
+ return ret_value;
if (mutex->owner_thread && pthread_equal(pthread_self(), *mutex->owner_thread)) {
/* already owned by self - increment count */
@@ -284,7 +282,7 @@ H5TS_cancel_count_inc(void)
* First time thread calls library - create new counter and associate
* with key
*/
- cancel_counter = H5MM_malloc(sizeof(H5TS_cancel_t));
+ cancel_counter = H5MM_calloc(sizeof(H5TS_cancel_t));
if (!cancel_counter) {
H5E_push(H5E_RESOURCE, H5E_NOSPACE, "H5TS_cancel_count_inc",
@@ -292,7 +290,6 @@ H5TS_cancel_count_inc(void)
return FAIL;
}
- cancel_counter->cancel_count = 0;
ret_value = pthread_setspecific(H5TS_cancel_key_g,
(void *)cancel_counter);
}
diff --git a/src/H5Tarray.c b/src/H5Tarray.c
index a8c8de9..73675a7 100644
--- a/src/H5Tarray.c
+++ b/src/H5Tarray.c
@@ -19,6 +19,9 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_array_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5T_array_mask
@@ -29,11 +32,6 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Tpkg.h" /* Datatypes */
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_array_interface
-static herr_t H5T_init_array_interface(void);
-
/* Declare extern the free list for H5T_t's */
H5FL_EXTERN(H5T_t);
H5FL_EXTERN(H5T_shared_t);
diff --git a/src/H5Tbit.c b/src/H5Tbit.c
index a3537f1..440d8d1 100644
--- a/src/H5Tbit.c
+++ b/src/H5Tbit.c
@@ -22,17 +22,13 @@
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
-#define PABLO_MASK H5Tbit_mask
+#define PABLO_MASK H5T_bit_mask
#include "H5private.h" /*generic functions */
#include "H5Eprivate.h" /*error handling */
#include "H5Iprivate.h" /*ID functions */
#include "H5Tpkg.h" /*data-type functions */
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/*-------------------------------------------------------------------------
* Function: H5T_bit_copy
@@ -163,7 +159,8 @@ H5T_bit_copy (uint8_t *dst, size_t dst_offset, const uint8_t *src,
/*-------------------------------------------------------------------------
* Function: H5T_bit_get_d
*
- * Purpose: Return a small bit sequence as a number.
+ * Purpose: Return a small bit sequence as a number. Bit vector starts
+ * at OFFSET and is SIZE bits long.
*
* Return: Success: The bit sequence interpretted as an unsigned
* integer.
@@ -184,12 +181,12 @@ H5T_bit_get_d (uint8_t *buf, size_t offset, size_t size)
size_t i, hs;
hsize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5T_bit_get_d, 0);
+ FUNC_ENTER_NOAPI_NOFUNC(H5T_bit_get_d);
assert (8*sizeof(val)>=size);
H5T_bit_copy ((uint8_t*)&val, 0, buf, offset, size);
- switch (((H5T_t*)(H5I_object(H5T_NATIVE_INT_g)))->shared->u.atomic.order) {
+ switch (H5T_native_order_g) {
case H5T_ORDER_LE:
break;
@@ -208,7 +205,6 @@ H5T_bit_get_d (uint8_t *buf, size_t offset, size_t size)
/* Set return value */
ret_value=val;
-done:
FUNC_LEAVE_NOAPI(ret_value);
}
@@ -234,7 +230,7 @@ H5T_bit_set_d (uint8_t *buf, size_t offset, size_t size, hsize_t val)
assert (8*sizeof(val)>=size);
- switch (((H5T_t*)(H5I_object(H5T_NATIVE_INT_g)))->shared->u.atomic.order) {
+ switch (H5T_native_order_g) {
case H5T_ORDER_LE:
break;
@@ -313,7 +309,9 @@ H5T_bit_set (uint8_t *buf, size_t offset, size_t size, hbool_t value)
* Purpose: Finds the first bit with the specified VALUE within a region
* of a bit vector. The region begins at OFFSET and continues
* for SIZE bits, but the region can be searched from the least
- * significat end toward the most significant end with
+ * significat end toward the most significant end(H5T_BIT_LSB
+ * as DIRECTION), or from the most significant end to the least
+ * significant end(H5T_BIT_MSB as DIRECTION).
*
* Return: Success: The position of the bit found, relative to
* the offset.
@@ -417,10 +415,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5T_bit_inc
*
- * Purpose: Increment part of a bit field by adding 1.
+ * Purpose: Increment part of a bit field by adding 1. The bit field
+ * starts with bit position START and is SIZE bits long.
*
- * Return: Success: The carry-out value, one if overflow zero
- * otherwise.
+ * Return: Success: The carry-out value. One if overflows,
+ * zero otherwise.
*
* Failure: Negative
*
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index dfee616..26054d0 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -19,6 +19,9 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_commit_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5T_commit_mask
@@ -27,14 +30,9 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FOprivate.h" /* File objects */
#include "H5Iprivate.h" /* IDs */
+#include "H5Oprivate.h" /* Object headers */
#include "H5Tpkg.h" /* Datatypes */
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_commit_interface
-static herr_t H5T_init_commit_interface(void);
-
-
/* Static local functions */
static herr_t H5T_commit(H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id);
@@ -55,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
@@ -83,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)
}
@@ -124,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()
@@ -136,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 */
if (H5T_vlen_mark(type, file, H5T_VLEN_DISK)<0)
@@ -157,11 +155,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;
@@ -178,21 +176,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.
*
@@ -211,25 +209,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.
*
@@ -241,14 +239,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() */
@@ -275,15 +273,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 ee51989..467798f 100644
--- a/src/H5Tcompound.c
+++ b/src/H5Tcompound.c
@@ -19,6 +19,9 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_compound_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5T_compound_mask
@@ -29,16 +32,11 @@
#include "H5MMprivate.h" /*memory management */
#include "H5Tpkg.h" /*data-type functions */
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_compound_interface
-static herr_t H5T_init_compound_interface(void);
-
/* Local macros */
#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);
/*--------------------------------------------------------------------------
@@ -84,18 +82,18 @@ H5T_init_compound_interface(void)
*-------------------------------------------------------------------------
*/
size_t
-H5Tget_member_offset(hid_t type_id, int membno)
+H5Tget_member_offset(hid_t type_id, unsigned membno)
{
H5T_t *dt = NULL;
size_t ret_value;
FUNC_ENTER_API(H5Tget_member_offset, 0)
- H5TRACE2("z","iIs",type_id,membno);
+ H5TRACE2("z","iIu",type_id,membno);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a compound datatype")
- if (membno < 0 || membno >= dt->shared->u.compnd.nmembs)
+ if (membno >= dt->shared->u.compnd.nmembs)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid member number")
/* Value */
@@ -128,19 +126,18 @@ done:
*-------------------------------------------------------------------------
*/
size_t
-H5T_get_member_offset(const H5T_t *dt, int membno)
+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 >= 0 && membno < dt->shared->u.compnd.nmembs);
+ assert(membno < dt->shared->u.compnd.nmembs);
/* Value */
ret_value = dt->shared->u.compnd.memb[membno].offset;
-done:
FUNC_LEAVE_NOAPI(ret_value)
}
@@ -162,18 +159,18 @@ done:
*-------------------------------------------------------------------------
*/
H5T_class_t
-H5Tget_member_class(hid_t type_id, int membno)
+H5Tget_member_class(hid_t type_id, unsigned membno)
{
H5T_t *dt = NULL;
H5T_class_t ret_value;
FUNC_ENTER_API(H5Tget_member_class, H5T_NO_CLASS)
- H5TRACE2("Tt","iIs",type_id,membno);
+ H5TRACE2("Tt","iIu",type_id,membno);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a compound datatype")
- if (membno < 0 || membno >= dt->shared->u.compnd.nmembs)
+ if (membno >= dt->shared->u.compnd.nmembs)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5T_NO_CLASS, "invalid member number")
/* Value */
@@ -209,18 +206,18 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5Tget_member_type(hid_t type_id, int membno)
+H5Tget_member_type(hid_t type_id, unsigned membno)
{
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)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype")
- if (membno < 0 || membno >= dt->shared->u.compnd.nmembs)
+ if (membno >= dt->shared->u.compnd.nmembs)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid member number")
if ((memb_dt=H5T_get_member_type(dt, membno))==NULL)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to retrieve member type")
@@ -231,7 +228,7 @@ done:
if(ret_value<0) {
if(memb_dt!=NULL)
if(H5T_close(memb_dt)<0)
- HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "can't close datatype")
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype")
} /* end if */
FUNC_LEAVE_API(ret_value)
@@ -258,14 +255,14 @@ done:
*-------------------------------------------------------------------------
*/
H5T_t *
-H5T_get_member_type(const H5T_t *dt, int membno)
+H5T_get_member_type(const H5T_t *dt, unsigned membno)
{
H5T_t *ret_value = NULL;
FUNC_ENTER_NOAPI(H5T_get_member_type, NULL)
assert(dt);
- assert(membno >=0 && membno < dt->shared->u.compnd.nmembs);
+ assert(membno < dt->shared->u.compnd.nmembs);
/* Copy datatype into an atom */
if (NULL == (ret_value = H5T_copy(dt->shared->u.compnd.memb[membno].type, H5T_COPY_REOPEN)))
@@ -293,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);
@@ -305,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)
}
@@ -359,7 +355,7 @@ H5Tinsert(hid_t parent_id, const char *name, size_t offset, hid_t member_id)
/* Insert */
if (H5T_insert(parent, name, offset, member) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "unable to insert member")
-
+
done:
FUNC_LEAVE_API(ret_value)
}
@@ -396,7 +392,7 @@ H5Tpack(hid_t type_id)
/* Pack */
if (H5T_pack(dt) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack compound datatype")
-
+
done:
FUNC_LEAVE_API(ret_value)
}
@@ -421,9 +417,9 @@ 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)
{
- int idx, i;
+ unsigned idx, i;
size_t total_size;
herr_t ret_value=SUCCEED; /* Return value */
@@ -458,13 +454,13 @@ 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));
if (!x)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- parent->shared->u.compnd.nalloc = (int)na;
+ parent->shared->u.compnd.nalloc = na;
parent->shared->u.compnd.memb = x;
}
@@ -528,9 +524,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T_pack(H5T_t *dt)
+H5T_pack(const H5T_t *dt)
{
- int i;
+ unsigned i;
size_t offset;
herr_t ret_value=SUCCEED; /* Return value */
@@ -541,12 +537,12 @@ 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)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is read-only")
-
+
if(dt->shared->parent) {
if (H5T_pack(dt->shared->parent) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack parent of datatype")
@@ -604,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);
@@ -614,9 +610,8 @@ H5T_is_packed(const H5T_t *dt)
/* If this is a compound datatype, check if it is packed */
if(dt->shared->type==H5T_COMPOUND)
- ret_value=dt->shared->u.compnd.packed;
+ 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 8e2433b..2cdfb2e 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -20,7 +20,7 @@
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
-#define PABLO_MASK H5Tconv_mask
+#define PABLO_MASK H5T_conv_mask
#include "H5private.h" /*generic functions */
#include "H5Eprivate.h" /*error handling */
@@ -51,10 +51,6 @@ typedef struct H5T_conv_hw_t {
size_t d_aligned; /*number destination elements aligned*/
} H5T_conv_hw_t;
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
-
/* Declare a free list to manage pieces of vlen data */
H5FL_BLK_DEFINE_STATIC(vlen_seq);
@@ -336,7 +332,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 \
@@ -353,7 +349,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); \
@@ -1306,7 +1303,8 @@ static herr_t
H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id)
{
H5T_conv_struct_t *priv = (H5T_conv_struct_t*)(cdata->priv);
- int i, j, *src2dst = NULL;
+ int *src2dst = NULL;
+ unsigned i, j;
H5T_t *type = NULL;
hid_t tid;
herr_t ret_value=SUCCEED; /* Return value */
@@ -1463,6 +1461,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
size_t offset; /*byte offset wrt struct */
size_t src_delta; /*source stride */
size_t elmtno;
+ unsigned u; /*counters */
int i; /*counters */
H5T_conv_struct_t *priv = (H5T_conv_struct_t *)(cdata->priv);
herr_t ret_value=SUCCEED; /* Return value */
@@ -1545,14 +1544,14 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* data point as small as possible with all the free space on the
* right side.
*/
- for (i=0, offset=0; i<src->shared->u.compnd.nmembs; i++) {
- if (src2dst[i]<0) continue; /*subsetting*/
- src_memb = src->shared->u.compnd.memb + i;
- dst_memb = dst->shared->u.compnd.memb + src2dst[i];
+ for (u=0, offset=0; u<src->shared->u.compnd.nmembs; u++) {
+ if (src2dst[u]<0) continue; /*subsetting*/
+ src_memb = src->shared->u.compnd.memb + u;
+ dst_memb = dst->shared->u.compnd.memb + src2dst[u];
if (dst_memb->size <= src_memb->size) {
- if (H5T_convert(priv->memb_path[i], priv->src_memb_id[i],
- priv->dst_memb_id[src2dst[i]],
+ if (H5T_convert(priv->memb_path[u], priv->src_memb_id[u],
+ priv->dst_memb_id[src2dst[u]],
1, 0, 0, /*no striding (packed array)*/
xbuf+src_memb->offset, xbkg+dst_memb->offset,
dxpl_id)<0)
@@ -1695,6 +1694,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
H5T_cmemb_t *dst_memb = NULL; /*destination struct memb desc. */
size_t offset; /*byte offset wrt struct */
size_t elmtno; /*element counter */
+ unsigned u; /*counters */
int i; /*counters */
H5T_conv_struct_t *priv = NULL; /*private data */
herr_t ret_value=SUCCEED; /* Return value */
@@ -1732,11 +1732,11 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
* is room for each conversion instead of actually doing anything.
*/
if (dst->shared->size > src->shared->size) {
- for (i=0, offset=0; i<src->shared->u.compnd.nmembs; i++) {
- if (src2dst[i]<0)
+ for (u=0, offset=0; u<src->shared->u.compnd.nmembs; u++) {
+ if (src2dst[u]<0)
continue;
- src_memb = src->shared->u.compnd.memb + i;
- dst_memb = dst->shared->u.compnd.memb + src2dst[i];
+ src_memb = src->shared->u.compnd.memb + u;
+ dst_memb = dst->shared->u.compnd.memb + src2dst[u];
if (dst_memb->size > src_memb->size)
offset += src_memb->size;
}
@@ -1813,17 +1813,17 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
* destination in the bkg buffer. Otherwise move the element as far
* left as possible in the buffer.
*/
- for (i=0, offset=0; i<src->shared->u.compnd.nmembs; i++) {
- if (src2dst[i]<0) continue; /*subsetting*/
- src_memb = src->shared->u.compnd.memb + i;
- dst_memb = dst->shared->u.compnd.memb + src2dst[i];
+ for (u=0, offset=0; u<src->shared->u.compnd.nmembs; u++) {
+ if (src2dst[u]<0) continue; /*subsetting*/
+ src_memb = src->shared->u.compnd.memb + u;
+ dst_memb = dst->shared->u.compnd.memb + src2dst[u];
if (dst_memb->size <= src_memb->size) {
xbuf = buf + src_memb->offset;
xbkg = bkg + dst_memb->offset;
- if (H5T_convert(priv->memb_path[i],
- priv->src_memb_id[i],
- priv->dst_memb_id[src2dst[i]], nelmts,
+ if (H5T_convert(priv->memb_path[u],
+ priv->src_memb_id[u],
+ priv->dst_memb_id[src2dst[u]], nelmts,
buf_stride ? buf_stride : src->shared->size,
bkg_stride, xbuf, xbkg,
dxpl_id)<0)
@@ -1915,8 +1915,8 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
int n; /*src value cast as native int */
int domain[2]; /*min and max source values */
int *map=NULL; /*map from src value to dst idx */
- int length; /*nelmts in map array */
- int i, j; /*counters */
+ unsigned length; /*nelmts in map array */
+ unsigned i, j; /*counters */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5T_conv_enum_init);
@@ -2296,14 +2296,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 */
@@ -2509,8 +2514,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
done:
/* If the conversion buffer doesn't need to be freed, reset its pointer */
if(write_to_file && noop_conv)
- conv_buf = NULL;
-
+ conv_buf=NULL;
/* Release the conversion buffer (always allocated, except on errors) */
if(conv_buf!=NULL)
H5FL_BLK_FREE(vlen_seq,conv_buf);
@@ -2893,7 +2897,6 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
H5T_bit_copy (d, dst->shared->u.atomic.offset, s, src->shared->u.atomic.offset,
dst->shared->u.atomic.prec);
}
-
} else if (first+1 == src->shared->u.atomic.prec) {
/*
* Both the source and the destination are signed and the
@@ -3317,13 +3320,13 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
H5T_bit_set(d, dst.u.f.mpos, 1, TRUE);
} else if (mrsh==dst.u.f.msize) {
H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE);
- H5T_bit_set_d(d, dst.u.f.mpos, MIN(2, dst.u.f.msize), implied);
+ H5T_bit_set_d(d, dst.u.f.mpos, MIN(2, dst.u.f.msize), (hsize_t)implied);
} else {
if (mrsh>0) {
H5T_bit_set(d, dst.u.f.mpos+dst.u.f.msize-mrsh, mrsh,
FALSE);
H5T_bit_set_d(d, dst.u.f.mpos+dst.u.f.msize-mrsh, 2,
- implied);
+ (hsize_t)implied);
}
if (mrsh+msize>=dst.u.f.msize) {
H5T_bit_copy(d, dst.u.f.mpos,
diff --git a/src/H5Tcset.c b/src/H5Tcset.c
index f9fe4e6..5d9c857 100644
--- a/src/H5Tcset.c
+++ b/src/H5Tcset.c
@@ -19,18 +19,18 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_cset_interface
+
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5T_cset_mask
+
#include "H5private.h" /*generic functions */
#include "H5Eprivate.h" /*error handling */
#include "H5Iprivate.h" /*ID functions */
#include "H5Tpkg.h" /*data-type functions */
-#define PABLO_MASK H5Tcset_mask
-
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_cset_interface
-static herr_t H5T_init_cset_interface(void);
-
/*--------------------------------------------------------------------------
NAME
@@ -48,9 +48,9 @@ DESCRIPTION
static herr_t
H5T_init_cset_interface(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_cset_interface);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_cset_interface)
- FUNC_LEAVE_NOAPI(H5T_init());
+ FUNC_LEAVE_NOAPI(H5T_init())
} /* H5T_init_cset_interface() */
@@ -80,27 +80,25 @@ H5Tget_cset(hid_t type_id)
H5T_t *dt = NULL;
H5T_cset_t ret_value;
- FUNC_ENTER_API(H5Tget_cset, H5T_CSET_ERROR);
+ FUNC_ENTER_API(H5Tget_cset, H5T_CSET_ERROR)
H5TRACE1("Tc","i",type_id);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_CSET_ERROR, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_CSET_ERROR, "not a data type")
while (dt->shared->parent && !H5T_IS_STRING(dt->shared))
dt = dt->shared->parent; /*defer to parent*/
if (!H5T_IS_STRING(dt->shared))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_CSET_ERROR, "operation not defined for data type class");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_CSET_ERROR, "operation not defined for data type class")
/* result */
- if(H5T_STRING == dt->shared->type)
+ if(H5T_IS_FIXED_STRING(dt->shared))
ret_value = dt->shared->u.atomic.u.s.cset;
- else if(H5T_VLEN == dt->shared->type && H5T_VLEN_STRING == dt->shared->u.vlen.type)
+ else
ret_value = dt->shared->u.vlen.cset;
- else
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, H5T_CSET_ERROR, "can't get cset info");
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -128,30 +126,28 @@ H5Tset_cset(hid_t type_id, H5T_cset_t cset)
H5T_t *dt = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tset_cset, FAIL);
+ FUNC_ENTER_API(H5Tset_cset, FAIL)
H5TRACE2("e","iTc",type_id,cset);
/* Check args */
if (NULL == (dt = 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 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)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal character set type");
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only")
+ 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*/
if (!H5T_IS_STRING(dt->shared))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for data type class");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for data type class")
/* Commit */
- if(H5T_STRING == dt->shared->type)
+ if(H5T_IS_FIXED_STRING(dt->shared))
dt->shared->u.atomic.u.s.cset = cset;
- else if(H5T_VLEN == dt->shared->type && H5T_VLEN_STRING == dt->shared->u.vlen.type)
+ else
dt->shared->u.vlen.cset = cset;
- else
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "can't set cset info");
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
diff --git a/src/H5Tenum.c b/src/H5Tenum.c
index 945e728..db1daa4 100644
--- a/src/H5Tenum.c
+++ b/src/H5Tenum.c
@@ -19,6 +19,9 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_enum_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5T_enum_mask
@@ -30,19 +33,14 @@
#include "H5MMprivate.h" /*memory management */
#include "H5Tpkg.h" /*data-type functions */
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_enum_interface
-static herr_t H5T_init_enum_interface(void);
-
/* Declare extern the free lists for H5T_t's and H5T_shared_t's */
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*/);
@@ -143,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);
@@ -225,9 +223,9 @@ 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)
{
- int i;
+ unsigned i;
char **names=NULL;
uint8_t *values=NULL;
herr_t ret_value=SUCCEED; /* Return value */
@@ -248,7 +246,7 @@ H5T_enum_insert(H5T_t *dt, const char *name, const void *value)
/* Increase table sizes */
if (dt->shared->u.enumer.nmembs >= dt->shared->u.enumer.nalloc) {
- int n = MAX(32, 2*dt->shared->u.enumer.nalloc);
+ unsigned n = MAX(32, 2*dt->shared->u.enumer.nalloc);
if (NULL==(names=H5MM_realloc(dt->shared->u.enumer.name, n*sizeof(char*))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
dt->shared->u.enumer.name = names;
@@ -288,19 +286,19 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Tget_member_value(hid_t type, int membno, void *value/*out*/)
+H5Tget_member_value(hid_t type, unsigned membno, void *value/*out*/)
{
H5T_t *dt=NULL;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(H5Tget_member_value, FAIL)
- H5TRACE3("e","iIsx",type,membno,value);
+ H5TRACE3("e","iIux",type,membno,value);
if (NULL==(dt=H5I_object_verify(type,H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
if (H5T_ENUM!=dt->shared->type)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for data type class")
- if (membno<0 || membno>=dt->shared->u.enumer.nmembs)
+ if (membno>=dt->shared->u.enumer.nmembs)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid member number")
if (!value)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null value buffer")
@@ -331,7 +329,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5T_get_member_value(const H5T_t *dt, int membno, void *value/*out*/)
+H5T_get_member_value(const H5T_t *dt, unsigned membno, void *value/*out*/)
{
herr_t ret_value=SUCCEED; /* Return value */
@@ -423,9 +421,9 @@ 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)
{
- int lt, md, rt; /*indices for binary search */
+ unsigned lt, md=0, rt; /*indices for binary search */
int cmp=(-1); /*comparison result */
char *ret_value; /* Return value */
@@ -446,7 +444,6 @@ H5T_enum_nameof(H5T_t *dt, const void *value, char *name/*out*/, size_t size)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOMPARE, NULL, "value sort failed")
lt = 0;
rt = dt->shared->u.enumer.nmembs;
- md = -1;
while (lt<rt) {
md = (lt+rt)/2;
@@ -544,9 +541,9 @@ 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*/)
{
- int lt, md, rt; /*indices for binary search */
+ unsigned lt, md=0, rt; /*indices for binary search */
int cmp=(-1); /*comparison result */
herr_t ret_value=SUCCEED; /* Return value */
@@ -566,7 +563,6 @@ H5T_enum_valueof(H5T_t *dt, const char *name, void *value/*out*/)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOMPARE, FAIL, "value sort failed")
lt = 0;
rt = dt->shared->u.enumer.nmembs;
- md = -1;
while (lt<rt) {
md = (lt+rt)/2;
diff --git a/src/H5Tfields.c b/src/H5Tfields.c
index 674a16b..d2c2082 100644
--- a/src/H5Tfields.c
+++ b/src/H5Tfields.c
@@ -19,19 +19,19 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_fields_interface
+
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5T_fields_mask
+
#include "H5private.h" /*generic functions */
#include "H5Eprivate.h" /*error handling */
#include "H5Iprivate.h" /*ID functions */
#include "H5MMprivate.h" /*memory management */
#include "H5Tpkg.h" /*data-type functions */
-#define PABLO_MASK H5Tfields_mask
-
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_fields_interface
-static herr_t H5T_init_fields_interface(void);
-
/*--------------------------------------------------------------------------
NAME
@@ -49,9 +49,9 @@ DESCRIPTION
static herr_t
H5T_init_fields_interface(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_fields_interface);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_fields_interface)
- FUNC_LEAVE_NOAPI(H5T_init());
+ FUNC_LEAVE_NOAPI(H5T_init())
} /* H5T_init_fields_interface() */
@@ -59,9 +59,9 @@ H5T_init_fields_interface(void)
* Function: H5Tget_nmembers
*
* Purpose: Determines how many members TYPE_ID has. The type must be
- * either a compound data type or an enumeration data type.
+ * either a compound datatype or an enumeration datatype.
*
- * Return: Success: Number of members defined in the data type.
+ * Return: Success: Number of members defined in the datatype.
*
* Failure: Negative
*
@@ -72,7 +72,7 @@ H5T_init_fields_interface(void)
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works with enumeration data types.
+ * Also works with enumeration datatypes.
*-------------------------------------------------------------------------
*/
int
@@ -81,18 +81,18 @@ H5Tget_nmembers(hid_t type_id)
H5T_t *dt = NULL;
int ret_value;
- FUNC_ENTER_API(H5Tget_nmembers, FAIL);
+ FUNC_ENTER_API(H5Tget_nmembers, FAIL)
H5TRACE1("Is","i",type_id);
/* Check args */
if (NULL == (dt = 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((ret_value = H5T_get_nmembers(dt))<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot return member number");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot return member number")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -101,9 +101,9 @@ done:
*
* Purpose: Private function for H5Tget_nmembers. Determines how many
* members DTYPE has. The type must be either a compound data
- * type or an enumeration data type.
+ * type or an enumeration datatype.
*
- * Return: Success: Number of members defined in the data type.
+ * Return: Success: Number of members defined in the datatype.
*
* Failure: Negative
*
@@ -121,19 +121,19 @@ H5T_get_nmembers(const H5T_t *dt)
{
int ret_value;
- FUNC_ENTER_NOAPI(H5T_get_nmembers, FAIL);
+ FUNC_ENTER_NOAPI(H5T_get_nmembers, FAIL)
assert(dt);
if (H5T_COMPOUND==dt->shared->type)
- ret_value = dt->shared->u.compnd.nmembs;
+ ret_value = (int)dt->shared->u.compnd.nmembs;
else if (H5T_ENUM==dt->shared->type)
- ret_value = dt->shared->u.enumer.nmembs;
+ ret_value = (int)dt->shared->u.enumer.nmembs;
else
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for type class");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for type class")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -141,7 +141,7 @@ done:
* Function: H5Tget_member_name
*
* Purpose: Returns the name of a member of a compound or enumeration
- * data type. Members are stored in no particular order with
+ * datatype. Members are stored in no particular order with
* numbers 0 through N-1 where N is the value returned by
* H5Tget_nmembers().
*
@@ -155,26 +155,26 @@ done:
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works with enumeration data types.
+ * Also works with enumeration datatypes.
*-------------------------------------------------------------------------
*/
char *
-H5Tget_member_name(hid_t type_id, int membno)
+H5Tget_member_name(hid_t type_id, unsigned membno)
{
H5T_t *dt = NULL;
char *ret_value;
- FUNC_ENTER_API(H5Tget_member_name, NULL);
+ FUNC_ENTER_API(H5Tget_member_name, NULL)
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype")
if((ret_value = H5T_get_member_name(dt, membno))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get member name");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get member name")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -182,7 +182,7 @@ done:
* Function: H5T_get_member_name
*
* Purpose: Private function for H5Tget_member_name. Returns the name
- * of a member of a compound or enumeration data type. Members
+ * of a member of a compound or enumeration datatype. Members
* are stored in no particular order with numbers 0 through
* N-1 where N is the value returned by H5Tget_nmembers().
*
@@ -198,33 +198,33 @@ done:
*-------------------------------------------------------------------------
*/
char *
-H5T_get_member_name(H5T_t const *dt, int membno)
+H5T_get_member_name(H5T_t const *dt, unsigned membno)
{
char *ret_value;
- FUNC_ENTER_NOAPI(H5T_get_member_name, NULL);
+ FUNC_ENTER_NOAPI(H5T_get_member_name, NULL)
assert(dt);
switch (dt->shared->type) {
case H5T_COMPOUND:
- if (membno<0 || membno>=dt->shared->u.compnd.nmembs)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid member number");
+ if (membno>=dt->shared->u.compnd.nmembs)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid member number")
ret_value = H5MM_xstrdup(dt->shared->u.compnd.memb[membno].name);
break;
case H5T_ENUM:
- if (membno<0 || membno>=dt->shared->u.enumer.nmembs)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid member number");
+ if (membno>=dt->shared->u.enumer.nmembs)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid member number")
ret_value = H5MM_xstrdup(dt->shared->u.enumer.name[membno]);
break;
default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "operation not supported for type class");
- }
+ 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);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -232,7 +232,7 @@ done:
* Function: H5Tget_member_index
*
* Purpose: Returns the index of a member in a compound or enumeration
- * data type by given name.Members are stored in no particular
+ * datatype by given name.Members are stored in no particular
* order with numbers 0 through N-1 where N is the value
* returned by H5Tget_nmembers().
*
@@ -251,47 +251,45 @@ H5Tget_member_index(hid_t type_id, const char *name)
{
H5T_t *dt = NULL;
int ret_value=FAIL;
- int nmembs, i;
+ unsigned i;
- FUNC_ENTER_API(H5Tget_member_index, FAIL);
+ FUNC_ENTER_API(H5Tget_member_index, FAIL)
H5TRACE2("Is","is",type_id,name);
/* Check arguments */
assert(name);
if(NULL==(dt=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")
/* Locate member by name */
switch (dt->shared->type) {
case H5T_COMPOUND:
- nmembs = dt->shared->u.compnd.nmembs;
- for(i=0; i<nmembs; i++) {
+ for(i=0; i< dt->shared->u.compnd.nmembs; i++) {
if(!HDstrcmp(dt->shared->u.compnd.memb[i].name, name))
- HGOTO_DONE(i);
+ HGOTO_DONE((int)i)
}
break;
case H5T_ENUM:
- nmembs = dt->shared->u.enumer.nmembs;
- for(i=0; i<nmembs; i++) {
+ for(i=0; i< dt->shared->u.enumer.nmembs; i++) {
if(!HDstrcmp(dt->shared->u.enumer.name[i], name))
- HGOTO_DONE(i);
+ HGOTO_DONE((int)i)
}
break;
default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for this type");
- }
+ 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);
+ FUNC_LEAVE_API(ret_value)
}
/*-------------------------------------------------------------------------
* Function: H5T_sort_value
*
- * Purpose: Sorts the members of a compound data type by their offsets;
+ * Purpose: Sorts the members of a compound datatype by their offsets;
* sorts the members of an enum type by their values. This even
- * works for locked data types since it doesn't change the value
+ * works for locked datatypes since it doesn't change the value
* of the type. MAP is an optional parallel integer array which
* is also swapped along with members of DT.
*
@@ -305,15 +303,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5T_sort_value(H5T_t *dt, int *map)
+H5T_sort_value(const H5T_t *dt, int *map)
{
- int i, j, nmembs;
+ unsigned i, j, nmembs;
size_t size;
hbool_t swapped;
uint8_t tbuf[32];
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5T_sort_value, FAIL);
+ FUNC_ENTER_NOAPI(H5T_sort_value, FAIL)
/* Check args */
assert(dt);
@@ -393,15 +391,15 @@ H5T_sort_value(H5T_t *dt, int *map)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
/*-------------------------------------------------------------------------
* Function: H5T_sort_name
*
- * Purpose: Sorts members of a compound or enumeration data type by their
- * names. This even works for locked data types since it doesn't
+ * Purpose: Sorts members of a compound or enumeration datatype by their
+ * names. This even works for locked datatypes since it doesn't
* change the value of the types.
*
* Return: Success: Non-negative
@@ -416,15 +414,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5T_sort_name(H5T_t *dt, int *map)
+H5T_sort_name(const H5T_t *dt, int *map)
{
- int i, j, nmembs;
+ unsigned i, j, nmembs;
size_t size;
hbool_t swapped;
uint8_t tbuf[32];
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5T_sort_name, FAIL);
+ FUNC_ENTER_NOAPI(H5T_sort_name, FAIL)
/* Check args */
assert(dt);
@@ -500,6 +498,6 @@ H5T_sort_name(H5T_t *dt, int *map)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
diff --git a/src/H5Tfixed.c b/src/H5Tfixed.c
index 041c58f..99fc26a 100644
--- a/src/H5Tfixed.c
+++ b/src/H5Tfixed.c
@@ -19,18 +19,18 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_fixed_interface
+
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5T_fixed_mask
+
#include "H5private.h" /*generic functions */
#include "H5Eprivate.h" /*error handling */
#include "H5Iprivate.h" /*ID functions */
#include "H5Tpkg.h" /*data-type functions */
-#define PABLO_MASK H5Tfixed_mask
-
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_fixed_interface
-static herr_t H5T_init_fixed_interface(void);
-
/*--------------------------------------------------------------------------
NAME
@@ -48,9 +48,9 @@ DESCRIPTION
static herr_t
H5T_init_fixed_interface(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_fixed_interface);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_fixed_interface)
- FUNC_LEAVE_NOAPI(H5T_init());
+ FUNC_LEAVE_NOAPI(H5T_init())
} /* H5T_init_fixed_interface() */
@@ -68,7 +68,7 @@ H5T_init_fixed_interface(void)
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works with derived data types.
+ * Also works with derived datatypes.
*-------------------------------------------------------------------------
*/
H5T_sign_t
@@ -77,17 +77,17 @@ H5Tget_sign(hid_t type_id)
H5T_t *dt = NULL;
H5T_sign_t ret_value;
- FUNC_ENTER_API(H5Tget_sign, H5T_SGN_ERROR);
+ FUNC_ENTER_API(H5Tget_sign, H5T_SGN_ERROR)
H5TRACE1("Ts","i",type_id);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_SGN_ERROR, "not an integer data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_SGN_ERROR, "not an integer datatype")
ret_value = H5T_get_sign(dt);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -123,7 +123,7 @@ H5T_get_sign(H5T_t const *dt)
/* Check args */
if (H5T_INTEGER!=dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_SGN_ERROR, "operation not defined for data type class")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_SGN_ERROR, "operation not defined for datatype class")
/* Sign */
ret_value = dt->shared->u.atomic.u.i.sign;
@@ -146,7 +146,7 @@ done:
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works with derived data types.
+ * Also works with derived datatypes.
*
*-------------------------------------------------------------------------
*/
@@ -156,27 +156,27 @@ H5Tset_sign(hid_t type_id, H5T_sign_t sign)
H5T_t *dt = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tset_sign, FAIL);
+ FUNC_ENTER_API(H5Tset_sign, FAIL)
H5TRACE2("e","iTs",type_id,sign);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an integer data type");
+ 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, "data type is read-only");
- if (sign < 0 || sign >= H5T_NSGN)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal sign type");
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only")
+ 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");
+ 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_INTEGER!=dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for data type class");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class")
/* Commit */
dt->shared->u.atomic.u.i.sign = sign;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
diff --git a/src/H5Tfloat.c b/src/H5Tfloat.c
index 7b7ac98..6be73da 100644
--- a/src/H5Tfloat.c
+++ b/src/H5Tfloat.c
@@ -19,18 +19,18 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_float_interface
+
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5T_float_mask
+
#include "H5private.h" /*generic functions */
#include "H5Eprivate.h" /*error handling */
#include "H5Iprivate.h" /*ID functions */
#include "H5Tpkg.h" /*data-type functions */
-#define PABLO_MASK H5Tfloat_mask
-
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_float_interface
-static herr_t H5T_init_float_interface(void);
-
/*--------------------------------------------------------------------------
NAME
@@ -48,9 +48,9 @@ DESCRIPTION
static herr_t
H5T_init_float_interface(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_float_interface);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_float_interface)
- FUNC_LEAVE_NOAPI(H5T_init());
+ FUNC_LEAVE_NOAPI(H5T_init())
} /* H5T_init_float_interface() */
@@ -58,8 +58,8 @@ H5T_init_float_interface(void)
* Function: H5Tget_fields
*
* Purpose: Returns information about the locations of the various bit
- * fields of a floating point data type. The field positions
- * are bit positions in the significant region of the data type.
+ * fields of a floating point datatype. The field positions
+ * are bit positions in the significant region of the datatype.
* Bits are numbered with the least significant bit number zero.
*
* Any (or even all) of the arguments can be null pointers.
@@ -74,7 +74,7 @@ H5T_init_float_interface(void)
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works with derived data types.
+ * Also works with derived datatypes.
*-------------------------------------------------------------------------
*/
herr_t
@@ -85,16 +85,16 @@ H5Tget_fields(hid_t type_id, size_t *spos/*out*/,
H5T_t *dt = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tget_fields, FAIL);
+ FUNC_ENTER_API(H5Tget_fields, FAIL)
H5TRACE6("e","ixxxxx",type_id,spos,epos,esize,mpos,msize);
/* Check args */
if (NULL == (dt = 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")
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
if (H5T_FLOAT != dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for data type class");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class")
/* Get values */
if (spos) *spos = dt->shared->u.atomic.u.f.sign;
@@ -104,7 +104,7 @@ H5Tget_fields(hid_t type_id, size_t *spos/*out*/,
if (msize) *msize = dt->shared->u.atomic.u.f.msize;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -113,7 +113,7 @@ done:
*
* Purpose: Sets the locations and sizes of the various floating point
* bit fields. The field positions are bit positions in the
- * significant region of the data type. Bits are numbered with
+ * significant region of the datatype. Bits are numbered with
* the least significant bit number zero.
*
* Fields are not allowed to extend beyond the number of bits of
@@ -126,7 +126,7 @@ done:
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works for derived data types.
+ * Also works for derived datatypes.
*
*-------------------------------------------------------------------------
*/
@@ -137,33 +137,33 @@ H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize,
H5T_t *dt = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tset_fields, FAIL);
+ FUNC_ENTER_API(H5Tset_fields, FAIL)
H5TRACE6("e","izzzzz",type_id,spos,epos,esize,mpos,msize);
/* Check args */
if (NULL == (dt = 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 (H5T_STATE_TRANSIENT!=dt->shared->state)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only");
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only")
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
if (H5T_FLOAT != dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for data type class");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class")
if (epos + esize > dt->shared->u.atomic.prec)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "exponent bit field size/location is invalid");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "exponent bit field size/location is invalid")
if (mpos + msize > dt->shared->u.atomic.prec)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mantissa bit field size/location is invalid");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mantissa bit field size/location is invalid")
if (spos >= dt->shared->u.atomic.prec)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign location is not valid");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign location is not valid")
/* Check for overlap */
if (spos >= epos && spos < epos + esize)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign bit appears within exponent field");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign bit appears within exponent field")
if (spos >= mpos && spos < mpos + msize)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign bit appears within mantissa field");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign bit appears within mantissa field")
if ((mpos < epos && mpos + msize > epos) ||
(epos < mpos && epos + esize > mpos))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "exponent and mantissa fields overlap");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "exponent and mantissa fields overlap")
/* Commit */
dt->shared->u.atomic.u.f.sign = spos;
@@ -173,7 +173,7 @@ H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize,
dt->shared->u.atomic.u.f.msize = msize;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -191,7 +191,7 @@ done:
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works with derived data types.
+ * Also works with derived datatypes.
*-------------------------------------------------------------------------
*/
size_t
@@ -200,22 +200,22 @@ H5Tget_ebias(hid_t type_id)
H5T_t *dt = NULL;
size_t ret_value;
- FUNC_ENTER_API(H5Tget_ebias, 0);
+ FUNC_ENTER_API(H5Tget_ebias, 0)
H5TRACE1("z","i",type_id);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype")
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
if (H5T_FLOAT != dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for data type class");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for datatype class")
/* bias */
H5_ASSIGN_OVERFLOW(ret_value,dt->shared->u.atomic.u.f.ebias,uint64_t,size_t);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -231,7 +231,7 @@ done:
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works with derived data types.
+ * Also works with derived datatypes.
*
*-------------------------------------------------------------------------
*/
@@ -241,24 +241,24 @@ H5Tset_ebias(hid_t type_id, size_t ebias)
H5T_t *dt = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tset_ebias, FAIL);
+ FUNC_ENTER_API(H5Tset_ebias, FAIL)
H5TRACE2("e","iz",type_id,ebias);
/* Check args */
if (NULL == (dt = 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 (H5T_STATE_TRANSIENT!=dt->shared->state)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only");
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only")
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
if (H5T_FLOAT != dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for data type class");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class")
/* Commit */
dt->shared->u.atomic.u.f.ebias = ebias;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -277,7 +277,7 @@ done:
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works with derived data types.
+ * Also works with derived datatypes.
*
*-------------------------------------------------------------------------
*/
@@ -287,22 +287,22 @@ H5Tget_norm(hid_t type_id)
H5T_t *dt = NULL;
H5T_norm_t ret_value;
- FUNC_ENTER_API(H5Tget_norm, H5T_NORM_ERROR);
+ FUNC_ENTER_API(H5Tget_norm, H5T_NORM_ERROR)
H5TRACE1("Tn","i",type_id);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NORM_ERROR, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NORM_ERROR, "not a datatype")
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
if (H5T_FLOAT != dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_NORM_ERROR, "operation not defined for data type class");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_NORM_ERROR, "operation not defined for datatype class")
/* norm */
ret_value = dt->shared->u.atomic.u.f.norm;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -310,7 +310,7 @@ done:
* Function: H5Tset_norm
*
* Purpose: Sets the mantissa normalization method for a floating point
- * data type.
+ * datatype.
*
* Return: Non-negative on success/Negative on failure
*
@@ -319,7 +319,7 @@ done:
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works for derived data types.
+ * Also works for derived datatypes.
*
*-------------------------------------------------------------------------
*/
@@ -329,26 +329,26 @@ H5Tset_norm(hid_t type_id, H5T_norm_t norm)
H5T_t *dt = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tset_norm, FAIL);
+ FUNC_ENTER_API(H5Tset_norm, FAIL)
H5TRACE2("e","iTn",type_id,norm);
/* Check args */
if (NULL == (dt = 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 (H5T_STATE_TRANSIENT!=dt->shared->state)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only");
- if (norm < 0 || norm > H5T_NORM_NONE)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal normalization");
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only")
+ 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*/
if (H5T_FLOAT != dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for data type class");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class")
/* Commit */
dt->shared->u.atomic.u.f.norm = norm;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -369,7 +369,7 @@ done:
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works for derived data types.
+ * Also works for derived datatypes.
*
*-------------------------------------------------------------------------
*/
@@ -379,22 +379,22 @@ H5Tget_inpad(hid_t type_id)
H5T_t *dt = NULL;
H5T_pad_t ret_value;
- FUNC_ENTER_API(H5Tget_inpad, H5T_PAD_ERROR);
+ FUNC_ENTER_API(H5Tget_inpad, H5T_PAD_ERROR)
H5TRACE1("Tp","i",type_id);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_PAD_ERROR, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_PAD_ERROR, "not a datatype")
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
if (H5T_FLOAT != dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_PAD_ERROR, "operation not defined for data type class");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_PAD_ERROR, "operation not defined for datatype class")
/* pad */
ret_value = dt->shared->u.atomic.u.f.pad;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -413,7 +413,7 @@ done:
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works for derived data types.
+ * Also works for derived datatypes.
*
*-------------------------------------------------------------------------
*/
@@ -423,25 +423,25 @@ H5Tset_inpad(hid_t type_id, H5T_pad_t pad)
H5T_t *dt = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tset_inpad, FAIL);
+ FUNC_ENTER_API(H5Tset_inpad, FAIL)
H5TRACE2("e","iTp",type_id,pad);
/* Check args */
if (NULL == (dt = 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 (H5T_STATE_TRANSIENT!=dt->shared->state)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only");
- if (pad < 0 || pad >= H5T_NPAD)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal internal pad type");
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only")
+ 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*/
if (H5T_FLOAT != dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for data type class");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class")
/* Commit */
dt->shared->u.atomic.u.f.pad = pad;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index 992a2ab..291c41b 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -17,23 +17,21 @@
* a "native" datatype for the H5T interface.
*/
-#define H5T_PACKAGE /*suppress error about including H5Tpkg */
+#define H5T_PACKAGE /*suppress error about including H5Tpkg */
+
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_native_interface
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
-#define PABLO_MASK H5Tnative_mask
-
-#include "H5private.h" /*generic functions */
-#include "H5Eprivate.h" /*error handling */
-#include "H5Iprivate.h" /*ID functions */
-#include "H5Pprivate.h" /*property list */
-#include "H5MMprivate.h" /*memory management */
-#include "H5Tpkg.h" /*data-type functions */
+#define PABLO_MASK H5T_native_mask
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_native_interface
-static herr_t H5T_init_native_interface(void);
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Tpkg.h" /* Datatypes */
/* Static local functions */
static H5T_t *H5T_get_native_type(H5T_t *dt, H5T_direction_t direction,
@@ -62,9 +60,9 @@ DESCRIPTION
static herr_t
H5T_init_native_interface(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_native_interface);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_native_interface)
- FUNC_LEAVE_NOAPI(H5T_init());
+ FUNC_LEAVE_NOAPI(H5T_init())
} /* H5T_init_native_interface() */
@@ -108,31 +106,32 @@ H5Tget_native_type(hid_t type_id, H5T_direction_t direction)
size_t comp_size=0; /* Compound datatype's size */
hid_t ret_value; /* Return value */
- FUNC_ENTER_API(H5Tget_native_type, FAIL);
+ FUNC_ENTER_API(H5Tget_native_type, FAIL)
H5TRACE2("i","iTd",type_id,direction);
/* check argument */
if(NULL==(dt=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 data type")
if(direction!=H5T_DIR_DEFAULT && direction!=H5T_DIR_ASCEND
&& direction!=H5T_DIR_DESCEND)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not valid direction value");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not valid direction value")
if((new_dt = H5T_get_native_type(dt, direction, NULL, NULL, &comp_size))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot retrieve native type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot retrieve native type")
if((ret_value=H5I_register(H5I_DATATYPE, new_dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type")
done:
/* Error cleanup */
if(ret_value<0) {
if(new_dt)
- H5T_close(new_dt);
+ if(H5T_close(new_dt)<0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release datatype")
} /* end if */
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -148,7 +147,7 @@ done:
* Programmer: Raymond Lu
* Oct 3, 2002
*
- * Modifications:
+ * Modifications:
*
*-------------------------------------------------------------------------
*/
@@ -159,22 +158,23 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
H5T_class_t h5_class; /* Class of datatype to make native */
size_t size; /* Size of datatype to make native */
size_t prec; /* Precision of datatype to make native */
- int nmemb; /* Number of members in compound & enum types */
+ int snmemb; /* Number of members in compound & enum types */
+ unsigned nmemb; /* Number of members in compound & enum types */
H5T_t *super_type; /* Super type of VL, array and enum datatypes */
H5T_t *nat_super_type; /* Native form of VL, array & enum super datatype */
H5T_t *new_type=NULL; /* New native datatype */
- int i; /* Local index variable */
+ unsigned i; /* Local index variable */
H5T_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5T_get_native_type, NULL);
+ FUNC_ENTER_NOAPI(H5T_get_native_type, NULL)
assert(dtype);
- if((h5_class = H5T_get_class(dtype))<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid class");
+ 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)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid size");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid size")
switch(h5_class) {
case H5T_INTEGER:
@@ -182,33 +182,33 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
H5T_sign_t sign; /* Signedness of integer type */
if((sign = H5T_get_sign(dtype))==H5T_SGN_ERROR)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid signess");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid signess")
prec = dtype->shared->u.atomic.prec;
-
+
if((ret_value = H5T_get_native_integer(prec, sign, direction, struct_align, offset, comp_size))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve integer type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve integer type")
}
break;
case H5T_FLOAT:
if((ret_value = H5T_get_native_float(size, direction, struct_align, offset, comp_size))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type")
break;
case H5T_STRING:
if((ret_value=H5T_copy(dtype, H5T_COPY_TRANSIENT))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type")
if(H5T_IS_VL_STRING(dtype->shared)) {
/* Update size, offset and compound alignment for parent. */
if(H5T_cmp_offset(comp_size, offset, sizeof(char *), 1, H5T_POINTER_COMP_ALIGN_g, struct_align)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset")
} else {
/* Update size, offset and compound alignment for parent. */
if(H5T_cmp_offset(comp_size, offset, sizeof(char), size, H5T_NATIVE_SCHAR_COMP_ALIGN_g, struct_align)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset")
}
break;
@@ -236,11 +236,11 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
int not_equal;
if((ret_value=H5T_copy(dtype, H5T_COPY_TRANSIENT))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type")
/* Decide if the data type is object or dataset region reference. */
if(NULL==(dt=H5I_object(H5T_STD_REF_OBJ_g)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type")
not_equal = H5T_cmp(ret_value, dt);
/* Update size, offset and compound alignment for parent. */
@@ -253,7 +253,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
}
if(H5T_cmp_offset(comp_size, offset, ref_size, 1, align, struct_align)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset")
}
break;
@@ -266,29 +266,30 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
size_t children_st_align=0; /* The max alignment among compound members. This'll be the compound alignment */
char **comp_mname; /* List of member names in compound type */
- if((nmemb = H5T_get_nmembers(dtype))<=0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "compound data type doesn't have any member");
+ if((snmemb = H5T_get_nmembers(dtype))<=0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "compound data type doesn't have any member")
+ H5_ASSIGN_OVERFLOW(nmemb,snmemb,int,unsigned);
if((memb_list = (H5T_t**)H5MM_malloc(nmemb*sizeof(H5T_t*)))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory")
if((memb_offset = (size_t*)H5MM_calloc(nmemb*sizeof(size_t)))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory")
if((comp_mname = (char**)H5MM_malloc(nmemb*sizeof(char*)))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory")
/* Construct child compound type and retrieve a list of their IDs, offsets, total size, and alignment for compound type. */
for(i=0; i<nmemb; i++) {
if((memb_type = H5T_get_member_type(dtype, i))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member type retrieval failed");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member type retrieval failed")
if((comp_mname[i] = H5T_get_member_name(dtype, i))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member type retrieval failed");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member type retrieval failed")
if((memb_list[i] = H5T_get_native_type(memb_type, direction, &children_st_align, &(memb_offset[i]), &children_size))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member identifier retrieval failed");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member identifier retrieval failed")
if(H5T_close(memb_type)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype")
}
/* The alignment for whole compound type */
@@ -297,12 +298,12 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
/* Construct new compound type based on native type */
if((new_type=H5T_create(H5T_COMPOUND, children_size))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot create a compound type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot create a compound type")
/* Insert members for the new compound type */
for(i=0; i<nmemb; i++) {
if(H5T_insert(new_type, comp_mname[i], memb_offset[i], memb_list[i])<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot insert member to compound datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot insert member to compound datatype")
}
/* Update size, offset and compound alignment for parent. */
@@ -315,7 +316,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
/* Close member data type */
for(i=0; i<nmemb; i++) {
if(H5T_close(memb_list[i])<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype")
/* Free member names in list */
H5MM_xfree(comp_mname[i]);
@@ -340,40 +341,41 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
/* Retrieve base type for enumarate type */
if((super_type=H5T_get_super(dtype))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get base type for enumarate type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get base type for enumarate type")
if((nat_super_type = H5T_get_native_type(super_type, direction, struct_align, offset, comp_size))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "base native type retrieval failed");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "base native type retrieval failed")
if((super_type_id=H5I_register(H5I_DATATYPE, super_type))<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot register datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot register datatype")
if((nat_super_type_id=H5I_register(H5I_DATATYPE, nat_super_type))<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot register datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot register datatype")
/* Allocate room for the enum values */
if((tmp_memb_value = H5MM_calloc(H5T_get_size(super_type)))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory")
if((memb_value = H5MM_calloc(H5T_get_size(nat_super_type)))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory")
/* Construct new enum type based on native type */
if((new_type=H5T_enum_create(nat_super_type))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create enum type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create enum type")
/* Retrieve member info and insert members into new enum type */
- if((nmemb = H5T_get_nmembers(dtype))<=0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "enumarate data type doesn't have any member");
+ if((snmemb = H5T_get_nmembers(dtype))<=0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "enumarate data type doesn't have any member")
+ H5_ASSIGN_OVERFLOW(nmemb,snmemb,int,unsigned);
for(i=0; i<nmemb; i++) {
if((memb_name=H5T_get_member_name(dtype, i))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member name");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member name")
if(H5T_get_member_value(dtype, i, tmp_memb_value)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value")
HDmemcpy(memb_value, tmp_memb_value, H5T_get_size(super_type));
if(H5Tconvert(super_type_id, nat_super_type_id, 1, memb_value, NULL, H5P_DEFAULT)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value")
if(H5T_enum_insert(new_type, memb_name, memb_value)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot insert member");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot insert member")
H5MM_xfree(memb_name);
}
H5MM_xfree(memb_value);
@@ -381,10 +383,10 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
/* Close base type */
if(H5Tclose(nat_super_type_id)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype")
/* Close super type */
if(H5Tclose(super_type_id)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype")
ret_value = new_type;
}
@@ -392,7 +394,8 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
case H5T_ARRAY:
{
- int array_rank; /* Array's rank */
+ int sarray_rank; /* Array's rank */
+ unsigned array_rank; /* Array's rank */
hsize_t *dims = NULL; /* Dimension sizes for array */
hsize_t nelems = 1;
size_t super_offset=0;
@@ -400,37 +403,38 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
size_t super_align=0;
/* Retrieve dimension information for array data type */
- if((array_rank=H5T_get_array_ndims(dtype))<=0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get dimension rank");
+ if((sarray_rank=H5T_get_array_ndims(dtype))<=0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get dimension rank")
+ H5_ASSIGN_OVERFLOW(array_rank,sarray_rank,int,unsigned);
if((dims = (hsize_t*)H5MM_malloc(array_rank*sizeof(hsize_t)))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory")
if(H5T_get_array_dims(dtype, dims, NULL)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get dimension size");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get dimension size")
/* Retrieve base type for array type */
if((super_type=H5T_get_super(dtype))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get parent type for enumarate type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get parent type for enumarate type")
if((nat_super_type = H5T_get_native_type(super_type, direction, &super_align,
&super_offset, &super_size))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "parent native type retrieval failed");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "parent native type retrieval failed")
/* Close super type */
if(H5T_close(super_type)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype")
/* Create a new array type based on native type */
- if((new_type=H5T_array_create(nat_super_type, array_rank, dims, NULL))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create array type");
+ if((new_type=H5T_array_create(nat_super_type, sarray_rank, dims, NULL))==NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create array type")
/* Close base type */
if(H5T_close(nat_super_type)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype")
for(i=0; i<array_rank; i++)
nelems *= dims[i];
H5_CHECK_OVERFLOW(nelems,hsize_t,size_t);
if(H5T_cmp_offset(comp_size, offset, super_size, (size_t)nelems, super_align, struct_align)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset")
H5MM_xfree(dims);
ret_value = new_type;
@@ -445,47 +449,50 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
/* Retrieve base type for array type */
if((super_type=H5T_get_super(dtype))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get parent type for enumarate type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get parent type for enumarate type")
/* Don't need alignment, offset information if this VL isn't a field of compound type. If it
* is, go to a few steps below to compute the information directly. */
if((nat_super_type = H5T_get_native_type(super_type, direction, NULL, NULL, &super_size))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "parent native type retrieval failed");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "parent native type retrieval failed")
/* Close super type */
if(H5T_close(super_type)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype")
/* Create a new array type based on native type */
if((new_type=H5T_vlen_create(nat_super_type))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create VL type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create VL type")
/* Close base type */
if(H5T_close(nat_super_type)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype")
/* Update size, offset and compound alignment for parent compound type directly. */
vl_align = H5T_HVL_COMP_ALIGN_g;
vl_size = sizeof(hvl_t);
if(H5T_cmp_offset(comp_size, offset, vl_size, 1, vl_align, struct_align)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset")
ret_value = new_type;
}
break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "data type doesn't match any native type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "data type doesn't match any native type")
}
done:
/* Error cleanup */
if(ret_value==NULL) {
if(new_type)
- H5T_close(new_type);
+ if(H5T_close(new_type)<0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, NULL, "unable to release datatype")
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -530,71 +537,70 @@ H5T_get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
FUNC_ENTER_NOAPI(H5T_get_native_integer, NULL);
- if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND)
- {
- if(prec<=H5Tget_precision(H5T_NATIVE_SCHAR)) {
- match=H5T_NATIVE_INT_MATCH_CHAR;
- native_size = sizeof(char);
- } else if(prec<=H5Tget_precision(H5T_NATIVE_SHORT)) {
- match=H5T_NATIVE_INT_MATCH_SHORT;
- native_size = sizeof(short);
- } else if(prec<=H5Tget_precision(H5T_NATIVE_INT)) {
- match=H5T_NATIVE_INT_MATCH_INT;
- native_size = sizeof(int);
- } else if(prec<=H5Tget_precision(H5T_NATIVE_LONG)) {
- match=H5T_NATIVE_INT_MATCH_LONG;
- native_size = sizeof(long);
- } else if(prec<=H5Tget_precision(H5T_NATIVE_LLONG)) {
- match=H5T_NATIVE_INT_MATCH_LLONG;
- native_size = sizeof(long_long);
- } else { /* If no native type matches the querried datatype, simply choose the type of biggest size. */
- match=H5T_NATIVE_INT_MATCH_LLONG;
- native_size = sizeof(long_long);
- }
- } else if(direction == H5T_DIR_DESCEND) {
- if(prec>=H5Tget_precision(H5T_NATIVE_LLONG)) {
- match=H5T_NATIVE_INT_MATCH_LLONG;
- native_size = sizeof(long_long);
- } else if(prec>=H5Tget_precision(H5T_NATIVE_LONG)) {
- if(prec==H5Tget_precision(H5T_NATIVE_LONG)) {
- match=H5T_NATIVE_INT_MATCH_LONG;
- native_size = sizeof(long);
- } else {
- match=H5T_NATIVE_INT_MATCH_LLONG;
- native_size = sizeof(long_long);
- }
- }
- else if(prec>=H5Tget_precision(H5T_NATIVE_INT)) {
- if(prec==H5Tget_precision(H5T_NATIVE_INT)) {
- match=H5T_NATIVE_INT_MATCH_INT;
- native_size = sizeof(int);
- } else {
- match=H5T_NATIVE_INT_MATCH_LONG;
- native_size = sizeof(long);
- }
- }
- else if(prec>=H5Tget_precision(H5T_NATIVE_SHORT)) {
- if(prec==H5Tget_precision(H5T_NATIVE_SHORT)) {
- match=H5T_NATIVE_INT_MATCH_SHORT;
- native_size = sizeof(short);
- } else {
- match=H5T_NATIVE_INT_MATCH_INT;
- native_size = sizeof(int);
- }
- }
- else if(prec>=H5Tget_precision(H5T_NATIVE_SCHAR)) {
- if(prec==H5Tget_precision(H5T_NATIVE_SCHAR)) {
- match=H5T_NATIVE_INT_MATCH_CHAR;
- native_size = sizeof(char);
- } else {
- match=H5T_NATIVE_INT_MATCH_SHORT;
- native_size = sizeof(short);
- }
- }
- else { /* If no native type matches the querried datatype, simple choose the type of smallest size. */
- match=H5T_NATIVE_INT_MATCH_CHAR;
- native_size = sizeof(char);
- }
+ if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) {
+ if(prec<=H5Tget_precision(H5T_NATIVE_SCHAR)) {
+ match=H5T_NATIVE_INT_MATCH_CHAR;
+ native_size = sizeof(char);
+ } else if(prec<=H5Tget_precision(H5T_NATIVE_SHORT)) {
+ match=H5T_NATIVE_INT_MATCH_SHORT;
+ native_size = sizeof(short);
+ } else if(prec<=H5Tget_precision(H5T_NATIVE_INT)) {
+ match=H5T_NATIVE_INT_MATCH_INT;
+ native_size = sizeof(int);
+ } else if(prec<=H5Tget_precision(H5T_NATIVE_LONG)) {
+ match=H5T_NATIVE_INT_MATCH_LONG;
+ native_size = sizeof(long);
+ } else if(prec<=H5Tget_precision(H5T_NATIVE_LLONG)) {
+ match=H5T_NATIVE_INT_MATCH_LLONG;
+ native_size = sizeof(long_long);
+ } else { /* If no native type matches the querried datatype, simply choose the type of biggest size. */
+ match=H5T_NATIVE_INT_MATCH_LLONG;
+ native_size = sizeof(long_long);
+ }
+ } else if(direction == H5T_DIR_DESCEND) {
+ if(prec>=H5Tget_precision(H5T_NATIVE_LLONG)) {
+ match=H5T_NATIVE_INT_MATCH_LLONG;
+ native_size = sizeof(long_long);
+ } else if(prec>=H5Tget_precision(H5T_NATIVE_LONG)) {
+ if(prec==H5Tget_precision(H5T_NATIVE_LONG)) {
+ match=H5T_NATIVE_INT_MATCH_LONG;
+ native_size = sizeof(long);
+ } else {
+ match=H5T_NATIVE_INT_MATCH_LLONG;
+ native_size = sizeof(long_long);
+ }
+ }
+ else if(prec>=H5Tget_precision(H5T_NATIVE_INT)) {
+ if(prec==H5Tget_precision(H5T_NATIVE_INT)) {
+ match=H5T_NATIVE_INT_MATCH_INT;
+ native_size = sizeof(int);
+ } else {
+ match=H5T_NATIVE_INT_MATCH_LONG;
+ native_size = sizeof(long);
+ }
+ }
+ else if(prec>=H5Tget_precision(H5T_NATIVE_SHORT)) {
+ if(prec==H5Tget_precision(H5T_NATIVE_SHORT)) {
+ match=H5T_NATIVE_INT_MATCH_SHORT;
+ native_size = sizeof(short);
+ } else {
+ match=H5T_NATIVE_INT_MATCH_INT;
+ native_size = sizeof(int);
+ }
+ }
+ else if(prec>=H5Tget_precision(H5T_NATIVE_SCHAR)) {
+ if(prec==H5Tget_precision(H5T_NATIVE_SCHAR)) {
+ match=H5T_NATIVE_INT_MATCH_CHAR;
+ native_size = sizeof(char);
+ } else {
+ match=H5T_NATIVE_INT_MATCH_SHORT;
+ native_size = sizeof(short);
+ }
+ }
+ else { /* If no native type matches the queried datatype, simply choose the type of smallest size. */
+ match=H5T_NATIVE_INT_MATCH_CHAR;
+ native_size = sizeof(char);
+ }
}
/* Set the appropriate native datatype information */
@@ -643,25 +649,25 @@ 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 */
assert(tid>=0);
if(NULL==(dt=H5I_object(tid)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type")
if((ret_value=H5T_copy(dt, H5T_COPY_TRANSIENT))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot copy type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot copy type")
/* compute size and offset of compound type member. */
if(H5T_cmp_offset(comp_size, offset, native_size, 1, align, struct_align)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -688,7 +694,7 @@ H5T_get_native_float(size_t size, H5T_direction_t direction, size_t *struct_alig
H5T_t *dt=NULL; /* Appropriate native datatype to copy */
hid_t tid=(-1); /* Datatype ID of appropriate native datatype */
size_t align=0; /* Alignment necessary for native datatype */
- size_t native_size=0; /* Datatype size of the native type */
+ size_t native_size=0; /* Datatype size of the native type */
enum match_type { /* The different kinds of floating point types we can match */
H5T_NATIVE_FLOAT_MATCH_FLOAT,
H5T_NATIVE_FLOAT_MATCH_DOUBLE,
@@ -697,50 +703,50 @@ H5T_get_native_float(size_t size, H5T_direction_t direction, size_t *struct_alig
} match=H5T_NATIVE_FLOAT_MATCH_UNKNOWN;
H5T_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5T_get_native_float, NULL);
+ FUNC_ENTER_NOAPI(H5T_get_native_float, NULL)
assert(size>0);
if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) {
if(size<=sizeof(float)) {
match=H5T_NATIVE_FLOAT_MATCH_FLOAT;
- native_size = sizeof(float);
+ native_size = sizeof(float);
} else if(size<=sizeof(double)) {
match=H5T_NATIVE_FLOAT_MATCH_DOUBLE;
- native_size = sizeof(double);
+ native_size = sizeof(double);
} else if(size<=sizeof(long double)) {
match=H5T_NATIVE_FLOAT_MATCH_LDOUBLE;
- native_size = sizeof(long double);
+ native_size = sizeof(long double);
} else { /* If not match, return the biggest datatype */
match=H5T_NATIVE_FLOAT_MATCH_LDOUBLE;
- native_size = sizeof(long double);
- }
+ native_size = sizeof(long double);
+ }
} else {
if(size>=sizeof(long double)) {
match=H5T_NATIVE_FLOAT_MATCH_LDOUBLE;
- native_size = sizeof(long double);
+ native_size = sizeof(long double);
} else if(size>=sizeof(double)) {
if(size==sizeof(double)) {
match=H5T_NATIVE_FLOAT_MATCH_DOUBLE;
- native_size = sizeof(double);
+ native_size = sizeof(double);
} else {
match=H5T_NATIVE_FLOAT_MATCH_LDOUBLE;
- native_size = sizeof(long double);
- }
+ native_size = sizeof(long double);
+ }
}
else if(size>=sizeof(float)) {
if(size==sizeof(float)) {
match=H5T_NATIVE_FLOAT_MATCH_FLOAT;
- native_size = sizeof(float);
+ native_size = sizeof(float);
} else {
match=H5T_NATIVE_FLOAT_MATCH_DOUBLE;
- native_size = sizeof(double);
- }
+ native_size = sizeof(double);
+ }
}
else {
match=H5T_NATIVE_FLOAT_MATCH_FLOAT;
- native_size = sizeof(float);
- }
+ native_size = sizeof(float);
+ }
}
/* Set the appropriate native floating point information */
@@ -760,40 +766,40 @@ 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 */
assert(tid>=0);
if(NULL==(dt=H5I_object(tid)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type")
if((ret_value=H5T_copy(dt, H5T_COPY_TRANSIENT))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type")
/* compute offset of compound type member. */
if(H5T_cmp_offset(comp_size, offset, native_size, 1, align, struct_align)<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
/*-------------------------------------------------------------------------
- * Function: H5T_cmp_offset
+ * Function: H5T_cmp_offset
*
- * Purpose: This function is only for convenience. It computes the
+ * Purpose: This function is only for convenience. It computes the
* compound type size, offset of the member being considered
* and the alignment for the whole compound type.
*
- * Return: Success: Non-negative value.
+ * Return: Success: Non-negative value.
*
- * Failure: Negative value.
+ * Failure: Negative value.
*
- * Programmer: Raymond Lu
- * December 10, 2002
+ * Programmer: Raymond Lu
+ * December 10, 2002
*
* Modifications:
*
@@ -805,7 +811,7 @@ H5T_cmp_offset(size_t *comp_size, size_t *offset, size_t elem_size,
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5T_cmp_offset, FAIL);
+ FUNC_ENTER_NOAPI(H5T_cmp_offset, FAIL)
if(offset && comp_size) {
if(align>1 && *comp_size%align) {
@@ -823,6 +829,6 @@ H5T_cmp_offset(size_t *comp_size, size_t *offset, size_t elem_size,
*struct_align = align;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
diff --git a/src/H5Toffset.c b/src/H5Toffset.c
index a3965ad..99046cf 100644
--- a/src/H5Toffset.c
+++ b/src/H5Toffset.c
@@ -19,20 +19,20 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
-#include "H5private.h" /*generic functions */
-#include "H5Eprivate.h" /*error handling */
-#include "H5Iprivate.h" /*ID functions */
-#include "H5Tpkg.h" /*data-type functions */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_offset_interface
-#define PABLO_MASK H5Toffset_mask
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5T_offset_mask
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_offset_interface
-static herr_t H5T_init_offset_interface(void);
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#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);
/*--------------------------------------------------------------------------
@@ -51,9 +51,9 @@ DESCRIPTION
static herr_t
H5T_init_offset_interface(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_offset_interface);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_offset_interface)
- FUNC_LEAVE_NOAPI(H5T_init());
+ FUNC_LEAVE_NOAPI(H5T_init())
} /* H5T_init_offset_interface() */
@@ -97,23 +97,22 @@ H5Tget_offset(hid_t type_id)
H5T_t *dt = NULL;
int ret_value;
- FUNC_ENTER_API(H5Tget_offset, -1);
+ FUNC_ENTER_API(H5Tget_offset, -1)
H5TRACE1("Is","i",type_id);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type")
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
- if (H5T_COMPOUND==dt->shared->type || H5T_OPAQUE==dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for specified data type");
+ if (!H5T_IS_ATOMIC(dt->shared))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type")
/* Offset */
- assert(H5T_IS_ATOMIC(dt->shared));
ret_value = (int)dt->shared->u.atomic.offset;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -162,27 +161,27 @@ H5Tset_offset(hid_t type_id, size_t offset)
H5T_t *dt = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tset_offset, FAIL);
+ FUNC_ENTER_API(H5Tset_offset, FAIL)
H5TRACE2("e","iz",type_id,offset);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type")
if (H5T_STATE_TRANSIENT!=dt->shared->state)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only");
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only")
if (H5T_STRING == dt->shared->type && offset != 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset must be zero for this type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset must be zero for this 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");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined")
if (H5T_COMPOUND==dt->shared->type || H5T_REFERENCE==dt->shared->type || H5T_OPAQUE==dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for this datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for this datatype")
/* Do the real work */
if (H5T_set_offset(dt, offset)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set offset");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set offset")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -226,11 +225,11 @@ 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 */
- FUNC_ENTER_NOAPI(H5T_set_offset, FAIL);
+ FUNC_ENTER_NOAPI(H5T_set_offset, FAIL)
/* Check args */
assert(dt);
@@ -242,7 +241,7 @@ H5T_set_offset(H5T_t *dt, size_t offset)
if (dt->shared->parent) {
if (H5T_set_offset(dt->shared->parent, offset)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set offset for base type");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set offset for base type")
/* Adjust size of datatype appropriately */
if(dt->shared->type==H5T_ARRAY)
@@ -256,6 +255,6 @@ H5T_set_offset(H5T_t *dt, size_t offset)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
diff --git a/src/H5Topaque.c b/src/H5Topaque.c
index d2a9df6..0bfed4b 100644
--- a/src/H5Topaque.c
+++ b/src/H5Topaque.c
@@ -19,18 +19,18 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
-#include "H5private.h" /*generic functions */
-#include "H5Eprivate.h" /*error handling */
-#include "H5Iprivate.h" /*ID functions */
-#include "H5MMprivate.h" /*memory management */
-#include "H5Tpkg.h" /*data-type functions */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_opaque_interface
-#define PABLO_MASK H5Topaque_mask
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5T_opaque_mask
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_opaque_interface
-static herr_t H5T_init_opaque_interface(void);
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Tpkg.h" /* Datatypes */
/*--------------------------------------------------------------------------
@@ -49,9 +49,9 @@ DESCRIPTION
static herr_t
H5T_init_opaque_interface(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_opaque_interface);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_opaque_interface)
- FUNC_LEAVE_NOAPI(H5T_init());
+ FUNC_LEAVE_NOAPI(H5T_init())
} /* H5T_init_opaque_interface() */
@@ -75,27 +75,27 @@ H5Tset_tag(hid_t type_id, const char *tag)
H5T_t *dt=NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tset_tag, FAIL);
+ FUNC_ENTER_API(H5Tset_tag, FAIL)
H5TRACE2("e","is",type_id,tag);
/* Check args */
if (NULL == (dt = 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 data type")
if (H5T_STATE_TRANSIENT!=dt->shared->state)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only");
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only")
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
if (H5T_OPAQUE!=dt->shared->type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an opaque data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an opaque data type")
if (!tag)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no tag");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no tag")
/* Commit */
H5MM_xfree(dt->shared->u.opaque.tag);
dt->shared->u.opaque.tag = H5MM_strdup(tag);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -120,21 +120,21 @@ H5Tget_tag(hid_t type_id)
H5T_t *dt=NULL;
char *ret_value;
- FUNC_ENTER_API(H5Tget_tag, NULL);
+ FUNC_ENTER_API(H5Tget_tag, NULL)
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type")
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
if (H5T_OPAQUE != dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "operation not defined for data type class");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "operation not defined for data type class")
/* result */
if (NULL==(ret_value=H5MM_strdup(dt->shared->u.opaque.tag)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
diff --git a/src/H5Torder.c b/src/H5Torder.c
index 4bd1c9c..c43fc3c 100644
--- a/src/H5Torder.c
+++ b/src/H5Torder.c
@@ -19,17 +19,17 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
-#include "H5private.h" /*generic functions */
-#include "H5Eprivate.h" /*error handling */
-#include "H5Iprivate.h" /*ID functions */
-#include "H5Tpkg.h" /*data-type functions */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_order_interface
-#define PABLO_MASK H5Torder_mask
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5T_order_mask
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_order_interface
-static herr_t H5T_init_order_interface(void);
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Tpkg.h" /* Datatypes */
/*--------------------------------------------------------------------------
@@ -48,9 +48,9 @@ DESCRIPTION
static herr_t
H5T_init_order_interface(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_order_interface);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_order_interface)
- FUNC_LEAVE_NOAPI(H5T_init());
+ FUNC_LEAVE_NOAPI(H5T_init())
} /* H5T_init_order_interface() */
@@ -78,23 +78,22 @@ H5Tget_order(hid_t type_id)
H5T_t *dt = NULL;
H5T_order_t ret_value;
- FUNC_ENTER_API(H5Tget_order, H5T_ORDER_ERROR);
+ FUNC_ENTER_API(H5Tget_order, H5T_ORDER_ERROR)
H5TRACE1("To","i",type_id);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_ORDER_ERROR, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_ORDER_ERROR, "not a data type")
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
- if (H5T_COMPOUND==dt->shared->type || H5T_OPAQUE==dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_ORDER_ERROR, "operation not defined for specified data type");
+ if (!H5T_IS_ATOMIC(dt->shared))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "operation not defined for specified data type")
/* Order */
- assert(H5T_IS_ATOMIC(dt->shared));
ret_value = dt->shared->u.atomic.order;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -120,28 +119,27 @@ H5Tset_order(hid_t type_id, H5T_order_t order)
H5T_t *dt = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tset_order, FAIL);
+ FUNC_ENTER_API(H5Tset_order, FAIL)
H5TRACE2("e","iTo",type_id,order);
/* Check args */
if (NULL == (dt = 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 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)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal byte order");
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only")
+ 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");
+ 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_COMPOUND==dt->shared->type || H5T_OPAQUE==dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_ORDER_ERROR, "operation not defined for specified data type");
+ if (!H5T_IS_ATOMIC(dt->shared))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type")
/* Commit */
- assert(H5T_IS_ATOMIC(dt->shared));
dt->shared->u.atomic.order = order;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
diff --git a/src/H5Tpad.c b/src/H5Tpad.c
index 4c84c7e4..254831e 100644
--- a/src/H5Tpad.c
+++ b/src/H5Tpad.c
@@ -19,17 +19,17 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
-#include "H5private.h" /*generic functions */
-#include "H5Eprivate.h" /*error handling */
-#include "H5Iprivate.h" /*ID functions */
-#include "H5Tpkg.h" /*data-type functions */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_pad_interface
-#define PABLO_MASK H5Tpad_mask
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5T_pad_mask
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_pad_interface
-static herr_t H5T_init_pad_interface(void);
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Tpkg.h" /* Datatypes */
/*--------------------------------------------------------------------------
@@ -48,9 +48,9 @@ DESCRIPTION
static herr_t
H5T_init_pad_interface(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_pad_interface);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_pad_interface)
- FUNC_LEAVE_NOAPI(H5T_init());
+ FUNC_LEAVE_NOAPI(H5T_init())
} /* H5T_init_pad_interface() */
@@ -78,26 +78,25 @@ H5Tget_pad(hid_t type_id, H5T_pad_t *lsb/*out*/, H5T_pad_t *msb/*out*/)
H5T_t *dt = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tget_pad, FAIL);
+ FUNC_ENTER_API(H5Tget_pad, FAIL)
H5TRACE3("e","ixx",type_id,lsb,msb);
/* Check args */
if (NULL == (dt = 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 data type")
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
- if (H5T_COMPOUND==dt->shared->type || H5T_OPAQUE==dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for specified data type");
+ if (!H5T_IS_ATOMIC(dt->shared))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type")
/* Get values */
- assert(H5T_IS_ATOMIC(dt->shared));
if (lsb)
*lsb = dt->shared->u.atomic.lsb_pad;
if (msb)
*msb = dt->shared->u.atomic.msb_pad;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -123,29 +122,28 @@ H5Tset_pad(hid_t type_id, H5T_pad_t lsb, H5T_pad_t msb)
H5T_t *dt = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tset_pad, FAIL);
+ FUNC_ENTER_API(H5Tset_pad, FAIL)
H5TRACE3("e","iTpTp",type_id,lsb,msb);
/* Check args */
if (NULL == (dt = 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 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)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pad type");
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only")
+ 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");
+ 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_COMPOUND==dt->shared->type || H5T_OPAQUE==dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for specified data type");
+ if (!H5T_IS_ATOMIC(dt->shared))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type")
/* Commit */
- assert(H5T_IS_ATOMIC(dt->shared));
dt->shared->u.atomic.lsb_pad = lsb;
dt->shared->u.atomic.msb_pad = msb;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 58fabca..6daef4f 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -38,9 +38,10 @@
#include "H5Tprivate.h"
/* Other private headers needed by this file */
-#include "H5Dprivate.h" /* Datasets */
#include "H5Fprivate.h" /* Files */
-#include "H5HGprivate.h" /* Global heaps */
+
+/* Other public headers needed by this file */
+#include "H5Spublic.h" /* Dataspace functions */
/* Number of reserved IDs in ID group */
#define H5T_RESERVED_ATOMS 8
@@ -124,8 +125,8 @@ typedef enum H5T_sort_t {
/* A compound datatype */
typedef struct H5T_compnd_t {
- int nalloc; /*num entries allocated in MEMB array*/
- int nmembs; /*number of members defined in struct*/
+ unsigned nalloc; /*num entries allocated in MEMB array*/
+ unsigned nmembs; /*number of members defined in struct*/
H5T_sort_t sorted; /*how are members sorted? */
hbool_t packed; /*are members packed together? */
struct H5T_cmemb_t *memb; /*array of struct members */
@@ -133,17 +134,17 @@ typedef struct H5T_compnd_t {
/* An enumeration datatype */
typedef struct H5T_enum_t {
- int nalloc; /*num entries allocated */
- int nmembs; /*number of members defined in enum */
+ unsigned nalloc; /*num entries allocated */
+ unsigned nmembs; /*number of members defined in enum */
H5T_sort_t sorted; /*how are members sorted? */
uint8_t *value; /*array of values */
char **name; /*array of symbol names */
} 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);
@@ -242,6 +243,9 @@ typedef enum H5T_sdir_t {
/* The overflow handler */
H5_DLLVAR H5T_overflow_t H5T_overflow_g;
+/* The native endianess of the platform */
+H5_DLLVAR H5T_order_t H5T_native_order_g;
+
/*
* Alignment information for native types. A value of N indicates that the
* data must be aligned on an address ADDR such that 0 == ADDR mod N. When
@@ -320,22 +324,21 @@ H5_DLLVAR double H5T_NATIVE_DOUBLE_POS_INF_g;
H5_DLLVAR double H5T_NATIVE_DOUBLE_NEG_INF_g;
/* Common functions */
-H5_DLL herr_t H5T_init_interface(void);
H5_DLL H5T_t *H5T_create(H5T_class_t type, size_t size);
H5_DLL herr_t H5T_free(H5T_t *dt);
H5_DLL H5T_sign_t H5T_get_sign(H5T_t const *dt);
H5_DLL H5T_t *H5T_get_super(H5T_t *dt);
-H5_DLL char *H5T_get_member_name(H5T_t const *dt, int membno);
-H5_DLL herr_t H5T_get_member_value(const H5T_t *dt, int membno, void *value);
+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 */
@@ -882,9 +885,9 @@ H5_DLL H5T_t * H5T_array_create(H5T_t *base, int ndims,
const hsize_t dim[/* ndims */], const int perm[/* ndims */]);
/* Compound functions */
-H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, int membno);
-H5_DLL size_t H5T_get_member_offset(const H5T_t *dt, int membno);
-H5_DLL size_t H5T_get_member_size(H5T_t *dt, unsigned membno);
+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(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 33a71e0..9728172 100644
--- a/src/H5Tprecis.c
+++ b/src/H5Tprecis.c
@@ -19,20 +19,20 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
-#include "H5private.h" /*generic functions */
-#include "H5Eprivate.h" /*error handling */
-#include "H5Iprivate.h" /*ID functions */
-#include "H5Tpkg.h" /*data-type functions */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_precis_interface
-#define PABLO_MASK H5Tprecis_mask
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5T_precis_mask
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_precis_interface
-static herr_t H5T_init_precis_interface(void);
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#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);
/*--------------------------------------------------------------------------
@@ -51,16 +51,16 @@ DESCRIPTION
static herr_t
H5T_init_precis_interface(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_precis_interface);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_precis_interface)
- FUNC_LEAVE_NOAPI(H5T_init());
+ FUNC_LEAVE_NOAPI(H5T_init())
} /* H5T_init_precis_interface() */
/*-------------------------------------------------------------------------
* Function: H5Tget_precision
*
- * Purpose: Gets the precision of a data type. The precision is
+ * Purpose: Gets the precision of a datatype. The precision is
* the number of significant bits which, unless padding is
* present, is 8 times larger than the value returned by
* H5Tget_size().
@@ -75,7 +75,7 @@ H5T_init_precis_interface(void)
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works for derived data types.
+ * Also works for derived datatypes.
*
*-------------------------------------------------------------------------
*/
@@ -85,37 +85,36 @@ H5Tget_precision(hid_t type_id)
H5T_t *dt = NULL;
size_t ret_value;
- FUNC_ENTER_API(H5Tget_precision, 0);
+ FUNC_ENTER_API(H5Tget_precision, 0)
H5TRACE1("z","i",type_id);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype")
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
- if (H5T_COMPOUND==dt->shared->type || H5T_OPAQUE==dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for specified data type");
+ if (!H5T_IS_ATOMIC(dt->shared))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for specified datatype")
/* Precision */
- assert(H5T_IS_ATOMIC(dt->shared));
ret_value = dt->shared->u.atomic.prec;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
/*-------------------------------------------------------------------------
* Function: H5Tset_precision
*
- * Purpose: Sets the precision of a data type. The precision is
+ * Purpose: Sets the precision of a datatype. The precision is
* the number of significant bits which, unless padding is
* present, is 8 times larger than the value returned by
* H5Tget_size().
*
* If the precision is increased then the offset is decreased
* and then the size is increased to insure that significant
- * bits do not "hang over" the edge of the data type.
+ * bits do not "hang over" the edge of the datatype.
*
* The precision property of strings is read-only.
*
@@ -140,43 +139,43 @@ H5Tset_precision(hid_t type_id, size_t prec)
H5T_t *dt = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tset_precision, FAIL);
+ FUNC_ENTER_API(H5Tset_precision, FAIL)
H5TRACE2("e","iz",type_id,prec);
/* Check args */
if (NULL == (dt = 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 (H5T_STATE_TRANSIENT!=dt->shared->state)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only");
- if (prec <= 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "precision must be positive");
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only")
+ if (prec == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "precision must be positive")
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");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "operation not allowed after members are defined")
if (H5T_STRING==dt->shared->type)
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "precision for this type is read-only");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "precision for this type is read-only")
if (H5T_COMPOUND==dt->shared->type || H5T_OPAQUE==dt->shared->type)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for specified data type");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified datatype")
/* Do the work */
if (H5T_set_precision(dt, prec)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set precision");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
/*-------------------------------------------------------------------------
* Function: H5T_set_precision
*
- * Purpose: Sets the precision of a data type. The precision is
+ * Purpose: Sets the precision of a datatype. The precision is
* the number of significant bits which, unless padding is
* present, is 8 times larger than the value returned by
* H5Tget_size().
*
* If the precision is increased then the offset is decreased
* and then the size is increased to insure that significant
- * bits do not "hang over" the edge of the data type.
+ * bits do not "hang over" the edge of the datatype.
*
* The precision property of strings is read-only.
*
@@ -191,17 +190,17 @@ done:
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works for derived data types.
+ * Also works for derived datatypes.
*
*-------------------------------------------------------------------------
*/
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 */
- FUNC_ENTER_NOAPI(H5T_set_precision, FAIL);
+ FUNC_ENTER_NOAPI(H5T_set_precision, FAIL)
/* Check args */
assert(dt);
@@ -213,7 +212,7 @@ H5T_set_precision(H5T_t *dt, size_t prec)
if (dt->shared->parent) {
if (H5T_set_precision(dt->shared->parent, prec)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set precision for base type");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision for base type")
/* Adjust size of datatype appropriately */
if(dt->shared->type==H5T_ARRAY)
@@ -221,7 +220,7 @@ H5T_set_precision(H5T_t *dt, size_t prec)
else if(dt->shared->type!=H5T_VLEN)
dt->shared->size = dt->shared->parent->shared->size;
} else {
- if (H5T_IS_ATOMIC(dt->shared)) {
+ if (H5T_IS_ATOMIC(dt->shared)) {
/* Adjust the offset and size */
offset = dt->shared->u.atomic.offset;
size = dt->shared->size;
@@ -247,28 +246,25 @@ H5T_set_precision(H5T_t *dt, size_t prec)
* type.
*/
if (dt->shared->u.atomic.u.f.sign >= prec ||
- dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec ||
- dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec) {
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first");
- }
+ dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec ||
+ dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first")
break;
default:
- assert("not implemented yet" && 0);
- }
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class")
+ } /* end switch */ /*lint !e788 All appropriate cases are covered */
/* Commit */
dt->shared->size = size;
- if (H5T_IS_ATOMIC(dt->shared)) {
- dt->shared->u.atomic.offset = offset;
- dt->shared->u.atomic.prec = prec;
- }
- }
+ dt->shared->u.atomic.offset = offset;
+ dt->shared->u.atomic.prec = prec;
+ } /* end if */
else
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for specified datatype");
- }
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for specified datatype")
+ } /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 8b279e7..52b7d3b 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -81,11 +81,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_vlen_mark(H5T_t *dt, H5F_t *f, H5T_vlen_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 83c118b..0212fd8 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 {
@@ -199,13 +199,13 @@ typedef herr_t (*H5T_overflow_t)(hid_t src_id, hid_t dst_id,
void *src_buf, void *dst_buf);
-/* 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.
@@ -523,12 +523,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);
-H5_DLL char *H5Tget_member_name(hid_t type_id, int membno);
+H5_DLL char *H5Tget_member_name(hid_t type_id, unsigned membno);
H5_DLL int H5Tget_member_index(hid_t type_id, const char *name);
-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*/);
+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*/);
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 275f5c3..c79b60d 100644
--- a/src/H5Tstrpad.c
+++ b/src/H5Tstrpad.c
@@ -19,17 +19,17 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
-#include "H5private.h" /*generic functions */
-#include "H5Eprivate.h" /*error handling */
-#include "H5Iprivate.h" /*ID functions */
-#include "H5Tpkg.h" /*data-type functions */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_strpad_interface
-#define PABLO_MASK H5Tstrpad_mask
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5T_strpad_mask
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_strpad_interface
-static herr_t H5T_init_strpad_interface(void);
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Tpkg.h" /* Datatypes */
/*--------------------------------------------------------------------------
@@ -48,9 +48,9 @@ DESCRIPTION
static herr_t
H5T_init_strpad_interface(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_strpad_interface);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_strpad_interface)
- FUNC_LEAVE_NOAPI(H5T_init());
+ FUNC_LEAVE_NOAPI(H5T_init())
} /* H5T_init_strpad_interface() */
@@ -71,7 +71,7 @@ H5T_init_strpad_interface(void)
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works for derived data types.
+ * Also works for derived datatypes.
*
*-------------------------------------------------------------------------
*/
@@ -81,27 +81,25 @@ H5Tget_strpad(hid_t type_id)
H5T_t *dt = NULL;
H5T_str_t ret_value;
- FUNC_ENTER_API(H5Tget_strpad, H5T_STR_ERROR);
+ FUNC_ENTER_API(H5Tget_strpad, H5T_STR_ERROR)
H5TRACE1("Tz","i",type_id);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_STR_ERROR, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_STR_ERROR, "not a datatype")
while (dt->shared->parent && !H5T_IS_STRING(dt->shared))
dt = dt->shared->parent; /*defer to parent*/
if (!H5T_IS_STRING(dt->shared))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_STR_ERROR, "operation not defined for data type class");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_STR_ERROR, "operation not defined for datatype class")
/* result */
- if(H5T_STRING == dt->shared->type)
+ if(H5T_IS_FIXED_STRING(dt->shared))
ret_value = dt->shared->u.atomic.u.s.pad;
- else if(H5T_VLEN == dt->shared->type && H5T_VLEN_STRING == dt->shared->u.vlen.type)
- ret_value = dt->shared->u.vlen.pad;
else
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, H5T_STR_ERROR, "can't get strpad info");
+ ret_value = dt->shared->u.vlen.pad;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -130,7 +128,7 @@ done:
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works for derived data types.
+ * Also works for derived datatypes.
*
*-------------------------------------------------------------------------
*/
@@ -140,30 +138,28 @@ H5Tset_strpad(hid_t type_id, H5T_str_t strpad)
H5T_t *dt = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tset_strpad, FAIL);
+ FUNC_ENTER_API(H5Tset_strpad, FAIL)
H5TRACE2("e","iTz",type_id,strpad);
/* Check args */
if (NULL == (dt = 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 (H5T_STATE_TRANSIENT!=dt->shared->state)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only");
- if (strpad < 0 || strpad >= H5T_NSTR)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal string pad type");
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only")
+ 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*/
if (!H5T_IS_STRING(dt->shared))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for data type class");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class")
/* Commit */
- if(H5T_STRING == dt->shared->type)
+ if(H5T_IS_FIXED_STRING(dt->shared))
dt->shared->u.atomic.u.s.pad = strpad;
- else if(H5T_VLEN == dt->shared->type && H5T_VLEN_STRING == dt->shared->u.vlen.type)
- dt->shared->u.vlen.pad = strpad;
else
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, H5T_STR_ERROR, "can't set strpad info");
+ dt->shared->u.vlen.pad = strpad;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 643f36d..b20b0b3 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -19,42 +19,41 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5T_init_vlen_interface
+
/* Pablo information */
/* (Put before include files to avoid problems with inline functions) */
-#define PABLO_MASK H5Tvlen_mask
+#define PABLO_MASK H5T_vlen_mask
#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Errors */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5HGprivate.h" /* Global Heaps */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory Allocation */
-#include "H5Pprivate.h" /* Property Lists */
-#include "H5Tpkg.h" /* Datatypes */
-
-/* Interface initialization */
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT H5T_init_vlen_interface
-static herr_t H5T_init_vlen_interface(void);
+#include "H5Dprivate.h" /* Dataset functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5HGprivate.h" /* Global Heaps */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Tpkg.h" /* Datatypes */
/* Local functions */
-static htri_t H5T_vlen_set_loc(H5T_t *dt, H5F_t *f, H5T_vlen_loc_t loc);
+static htri_t H5T_vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_vlen_loc_t loc);
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);
@@ -69,7 +68,7 @@ static H5T_vlen_alloc_info_t H5T_vlen_def_vl_alloc_info ={
H5D_XFER_VLEN_FREE_INFO_DEF
};
-/* Declare extern the free list for H5T_t's */
+/* Declare extern the free lists for H5T_t's and H5T_shared_t's */
H5FL_EXTERN(H5T_t);
H5FL_EXTERN(H5T_shared_t);
@@ -219,7 +218,7 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5T_vlen_set_loc(H5T_t *dt, H5F_t *f, H5T_vlen_loc_t loc)
+H5T_vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_vlen_loc_t loc)
{
htri_t ret_value = 0; /* Indicate that success, but no location change */
@@ -299,7 +298,7 @@ H5T_vlen_set_loc(H5T_t *dt, H5F_t *f, H5T_vlen_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:
@@ -322,9 +321,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)
@@ -379,7 +378,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 */
@@ -534,9 +533,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)
@@ -591,13 +590,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() */
@@ -728,9 +727,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)
@@ -758,6 +757,7 @@ H5T_vlen_disk_getlen(void *_vl)
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static void *
H5T_vlen_disk_getptr(void UNUSED *vl)
{
@@ -785,7 +785,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 */
@@ -825,7 +825,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)
@@ -835,8 +834,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));
@@ -872,6 +871,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)
{
@@ -890,11 +890,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));
@@ -955,11 +954,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));
@@ -1035,7 +1033,7 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi
case H5T_COMPOUND:
/* Check each field and recurse on VL, compound, enum or array ones */
- for (i=0; i<(unsigned)dt->shared->u.compnd.nmembs; i++) {
+ for (i=0; i<dt->shared->u.compnd.nmembs; i++) {
/* Recurse if it's VL, compound, enum or array */
if(H5T_IS_COMPLEX(dt->shared->u.compnd.memb[i].type->shared->type)) {
void *off; /* offset of field */
@@ -1087,7 +1085,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)
@@ -1103,8 +1101,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
@@ -1120,7 +1118,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;
@@ -1231,8 +1229,8 @@ H5T_vlen_mark(H5T_t *dt, H5F_t *f, H5T_vlen_loc_t loc)
{
htri_t vlen_changed; /* Whether H5T_vlen_mark changed the type (even if the size didn't change) */
htri_t ret_value = 0; /* Indicate that success, but no location change */
- int i; /* Local index variable */
- int accum_change=0; /* Amount of change in the offset of the fields */
+ unsigned i; /* Local index variable */
+ int accum_change=0; /* Amount of change in the offset of the fields */
size_t old_size; /* Previous size of a field */
FUNC_ENTER_NOAPI(H5T_vlen_mark, FAIL);
diff --git a/src/H5V.c b/src/H5V.c
index 4163a6f..b2720f5 100644
--- a/src/H5V.c
+++ b/src/H5V.c
@@ -26,9 +26,22 @@
#include "H5Oprivate.h"
#include "H5Vprivate.h"
+/* Local macros */
#define H5V_HYPER_NDIMS H5O_LAYOUT_NDIMS
-static int interface_initialize_g = 0;
-#define INTERFACE_INIT NULL
+
+/* Local prototypes */
+static void
+H5V_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
+ 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, 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 ssize_t *dst_stride, void *_dst,
+ unsigned src_n, const hsize_t *src_size, const ssize_t *src_stride, const void *_src);
+#endif /* LATER */
/*-------------------------------------------------------------------------
@@ -42,7 +55,7 @@ static int interface_initialize_g = 0;
* All arguments are passed by reference and their values may be
* modified by this function.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: None
*
* Programmer: Robb Matzke
* Saturday, October 11, 1997
@@ -51,13 +64,11 @@ static int interface_initialize_g = 0;
*
*-------------------------------------------------------------------------
*/
-herr_t
+static void
H5V_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
- hsize_t *size, hssize_t *stride1)
+ const hsize_t *size, hsize_t *stride1)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5V_stride_optimize1, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_stride_optimize1);
/*
* This has to be true because if we optimize the dimensionality down to
@@ -71,13 +82,11 @@ 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) {
+ if (--*np)
stride1[*np-1] += size[*np] * stride1[*np];
- }
}
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI_VOID
}
@@ -104,13 +113,11 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+static void
H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
- hsize_t *size, hssize_t *stride1, hssize_t *stride2)
+ const hsize_t *size, hsize_t *stride1, hsize_t *stride2)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5V_stride_optimize2, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_stride_optimize2)
/*
* This has to be true because if we optimize the dimensionality down to
@@ -126,23 +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 */
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 */
@@ -150,22 +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 */
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 */
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 */
@@ -174,29 +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 */
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 */
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 */
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 */
@@ -207,8 +204,8 @@ 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) {
stride1[*np-1] += size[*np] * stride1[*np];
@@ -218,8 +215,7 @@ H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
break;
} /* end switch */
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI_VOID
}
@@ -257,16 +253,15 @@ done:
*/
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 */
- FUNC_ENTER_NOAPI(H5V_hyper_stride, (HDabort(), 0));
+ FUNC_ENTER_NOAPI_NOFUNC(H5V_hyper_stride)
assert(n <= H5V_HYPER_NDIMS);
assert(size);
@@ -274,60 +269,54 @@ H5V_hyper_stride(unsigned n, const hsize_t *size,
assert(stride);
/* init */
+ assert(n>0);
stride[n-1] = 1;
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 ? 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 ? offset[1] : 0);
+ 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 ? offset[0] : 0);
+ 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 ? offset[2] : 0);
+ 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 ? offset[1] : 0);
+ 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 ? offset[0] : 0);
+ skip += acc * (offset ? (hsize_t)offset[0] : 0);
break;
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 ? offset[i] : 0);
+ skip += acc * (offset ? (hsize_t)offset[i] : 0);
}
break;
} /* end switch */
@@ -335,8 +324,7 @@ H5V_hyper_stride(unsigned n, const hsize_t *size,
/* Set return value */
ret_value=skip;
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -364,32 +352,32 @@ done:
*-------------------------------------------------------------------------
*/
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);
+ 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)) {
- HGOTO_DONE(FALSE);
- }
- if ((size1 ? size1[i] : 0) != (size2 ? size2[i] : 0)) {
- HGOTO_DONE(FALSE);
- }
- if (0 == (nelmts1 *= (size1 ? size1[i] : 0))) HGOTO_DONE(FALSE);
- if (0 == (nelmts2 *= (size2 ? size2[i] : 0))) HGOTO_DONE(FALSE);
+ if ((offset1 ? offset1[i] : 0) != (offset2 ? offset2[i] : 0))
+ HGOTO_DONE(FALSE)
+ if ((size1 ? size1[i] : 0) != (size2 ? size2[i] : 0))
+ HGOTO_DONE(FALSE)
+ if (0 == (nelmts1 *= (size1 ? size1[i] : 0)))
+ HGOTO_DONE(FALSE)
+ if (0 == (nelmts2 *= (size2 ? size2[i] : 0)))
+ HGOTO_DONE(FALSE)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -413,35 +401,32 @@ 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 */
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_hyper_disjointp);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_hyper_disjointp)
- if (!n || !size1 || !size2) HGOTO_DONE(TRUE);
+ 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);
+ 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)))) {
- HGOTO_DONE(TRUE);
- }
+ ((offset2?offset2[u]:0) + size2[u] <= (offset1?offset1[u]:0))))
+ HGOTO_DONE(TRUE)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -468,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 */
@@ -481,7 +466,7 @@ H5V_hyper_fill(unsigned n, const hsize_t *_size,
unsigned u;
#endif
- FUNC_ENTER_NOAPI(H5V_hyper_fill, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5V_hyper_fill)
/* check args */
assert(n > 0 && n <= H5V_HYPER_NDIMS);
@@ -506,8 +491,7 @@ H5V_hyper_fill(unsigned n, const hsize_t *_size,
ret_value = H5V_stride_fill(n, elmt_size, size, dst_stride, dst+dst_start,
fill_value);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -549,28 +533,26 @@ 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;
#endif
- FUNC_ENTER_NOAPI(H5V_hyper_copy, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5V_hyper_copy)
/* check args */
assert(n > 0 && n <= H5V_HYPER_NDIMS);
@@ -602,6 +584,7 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
int ii; /*counter */
/* init */
+ assert(n>0);
dst_stride[n-1] = 1;
src_stride[n-1] = 1;
dst_start = dst_offset ? dst_offset[n-1] : 0;
@@ -610,12 +593,10 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
/* 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 ? dst_offset[0] : 0);
@@ -623,23 +604,19 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
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 ? dst_offset[1] : 0);
src_start += src_acc * (src_offset ? 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*/
+ 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 ? dst_offset[0] : 0);
@@ -647,34 +624,28 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
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 ? dst_offset[2] : 0);
src_start += src_acc * (src_offset ? 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*/
+ 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 ? dst_offset[1] : 0);
src_start += src_acc * (src_offset ? 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*/
+ 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 ? dst_offset[0] : 0);
@@ -684,12 +655,10 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
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 ? dst_offset[ii] : 0);
@@ -707,8 +676,7 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
ret_value = H5V_stride_copy(n, elmt_size, size,
dst_stride, dst+dst_start, src_stride, src+src_start);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -729,7 +697,7 @@ done:
*/
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 */
@@ -737,16 +705,16 @@ H5V_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size,
hsize_t i; /*counter */
int j; /*counter */
hbool_t carry; /*subtraction carray value */
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5V_stride_fill, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5V_stride_fill)
assert (elmt_size < SIZET_MAX);
H5V_vector_cpy(n, idx, size);
nelmts = H5V_vector_reduce_product(n, size);
for (i=0; i<nelmts; i++) {
/* Copy an element */
- HDmemset(dst, (signed)fill_value, (size_t)elmt_size);
+ H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
+ HDmemset(dst, (int)fill_value, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
/* Decrement indices and advance pointer */
for (j=(int)(n-1), carry=TRUE; j>=0 && carry; --j) {
@@ -754,13 +722,14 @@ H5V_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size,
if (--idx[j])
carry = FALSE;
- else
+ else {
+ assert(size);
idx[j] = size[j];
+ } /* end else */
}
}
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED)
}
@@ -787,6 +756,74 @@ done:
*/
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)
{
@@ -797,9 +834,8 @@ H5V_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size,
hsize_t i; /*counter */
int j; /*counters */
hbool_t carry; /*carray for subtraction*/
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5V_stride_copy, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5V_stride_copy_s)
assert (elmt_size<SIZET_MAX);
if (n) {
@@ -809,7 +845,7 @@ H5V_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size,
/* Copy an element */
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy(dst, src, (size_t)elmt_size);
+ 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) {
@@ -818,18 +854,21 @@ H5V_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size,
if (--idx[j])
carry = FALSE;
- else
+ else {
+ assert(size);
idx[j] = size[j];
+ }
}
}
} else {
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy (dst, src, (size_t)elmt_size);
+ HDmemcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
}
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED)
}
+
+#ifdef LATER
/*-------------------------------------------------------------------------
* Function: H5V_stride_copy2
@@ -839,7 +878,7 @@ done:
* we copy exactly NELMTS elements each of size ELMT_SIZE. The
* size counters wrap if NELMTS is more than a size counter.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: None
*
* Programmer: Robb Matzke
* Saturday, October 11, 1997
@@ -848,31 +887,32 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+static void
H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
/* destination */
- int dst_n, const hsize_t *dst_size,
- const hssize_t *dst_stride,
+ unsigned dst_n, const hsize_t *dst_size,
+ const hsize_t *dst_stride,
void *_dst,
/* source */
- int src_n, const hsize_t *src_size,
- const hssize_t *src_stride,
+ unsigned src_n, const hsize_t *src_size,
+ const hsize_t *src_stride,
const void *_src)
{
uint8_t *dst = (uint8_t *) _dst;
const uint8_t *src = (const uint8_t *) _src;
hsize_t dst_idx[H5V_HYPER_NDIMS];
hsize_t src_idx[H5V_HYPER_NDIMS];
- hsize_t i;
- int j;
+ hsize_t i; /* Local index variable */
+ int j; /* Local index variable */
hbool_t carry;
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5V_stride_copy2, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_stride_copy2)
assert (elmt_size < SIZET_MAX);
+ assert(dst_n>0);
+ assert(src_n>0);
H5V_vector_cpy(dst_n, dst_idx, dst_size);
H5V_vector_cpy(src_n, src_idx, src_size);
@@ -880,28 +920,34 @@ H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
for (i=0; i<nelmts; i++) {
/* Copy an element */
- HDmemcpy(dst, src, (size_t)elmt_size);
+ 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=dst_n-1, carry=TRUE; j>=0 && carry; --j) {
+ for (j=(int)(dst_n-1), carry=TRUE; j>=0 && carry; --j) {
dst += dst_stride[j];
if (--dst_idx[j])
carry = FALSE;
- else
+ else {
+ assert(dst_size);
dst_idx[j] = dst_size[j];
+ } /* end else */
}
- for (j=src_n-1, carry=TRUE; j>=0 && carry; --j) {
+ for (j=(int)(src_n-1), carry=TRUE; j>=0 && carry; --j) {
src += src_stride[j];
if (--src_idx[j])
carry = FALSE;
- else
+ else {
+ assert(src_size);
src_idx[j] = src_size[j];
+ } /* end else */
}
}
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI_VOID
}
+#endif /* LATER */
+
/*-------------------------------------------------------------------------
* Function: H5V_array_fill
@@ -926,9 +972,8 @@ H5V_array_fill(void *_dst, const void *src, size_t size, size_t count)
size_t copy_items; /* number of items currently copying*/
size_t items_left; /* number of items left to copy */
uint8_t *dst=(uint8_t*)_dst;/* alias for pointer arithmetic */
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5V_array_fill, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5V_array_fill)
assert (dst);
assert (src);
@@ -956,8 +1001,7 @@ H5V_array_fill(void *_dst, const void *src, size_t size, size_t count)
if (items_left > 0) /* if there are any items left to copy */
HDmemcpy(dst, _dst, items_left * size);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5V_array_fill() */
@@ -983,9 +1027,8 @@ H5V_array_down(unsigned n, const hsize_t *total_size, hsize_t *down)
{
hsize_t acc; /*accumulator */
int i; /*counter */
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5V_array_down, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5V_array_down)
assert(n <= H5V_HYPER_NDIMS);
assert(total_size);
@@ -993,13 +1036,12 @@ H5V_array_down(unsigned n, const hsize_t *total_size, hsize_t *down)
/* Build the sizes of each dimension in the array */
/* (From fastest to slowest) */
- for(i=n-1,acc=1; i>=0; i--) {
+ for(i=(int)(n-1),acc=1; i>=0; i--) {
down[i]=acc;
acc *= total_size[i];
} /* end for */
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5V_array_down() */
@@ -1027,27 +1069,22 @@ done:
*-------------------------------------------------------------------------
*/
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 */
- FUNC_ENTER_NOAPI(H5V_array_offset_pre, (HDabort(), 0));
+ FUNC_ENTER_NOAPI_NOFUNC(H5V_array_offset_pre)
assert(n <= H5V_HYPER_NDIMS);
assert(acc);
assert(offset);
/* Compute offset in array */
- for (i=(int)(n-1), skip=0; i>=0; --i)
- skip += acc[i] * offset[i];
-
- /* Set return value */
- ret_value=skip;
+ for (i=(int)(n-1), ret_value=0; i>=0; --i)
+ ret_value += acc[i] * offset[i];
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5V_array_offset_pre() */
@@ -1072,12 +1109,12 @@ done:
*-------------------------------------------------------------------------
*/
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 */
- FUNC_ENTER_NOAPI(H5V_array_offset, (HDabort(), 0));
+ FUNC_ENTER_NOAPI(H5V_array_offset, (HDabort(), 0)) /*lint !e527 Don't worry about unreachable statement */
assert(n <= H5V_HYPER_NDIMS);
assert(total_size);
@@ -1085,13 +1122,13 @@ H5V_array_offset(unsigned n, const hsize_t *total_size, const hssize_t *offset)
/* Build the sizes of each dimension in the array */
if(H5V_array_down(n,total_size,acc_arr)<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, UFAIL, "can't compute down sizes");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, UFAIL, "can't compute down sizes")
/* Set return value */
ret_value=H5V_array_offset_pre(n,acc_arr,offset);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5V_array_offset() */
@@ -1116,15 +1153,14 @@ 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 */
unsigned u; /* Local index variable */
int i; /* Local index variable */
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5V_array_calc, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5V_array_calc)
/* Sanity check */
assert(n <= H5V_HYPER_NDIMS);
@@ -1133,7 +1169,7 @@ H5V_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hssize_t *
/* Build the sizes of each dimension in the array */
/* (From fastest to slowest) */
- for(i=n-1,acc=1; i>=0; i--) {
+ for(i=(int)(n-1),acc=1; i>=0; i--) {
idx[i]=acc;
acc *= total_size[i];
} /* end for */
@@ -1144,8 +1180,7 @@ H5V_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hssize_t *
offset %= idx[u];
} /* end for */
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5V_array_calc() */
@@ -1192,14 +1227,13 @@ done:
*-------------------------------------------------------------------------
*/
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 */
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5V_chunk_index, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5V_chunk_index)
/* Sanity check */
assert(ndims <= H5V_HYPER_NDIMS);
@@ -1208,16 +1242,13 @@ 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);
+ *chunk_idx=H5V_array_offset_pre(ndims,down_nchunks,scaled_coord); /*lint !e772 scaled_coord will always be initialized */
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5V_chunk_index() */
@@ -1251,11 +1282,12 @@ 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(H5V_memcpyvv, FAIL);
+ FUNC_ENTER_NOAPI_NOFUNC(H5V_memcpyvv)
/* Sanity check */
assert(_dst);
@@ -1299,14 +1331,16 @@ H5V_memcpyvv(void *_dst,
u++;
/* Increment number of bytes copied */
- ret_value+=size;
+ total_size+=size;
} /* end for */
/* Update current sequence vectors */
*dst_curr_seq=u;
*src_curr_seq=v;
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ /* 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 71d9489..52f9d6b 100644
--- a/src/H5Vprivate.h
+++ b/src/H5Vprivate.h
@@ -47,51 +47,44 @@
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_stride_copy2(hsize_t nelmts, hsize_t elmt_size, int dst_n,
- const hsize_t *dst_size,
- const hssize_t *dst_stride, void *_dst,
- int src_n, const hsize_t *src_size,
- const hssize_t *src_stride, const void *_src);
-H5_DLL herr_t H5V_stride_optimize1(unsigned *np, hsize_t *elmt_size,
- hsize_t *size, hssize_t *stride1);
-H5_DLL herr_t H5V_stride_optimize2(unsigned *np, hsize_t *elmt_size,
- hsize_t *size, hssize_t *stride1,
- hssize_t *stride2);
H5_DLL herr_t H5V_array_fill(void *_dst, const void *src, size_t size,
size_t count);
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[],
@@ -124,13 +117,13 @@ H5V_vector_reduce_product(unsigned n, const hsize_t *v)
hsize_t ret_value = 1;
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_vector_reduce_product);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_vector_reduce_product)
- if (n && !v) HGOTO_DONE(0);
+ if (n && !v) HGOTO_DONE(0)
while (n--) ret_value *= *v++;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
/*-------------------------------------------------------------------------
@@ -156,16 +149,16 @@ H5V_vector_zerop_u(int n, const hsize_t *v)
htri_t ret_value=TRUE; /* Return value */
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_vector_zerop_u);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_vector_zerop_u)
if (!v)
- HGOTO_DONE(TRUE);
+ HGOTO_DONE(TRUE)
while (n--)
if (*v++)
- HGOTO_DONE(FALSE);
+ HGOTO_DONE(FALSE)
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
/*-------------------------------------------------------------------------
@@ -191,16 +184,16 @@ H5V_vector_zerop_s(int n, const hssize_t *v)
htri_t ret_value=TRUE; /* Return value */
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_vector_zerop_s);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_vector_zerop_s)
if (!v)
- HGOTO_DONE(TRUE);
+ HGOTO_DONE(TRUE)
while (n--)
if (*v++)
- HGOTO_DONE(FALSE);
+ HGOTO_DONE(FALSE)
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
/*-------------------------------------------------------------------------
@@ -223,14 +216,14 @@ 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 */
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_vector_cmp_u);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_vector_cmp_u)
- if (v1 == v2) HGOTO_DONE(0);
+ if (v1 == v2) HGOTO_DONE(0)
if (v1 == NULL) HGOTO_DONE(-1)
if (v2 == NULL) HGOTO_DONE(1)
while (n--) {
@@ -241,7 +234,7 @@ H5V_vector_cmp_u (int n, const hsize_t *v1, const hsize_t *v2)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -270,9 +263,9 @@ H5V_vector_cmp_s (unsigned n, const hssize_t *v1, const hssize_t *v2)
int ret_value=0; /* Return value */
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_vector_cmp_s);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_vector_cmp_s)
- if (v1 == v2) HGOTO_DONE(0);
+ if (v1 == v2) HGOTO_DONE(0)
if (v1 == NULL) HGOTO_DONE(-1)
if (v2 == NULL) HGOTO_DONE(1)
while (n--) {
@@ -283,7 +276,7 @@ H5V_vector_cmp_s (unsigned n, const hssize_t *v1, const hssize_t *v2)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
diff --git a/src/H5Z.c b/src/H5Z.c
index 700cfc6..87fe166 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -14,6 +14,9 @@
#define H5Z_PACKAGE /*suppress error about including H5Zpkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5Z_init_interface
+
/* Pablo mask */
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5Z_mask
@@ -28,11 +31,6 @@
#include "H5Sprivate.h" /* Dataspace functions */
#include "H5Zpkg.h" /* Data filters */
-/* Interface initialization */
-#define INTERFACE_INIT H5Z_init_interface
-static int interface_initialize_g = 0;
-static herr_t H5Z_init_interface (void);
-
/* Local typedefs */
#ifdef H5Z_DEBUG
typedef struct H5Z_stats_t {
@@ -130,7 +128,7 @@ H5Z_term_interface (void)
char comment[16], bandwidth[32];
#endif
- if (interface_initialize_g) {
+ if (H5_interface_initialize_g) {
#ifdef H5Z_DEBUG
if (H5DEBUG(Z)) {
for (i=0; i<H5Z_table_used_g; i++) {
@@ -185,7 +183,7 @@ H5Z_term_interface (void)
H5Z_stat_table_g = H5MM_xfree(H5Z_stat_table_g);
#endif /* H5Z_DEBUG */
H5Z_table_used_g = H5Z_table_alloc_g = 0;
- interface_initialize_g = 0;
+ H5_interface_initialize_g = 0;
}
return 0;
}
@@ -660,7 +658,7 @@ herr_t
H5Z_can_apply (hid_t dcpl_id, hid_t type_id)
{
herr_t ret_value=SUCCEED; /* Return value */
-
+
FUNC_ENTER_NOAPI(H5Z_can_apply,FAIL)
assert (H5I_GENPROP_LST==H5I_get_type(dcpl_id));
@@ -668,7 +666,7 @@ H5Z_can_apply (hid_t dcpl_id, hid_t type_id)
/* Make "can apply" callbacks for filters in pipeline */
if(H5Z_prelude_callback(dcpl_id, type_id, H5Z_PRELUDE_CAN_APPLY)<0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate")
+ HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c
index e83cd86..3202221 100644
--- a/src/H5Zdeflate.c
+++ b/src/H5Zdeflate.c
@@ -19,6 +19,10 @@
#define H5Z_PACKAGE /*suppress error about including H5Zpkg */
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5Z_deflate_mask
+
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5MMprivate.h" /* Memory management */
@@ -30,11 +34,6 @@
# include "zlib.h"
#endif
-/* Interface initialization */
-#define PABLO_MASK H5Z_deflate_mask
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/* Local function prototypes */
static size_t H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf);
@@ -76,11 +75,11 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
int status; /* Status from zlib operation */
size_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5Z_filter_deflate, 0);
+ FUNC_ENTER_NOAPI(H5Z_filter_deflate, 0)
/* Check arguments */
if (cd_nelmts!=1 || cd_values[0]>9)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid deflate aggression level");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid deflate aggression level")
if (flags & H5Z_FLAG_REVERSE) {
/* Input; uncompress */
@@ -89,7 +88,7 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
/* Allocate space for the compressed buffer */
if (NULL==(outbuf = H5MM_malloc(nalloc)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for deflate uncompression");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for deflate uncompression")
/* Set the uncompression parameters */
HDmemset(&z_strm, 0, sizeof(z_strm));
@@ -100,10 +99,10 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
/* Initialize the uncompression routines */
if (Z_OK!=inflateInit(&z_strm))
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflateInit() failed");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflateInit() failed")
/* Loop to uncompress the buffer */
- while (1) {
+ do {
/* Uncompress some data */
status = inflate(&z_strm, Z_SYNC_FLUSH);
@@ -113,24 +112,25 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
/* Check for error */
if (Z_OK!=status) {
- inflateEnd(&z_strm);
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflate() failed");
+ (void)inflateEnd(&z_strm);
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflate() failed")
}
-
- /* If we're not done and just ran out of buffer space, get more */
- if (Z_OK==status && 0==z_strm.avail_out) {
- /* Allocate a buffer twice as big */
- nalloc *= 2;
- if (NULL==(outbuf = H5MM_realloc(outbuf, nalloc))) {
- inflateEnd(&z_strm);
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for deflate uncompression");
- }
-
- /* Update pointers to buffer for next set of uncompressed data */
- z_strm.next_out = (unsigned char*)outbuf + z_strm.total_out;
- z_strm.avail_out = (uInt)(nalloc - z_strm.total_out);
- }
- }
+ else {
+ /* If we're not done and just ran out of buffer space, get more */
+ if (0==z_strm.avail_out) {
+ /* Allocate a buffer twice as big */
+ nalloc *= 2;
+ if (NULL==(outbuf = H5MM_realloc(outbuf, nalloc))) {
+ (void)inflateEnd(&z_strm);
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for deflate uncompression")
+ }
+
+ /* Update pointers to buffer for next set of uncompressed data */
+ z_strm.next_out = (unsigned char*)outbuf + z_strm.total_out;
+ z_strm.avail_out = (uInt)(nalloc - z_strm.total_out);
+ }
+ } /* end else */
+ } while(status==Z_OK);
/* Free the input buffer */
H5MM_xfree(*buf);
@@ -142,7 +142,7 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
ret_value = z_strm.total_out;
/* Finish uncompressing the stream */
- inflateEnd(&z_strm);
+ (void)inflateEnd(&z_strm);
}
else {
/*
@@ -157,23 +157,22 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
int aggression; /* Compression aggression setting */
/* Set the compression aggression level */
- aggression = cd_values[0];
+ H5_ASSIGN_OVERFLOW(aggression,cd_values[0],unsigned,int);
/* Allocate output (compressed) buffer */
if (NULL==(z_dst=outbuf=H5MM_malloc(z_dst_nbytes)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate deflate destination buffer");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate deflate destination buffer")
/* Perform compression from the source to the destination buffer */
status = compress2 (z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression);
/* Check for various zlib errors */
- if (Z_BUF_ERROR==status) {
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow");
- } else if (Z_MEM_ERROR==status) {
- HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "deflate memory error");
- } else if (Z_OK!=status) {
- HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "other deflate error");
- }
+ if (Z_BUF_ERROR==status)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow")
+ else if (Z_MEM_ERROR==status)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "deflate memory error")
+ else if (Z_OK!=status)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "other deflate error")
/* Successfully uncompressed the buffer */
else {
/* Free the input buffer */
@@ -190,7 +189,7 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
done:
if(outbuf)
H5MM_xfree(outbuf);
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
#endif /* H5_HAVE_FILTER_DEFLATE */
diff --git a/src/H5Zfletcher32.c b/src/H5Zfletcher32.c
index 48e7aea..dfd69cf 100644
--- a/src/H5Zfletcher32.c
+++ b/src/H5Zfletcher32.c
@@ -19,6 +19,10 @@
#define H5Z_PACKAGE /*suppress error about including H5Zpkg */
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5Z_fletcher32_mask
+
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
@@ -27,11 +31,6 @@
#ifdef H5_HAVE_FILTER_FLETCHER32
-/* Interface initialization */
-#define PABLO_MASK H5Z_fletcher32_mask
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/* Local function prototypes */
static size_t H5Z_filter_fletcher32 (unsigned flags, size_t cd_nelmts,
const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf);
@@ -130,6 +129,7 @@ H5Z_filter_fletcher32_compute(void *_src, size_t len)
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static size_t
H5Z_filter_fletcher32 (unsigned flags, size_t UNUSED cd_nelmts, const unsigned UNUSED cd_values[],
size_t nbytes, size_t *buf_size, void **buf)
@@ -139,7 +139,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t UNUSED cd_nelmts, const unsigned U
uint32_t fletcher; /* Checksum value */
size_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5Z_filter_fletcher32, 0);
+ FUNC_ENTER_NOAPI(H5Z_filter_fletcher32, 0)
assert(sizeof(uint32_t)>=4);
@@ -157,11 +157,11 @@ H5Z_filter_fletcher32 (unsigned flags, size_t UNUSED cd_nelmts, const unsigned U
UINT32DECODE(tmp_src, stored_fletcher);
/* Compute checksum (can't fail) */
- fletcher = H5Z_filter_fletcher32_compute((unsigned short*)src,src_nbytes);
+ fletcher = H5Z_filter_fletcher32_compute(src,src_nbytes);
/* Verify computed checksum matches stored checksum */
if(stored_fletcher != fletcher)
- HGOTO_ERROR(H5E_STORAGE, H5E_READERROR, 0, "data error detected by Fletcher32 checksum");
+ HGOTO_ERROR(H5E_STORAGE, H5E_READERROR, 0, "data error detected by Fletcher32 checksum")
}
/* Set return values */
@@ -171,10 +171,10 @@ H5Z_filter_fletcher32 (unsigned flags, size_t UNUSED cd_nelmts, const unsigned U
unsigned char *dst; /* Temporary pointer to destination buffer */
/* Compute checksum (can't fail) */
- fletcher = H5Z_filter_fletcher32_compute((unsigned short*)src,nbytes);
+ fletcher = H5Z_filter_fletcher32_compute(src,nbytes);
if (NULL==(dst=outbuf=H5MM_malloc(nbytes+FLETCHER_LEN)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate Fletcher32 checksum destination buffer");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate Fletcher32 checksum destination buffer")
/* Copy raw data */
HDmemcpy((void*)dst, (void*)(*buf), nbytes);
@@ -196,7 +196,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t UNUSED cd_nelmts, const unsigned U
done:
if(outbuf)
H5MM_xfree(outbuf);
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
#endif /* H5_HAVE_FILTER_FLETCHER32 */
diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h
index e4db1b0..f8189b2 100644
--- a/src/H5Zpublic.h
+++ b/src/H5Zpublic.h
@@ -81,7 +81,7 @@ typedef enum H5Z_cb_return_t {
/* Filter callback function definition */
typedef H5Z_cb_return_t (*H5Z_filter_func_t)(H5Z_filter_t filter, void* buf,
size_t buf_size, void* op_data);
-
+
/* Structure for filter callback property */
typedef struct H5Z_cb_t {
H5Z_filter_func_t func;
diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c
index 60dad91..36b6f23 100644
--- a/src/H5Zshuffle.c
+++ b/src/H5Zshuffle.c
@@ -14,6 +14,10 @@
#define H5Z_PACKAGE /*suppress error about including H5Zpkg */
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5Z_shuffle_mask
+
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5MMprivate.h" /* Memory management */
@@ -23,11 +27,6 @@
#ifdef H5_HAVE_FILTER_SHUFFLE
-/* Interface initialization */
-#define PABLO_MASK H5Z_shuffle_mask
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/* Local function prototypes */
static herr_t H5Z_set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static size_t H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts,
@@ -64,6 +63,7 @@ const H5Z_class_t H5Z_SHUFFLE[1] = {{
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static herr_t
H5Z_set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t UNUSED space_id)
{
@@ -72,22 +72,22 @@ H5Z_set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t UNUSED space_id)
unsigned cd_values[H5Z_SHUFFLE_TOTAL_NPARMS]; /* Filter parameters */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5Z_set_local_shuffle, FAIL);
+ FUNC_ENTER_NOAPI(H5Z_set_local_shuffle, FAIL)
/* Get the filter's current parameters */
if(H5Pget_filter_by_id(dcpl_id,H5Z_FILTER_SHUFFLE,&flags,&cd_nelmts, cd_values,0,NULL)<0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get shuffle parameters");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get shuffle parameters")
/* Set "local" parameter for this dataset */
if((cd_values[H5Z_SHUFFLE_PARM_SIZE]=(unsigned)H5Tget_size(type_id))==0)
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size");
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size")
/* Modify the filter's parameters for this dataset */
if(H5Pmodify_filter(dcpl_id, H5Z_FILTER_SHUFFLE, flags, H5Z_SHUFFLE_TOTAL_NPARMS, cd_values)<0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local shuffle parameters");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local shuffle parameters")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_set_local_shuffle() */
@@ -126,11 +126,11 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
size_t leftover; /* Extra bytes at end of buffer */
size_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5Z_filter_shuffle, 0);
+ FUNC_ENTER_NOAPI(H5Z_filter_shuffle, 0)
/* Check arguments */
if (cd_nelmts!=H5Z_SHUFFLE_TOTAL_NPARMS || cd_values[H5Z_SHUFFLE_PARM_SIZE]==0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid shuffle parameters");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid shuffle parameters")
/* Get the number of bytes per element from the parameter block */
bytesoftype=cd_values[H5Z_SHUFFLE_PARM_SIZE];
@@ -145,7 +145,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
/* Allocate the destination buffer */
if (NULL==(dest = H5MM_malloc(nbytes)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for shuffle buffer");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for shuffle buffer")
if(flags & H5Z_FLAG_REVERSE) {
/* Get the pointer to the source buffer */
@@ -163,7 +163,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
/* Add leftover to the end of data */
if(leftover>0) {
/* Adjust back to end of shuffled bytes */
- _dest -= (bytesoftype - 1);
+ _dest -= (bytesoftype - 1); /*lint !e794 _dest is initialized */
HDmemcpy((void*)_dest, (void*)_src, leftover);
}
} /* end if */
@@ -183,7 +183,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
/* Add leftover to the end of data */
if(leftover>0) {
/* Adjust back to end of shuffled bytes */
- _src -= (bytesoftype - 1);
+ _src -= (bytesoftype - 1); /*lint !e794 _src is initialized */
HDmemcpy((void*)_dest, (void*)_src, leftover);
}
} /* end else */
@@ -200,7 +200,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
ret_value = nbytes;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
#endif /*H5_HAVE_FILTER_SHUFFLE */
diff --git a/src/H5Zszip.c b/src/H5Zszip.c
index 48efb81..64dbf70 100644
--- a/src/H5Zszip.c
+++ b/src/H5Zszip.c
@@ -14,6 +14,10 @@
#define H5Z_PACKAGE /*suppress error about including H5Zpkg */
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5Z_szip_mask
+
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
@@ -29,11 +33,6 @@
# include "szlib.h"
#endif
-/* Interface initialization */
-#define PABLO_MASK H5Z_szip_mask
-#define INTERFACE_INIT NULL
-static int interface_initialize_g = 0;
-
/* Local function prototypes */
static herr_t H5Z_can_apply_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static herr_t H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id);
@@ -84,31 +83,31 @@ const H5Z_class_t H5Z_SZIP[1] = {{
static herr_t
H5Z_can_apply_szip(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id)
{
- int dtype_size; /* Datatype's size (in bits) */
+ unsigned dtype_size; /* Datatype's size (in bits) */
H5T_order_t dtype_order; /* Datatype's endianness order */
herr_t ret_value=TRUE; /* Return value */
- FUNC_ENTER_NOAPI(H5Z_can_apply_szip, FAIL);
+ FUNC_ENTER_NOAPI(H5Z_can_apply_szip, FAIL)
/* Get datatype's size, for checking the "bits-per-pixel" */
if((dtype_size=(8*H5Tget_size(type_id)))==0)
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size");
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size")
/* Range check datatype's size */
if(dtype_size>32 && dtype_size!=64)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype size");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype size")
/* Get datatype's endianness order */
if((dtype_order=H5Tget_order(type_id))==H5T_ORDER_ERROR)
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "can't retrieve datatype endianness order");
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "can't retrieve datatype endianness order")
/* Range check datatype's endianness order */
/* (Note: this may not handle non-atomic datatypes well) */
if(dtype_order != H5T_ORDER_LE && dtype_order != H5T_ORDER_BE)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype endianness order");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype endianness order")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_can_apply_szip() */
@@ -144,11 +143,11 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
H5T_order_t dtype_order; /* Datatype's endianness order */
int dtype_size; /* Datatype's size (in bits) */
size_t dtype_precision; /* Datatype's precision (in bits) */
- size_t dtype_offset; /* Datatype's precision (in bits) */
+ size_t dtype_offset; /* Datatype's offset (in bits) */
hsize_t scanline; /* Size of dataspace's fastest changing dimension */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5Z_set_local_szip, FAIL);
+ FUNC_ENTER_NOAPI(H5Z_set_local_szip, FAIL)
/* Get the filter's current parameters */
if(H5Pget_filter_by_id(dcpl_id,H5Z_FILTER_SZIP,&flags,&cd_nelmts, cd_values,0,NULL)<0)
@@ -181,7 +180,7 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
/* Get dimensions for dataspace */
if ((ndims=H5Sget_simple_extent_dims(space_id, dims, NULL))<0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get dataspace dimensions");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get dataspace dimensions")
/* Set "local" parameter for this dataset's "pixels-per-scanline" */
/* (Use the chunk's fastest changing dimension size) */
@@ -216,7 +215,7 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
/* Get datatype's endianness order */
if((dtype_order=H5Tget_order(type_id))==H5T_ORDER_ERROR)
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order");
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order")
/* Set the correct endianness flag for szip */
/* (Note: this may not handle non-atomic datatypes well) */
@@ -231,15 +230,15 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
break;
default:
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order");
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order")
} /* end switch */
/* Modify the filter's parameters for this dataset */
if(H5Pmodify_filter(dcpl_id, H5Z_FILTER_SZIP, flags, H5Z_SZIP_TOTAL_NPARMS, cd_values)<0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local szip parameters");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local szip parameters")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_set_local_szip() */
@@ -271,7 +270,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
unsigned char *newbuf = NULL; /* Pointer to input buffer */
SZ_com_t sz_param; /* szip parameter block */
- FUNC_ENTER_NOAPI(H5Z_filter_szip, 0);
+ FUNC_ENTER_NOAPI(H5Z_filter_szip, 0)
/* Sanity check to make certain that we haven't drifted out of date with
* the mask options from the szlib.h header */
@@ -285,13 +284,13 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
/* Check arguments */
if (cd_nelmts!=4)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid deflate aggression level");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid deflate aggression level")
/* Copy the filter parameters into the szip parameter block */
- sz_param.options_mask = cd_values[H5Z_SZIP_PARM_MASK];
- sz_param.bits_per_pixel = cd_values[H5Z_SZIP_PARM_BPP];
- sz_param.pixels_per_block = cd_values[H5Z_SZIP_PARM_PPB];
- sz_param.pixels_per_scanline = cd_values[H5Z_SZIP_PARM_PPS];
+ H5_ASSIGN_OVERFLOW(sz_param.options_mask,cd_values[H5Z_SZIP_PARM_MASK],unsigned,int);
+ H5_ASSIGN_OVERFLOW(sz_param.bits_per_pixel,cd_values[H5Z_SZIP_PARM_BPP],unsigned,int);
+ H5_ASSIGN_OVERFLOW(sz_param.pixels_per_block,cd_values[H5Z_SZIP_PARM_PPB],unsigned,int);
+ H5_ASSIGN_OVERFLOW(sz_param.pixels_per_scanline,cd_values[H5Z_SZIP_PARM_PPS],unsigned,int);
/* Input; uncompress */
if (flags & H5Z_FLAG_REVERSE) {
@@ -305,12 +304,12 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
/* Allocate space for the uncompressed buffer */
if(NULL==(outbuf = H5MM_malloc(nalloc)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for szip decompression");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for szip decompression")
/* Decompress the buffer */
size_out=nalloc;
if(SZ_BufftoBuffDecompress(outbuf, &size_out, newbuf, nbytes-4, &sz_param) != SZ_OK)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "szip_filter: decompression failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "szip_filter: decompression failed")
assert(size_out==nalloc);
/* Free the input buffer */
@@ -328,7 +327,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
/* Allocate space for the compressed buffer & header (assume data won't get bigger) */
if(NULL==(dst=outbuf = H5MM_malloc(nbytes+4)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate szip destination buffer");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate szip destination buffer")
/* Encode the uncompressed length */
H5_CHECK_OVERFLOW(nbytes,size_t,uint32_t);
@@ -337,7 +336,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
/* Compress the buffer */
size_out = nbytes;
if(SZ_OK!= SZ_BufftoBuffCompress(dst, &size_out, *buf, nbytes, &sz_param))
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow");
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow")
assert(size_out<=nbytes);
/* Free the input buffer */
@@ -353,7 +352,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
done:
if(outbuf)
H5MM_xfree(outbuf);
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
#endif /* H5_HAVE_FILTER_SZIP */
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 365122d..dff3207 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -503,9 +503,6 @@
PTHREAD_SCOPE_SYSTEM) call. */
#undef SYSTEM_SCOPE_THREADS
-/* Define if szip encoder is present */
-#undef SZIP_CAN_ENCODE
-
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
diff --git a/src/H5detect.c b/src/H5detect.c
index 6cf519f..ec99b49 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -493,41 +493,26 @@ sigbus_handler(int UNUSED signo)
static void
print_results(int nd, detected_t *d, int na, malign_t *misc_align)
{
-
+ int byte_order=0;
int i, j;
/* Include files */
printf("\
#define H5T_PACKAGE /*suppress error about including H5Tpkg.h*/\n\
-#define PABLO_MASK H5Tinit_mask\n\
+#define PABLO_MASK H5T_init_mask\n\
\n\
#include \"H5private.h\"\n\
#include \"H5Iprivate.h\"\n\
#include \"H5Eprivate.h\"\n\
#include \"H5FLprivate.h\"\n\
-#include \"H5MMprivate.h\"\n\
#include \"H5Tpkg.h\"\n\
\n\
-static int interface_initialize_g = 0;\n\
-#define INTERFACE_INIT NULL\n\
-\n\
-/* Declare external the free list for H5T_t's */\n\
+/* Declare external the free lists for H5T_t's and H5T_shared_t's */\n\
H5FL_EXTERN(H5T_t);\n\
H5FL_EXTERN(H5T_shared_t);\n\
\n\
\n");
- /* The interface termination function */
- printf("\n\
-int\n\
-H5TN_term_interface(void)\n\
-{\n\
- interface_initialize_g = 0;\n\
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5TN_term_interface);\n\
- \n\
- FUNC_LEAVE_NOAPI(0);\n\
-}\n");
-
/* The interface initialization function */
printf("\n\
herr_t\n\
@@ -538,6 +523,18 @@ H5TN_init_interface(void)\n\
\n\
FUNC_ENTER_NOAPI(H5TN_init_interface, FAIL);\n");
+ /* The native endianess of this machine */
+ /* (Use the byte-order of a reasonably large type) */
+ for (i = 0; i < nd; i++)
+ if(d[i].size>1) {
+ byte_order=d[i].perm[0];
+ break;
+ } /* end if */
+ printf("\n\
+ /* Set the native order for this machine */\n\
+ H5T_native_order_g = H5T_ORDER_%s;\n",
+ byte_order ? "BE" : "LE"); /*byte order */
+
for (i = 0; i < nd; i++) {
/* Print a comment to describe this section of definitions. */
@@ -568,6 +565,7 @@ H5TN_init_interface(void)\n\
d[i].perm[0] ? "BE" : "LE", /*byte order */
d[i].offset, /*offset */
d[i].precision); /*precision */
+ assert(d[i].size<2 || (d[i].perm[0]>0)==(byte_order>0)); /* Double-check that byte-order doesn't change */
if (0 == d[i].msize) {
/* The part unique to fixed point types */
diff --git a/src/H5private.h b/src/H5private.h
index d8f7f15..526717c 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
/*
@@ -844,9 +844,9 @@ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base);
#define HDuname(S) uname(S)
#define HDungetc(C,F) ungetc(C,F)
#ifdef WIN32
-#define HDunlink(S) _unlink(S)
+#define HDunlink(S) _unlink(S)
#else
-#define HDunlink(S) unlink(S)
+#define HDunlink(S) unlink(S)
#endif
#define HDutime(S,T) utime(S,T)
#define HDva_arg(A,T) va_arg(A,T)
@@ -1125,6 +1125,25 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
assert(func_name)
#endif /* H5_HAVE_FUNCTION */
+/* Macros for defining interface initialization routines */
+#ifdef H5_INTERFACE_INIT_FUNC
+static int H5_interface_initialize_g = 0;
+static herr_t H5_INTERFACE_INIT_FUNC(void);
+#define H5_INTERFACE_INIT(err) \
+ /* Initialize this interface or bust */ \
+ if (!H5_interface_initialize_g) { \
+ H5_interface_initialize_g = 1; \
+ if (H5_INTERFACE_INIT_FUNC()<0) { \
+ H5_interface_initialize_g = 0; \
+ HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \
+ "interface initialization failed") \
+ } \
+ }
+#else /* H5_INTERFACE_INIT_FUNC */
+#define H5_INTERFACE_INIT(err)
+#endif /* H5_INTERFACE_INIT_FUNC */
+
+
#define FUNC_ENTER_COMMON_NOFUNC(func_name,asrt) \
PABLO_SAVE (ID_ ## func_name) \
\
@@ -1165,7 +1184,7 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
FUNC_ENTER_API_VARS(func_name) \
FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \
FUNC_ENTER_API_THREADSAFE; \
- FUNC_ENTER_API_COMMON(func_name,INTERFACE_INIT,err); \
+ FUNC_ENTER_API_COMMON(func_name,err); \
/* Clear thread error stack entering public functions */ \
H5E_clear(); \
{
@@ -1178,7 +1197,7 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
FUNC_ENTER_API_VARS(func_name) \
FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \
FUNC_ENTER_API_THREADSAFE; \
- FUNC_ENTER_API_COMMON(func_name,INTERFACE_INIT,err); \
+ FUNC_ENTER_API_COMMON(func_name,err); \
{
/*
@@ -1198,7 +1217,13 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
/* Use this macro for all "normal" non-API functions */
#define FUNC_ENTER_NOAPI(func_name,err) { \
FUNC_ENTER_COMMON(func_name,!H5_IS_API(#func_name)); \
- FUNC_ENTER_NOAPI_INIT(func_name,INTERFACE_INIT,err) \
+ FUNC_ENTER_NOAPI_INIT(func_name,err) \
+ {
+
+/* Use this macro for all non-API functions which don't issue errors */
+#define FUNC_ENTER_NOAPI_NOFUNC(func_name) { \
+ FUNC_ENTER_COMMON_NOFUNC(func_name,!H5_IS_API(#func_name)); \
+ FUNC_ENTER_NOAPI_INIT(func_name,err) \
{
/*
@@ -1235,12 +1260,16 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
* Use this macro for non-API functions which fall into these categories:
* - functions which shouldn't push their name on the function stack
* (so far, just the H5FS routines themselves)
+ *
+ * This macro is used for functions which fit the above categories _and_
+ * also don't use the 'FUNC' variable (i.e. don't push errors on the error stack)
+ *
*/
-#define FUNC_ENTER_NOAPI_NOFS(func_name) { \
- FUNC_ENTER_COMMON(func_name,!H5_IS_API(#func_name)); \
+#define FUNC_ENTER_NOAPI_NOFUNC_NOFS(func_name) { \
+ FUNC_ENTER_COMMON_NOFUNC(func_name,!H5_IS_API(#func_name)); \
{
-#define FUNC_ENTER_API_COMMON(func_name,interface_init_func,err) \
+#define FUNC_ENTER_API_COMMON(func_name,err) \
/* Initialize the library */ \
if (!(H5_INIT_GLOBAL)) { \
H5_INIT_GLOBAL = TRUE; \
@@ -1249,33 +1278,17 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
"library initialization failed") \
} \
\
- /* Initialize this interface or bust */ \
- if (!interface_initialize_g) { \
- interface_initialize_g = 1; \
- if (interface_init_func && \
- ((herr_t(*)(void))interface_init_func)()<0) { \
- interface_initialize_g = 0; \
- HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \
- "interface initialization failed"); \
- } \
- } \
+ /* Initialize the interface, if appropriate */ \
+ H5_INTERFACE_INIT(err) \
\
/* Push the name of this function on the function stack */ \
H5_PUSH_FUNC(func_name); \
\
BEGIN_MPE_LOG(func_name)
-#define FUNC_ENTER_NOAPI_INIT(func_name,interface_init_func,err) \
- /* Initialize this interface or bust */ \
- if (!interface_initialize_g) { \
- interface_initialize_g = 1; \
- if (interface_init_func && \
- ((herr_t(*)(void))interface_init_func)()<0) { \
- interface_initialize_g = 0; \
- HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \
- "interface initialization failed"); \
- } \
- } \
+#define FUNC_ENTER_NOAPI_INIT(func_name,err) \
+ /* Initialize the interface, if appropriate */ \
+ H5_INTERFACE_INIT(err) \
\
/* Push the name of this function on the function stack */ \
H5_PUSH_FUNC(func_name);
@@ -1362,7 +1375,6 @@ H5_DLL int H5I_term_interface(void);
H5_DLL int H5P_term_interface(void);
H5_DLL int H5R_term_interface(void);
H5_DLL int H5S_term_interface(void);
-H5_DLL int H5TN_term_interface(void);
H5_DLL int H5T_term_interface(void);
H5_DLL int H5Z_term_interface(void);
diff --git a/src/H5public.h b/src/H5public.h
index d23cb0f..0753003 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.
*/
@@ -165,36 +162,52 @@ typedef ssize_t hssize_t;
#if H5_SIZEOF_INT64_T>=8
typedef uint64_t haddr_t;
# define HADDR_UNDEF ((haddr_t)(int64_t)(-1))
+# define H5_SIZEOF_HADDR_T H5_SIZEOF_INT64_T
# ifdef H5_HAVE_PARALLEL
# define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT
# endif /* H5_HAVE_PARALLEL */
#elif H5_SIZEOF_INT>=8
typedef unsigned haddr_t;
# define HADDR_UNDEF ((haddr_t)(-1))
+# define H5_SIZEOF_HADDR_T H5_SIZEOF_INT
# ifdef H5_HAVE_PARALLEL
# define HADDR_AS_MPI_TYPE MPI_UNSIGNED
# endif /* H5_HAVE_PARALLEL */
#elif H5_SIZEOF_LONG>=8
typedef unsigned long haddr_t;
# define HADDR_UNDEF ((haddr_t)(long)(-1))
+# define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG
# ifdef H5_HAVE_PARALLEL
# define HADDR_AS_MPI_TYPE MPI_UNSIGNED_LONG
# endif /* H5_HAVE_PARALLEL */
#elif H5_SIZEOF_LONG_LONG>=8
typedef unsigned long long haddr_t;
# define HADDR_UNDEF ((haddr_t)(long long)(-1))
+# define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG_LONG
# ifdef H5_HAVE_PARALLEL
# define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT
# endif /* H5_HAVE_PARALLEL */
#elif H5_SIZEOF___INT64>=8
typedef unsigned __int64 haddr_t;
# define HADDR_UNDEF ((haddr_t)(__int64)(-1))
+# define H5_SIZEOF_HADDR_T H5_SIZEOF___INT64
# ifdef H5_HAVE_PARALLEL
# define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT
# endif /* H5_HAVE_PARALLEL */
#else
# error "nothing appropriate for haddr_t"
#endif
+#if H5_SIZEOF_HADDR_T ==H5_SIZEOF_INT
+# define H5_PRINTF_HADDR_FMT "%u"
+#elif H5_SIZEOF_HADDR_T ==H5_SIZEOF_LONG
+# define H5_PRINTF_HADDR_FMT "%lu"
+#elif H5_SIZEOF_HADDR_T ==H5_SIZEOF_LONG_LONG
+# define H5_PRINTF_HADDR_FMT "%"H5_PRINTF_LL_WIDTH"u"
+#elif H5_SIZEOF_HADDR_T ==H5_SIZEOF___INT64
+# define H5_PRINTF_HADDR_FMT "%"H5_PRINTF_LL_WIDTH"u"
+#else
+# error "nothing appropriate for H5_PRINTF_HADDR_FMT"
+#endif
#define HADDR_MAX (HADDR_UNDEF-1)
/* Functions in H5.c */
diff --git a/src/Makefile.in b/src/Makefile.in
index 9247513..8d5ed7a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -32,7 +32,7 @@ DISTCLEAN=libhdf5.settings
## Source and object files for the library (lexicographically)...
LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5C.c H5D.c H5Dcontig.c H5Dcompact.c H5Defl.c \
H5Dio.c H5Distore.c H5Dmpio.c H5Dselect.c H5Dtest.c H5E.c H5F.c \
- H5FD.c \
+ H5Fdbg.c H5FD.c \
H5FDcore.c H5FDfamily.c H5FDgass.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDsrb.c H5FDstdio.c \
H5FDstream.c H5FL.c H5FO.c H5FS.c H5G.c H5Gent.c H5Gnode.c H5Gstab.c \