diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2008-02-19 19:12:10 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2008-02-19 19:12:10 (GMT) |
commit | 6bc41c8b209fd0cc9cc3d088eb425ddbcf681a53 (patch) | |
tree | a6c6f0d9f1fb4bd950c74dbadaf50f4ee1623092 /tools/h5import/h5import.c | |
parent | fc8e5477f583b6e256b06da62fb9b80d0db5418f (diff) | |
download | hdf5-6bc41c8b209fd0cc9cc3d088eb425ddbcf681a53.zip hdf5-6bc41c8b209fd0cc9cc3d088eb425ddbcf681a53.tar.gz hdf5-6bc41c8b209fd0cc9cc3d088eb425ddbcf681a53.tar.bz2 |
[svn-r14613] 971 (B2) h5import bug on Windows w/binary datasets. CLOSED. fread in windows needs a binary file to be open with "rb" instead of "r" otherwise it terminates execution if an end of file character is found on the input file. Besides that the binary file generated needs to be open with "wb" , otherwise an end of line character is read twice. DONE NOW for 1.8, already done previously for 1.6
renamed the h5import test files to have the extensions
text input files = .txt
binary input files = .bin
configuration files = .conf
hdf5 files = .h5
besides that in very test the files have the same name except extension.
For example
TOOLTEST txtin16.txt -c $srcdir/testfiles/txtin16.conf -o txtin16.h5
The convention for the test name is for example, for "txtin16"
"txt" for text then "in16" means integer 16 size
Tested: linux, solaris
Diffstat (limited to 'tools/h5import/h5import.c')
-rwxr-xr-x | tools/h5import/h5import.c | 55 |
1 files changed, 46 insertions, 9 deletions
diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index f8f518b..d1b15bb 100755 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -45,10 +45,6 @@ int main(int argc, char *argv[]) (void)HDsetvbuf(stderr, (char *) NULL, _IOLBF, 0); (void)HDsetvbuf(stdout, (char *) NULL, _IOLBF, 0); -#if defined __MWERKS__ - argc = ccommand(&argv); -#endif - if ( argv[1] && (strcmp("-V",argv[1])==0) ) { print_version("h5import"); @@ -275,7 +271,7 @@ gtoken(char *s) * Programmer: pkmat * * Modifications: pvn - * 7/23/2007. Added support for STR type + * 7/23/2007. Added support for STR type, extra parameter FILE_ID * *------------------------------------------------------------------------- */ @@ -293,12 +289,53 @@ processDataFile(char *infile, struct Input *in, FILE **strm, hid_t file_id) const char *err10 = "Unrecognized input class type.\n"; const char *err11 = "Error in reading string data.\n"; - if ((*strm = fopen(infile, "r")) == NULL) + /*------------------------------------------------------------------------- + * special case for opening binary classes in WIN32 + * "FP" denotes a floating point binary file, + * "IN" denotes a signed integer binary file, + * "UIN" denotes an unsigned integer binary file, + *------------------------------------------------------------------------- + */ + if ( in->inputClass == 4 /* "IN" */ || + in->inputClass == 3 /* "FP" */ || + in->inputClass == 7 /* "UIN" */ + + ) + { + +#ifdef WIN32 + + if ((*strm = fopen(infile, "rb")) == NULL) + { + (void) fprintf(stderr, err1, infile); + return(-1); + } +#else + + if ((*strm = fopen(infile, "r")) == NULL) + { + (void) fprintf(stderr, err1, infile); + return(-1); + } + +#endif + + } + /*------------------------------------------------------------------------- + * if the input class is not binary, just use "r" + *------------------------------------------------------------------------- + */ + else { - (void) fprintf(stderr, err1, infile); - return(-1); + if ((*strm = fopen(infile, "r")) == NULL) + { + (void) fprintf(stderr, err1, infile); + return(-1); + } } + + switch(in->inputClass) { case 0: /* TEXTIN */ @@ -372,7 +409,7 @@ readIntegerData(FILE **strm, struct Input *in) H5DT_INT8 *in08; H5DT_INT16 *in16, temp; H5DT_INT32 *in32; -#ifndef _WIN32 +#ifndef WIN32 H5DT_INT64 *in64; char buffer[256]; #endif |