mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
[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:
parent
098ed81ec8
commit
8c2c4cd51c
@ -105,6 +105,35 @@ typedef struct H5FD_log_t {
|
|||||||
} 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) {
|
while (size>0) {
|
||||||
do {
|
do {
|
||||||
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
|
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);
|
} while (-1==nbytes && EINTR==errno);
|
||||||
if (-1==nbytes) {
|
if (-1==nbytes) {
|
||||||
/* error */
|
/* error */
|
||||||
|
@ -76,6 +76,35 @@ typedef struct H5FD_sec2_t {
|
|||||||
} 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
|
* 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) {
|
while (size>0) {
|
||||||
do {
|
do {
|
||||||
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
|
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);
|
} while (-1==nbytes && EINTR==errno);
|
||||||
if (-1==nbytes) {
|
if (-1==nbytes) {
|
||||||
/* error */
|
/* error */
|
||||||
|
@ -20,7 +20,12 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#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
|
#ifdef MAX
|
||||||
#undef MAX
|
#undef MAX
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
/* Only build this driver if it was configured with --with-Stream-VFD */
|
/* Only build this driver if it was configured with --with-Stream-VFD */
|
||||||
#ifdef H5_HAVE_STREAM
|
#ifdef H5_HAVE_STREAM
|
||||||
|
|
||||||
#include "H5private.h"
|
|
||||||
|
|
||||||
#include "H5Eprivate.h" /* error handling */
|
#include "H5Eprivate.h" /* error handling */
|
||||||
#include "H5FDpublic.h" /* VFD structures */
|
#include "H5FDpublic.h" /* VFD structures */
|
||||||
#include "H5MMprivate.h" /* memory allocation */
|
#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
|
* REGION_OVERFLOW: Checks whether an address and size pair describe data
|
||||||
* which can be addressed entirely in memory.
|
* 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 MAXADDR (((haddr_t)1<<(8*sizeof(file_offset_t)-1))-1)
|
||||||
#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \
|
#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \
|
||||||
((A) & ~(haddr_t)MAXADDR))
|
((A) & ~(haddr_t)MAXADDR))
|
||||||
|
@ -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");
|
"unable to seek in external raw data file");
|
||||||
}
|
}
|
||||||
to_write = MIN(efl->slot[i].size-skip, size);
|
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,
|
HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL,
|
||||||
"write error in external raw data file");
|
"write error in external raw data file");
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
/* Default Template for creation, access, etc. templates */
|
/* Default Template for creation, access, etc. templates */
|
||||||
#define H5P_DEFAULT 0
|
#define H5P_DEFAULT 0
|
||||||
|
|
||||||
#include <H5private.h>
|
|
||||||
/* Public headers needed by this file */
|
/* Public headers needed by this file */
|
||||||
#include "H5public.h"
|
#include "H5public.h"
|
||||||
#include "H5Ipublic.h"
|
#include "H5Ipublic.h"
|
||||||
@ -29,7 +28,6 @@
|
|||||||
#include "H5MMpublic.h"
|
#include "H5MMpublic.h"
|
||||||
#include "H5Zpublic.h"
|
#include "H5Zpublic.h"
|
||||||
|
|
||||||
|
|
||||||
/* Property list classes */
|
/* Property list classes */
|
||||||
typedef enum H5P_class_t {
|
typedef enum H5P_class_t {
|
||||||
H5P_NO_CLASS = -1, /*error return value */
|
H5P_NO_CLASS = -1, /*error return value */
|
||||||
|
@ -173,41 +173,9 @@ MS doesn't recognize it yet (as of April 2001)
|
|||||||
typedef long off_t;
|
typedef long off_t;
|
||||||
/* Metroworks does not define EINTR in <errno.h> */
|
/* Metroworks does not define EINTR in <errno.h> */
|
||||||
# define EINTR 4
|
# define EINTR 4
|
||||||
#endif
|
#endif /*__MWERKS__*/
|
||||||
/*__MWERKS__*/
|
|
||||||
|
|
||||||
#endif
|
#endif /*WIN32*/
|
||||||
/*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
|
|
||||||
|
|
||||||
#ifndef F_OK
|
#ifndef F_OK
|
||||||
# define F_OK 00
|
# define F_OK 00
|
||||||
@ -215,9 +183,6 @@ typedef long off_t;
|
|||||||
# define R_OK 04
|
# define R_OK 04
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pablo support files.
|
* 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 HDexecve(S,AV,E) execve(S,AV,E)
|
||||||
#define HDexecvp(S,AV) execvp(S,AV)
|
#define HDexecvp(S,AV) execvp(S,AV)
|
||||||
#define HDexit(N) exit(N)
|
#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)
|
#define HD_exit(N) _exit(N)
|
||||||
|
#endif /* __MWERKS __ */
|
||||||
#define HDexp(X) exp(X)
|
#define HDexp(X) exp(X)
|
||||||
#define HDfabs(X) fabs(X)
|
#define HDfabs(X) fabs(X)
|
||||||
#define HDfclose(F) fclose(F)
|
#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
|
* And now for a couple non-Posix functions... Watch out for systems that
|
||||||
* define these in terms of macros.
|
* define these in terms of macros.
|
||||||
*/
|
*/
|
||||||
#if defined (__MWERKS__)
|
#ifdef WIN32
|
||||||
#define HDstrdup(S) _strdup(S)
|
#define HDstrdup(S) _strdup(S)
|
||||||
#else
|
#else /* WIN32 */
|
||||||
|
|
||||||
#if !defined strdup && !defined H5_HAVE_STRDUP
|
#if !defined strdup && !defined H5_HAVE_STRDUP
|
||||||
extern char *strdup(const char *s);
|
extern char *strdup(const char *s);
|
||||||
|
@ -13,14 +13,6 @@
|
|||||||
*/
|
*/
|
||||||
#include "h5test.h"
|
#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[] = {
|
const char *FILENAME[] = {
|
||||||
"flush",
|
"flush",
|
||||||
NULL
|
NULL
|
||||||
@ -97,10 +89,10 @@ main(void)
|
|||||||
PASSED();
|
PASSED();
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
_exit(0);
|
HD_exit(0);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
_exit(1);
|
HD_exit(1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user