summaryrefslogtreecommitdiffstats
path: root/src/H5Osdspace.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-04-09 20:22:11 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-04-09 20:22:11 (GMT)
commitc96611f8b54caf83b386e78ebb398d3a69be752a (patch)
tree55a6e8e66c4e099dec84bb52eca725b9bae00d27 /src/H5Osdspace.c
parentc01750fa740943c0083711b353278143c79d50a3 (diff)
downloadhdf5-c96611f8b54caf83b386e78ebb398d3a69be752a.zip
hdf5-c96611f8b54caf83b386e78ebb398d3a69be752a.tar.gz
hdf5-c96611f8b54caf83b386e78ebb398d3a69be752a.tar.bz2
[svn-r339] Changes since 19980408
---------------------- ./src/H5Osdspace.c ./html/H5.format.html In the past we were allowed to have >2GB files on a 32-bit machine as long as no dataset within the file was larger than 4GB (or whatever sizeof(size_t) is). That's been fixed now. All dataset size calculations are done with `hsize_t' which is normally defined as `unsigned long long'. ./src/H5F.c ./src/H5Ffamily.c ./src/H5Fprivate.h ./src/H5P.c ./src/H5Ppublic.h The file family member size can now be set/queried. The default is still 64MB, but it can be set to 1GB by saying: H5Pset_family (plist, 30, H5P_DEFAULT); When opening an existing file family the specified bits-per-member is ignored and the first member of the family determines the bits-per-member, which can be retrieved with H5Pget_family(). ./acconfig.h ./configure.in ./src/H5config.h ./src/H5public.h Added `--disable-hsizet' so that those with old GCC compilers (<2.8.1) can still compile the code. ./src/H5.c ./src/H5private.h Added HDfprintf() which works just like fprintf() except you can give `H' as a size modifier for the integer conversions and supply an `hsize_t' or `hssize_t' argument without casting it. For instance: hsize_t npoints = H5Sget_npoints(space); HDfprintf(stdout,"Dataset has %Hd (%#018Hx) points\n", npoints, npoints); You can now give `%a' as a format to print an address, but all formating flags are ignored and it causes the return value of HDfprintf() to not include the characters in the address (but who uses the return value anyway :-). Example: H5G_t *grp; HDfprintf(stdout, "Group object header at %a\n", &(grp->ent.header)); Added HDstrtoll() which works exactly like [HD]strtol() except the result is an int64. ./src/debug.c Large addresses can now be entered from the command-line. Use either decimal, octal (leading `0') or hexadecimal (leading `0x') when giving the address. ./src/h5ls.c The printf format for dataset dimensions was changed to `%Hu' to support large datasets. ./test/big.c [NEW] A test for big datasets on 32-bit machines. This test is not run by default. Don't try to run it on an nfs-mounted file system or other file system that doesn't support holes because it creates two 32GB datasets of all zero.
Diffstat (limited to 'src/H5Osdspace.c')
-rw-r--r--src/H5Osdspace.c84
1 files changed, 55 insertions, 29 deletions
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index cb079fa..12ae765 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -67,10 +67,14 @@ static hbool_t interface_initialize_g = FALSE;
This function decodes the "raw" disk form of a simple dimensionality
message into a struct in memory native format. The struct is allocated
within this function using malloc() and is returned to the caller.
+
+ MODIFICATIONS
+ Robb Matzke, 1998-04-09
+ The current and maximum dimensions are now H5F_SIZEOF_SIZET bytes
+ instead of just four bytes.
--------------------------------------------------------------------------*/
static void *
-H5O_sdspace_decode(H5F_t __unused__ *f, const uint8 *p,
- H5HG_t __unused__ *hobj)
+H5O_sdspace_decode(H5F_t *f, const uint8 *p, H5HG_t __unused__ *hobj)
{
H5S_simple_t *sdim = NULL;/* New simple dimensionality structure */
intn u; /* local counting variable */
@@ -89,12 +93,14 @@ H5O_sdspace_decode(H5F_t __unused__ *f, const uint8 *p,
UINT32DECODE(p, flags);
if (sdim->rank > 0) {
sdim->size = H5MM_xmalloc(sizeof(sdim->size[0]) * sdim->rank);
- for (u = 0; u < sdim->rank; u++)
- UINT32DECODE(p, sdim->size[u]);
+ for (u = 0; u < sdim->rank; u++) {
+ H5F_decode_length (f, p, sdim->size[u]);
+ }
if (flags & 0x01) {
sdim->max = H5MM_xmalloc(sizeof(sdim->max[0]) * sdim->rank);
- for (u = 0; u < sdim->rank; u++)
- UINT32DECODE(p, sdim->max[u]);
+ for (u = 0; u < sdim->rank; u++) {
+ H5F_decode_length (f, p, sdim->max[u]);
+ }
}
if (flags & 0x02) {
sdim->perm = H5MM_xmalloc(sizeof(sdim->perm[0]) * sdim->rank);
@@ -130,9 +136,14 @@ H5O_sdspace_decode(H5F_t __unused__ *f, const uint8 *p,
DESCRIPTION
This function encodes the native memory form of the simple
dimensionality message in the "raw" disk form.
+
+ MODIFICATIONS
+ Robb Matzke, 1998-04-09
+ The current and maximum dimensions are now H5F_SIZEOF_SIZET bytes
+ instead of just four bytes.
--------------------------------------------------------------------------*/
static herr_t
-H5O_sdspace_encode(H5F_t __unused__ *f, uint8 *p, const void *mesg)
+H5O_sdspace_encode(H5F_t *f, uint8 *p, const void *mesg)
{
const H5S_simple_t *sdim = (const H5S_simple_t *) mesg;
intn u; /* Local counting variable */
@@ -153,11 +164,13 @@ H5O_sdspace_encode(H5F_t __unused__ *f, uint8 *p, const void *mesg)
UINT32ENCODE(p, sdim->rank);
UINT32ENCODE(p, flags);
if (sdim->rank > 0) {
- for (u = 0; u < sdim->rank; u++)
- UINT32ENCODE(p, sdim->size[u]);
+ for (u = 0; u < sdim->rank; u++) {
+ H5F_encode_length (f, p, sdim->size[u]);
+ }
if (flags & 0x01) {
- for (u = 0; u < sdim->rank; u++)
- UINT32ENCODE(p, sdim->max[u]);
+ for (u = 0; u < sdim->rank; u++) {
+ H5F_encode_length (f, p, sdim->max[u]);
+ }
}
if (flags & 0x02) {
for (u = 0; u < sdim->rank; u++)
@@ -229,18 +242,32 @@ H5O_sdspace_copy(const void *mesg, void *dest)
This function returns the size of the raw simple dimensionality message on
success. (Not counting the message type or size fields, only the data
portion of the message). It doesn't take into account alignment.
+
+ MODIFICATIONS
+ Robb Matzke, 1998-04-09
+ The current and maximum dimensions are now H5F_SIZEOF_SIZET bytes
+ instead of just four bytes.
--------------------------------------------------------------------------*/
static size_t
-H5O_sdspace_size(H5F_t __unused__ *f, const void *mesg)
+H5O_sdspace_size(H5F_t *f, const void *mesg)
{
const H5S_simple_t *sdim = (const H5S_simple_t *) mesg;
- size_t ret_value = 8; /* all dimensionality messages are at least 8 bytes long (rank and flags) */
+ /*
+ * all dimensionality messages are at least 8 bytes long (four bytes for
+ * rank and four bytes for flags)
+ */
+ size_t ret_value = 8;
FUNC_ENTER(H5O_sim_dtype_size, 0);
- ret_value += sdim->rank * 4; /* add in the dimension sizes */
- ret_value += sdim->max ? sdim->rank * 4 : 0; /* add in the space for the maximum dimensions, if they are present */
- ret_value += sdim->perm ? sdim->rank * 4 : 0; /* add in the space for the dimension permutations, if they are present */
+ /* add in the dimension sizes */
+ ret_value += sdim->rank * H5F_SIZEOF_SIZE (f);
+
+ /* add in the space for the maximum dimensions, if they are present */
+ ret_value += sdim->max ? sdim->rank * H5F_SIZEOF_SIZE (f) : 0;
+
+ /* add in the space for the dimension permutations, if they are present */
+ ret_value += sdim->perm ? sdim->rank * 4 : 0;
FUNC_LEAVE(ret_value);
}
@@ -279,36 +306,35 @@ H5O_sdspace_debug(H5F_t __unused__ *f, const void *mesg,
assert(indent >= 0);
assert(fwidth >= 0);
- fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
"Rank:",
(unsigned long) (sdim->rank));
- fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:");
+ HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:");
for (u = 0; u < sdim->rank; u++) {
- fprintf (stream, "%s%lu", u?", ":"", (unsigned long)(sdim->size[u]));
+ HDfprintf (stream, "%s%Hu", u?", ":"", sdim->size[u]);
}
- fprintf (stream, "}\n");
+ HDfprintf (stream, "}\n");
- fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Dim Max:");
+ HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Dim Max:");
if (sdim->max) {
- fprintf (stream, "{");
+ HDfprintf (stream, "{");
for (u = 0; u < sdim->rank; u++) {
if (H5S_UNLIMITED==sdim->max[u]) {
- fprintf (stream, "%sINF", u?", ":"");
+ HDfprintf (stream, "%sINF", u?", ":"");
} else {
- fprintf (stream, "%s%lu", u?", ":"",
- (unsigned long) (sdim->max[u]));
+ HDfprintf (stream, "%s%Hu", u?", ":"", sdim->max[u]);
}
}
- fprintf (stream, "}\n");
+ HDfprintf (stream, "}\n");
} else {
- fprintf (stream, "CONSTANT\n");
+ HDfprintf (stream, "CONSTANT\n");
}
if (sdim->perm) {
- fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Perm:");
+ HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Perm:");
for (u = 0; u < sdim->rank; u++) {
- fprintf (stream, "%s%lu", u?", ":"",
+ HDfprintf (stream, "%s%lu", u?", ":"",
(unsigned long) (sdim->perm[u]));
}
}