예제 #1
0
파일: H5HLint.c 프로젝트: 151706061/ITK
/*-------------------------------------------------------------------------
 * Function:	H5HL_dest
 *
 * Purpose:	Destroys a heap in memory.
 *
 * Return:	Non-negative on success/Negative on failure
 *
 * Programmer:	Quincey Koziol
 *		[email protected]
 *		Jan 15 2003
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5HL_dest(H5HL_t *heap)
{
    FUNC_ENTER_NOAPI_NOFUNC(H5HL_dest)

    /* check arguments */
    HDassert(heap);

    /* Verify that node is unused */
    HDassert(heap->prots == 0);
    HDassert(heap->rc == 0);
    HDassert(heap->prfx == NULL);
    HDassert(heap->dblk == NULL);

    if(heap->dblk_image)
        heap->dblk_image = H5FL_BLK_FREE(lheap_chunk, heap->dblk_image);
    while(heap->freelist) {
        H5HL_free_t	*fl;

        fl = heap->freelist;
        heap->freelist = fl->next;
        fl = H5FL_FREE(H5HL_free_t, fl);
    } /* end while */
    heap = H5FL_FREE(H5HL_t, heap);

    FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HL_dest() */
예제 #2
0
파일: H5Gint.c 프로젝트: zlongshen/hdf5
/*-------------------------------------------------------------------------
 * Function:	H5G__create
 *
 * Purpose:	Creates a new empty group with the specified name. The name
 *		is either an absolute name or is relative to LOC.
 *
 * Return:	Success:	A handle for the group.	 The group is opened
 *				and should eventually be close by calling
 *				H5G_close().
 *
 *		Failure:	NULL
 *
 * Programmer:	Robb Matzke
 *		[email protected]
 *		Aug 11 1997
 *
 *-------------------------------------------------------------------------
 */
H5G_t *
H5G__create(H5F_t *file, H5G_obj_create_t *gcrt_info, hid_t dxpl_id)
{
    H5G_t	*grp = NULL;	/*new group			*/
    unsigned    oloc_init = 0;  /* Flag to indicate that the group object location was created successfully */
    H5G_t *ret_value = NULL;    /* Return value */

    FUNC_ENTER_PACKAGE

    /* check args */
    HDassert(file);
    HDassert(gcrt_info->gcpl_id != H5P_DEFAULT);
    HDassert(dxpl_id != H5P_DEFAULT);

    /* create an open group */
    if(NULL == (grp = H5FL_CALLOC(H5G_t)))
        HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
    if(NULL == (grp->shared = H5FL_CALLOC(H5G_shared_t)))
        HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")

    /* Create the group object header */
    if(H5G__obj_create(file, dxpl_id, gcrt_info, &(grp->oloc)/*out*/) < 0)
        HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group object header")
    oloc_init = 1;    /* Indicate that the object location information is valid */

    /* Add group to list of open objects in file */
    if(H5FO_top_incr(grp->oloc.file, grp->oloc.addr) < 0)
        HGOTO_ERROR(H5E_SYM, H5E_CANTINC, NULL, "can't incr object ref. count")
    if(H5FO_insert(grp->oloc.file, grp->oloc.addr, grp->shared, TRUE) < 0)
        HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, NULL, "can't insert group into list of open objects")

    /* Set the count of times the object is opened */
    grp->shared->fo_count = 1;

    /* Set return value */
    ret_value = grp;

done:
    if(ret_value == NULL) {
        /* Check if we need to release the file-oriented symbol table info */
        if(oloc_init) {
            if(H5O_dec_rc_by_loc(&(grp->oloc), dxpl_id) < 0)
                HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object")
            if(H5O_close(&(grp->oloc)) < 0)
                HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, NULL, "unable to release object header")
            if(H5O_delete(file, dxpl_id, grp->oloc.addr) < 0)
                HDONE_ERROR(H5E_SYM, H5E_CANTDELETE, NULL, "unable to delete object header")
        } /* end if */
        if(grp != NULL) {
            if(grp->shared != NULL)
                grp->shared = H5FL_FREE(H5G_shared_t, grp->shared);
            grp = H5FL_FREE(H5G_t, grp);
        } /* end if */
    } /* end if */

    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__create() */
예제 #3
0
/*--------------------------------------------------------------------------
 NAME
    H5O_sdspace_copy
 PURPOSE
    Copies a message from MESG to DEST, allocating DEST if necessary.
 USAGE
    void *H5O_sdspace_copy(_mesg, _dest)
	const void *_mesg;	IN: Pointer to the source extent dimensionality struct
	const void *_dest;	IN: Pointer to the destination extent dimensionality struct
 RETURNS
    Pointer to DEST on success, NULL on failure
 DESCRIPTION
	This function copies a native (memory) simple dimensionality message,
    allocating the destination structure if necessary.
--------------------------------------------------------------------------*/
static void *
H5O_sdspace_copy(const void *_mesg, void *_dest)
{
    const H5S_extent_t	   *mesg = (const H5S_extent_t *)_mesg;
    H5S_extent_t	   *dest = (H5S_extent_t *)_dest;
    void                   *ret_value;          /* Return value */

    FUNC_ENTER_NOAPI_NOINIT(H5O_sdspace_copy)

    /* check args */
    HDassert(mesg);
    if(!dest && NULL == (dest = H5FL_MALLOC(H5S_extent_t)))
	HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")

    /* Copy extent information */
    if(H5S_extent_copy(dest, mesg, TRUE) < 0)
        HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent")

    /* Set return value */
    ret_value = dest;

done:
    if(NULL == ret_value)
        if(dest && NULL == _dest)
            dest = H5FL_FREE(H5S_extent_t, dest);

    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_sdspace_copy() */
예제 #4
0
/*-------------------------------------------------------------------------
 * Function:    H5O_refcount_decode
 *
 * Purpose:     Decode a message and return a pointer to a newly allocated one.
 *
 * Return:      Success:        Ptr to new message in native form.
 *              Failure:        NULL
 *
 * Programmer:  Quincey Koziol
 *              [email protected]
 *              Mar 10 2007
 *
 *-------------------------------------------------------------------------
 */
static void *
H5O_refcount_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
    unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
{
    H5O_refcount_t *refcount = NULL;    /* Reference count */
    void *ret_value = NULL;             /* Return value */

    FUNC_ENTER_NOAPI_NOINIT

    /* check args */
    HDassert(f);
    HDassert(p);

    /* Version of message */
    if(*p++ != H5O_REFCOUNT_VERSION)
        HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message")

    /* Allocate space for message */
    if(NULL == (refcount = H5FL_MALLOC(H5O_refcount_t)))
	HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")

    /* Get ref. count for object */
    UINT32DECODE(p, *refcount)

    /* Set return value */
    ret_value = refcount;

done:
    if(ret_value == NULL && refcount != NULL)
        refcount = H5FL_FREE(H5O_refcount_t, refcount);

    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_refcount_decode() */
예제 #5
0
파일: H5HLint.c 프로젝트: 151706061/ITK
/*-------------------------------------------------------------------------
 * Function:	H5HL_prfx_dest
 *
 * Purpose:	Destroy a local heap prefix object
 *
 * Return:	Success:	Non-negative
 *		Failure:	Negative
 *
 * Programmer:	Quincey Koziol
 *		[email protected]
 *		Oct 12 2008
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5HL_prfx_dest(H5HL_prfx_t *prfx)
{
    herr_t ret_value = SUCCEED;         /* Return value */

    FUNC_ENTER_NOAPI(H5HL_prfx_dest, FAIL)

    /* check arguments */
    HDassert(prfx);

    /* Check if prefix was initialized */
    if(prfx->heap) {
        /* Unlink prefix from heap */
        prfx->heap->prfx = NULL;

        /* Decrement ref. count on heap data structure */
        if(H5HL_dec_rc(prfx->heap) < 0)
            HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count")

        /* Unlink heap from prefix */
        prfx->heap = NULL;
    } /* end if */

    /* Free local heap prefix */
    prfx = H5FL_FREE(H5HL_prfx_t, prfx);

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_prfx_dest() */
/*-------------------------------------------------------------------------
 * Function:	H5HF_man_iter_up
 *
 * Purpose:	Move iterator up one level
 *
 * Return:	SUCCEED/FAIL
 *
 * Programmer:	Quincey Koziol
 *		[email protected]
 *		Apr 24 2006
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5HF_man_iter_up(H5HF_block_iter_t *biter)
{
    H5HF_block_loc_t *up_loc;           /* Pointer to 'up' block location */
    herr_t ret_value = SUCCEED;         /* Return value */

    FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iter_up)

    /*
     * Check arguments.
     */
    HDassert(biter);
    HDassert(biter->ready);
    HDassert(biter->curr);
    HDassert(biter->curr->up);
    HDassert(biter->curr->context);

    /* Release hold on current location's indirect block */
    if(H5HF_iblock_decr(biter->curr->context) < 0)
        HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block")

    /* Get pointer to location context above this one */
    up_loc = biter->curr->up;

    /* Release this location */
    biter->curr = H5FL_FREE(H5HF_block_loc_t, biter->curr);

    /* Point location to next location up */
    biter->curr = up_loc;

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_man_iter_up() */
예제 #7
0
/*-------------------------------------------------------------------------
 * Function:    H5O_fill_decode
 *
 * Purpose:     Decode a fill value message.
 *
 * Return:      Success:        Ptr to new message in native struct.
 *
 *              Failure:        NULL
 *
 * Programmer:  Robb Matzke
 *              Wednesday, September 30, 1998
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
static void *
H5O_fill_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
{
    H5O_fill_t  *mesg=NULL;
    void        *ret_value;

    FUNC_ENTER_NOAPI_NOINIT(H5O_fill_decode);

    assert(f);
    assert(p);

    if (NULL==(mesg=H5FL_CALLOC(H5O_fill_t)))
        HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message");
    UINT32DECODE(p, mesg->size);
    if (mesg->size>0) {
        if (NULL==(mesg->buf=H5MM_malloc(mesg->size)))
            HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value");
        HDmemcpy(mesg->buf, p, mesg->size);
    }

    /* Set return value */
    ret_value = (void*)mesg;

done:
    if (!ret_value && mesg) {
        if(mesg->buf)
            H5MM_xfree(mesg->buf);
	H5FL_FREE(H5O_fill_t,mesg);
    }

    FUNC_LEAVE_NOAPI(ret_value);
}
예제 #8
0
파일: H5Oainfo.c 프로젝트: aleph7/HDF5Kit
/*-------------------------------------------------------------------------
 * Function:    H5O_ainfo_decode
 *
 * Purpose:     Decode a message and return a pointer to a newly allocated one.
 *
 * Return:      Success:        Ptr to new message in native form.
 *              Failure:        NULL
 *
 * Programmer:  Quincey Koziol
 *              [email protected]
 *              Mar  6 2007
 *
 *-------------------------------------------------------------------------
 */
static void *
H5O_ainfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
    unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
{
    H5O_ainfo_t	*ainfo = NULL;  /* Attribute info */
    unsigned char flags;        /* Flags for encoding attribute info */
    void *ret_value = NULL;     /* Return value */

    FUNC_ENTER_NOAPI_NOINIT

    /* check args */
    HDassert(f);
    HDassert(p);

    /* Version of message */
    if(*p++ != H5O_AINFO_VERSION)
        HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message")

    /* Allocate space for message */
    if(NULL == (ainfo = H5FL_MALLOC(H5O_ainfo_t)))
	HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")

    /* Get the flags for the message */
    flags = *p++;
    if(flags & ~H5O_AINFO_ALL_FLAGS)
        HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad flag value for message")
    ainfo->track_corder = (flags & H5O_AINFO_TRACK_CORDER) ? TRUE : FALSE;
    ainfo->index_corder = (flags & H5O_AINFO_INDEX_CORDER) ? TRUE : FALSE;

    /* Set the number of attributes on the object to an invalid value, so we query it later */
    ainfo->nattrs = HSIZET_MAX;

    /* Max. creation order value for the object */
    if(ainfo->track_corder)
        UINT16DECODE(p, ainfo->max_crt_idx)
    else
        ainfo->max_crt_idx = H5O_MAX_CRT_ORDER_IDX;

    /* Address of fractal heap to store "dense" attributes */
    H5F_addr_decode(f, &p, &(ainfo->fheap_addr));

    /* Address of v2 B-tree to index names of attributes (names are always indexed) */
    H5F_addr_decode(f, &p, &(ainfo->name_bt2_addr));

    /* Address of v2 B-tree to index creation order of links, if there is one */
    if(ainfo->index_corder)
        H5F_addr_decode(f, &p, &(ainfo->corder_bt2_addr));
    else
        ainfo->corder_bt2_addr = HADDR_UNDEF;

    /* Set return value */
    ret_value = ainfo;

done:
    if(ret_value == NULL && ainfo != NULL)
        ainfo = H5FL_FREE(H5O_ainfo_t, ainfo);

    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_ainfo_decode() */
예제 #9
0
파일: H5Oginfo.c 프로젝트: soumagne/hdf5
/*-------------------------------------------------------------------------
 * Function:    H5O_ginfo_decode
 *
 * Purpose:     Decode a message and return a pointer to
 *              a newly allocated one.
 *
 * Return:      Success:        Ptr to new message in native order.
 *
 *              Failure:        NULL
 *
 * Programmer:  Quincey Koziol
 *              [email protected]
 *              Aug 30 2005
 *
 *-------------------------------------------------------------------------
 */
static void *
H5O_ginfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh,
    unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
    size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
    H5O_ginfo_t         *ginfo = NULL;  /* Pointer to group information message */
    unsigned char       flags;          /* Flags for encoding group info */
    void                *ret_value = NULL;      /* Return value */

    FUNC_ENTER_NOAPI_NOINIT

    /* check args */
    HDassert(p);

    /* Version of message */
    if(*p++ != H5O_GINFO_VERSION)
        HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message")

    /* Allocate space for message */
    if(NULL == (ginfo = H5FL_CALLOC(H5O_ginfo_t)))
        HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")

    /* Get the flags for the group */
    flags = *p++;
    if(flags & ~H5O_GINFO_ALL_FLAGS)
        HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad flag value for message")
    ginfo->store_link_phase_change = (flags & H5O_GINFO_STORE_PHASE_CHANGE) ? TRUE : FALSE;
    ginfo->store_est_entry_info = (flags & H5O_GINFO_STORE_EST_ENTRY_INFO) ? TRUE : FALSE;

    /* Get the max. # of links to store compactly & the min. # of links to store densely */
    if(ginfo->store_link_phase_change) {
        UINT16DECODE(p, ginfo->max_compact)
        UINT16DECODE(p, ginfo->min_dense)
    } /* end if */
    else {
        ginfo->max_compact = H5G_CRT_GINFO_MAX_COMPACT;
        ginfo->min_dense = H5G_CRT_GINFO_MIN_DENSE;
    } /* end else */

    /* Get the estimated # of entries & name lengths */
    if(ginfo->store_est_entry_info) {
        UINT16DECODE(p, ginfo->est_num_entries)
        UINT16DECODE(p, ginfo->est_name_len)
    } /* end if */
    else {
        ginfo->est_num_entries = H5G_CRT_GINFO_EST_NUM_ENTRIES;
        ginfo->est_name_len = H5G_CRT_GINFO_EST_NAME_LEN;
    } /* end if */

    /* Set return value */
    ret_value = ginfo;

done:
    if(ret_value == NULL)
        if(ginfo != NULL)
            ginfo = H5FL_FREE(H5O_ginfo_t, ginfo);

    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_ginfo_decode() */
예제 #10
0
파일: H5HP.c 프로젝트: Andy-Sun/VTK
/*--------------------------------------------------------------------------
 NAME
    H5HP_create
 PURPOSE
    Create a heap
 USAGE
    H5HP_t *H5HP_create(heap_type)
        H5HP_type_t heap_type;          IN: Type of heap to create

 RETURNS
    Returns a pointer to a heap on success, NULL on failure.
 DESCRIPTION
    Create a priority queue.  The SIZE is used to set the initial number of
    entries allocated.
 GLOBAL VARIABLES
 COMMENTS, BUGS, ASSUMPTIONS
 EXAMPLES
 REVISION LOG
--------------------------------------------------------------------------*/
H5HP_t *
H5HP_create(H5HP_type_t heap_type)
{
    H5HP_t *new_heap=NULL;      /* Pointer to new heap object created */
    H5HP_t *ret_value;          /* Return value */

    FUNC_ENTER_NOAPI(NULL)

    /* Check args */
    HDassert(heap_type==H5HP_MIN_HEAP || heap_type==H5HP_MAX_HEAP);

    /* Allocate ref-counted string structure */
    if((new_heap=H5FL_MALLOC(H5HP_t))==NULL)
        HGOTO_ERROR(H5E_HEAP,H5E_NOSPACE,NULL,"memory allocation failed");

    /* Allocate the array to store the heap entries */
    if((new_heap->heap = H5FL_SEQ_MALLOC(H5HP_ent_t, (size_t)(H5HP_START_SIZE + 1)))==NULL)
        HGOTO_ERROR(H5E_HEAP,H5E_NOSPACE,NULL,"memory allocation failed");

    /* Set the internal fields */
    new_heap->type=heap_type;
    new_heap->nobjs=0;
    new_heap->nalloc=H5HP_START_SIZE+1;

    /* Set the information in the 0'th location based on the type of heap */
    if(heap_type==H5HP_MIN_HEAP) {
        /* Set the value in the '0' location to be the minimum value, to
         * simplify the algorithms
         */
        new_heap->heap[0].val=INT_MIN;
        new_heap->heap[0].obj=NULL;
    } /* end if */
    else {
        /* Set the value in the '0' location to be the maximum value, to
         * simplify the algorithms
         */
        new_heap->heap[0].val=INT_MAX;
        new_heap->heap[0].obj=NULL;
    } /* end else */

    /* Set the return value */
    ret_value=new_heap;

done:
    /* Error cleanup */
    if(NULL ==ret_value) {
        if(NULL != new_heap) {
            if(NULL != new_heap->heap)
                new_heap->heap = H5FL_SEQ_FREE(H5HP_ent_t, new_heap->heap);
            new_heap = H5FL_FREE(H5HP_t, new_heap);
        } /* end if */
    } /* end if */

    FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_create() */
예제 #11
0
파일: H5Oainfo.c 프로젝트: aleph7/HDF5Kit
/*-------------------------------------------------------------------------
 * Function:	H5O_ainfo_free
 *
 * Purpose:	Free's the message
 *
 * Return:	Non-negative on success/Negative on failure
 *
 * Programmer:	Quincey Koziol
 *              Tuesday, March  6, 2007
 *
 *-------------------------------------------------------------------------
 */
static herr_t
H5O_ainfo_free(void *mesg)
{
    FUNC_ENTER_NOAPI_NOINIT_NOERR

    HDassert(mesg);

    mesg = H5FL_FREE(H5O_ainfo_t, mesg);

    FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_ainfo_free() */
예제 #12
0
/*-------------------------------------------------------------------------
 * Function:	H5O_sdsdpace_free
 *
 * Purpose:	Free's the message
 *
 * Return:	Non-negative on success/Negative on failure
 *
 * Programmer:	Quincey Koziol
 *              Thursday, March 30, 2000
 *
 *-------------------------------------------------------------------------
 */
static herr_t
H5O_sdspace_free(void *mesg)
{
    FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_free)

    HDassert(mesg);

    mesg = H5FL_FREE(H5S_extent_t, mesg);

    FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_sdspace_free() */
예제 #13
0
/*-------------------------------------------------------------------------
 * Function:	H5O_attr_free
 *
 * Purpose:	Free's the message
 *
 * Return:	Non-negative on success/Negative on failure
 *
 * Programmer:	Quincey Koziol
 *              Thursday, November 18, 2004
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
static herr_t
H5O_attr_free (void *mesg)
{
    FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_free);

    assert (mesg);

    H5FL_FREE(H5A_t,mesg);

    FUNC_LEAVE_NOAPI(SUCCEED);
} /* end H5O_attr_free() */
예제 #14
0
파일: H5I.c 프로젝트: gang-liu/paraview
/*-------------------------------------------------------------------------
 * Function:  H5I_remove
 *
 * Purpose:  Removes the specified ID from its group.
 *
 * Return:  Success:  A pointer to the object that was removed, the
 *        same pointer which would have been found by
 *        calling H5I_object().
 *
 *    Failure:  NULL
 *
 * Programmer:
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
void *
H5I_remove(hid_t id)
{
    H5I_id_group_t  *grp_ptr = NULL;/*ptr to the atomic group  */
    H5I_id_info_t  *curr_id;  /*ptr to the current atom  */
    H5I_id_info_t  *last_id;  /*ptr to the last atom    */
    H5I_type_t    grp;    /*atom's atomic group    */
    unsigned    hash_loc;  /*atom's hash table location  */
    void *        ret_value = NULL;  /*return value      */

    FUNC_ENTER_NOAPI(H5I_remove, NULL);

    /* Check arguments */
    grp = H5I_GROUP(id);
    if (grp <= H5I_BADID || grp >= H5I_NGROUPS)
  HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid group number");
    grp_ptr = H5I_id_group_list_g[grp];
    if (grp_ptr == NULL || grp_ptr->count <= 0)
  HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid group");

    /* Get the bucket in which the ID is located */
    hash_loc = (unsigned) H5I_LOC(id, grp_ptr->hash_size);
    curr_id = grp_ptr->id_list[hash_loc];
    if (curr_id == NULL)
  HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "invalid ID");

    last_id = NULL;
    while (curr_id != NULL) {
        if (curr_id->id == id)
            break;
        last_id = curr_id;
        curr_id = curr_id->next;
    }

    if (curr_id != NULL) {
        if (last_id == NULL) {
            /* ID is the first in the chain */
            grp_ptr->id_list[hash_loc] = curr_id->next;
        } else {
            last_id->next = curr_id->next;
        }
        ret_value = curr_id->obj_ptr;
        H5FL_FREE(H5I_id_info_t,curr_id);
    } else {
        /* couldn't find the ID in the proper place */
  HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "invalid ID");
    }

    /* Decrement the number of IDs in the group */
    (grp_ptr->ids)--;

done:
    FUNC_LEAVE_NOAPI(ret_value);
}
예제 #15
0
/*-------------------------------------------------------------------------
 * Function:	H5O_fill_new_decode
 *
 * Purpose:	Decode a new fill value message.  The new fill value
 * 		message is fill value plus space allocation time and
 * 		fill value writing time and whether fill value is defined.
 *
 * Return:	Success:	Ptr to new message in native struct.
 *
 *		Failure:	NULL
 *
 * Programmer:  Raymond Lu
 *              Feb 26, 2002
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
static void *
H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
{
    H5O_fill_new_t	*mesg=NULL;
    int			version;
    void		*ret_value;

    FUNC_ENTER_NOAPI_NOINIT(H5O_fill_new_decode);

    assert(f);
    assert(p);

    if (NULL==(mesg=H5FL_CALLOC(H5O_fill_new_t)))
	HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message");

    /* Version */
    version = *p++;
    if( version != H5O_FILL_VERSION && version !=H5O_FILL_VERSION_2)
        HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for fill value message");

    /* Space allocation time */
    mesg->alloc_time = (H5D_alloc_time_t)*p++;

    /* Fill value write time */
    mesg->fill_time = (H5D_fill_time_t)*p++;

    /* Whether fill value is defined */
    mesg->fill_defined = *p++;

    /* Only decode fill value information if one is defined */
    if(mesg->fill_defined) {
        INT32DECODE(p, mesg->size);
        if (mesg->size>0) {
            H5_CHECK_OVERFLOW(mesg->size,ssize_t,size_t);
            if (NULL==(mesg->buf=H5MM_malloc((size_t)mesg->size)))
                HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value");
            HDmemcpy(mesg->buf, p, (size_t)mesg->size);
        }
    } /* end if */
    else
        mesg->size=(-1);

    /* Set return value */
    ret_value = (void*)mesg;

done:
    if (!ret_value && mesg) {
        if(mesg->buf)
            H5MM_xfree(mesg->buf);
	H5FL_FREE(H5O_fill_new_t,mesg);
    }

    FUNC_LEAVE_NOAPI(ret_value);
}
예제 #16
0
파일: H5RC.c 프로젝트: chaako/sceptic3D
/*--------------------------------------------------------------------------
 NAME
    H5RC_decr
 PURPOSE
    Decrement the reference count for a ref-counted object
 USAGE
    herr_t H5RC_decr(rc)
        H5RC_t *rc;             IN: Ref-counted object to decrement count for

 RETURNS
    SUCCEED/FAIL
 DESCRIPTION
    Decrements the reference count for a ref-counted object, calling the
    object's free function if ref-count drops to zero.
 GLOBAL VARIABLES
 COMMENTS, BUGS, ASSUMPTIONS
 EXAMPLES
 REVISION LOG
--------------------------------------------------------------------------*/
herr_t
H5RC_decr(H5RC_t *rc)
{
    herr_t ret_value = SUCCEED;   /* Return value */

    FUNC_ENTER_NOAPI(H5RC_decr, FAIL)

    /* Sanity check */
    HDassert(rc);
    HDassert(rc->o);
    HDassert(rc->n > 0);
    HDassert(rc->free_func);

    /* Decrement reference count */
    rc->n--;

    /* Check if we should delete this object now */
    if(rc->n == 0) {
        if((rc->free_func)(rc->o) < 0) {
            (void)H5FL_FREE(H5RC_t, rc);
            HGOTO_ERROR(H5E_RS, H5E_CANTFREE, FAIL, "memory release failed")
        } /* end if */
        (void)H5FL_FREE(H5RC_t, rc);
    } /* end if */
예제 #17
0
파일: H5SMbtree2.c 프로젝트: zlongshen/hdf5
/*-------------------------------------------------------------------------
 * Function:	H5SM__bt2_dst_context
 *
 * Purpose:	Destroy client callback context
 *
 * Return:	Success:	non-negative
 *		Failure:	negative
 *
 * Programmer:	Quincey Koziol
 *              Thursday, November 26, 2009
 *
 *-------------------------------------------------------------------------
 */
static herr_t
H5SM__bt2_dst_context(void *_ctx)
{
    H5SM_bt2_ctx_t *ctx = (H5SM_bt2_ctx_t *)_ctx;       /* Callback context structure */

    FUNC_ENTER_STATIC_NOERR

    /* Sanity check */
    HDassert(ctx);

    /* Release callback context */
    ctx = H5FL_FREE(H5SM_bt2_ctx_t, ctx);

    FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5SM__bt2_dst_context() */
예제 #18
0
파일: H5Oainfo.c 프로젝트: aleph7/HDF5Kit
/*-------------------------------------------------------------------------
 * Function:    H5O_ainfo_copy_file
 *
 * Purpose:     Copies a message from _MESG to _DEST in file
 *
 * Return:      Success:        Ptr to _DEST
 *              Failure:        NULL
 *
 * Programmer:  Peter Cao
 *              July 18, 2007
 *
 *-------------------------------------------------------------------------
 */
static void *
H5O_ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
    hbool_t H5_ATTR_UNUSED *recompute_size, unsigned H5_ATTR_UNUSED *mesg_flags,
    H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata, hid_t dxpl_id)
{
    H5O_ainfo_t *ainfo_src = (H5O_ainfo_t *)mesg_src;
    H5O_ainfo_t *ainfo_dst = NULL;
    void *ret_value = NULL;     /* Return value */

    FUNC_ENTER_NOAPI_NOINIT

    /* check args */
    HDassert(file_src);
    HDassert(ainfo_src);
    HDassert(file_dst);
    HDassert(cpy_info);
    HDassert(!cpy_info->copy_without_attr);

    /* Allocate space for the destination message */
    if(NULL == (ainfo_dst = H5FL_MALLOC(H5O_ainfo_t)))
        HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")

    /* Copy the top level of the information */
    *ainfo_dst = *ainfo_src;

    if(H5F_addr_defined(ainfo_src->fheap_addr)) {
        /* Prepare to copy dense attributes - actual copy in post_copy */

        /* Set copied metadata tag */
        H5_BEGIN_TAG(dxpl_id, H5AC__COPIED_TAG, NULL);

        if(H5A_dense_create(file_dst, dxpl_id, ainfo_dst) < 0)
            HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes")

        /* Reset metadata tag */
        H5_END_TAG(NULL);
    } /* end if */

    /* Set return value */
    ret_value = ainfo_dst;

done:
    /* Release destination attribute information on failure */
    if(!ret_value && ainfo_dst)
        ainfo_dst = H5FL_FREE(H5O_ainfo_t, ainfo_dst);

    FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_ainfo_copy_file() */
/*-------------------------------------------------------------------------
 * Function:	H5HF_man_iter_reset
 *
 * Purpose:	Reset a block iterator to it's initial state, freeing any
 *              location context it currently has
 *
 * Return:	SUCCEED/FAIL
 *
 * Programmer:	Quincey Koziol
 *		[email protected]
 *		Apr 24 2006
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5HF_man_iter_reset(H5HF_block_iter_t *biter)
{
    herr_t ret_value = SUCCEED;         /* Return value */

    FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iter_reset)

    /*
     * Check arguments.
     */
    HDassert(biter);

    /* Free any location contexts that exist */
    if(biter->curr) {
        H5HF_block_loc_t *curr_loc;      /* Pointer to current block location */
        H5HF_block_loc_t *next_loc;      /* Pointer to next block location */

        /* Free location contexts */
        curr_loc = biter->curr;
        while(curr_loc) {
            /* Get pointer to next node */
            next_loc = curr_loc->up;

            /* If this node is holding an indirect block, release the block */
            if(curr_loc->context)
                if(H5HF_iblock_decr(curr_loc->context) < 0)
                    HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block")

            /* Free the current location context */
            curr_loc = H5FL_FREE(H5HF_block_loc_t, curr_loc);

            /* Advance to next location */
            curr_loc = next_loc;
        } /* end while */

        /* Reset top location context */
        biter->curr = NULL;
    } /* end if */

    /* Reset block iterator flags */
    biter->ready = FALSE;

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_man_iter_reset() */
예제 #20
0
파일: H5Ochunk.c 프로젝트: aleph7/HDF5Kit
/*-------------------------------------------------------------------------
 * Function:	H5O_chunk_add
 *
 * Purpose:	Add new chunk for object header to metadata cache
 *
 * Return:	Success:	Non-negative
 *		Failure:	Negative
 *
 * Programmer:	Quincey Koziol
 *		[email protected]
 *		Jul 13 2008
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5O_chunk_add(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
    unsigned cont_chunkno)
{
    H5O_chunk_proxy_t *chk_proxy = NULL;        /* Proxy for chunk, to mark it dirty in the cache */
    herr_t ret_value = SUCCEED;         /* Return value */

    FUNC_ENTER_NOAPI_TAG(dxpl_id, oh->cache_info.addr, FAIL)

    /* check args */
    HDassert(f);
    HDassert(oh);
    HDassert(idx < oh->nchunks);
    HDassert(idx > 0);

    /* Allocate space for the object header data structure */
    if(NULL == (chk_proxy = H5FL_CALLOC(H5O_chunk_proxy_t)))
	HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")

    /* Set the values in the chunk proxy */
    chk_proxy->f = f;
    chk_proxy->oh = oh;
    chk_proxy->chunkno = idx;
    chk_proxy->cont_chunkno = cont_chunkno;

    chk_proxy->fd_parent_addr = HADDR_UNDEF;
    chk_proxy->fd_parent_ptr = NULL;

    /* Increment reference count on object header */
    if(H5O_inc_rc(oh) < 0)
        HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "can't increment reference count on object header")

    /* Insert the chunk proxy into the cache */
    if(H5AC_insert_entry(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0)
        HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header chunk")

    chk_proxy = NULL;

done:
    if(ret_value < 0)
        if(chk_proxy)
            chk_proxy = H5FL_FREE(H5O_chunk_proxy_t, chk_proxy);

    FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
} /* end H5O_chunk_add() */
/*-------------------------------------------------------------------------
 * Function:	H5HF_man_iter_start_entry
 *
 * Purpose:	Initialize a block iterator to a particular location within
 *              an indirect block
 *
 * Return:	SUCCEED/FAIL
 *
 * Programmer:	Quincey Koziol
 *		[email protected]
 *		Apr 24 2006
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5HF_man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter,
    H5HF_indirect_t *iblock, unsigned start_entry)
{
    H5HF_block_loc_t *new_loc = NULL;   /* Pointer to new block location */
    herr_t ret_value = SUCCEED;         /* Return value */

    FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iter_start_entry)

    /*
     * Check arguments.
     */
    HDassert(hdr);
    HDassert(biter);
    HDassert(!biter->ready);
    HDassert(iblock);

    /* Create new location for iterator */
    if(NULL == (new_loc = H5FL_MALLOC(H5HF_block_loc_t)))
        HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct block free list section")

    /* Set up location context */
    new_loc->entry = start_entry;
    new_loc->row = start_entry / hdr->man_dtable.cparam.width;
    new_loc->col = start_entry % hdr->man_dtable.cparam.width;
    new_loc->context = iblock;
    new_loc->up = NULL;

    /* Increment reference count on indirect block */
    if(H5HF_iblock_incr(new_loc->context) < 0)
        HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block")

    /* Make new location the current location */
    biter->curr = new_loc;

    /* Set flag to indicate block iterator finished initializing */
    biter->ready = TRUE;

done:
    if(ret_value < 0 && new_loc)
        new_loc = H5FL_FREE(H5HF_block_loc_t, new_loc);

    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_man_iter_start_entry() */
예제 #22
0
파일: H5Olayout.c 프로젝트: 151706061/ITK
/*-------------------------------------------------------------------------
 * Function:	H5O_layout_free
 *
 * Purpose:	Free's the message
 *
 * Return:	Non-negative on success/Negative on failure
 *
 * Programmer:	Quincey Koziol
 *              Saturday, March 11, 2000
 *
 *-------------------------------------------------------------------------
 */
static herr_t
H5O_layout_free(void *_mesg)
{
    H5O_layout_t     *mesg = (H5O_layout_t *) _mesg;
    herr_t ret_value = SUCCEED;         /* Return value */

    FUNC_ENTER_NOAPI_NOINIT(H5O_layout_free)

    HDassert(mesg);

    /* Free resources within the message */
    if(H5O_layout_reset(mesg) < 0)
        HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free message resources")

    mesg = H5FL_FREE(H5O_layout_t, mesg);

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_layout_free() */
예제 #23
0
파일: H5Olayout.c 프로젝트: 151706061/ITK
/*-------------------------------------------------------------------------
 * Function:    H5O_layout_copy
 *
 * Purpose:     Copies a message from _MESG to _DEST, allocating _DEST if
 *              necessary.
 *
 * Return:      Success:        Ptr to _DEST
 *
 *              Failure:        NULL
 *
 * Programmer:  Robb Matzke
 *              Wednesday, October  8, 1997
 *
 *-------------------------------------------------------------------------
 */
static void *
H5O_layout_copy(const void *_mesg, void *_dest)
{
    const H5O_layout_t     *mesg = (const H5O_layout_t *) _mesg;
    H5O_layout_t           *dest = (H5O_layout_t *) _dest;
    void                   *ret_value;          /* Return value */

    FUNC_ENTER_NOAPI_NOINIT(H5O_layout_copy)

    /* check args */
    HDassert(mesg);

    /* Allocate destination message, if necessary */
    if(!dest && NULL == (dest = H5FL_MALLOC(H5O_layout_t)))
        HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "layout message allocation failed")

    /* copy */
    *dest = *mesg;

    /* Deep copy the buffer for compact datasets also */
    if(mesg->type == H5D_COMPACT && mesg->storage.u.compact.size > 0) {
        /* Allocate memory for the raw data */
        if(NULL == (dest->storage.u.compact.buf = H5MM_malloc(dest->storage.u.compact.size)))
            HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset")

        /* Copy over the raw data */
        HDmemcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size);
    } /* end if */

    /* Reset the pointer of the chunked storage index but not the address */
    if(dest->type == H5D_CHUNKED && dest->storage.u.chunk.ops)
	H5D_chunk_idx_reset(&dest->storage.u.chunk, FALSE);

    /* Set return value */
    ret_value = dest;

done:
    if(ret_value == NULL)
        if(NULL == _dest)
            dest = H5FL_FREE(H5O_layout_t, dest);

    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_layout_copy() */
/*-------------------------------------------------------------------------
 * Function:	H5HF_man_iter_down
 *
 * Purpose:	Move iterator down one level
 *
 * Return:	SUCCEED/FAIL
 *
 * Programmer:	Quincey Koziol
 *		[email protected]
 *		Apr 24 2006
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5HF_man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock)
{
    H5HF_block_loc_t *down_loc = NULL;  /* Pointer to new 'down' block location */
    herr_t ret_value = SUCCEED;         /* Return value */

    FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iter_down)

    /*
     * Check arguments.
     */
    HDassert(biter);
    HDassert(biter->ready);
    HDassert(biter->curr);
    HDassert(biter->curr->context);

    /* Create new location to move down to */
    if(NULL == (down_loc = H5FL_MALLOC(H5HF_block_loc_t)))
        HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct block free list section")

    /* Initialize down location */
    down_loc->row = 0;
    down_loc->col = 0;
    down_loc->entry = 0;
    down_loc->context = iblock;
    down_loc->up = biter->curr;

    /* Increment reference count on indirect block */
    if(H5HF_iblock_incr(down_loc->context) < 0)
        HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block")

    /* Make down location the current location */
    biter->curr = down_loc;

done:
    if(ret_value < 0 && down_loc)
        down_loc = H5FL_FREE(H5HF_block_loc_t, down_loc);

    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_man_iter_down() */
예제 #25
0
파일: H5MP.c 프로젝트: ekjstm/permafrost
/*-------------------------------------------------------------------------
 * Function:	H5MP_close
 *
 * Purpose:	Release all memory for a pool and destroy pool
 *
 * Return:	Non-negative on success/negative on failure
 *
 * Programmer:	Quincey Koziol
 *		[email protected]
 *		May  3 2005
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5MP_close (H5MP_pool_t *mp)
{
    herr_t ret_value = SUCCEED;         /* Return value */

    FUNC_ENTER_NOAPI(H5MP_close, FAIL)

    /* Release memory for pool pages */
    if(mp->first != NULL) {
        H5MP_page_t *page, *next_page;  /* Pointer to pages in pool */

        /* Iterate through pages, releasing them */
        page = mp->first;
        while(page) {
            next_page = page->next;

            /* Free the page appropriately */
            if(page->fac_alloc)
                H5FL_FAC_FREE(mp->page_fac,page);
            else
                H5MM_xfree(page);

            page = next_page;
        } /* end while */
    } /* end if */

    /* Release page factory */
    if(mp->page_fac)
        if(H5FL_fac_term(mp->page_fac)<0)
            HGOTO_ERROR (H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy page factory")

    /* Free the memory pool itself */
    H5FL_FREE(H5MP_pool_t, mp);

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MP_close() */
예제 #26
0
파일: H5Gint.c 프로젝트: zlongshen/hdf5
/*-------------------------------------------------------------------------
 * Function:	H5G_open
 *
 * Purpose:	Opens an existing group.  The group should eventually be
 *		closed by calling H5G_close().
 *
 * Return:	Success:	Ptr to a new group.
 *
 *		Failure:	NULL
 *
 * Programmer:	Robb Matzke
 *		Monday, January	 5, 1998
 *
 *-------------------------------------------------------------------------
 */
H5G_t *
H5G_open(const H5G_loc_t *loc, hid_t dxpl_id)
{
    H5G_t           *grp = NULL;        /* Group opened */
    H5G_shared_t    *shared_fo;         /* Shared group object */
    H5G_t *ret_value = NULL;            /* Return value */

    FUNC_ENTER_NOAPI(NULL)

    /* Check args */
    HDassert(loc);

    /* Allocate the group structure */
    if(NULL == (grp = H5FL_CALLOC(H5G_t)))
        HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for group")

    /* Shallow copy (take ownership) of the group location object */
    if(H5O_loc_copy(&(grp->oloc), loc->oloc, H5_COPY_SHALLOW) < 0)
        HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "can't copy object location")
    if(H5G_name_copy(&(grp->path), loc->path, H5_COPY_SHALLOW) < 0)
        HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "can't copy path")

    /* Check if group was already open */
    if((shared_fo = (H5G_shared_t *)H5FO_opened(grp->oloc.file, grp->oloc.addr)) == NULL) {

        /* Clear any errors from H5FO_opened() */
        H5E_clear_stack(NULL);

        /* Open the group object */
        if(H5G_open_oid(grp, dxpl_id) < 0)
            HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "not found")

        /* Add group to list of open objects in file */
        if(H5FO_insert(grp->oloc.file, grp->oloc.addr, grp->shared, FALSE) < 0) {
            grp->shared = H5FL_FREE(H5G_shared_t, grp->shared);
            HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, NULL, "can't insert group into list of open objects")
        } /* end if */
예제 #27
0
파일: H5HP.c 프로젝트: Andy-Sun/VTK
/*--------------------------------------------------------------------------
 NAME
    H5HP_close
 PURPOSE
    Close a heap, deallocating it.
 USAGE
    herr_t H5HP_close(heap)
        H5HP_t *heap;            IN/OUT: Pointer to heap to close

 RETURNS
    Returns non-negative on success, negative on failure.
 DESCRIPTION
    Close a heap, freeing all internal information.  Any objects left in
    the heap are not deallocated.
 GLOBAL VARIABLES
 COMMENTS, BUGS, ASSUMPTIONS
 EXAMPLES
 REVISION LOG
--------------------------------------------------------------------------*/
herr_t
H5HP_close(H5HP_t *heap)
{
    FUNC_ENTER_NOAPI_NOINIT_NOERR

    /* Check args */
    HDassert(heap);

    /* Check internal consistency */
    /* (Pre-condition) */
    HDassert(heap->nobjs < heap->nalloc);
    HDassert(heap->heap);
    HDassert((heap->type == H5HP_MAX_HEAP && heap->heap[0].val == INT_MAX) ||
        (heap->type == H5HP_MIN_HEAP && heap->heap[0].val == INT_MIN));
    HDassert(NULL == heap->heap[0].obj);

    /* Free internal structures for heap */
    heap->heap = H5FL_SEQ_FREE(H5HP_ent_t, heap->heap);

    /* Free actual heap object */
    heap = H5FL_FREE(H5HP_t, heap);

    FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HP_close() */
예제 #28
0
/*-------------------------------------------------------------------------
 * Function:	H5TN_init_interface
 *
 * Purpose:	Initialize pre-defined native datatypes from code generated
 *              during the library configuration by H5detect.
 *
 * Return:	Success:	non-negative
 *		Failure:	negative
 *
 * Programmer:	Robb Matzke
 *              Wednesday, December 16, 1998
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5TN_init_interface(void)
{
    H5T_t	*dt = NULL;
    herr_t	ret_value = SUCCEED;

    FUNC_ENTER_NOAPI(FAIL)

   /*
    *    0
    * IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 1;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 8;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_SCHAR_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_SCHAR_ALIGN_g = 1;
    H5T_NATIVE_SCHAR_COMP_ALIGN_g = 1;

   /*
    *    0
    * UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 1;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 8;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_UCHAR_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_UCHAR_ALIGN_g = 1;

   /*
    *    1        0
    * IIIIIIII IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 2;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 16;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_SHORT_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_SHORT_ALIGN_g = 1;
    H5T_NATIVE_SHORT_COMP_ALIGN_g = 2;

   /*
    *    1        0
    * UUUUUUUU UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 2;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 16;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_USHORT_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_USHORT_ALIGN_g = 1;

   /*
    *    3        2        1        0
    * IIIIIIII IIIIIIII IIIIIIII IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 4;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 32;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_INT_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_INT_ALIGN_g = 1;
    H5T_NATIVE_INT_COMP_ALIGN_g = 4;

   /*
    *    3        2        1        0
    * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 4;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 32;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_UINT_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_UINT_ALIGN_g = 1;

   /*
    *    3        2        1        0
    * IIIIIIII IIIIIIII IIIIIIII IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 4;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 32;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_LONG_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_LONG_ALIGN_g = 1;
    H5T_NATIVE_LONG_COMP_ALIGN_g = 4;

   /*
    *    3        2        1        0
    * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 4;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 32;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_ULONG_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_ULONG_ALIGN_g = 1;

   /*
    *    0
    * IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 1;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 8;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_INT8_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_INT8_ALIGN_g = 1;

   /*
    *    0
    * UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 1;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 8;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_UINT8_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_UINT8_ALIGN_g = 1;

   /*
    *    0
    * IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 1;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 8;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_INT_LEAST8_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_INT_LEAST8_ALIGN_g = 1;

   /*
    *    0
    * UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 1;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 8;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_UINT_LEAST8_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_UINT_LEAST8_ALIGN_g = 1;

   /*
    *    0
    * IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 1;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 8;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_INT_FAST8_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_INT_FAST8_ALIGN_g = 1;

   /*
    *    0
    * UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 1;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 8;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_UINT_FAST8_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_UINT_FAST8_ALIGN_g = 1;

   /*
    *    1        0
    * IIIIIIII IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 2;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 16;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_INT16_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_INT16_ALIGN_g = 1;

   /*
    *    1        0
    * UUUUUUUU UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 2;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 16;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_UINT16_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_UINT16_ALIGN_g = 1;

   /*
    *    1        0
    * IIIIIIII IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 2;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 16;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_INT_LEAST16_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_INT_LEAST16_ALIGN_g = 1;

   /*
    *    1        0
    * UUUUUUUU UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 2;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 16;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_UINT_LEAST16_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_UINT_LEAST16_ALIGN_g = 1;

   /*
    *    3        2        1        0
    * IIIIIIII IIIIIIII IIIIIIII IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 4;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 32;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_INT_FAST16_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_INT_FAST16_ALIGN_g = 1;

   /*
    *    3        2        1        0
    * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 4;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 32;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_UINT_FAST16_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_UINT_FAST16_ALIGN_g = 1;

   /*
    *    3        2        1        0
    * IIIIIIII IIIIIIII IIIIIIII IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 4;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 32;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_INT32_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_INT32_ALIGN_g = 1;

   /*
    *    3        2        1        0
    * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 4;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 32;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_UINT32_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_UINT32_ALIGN_g = 1;

   /*
    *    3        2        1        0
    * IIIIIIII IIIIIIII IIIIIIII IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 4;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 32;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_INT_LEAST32_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_INT_LEAST32_ALIGN_g = 1;

   /*
    *    3        2        1        0
    * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 4;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 32;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_UINT_LEAST32_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_UINT_LEAST32_ALIGN_g = 1;

   /*
    *    3        2        1        0
    * IIIIIIII IIIIIIII IIIIIIII IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 4;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 32;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_INT_FAST32_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_INT_FAST32_ALIGN_g = 1;

   /*
    *    3        2        1        0
    * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 4;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 32;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_UINT_FAST32_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_UINT_FAST32_ALIGN_g = 1;

   /*
    *    7        6        5        4
    * IIIIIIII IIIIIIII IIIIIIII IIIIIIII
    *    3        2        1        0
    * IIIIIIII IIIIIIII IIIIIIII IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 8;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 64;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_INT64_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_INT64_ALIGN_g = 1;

   /*
    *    7        6        5        4
    * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU
    *    3        2        1        0
    * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 8;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 64;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_UINT64_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_UINT64_ALIGN_g = 1;

   /*
    *    7        6        5        4
    * IIIIIIII IIIIIIII IIIIIIII IIIIIIII
    *    3        2        1        0
    * IIIIIIII IIIIIIII IIIIIIII IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 8;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 64;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_INT_LEAST64_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_INT_LEAST64_ALIGN_g = 1;

   /*
    *    7        6        5        4
    * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU
    *    3        2        1        0
    * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 8;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 64;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_UINT_LEAST64_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_UINT_LEAST64_ALIGN_g = 1;

   /*
    *    7        6        5        4
    * IIIIIIII IIIIIIII IIIIIIII IIIIIIII
    *    3        2        1        0
    * IIIIIIII IIIIIIII IIIIIIII IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 8;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 64;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_INT_FAST64_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_INT_FAST64_ALIGN_g = 1;

   /*
    *    7        6        5        4
    * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU
    *    3        2        1        0
    * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 8;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 64;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_UINT_FAST64_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_UINT_FAST64_ALIGN_g = 1;

   /*
    *    7        6        5        4
    * IIIIIIII IIIIIIII IIIIIIII IIIIIIII
    *    3        2        1        0
    * IIIIIIII IIIIIIII IIIIIIII IIIIIIII
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 8;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 64;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_2;
    if((H5T_NATIVE_LLONG_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_LLONG_ALIGN_g = 1;
    H5T_NATIVE_LLONG_COMP_ALIGN_g = 4;

   /*
    *    7        6        5        4
    * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU
    *    3        2        1        0
    * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_INTEGER;
    dt->shared->size = 8;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 64;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE;
    if((H5T_NATIVE_ULLONG_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_ULLONG_ALIGN_g = 1;

   /*
    *    3        2        1        0
    * SEEEEEEE EMMMMMMM MMMMMMMM MMMMMMMM
    * Implicit bit? yes
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_FLOAT;
    dt->shared->size = 4;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 32;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.f.sign = 31;
    dt->shared->u.atomic.u.f.epos = 23;
    dt->shared->u.atomic.u.f.esize = 8;
    dt->shared->u.atomic.u.f.ebias = 0x0000007f;
    dt->shared->u.atomic.u.f.mpos = 0;
    dt->shared->u.atomic.u.f.msize = 23;
    dt->shared->u.atomic.u.f.norm = H5T_NORM_IMPLIED;
    dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO;
    if((H5T_NATIVE_FLOAT_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_FLOAT_ALIGN_g = 1;
    H5T_NATIVE_FLOAT_COMP_ALIGN_g = 4;

   /*
    *    7        6        5        4
    * SEEEEEEE EEEEMMMM MMMMMMMM MMMMMMMM
    *    3        2        1        0
    * MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM
    * Implicit bit? yes
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_FLOAT;
    dt->shared->size = 8;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 64;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.f.sign = 63;
    dt->shared->u.atomic.u.f.epos = 52;
    dt->shared->u.atomic.u.f.esize = 11;
    dt->shared->u.atomic.u.f.ebias = 0x000003ff;
    dt->shared->u.atomic.u.f.mpos = 0;
    dt->shared->u.atomic.u.f.msize = 52;
    dt->shared->u.atomic.u.f.norm = H5T_NORM_IMPLIED;
    dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO;
    if((H5T_NATIVE_DOUBLE_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_DOUBLE_ALIGN_g = 1;
    H5T_NATIVE_DOUBLE_COMP_ALIGN_g = 4;

   /*
    *   11       10        9        8
    * ???????? ???????? SEEEEEEE EEEEEEEE
    *    7        6        5        4
    * MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM
    *    3        2        1        0
    * MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM
    * Implicit bit? no
    * Alignment: none
    */
    if(NULL == (dt = H5T__alloc()))
        HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed")
    dt->shared->state = H5T_STATE_IMMUTABLE;
    dt->shared->type = H5T_FLOAT;
    dt->shared->size = 12;
    dt->shared->u.atomic.order = H5T_ORDER_LE;
    dt->shared->u.atomic.offset = 0;
    dt->shared->u.atomic.prec = 80;
    dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
    dt->shared->u.atomic.u.f.sign = 79;
    dt->shared->u.atomic.u.f.epos = 64;
    dt->shared->u.atomic.u.f.esize = 15;
    dt->shared->u.atomic.u.f.ebias = 0x00003fff;
    dt->shared->u.atomic.u.f.mpos = 0;
    dt->shared->u.atomic.u.f.msize = 64;
    dt->shared->u.atomic.u.f.norm = H5T_NORM_NONE;
    dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO;
    if((H5T_NATIVE_LDOUBLE_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)
        HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype")
    H5T_NATIVE_LDOUBLE_ALIGN_g = 1;
    H5T_NATIVE_LDOUBLE_COMP_ALIGN_g = 4;

    /* Set the native order for this machine */
    H5T_native_order_g = H5T_ORDER_LE;

    /* Structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */
    H5T_POINTER_COMP_ALIGN_g = 4;
    H5T_HVL_COMP_ALIGN_g = 4;
    H5T_HOBJREF_COMP_ALIGN_g = 4;
    H5T_HDSETREGREF_COMP_ALIGN_g = 1;

done:
    if(ret_value < 0) {
        if(dt != NULL) {
            dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
            dt = H5FL_FREE(H5T_t, dt);
        } /* end if */
    } /* end if */

    FUNC_LEAVE_NOAPI(ret_value);
} /* end H5TN_init_interface() */
예제 #29
0
파일: H5HLint.c 프로젝트: 151706061/ITK
    FUNC_ENTER_NOAPI(H5HL_dblk_dest, FAIL)

    /* check arguments */
    HDassert(dblk);

    /* Check if data block was initialized */
    if(dblk->heap) {
        /* Unlink data block from heap */
        dblk->heap->dblk = NULL;

        /* Unpin the local heap prefix */
        if(H5AC_unpin_entry(dblk->heap->prfx) < 0)
            HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "can't unpin local heap prefix")

        /* Decrement ref. count on heap data structure */
        if(H5HL_dec_rc(dblk->heap) < 0)
            HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count")

        /* Unlink heap from data block */
        dblk->heap = NULL;
    } /* end if */

    /* Free local heap data block */
    dblk = H5FL_FREE(H5HL_dblk_t, dblk);

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_dblk_dest() */

예제 #30
0
파일: H5Olayout.c 프로젝트: 151706061/ITK
/*-------------------------------------------------------------------------
 * Function:    H5O_layout_decode
 *
 * Purpose:     Decode an data layout message and return a pointer to a
 *              new one created with malloc().
 *
 * Return:      Success:        Ptr to new message in native order.
 *
 *              Failure:        NULL
 *
 * Programmer:  Robb Matzke
 *              Wednesday, October  8, 1997
 *
 *-------------------------------------------------------------------------
 */
static void *
H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
    unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p)
{
    H5O_layout_t           *mesg = NULL;
    unsigned               u;
    void                   *ret_value;          /* Return value */

    FUNC_ENTER_NOAPI_NOINIT(H5O_layout_decode)

    /* check args */
    HDassert(f);
    HDassert(p);

    /* decode */
    if(NULL == (mesg = H5FL_CALLOC(H5O_layout_t)))
        HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")

    mesg->version = *p++;
    if(mesg->version < H5O_LAYOUT_VERSION_1 || mesg->version > H5O_LAYOUT_VERSION_3)
        HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for layout message")

    if(mesg->version < H5O_LAYOUT_VERSION_3) {
        unsigned	ndims;			/* Num dimensions in chunk           */

        /* Dimensionality */
        ndims = *p++;
        if(ndims > H5O_LAYOUT_NDIMS)
            HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is too large")

        /* Layout class */
        mesg->type = (H5D_layout_t)*p++;
        assert(H5D_CONTIGUOUS == mesg->type || H5D_CHUNKED == mesg->type || H5D_COMPACT == mesg->type);

        /* Reserved bytes */
        p += 5;

        /* Address */
        if(mesg->type == H5D_CONTIGUOUS) {
            H5F_addr_decode(f, &p, &(mesg->storage.u.contig.addr));

            /* Set the layout operations */
            mesg->ops = H5D_LOPS_CONTIG;
        } /* end if */
        else if(mesg->type == H5D_CHUNKED) {
            H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr));

            /* Set the layout operations */
            mesg->ops = H5D_LOPS_CHUNK;

            /* Set the chunk operations */
            /* (Only "btree" indexing type currently supported in this version) */
            mesg->storage.u.chunk.idx_type = H5D_CHUNK_BTREE;
            mesg->storage.u.chunk.ops = H5D_COPS_BTREE;
        } /* end if */
        else {
            /* Sanity check */
            HDassert(mesg->type == H5D_COMPACT);

            /* Set the layout operations */
            mesg->ops = H5D_LOPS_COMPACT;
        } /* end else */

        /* Read the size */
        if(mesg->type != H5D_CHUNKED) {
            /* Don't compute size of contiguous storage here, due to possible
             * truncation of the dimension sizes when they were stored in this
             * version of the layout message.  Compute the contiguous storage
             * size in the dataset code, where we've got the dataspace
             * information available also.  - QAK 5/26/04
             */
            p += ndims * 4;     /* Skip over dimension sizes (32-bit quantities) */
        } /* end if */
        else {
            mesg->u.chunk.ndims=ndims;
            for(u = 0; u < ndims; u++)
                UINT32DECODE(p, mesg->u.chunk.dim[u]);

            /* Compute chunk size */
            for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < ndims; u++)
                mesg->u.chunk.size *= mesg->u.chunk.dim[u];
        } /* end if */

        if(mesg->type == H5D_COMPACT) {
            UINT32DECODE(p, mesg->storage.u.compact.size);
            if(mesg->storage.u.compact.size > 0) {
                if(NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size)))
                    HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer")
                HDmemcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size);
                p += mesg->storage.u.compact.size;
            } /* end if */
        } /* end if */
    } /* end if */
    else {
        /* Layout class */
        mesg->type = (H5D_layout_t)*p++;

        /* Interpret the rest of the message according to the layout class */
        switch(mesg->type) {
            case H5D_COMPACT:
                UINT16DECODE(p, mesg->storage.u.compact.size);
                if(mesg->storage.u.compact.size > 0) {
                    if(NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size)))
                        HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer")
                    HDmemcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size);
                    p += mesg->storage.u.compact.size;
                } /* end if */

                /* Set the layout operations */
                mesg->ops = H5D_LOPS_COMPACT;
                break;

            case H5D_CONTIGUOUS:
                H5F_addr_decode(f, &p, &(mesg->storage.u.contig.addr));
                H5F_DECODE_LENGTH(f, p, mesg->storage.u.contig.size);

                /* Set the layout operations */
                mesg->ops = H5D_LOPS_CONTIG;
                break;

            case H5D_CHUNKED:
                /* Dimensionality */
                mesg->u.chunk.ndims = *p++;
                if(mesg->u.chunk.ndims > H5O_LAYOUT_NDIMS)
                    HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is too large")

                /* B-tree address */
                H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr));

                /* Chunk dimensions */
                for(u = 0; u < mesg->u.chunk.ndims; u++)
                    UINT32DECODE(p, mesg->u.chunk.dim[u]);

                /* Compute chunk size */
                for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++)
                    mesg->u.chunk.size *= mesg->u.chunk.dim[u];

                /* Set the chunk operations */
                /* (Only "btree" indexing type supported with v3 of message format) */
                mesg->storage.u.chunk.idx_type = H5D_CHUNK_BTREE;
                mesg->storage.u.chunk.ops = H5D_COPS_BTREE;

                /* Set the layout operations */
                mesg->ops = H5D_LOPS_CHUNK;
                break;

            default:
                HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class")
        } /* end switch */
    } /* end else */

    /* Set return value */
    ret_value = mesg;

done:
    if(ret_value == NULL)
        if(mesg)
            mesg = H5FL_FREE(H5O_layout_t, mesg);

    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_layout_decode() */