summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2001-06-29 15:27:15 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2001-06-29 15:27:15 (GMT)
commit098ed81ec88483581d08974f27a62bf42a836fc3 (patch)
tree6635d919289a5313946911b32bc1d30e9ce1cf6f
parent79c65cc4c0c9195ece5ed4f314e789e8e50f9f7a (diff)
downloadhdf5-098ed81ec88483581d08974f27a62bf42a836fc3.zip
hdf5-098ed81ec88483581d08974f27a62bf42a836fc3.tar.gz
hdf5-098ed81ec88483581d08974f27a62bf42a836fc3.tar.bz2
[svn-r4083]
code warrior support and some clean up the macros file_seek and file_offset_t that were repeated over sevral files were put only in H5private.h H5private .h was updated for win32 vthe Description: Solution: Platforms tested:
-rw-r--r--src/H5FDlog.c31
-rw-r--r--src/H5FDsec2.c31
-rw-r--r--src/H5FDstdio.c7
-rw-r--r--src/H5FDstream.c11
-rw-r--r--src/H5Oefl.c2
-rw-r--r--src/H5Ppublic.h2
-rw-r--r--src/H5private.h55
-rw-r--r--test/iopipe.c7
-rw-r--r--test/titerate.c4
-rw-r--r--tools/h5dump/h5dump.c16
10 files changed, 68 insertions, 98 deletions
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 4c37651..a9ba785 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -105,35 +105,6 @@ typedef struct H5FD_log_t {
} H5FD_log_t;
-/*
- * This driver supports systems that have the lseek64() function by defining
- * some macros here so we don't have to have conditional compilations later
- * throughout the code.
- *
- * file_offset_t: The datatype for file offsets, the second argument of
- * the lseek() or lseek64() call.
- *
- * file_seek: The function which adjusts the current file position,
- * either lseek() or lseek64().
- */
-/* adding for windows NT file system support. */
-/* pvn: added __MWERKS__ support. */
-
-#ifdef H5_HAVE_LSEEK64
-# define file_offset_t off64_t
-# define file_seek lseek64
-#elif defined (WIN32)
-# ifdef __MWERKS__
-# define file_offset_t off_t
-# define file_seek lseek
-# else /*MSVC*/
-# define file_offset_t __int64
-# define file_seek _lseeki64
-# endif
-#else
-# define file_offset_t off_t
-# define file_seek lseek
-#endif
/*
@@ -986,7 +957,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
while (size>0) {
do {
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
- nbytes = HDwrite(file->fd, buf, (size_t)size);
+ nbytes = HDwrite(file->fd, (void*)buf, (size_t)size);
} while (-1==nbytes && EINTR==errno);
if (-1==nbytes) {
/* error */
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 2cfa24e..6e77bf5 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -75,35 +75,6 @@ typedef struct H5FD_sec2_t {
#endif
} H5FD_sec2_t;
-/*
- * This driver supports systems that have the lseek64() function by defining
- * some macros here so we don't have to have conditional compilations later
- * throughout the code.
- *
- * file_offset_t: The datatype for file offsets, the second argument of
- * the lseek() or lseek64() call.
- *
- * file_seek: The function which adjusts the current file position,
- * either lseek() or lseek64().
- */
-/* adding for windows NT file system support. */
-/* pvn: added __MWERKS__ support. */
-
-#ifdef H5_HAVE_LSEEK64
-# define file_offset_t off64_t
-# define file_seek lseek64
-#elif defined (WIN32)
-# ifdef __MWERKS__
-# define file_offset_t off_t
-# define file_seek lseek
-# else /*MSVC*/
-# define file_offset_t __int64
-# define file_seek _lseeki64
-# endif
-#else
-# define file_offset_t off_t
-# define file_seek lseek
-#endif
/*
@@ -665,7 +636,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had
while (size>0) {
do {
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
- nbytes = HDwrite(file->fd, buf, (size_t)size);
+ nbytes = HDwrite(file->fd, (void*)buf, (size_t)size);
} while (-1==nbytes && EINTR==errno);
if (-1==nbytes) {
/* error */
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index c852208..eccba8f 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -20,12 +20,7 @@
#include <unistd.h>
#endif
-#ifdef WIN32
-#include <windows.h>
-#include <io.h>
-#endif /*kent yang 6/21/2001, must be added for defination of open,write....
- also the defination of longlong is valid, will investigate this to
- make sure int64 can replace longlong. Otherwise, keep windows.h*/
+
#ifdef MAX
#undef MAX
diff --git a/src/H5FDstream.c b/src/H5FDstream.c
index 924ab9e..9db2b18 100644
--- a/src/H5FDstream.c
+++ b/src/H5FDstream.c
@@ -26,6 +26,8 @@
/* Only build this driver if it was configured with --with-Stream-VFD */
#ifdef H5_HAVE_STREAM
+#include "H5private.h"
+
#include "H5Eprivate.h" /* error handling */
#include "H5FDpublic.h" /* VFD structures */
#include "H5MMprivate.h" /* memory allocation */
@@ -132,11 +134,10 @@ static const H5FD_stream_fapl_t default_fapl =
* REGION_OVERFLOW: Checks whether an address and size pair describe data
* which can be addressed entirely in memory.
*/
-#ifdef H5_HAVE_LSEEK64
-# define file_offset_t off64_t
-#else
-# define file_offset_t off_t
-#endif
+
+
+
+
#define MAXADDR (((haddr_t)1<<(8*sizeof(file_offset_t)-1))-1)
#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \
((A) & ~(haddr_t)MAXADDR))
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index c5ac308..de6595b 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -537,7 +537,7 @@ H5O_efl_write (H5F_t UNUSED *f, const H5O_efl_t *efl, haddr_t addr,
"unable to seek in external raw data file");
}
to_write = MIN(efl->slot[i].size-skip, size);
- if ((size_t)HDwrite (fd, buf, to_write)!=to_write) {
+ if ((size_t)HDwrite (fd, (void*)buf, to_write)!=to_write) {
HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL,
"write error in external raw data file");
}
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index ebaeb31..1fa1bf1 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -20,6 +20,7 @@
/* Default Template for creation, access, etc. templates */
#define H5P_DEFAULT 0
+#include <H5private.h>
/* Public headers needed by this file */
#include "H5public.h"
#include "H5Ipublic.h"
@@ -28,7 +29,6 @@
#include "H5MMpublic.h"
#include "H5Zpublic.h"
-/*pvn*/
/* Property list classes */
typedef enum H5P_class_t {
diff --git a/src/H5private.h b/src/H5private.h
index 8d69949..02c5bbf 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -139,7 +139,6 @@
* HDF5 is currently supported on _X86_
* including <windows.h> has the side effect of introducing thousands of Windows GUI
* macros and type declarations to the compilation environment, so we don't include it
- * pvn
*/
#if !defined(_68K_) && !defined(_MPPC_) && !defined(_PPC_) && !defined(_ALPHA_) && !defined(_MIPS_) && !defined(_X86_) && defined(_M_IX86)
@@ -148,7 +147,7 @@
#include <windef.h>
#include <winbase.h>
-#include <IO.h> /* kent yang 6/18/2001*/
+#include <io.h>
/* H5_inline */
@@ -158,13 +157,8 @@
#endif
/*
-syntax:
-
-inline function_declarator; // C++ Specific
-__inline function_declarator; // Microsoft Specific
-The inline and __inline keywords allow the compiler to insert a copy of
+The inline keywords allows the compiler to insert a copy of
the function body into each place the function is called
-
inline is now in C but in the C99 standard and not the old C89 version so
MS doesn't recognize it yet (as of April 2001)
*/
@@ -172,16 +166,48 @@ MS doesn't recognize it yet (as of April 2001)
# define H5_inline inline
# else
# define H5_inline
-#endif /*__MWERKS__*/
+#endif
/* Metroworks <sys/types.h> doesn't define off_t. */
#ifdef __MWERKS__
typedef long off_t;
/* Metroworks does not define EINTR in <errno.h> */
# define EINTR 4
-#endif /*__MWERKS__*/
+#endif
+/*__MWERKS__*/
+
+#endif
+/*WIN32*/
+
+/*
+ * This driver supports systems that have the lseek64() function by defining
+ * some macros here so we don't have to have conditional compilations later
+ * throughout the code.
+ *
+ * file_offset_t: The datatype for file offsets, the second argument of
+ * the lseek() or lseek64() call.
+ *
+ * file_seek: The function which adjusts the current file position,
+ * either lseek() or lseek64().
+ *
+ * adding for windows NT file system support.
+ */
-#endif /*WIN32*/
+#ifdef H5_HAVE_LSEEK64
+# define file_offset_t off64_t
+# define file_seek lseek64
+#elif defined (WIN32)
+# ifdef __MWERKS__
+# define file_offset_t off_t
+# define file_seek lseek
+# else /*MSVC*/
+# define file_offset_t __int64
+# define file_seek _lseeki64
+# endif
+#else
+# define file_offset_t off_t
+# define file_seek lseek
+#endif
#ifndef F_OK
# define F_OK 00
@@ -189,6 +215,9 @@ typedef long off_t;
# define R_OK 04
#endif
+
+
+
/*
* Pablo support files.
*/
@@ -767,9 +796,9 @@ __DLL__ int64_t HDstrtoll (const char *s, const char **rest, int base);
* And now for a couple non-Posix functions... Watch out for systems that
* define these in terms of macros.
*/
-#ifdef WIN32
+#if defined (__MWERKS__)
#define HDstrdup(S) _strdup(S)
-#else /* WIN32 */
+#else
#if !defined strdup && !defined H5_HAVE_STRDUP
extern char *strdup(const char *s);
diff --git a/test/iopipe.c b/test/iopipe.c
index 05694ae..aa76369 100644
--- a/test/iopipe.c
+++ b/test/iopipe.c
@@ -9,10 +9,13 @@
/* See H5private.h for how to include headers */
#undef NDEBUG
#include "hdf5.h"
+
#ifdef H5_HAVE_WINSOCK_H
#include <Winsock.h>
-#endif /*Winsock.h includes windows.h, due to the different value of
- WINVER, windows.h should be put before H5private.h. Kent yang 6/21/2001*/
+#endif
+
+/*Winsock.h includes windows.h, due to the different value of
+WINVER, windows.h should be put before H5private.h. Kent yang 6/21/2001*/
#include "H5private.h"
diff --git a/test/titerate.c b/test/titerate.c
index ea80cf7..c4370f8 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -133,7 +133,7 @@ static void test_iter_group(void)
CHECK(dataset, FAIL, "H5Dcreate");
/* Keep a copy of the dataset names around for later */
- dnames[i]=strdup(name);
+ dnames[i]=HDstrdup(name);
CHECK(dnames[i], NULL, "strdup");
ret=H5Dclose(dataset);
@@ -280,7 +280,7 @@ static void test_iter_attr(void)
CHECK(attribute, FAIL, "H5Acreate");
/* Keep a copy of the attribute names around for later */
- anames[i]=strdup(name);
+ anames[i]=HDstrdup(name);
CHECK(anames[i], NULL, "strdup");
ret=H5Aclose(attribute);
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 3e8b396..9834dda 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -2414,7 +2414,7 @@ parse_start:
for (i = 0; i < argc; i++)
if (!hand[i].func) {
hand[i].func = handle_attributes;
- hand[i].obj = strdup(opt_arg);
+ hand[i].obj = HDstrdup(opt_arg);
break;
}
@@ -2426,7 +2426,7 @@ parse_start:
for (i = 0; i < argc; i++)
if (!hand[i].func) {
hand[i].func = handle_datasets;
- hand[i].obj = strdup(opt_arg);
+ hand[i].obj = HDstrdup(opt_arg);
hand[i].subset_info = parse_subset_params(hand[i].obj);
last_dset = hand;
break;
@@ -2440,7 +2440,7 @@ parse_start:
for (i = 0; i < argc; i++)
if (!hand[i].func) {
hand[i].func = handle_groups;
- hand[i].obj = strdup(opt_arg);
+ hand[i].obj = HDstrdup(opt_arg);
break;
}
@@ -2452,7 +2452,7 @@ parse_start:
for (i = 0; i < argc; i++)
if (!hand[i].func) {
hand[i].func = handle_links;
- hand[i].obj = strdup(opt_arg);
+ hand[i].obj = HDstrdup(opt_arg);
break;
}
@@ -2464,7 +2464,7 @@ parse_start:
for (i = 0; i < argc; i++)
if (!hand[i].func) {
hand[i].func = handle_datatypes;
- hand[i].obj = strdup(opt_arg);
+ hand[i].obj = HDstrdup(opt_arg);
break;
}
@@ -3058,7 +3058,7 @@ ref_path_table_put(hid_t obj, const char *path)
pte->obj_ref = ref;
- pte->apath = strdup(path);
+ pte->apath = HDstrdup(path);
pte->next = ref_path_table;
ref_path_table = pte;
@@ -3249,7 +3249,7 @@ xml_escape_the_name(const char *str)
}
if (extra == 0)
- return strdup(str);
+ return HDstrdup(str);
cp = str;
rcp = ncp = calloc((size_t)(len + extra + 1), sizeof(char));
@@ -4254,7 +4254,7 @@ xml_dump_group(hid_t gid, const char *name)
} else {
tmp = malloc(strlen(prefix) + strlen(name) + 2);
strcpy(tmp, prefix);
- par = strdup(tmp);
+ par = HDstrdup(tmp);
cp = strrchr(par, '/');
if (cp != NULL) {
if ((cp == par) && strlen(par) > 1) {