diff options
Diffstat (limited to 'tools/src')
-rw-r--r-- | tools/src/h5import/h5import.c | 122 | ||||
-rw-r--r-- | tools/src/h5import/h5import.h | 4 |
2 files changed, 63 insertions, 63 deletions
diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 42ce317..3989c29 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -156,7 +156,7 @@ int main(int argc, char *argv[]) break; case 5: /* get outfile found */ - if (HDstrlen(argv[i]) > 255) { + if (HDstrlen(argv[i]) > MAX_PATH_NAME_LENGTH) { (void) HDfprintf(stderr, err10, argv[i]); goto err; } @@ -1371,9 +1371,9 @@ static int allocateFloatStorage(struct Input *in) static int processConfigurationFile(char *infile, struct Input *in) { FILE *strm = NULL; - char key[255]; + char key[MAX_PATH_NAME_LENGTH]; int kindex; - char temp[255]; + char temp[MAX_PATH_NAME_LENGTH]; int ival; int scanret; int retval = -1; @@ -1451,16 +1451,16 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } - scanret = fscanf(strm, "%s", key); + scanret = fscanf(strm, "%254s", key); if((scanret == 1) && !HDstrcmp("HDF5", key)) { #ifdef H5DEBUGIMPORT int pndx; HDprintf("\nh5dump file\n"); #endif in->h5dumpInput = 1; - scanret = fscanf(strm, "%s", temp); /* filename */ - scanret = fscanf(strm, "%s", temp); /* start bracket */ - scanret = fscanf(strm, "%s", key); /* DATASET */ + scanret = fscanf(strm, "%254s", temp); /* filename */ + scanret = fscanf(strm, "%254s", temp); /* start bracket */ + scanret = fscanf(strm, "%254s", key); /* DATASET */ while (scanret == 1) { if(!HDstrcmp("DATASET", key)) { /* PATH */ #ifdef H5DEBUGIMPORT @@ -1470,7 +1470,7 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, err3a, infile); goto error; } - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1482,7 +1482,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } in->configOptionVector[PATH] = 1; - scanret = fscanf(strm, "%s", temp); /* start bracket */ + scanret = fscanf(strm, "%254s", temp); /* start bracket */ #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASET %s found\n", temp); #endif @@ -1496,7 +1496,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1533,20 +1533,20 @@ static int processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATATYPE STRING found\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump DATATYPE STRING %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* string properties */ + if (fscanf(strm, "%254s", temp) != 1) { /* string properties */ (void) HDfprintf(stderr, "%s", err18); goto error; } while (get_next_prop) { if(!HDstrcmp("STRSIZE", temp)) { /* STRSIZE */ - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err19); goto error; } @@ -1566,7 +1566,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } } else if(!HDstrcmp("STRPAD", temp)) { /* STRPAD */ - if (fscanf(strm, "%s", temp) != 1) { /* STRPAD type */ + if (fscanf(strm, "%254s", temp) != 1) { /* STRPAD type */ (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1575,7 +1575,7 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif } else if(!HDstrcmp("CSET", key)) { /* CSET */ - if (fscanf(strm, "%s", temp) != 1) { /* CSET type */ + if (fscanf(strm, "%254s", temp) != 1) { /* CSET type */ (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1585,7 +1585,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } else if(!HDstrcmp("CTYPE", temp)) { /* CTYPE */ - if (fscanf(strm, "%s", temp) != 1) { /* CTYPE type */ + if (fscanf(strm, "%254s", temp) != 1) { /* CTYPE type */ (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1593,7 +1593,7 @@ static int processConfigurationFile(char *infile, struct Input *in) HDprintf("h5dump DATATYPE STRING CTYPE %s found\n", temp); #endif } /* if(!HDstrcmp("CSET", key)) */ - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1612,7 +1612,7 @@ static int processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE key\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1628,14 +1628,14 @@ static int processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE SIMPLE found\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -1646,7 +1646,7 @@ static int processConfigurationFile(char *infile, struct Input *in) int get_next_dim = 1; int i = 0; - if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void) HDfprintf(stderr, err16c, infile); goto error; } @@ -1656,7 +1656,7 @@ static int processConfigurationFile(char *infile, struct Input *in) while (get_next_dim) { char *more = temp; temp_dims[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -1699,7 +1699,7 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, err5b, infile); goto error; } - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1710,7 +1710,7 @@ static int processConfigurationFile(char *infile, struct Input *in) if ((in->maxsizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { goto error; } - if (fscanf(strm, "%s", temp) != 1) { /* start paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -1724,7 +1724,7 @@ static int processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE SIMPLE process max dim values\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* max dim with optional comma */ + if (fscanf(strm, "%254s", temp) != 1) { /* max dim with optional comma */ (void) HDfprintf(stderr, err16c, infile); goto error; } @@ -1743,7 +1743,7 @@ static int processConfigurationFile(char *infile, struct Input *in) char *more = temp; in->maxsizeOfDimension[i] = HDstrtoull(more, &more, 10); } - if (fscanf(strm, "%s", temp) != 1) { /* max dim or end paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* max dim or end paren */ (void) HDfprintf(stderr, err16c, infile); goto error; } @@ -1774,7 +1774,7 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, err16c, infile); goto error; } - scanret = fscanf(strm, "%s", temp); /* end bracket */ + scanret = fscanf(strm, "%254s", temp); /* end bracket */ #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif @@ -1789,14 +1789,14 @@ static int processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump STORAGE_LAYOUT key\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump STORAGE_LAYOUT %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* CHUNKED */ + if (fscanf(strm, "%254s", temp) != 1) { /* CHUNKED */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -1808,7 +1808,7 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, "Unable to allocate dynamic memory.\n"); goto error; } - if (fscanf(strm, "%s", temp) != 1) { /* start paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -1819,7 +1819,7 @@ static int processConfigurationFile(char *infile, struct Input *in) int get_next_dim = 1; int icount = 0; - if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void) HDfprintf(stderr, err16c, infile); goto error; } @@ -1829,7 +1829,7 @@ static int processConfigurationFile(char *infile, struct Input *in) while (get_next_dim) { char *more = temp; in->sizeOfChunk[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -1861,7 +1861,7 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, err5b, infile); goto error; } - if (fscanf(strm, "%s", temp) != 1) { /* SIZE */ + if (fscanf(strm, "%254s", temp) != 1) { /* SIZE */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -1878,7 +1878,7 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif } while (HDstrcmp("}", temp)) { - if (fscanf(strm, "%s", temp) != 1) { /* end bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1893,14 +1893,14 @@ static int processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS key\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -1911,21 +1911,21 @@ static int processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS COMPRESSION found\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* DEFLATE */ + if (fscanf(strm, "%254s", temp) != 1) { /* DEFLATE */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* bgin bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* bgin bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* LEVEL */ + if (fscanf(strm, "%254s", temp) != 1) { /* LEVEL */ (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1940,7 +1940,7 @@ static int processConfigurationFile(char *infile, struct Input *in) HDprintf("h5dump FILTERS COMPRESSION LEVEL %d found\n", ival); #endif in->compressionParam = ival; - if (fscanf(strm, "%s", temp) != 1) { /* end bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1962,7 +1962,7 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif in->configOptionVector[COMPRESS] = 0; } - if (fscanf(strm, "%s", temp) != 1) { /* end bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1976,14 +1976,14 @@ static int processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump SUBSET key\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err20, infile); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump SUBSET %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* SUBSET keyword */ + if (fscanf(strm, "%254s", temp) != 1) { /* SUBSET keyword */ (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1993,7 +1993,7 @@ static int processConfigurationFile(char *infile, struct Input *in) while (get_next_prop) { if(!HDstrcmp("COUNT", temp)) { /* COUNT */ int icount = 0; - if (fscanf(strm, "%s", temp) != 1) { /* start paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -2004,7 +2004,7 @@ static int processConfigurationFile(char *infile, struct Input *in) int get_next_dim = 1; int i = 0; - if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void) HDfprintf(stderr, err16c, infile); goto error; } @@ -2014,7 +2014,7 @@ static int processConfigurationFile(char *infile, struct Input *in) while (get_next_dim) { char *more = temp; temp_dims[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -2049,7 +2049,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } /* if(!HDstrcmp("COUNT", temp)) COUNT */ if(!HDstrcmp("BLOCK", temp)) { /* BLOCK */ int icount = 0; - if (fscanf(strm, "%s", temp) != 1) { /* start paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -2060,7 +2060,7 @@ static int processConfigurationFile(char *infile, struct Input *in) int get_next_dim = 1; int i = 0; - if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void) HDfprintf(stderr, err16c, infile); goto error; } @@ -2070,7 +2070,7 @@ static int processConfigurationFile(char *infile, struct Input *in) while (get_next_dim) { char *more = temp; temp_dims[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -2103,7 +2103,7 @@ static int processConfigurationFile(char *infile, struct Input *in) in->configOptionVector[DIM] = 1; } /* if(!HDstrcmp("(", key)) start paren */ } /* if(!HDstrcmp("BLOCK", temp)) BLOCK */ - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -2122,7 +2122,7 @@ static int processConfigurationFile(char *infile, struct Input *in) scanret = 0; break; } - scanret = fscanf(strm, "%s", key); + scanret = fscanf(strm, "%254s", key); } #ifdef H5DEBUGIMPORT HDprintf("h5dump path"); @@ -2163,7 +2163,7 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, err3a, infile); goto error; } - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -2180,7 +2180,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -2208,7 +2208,7 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, err5a, infile); goto error; } - if (fscanf(strm, "%d", (&ival)) != 1) { + if (fscanf(strm, "%254d", (&ival)) != 1) { (void) HDfprintf(stderr, "%s", err19); goto error; } @@ -2405,7 +2405,7 @@ static int processConfigurationFile(char *infile, struct Input *in) default: break; } - scanret = fscanf(strm, "%s", key); + scanret = fscanf(strm, "%254s", key); } /* @@ -2576,7 +2576,7 @@ static int getOutputClass(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output class.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -3469,7 +3469,7 @@ static int getInputByteOrder(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for input byte-order.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -3600,7 +3600,7 @@ static int getOutputArchitecture(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output architecture.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -3632,7 +3632,7 @@ static int getOutputByteOrder(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output byte-order.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -3663,7 +3663,7 @@ static int getCompressionType(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for compression.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -3727,7 +3727,7 @@ static int getExternalFilename(struct Input *in, FILE *strm) char temp[255]; const char *err1 = "Unable to get 'string' value.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } diff --git a/tools/src/h5import/h5import.h b/tools/src/h5import/h5import.h index c55717d..00c41f6 100644 --- a/tools/src/h5import/h5import.h +++ b/tools/src/h5import/h5import.h @@ -102,8 +102,8 @@ struct Input struct infilesformat { - char datafile[255]; - char configfile[255]; + char datafile[MAX_PATH_NAME_LENGTH]; + char configfile[MAX_PATH_NAME_LENGTH]; struct Input in; int config; /* Configfile present? No - 0. Yes - 1 */ }; |