Skip to content

Commit

Permalink
Merge remote-tracking branch 'canonical/develop' into float16_config_…
Browse files Browse the repository at this point in the history
…checks_revise
  • Loading branch information
lrknox committed Apr 4, 2024
2 parents abe0a7a + 3424bc9 commit 22f121d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
13 changes: 9 additions & 4 deletions src/H5Gent.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,19 +365,24 @@ H5G__ent_to_link(const H5G_entry_t *ent, const H5HL_t *heap, H5O_link_t *lnk)
assert(heap);
assert(lnk);

/* Initialize structure and set (default) common info for link */
lnk->type = H5L_TYPE_ERROR;
lnk->corder_valid = false; /* Creation order not valid for this link */
lnk->corder = 0;
lnk->cset = H5F_DEFAULT_CSET;
lnk->name = NULL;

/* Get the size of the heap block */
block_size = H5HL_heap_get_size(heap);

/* Get pointer to link's name in the heap */
if (NULL == (name = (const char *)H5HL_offset_into(heap, ent->name_off)))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table link name");

/* Set (default) common info for link */
lnk->cset = H5F_DEFAULT_CSET;
lnk->corder = 0;
lnk->corder_valid = false; /* Creation order not valid for this link */
if (NULL == (lnk->name = H5MM_strndup(name, (block_size - ent->name_off))))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to duplicate link name");
if (!*lnk->name)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "invalid link name");

/* Object is a symbolic or hard link */
if (ent->type == H5G_CACHED_SLINK) {
Expand Down
5 changes: 4 additions & 1 deletion src/H5Gloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,12 @@ H5G_loc_find(const H5G_loc_t *loc, const char *name, H5G_loc_t *obj_loc /*out*/)

/* Check args. */
assert(loc);
assert(name && *name);
assert(name);
assert(obj_loc);

if (!*name)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "invalid object name");

/* Set up user data for locating object */
udata.loc = obj_loc;

Expand Down
17 changes: 3 additions & 14 deletions src/H5T.c
Original file line number Diff line number Diff line change
Expand Up @@ -6785,24 +6785,13 @@ H5T_is_numeric_with_unusual_unused_bits(const H5T_t *dt)
/* Is the correct type? */
if (H5T_INTEGER == dt->shared->type || H5T_FLOAT == dt->shared->type ||
H5T_BITFIELD == dt->shared->type) {
#if LDBL_MANT_DIG == 106
/* This currently won't work for the IBM long double type */
if (H5T_FLOAT == dt->shared->type && dt->shared->size == 16 &&
(dt->shared->u.atomic.prec == 64 || dt->shared->u.atomic.prec == 128))
HGOTO_DONE(false);
#endif

/* Has unused bits? */
if (dt->shared->u.atomic.prec < (dt->shared->size * 8)) {
unsigned surround_bits =
1U << (1 + H5VM_log2_gen((dt->shared->u.atomic.prec + dt->shared->u.atomic.offset) - 1));

if (dt->shared->size > 1 && dt->shared->u.atomic.prec < (dt->shared->size * 8))
/* Unused bits are unusually large? */
if (dt->shared->size > 1 && ((dt->shared->size * 8) > surround_bits))
HGOTO_DONE(true);
}
ret_value =
(dt->shared->size * 8) > (2 * (dt->shared->u.atomic.prec + dt->shared->u.atomic.offset));
}

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

0 comments on commit 22f121d

Please sign in to comment.