summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2007-03-12 16:36:34 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2007-03-12 16:36:34 (GMT)
commitc24cea791f4a7c41a5258a943a4f614ad193948c (patch)
tree514a542eaba372169c0255f80981252c1d4399d4 /tools/lib
parent3015df0a5b02dee38264b191997c1949596c2c95 (diff)
downloadhdf5-c24cea791f4a7c41a5258a943a4f614ad193948c.zip
hdf5-c24cea791f4a7c41a5258a943a4f614ad193948c.tar.gz
hdf5-c24cea791f4a7c41a5258a943a4f614ad193948c.tar.bz2
[svn-r13503]
Preparation for making 1.6 and 1.7 h5dump more similar and 1.6 to have 1.7 fixed bugs incorporated
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5tools.c36
-rw-r--r--tools/lib/h5tools.h4
-rw-r--r--tools/lib/h5tools_filters.c4
-rw-r--r--tools/lib/h5tools_ref.c12
-rw-r--r--tools/lib/h5tools_str.c352
-rw-r--r--tools/lib/h5tools_str.h6
6 files changed, 207 insertions, 207 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index a713092..322fb27 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -101,10 +101,10 @@ void
h5tools_init(void)
{
if (!h5tools_init_g) {
- if (!rawdatastream)
- rawdatastream = stdout;
+ if (!rawdatastream)
+ rawdatastream = stdout;
- h5tools_init_g++;
+ h5tools_init_g++;
}
}
@@ -128,12 +128,12 @@ void
h5tools_close(void)
{
if (h5tools_init_g) {
- if (rawdatastream && rawdatastream != stdout) {
- if (fclose(rawdatastream))
- perror("closing rawdatastream");
- else
- rawdatastream = NULL;
- }
+ if (rawdatastream && rawdatastream != stdout) {
+ if (fclose(rawdatastream))
+ perror("closing rawdatastream");
+ else
+ rawdatastream = NULL;
+ }
/* Clean up the reference path table, if it's been used */
term_ref_path_table();
@@ -141,7 +141,7 @@ h5tools_close(void)
/* Shut down the library */
H5close();
- h5tools_init_g = 0;
+ h5tools_init_g = 0;
}
}
@@ -217,24 +217,24 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum)
#ifdef H5_HAVE_PARALLEL
} else if(!strcmp(driver, drivernames[MPIO_IDX])) {
/* MPI-I/O Driver */
- /* check if MPI has been initialized. */
- if(!h5tools_mpi_init_g)
- MPI_Initialized(&h5tools_mpi_init_g);
+ /* check if MPI has been initialized. */
+ if(!h5tools_mpi_init_g)
+ MPI_Initialized(&h5tools_mpi_init_g);
if(h5tools_mpi_init_g) {
if(H5Pset_fapl_mpio(new_fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0)
- goto error;
+ goto error;
if(drivernum)
*drivernum = MPIO_IDX;
} /* end if */
} else if (!strcmp(driver, drivernames[MPIPOSIX_IDX])) {
/* MPI-I/O Driver */
- /* check if MPI has been initialized. */
- if(!h5tools_mpi_init_g)
- MPI_Initialized(&h5tools_mpi_init_g);
+ /* check if MPI has been initialized. */
+ if(!h5tools_mpi_init_g)
+ MPI_Initialized(&h5tools_mpi_init_g);
if(h5tools_mpi_init_g) {
if(H5Pset_fapl_mpiposix(new_fapl, MPI_COMM_WORLD, TRUE) < 0)
- goto error;
+ goto error;
if(drivernum)
*drivernum = MPIPOSIX_IDX;
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 61b02a5..fa05a9f 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -27,8 +27,8 @@
#define ESCAPE_HTML 1
#define OPT(X,S) ((X) ? (X) : (S))
#define OPTIONAL_LINE_BREAK "\001" /* Special strings embedded in the output */
-#define START_OF_DATA 0x0001
-#define END_OF_DATA 0x0002
+#define START_OF_DATA 0x0001
+#define END_OF_DATA 0x0002
/*
* The output functions need a temporary buffer to hold a piece of the
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index b2ed201..9ba9492 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -106,7 +106,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
return 0;
/*-------------------------------------------------------------------------
- * H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ * H5Z_FILTER_DEFLATE 1 , deflation like gzip
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_DEFLATE:
@@ -231,7 +231,7 @@ int h5tools_can_encode( H5Z_filter_t filtn)
switch (filtn)
{
- /* user defined filter */
+ /* user defined filter */
default:
return 0;
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index 1d4a2f7..2a7a4ff 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -75,15 +75,15 @@ init_ref_path_table(hid_t fid)
/* Create skip list to store reference path information */
if((ref_path_table = H5SL_create(H5SL_TYPE_HADDR, 0.5, (size_t)16))==NULL)
- return (-1);
+ return (-1);
if((root_path = HDstrdup("/")) == NULL)
- return (-1);
+ return (-1);
if(H5Gget_objinfo(fid, "/", TRUE, &sb)<0) {
- /* fatal error? */
- HDfree(root_path);
- return (-1);
+ /* fatal error? */
+ HDfree(root_path);
+ return (-1);
}
objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long)));
@@ -163,7 +163,7 @@ ref_path_table_lookup(const char *thepath)
/* Check for external link first, so we don't return the OID of an object in another file */
if(H5Gget_objinfo(thefile, thepath, FALSE, &sb)<0)
- return HADDR_UNDEF;
+ return HADDR_UNDEF;
if(sb.type == H5G_LINK) {
/* Get object ID for object at path */
/* (If the object is not a soft link, we've already retrieved the
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index afb250f..a6432c5 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -34,11 +34,11 @@
* 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' repeates 9 times
*
* Otherwise the format is more Perl-like
*
- * 'A'*10
+ * 'A'*10
*
*/
#define REPEAT_VERBOSE
@@ -51,14 +51,14 @@ static hbool_t h5tools_is_zero(const void *_mem, size_t size);
static void h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, char ch);
/*-------------------------------------------------------------------------
- * Function: h5tools_str_close
+ * Function: h5tools_str_close
*
- * Purpose: Closes a string by releasing it's memory and setting the size
- * information to zero.
+ * Purpose: Closes a string by releasing it's memory and setting the size
+ * information to zero.
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, April 26, 1999
*
* Modifications:
@@ -75,16 +75,16 @@ h5tools_str_close(h5tools_str_t *str)
}
/*-------------------------------------------------------------------------
- * Function: h5tools_str_len
+ * Function: h5tools_str_len
*
- * Purpose: Returns the length of the string, not counting the null
- * terminator.
+ * Purpose: Returns the length of the string, not counting the null
+ * terminator.
*
- * Return: Success: Length of string
+ * Return: Success: Length of string
*
- * Failure: 0
+ * Failure: 0
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, April 26, 1999
*
* Modifications:
@@ -98,16 +98,16 @@ h5tools_str_len(h5tools_str_t *str)
}
/*-------------------------------------------------------------------------
- * Function: h5tools_str_append
+ * Function: h5tools_str_append
*
- * Purpose: Formats variable arguments according to printf() format
- * string and appends the result to variable length string STR.
+ * Purpose: Formats variable arguments according to printf() format
+ * string and appends the result to variable length string STR.
*
- * Return: Success: Pointer to buffer containing result.
+ * Return: Success: Pointer to buffer containing result.
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, April 26, 1999
*
* Modifications:
@@ -115,7 +115,7 @@ h5tools_str_len(h5tools_str_t *str)
* Major change: need to check results of vsnprintf to
* handle errors, empty format, and overflows.
*
- * Programmer: REMcG Matzke
+ * Programmer: REMcG Matzke
* June 16, 2004
*
*-------------------------------------------------------------------------
@@ -129,11 +129,11 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...)
/* Make sure we have some memory into which to print */
if (!str->s || str->nalloc <= 0) {
- str->nalloc = STR_INIT_LEN;
- str->s = malloc(str->nalloc);
- assert(str->s);
- str->s[0] = '\0';
- str->len = 0;
+ str->nalloc = STR_INIT_LEN;
+ str->s = malloc(str->nalloc);
+ assert(str->s);
+ str->s[0] = '\0';
+ str->len = 0;
}
if (strlen(fmt) == 0) {
@@ -145,33 +145,33 @@ 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;
+ size_t avail = str->nalloc - str->len;
- int nchars = HDvsnprintf(str->s + str->len, avail, fmt, ap);
+ int nchars = HDvsnprintf(str->s + str->len, avail, fmt, ap);
- if (nchars<0) {
+ if (nchars<0) {
/* failure, such as bad format */
va_end(ap);
- return NULL;
+ return NULL;
}
- if ((size_t)nchars>=avail ||
- (0==nchars && (strcmp(fmt,"%s") ))) {
- /* Truncation return value as documented by C99, or zero return value with either of the
+ if ((size_t)nchars>=avail ||
+ (0==nchars && (strcmp(fmt,"%s") ))) {
+ /* Truncation return value as documented by C99, or zero return value with either of the
* following conditions, each of which indicates that the proper C99 return value probably
* should have been positive when the format string is
* something other than "%s"
* Alocate at least twice as much space and try again.
*/
- size_t newsize = MAX(str->len+nchars+1, 2*str->nalloc);
- assert(newsize > str->nalloc); /*overflow*/
- str->s = realloc(str->s, newsize);
- assert(str->s);
- str->nalloc = newsize;
- } else {
- /* Success */
- str->len += nchars;
- break;
+ size_t newsize = MAX(str->len+nchars+1, 2*str->nalloc);
+ assert(newsize > str->nalloc); /*overflow*/
+ str->s = realloc(str->s, newsize);
+ assert(str->s);
+ str->nalloc = newsize;
+ } else {
+ /* Success */
+ str->len += nchars;
+ break;
}
}
va_end(ap);
@@ -179,17 +179,17 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...)
}
/*-------------------------------------------------------------------------
- * Function: h5tools_str_reset
+ * Function: h5tools_str_reset
*
- * Purpose: Reset the string to the empty value. If no memory is
- * allocated yet then initialize the h5tools_str_t struct.
+ * Purpose: Reset the string to the empty value. If no memory is
+ * allocated yet then initialize the h5tools_str_t struct.
*
- * Return: Success: Ptr to the buffer which contains a null
- * character as the first element.
+ * Return: Success: Ptr to the buffer which contains a null
+ * character as the first element.
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, April 26, 1999
*
* Modifications:
@@ -200,9 +200,9 @@ char *
h5tools_str_reset(h5tools_str_t *str/*in,out*/)
{
if (!str->s || str->nalloc <= 0) {
- str->nalloc = STR_INIT_LEN;
- str->s = malloc(str->nalloc);
- assert(str->s);
+ str->nalloc = STR_INIT_LEN;
+ str->s = malloc(str->nalloc);
+ assert(str->s);
}
str->s[0] = '\0';
@@ -211,15 +211,15 @@ h5tools_str_reset(h5tools_str_t *str/*in,out*/)
}
/*-------------------------------------------------------------------------
- * Function: h5tools_str_trunc
+ * Function: h5tools_str_trunc
*
- * Purpose: Truncate a string to be at most SIZE characters.
+ * Purpose: Truncate a string to be at most SIZE characters.
*
- * Return: Success: Pointer to the string
+ * Return: Success: Pointer to the string
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, April 26, 1999
*
* Modifications:
@@ -230,27 +230,27 @@ char *
h5tools_str_trunc(h5tools_str_t *str/*in,out*/, size_t size)
{
if (size < str->len) {
- str->len = size;
- str->s[size] = '\0';
+ str->len = size;
+ str->s[size] = '\0';
}
return str->s;
}
/*-------------------------------------------------------------------------
- * Function: h5tools_str_fmt
+ * Function: h5tools_str_fmt
*
- * Purpose: Reformat a string contents beginning at character START
- * according to printf format FMT. FMT should contain no format
- * specifiers except possibly the `%s' variety. For example, if
- * the input string is `hello' and the format is "<<%s>>" then
- * the output value will be "<<hello>>".
+ * Purpose: Reformat a string contents beginning at character START
+ * according to printf format FMT. FMT should contain no format
+ * specifiers except possibly the `%s' variety. For example, if
+ * the input string is `hello' and the format is "<<%s>>" then
+ * the output value will be "<<hello>>".
*
- * Return: Success: A pointer to the resulting string.
+ * Return: Success: A pointer to the resulting string.
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, April 26, 1999
*
* Modifications:
@@ -291,15 +291,15 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt)
}
/*-------------------------------------------------------------------------
- * Function: h5tools_str_prefix
+ * Function: h5tools_str_prefix
*
- * Purpose: Renders the line prefix value into string STR.
+ * Purpose: Renders the line prefix value into string STR.
*
- * Return: Success: Pointer to the prefix.
+ * Return: Success: Pointer to the prefix.
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, July 23, 1998
*
* Modifications:
@@ -351,16 +351,16 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
}
/*-------------------------------------------------------------------------
- * Function: h5tools_str_dump_region
+ * Function: h5tools_str_dump_region
*
- * Purpose: Prints information about a dataspace region by appending
- * the information to the specified string.
+ * Purpose: Prints information about a dataspace region by appending
+ * the information to the specified string.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, June 7, 1999
*
* Modifications:
@@ -370,10 +370,10 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
int
h5tools_str_dump_region(h5tools_str_t *str, hid_t region, const h5tool_format_t *info)
{
- hssize_t nblocks, npoints;
+ hssize_t nblocks, npoints;
hsize_t alloc_size;
hsize_t *ptdata;
- int ndims = H5Sget_simple_extent_ndims(region);
+ int ndims = H5Sget_simple_extent_ndims(region);
/*
* These two functions fail if the region does not have blocks or points,
@@ -451,13 +451,13 @@ h5tools_str_dump_region(h5tools_str_t *str, hid_t region, const h5tool_format_t
}
/*-------------------------------------------------------------------------
- * Function: h5tools_print_char
+ * Function: h5tools_print_char
*
- * Purpose: Shove a character into the STR.
+ * Purpose: Shove a character into the STR.
*
- * Return: Nothing
+ * Return: Nothing
*
- * Programmer: Bill Wendling
+ * Programmer: Bill Wendling
* Tuesday, 20. February 2001
*
* Modifications:
@@ -533,28 +533,28 @@ h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, char ch)
/*-------------------------------------------------------------------------
- * Function: h5tools_str_sprint
+ * Function: h5tools_str_sprint
*
- * Purpose: Renders the value pointed to by VP of type TYPE into variable
- * length string STR.
+ * Purpose: Renders the value pointed to by VP of type TYPE into variable
+ * length string STR.
*
- * Return: A pointer to memory containing the result or NULL on error.
+ * Return: A pointer to memory containing the result or NULL on error.
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, July 23, 1998
*
* Modifications:
- * Robb Matzke, 1999-04-26
- * Made this function safe from overflow problems by allowing it
- * to reallocate the output string.
+ * Robb Matzke, 1999-04-26
+ * Made this function safe from overflow problems by allowing it
+ * to reallocate the output string.
*
- * Robb Matzke, 1999-06-04
- * Added support for object references. The new `container'
- * argument is the dataset where the reference came from.
+ * Robb Matzke, 1999-06-04
+ * Added support for object references. The new `container'
+ * argument is the dataset where the reference came from.
*
- * Robb Matzke, 1999-06-07
- * Added support for printing raw data. If info->raw is non-zero
- * then data is printed in hexadecimal format.
+ * Robb Matzke, 1999-06-07
+ * Added support for printing raw data. If info->raw is non-zero
+ * then data is printed in hexadecimal format.
*
* Robb Matzke, 2003-01-10
* Binary output format is dd:dd:... instead of 0xdddd... so it
@@ -580,7 +580,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
char *cp_vp = (char *)vp;
hid_t memb, obj, region;
unsigned nmembs;
- int otype;
+ int otype;
static char fmt_llong[8], fmt_ullong[8];
H5T_str_t pad;
H5G_stat_t sb;
@@ -910,7 +910,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
}
} else if (H5Tget_class(type) == H5T_ARRAY) {
int k, ndims;
- hsize_t i, dims[H5S_MAX_RANK],temp_nelmts;
+ hsize_t i, dims[H5S_MAX_RANK],temp_nelmts;
/* Get the array's base datatype for each element */
memb = H5Tget_super(type);
@@ -921,11 +921,11 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
/* Calculate the number of array elements */
for (k = 0, nelmts = 1; k < ndims; k++){
- temp_nelmts = nelmts;
- temp_nelmts *= dims[k];
- assert(temp_nelmts==(hsize_t)((size_t)temp_nelmts));
+ temp_nelmts = nelmts;
+ temp_nelmts *= dims[k];
+ assert(temp_nelmts==(hsize_t)((size_t)temp_nelmts));
nelmts = (size_t)temp_nelmts;
- }
+ }
/* Print the opening bracket */
h5tools_str_append(str, "%s", OPT(info->arr_pre, "["));
@@ -961,7 +961,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
} /* end for */
/* Print the closing bracket */
- h5tools_str_append(str, "%s", OPT(info->arr_suf, "]"));
+ h5tools_str_append(str, "%s", OPT(info->arr_suf, "]"));
H5Tclose(memb);
} else if (H5Tget_class(type) == H5T_VLEN) {
unsigned int i;
@@ -1024,18 +1024,18 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
}
/*-------------------------------------------------------------------------
- * Function: h5tools_escape
+ * Function: h5tools_escape
*
- * Purpose: Changes all "funny" characters in S into standard C escape
- * sequences.
+ * Purpose: Changes all "funny" characters in S into standard C escape
+ * sequences.
*
- * Return: Success: S
+ * Return: Success: S
*
- * Failure: NULL if the buffer would overflow. The
- * buffer has as many left-to-right escapes as
- * possible before overflow would have happened.
+ * Failure: NULL if the buffer would overflow. The
+ * buffer has as many left-to-right escapes as
+ * possible before overflow would have happened.
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, April 26, 1999
*
* Modifications:
@@ -1051,76 +1051,76 @@ h5tools_escape(char *s/*in,out*/, size_t size)
char octal[8];
for (i = 0; i < n; i++) {
- switch (s[i]) {
- case '\'':
- escape = "\\\'";
- break;
- case '\"':
- escape = "\\\"";
- break;
- case '\\':
- escape = "\\\\";
- break;
- case '\?':
- escape = "\\\?";
- break;
- case '\a':
- escape = "\\a";
- break;
- case '\b':
- escape = "\\b";
- break;
- case '\f':
- escape = "\\f";
- break;
- case '\n':
- escape = "\\n";
- break;
- case '\r':
- escape = "\\r";
- break;
- case '\t':
- escape = "\\t";
- break;
- case '\v':
- escape = "\\v";
- break;
- default:
- if (!isprint(s[i])) {
- sprintf(octal, "\\%03o", (unsigned char)s[i]);
- escape = octal;
- } else {
- escape = NULL;
- }
-
- break;
- }
-
- if (escape) {
- size_t esc_size = strlen(escape);
-
- if (n + esc_size + 1 > size)
- /*would overflow*/
- return NULL;
-
- memmove(s + i + esc_size, s + i + 1, n - i); /*make room*/
- memcpy(s + i, escape, esc_size); /*insert*/
- n += esc_size - 1; /* adjust total string size */
- i += esc_size; /* adjust string position */
- }
+ switch (s[i]) {
+ case '\'':
+ escape = "\\\'";
+ break;
+ case '\"':
+ escape = "\\\"";
+ break;
+ case '\\':
+ escape = "\\\\";
+ break;
+ case '\?':
+ escape = "\\\?";
+ break;
+ case '\a':
+ escape = "\\a";
+ break;
+ case '\b':
+ escape = "\\b";
+ break;
+ case '\f':
+ escape = "\\f";
+ break;
+ case '\n':
+ escape = "\\n";
+ break;
+ case '\r':
+ escape = "\\r";
+ break;
+ case '\t':
+ escape = "\\t";
+ break;
+ case '\v':
+ escape = "\\v";
+ break;
+ default:
+ if (!isprint(s[i])) {
+ sprintf(octal, "\\%03o", (unsigned char)s[i]);
+ escape = octal;
+ } else {
+ escape = NULL;
+ }
+
+ break;
+ }
+
+ if (escape) {
+ size_t esc_size = strlen(escape);
+
+ if (n + esc_size + 1 > size)
+ /*would overflow*/
+ return NULL;
+
+ memmove(s + i + esc_size, s + i + 1, n - i); /*make room*/
+ memcpy(s + i, escape, esc_size); /*insert*/
+ n += esc_size - 1; /* adjust total string size */
+ i += esc_size; /* adjust string position */
+ }
}
return s;
}
/*-------------------------------------------------------------------------
- * Function: h5tools_is_zero
+ * Function: h5tools_is_zero
*
- * Purpose: Determines if memory is initialized to all zero bytes.
+ * Purpose: Determines if memory is initialized to all zero bytes.
*
- * Return: TRUE if all bytes are zero; FALSE otherwise
+ * Return: TRUE if all bytes are zero; FALSE otherwise
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, June 7, 1999
*
* Modifications:
@@ -1133,8 +1133,8 @@ h5tools_is_zero(const void *_mem, size_t size)
const unsigned char *mem = (const unsigned char *)_mem;
while (size-- > 0)
- if (mem[size])
- return FALSE;
+ if (mem[size])
+ return FALSE;
return TRUE;
}
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index ca9c497..0964b7b 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -21,9 +21,9 @@
#define H5TOOLS_STR_H__
typedef struct h5tools_str_t {
- char *s; /*allocate string */
- size_t len; /*length of actual value */
- size_t nalloc; /*allocated size of string */
+ char *s; /*allocate string */
+ size_t len; /*length of actual value */
+ size_t nalloc; /*allocated size of string */
} h5tools_str_t;
extern void h5tools_str_close(h5tools_str_t *str);