summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>1997-08-26 19:51:49 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>1997-08-26 19:51:49 (GMT)
commit31ff3e40a06c7d9cced2475f0e6e4acaa2afacd0 (patch)
treedec82b8f07a186e260116f9959378998809a0dfa /src
parented257f0958afe6555eeec6733761993f0355fe98 (diff)
downloadhdf5-31ff3e40a06c7d9cced2475f0e6e4acaa2afacd0.zip
hdf5-31ff3e40a06c7d9cced2475f0e6e4acaa2afacd0.tar.gz
hdf5-31ff3e40a06c7d9cced2475f0e6e4acaa2afacd0.tar.bz2
[svn-r42] Minor tweaks to correct parameters for H5O_new
Diffstat (limited to 'src')
-rw-r--r--src/H5D.c2
-rw-r--r--src/H5Dprivate.h3
-rw-r--r--src/H5Osdim.c109
3 files changed, 61 insertions, 53 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 5c93840..05316a3 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -288,7 +288,7 @@ herr_t H5D_flush(hatom_t oid)
/* construct dataset symbol-table entry */
d_sym.name_off=0;
/* allocate the dataset's object header */
- if((d_sym.header=H5O_new(file, 1, 0))<0)
+ if((d_sym.header=H5O_new(file, 0, H5D_MINHDR_SIZE))<0)
HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL);
d_sym.type=H5G_NOTHING_CACHED;
dataset->header=d_sym.header;
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index 73e4a40..43558e8 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -38,6 +38,9 @@ typedef struct {
#define H5D_RESERVED_ATOMS 0
+/* Set the minimum object header size to create objects with */
+#define H5D_MINHDR_SIZE 512
+
/*-----------------_-- Local function prototypes ----------------------------*/
hatom_t H5D_create(hatom_t owner_id, hobjtype_t type, const char *name);
herr_t H5D_flush(hatom_t oid);
diff --git a/src/H5Osdim.c b/src/H5Osdim.c
index a5f3e29..9a624c7 100644
--- a/src/H5Osdim.c
+++ b/src/H5Osdim.c
@@ -105,18 +105,18 @@ H5O_sim_dim_decode (hdf5_file_t *f, size_t raw_size, const uint8 *p)
if(sdim->rank>0)
{
sdim->size=H5MM_xmalloc(sizeof(uint32)*sdim->rank);
- for(u=0; u<sdim->size; u++)
+ for(u=0; u<sdim->rank; u++)
UINT32DECODE(p,sdim->size[u]);
if(sdim->dim_flags&0x01)
{
sdim->max=H5MM_xmalloc(sizeof(uint32)*sdim->rank);
- for(u=0; u<sdim->size; u++)
+ for(u=0; u<sdim->rank; u++)
UINT32DECODE(p,sdim->max[u]);
} /* end if */
if(sdim->dim_flags&0x02)
{
sdim->perm=H5MM_xmalloc(sizeof(uint32)*sdim->rank);
- for(u=0; u<sdim->size; u++)
+ for(u=0; u<sdim->rank; u++)
UINT32DECODE(p,sdim->perm[u]);
} /* end if */
} /* end if */
@@ -169,90 +169,99 @@ H5O_sim_dim_encode (hdf5_file_t *f, size_t raw_size, uint8 *p, const void *mesg)
UINT32ENCODE(p,sdim->dim_flags);
if(sdim->rank>0)
{
- for(u=0; u<=sdim->rank; u++);
+ for(u=0; u<sdim->rank; u++);
UINT32ENCODE(p,sdim->size[u]);
if(sdim->dim_flags&0x01)
{
- for(u=0; u<=sdim->rank; u++);
+ for(u=0; u<sdim->rank; u++);
UINT32ENCODE(p,sdim->max[u]);
} /* end if */
+ if(sdim->dim_flags&0x02)
+ {
+ for(u=0; u<sdim->rank; u++);
+ UINT32ENCODE(p,sdim->perm[u]);
+ } /* end if */
} /* end if */
FUNC_LEAVE (SUCCEED);
-} /* end H5O_sim_dtype_encode() */
+} /* end H5O_sim_dim_encode() */
/*--------------------------------------------------------------------------
NAME
- H5O_sim_dtype_fast
+ H5O_sim_dim_fast
PURPOSE
- Initializes a new simple datatype struct with info from a symbol table
- entry.
+ Initializes a new simple dimensionality struct with info from a symbol
+ table entry.
USAGE
- void *H5O_sim_dtype_fast(ent, mesg)
+ void *H5O_sim_dim_fast(ent, mesg)
const H5G_entry_t *ent; IN: pointer to the symbol table entry
- const void *mesg; IN: Pointer to the simple datatype struct
+ const void *mesg; IN: Pointer to the simple dimensionality struct
RETURNS
Pointer to the message structure (allocated if none is supplied) on success,
NULL on failure
DESCRIPTION
- This function fills the native memory form of the simple datatype
+ This function fills the native memory form of the simple dimensionality
message from a symbol-table entry cache fields. (This method is required
- for simple datatypes, as they can be cached in the symbol-table entry)
+ for simple dimensionality, as they can be cached in the symbol-table entry)
--------------------------------------------------------------------------*/
static void *
-H5O_sim_dtype_fast (const H5G_entry_t *ent, void *mesg)
+H5O_sim_dim_fast (const H5G_entry_t *ent, void *mesg)
{
- H5O_sim_dtype_t *sdtype = (H5O_sim_dtype_t *)mesg;
+ H5O_sim_dim_t *sdim = (H5O_sim_dim_t *)mesg;
+ uintn u; /* local counting variable */
const uint8 *p;
- FUNC_ENTER (H5O_sim_dtype_fast, NULL, NULL);
+ FUNC_ENTER (H5O_sim_dim_fast, NULL, NULL);
/* check args */
assert (ent);
if (H5G_CACHED_SDATA==ent->type)
{
- if (!sdtype)
- if((sdtype = H5MM_xcalloc (1, sizeof(H5O_sim_dtype_t)))!=NULL)
+ if (!sdim)
+ if((sdim = H5MM_xcalloc (1, sizeof(H5O_sim_dim_t)))!=NULL)
{
- p=&(uint8 *)ent->cache.sdata.nt;
- sdtype->length=*p++;
- sdtype->arch=*p++;
- UINT16DECODE(p,sdtype->type);
+ p=&(uint8 *)ent->cache.sdata.ndim;
+ UINT32DECODE(p,sdim->rank);
+ sdim->dim_flags=0; /* cached dimensions never have max. dims or permutation vectors */
+ sdim->size=H5MM_xmalloc(sizeof(uint32)*sdim->rank);
+ for(u=0; u<sdim->rank; u++)
+ UINT32DECODE(p,sdim->size[u]);
} /* end if */
} /* end if */
else
- sdtype = NULL;
+ sdim = NULL;
- FUNC_LEAVE (sdtype);
-} /* end H5O_sim_dtype_fast() */
+ FUNC_LEAVE (sdim);
+} /* end H5O_sim_dim_fast() */
/*--------------------------------------------------------------------------
NAME
- H5O_sim_dtype_cache
+ H5O_sim_dim_cache
PURPOSE
- Copies a simple datatype message into the cache portion of a symbol table
- entry.
+ Copies a simple dimensionality message into the cache portion of a symbol
+ table entry.
USAGE
- hbool_t H5O_sim_dtype_cache(ent, mesg)
+ hbool_t H5O_sim_dim_cache(ent, mesg)
const H5G_entry_t *ent; IN: Pointer to the symbol table entry
- const void *mesg; IN: Pointer to the simple datatype struct
+ const void *mesg; IN: Pointer to the simple dimensionality struct
RETURNS
BTRUE if symbol-table modified, BFALSE if not modified, BFAIL on failure.
DESCRIPTION
- This function is the opposite of the H5O_sim_dtype_fast method, it
+ This function is the opposite of the H5O_sim_dim_fast method, it
copies a message into the cached portion of a symbol-table entry. (This
- method is required for simple datatypes, as they can be cached in the
- symbol-table entry)
+ method is required for simple dimensionalities, as they can be cached in
+ the symbol-table entry)
--------------------------------------------------------------------------*/
static hbool_t
-H5O_sim_dtype_cache (H5G_entry_t *ent, const void *mesg)
+H5O_sim_dim_cache (H5G_entry_t *ent, const void *mesg)
{
- const H5O_sim_dtype_t *sdtype = (const H5O_sim_dtype_t *)mesg;
+ const H5O_sim_dim_t *sdtype = (const H5O_sim_dim_t *)mesg;
+ uintn u; /* Local counting variable */
const uint8 *p;
hbool_t modified = BFALSE;
- FUNC_ENTER (H5O_sim_dtype_cache, NULL, BFAIL);
+ FUNC_ENTER (H5O_sim_dim_cache, NULL, BFAIL);
/* check args */
assert (ent);
@@ -268,29 +277,25 @@ H5O_sim_dtype_cache (H5G_entry_t *ent, const void *mesg)
{
modified = BTRUE;
ent->type = H5G_CACHED_SDATA;
- *p++=sdtype->length;
- *p++=sdtype->arch;
- UINT16ENCODE(p,sdtype->type);
+ UINT32ENCODE(p,sdim->rank);
+ for(u=0; u<=sdim->rank; u++);
+ UINT32ENCODE(p,sdim->size[u]);
} /* end if */
else
{
- if(ent->cache.sdata.length= sdtype->length)
+ if(ent->cache.sdata.rank= sdim->rank)
{
modified = BTRUE;
- ent->cache.sdata.length = sdtype->length;
+ ent->cache.sdata.rank = sdim->rank;
} /* end if */
- if (ent->cache.sdata.arch != sdtype->arch)
- {
- modified = BTRUE;
- ent->cache.sdata.arch = sdtype->arch;
- } /* end if */
-
- if (ent->cache.sdata.type != sdtype->type)
- {
- modified = BTRUE;
- ent->cache.sdata.type = sdtype->type;
- } /* end if */
+ /* Check each dimension */
+ for(u=0; u<sdim->rank; u++)
+ if (ent->cache.sdata.dim[u] != sdim->size[u])
+ {
+ modified = BTRUE;
+ ent->cache.sdata.dim[u] = sdim->size[u];
+ } /* end if */
} /* end else */
FUNC_LEAVE (modified);