[svn-r15183] 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)
This commit is contained in:
Scott Wegner 2008-06-09 13:41:29 -05:00
parent a97fa671eb
commit 7a92820e35
13 changed files with 6 additions and 84 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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

View File

@ -21,10 +21,6 @@
*
*************************************************************/
#ifdef _WIN32
#include <stdio.h>
#endif
#include "testhdf5.h"
#include "hdf5.h"

View File

@ -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);

View File

@ -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);

View File

@ -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
}
}
}

View File

@ -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);

View File

@ -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');

View File

@ -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);
}

View File

@ -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 */

View File

@ -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 */
/* #define H5_USING_MEMCHECKER 1 */