[svn-r4088] Purpose:

Code cleanup
Description:
    Recent CodeWarrior patches have broken the Unix builds and moved code
    around in non-portable ways.
Solution:
    Patched things back up to try to accomodate CodeWarrior and still let the
    Unix builds work correctly.
Platforms tested:
    FreeBSD 4.3 (hawkwind)
This commit is contained in:
Quincey Koziol 2001-06-29 14:49:53 -05:00
parent 098ed81ec8
commit 8c2c4cd51c
8 changed files with 83 additions and 61 deletions

View File

@ -105,6 +105,35 @@ 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
/*
@ -957,7 +986,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, (void*)buf, (size_t)size);
nbytes = HDwrite(file->fd, buf, (size_t)size);
} while (-1==nbytes && EINTR==errno);
if (-1==nbytes) {
/* error */

View File

@ -76,6 +76,35 @@ typedef struct H5FD_sec2_t {
} 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
/*
* These macros check for overflow of various quantities. These macros
@ -636,7 +665,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, (void*)buf, (size_t)size);
nbytes = HDwrite(file->fd, buf, (size_t)size);
} while (-1==nbytes && EINTR==errno);
if (-1==nbytes) {
/* error */

View File

@ -20,7 +20,12 @@
#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

View File

@ -26,8 +26,6 @@
/* 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 */
@ -134,10 +132,11 @@ 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))

View File

@ -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, (void*)buf, to_write)!=to_write) {
if ((size_t)HDwrite (fd, buf, to_write)!=to_write) {
HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL,
"write error in external raw data file");
}

View File

@ -20,7 +20,6 @@
/* 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"
@ -29,7 +28,6 @@
#include "H5MMpublic.h"
#include "H5Zpublic.h"
/* Property list classes */
typedef enum H5P_class_t {
H5P_NO_CLASS = -1, /*error return value */

View File

@ -173,41 +173,9 @@ MS doesn't recognize it yet (as of April 2001)
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.
*/
#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
#endif /*WIN32*/
#ifndef F_OK
# define F_OK 00
@ -215,9 +183,6 @@ typedef long off_t;
# define R_OK 04
#endif
/*
* Pablo support files.
*/
@ -572,7 +537,12 @@ __DLL__ void H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds);
#define HDexecve(S,AV,E) execve(S,AV,E)
#define HDexecvp(S,AV) execvp(S,AV)
#define HDexit(N) exit(N)
#if defined __MWERKS__
#include <abort_exit.h>
#define HD_exit(N) __exit(N)
#else /* __MWERKS __ */
#define HD_exit(N) _exit(N)
#endif /* __MWERKS __ */
#define HDexp(X) exp(X)
#define HDfabs(X) fabs(X)
#define HDfclose(F) fclose(F)
@ -796,9 +766,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.
*/
#if defined (__MWERKS__)
#ifdef WIN32
#define HDstrdup(S) _strdup(S)
#else
#else /* WIN32 */
#if !defined strdup && !defined H5_HAVE_STRDUP
extern char *strdup(const char *s);

View File

@ -13,14 +13,6 @@
*/
#include "h5test.h"
#if defined __MWERKS__
#include <abort_exit.h>
# define EXIT(a) __exit(a)
#else
# define EXIT(a) _exit(a)
#endif
const char *FILENAME[] = {
"flush",
NULL
@ -97,10 +89,10 @@ main(void)
PASSED();
fflush(stdout);
fflush(stderr);
_exit(0);
HD_exit(0);
return 0;
error:
_exit(1);
HD_exit(1);
return 1;
}