summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Wegner <swegner@hdfgroup.org>2008-06-09 17:31:22 (GMT)
committerScott Wegner <swegner@hdfgroup.org>2008-06-09 17:31:22 (GMT)
commit6df2bbd6e93c8731ac5c7a39f32090487b9061f5 (patch)
treefdaced2c64e3c5f2428f6ef02022f48f37989905
parent0304c9a5fa3aca4331505e36c939f0347acf0132 (diff)
downloadhdf5-6df2bbd6e93c8731ac5c7a39f32090487b9061f5.zip
hdf5-6df2bbd6e93c8731ac5c7a39f32090487b9061f5.tar.gz
hdf5-6df2bbd6e93c8731ac5c7a39f32090487b9061f5.tar.bz2
[svn-r15181] Purpose: _WIN32 macro cleanup
Description: As part of our Windows cleanup, we try to remove windows-specific tweaks in the source code. There are many instances where Windows code is introduces via ifdef's. We re-evaluate whether they are still required, and found that many of them are not. Others we change to "feature"-specific code, rather than Windows-specific. Tested: VS2005 on WinXP VS.NET on WinXP h5committest (kagisopp, smirom, linew)
-rw-r--r--c++/src/H5Exception.h6
-rw-r--r--fortran/src/H5Pf.c4
-rw-r--r--hl/tools/gif2h5/hdfgifwr.c4
-rw-r--r--src/H5Omtime.c24
-rw-r--r--test/tvlstr.c4
-rw-r--r--testpar/t_mdset.c6
-rw-r--r--testpar/testphdf5.c6
-rw-r--r--tools/h5dump/h5dumpgentest.c4
-rwxr-xr-xtools/h5import/h5import.c18
-rwxr-xr-xtools/h5import/h5importtest.c18
-rw-r--r--tools/h5jam/h5jamgentest.c6
-rw-r--r--tools/h5ls/h5ls.c4
-rw-r--r--tools/lib/h5tools_utils.c5
-rw-r--r--tools/misc/h5repart.c14
-rwxr-xr-xwindows/src/H5pubconf.h3
15 files changed, 6 insertions, 120 deletions
diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h
index d422edb..c17ff5b 100644
--- a/c++/src/H5Exception.h
+++ b/c++/src/H5Exception.h
@@ -79,12 +79,6 @@ class H5_DLLCPP Exception {
virtual ~Exception();
private:
-// Because 'string' is not instantiated at compilation time, this
-// warning is displayed when building DLL; but the class is exported
-// so the warning is harmless
-#if defined(_WIN32)
-#pragma warning(disable: 4251)
-#endif
H5std_string detail_message;
H5std_string func_name;
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c
index c05e261..02da4f2 100644
--- a/fortran/src/H5Pf.c
+++ b/fortran/src/H5Pf.c
@@ -3202,12 +3202,8 @@ HD5packFstring(tmp, _fcdtocp(memb_name), (size_t)(c_lenmax*H5FD_MEM_NTYPES));
for (i=0; i < H5FD_MEM_NTYPES; i++) {
memb_map[i] = (int_f)c_memb_map[i];
memb_fapl[i] = (hid_t_f)c_memb_fapl[i];
-#if defined(_WIN32)
- memb_addr[i] = -1;
-#else
if(c_memb_addr[i] == HADDR_UNDEF) memb_addr[i] = -1;
else memb_addr[i] = (real_f) ((long)c_memb_addr[i]/HADDR_MAX);
-#endif /*_WIN32*/
}
*flag = (int_f)relax;
*maxlen_out = (int_f)length;
diff --git a/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c
index e6d681a..1771d06 100644
--- a/hl/tools/gif2h5/hdfgifwr.c
+++ b/hl/tools/gif2h5/hdfgifwr.c
@@ -172,9 +172,9 @@ static unsigned long cur_accum = 0;
static int cur_bits = 0;
#define MAXCODE(n_bits) ( (1 << (n_bits)) - 1)
-#ifndef _WIN32
+#ifndef min
#define min(a,b) ((a>b) ? b : a)
-#endif
+#endif /* min */
#define XV_BITS 12 /* BITS was already defined on some systems */
#define MSDOS 1
#define HSIZE 5003 /* 80% occupancy */
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index 0a70e5b..df4bdd4 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -27,11 +27,6 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
-#if defined (_WIN32) && !defined (__MWERKS__)
-#include <sys/types.h>
-#include <sys/timeb.h>
-#endif
-
static void *H5O_mtime_new_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, const uint8_t *p);
static herr_t H5O_mtime_new_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
@@ -247,24 +242,7 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_fla
the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0);
}
-#elif defined (_WIN32)
- #if !defined (__MWERKS__) /* MSVC */
- {
- struct timeb timebuffer;
- long tz;
-
- ftime(&timebuffer);
- tz = timebuffer.timezone;
- /* daylight is not handled properly. Currently we just hard-code
- the problem. */
- the_time -= tz * 60 - 3600;
- }
- #else /*__MWERKS__*/
-
- ;
-
- #endif /*__MWERKS__*/
-#else /* _WIN32 */
+#else
/*
* The catch-all. If we can't convert a character string universal
* coordinated time to a time_t value reliably then we can't decode the
diff --git a/test/tvlstr.c b/test/tvlstr.c
index 0d5b955..d87268e 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -21,10 +21,6 @@
*
*************************************************************/
-#ifdef _WIN32
-#include <stdio.h>
-#endif
-
#include "testhdf5.h"
#include "hdf5.h"
diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c
index 5b114be..2559d3e 100644
--- a/testpar/t_mdset.c
+++ b/testpar/t_mdset.c
@@ -457,9 +457,7 @@ void big_dataset(void)
/* Check that file of the correct size was created */
file_size=h5_get_file_size(filename);
-#ifndef _WIN32
VRFY((file_size == 2147485696ULL), "File is correct size(~2GB)");
-#endif
/*
* Create >4GB HDF5 file
@@ -488,9 +486,7 @@ void big_dataset(void)
/* Check that file of the correct size was created */
file_size=h5_get_file_size(filename);
-#ifndef _WIN32
VRFY((file_size == 4294969344ULL), "File is correct size(~4GB)");
-#endif
/*
* Create >8GB HDF5 file
@@ -519,9 +515,7 @@ void big_dataset(void)
/* Check that file of the correct size was created */
file_size=h5_get_file_size(filename);
-#ifndef _WIN32
VRFY((file_size == 8589936640ULL), "File is correct size(~8GB)");
-#endif
/* Close fapl */
ret = H5Pclose(fapl);
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index 2f74221..2760a8b 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -399,14 +399,8 @@ int main(int argc, char **argv)
"collective group and dataset write", &collngroups_params);
AddTest("ingrpr", independent_group_read, NULL,
"independent group and dataset read", &collngroups_params);
- /* By default, do not run big dataset on _WIN32. */
-#ifdef _WIN32
- AddTest("-bigdset", big_dataset, NULL,
- "big dataset test", PARATESTFILE);
-#else
AddTest("bigdset", big_dataset, NULL,
"big dataset test", PARATESTFILE);
-#endif
AddTest("fill", dataset_fillvalue, NULL,
"dataset fill value", PARATESTFILE);
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 8f48e89..0646536 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -1199,11 +1199,7 @@ static void gent_many(void)
for(i0 = 0; i0 < 2; i0++) {
dset1[j].a[i3][i2][i1][i0] = i0+j;
dset1[j].b[i3][i2][i1][i0] = (double)(i0+j);
-#ifdef _WIN32
- dset1[j].c[i3][i2][i1][i0] = (double)(i0+j+(signed __int64)sdim);
-#else
dset1[j].c[i3][i2][i1][i0] = (double)(i0+j+sdim);
-#endif
}
}
}
diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c
index f8f518b..097e298 100755
--- a/tools/h5import/h5import.c
+++ b/tools/h5import/h5import.c
@@ -372,10 +372,8 @@ readIntegerData(FILE **strm, struct Input *in)
H5DT_INT8 *in08;
H5DT_INT16 *in16, temp;
H5DT_INT32 *in32;
-#ifndef _WIN32
H5DT_INT64 *in64;
char buffer[256];
-#endif
hsize_t len=1;
hsize_t i;
int j;
@@ -488,7 +486,6 @@ readIntegerData(FILE **strm, struct Input *in)
}
break;
-#ifndef _WIN32
case 64:
in64 = (H5DT_INT64 *) in->data;
switch(in->inputClass)
@@ -521,7 +518,6 @@ readIntegerData(FILE **strm, struct Input *in)
return (-1);
}
break;
-#endif /* ifndef _WIN32 */
default:
(void) fprintf(stderr, err3);
@@ -536,10 +532,8 @@ readUIntegerData(FILE **strm, struct Input *in)
H5DT_UINT8 *in08;
H5DT_UINT16 *in16, temp;
H5DT_UINT32 *in32;
-#ifndef _WIN32
H5DT_UINT64 *in64;
char buffer[256];
-#endif
hsize_t len=1;
hsize_t i;
int j;
@@ -650,7 +644,6 @@ readUIntegerData(FILE **strm, struct Input *in)
}
break;
-#ifndef _WIN32
case 64:
in64 = (H5DT_UINT64 *) in->data;
switch(in->inputClass)
@@ -683,7 +676,6 @@ readUIntegerData(FILE **strm, struct Input *in)
return (-1);
}
break;
-#endif /* ifndef _WIN32 */
default:
(void) fprintf(stderr, err3);
@@ -1441,9 +1433,6 @@ validateConfigurationParameters(struct Input * in)
const char *err4a = "OUTPUT-ARCHITECTURE cannot be STD if OUTPUT-CLASS is floating point (FP).\n";
const char *err4b = "OUTPUT-ARCHITECTURE cannot be IEEE if OUTPUT-CLASS is integer (IN).\n";
const char *err5 = "For OUTPUT-CLASS FP, valid values for OUTPUT-SIZE are (32, 64) .\n";
-#ifdef _WIN32
- const char *err6 = "No support for reading 64-bit integer (INPUT-CLASS: IN, TEXTIN, UIN, TEXTUIN files\n";
-#endif
/* for class STR other parameters are ignored */
if (in->inputClass == 5) /* STR */
@@ -1502,13 +1491,6 @@ validateConfigurationParameters(struct Input * in)
return (-1);
}
-#ifdef _WIN32
- if (in->inputSize == 64 && (in->inputClass == 0 || in->inputClass == 4 || in->inputClass == 6 || in->inputClass == 7) )
- {
- (void) fprintf(stderr, err6);
- return -1;
- }
-#endif
return (0);
}
diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c
index 2a8c827..7a6bbff 100755
--- a/tools/h5import/h5importtest.c
+++ b/tools/h5import/h5importtest.c
@@ -46,12 +46,10 @@ main(void)
int rowo4i = (int)11 , colo4i = (int)21 , plno4i = (int)51 ;
int rowi4i = (int)1 , coli4i = (int)2 , plni4i = (int)5 ;
-#ifndef _WIN32
long_long b64i2[3][4], b64i3[5][3][4];
long_long row4i64[3], col4i64[4], pln4i64[5];
long_long rowo4i64 = (long_long)11 , colo4i64 = (long_long)21 , plno4i64 = (long_long)51 ;
long_long rowi4i64 = (long_long)1 , coli4i64 = (long_long)2 , plni4i64 = (long_long)5 ;
-#endif
short b16i3[5][3][4];
short row4i16[3], col4i16[4], pln4i16[5];
@@ -96,11 +94,9 @@ main(void)
col4i[0] = colo4i;
pln4i[0] = plno4i;
-#ifndef _WIN32
row4i64[0] = rowo4i64;
col4i64[0] = colo4i64;
pln4i64[0] = plno4i64;
-#endif
row4i16[0] = rowo4i16;
col4i16[0] = colo4i16;
@@ -115,9 +111,7 @@ main(void)
row4[i] = row4[i - 1] + rowi4;
row8[i] = row8[i - 1] + rowi8;
row4i[i] = row4i[i - 1] + rowi4i;
-#ifndef _WIN32
row4i64[i] = row4i64[i - 1] + rowi4i64;
-#endif
row4i16[i] = row4i16[i - 1] + rowi4i16;
row4i8[i] = row4i8[i - 1] + rowi4i8;
}
@@ -127,9 +121,7 @@ main(void)
col4[j] = col4[j - 1] + coli4;
col8[j] = col8[j - 1] + coli8;
col4i[j] = col4i[j - 1] + coli4i;
-#ifndef _WIN32
col4i64[j] = col4i64[j - 1] + coli4i64;
-#endif
col4i16[j] = col4i16[j - 1] + coli4i16;
col4i8[j] = col4i8[j - 1] + coli4i8;
}
@@ -138,9 +130,7 @@ main(void)
pln4[k] = pln4[k - 1] + plni4;
pln8[k] = pln8[k - 1] + plni8;
pln4i[k] = pln4i[k - 1] + plni4i;
-#ifndef _WIN32
pln4i64[k] = pln4i64[k - 1] + plni4i64;
-#endif
pln4i16[k] = pln4i16[k - 1] + plni4i16;
pln4i8[k] = pln4i8[k - 1] + plni4i8;
}
@@ -149,9 +139,7 @@ main(void)
{
for (j = 0; j < ncol; j++)
{
-#ifndef _WIN32
b64i2[i][j] = row4i64[i] + col4i64[j];
-#endif
}
}
@@ -170,9 +158,7 @@ main(void)
b32r3[k][i][j] = row4[i] + col4[j] + pln4[k];
b64r3[k][i][j] = row8[i] + col8[j] + pln8[k];
b32i3[k][i][j] = row4i[i] + col4i[j] + pln4i[k];
-#ifndef _WIN32
b64i3[k][i][j] = row4i64[i] + col4i64[j] + pln4i64[k];
-#endif
b16i3[k][i][j] = row4i16[i] + col4i16[j] + pln4i16[k];
b8i3[k][i][j] = row4i8[i] + col4i8[j] + pln4i8[k];
}
@@ -221,14 +207,12 @@ main(void)
(void) fwrite((char *) &b32i3[k][i][j], sizeof(unsigned int), 1, sp);
(void) fclose(sp);
-#ifndef _WIN32
sp = fopen("bin64-2", "w");
for (i = 0; i < nrow; i++)
for (j = 0; j < ncol; j++)
(void) fwrite((char *) &b64i2[i][j], sizeof(long_long), 1, sp);
(void) fclose(sp);
-#endif
sp = fopen("bfp32", "w");
for (k = 0; k < npln; k++)
@@ -254,7 +238,6 @@ main(void)
sp);
(void) fclose(sp);
-#ifndef _WIN32
sp = fopen("bin64-3", "w");
for (k = 0; k < npln; k++)
@@ -263,7 +246,6 @@ main(void)
(void) fwrite((char *) &b64i3[k][i][j], sizeof(long_long), 1,
sp);
(void) fclose(sp);
-#endif
sp = fopen("bin8", "w");
for (k = 0; k < npln; k++)
diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c
index 0599552..7b7e648 100644
--- a/tools/h5jam/h5jamgentest.c
+++ b/tools/h5jam/h5jamgentest.c
@@ -333,11 +333,7 @@ create_textfile(const char *name, size_t size)
size_t i;
char *bp;
-#ifdef _WIN32
- fd = _creat(name, _S_IREAD | _S_IWRITE);
-#else /* _WIN32 */
- fd = creat(name,(mode_t)0777);
-#endif /* _WIN32 */
+ fd = HDcreat(name,0777);
assert(fd >= 0);
buf = calloc(size, (size_t)1);
assert(buf);
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 6f07050..6545368 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1526,11 +1526,7 @@ dataset_list2(hid_t dset, const char UNUSED *name)
(unsigned long)total, 1==total?"":"s",
(unsigned long)used, 1==used?"":"s");
if (used>0) {
-#ifdef _WIN32
- utilization = (hssize_t)total * 100.0 / (hssize_t)used;
-#else
utilization = (total*100.0)/used;
-#endif
printf(", %1.2f%% utilization", utilization);
}
putchar('\n');
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 512a3fb..0be3a91 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -99,13 +99,8 @@ warn_msg(const char *progname, const char *fmt, ...)
va_start(ap, fmt);
HDfflush(stdout);
-#ifdef _WIN32
- HDfprintf(stdout, "%s warning: ", progname);
- HDvfprintf(stdout, fmt, ap);
-#else /* _WIN32 */
HDfprintf(stderr, "%s warning: ", progname);
HDvfprintf(stderr, fmt, ap);
-#endif /* _WIN32 */
va_end(ap);
}
diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c
index f107e31..91df7b6 100644
--- a/tools/misc/h5repart.c
+++ b/tools/misc/h5repart.c
@@ -45,11 +45,6 @@
# include <sys/stat.h>
#endif
-#ifdef _WIN32
-# include <io.h>
-# include <fcntl.h>
-#endif
-
#ifndef FALSE
# define FALSE 0
#endif
@@ -216,21 +211,12 @@ main (int argc, char *argv[])
int dst_is_family; /*is dst name a family name? */
int dst_membno=0; /*destination member number */
-#if defined(_WIN32) && ! defined (__MWERKS__)
- __int64 left_overs=0; /*amount of zeros left over */
- __int64 src_offset=0; /*offset in source member */
- __int64 dst_offset=0; /*offset in destination member */
- __int64 src_size; /*source logical member size */
- __int64 src_act_size; /*source actual member size */
- __int64 dst_size=1 GB; /*destination logical memb size */
-#else
off_t left_overs=0; /*amount of zeros left over */
off_t src_offset=0; /*offset in source member */
off_t dst_offset=0; /*offset in destination member */
off_t src_size; /*source logical member size */
off_t src_act_size; /*source actual member size */
off_t dst_size=1 GB; /*destination logical memb size */
-#endif
hid_t fapl; /*file access property list */
hid_t file;
hsize_t hdsize; /*destination logical memb size */
diff --git a/windows/src/H5pubconf.h b/windows/src/H5pubconf.h
index 0c06901..2ab12a1 100755
--- a/windows/src/H5pubconf.h
+++ b/windows/src/H5pubconf.h
@@ -37,6 +37,7 @@
/*#define H5_HAVE_TM_ZONE 1 windows do not use this constant.*/
#define H5_MALLOC_WORKS 1
+#define H5_HAVE_TIMEZONE 1
/* code warrior returns 0 in malloc(0) */
#if defined(__MWERKS__)
@@ -200,4 +201,4 @@ paths. This shouldn't need to be commented or removed. */
/* uncomment the following line if you need the library to perform "strict"
memory operations, which is useful when debugging with a memory checking
tool like Purify, etc. */
-/* #define H5_USING_MEMCHECKER 1 */ \ No newline at end of file
+/* #define H5_USING_MEMCHECKER 1 */