mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-27 02:10:55 +08:00
Merge pull request #501 in HDFFV/hdf5 from ~BYRN/hdf5_adb:develop to develop
* commit 'e4e261173f85de6f83651abd6950793d7b930a20': HDFFV-10186 more whitespace formatting
This commit is contained in:
commit
9d50ed5287
@ -40,7 +40,7 @@ typedef struct H5LD_memb_t {
|
||||
* If REPEAT_VERBOSE is defined then character strings will be printed so
|
||||
* that repeated character sequences like "AAAAAAAAAA" are displayed as
|
||||
*
|
||||
* 'A' repeates 9 times
|
||||
* 'A' repeats 9 times
|
||||
*
|
||||
* Otherwise the format is more Perl-like
|
||||
*
|
||||
@ -67,9 +67,6 @@ void h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *in
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, April 26, 1999
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
@ -93,9 +90,6 @@ h5tools_str_close(h5tools_str_t *str)
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, April 26, 1999
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
H5_ATTR_PURE size_t
|
||||
@ -116,15 +110,6 @@ h5tools_str_len(h5tools_str_t *str)
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, April 26, 1999
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
* Major change: need to check results of vsnprintf to
|
||||
* handle errors, empty format, and overflows.
|
||||
*
|
||||
* Programmer: REMcG Matzke
|
||||
* June 16, 2004
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
char *
|
||||
@ -143,8 +128,8 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...)
|
||||
/* Format the arguments and append to the value already in `str' */
|
||||
while(1) {
|
||||
/* How many bytes available for new value, counting the new NUL */
|
||||
size_t avail = str->nalloc - str->len;
|
||||
int nchars = -1;
|
||||
size_t avail = str->nalloc - str->len;
|
||||
|
||||
HDva_start(ap, fmt);
|
||||
nchars = HDvsnprintf(str->s + str->len, avail, fmt, ap);
|
||||
@ -200,9 +185,6 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...)
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, April 26, 1999
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
char *
|
||||
@ -230,9 +212,6 @@ h5tools_str_reset(h5tools_str_t *str/*in,out*/)
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, April 26, 1999
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
char *
|
||||
@ -261,9 +240,6 @@ h5tools_str_trunc(h5tools_str_t *str/*in,out*/, size_t size)
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, April 26, 1999
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
char *
|
||||
@ -315,9 +291,6 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt)
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Thursday, July 23, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
char *
|
||||
@ -350,10 +323,8 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Scalar */
|
||||
else /* Scalar */
|
||||
h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t) 0);
|
||||
}
|
||||
|
||||
/* Add prefix and suffix to the index */
|
||||
return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: "));
|
||||
@ -377,9 +348,9 @@ h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
|
||||
hsize_t elmtno, hsize_t *ptdata, unsigned ndims, hsize_t max_idx[],
|
||||
h5tools_context_t *ctx)
|
||||
{
|
||||
hsize_t p_prod[H5S_MAX_RANK];
|
||||
size_t i = 0;
|
||||
hsize_t curr_pos = elmtno;
|
||||
hsize_t p_prod[H5S_MAX_RANK];
|
||||
|
||||
h5tools_str_reset(str);
|
||||
|
||||
@ -410,10 +381,8 @@ h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
|
||||
|
||||
}
|
||||
} /* if (ndims > 0) */
|
||||
else {
|
||||
/* Scalar */
|
||||
else /* Scalar */
|
||||
h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t) 0);
|
||||
}
|
||||
|
||||
/* Add prefix and suffix to the index */
|
||||
return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: "));
|
||||
@ -494,8 +463,7 @@ h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace,
|
||||
*
|
||||
* Return: none
|
||||
*
|
||||
* In/Out:
|
||||
* h5tools_str_t *str
|
||||
* In/Out: h5tools_str_t *str
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
@ -513,11 +481,11 @@ h5tools_str_dump_space_blocks(h5tools_str_t *str, hid_t rspace,
|
||||
|
||||
/* Print block information */
|
||||
if(snblocks > 0) {
|
||||
hsize_t alloc_size;
|
||||
hsize_t nblocks;
|
||||
hsize_t *ptdata;
|
||||
hsize_t alloc_size;
|
||||
unsigned ndims = (unsigned)H5Sget_simple_extent_ndims(rspace);
|
||||
hsize_t u;
|
||||
unsigned ndims = (unsigned)H5Sget_simple_extent_ndims(rspace);
|
||||
|
||||
nblocks = (hsize_t)snblocks;
|
||||
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
|
||||
@ -554,8 +522,7 @@ h5tools_str_dump_space_blocks(h5tools_str_t *str, hid_t rspace,
|
||||
*
|
||||
* Return: none
|
||||
*
|
||||
* In/Out:
|
||||
* h5tools_str_t *str
|
||||
* In/Out: h5tools_str_t *str
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
@ -573,11 +540,11 @@ h5tools_str_dump_space_points(h5tools_str_t *str, hid_t rspace,
|
||||
|
||||
/* Print point information */
|
||||
if (snpoints > 0) {
|
||||
hsize_t npoints;
|
||||
hsize_t alloc_size;
|
||||
hsize_t npoints;
|
||||
hsize_t *ptdata;
|
||||
unsigned ndims = (unsigned)H5Sget_simple_extent_ndims(rspace);
|
||||
hsize_t u;
|
||||
unsigned ndims = (unsigned)H5Sget_simple_extent_ndims(rspace);
|
||||
|
||||
npoints = (hsize_t)snpoints;
|
||||
alloc_size = npoints * ndims * sizeof(ptdata[0]);
|
||||
@ -778,17 +745,15 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
|
||||
if(info->raw) {
|
||||
size_t i;
|
||||
|
||||
if (1 == nsize) {
|
||||
if(1 == nsize)
|
||||
h5tools_str_append(str, OPT(info->fmt_raw, "0x%02x"), ucp_vp[0]);
|
||||
}
|
||||
else {
|
||||
else
|
||||
for(i = 0; i < nsize; i++) {
|
||||
if(i)
|
||||
h5tools_str_append(str, ":");
|
||||
h5tools_str_append(str, OPT(info->fmt_raw, "%02x"), ucp_vp[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if((type_class = H5Tget_class(type)) < 0)
|
||||
return NULL;
|
||||
@ -1084,7 +1049,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
|
||||
|
||||
ctx->cmpd_listv = info->cmpd_listv;
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
unsigned nmembs;
|
||||
unsigned j;
|
||||
|
||||
@ -1129,20 +1095,17 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
|
||||
{
|
||||
char enum_name[1024];
|
||||
|
||||
if (H5Tenum_nameof(type, vp, enum_name, sizeof enum_name) >= 0) {
|
||||
if(H5Tenum_nameof(type, vp, enum_name, sizeof enum_name) >= 0)
|
||||
h5tools_str_append(str, h5tools_escape(enum_name, sizeof(enum_name)));
|
||||
}
|
||||
else {
|
||||
size_t i;
|
||||
if (1 == nsize) {
|
||||
if(1 == nsize)
|
||||
h5tools_str_append(str, "0x%02x", ucp_vp[0]);
|
||||
}
|
||||
else {
|
||||
else
|
||||
for(i = 0; i < nsize; i++)
|
||||
h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case H5T_REFERENCE:
|
||||
@ -1319,14 +1282,12 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
|
||||
{
|
||||
/* All other types get printed as hexadecimal */
|
||||
size_t i;
|
||||
if (1 == nsize) {
|
||||
if(1 == nsize)
|
||||
h5tools_str_append(str, "0x%02x", ucp_vp[0]);
|
||||
}
|
||||
else {
|
||||
else
|
||||
for(i = 0; i < nsize; i++)
|
||||
h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case H5T_NO_CLASS:
|
||||
@ -1394,18 +1355,15 @@ h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info,
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, April 26, 1999
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static char *
|
||||
h5tools_escape(char *s/*in,out*/, size_t size)
|
||||
{
|
||||
register size_t i;
|
||||
size_t n = HDstrlen(s);
|
||||
const char *escape;
|
||||
char octal[8];
|
||||
size_t n = HDstrlen(s);
|
||||
|
||||
for(i = 0; i < n; i++) {
|
||||
switch (s[i]) {
|
||||
@ -1447,9 +1405,8 @@ h5tools_escape(char *s/*in,out*/, size_t size)
|
||||
HDsnprintf(octal, sizeof(octal), "\\%03o", (unsigned char) s[i]);
|
||||
escape = octal;
|
||||
}
|
||||
else {
|
||||
else
|
||||
escape = NULL;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -1480,9 +1437,6 @@ h5tools_escape(char *s/*in,out*/, size_t size)
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, June 7, 1999
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static hbool_t
|
||||
|
@ -255,9 +255,8 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
|
||||
for (i = 0; i < travt->nobjs; i++) {
|
||||
if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) {
|
||||
/* Push onto the stack */
|
||||
if (NULL == (dt = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) {
|
||||
if (NULL == (dt = (named_dt_t *)HDmalloc(sizeof(named_dt_t))))
|
||||
goto done;
|
||||
}
|
||||
dt->next = *named_dt_head_p;
|
||||
*named_dt_head_p = dt;
|
||||
|
||||
@ -278,9 +277,8 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
|
||||
* possible if the datatype was committed anonymously in the input file. */
|
||||
if (!dt_ret) {
|
||||
/* Push the new datatype onto the stack */
|
||||
if (NULL == (dt_ret = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) {
|
||||
if (NULL == (dt_ret = (named_dt_t *)HDmalloc(sizeof(named_dt_t))))
|
||||
goto done;
|
||||
}
|
||||
dt_ret->next = *named_dt_head_p;
|
||||
*named_dt_head_p = dt_ret;
|
||||
|
||||
@ -307,9 +305,8 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
|
||||
|
||||
/* Increment the ref count on id_out, because the calling function will try
|
||||
* to close it */
|
||||
if(H5Iinc_ref(ret_value) < 0) {
|
||||
if(H5Iinc_ref(ret_value) < 0)
|
||||
ret_value = -1;
|
||||
}
|
||||
|
||||
done:
|
||||
return (ret_value);
|
||||
@ -477,10 +474,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
|
||||
} /* for (j=0; i<nmembers; j++) */
|
||||
} /* if (type_class == H5T_COMPOUND) */
|
||||
|
||||
if (is_ref) {
|
||||
; /* handled by copy_refs_attr() */
|
||||
}
|
||||
else {
|
||||
if (!is_ref) {
|
||||
/*-------------------------------------------------------------------------
|
||||
* read to memory
|
||||
*-------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user