From ed663577a5394d34a0cfbe5cd5443af1f7957dc5 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 25 Sep 2001 12:46:32 -0500 Subject: [svn-r4473] Purpose: Code cleanup for better compatibility with C++ compilers Description: C++ compilers are choking on our C code, for various reasons: we used our UNUSED macro incorrectly when referring to pointer types we used various C++ keywords as variables, etc. we incremented enum's with the ++ operator. Solution: Changed variables, etc.to avoid C++ keywords (new, class, typename, typeid, template) Fixed usage of UNUSED macro from this: char UNUSED *c to this: char * UNUSED c Switched the enums from x++ to x=x+1 Platforms tested: FreeBSD 4.4 (hawkwind) --- examples/h5_group.c | 18 +-- examples/h5_read.c | 6 +- hl/tools/gif2h5/gifread.c | 35 +++-- perform/chunk.c | 4 +- src/H5.c | 80 +++++------ src/H5Distore.c | 2 +- src/H5F.c | 2 +- src/H5FD.c | 4 +- src/H5FDfamily.c | 2 +- src/H5FDlog.c | 2 +- src/H5FDmulti.c | 50 +++---- src/H5FDsec2.c | 2 +- src/H5FDstream.c | 2 +- src/H5Fistore.c | 2 +- src/H5Gnode.c | 10 +- src/H5HG.c | 4 +- src/H5HL.c | 4 +- src/H5I.c | 4 +- src/H5O.c | 4 +- src/H5Omtime.c | 2 +- src/H5Oshared.c | 2 +- src/H5Ostab.c | 2 +- src/H5Sall.c | 6 +- src/H5Shyper.c | 30 ++-- src/H5Snone.c | 6 +- src/H5Spoint.c | 48 +++---- src/H5T.c | 6 +- test/dsets.c | 4 +- test/h5test.c | 6 +- test/tattr.c | 32 ++--- test/titerate.c | 8 +- tools/gifconv/gifread.c | 35 +++-- tools/h4toh5/h4toh5image.c | 4 +- tools/h4toh5/h4toh5sds.c | 8 +- tools/h5dump/h5dump.c | 58 ++++---- tools/h5ls/h5ls.c | 6 +- tools/h5toh4/h5toh4.c | 332 ++++++++++++++++++++++----------------------- 37 files changed, 427 insertions(+), 405 deletions(-) diff --git a/examples/h5_group.c b/examples/h5_group.c index f55262a..72982ec 100644 --- a/examples/h5_group.c +++ b/examples/h5_group.c @@ -176,7 +176,7 @@ herr_t group_info(hid_t loc_id, const char *name, void *opdata) { hid_t did; /* dataset identifier */ hid_t tid; /* datatype identifier */ - H5T_class_t class; + H5T_class_t t_class; hid_t pid; /* data_property identifier */ hsize_t chunk_dims_out[2]; @@ -216,22 +216,22 @@ herr_t group_info(hid_t loc_id, const char *name, void *opdata) (unsigned long)(chunk_dims_out[1])); } else{ - class = H5Tget_class(tid); - if(class < 0){ + t_class = H5Tget_class(tid); + if(t_class < 0){ puts(" Invalid datatype.\n"); } else { - if(class == H5T_INTEGER) + if(t_class == H5T_INTEGER) puts(" Datatype is 'H5T_NATIVE_INTEGER'.\n"); - if(class == H5T_FLOAT) + if(t_class == H5T_FLOAT) puts(" Datatype is 'H5T_NATIVE_FLOAT'.\n"); - if(class == H5T_STRING) + if(t_class == H5T_STRING) puts(" Datatype is 'H5T_NATIVE_STRING'.\n"); - if(class == H5T_BITFIELD) + if(t_class == H5T_BITFIELD) puts(" Datatype is 'H5T_NATIVE_BITFIELD'.\n"); - if(class == H5T_OPAQUE) + if(t_class == H5T_OPAQUE) puts(" Datatype is 'H5T_NATIVE_OPAQUE'.\n"); - if(class == H5T_COMPOUND) + if(t_class == H5T_COMPOUND) puts(" Datatype is 'H5T_NATIVE_COMPOUND'.\n"); } } diff --git a/examples/h5_read.c b/examples/h5_read.c index b96322b..cd8d9f7 100644 --- a/examples/h5_read.c +++ b/examples/h5_read.c @@ -23,7 +23,7 @@ main (void) hid_t file, dataset; /* handles */ hid_t datatype, dataspace; hid_t memspace; - H5T_class_t class; /* data type class */ + H5T_class_t t_class; /* data type class */ H5T_order_t order; /* data order */ size_t size; /* * size of the data element @@ -59,8 +59,8 @@ main (void) * dataset class, order, size, rank and dimensions. */ datatype = H5Dget_type(dataset); /* datatype handle */ - class = H5Tget_class(datatype); - if (class == H5T_INTEGER) printf("Data set has INTEGER type \n"); + t_class = H5Tget_class(datatype); + if (t_class == H5T_INTEGER) printf("Data set has INTEGER type \n"); order = H5Tget_order(datatype); if (order == H5T_ORDER_LE) printf("Little endian order \n"); diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c index 39043f3..3e01801 100644 --- a/hl/tools/gif2h5/gifread.c +++ b/hl/tools/gif2h5/gifread.c @@ -112,9 +112,10 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */ ** otherwise 0 if no error occured. */ int -ReadGifImageDesc(GifImageDesc, MemGif2) -GIFIMAGEDESC *GifImageDesc; /* Pointer to GIF image descriptor structure */ -BYTE **MemGif2; /* GIF image file input FILE stream */ +ReadGifImageDesc( + GIFIMAGEDESC *GifImageDesc, /* Pointer to GIF image descriptor structure */ + BYTE **MemGif2 /* GIF image file input FILE stream */ + ) { WORD i; /* Loop counter */ WORD tableSize; /* Number of entries in the Local Color Table */ @@ -208,9 +209,10 @@ BYTE **MemGif2; /* GIF image file input FILE stream */ ** otherwise 0 if no error occured. */ int -ReadGifGraphicControl(GifGraphicControl, MemGif2) -GIFGRAPHICCONTROL *GifGraphicControl; /* Pointer to GC Extension structure */ -BYTE **MemGif2; /* GIF image file input FILE stream */ +ReadGifGraphicControl( + GIFGRAPHICCONTROL *GifGraphicControl, /* Pointer to GC Extension structure */ + BYTE **MemGif2 /* GIF image file input FILE stream */ + ) { int i; @@ -232,9 +234,10 @@ BYTE **MemGif2; /* GIF image file input FILE stream */ ** otherwise 0 if no error occured. */ int -ReadGifPlainText(GifPlainText, MemGif2) -GIFPLAINTEXT *GifPlainText; /* Pointer to Plain Text Extension structure */ -BYTE **MemGif2; /* GIF image file input FILE stream */ +ReadGifPlainText( + GIFPLAINTEXT *GifPlainText, /* Pointer to Plain Text Extension structure */ + BYTE **MemGif2 /* GIF image file input FILE stream */ + ) { int i; @@ -270,9 +273,10 @@ BYTE **MemGif2; /* GIF image file input FILE stream */ ** otherwise 0 if no error occured. */ int -ReadGifApplication(GifApplication, MemGif2) -GIFAPPLICATION *GifApplication; /* Pointer to Application Extension structure */ -BYTE **MemGif2; /* GIF image file input FILE stream */ +ReadGifApplication( + GIFAPPLICATION *GifApplication, /* Pointer to Application Extension structure */ + BYTE **MemGif2 /* GIF image file input FILE stream */ + ) { int i; @@ -307,9 +311,10 @@ BYTE **MemGif2; /* GIF image file input FILE stream ** otherwise 0 if no error occured. */ int -ReadGifComment(GifComment, MemGif2) -GIFCOMMENT *GifComment; /* Pointer to GIF Comment Extension structure */ -BYTE **MemGif2; /* GIF image file input FILE stream */ +ReadGifComment( + GIFCOMMENT *GifComment, /* Pointer to GIF Comment Extension structure */ + BYTE **MemGif2 /* GIF image file input FILE stream */ + ) { /* Read in the Plain Text data sub-blocks */ diff --git a/perform/chunk.c b/perform/chunk.c index 47cd4db..5c023fa 100644 --- a/perform/chunk.c +++ b/perform/chunk.c @@ -83,8 +83,8 @@ static hid_t fapl_g = -1; */ static size_t counter (unsigned UNUSED flags, size_t UNUSED cd_nelmts, - const unsigned UNUSED *cd_values, size_t nbytes, - size_t UNUSED *buf_size, void UNUSED **buf) + const unsigned * UNUSED cd_values, size_t nbytes, + size_t * UNUSED buf_size, void ** UNUSED buf) { nio_g += nbytes; return nbytes; diff --git a/src/H5.c b/src/H5.c index 3d99998..b69d118 100644 --- a/src/H5.c +++ b/src/H5.c @@ -732,7 +732,7 @@ HDfprintf (FILE *stream, const char *fmt, ...) int prefix; char modifier[8]; int conv; - char *rest, template[128]; + char *rest, format_templ[128]; const char *s; va_list ap; @@ -844,19 +844,19 @@ HDfprintf (FILE *stream, const char *fmt, ...) conv = *s++; /* Create the format template */ - sprintf (template, "%%%s%s%s%s%s", + sprintf (format_templ, "%%%s%s%s%s%s", leftjust?"-":"", plussign?"+":"", ldspace?" ":"", prefix?"#":"", zerofill?"0":""); if (fwidth>0) { - sprintf (template+HDstrlen(template), "%d", fwidth); + sprintf (format_templ+HDstrlen(format_templ), "%d", fwidth); } if (prec>0) { - sprintf (template+HDstrlen(template), ".%d", prec); + sprintf (format_templ+HDstrlen(format_templ), ".%d", prec); } if (*modifier) { - sprintf (template+HDstrlen(template), "%s", modifier); + sprintf (format_templ+HDstrlen(format_templ), "%s", modifier); } - sprintf (template+HDstrlen(template), "%c", conv); + sprintf (format_templ+HDstrlen(format_templ), "%c", conv); /* Conversion */ @@ -865,16 +865,16 @@ HDfprintf (FILE *stream, const char *fmt, ...) case 'i': if (!HDstrcmp(modifier, "h")) { short x = va_arg (ap, int); - n = fprintf (stream, template, x); + n = fprintf (stream, format_templ, x); } else if (!*modifier) { int x = va_arg (ap, int); - n = fprintf (stream, template, x); + n = fprintf (stream, format_templ, x); } else if (!HDstrcmp (modifier, "l")) { long x = va_arg (ap, long); - n = fprintf (stream, template, x); + n = fprintf (stream, format_templ, x); } else { int64_t x = va_arg(ap, int64_t); - n = fprintf (stream, template, x); + n = fprintf (stream, format_templ, x); } break; @@ -884,16 +884,16 @@ HDfprintf (FILE *stream, const char *fmt, ...) case 'X': if (!HDstrcmp (modifier, "h")) { unsigned short x = va_arg (ap, unsigned int); - n = fprintf (stream, template, x); + n = fprintf (stream, format_templ, x); } else if (!*modifier) { unsigned int x = va_arg (ap, unsigned int); - n = fprintf (stream, template, x); + n = fprintf (stream, format_templ, x); } else if (!HDstrcmp (modifier, "l")) { unsigned long x = va_arg (ap, unsigned long); - n = fprintf (stream, template, x); + n = fprintf (stream, format_templ, x); } else { uint64_t x = va_arg(ap, uint64_t); - n = fprintf (stream, template, x); + n = fprintf (stream, format_templ, x); } break; @@ -904,10 +904,10 @@ HDfprintf (FILE *stream, const char *fmt, ...) case 'G': if (!HDstrcmp (modifier, "h")) { float x = va_arg (ap, double); - n = fprintf (stream, template, x); + n = fprintf (stream, format_templ, x); } else if (!*modifier || !HDstrcmp (modifier, "l")) { double x = va_arg (ap, double); - n = fprintf (stream, template, x); + n = fprintf (stream, format_templ, x); } else { /* * Some compilers complain when `long double' and @@ -915,10 +915,10 @@ HDfprintf (FILE *stream, const char *fmt, ...) */ #if SIZEOF_LONG_DOUBLE != SIZEOF_DOUBLE long double x = va_arg (ap, long double); - n = fprintf (stream, template, x); + n = fprintf (stream, format_templ, x); #else double x = va_arg (ap, double); - n = fprintf (stream, template, x); + n = fprintf (stream, format_templ, x); #endif } break; @@ -927,30 +927,30 @@ HDfprintf (FILE *stream, const char *fmt, ...) if (1) { haddr_t x = va_arg (ap, haddr_t); if (H5F_addr_defined(x)) { - sprintf(template, "%%%s%s%s%s%s", + sprintf(format_templ, "%%%s%s%s%s%s", leftjust?"-":"", plussign?"+":"", ldspace?" ":"", prefix?"#":"", zerofill?"0":""); if (fwidth>0) { - sprintf(template+HDstrlen(template), "%d", fwidth); + sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth); } if (sizeof(x)==SIZEOF_INT) { - HDstrcat(template, "d"); + HDstrcat(format_templ, "d"); } else if (sizeof(x)==SIZEOF_LONG) { - HDstrcat(template, "ld"); + HDstrcat(format_templ, "ld"); } else if (sizeof(x)==SIZEOF_LONG_LONG) { - HDstrcat(template, PRINTF_LL_WIDTH); - HDstrcat(template, "d"); + HDstrcat(format_templ, PRINTF_LL_WIDTH); + HDstrcat(format_templ, "d"); } - n = fprintf(stream, template, x); + n = fprintf(stream, format_templ, x); } else { - HDstrcpy(template, "%"); - if (leftjust) HDstrcat(template, "-"); + HDstrcpy(format_templ, "%"); + if (leftjust) HDstrcat(format_templ, "-"); if (fwidth) { - sprintf(template+HDstrlen(template), "%d", fwidth); + sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth); } - HDstrcat(template, "s"); - fprintf(stream, template, "UNDEF"); + HDstrcat(format_templ, "s"); + fprintf(stream, format_templ, "UNDEF"); } } break; @@ -958,7 +958,7 @@ HDfprintf (FILE *stream, const char *fmt, ...) case 'c': if (1) { char x = (char)va_arg (ap, int); - n = fprintf (stream, template, x); + n = fprintf (stream, format_templ, x); } break; @@ -966,20 +966,20 @@ HDfprintf (FILE *stream, const char *fmt, ...) case 'p': if (1) { char *x = va_arg (ap, char*); - n = fprintf (stream, template, x); + n = fprintf (stream, format_templ, x); } break; case 'n': if (1) { - template[HDstrlen(template)-1] = 'u'; - n = fprintf (stream, template, nout); + format_templ[HDstrlen(format_templ)-1] = 'u'; + n = fprintf (stream, format_templ, nout); } break; default: - HDfputs (template, stream); - n = (int)HDstrlen (template); + HDfputs (format_templ, stream); + n = (int)HDstrlen (format_templ); break; } nout += n; @@ -1413,10 +1413,10 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - hbool_t bool = va_arg (ap, hbool_t); - if (TRUE==bool) fprintf (out, "TRUE"); - else if (!bool) fprintf (out, "FALSE"); - else fprintf (out, "TRUE(%u)", (unsigned)bool); + hbool_t bool_var = va_arg (ap, hbool_t); + if (TRUE==bool_var) fprintf (out, "TRUE"); + else if (!bool_var) fprintf (out, "FALSE"); + else fprintf (out, "TRUE(%u)", (unsigned)bool_var); } break; diff --git a/src/H5Distore.c b/src/H5Distore.c index fc89a8d..c5f12a3 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -656,7 +656,7 @@ H5F_istore_new_node(H5F_t *f, H5B_ins_t op, */ static herr_t H5F_istore_found(H5F_t UNUSED *f, haddr_t addr, const void *_lt_key, - void *_udata, const void UNUSED *_rt_key) + void *_udata, const void * UNUSED _rt_key) { H5F_istore_ud1_t *udata = (H5F_istore_ud1_t *) _udata; const H5F_istore_key_t *lt_key = (const H5F_istore_key_t *) _lt_key; diff --git a/src/H5F.c b/src/H5F.c index 17b8ee3..0ff503c 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -2010,7 +2010,7 @@ done: */ static herr_t H5F_mount(H5G_entry_t *loc, const char *name, H5F_t *child, - const H5F_mprop_t UNUSED *plist) + const H5F_mprop_t * UNUSED plist) { H5G_t *mount_point = NULL; /*mount point group */ H5G_entry_t *mp_ent = NULL; /*mount point symbol table entry*/ diff --git a/src/H5FD.c b/src/H5FD.c index 25d5206..fb7d77b 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -189,7 +189,7 @@ H5FDregister(const H5FD_class_t *cls) HRETURN_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`read' and/or `write' method is not defined"); } - for (type=H5FD_MEM_DEFAULT; typefl_map[type]fl_map[type]>=H5FD_MEM_NTYPES) { HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, @@ -870,7 +870,7 @@ H5FD_close(H5FD_t *file) /* Free all free-lists, leaking any memory thus described. Also leaks * file space allocated but not used when metadata aggregation is * turned on. */ - for (i=H5FD_MEM_DEFAULT; ifl[i]; cur; cur=next) { #ifdef H5F_DEBUG nblocks++; diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 43f4793..5f67f03 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -628,7 +628,7 @@ H5FD_family_cmp(const H5FD_t *_f1, const H5FD_t *_f2) *------------------------------------------------------------------------- */ static herr_t -H5FD_family_query(const H5FD_t UNUSED *_f, unsigned long *flags /* out */) +H5FD_family_query(const H5FD_t * UNUSED _f, unsigned long *flags /* out */) { herr_t ret_value=SUCCEED; diff --git a/src/H5FDlog.c b/src/H5FDlog.c index f28ae0e..968057a 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -681,7 +681,7 @@ H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2) *------------------------------------------------------------------------- */ static herr_t -H5FD_log_query(const H5FD_t UNUSED *_f, unsigned long *flags /* out */) +H5FD_log_query(const H5FD_t * UNUSED _f, unsigned long *flags /* out */) { herr_t ret_value=SUCCEED; diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 2c880a6..fb8aa59 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -41,7 +41,7 @@ hbool_t _seen[H5FD_MEM_NTYPES]; \ \ memset(_seen, 0, sizeof _seen); \ - for (_unmapped=H5FD_MEM_SUPER; _unmapped0 && LOOPVAR0 && LOOPVAR=H5FD_MEM_NTYPES) @@ -502,7 +502,7 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, memcpy(memb_map, fa->memb_map, H5FD_MEM_NTYPES*sizeof(H5FD_mem_t)); } if (memb_fapl) { - for (mt=H5FD_MEM_DEFAULT; mtmemb_fapl[mt]>=0) { memb_fapl[mt] = H5Pcopy(fa->memb_fapl[mt]); } else { @@ -511,7 +511,7 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, } } if (memb_name) { - for (mt=H5FD_MEM_DEFAULT; mtmemb_name[mt]) { memb_name[mt] = malloc(strlen(fa->memb_name[mt])+1); strcpy(memb_name[mt], fa->memb_name[mt]); @@ -567,7 +567,7 @@ H5Pset_dxpl_multi(hid_t dxpl_id, const hid_t *memb_dxpl) H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1); if (!memb_dxpl) H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "invalid pointer", -1); - for (mt=H5FD_MEM_DEFAULT; mtmemb_dxpl[mt]>=0) { memb_dxpl[mt] = H5Pcopy(dx->memb_dxpl[mt]); } else { @@ -718,7 +718,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/, strcpy(name, "NCSAmulti"); assert(7==H5FD_MEM_NTYPES); - for (m=H5FD_MEM_SUPER; mfa.memb_map[m]; } buf[7] = 0; @@ -978,7 +978,7 @@ H5FD_multi_fapl_copy(const void *_old_fa) H5Eclear(); memcpy(new_fa, old_fa, sizeof(H5FD_multi_fapl_t)); - for (mt=H5FD_MEM_DEFAULT; mtmemb_fapl[mt]>=0) { new_fa->memb_fapl[mt] = H5Pcopy(old_fa->memb_fapl[mt]); if (new_fa->memb_fapl[mt]<0) nerrors++; @@ -991,7 +991,7 @@ H5FD_multi_fapl_copy(const void *_old_fa) } if (nerrors) { - for (mt=H5FD_MEM_DEFAULT; mtmemb_fapl[mt]>=0) H5Pclose(new_fa->memb_fapl[mt]); if (new_fa->memb_name[mt]) free(new_fa->memb_name[mt]); } @@ -1027,7 +1027,7 @@ H5FD_multi_fapl_free(void *_fa) /* Clear the error stack */ H5Eclear(); - for (mt=H5FD_MEM_DEFAULT; mtmemb_fapl[mt]>=0) H5Pclose(fa->memb_fapl[mt]); if (fa->memb_name[mt]) free(fa->memb_name[mt]); } @@ -1067,7 +1067,7 @@ H5FD_multi_dxpl_copy(const void *_old_dx) H5Eclear(); memcpy(new_dx, old_dx, sizeof(H5FD_multi_dxpl_t)); - for (mt=H5FD_MEM_DEFAULT; mtmemb_dxpl[mt]>=0) { new_dx->memb_dxpl[mt] = H5Pcopy(old_dx->memb_dxpl[mt]); if (new_dx->memb_dxpl[mt]<0) nerrors++; @@ -1075,7 +1075,7 @@ H5FD_multi_dxpl_copy(const void *_old_dx) } if (nerrors) { - for (mt=H5FD_MEM_DEFAULT; mtmemb_dxpl[mt]); free(new_dx); H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "invalid freespace objects", NULL); @@ -1109,7 +1109,7 @@ H5FD_multi_dxpl_free(void *_dx) /* Clear the error stack */ H5Eclear(); - for (mt=H5FD_MEM_DEFAULT; mtmemb_dxpl[mt]>=0) H5Pclose(dx->memb_dxpl[mt]); free(dx); @@ -1312,7 +1312,7 @@ H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2) /* Clear the error stack */ H5Eclear(); - for (mt=H5FD_MEM_DEFAULT; mtmemb[mt] && f2->memb[mt]) break; if (!cmp) { if (f1->memb[mt]) cmp = -1; @@ -1420,7 +1420,7 @@ H5FD_multi_set_eoa(H5FD_t *_file, haddr_t eoa) H5Eclear(); /* Find the subfile in which the new EOA value falls */ - for (mt=H5FD_MEM_SUPER; mtfa.memb_map[mt]; if (H5FD_MEM_DEFAULT==mmt) mmt = mt; assert(mmt>0 && mmtfa.memb_map[mt]; if (H5FD_MEM_DEFAULT==mmt) mmt = mt; assert(mmt>0 && mmtfa.memb_map[mt]; if (H5FD_MEM_DEFAULT==mmt) mmt = mt; assert(mmt>0 && mmtmemb[mt]) { H5E_BEGIN_TRY { if (H5FDflush(file->memb[mt])<0) nerrors++; diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 9c87161..a638381 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -428,7 +428,7 @@ H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2) *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_query(const H5FD_t UNUSED *_f, unsigned long *flags /* out */) +H5FD_sec2_query(const H5FD_t * UNUSED _f, unsigned long *flags /* out */) { herr_t ret_value=SUCCEED; diff --git a/src/H5FDstream.c b/src/H5FDstream.c index b85e731..1c8be7f 100644 --- a/src/H5FDstream.c +++ b/src/H5FDstream.c @@ -935,7 +935,7 @@ static herr_t H5FD_stream_close (H5FD_t *_stream) *------------------------------------------------------------------------- */ static herr_t -H5FD_stream_query(const H5FD_t UNUSED *_f, +H5FD_stream_query(const H5FD_t * UNUSED _f, unsigned long *flags/*out*/) { FUNC_ENTER (H5FD_stream_query, SUCCEED); diff --git a/src/H5Fistore.c b/src/H5Fistore.c index fc89a8d..c5f12a3 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -656,7 +656,7 @@ H5F_istore_new_node(H5F_t *f, H5B_ins_t op, */ static herr_t H5F_istore_found(H5F_t UNUSED *f, haddr_t addr, const void *_lt_key, - void *_udata, const void UNUSED *_rt_key) + void *_udata, const void * UNUSED _rt_key) { H5F_istore_ud1_t *udata = (H5F_istore_ud1_t *) _udata; const H5F_istore_key_t *lt_key = (const H5F_istore_key_t *) _lt_key; diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 6caff3f..9bcb91c 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -128,7 +128,7 @@ H5FL_BLK_DEFINE_STATIC(symbol_node); *------------------------------------------------------------------------- */ static size_t -H5G_node_sizeof_rkey(H5F_t *f, const void UNUSED *udata) +H5G_node_sizeof_rkey(H5F_t *f, const void * UNUSED udata) { return H5F_SIZEOF_SIZE(f); /*the name offset */ } @@ -411,8 +411,8 @@ H5G_node_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5G_node_t *sym) *------------------------------------------------------------------------- */ static H5G_node_t * -H5G_node_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1, - void UNUSED *_udata2) +H5G_node_load(H5F_t *f, haddr_t addr, const void * UNUSED _udata1, + void * UNUSED _udata2) { H5G_node_t *sym = NULL; size_t size = 0; @@ -625,8 +625,8 @@ H5G_node_cmp3(H5F_t *f, void *_lt_key, void *_udata, void *_rt_key) *------------------------------------------------------------------------- */ static herr_t -H5G_node_found(H5F_t *f, haddr_t addr, const void UNUSED *_lt_key, - void *_udata, const void UNUSED *_rt_key) +H5G_node_found(H5F_t *f, haddr_t addr, const void * UNUSED _lt_key, + void *_udata, const void * UNUSED _rt_key) { H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t *) _udata; H5G_node_t *sn = NULL; diff --git a/src/H5HG.c b/src/H5HG.c index f49aebd..b37c8fd 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -230,8 +230,8 @@ printf("%s: heap->obj[0].size=%d, size=%d\n",FUNC,(int)heap->obj[0].size,(int)si *------------------------------------------------------------------------- */ static H5HG_heap_t * -H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1, - void UNUSED *udata2) +H5HG_load (H5F_t *f, haddr_t addr, const void * UNUSED udata1, + void * UNUSED udata2) { H5HG_heap_t *heap = NULL; H5HG_heap_t *ret_value = NULL; diff --git a/src/H5HL.c b/src/H5HL.c index ac50afd..4e2591b 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -200,8 +200,8 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p/*out*/) *------------------------------------------------------------------------- */ static H5HL_t * -H5HL_load(H5F_t *f, haddr_t addr, const void UNUSED *udata1, - void UNUSED *udata2) +H5HL_load(H5F_t *f, haddr_t addr, const void * UNUSED udata1, + void * UNUSED udata2) { uint8_t hdr[52]; const uint8_t *p = NULL; diff --git a/src/H5I.c b/src/H5I.c index f759291..d6121c1 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -172,14 +172,14 @@ H5I_term_interface(void) if (interface_initialize_g) { /* How many groups are still being used? */ - for (grp=(H5I_type_t)0; grpid_list) n++; } /* If no groups are used then clean up */ if (0==n) { - for (grp=(H5I_type_t)0; grpstart = H5FL_ARR_ALLOC(hsize_t,src->extent.u.simple.rank,0))==NULL) + HDmemcpy(new_node,curr,sizeof(H5S_hyper_node_t)); /* copy caching information */ + if((new_node->start = H5FL_ARR_ALLOC(hsize_t,src->extent.u.simple.rank,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information"); - if((new->end = H5FL_ARR_ALLOC(hsize_t,src->extent.u.simple.rank,0))==NULL) + if((new_node->end = H5FL_ARR_ALLOC(hsize_t,src->extent.u.simple.rank,0))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information"); - HDmemcpy(new->start,curr->start,(src->extent.u.simple.rank*sizeof(hssize_t))); - HDmemcpy(new->end,curr->end,(src->extent.u.simple.rank*sizeof(hssize_t))); - new->next=NULL; + HDmemcpy(new_node->start,curr->start,(src->extent.u.simple.rank*sizeof(hssize_t))); + HDmemcpy(new_node->end,curr->end,(src->extent.u.simple.rank*sizeof(hssize_t))); + new_node->next=NULL; /* Insert into low & high bound arrays */ for(u=0; uextent.u.simple.rank; u++) { - new_hyper->lo_bounds[u][v].bound=new->start[u]; - new_hyper->lo_bounds[u][v].node=new; + new_hyper->lo_bounds[u][v].bound=new_node->start[u]; + new_hyper->lo_bounds[u][v].node=new_node; } /* end for */ v++; /* Increment the location of the next node in the boundary arrays */ /* Keep the order the same when copying */ if(new_head==NULL) - new_head=new_hyper->head=new; + new_head=new_hyper->head=new_node; else { - new_head->next=new; - new_head=new; + new_head->next=new_node; + new_head=new_node; } /* end else */ curr=curr->next; @@ -6044,7 +6044,7 @@ H5S_hyper_select_iterate_mem (int dim, H5S_hyper_iter_info_t *iter_info) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_hyper_select_iterate_mem_opt(H5S_sel_iter_t UNUSED *iter, void *buf, hid_t type_id, H5S_t *space, H5D_operator_t op, +H5S_hyper_select_iterate_mem_opt(H5S_sel_iter_t * UNUSED iter, void *buf, hid_t type_id, H5S_t *space, H5D_operator_t op, void *op_data) { H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */ diff --git a/src/H5Snone.c b/src/H5Snone.c index 553e3fd..c14c90d 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -85,7 +85,7 @@ H5S_none_select_serialize (const H5S_t *space, uint8_t *buf) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_none_select_deserialize (H5S_t *space, const uint8_t UNUSED *buf) +H5S_none_select_deserialize (H5S_t *space, const uint8_t * UNUSED buf) { herr_t ret_value=FAIL; /* return value */ @@ -208,8 +208,8 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_none_select_iterate(void UNUSED *buf, hid_t UNUSED type_id, H5S_t UNUSED *space, H5D_operator_t UNUSED op, - void UNUSED *operator_data) +H5S_none_select_iterate(void * UNUSED buf, hid_t UNUSED type_id, H5S_t * UNUSED space, H5D_operator_t UNUSED op, + void * UNUSED operator_data) { herr_t ret_value=SUCCEED; /* return value */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 119da32..9668233 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -127,7 +127,7 @@ H5S_point_init (const H5S_t *space, H5S_sel_iter_t *sel_iter) --------------------------------------------------------------------------*/ herr_t H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hssize_t **_coord) { - H5S_pnt_node_t *top, *curr, *new; /* Point selection nodes */ + H5S_pnt_node_t *top, *curr, *new_node; /* Point selection nodes */ const hssize_t *coord=(const hssize_t *)_coord; /* Pointer to the actual coordinates */ unsigned i; /* Counter */ herr_t ret_value=FAIL; /* return value */ @@ -145,7 +145,7 @@ herr_t H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hss top=curr=NULL; for(i=0; iextent.u.simple.rank); #endif /* QAK */ - if((new->pnt = H5MM_malloc(space->extent.u.simple.rank*sizeof(hssize_t)))==NULL) + if((new_node->pnt = H5MM_malloc(space->extent.u.simple.rank*sizeof(hssize_t)))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information"); #ifdef QAK @@ -161,14 +161,14 @@ herr_t H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hss #endif /* QAK */ /* Copy over the coordinates */ - HDmemcpy(new->pnt,coord+(i*space->extent.u.simple.rank),(space->extent.u.simple.rank*sizeof(hssize_t))); + HDmemcpy(new_node->pnt,coord+(i*space->extent.u.simple.rank),(space->extent.u.simple.rank*sizeof(hssize_t))); #ifdef QAK printf("%s: check 1.3\n",FUNC); { int j; for(j=0; jextent.u.simple.rank; j++) { - printf("%s: pnt[%d]=%d\n",FUNC,(int)j,(int)new->pnt[j]); + printf("%s: pnt[%d]=%d\n",FUNC,(int)j,(int)new_node->pnt[j]); printf("%s: coord[%d][%d]=%d\n", FUNC, (int)i, (int)j, (int)*(coord+(i*space->extent.u.simple.rank)+j)); @@ -177,12 +177,12 @@ herr_t H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hss #endif /* QAK */ /* Link into list */ - new->next=NULL; + new_node->next=NULL; if(top==NULL) - top=new; + top=new_node; else - curr->next=new; - curr=new; + curr->next=new_node; + curr=new_node; } /* end for */ #ifdef QAK printf("%s: check 2.0\n",FUNC); @@ -198,13 +198,13 @@ herr_t H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hss space->select.sel_info.pnt_lst->head=top; } else { /* op==H5S_SELECT_APPEND */ - new=space->select.sel_info.pnt_lst->head; - if(new!=NULL) - while(new->next!=NULL) - new=new->next; + new_node=space->select.sel_info.pnt_lst->head; + if(new_node!=NULL) + while(new_node->next!=NULL) + new_node=new_node->next; /* Append new list to point selection */ - new->next=top; + new_node->next=top; } /* Add the number of elements in the new selection */ @@ -234,7 +234,7 @@ done: *------------------------------------------------------------------------- */ static hsize_t -H5S_point_favail (const H5S_t UNUSED *space, +H5S_point_favail (const H5S_t * UNUSED space, const H5S_sel_iter_t *sel_iter, hsize_t max) { FUNC_ENTER (H5S_point_favail, 0); @@ -728,7 +728,7 @@ H5S_point_npoints (const H5S_t *space) herr_t H5S_point_copy (H5S_t *dst, const H5S_t *src) { - H5S_pnt_node_t *curr, *new, *new_head; /* Point information nodes */ + H5S_pnt_node_t *curr, *new_node, *new_head; /* Point information nodes */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER (H5S_point_copy, FAIL); @@ -748,30 +748,30 @@ H5S_point_copy (H5S_t *dst, const H5S_t *src) new_head=NULL; while(curr!=NULL) { /* Create each point */ - if((new=H5MM_malloc(sizeof(H5S_pnt_node_t)))==NULL) + if((new_node=H5MM_malloc(sizeof(H5S_pnt_node_t)))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node"); - if((new->pnt = H5MM_malloc(src->extent.u.simple.rank*sizeof(hssize_t)))==NULL) + if((new_node->pnt = H5MM_malloc(src->extent.u.simple.rank*sizeof(hssize_t)))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information"); - HDmemcpy(new->pnt,curr->pnt,(src->extent.u.simple.rank*sizeof(hssize_t))); - new->next=NULL; + HDmemcpy(new_node->pnt,curr->pnt,(src->extent.u.simple.rank*sizeof(hssize_t))); + new_node->next=NULL; #ifdef QAK printf("%s: check 5.0\n",FUNC); { int i; for(i=0; iextent.u.simple.rank; i++) - printf("%s: check 5.1, new->pnt[%d]=%d\n",FUNC,i,(int)new->pnt[i]); + printf("%s: check 5.1, new_node->pnt[%d]=%d\n",FUNC,i,(int)new_node->pnt[i]); } #endif /* QAK */ /* Keep the order the same when copying */ if(new_head==NULL) - new_head=dst->select.sel_info.pnt_lst->head=new; + new_head=dst->select.sel_info.pnt_lst->head=new_node; else { - new_head->next=new; - new_head=new; + new_head->next=new_node; + new_head=new_node; } /* end else */ curr=curr->next; diff --git a/src/H5T.c b/src/H5T.c index 2b22e10..0cddf25 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1328,7 +1328,7 @@ H5T_init_interface(void) *------------------------------------------------------------------------- */ static int -H5T_unlock_cb (void *_dt, const void UNUSED *key) +H5T_unlock_cb (void *_dt, const void * UNUSED key) { H5T_t *dt = (H5T_t *)_dt; @@ -6979,7 +6979,7 @@ done: */ hid_t H5Tarray_create(hid_t base_id, int ndims, const hsize_t dim[/* ndims */], - const int UNUSED perm[/* ndims */]) + const int * UNUSED perm/* ndims */) { H5T_t *base = NULL; /* base data type */ H5T_t *dt = NULL; /* new array data type */ @@ -7192,7 +7192,7 @@ H5Tget_array_dims(hid_t type_id, hsize_t dims[], int perm[]) *------------------------------------------------------------------------- */ static herr_t -H5T_print_stats(H5T_path_t UNUSED *path, int UNUSED *nprint/*in,out*/) +H5T_print_stats(H5T_path_t * UNUSED path, int * UNUSED nprint/*in,out*/) { #ifdef H5T_DEBUG hsize_t nbytes; diff --git a/test/dsets.c b/test/dsets.c index c55e25f..40d5f90 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -332,8 +332,8 @@ test_tconv(hid_t file) */ static size_t bogus(unsigned int UNUSED flags, size_t UNUSED cd_nelmts, - const unsigned int UNUSED cd_values[], size_t nbytes, - size_t UNUSED *buf_size, void UNUSED **buf) + const unsigned int * UNUSED cd_values, size_t nbytes, + size_t * UNUSED buf_size, void ** UNUSED buf) { return nbytes; } diff --git a/test/h5test.c b/test/h5test.c index c647a21..4fae090 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -92,7 +92,7 @@ static const char *multi_letters = "msbrglo"; *------------------------------------------------------------------------- */ herr_t -h5_errors(void UNUSED *client_data) +h5_errors(void * UNUSED client_data) { H5_FAILED(); H5Eprint (stdout); @@ -150,7 +150,7 @@ h5_cleanup(const char *base_name[], hid_t fapl) H5FD_mem_t mt; assert(strlen(multi_letters)==H5FD_MEM_NTYPES); - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt=mt+1) { HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); HDremove(temp); /*don't care if it fails*/ @@ -438,7 +438,7 @@ h5_fileaccess(void) HDmemset(memb_addr, 0, sizeof memb_addr); assert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); - for (mt=H5FD_MEM_DEFAULT; mtobjs[i].recorded) { dset = H5Dopen(gid, type_table->objs[i].objname); type = H5Dget_type(dset); - sprintf(typename, "#%lu:%lu", + sprintf(type_name, "#%lu:%lu", type_table->objs[i].objno[0], type_table->objs[i].objno[1]); - dump_named_datatype(type, typename); + dump_named_datatype(type, type_name); H5Tclose(type); H5Dclose(dset); } @@ -1956,7 +1956,7 @@ set_output_file(const char *fname) *------------------------------------------------------------------------- */ static void -handle_attributes(hid_t fid, char *attr, void UNUSED *data) +handle_attributes(hid_t fid, char *attr, void * UNUSED data) { dump_selected_attr(fid, attr); } @@ -2215,7 +2215,7 @@ handle_datasets(hid_t fid, char *dset, void *data) *------------------------------------------------------------------------- */ static void -handle_groups(hid_t fid, char *group, void UNUSED *data) +handle_groups(hid_t fid, char *group, void * UNUSED data) { H5G_stat_t statbuf; hid_t gid; @@ -2253,7 +2253,7 @@ handle_groups(hid_t fid, char *group, void UNUSED *data) *------------------------------------------------------------------------- */ static void -handle_links(hid_t fid, char *links, void UNUSED *data) +handle_links(hid_t fid, char *links, void * UNUSED data) { H5G_stat_t statbuf; @@ -2309,11 +2309,11 @@ handle_links(hid_t fid, char *links, void UNUSED *data) *------------------------------------------------------------------------- */ static void -handle_datatypes(hid_t fid, char *type, void UNUSED *data) +handle_datatypes(hid_t fid, char *type, void * UNUSED data) { - hid_t typeid; + hid_t type_id; - if ((typeid = H5Topen(fid, type)) < 0) { + if ((type_id = H5Topen(fid, type)) < 0) { /* check if type is unamed data type */ int idx = 0; @@ -2348,15 +2348,15 @@ handle_datatypes(hid_t fid, char *type, void UNUSED *data) d_status = EXIT_FAILURE; } else { hid_t dsetid = H5Dopen(fid, type_table->objs[idx].objname); - typeid = H5Dget_type(dsetid); - dump_named_datatype(typeid, type); - H5Tclose(typeid); + type_id = H5Dget_type(dsetid); + dump_named_datatype(type_id, type); + H5Tclose(type_id); H5Dclose(dsetid); } } else { - dump_named_datatype(typeid, type); + dump_named_datatype(type_id, type); - if (H5Tclose(typeid) < 0) + if (H5Tclose(type_id) < 0) d_status = EXIT_FAILURE; } } @@ -3137,7 +3137,7 @@ lookup_ref_path(hobj_ref_t * ref) *------------------------------------------------------------------------- */ static herr_t -fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data) +fill_ref_path_table(hid_t group, const char *name, void * UNUSED op_data) { hid_t obj; char *tmp; @@ -3912,7 +3912,7 @@ xml_dump_dataspace(hid_t space) *------------------------------------------------------------------------- */ static void -xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED *sset) +xml_dump_data(hid_t obj_id, int obj_data, struct subset_t * UNUSED sset) { h5dump_t *outputformat = &xml_dataformat; int status = -1; @@ -4016,7 +4016,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED *sset) *------------------------------------------------------------------------- */ static herr_t -xml_dump_attr(hid_t attr, const char *attr_name, void UNUSED * op_data) +xml_dump_attr(hid_t attr, const char *attr_name, void * UNUSED op_data) { hid_t attr_id, type, space; char *t_aname = xml_escape_the_name(attr_name); @@ -4275,7 +4275,7 @@ xml_dump_group(hid_t gid, const char *name) H5G_stat_t statbuf; char *cp; hid_t dset, type; - char typename[1024], *tmp = NULL; + char type_name[1024], *tmp = NULL; char *par = NULL; int i; int isRoot = 0; @@ -4347,10 +4347,10 @@ xml_dump_group(hid_t gid, const char *name) if (!type_table->objs[i].recorded) { dset = H5Dopen(gid, type_table->objs[i].objname); type = H5Dget_type(dset); - sprintf(typename, "#%lu:%lu", + sprintf(type_name, "#%lu:%lu", type_table->objs[i].objno[0], type_table->objs[i].objno[1]); - dump_function_table->dump_named_datatype_function(type, typename); + dump_function_table->dump_named_datatype_function(type, type_name); H5Tclose(type); H5Dclose(dset); } @@ -4377,10 +4377,10 @@ xml_dump_group(hid_t gid, const char *name) if (!type_table->objs[i].recorded) { dset = H5Dopen(gid, type_table->objs[i].objname); type = H5Dget_type(dset); - sprintf(typename, "#%lu:%lu", + sprintf(type_name, "#%lu:%lu", type_table->objs[i].objno[0], type_table->objs[i].objno[1]); - dump_function_table->dump_named_datatype_function(type, typename); + dump_function_table->dump_named_datatype_function(type, type_name); H5Tclose(type); H5Dclose(dset); } @@ -4662,7 +4662,7 @@ check_compression(hid_t dcpl) *------------------------------------------------------------------------- */ static void -xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED *sset) +xml_dump_dataset(hid_t did, const char *name, struct subset_t * UNUSED sset) { hid_t type, space; hid_t dcpl; diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 6be56ae..8aa69f9 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1246,7 +1246,7 @@ dump_dataset_values(hid_t dset) *------------------------------------------------------------------------- */ static herr_t -list_attr (hid_t obj, const char *attr_name, void UNUSED *op_data) +list_attr (hid_t obj, const char *attr_name, void * UNUSED op_data) { hid_t attr, space, type, p_type; hsize_t size[64], nelmts=1; @@ -1404,7 +1404,7 @@ dataset_list1(hid_t dset) *------------------------------------------------------------------------- */ static herr_t -dataset_list2(hid_t dset, const char UNUSED *name) +dataset_list2(hid_t dset, const char * UNUSED name) { hid_t dcpl; /*dataset creation property list*/ hid_t type; /*data type of dataset */ @@ -1591,7 +1591,7 @@ group_list2(hid_t grp, const char *name) *------------------------------------------------------------------------- */ static herr_t -datatype_list2(hid_t type, const char UNUSED *name) +datatype_list2(hid_t type, const char * UNUSED name) { if (verbose_g>0) { printf(" %-10s ", "Type:"); diff --git a/tools/h5toh4/h5toh4.c b/tools/h5toh4/h5toh4.c index fca2cf4..4995c29 100644 --- a/tools/h5toh4/h5toh4.c +++ b/tools/h5toh4/h5toh4.c @@ -464,125 +464,125 @@ done: *-----------------------------------------------------------------------*/ herr_t convert_group (hid_t gid, char *name, op_data_t *op_data) { -H5G_stat_t statbuf; + H5G_stat_t statbuf; - int32 hfile_id; - int32 vgroup_id; - int32 obj_idx; - int32 status; - int idx, flag; + int32 hfile_id; + int32 vgroup_id; + int32 obj_idx; + int32 status; + int idx, flag; - hfile_id = op_data->hfile_id; + hfile_id = op_data->hfile_id; - if ((vgroup_id = Vattach(hfile_id, -1, "w")) <= 0 ) { - fprintf(stderr,"Error: Unable to create new vgroup\n"); - DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); - return(vgroup_id); - } + if ((vgroup_id = Vattach(hfile_id, -1, "w")) <= 0 ) { + fprintf(stderr,"Error: Unable to create new vgroup\n"); + DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); + return(vgroup_id); + } - if ((status = Vsetname(vgroup_id, name)) != SUCCEED ) { - fprintf(stderr,"Error: Unable to set name on new vgroup\n"); - DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); - return(status); - } + if ((status = Vsetname(vgroup_id, name)) != SUCCEED ) { + fprintf(stderr,"Error: Unable to set name on new vgroup\n"); + DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); + return(status); + } - if ((status = Vsetclass(vgroup_id, "HDF5")) != SUCCEED ) { - fprintf(stderr,"Error: Unable to set class on new vgroup\n"); - DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); - return(status); - } + if ((status = Vsetclass(vgroup_id, "HDF5")) != SUCCEED ) { + fprintf(stderr,"Error: Unable to set class on new vgroup\n"); + DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); + return(status); + } - if (op_data->vgroup_id == 0) { - obj_idx = -1; /* Indexes assigned below start from 0 */ - } else { - if ((obj_idx = Vinsert(op_data->vgroup_id, vgroup_id)) < 0) { - fprintf(stderr,"Error: Index %d of the new vgroup is illegal\n",(int)obj_idx); - DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); - return(obj_idx); - } - } - op_data->vgroup_id = vgroup_id; - op_data->sds_id = 0; - op_data->vdata_id = 0; - op_data->obj_idx = obj_idx; - + if (op_data->vgroup_id == 0) { + obj_idx = -1; /* Indexes assigned below start from 0 */ + } else { + if ((obj_idx = Vinsert(op_data->vgroup_id, vgroup_id)) < 0) { + fprintf(stderr,"Error: Index %d of the new vgroup is illegal\n",(int)obj_idx); + DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); + return(obj_idx); + } + } + op_data->vgroup_id = vgroup_id; + op_data->sds_id = 0; + op_data->vdata_id = 0; + op_data->obj_idx = obj_idx; + - /* hard link */ - if ((status = H5Gget_objinfo(gid, ".", TRUE, &statbuf)) != SUCCEED ) { - fprintf(stderr,"Error: H5Gget_objinfo() did not work\n"); - DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); - return (status); - } + /* hard link */ + if ((status = H5Gget_objinfo(gid, ".", TRUE, &statbuf)) != SUCCEED ) { + fprintf(stderr,"Error: H5Gget_objinfo() did not work\n"); + DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); + return (status); + } - if (HDstrcmp(name,"/") == 0) { /* this is the root group, just iterate */ + if (HDstrcmp(name,"/") == 0) { /* this is the root group, just iterate */ - if ((status = H5Aiterate(gid, NULL, (H5A_operator_t)convert_attr, op_data)) != SUCCEED ) { - fprintf(stderr,"Error: Unable to iterate over all of the attributes\n"); - DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); - return(status); - } + if ((status = H5Aiterate(gid, NULL, (H5A_operator_t)convert_attr, op_data)) != SUCCEED ) { + fprintf(stderr,"Error: Unable to iterate over all of the attributes\n"); + DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); + return(status); + } - if ((status = H5Giterate(gid, ".", NULL, (H5G_operator_t)convert_all, op_data)) != SUCCEED ) { - fprintf(stderr,"Error: Unable to iterate over all of the groups\n"); - DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); - return(status); - } + if ((status = H5Giterate(gid, ".", NULL, (H5G_operator_t)convert_all, op_data)) != SUCCEED ) { + fprintf(stderr,"Error: Unable to iterate over all of the groups\n"); + DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); + return(status); + } - } else { + } else { - if ((idx = get_table_idx(group_table, statbuf.objno)) < 0 ) { + if ((idx = get_table_idx(group_table, statbuf.objno)) < 0 ) { - fprintf(stderr,"Error: object not found, %s\n",name); - DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); - status = FAIL; + fprintf(stderr,"Error: object not found, %s\n",name); + DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); + status = FAIL; - } else if((flag = get_tableflag(group_table,idx)) < 0 ) { - - fprintf(stderr,"Error: get_tableflag() should never return < 0\n"); - DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); - status = FAIL; + } else if((flag = get_tableflag(group_table,idx)) < 0 ) { + + fprintf(stderr,"Error: get_tableflag() should never return < 0\n"); + DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); + status = FAIL; - } else if(flag == TRUE ) { /* this has already been converted, don't convert the attributes again */ + } else if(flag == TRUE ) { /* this has already been converted, don't convert the attributes again */ - if ((status = H5Giterate(gid, ".", NULL, (H5G_operator_t)convert_all, op_data)) != SUCCEED ) { - fprintf(stderr,"Error: Unable to iterate over all of the groups\n"); - DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); - return(status); - } + if ((status = H5Giterate(gid, ".", NULL, (H5G_operator_t)convert_all, op_data)) != SUCCEED ) { + fprintf(stderr,"Error: Unable to iterate over all of the groups\n"); + DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); + return(status); + } - } else { /* flag == FALSE */ + } else { /* flag == FALSE */ - /* this is now being converted */ - if ((status = set_tableflag(group_table,idx)) < 0 ) { - fprintf(stderr,"Error: set_tableflag should never return < 0\n"); - DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); - return(status); - } + /* this is now being converted */ + if ((status = set_tableflag(group_table,idx)) < 0 ) { + fprintf(stderr,"Error: set_tableflag should never return < 0\n"); + DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); + return(status); + } - if ((status = H5Aiterate(gid, NULL, (H5A_operator_t)convert_attr, op_data)) != SUCCEED ) { - fprintf(stderr,"Error: Unable to iterate over all of the attributes\n"); - DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); - return(status); - } + if ((status = H5Aiterate(gid, NULL, (H5A_operator_t)convert_attr, op_data)) != SUCCEED ) { + fprintf(stderr,"Error: Unable to iterate over all of the attributes\n"); + DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); + return(status); + } - if ((status = H5Giterate(gid, ".", NULL, (H5G_operator_t)convert_all, op_data)) != SUCCEED ) { - fprintf(stderr,"Error: Unable to iterate over all of the groups\n"); - DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); - return(status); - } + if ((status = H5Giterate(gid, ".", NULL, (H5G_operator_t)convert_all, op_data)) != SUCCEED ) { + fprintf(stderr,"Error: Unable to iterate over all of the groups\n"); + DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); + return(status); + } - } + } - } + } - if ((status = Vdetach(vgroup_id)) != SUCCEED ) { - fprintf(stderr,"Error: Unable to detach the new Vgroup\n"); - DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); - status = FAIL; - } + if ((status = Vdetach(vgroup_id)) != SUCCEED ) { + fprintf(stderr,"Error: Unable to detach the new Vgroup\n"); + DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_group", __FILE__, __LINE__); + status = FAIL; + } - return status; + return status; } @@ -601,36 +601,36 @@ H5G_stat_t statbuf; *-----------------------------------------------------------------------*/ herr_t convert_dataset (hid_t did, char *name, op_data_t *op_data) { -hid_t type, space, class, mem_type, type2; -/* H5G_stat_t statbuf; */ -size_t typesize; -int i, idx; -int32 dim_sizes[32], start[32], edges[32]; -int ndims; -int ndimf; -hsize_t dims[32], maxdims[32]; -hsize_t dimf[4]; -int permf[4]; -int32 hfile_id; -int32 sd_id; -int32 sds_id; -int32 vdata_id; -int32 vgroup_id; -int32 n_values; -int32 status; -int32 h4_type; -int32 recsize; -int32 n_records, num_of_recs, record_pos; -int nmembers; -char *buffer=NULL; /* read/write buffer*/ -char fieldname_list[4096] = "\0"; -char *fieldname=NULL; -hid_t fieldtype; -int32 order; -off_t offset; -off_t offset_array[512]; -hid_t h4type_array[512], memtype_array[512]; -int32 order_array[512]; + hid_t type, space, t_class, mem_type, type2; + /* H5G_stat_t statbuf; */ + size_t typesize; + int i, idx; + int32 dim_sizes[32], start[32], edges[32]; + int ndims; + int ndimf; + hsize_t dims[32], maxdims[32]; + hsize_t dimf[4]; + int permf[4]; + int32 hfile_id; + int32 sd_id; + int32 sds_id; + int32 vdata_id; + int32 vgroup_id; + int32 n_values; + int32 status; + int32 h4_type; + int32 recsize; + int32 n_records, num_of_recs, record_pos; + int nmembers; + char *buffer=NULL; /* read/write buffer*/ + char fieldname_list[4096] = "\0"; + char *fieldname=NULL; + hid_t fieldtype; + int32 order; + off_t offset; + off_t offset_array[512]; + hid_t h4type_array[512], memtype_array[512]; + int32 order_array[512]; /* hard link */ @@ -670,14 +670,14 @@ int32 order_array[512]; return status; } - if ((class = H5Tget_class(type)) < 0 ) { + if ((t_class = H5Tget_class(type)) < 0 ) { fprintf(stderr,"Error: problem with getting class\n"); DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_dataset", __FILE__, __LINE__); - status = class; + status = t_class; return status; } - switch (class) { + switch (t_class) { case H5T_INTEGER: case H5T_FLOAT: sd_id = op_data->sd_id; @@ -1053,7 +1053,7 @@ int32 order_array[512]; } break; default: - fprintf(stderr,"Error: %d class not found\n",class); + fprintf(stderr,"Error: %d class not found\n",t_class); DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_dataset", __FILE__, __LINE__); } @@ -1094,20 +1094,20 @@ int32 order_array[512]; herr_t convert_attr (hid_t attr, char *attr_name, op_data_t *op_data) { -hid_t attr_id, type, space, mem_type, class; -size_t typesize; -char *attr_values=NULL; -int32 status; -int32 h4_type; -int32 sds_id; -int32 vdata_id; -int32 vgroup_id; -int32 n_values; -int32 order; -hid_t fxdlenstr; -size_t lenstr; -H5T_cset_t cset; -H5T_str_t strpad; + hid_t attr_id, type, space, mem_type, t_class; + size_t typesize; + char *attr_values=NULL; + int32 status; + int32 h4_type; + int32 sds_id; + int32 vdata_id; + int32 vgroup_id; + int32 n_values; + int32 order; + hid_t fxdlenstr; + size_t lenstr; + H5T_cset_t cset; + H5T_str_t strpad; sds_id = op_data->sds_id; vdata_id = op_data->vdata_id; @@ -1122,14 +1122,14 @@ H5T_str_t strpad; return status; } - if ((class = H5Tget_class(type)) < 0 ) { + if ((t_class = H5Tget_class(type)) < 0 ) { fprintf(stderr,"Error: problem with getting class\n"); DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_attr", __FILE__, __LINE__); - status = class; + status = t_class; return status; } - switch (class) { + switch (t_class) { case H5T_INTEGER: case H5T_FLOAT: @@ -1364,7 +1364,7 @@ H5T_str_t strpad; fprintf(stderr,"Warning: H5T_COMPOUND attribute not implemented.\n"); break; default: - fprintf(stderr,"Error: %d class not found\n",class); + fprintf(stderr,"Error: %d class not found\n",t_class); DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_attr", __FILE__, __LINE__); status = FAIL; } @@ -1736,7 +1736,7 @@ convert_shared_dataset(hid_t did, int idx, op_data_t *op_data) int32 vdata_ref; int32 sds_index; int32 numtagref; - hid_t type, space, class; + hid_t type, space, t_class; hsize_t dims[32], maxdims[32]; int n_values, ndims; @@ -1782,14 +1782,14 @@ convert_shared_dataset(hid_t did, int idx, op_data_t *op_data) return status; } - if ((class = H5Tget_class(type)) < 0 ) { + if ((t_class = H5Tget_class(type)) < 0 ) { fprintf(stderr,"Error: problem with getting class\n"); DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_shared_dataset", __FILE__, __LINE__); - status = class; + status = t_class; return status; } - switch (class) { + switch (t_class) { case H5T_INTEGER: case H5T_FLOAT: sd_id = op_data->sd_id; @@ -1857,7 +1857,7 @@ convert_shared_dataset(hid_t did, int idx, op_data_t *op_data) } break; default: - fprintf(stderr,"Error: %d class not found\n",class); + fprintf(stderr,"Error: %d class not found\n",t_class); DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_shared_dataset", __FILE__, __LINE__); status = FAIL; } @@ -1981,16 +1981,16 @@ convert_dataset_string (hid_t did, char *name, op_data_t *op_data) { int32 hfile_id; int32 vgroup_id; int32 vdata_id; -hid_t fxdlenstr, space, class, mem_type; -const char* fieldname = {"string"}; -const char* fieldname_list = fieldname; -char *buffer; -int32 status; -int32 h4_type; -int32 recsize, n_records, n_values, num_of_recs, record_pos; -size_t lenstr; -H5T_cset_t cset; -H5T_str_t strpad; + hid_t fxdlenstr, space, t_class, mem_type; + const char* fieldname = {"string"}; + const char* fieldname_list = fieldname; + char *buffer; + int32 status; + int32 h4_type; + int32 recsize, n_records, n_values, num_of_recs, record_pos; + size_t lenstr; + H5T_cset_t cset; + H5T_str_t strpad; if ((fxdlenstr = H5Dget_type(did)) <= 0) { fprintf(stderr, "Error: H5Dget_type() didn't return appropriate value.\n"); @@ -1999,10 +1999,10 @@ H5T_str_t strpad; return status; } - if ((class = H5Tget_class(fxdlenstr)) != H5T_STRING ) { + if ((t_class = H5Tget_class(fxdlenstr)) != H5T_STRING ) { fprintf(stderr,"Error: problem with getting class\n"); DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_shared_dataset", __FILE__, __LINE__); - status = class; + status = t_class; return status; } @@ -2172,18 +2172,18 @@ H5T_str_t strpad; *-----------------------------------------------------------------------*/ static herr_t h5atomic_type_to_h4type(const hid_t h5type, hid_t* h5memtype, size_t* h5memsize, int32* h4type) { - H5T_class_t class; + H5T_class_t t_class; size_t h5typesize, h4typesize; H5T_sign_t sign; hid_t mem_datatype = FAIL; - if ((class = H5Tget_class(h5type)) < 0 ) { + if ((t_class = H5Tget_class(h5type)) < 0 ) { fprintf(stderr,"Error: problem with getting type class\n"); DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "h5atomic_type_to_h4type", __FILE__, __LINE__); return FAIL; } - switch(class){ + switch(t_class){ case H5T_INTEGER: if ((h5typesize = H5Tget_size(h5type)) == 0 ) { fprintf(stderr,"Error: problem with getting type size\n"); -- cgit v0.12