aboutsummaryrefslogtreecommitdiff
path: root/src/ioconvert.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/ioconvert.cc')
-rw-r--r--src/ioconvert.cc24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/ioconvert.cc b/src/ioconvert.cc
index 6ba466c..5c818b7 100644
--- a/src/ioconvert.cc
+++ b/src/ioconvert.cc
@@ -41,39 +41,53 @@ int main(int argc,char *argv[]){
else swap=0;
// for the input file
+#if defined(WITH_HDF4) || defined(WITH_HDF5)
char *s_ext=strrchr(argv[sindex],'.');
char *d_ext=strrchr(argv[dindex],'.');
+#endif
#ifdef WITH_HDF4
- if(s_ext && !strcmp(s_ext,".hdf")){
+ if(s_ext && !strcmp(s_ext,".hdf"))
+ {
infile=hdffile=new HDFIO(argv[sindex],IObase::Read);
hdfin=1;
}
+ else
#endif
#ifdef WITH_HDF5
- else if(s_ext && !strcmp(s_ext,".h5")){
+ if(s_ext && !strcmp(s_ext,".h5"))
+ {
infile=new H5IO(argv[sindex],IObase::Read);
}
+ else
#endif
- else // assume its raw
+ {
+ // assume its raw
infile=new IEEEIO(argv[sindex],IObase::Read);
+ }
if(!infile->isValid()){
printf("cant read %s\n",argv[sindex]);
usage();
}
// for the outfile,
+#ifdef WITH_HDF4
if(d_ext && !strcmp(d_ext,".hdf"))
{
outfile=new HDFIO(argv[dindex],IObase::Create);
}
+ else
+#endif
#ifdef WITH_HDF5
- else if(d_ext && !strcmp(d_ext,".h5"))
+ if(d_ext && !strcmp(d_ext,".h5"))
{
outfile=new H5IO(argv[dindex],IObase::Create);
}
+ else
#endif
- else // assume its raw
+ {
+ // assume its raw
outfile=new IEEEIO(argv[dindex],IObase::Create,swap); // swap only affects IEEEIO output
+ }
if(!outfile->isValid()){
printf("cant write %s\n",argv[dindex]);
delete infile;