Fixes for borland, compiles with lots of warnings, but compiles, might fix vs70 again too.

This commit is contained in:
Bill Hoffman 2009-11-01 12:41:17 -05:00
parent e2d9595ae9
commit 8ba2a40404
9 changed files with 90 additions and 57 deletions

View File

@ -477,9 +477,9 @@ CHECK_TYPE_SIZE("unsigned long long int" UNSIGNED_LONG_LONG_INT)
#
CHECK_TYPE_SIZE(dev_t DEV_T)
IF(NOT HAVE_DEV_T)
IF(MSVC)
IF(MSVC OR BORLAND)
SET(dev_t "unsigned int")
ENDIF(MSVC)
ENDIF(MSVC OR BORLAND)
ENDIF(NOT HAVE_DEV_T)
#
CHECK_TYPE_SIZE(gid_t GID_T)
@ -502,30 +502,30 @@ ENDIF(NOT HAVE_ID_T)
#
CHECK_TYPE_SIZE(int64_t INT64_T)
IF(NOT HAVE_INT64_T)
IF(MSVC)
IF(MSVC OR BORLAND)
SET(int64_t __int64)
ENDIF(MSVC)
ENDIF(MSVC OR BORLAND)
ENDIF(NOT HAVE_INT64_T)
#
CHECK_TYPE_SIZE(intmax_t INTMAX_T)
IF(NOT HAVE_INTMAX_T)
IF(MSVC)
SET(intmax_t "long long")
ENDIF(MSVC)
IF(MSVC OR BORLAND)
SET(intmax_t "__int64")
ENDIF(MSVC OR BORLAND)
ENDIF(NOT HAVE_INTMAX_T)
#
CHECK_TYPE_SIZE(mode_t MODE_T)
IF(NOT HAVE_MODE_T)
IF(MSVC)
IF(MSVC OR BORLAND)
SET(mode_t "unsigned short")
ELSE(MSVC)
ELSE(MSVC OR BORLAND)
SET(mode_t "int")
ENDIF(MSVC)
ENDIF(MSVC OR BORLAND)
ENDIF(NOT HAVE_MODE_T)
#
CHECK_TYPE_SIZE(off_t OFF_T)
IF(NOT HAVE_OFF_T)
SET(off_t "long long")
SET(off_t "__int64")
ENDIF(NOT HAVE_OFF_T)
#
CHECK_TYPE_SIZE(size_t SIZE_T)
@ -535,15 +535,15 @@ ENDIF(NOT HAVE_SIZE_T)
#
CHECK_TYPE_SIZE(ssize_t SSIZE_T)
IF(NOT HAVE_SSIZE_T)
IF(MSVC)
IF(MSVC OR BORLAND)
IF(CMAKE_CL_64)
SET(ssize_t "__int64")
ELSE(CMAKE_CL_64)
SET(ssize_t "signed long")
ENDIF(CMAKE_CL_64)
ELSE(MSVC)
ELSE(MSVC OR BORLAND)
SET(ssize_t "int")
ENDIF(MSVC)
ENDIF(MSVC OR BORLAND)
ENDIF(NOT HAVE_SSIZE_T)
#
CHECK_TYPE_SIZE(uid_t UID_T)
@ -557,36 +557,36 @@ ENDIF(NOT HAVE_UID_T)
#
CHECK_TYPE_SIZE(uint16_t UINT16_T)
IF(NOT HAVE_UINT16_T)
IF(MSVC)
IF(MSVC OR BORLAND)
SET(uint16_t "unsigned short")
ENDIF(MSVC)
ENDIF(MSVC OR BORLAND)
ENDIF(NOT HAVE_UINT16_T)
#
CHECK_TYPE_SIZE(uint32_t UINT32_T)
IF(NOT HAVE_UINT32_T)
IF(MSVC)
IF(MSVC OR BORLAND)
SET(uint32_t "unsigned int")
ENDIF(MSVC)
ENDIF(MSVC OR BORLAND)
ENDIF(NOT HAVE_UINT32_T)
CHECK_TYPE_SIZE(int32_t INT32_T)
IF(NOT HAVE_INT32_T)
IF(MSVC)
IF(MSVC OR BORLAND)
SET(int32_t "int")
ENDIF(MSVC)
ENDIF(MSVC OR BORLAND)
ENDIF(NOT HAVE_INT32_T)
#
CHECK_TYPE_SIZE(uint64_t UINT64_T)
IF(NOT HAVE_UINT64_T)
IF(MSVC)
IF(MSVC OR BORLAND)
SET(uint64_t "unsigned __int64")
ENDIF(MSVC)
ENDIF(MSVC OR BORLAND)
ENDIF(NOT HAVE_UINT64_T)
#
CHECK_TYPE_SIZE(uintmax_t UINTMAX_T)
IF(NOT HAVE_UINTMAX_T)
IF(MSVC)
SET(uintmax_t "unsigned long long")
ENDIF(MSVC)
IF(MSVC OR BORLAND)
SET(uintmax_t "unsigned __int64")
ENDIF(MSVC OR BORLAND)
ENDIF(NOT HAVE_UINTMAX_T)
#
CHECK_TYPE_SIZE(wchar_t SIZEOF_WCHAR_T)

View File

@ -698,3 +698,7 @@
/* Define to `unsigned int' if <sys/types.h> does not define. */
#cmakedefine uintptr_t ${uintptr_t }
#ifdef __BORLANDC__
#define uintptr_t unsigned int
#define intptr_t int
#endif

View File

@ -46,7 +46,7 @@
/* Get appropriate definitions of standard POSIX-style types. */
/* These should match the types used in 'struct stat' */
#if defined(_WIN32) && !defined(__CYGWIN__)
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__)
#define __LA_INT64_T __int64
# if defined(_WIN64)
# define __LA_SSIZE_T __int64
@ -56,7 +56,11 @@
#define __LA_UID_T short
#define __LA_GID_T short
#else
#if defined(__BORLANDC__)
#include <sys/types.h>
#else
#include <unistd.h> /* ssize_t, uid_t, and gid_t */
#endif
#define __LA_INT64_T int64_t
#define __LA_SSIZE_T ssize_t
#define __LA_UID_T uid_t

View File

@ -45,7 +45,7 @@
* - SGI MIPSpro
* - Microsoft Visual C++ 6.0 (supposedly newer versions too)
*/
#if defined(__WATCOMC__) || defined(__sgi) || defined(__hpux)
#if defined(__WATCOMC__) || defined(__sgi) || defined(__hpux) || defined(__BORLANDC__)
#define inline
#elif defined(_MSC_VER)
#define inline __inline

View File

@ -46,14 +46,18 @@
/* Get appropriate definitions of standard POSIX-style types. */
/* These should match the types used in 'struct stat' */
#if defined(_WIN32) && !defined(__CYGWIN__)
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__)
#define __LA_INT64_T __int64
#define __LA_UID_T short
#define __LA_GID_T short
#define __LA_DEV_T unsigned int
#define __LA_MODE_T unsigned short
#else
#include <unistd.h>
#ifdef __BORLANDC__
# include <sys/types.h>
#else
# include <unistd.h>
#endif
#define __LA_INT64_T int64_t
#define __LA_UID_T uid_t
#define __LA_GID_T gid_t

View File

@ -28,9 +28,13 @@ __FBSDID("$FreeBSD$");
#include "archive_entry.h"
#if defined(_WIN32) && !defined(__CYGWIN__)
#if defined(_WIN32) && !defined(__CYGWIN__)
#if defined(__BORLANDC__) || (defined(_MSC_VER) && _MSC_VER <= 1300)
# define EPOC_TIME (116444736000000000)
#else
# define EPOC_TIME (116444736000000000ULL)
#endif
#define EPOC_TIME (116444736000000000ULL)
__inline static void
fileTimeToUtc(const FILETIME *filetime, time_t *time, long *ns)

View File

@ -50,13 +50,15 @@
#include <ctype.h>
#include <errno.h>
#include <stddef.h>
#ifndef __BORLANDC__
#include <sys/utime.h>
#endif
#include <sys/stat.h>
#include <process.h>
#include <stdlib.h>
#include <wchar.h>
#include <windows.h>
#if defined(_MSC_VER) && _MSC_VER <= 1300
#if defined(__BORLANDC__) || (defined(_MSC_VER) && _MSC_VER <= 1300)
# define EPOC_TIME (116444736000000000)
#else
# define EPOC_TIME (116444736000000000ULL)
@ -376,7 +378,6 @@ __la_ftruncate(int fd, off_t length)
}
return (0);
}
#define WINTIME(sec, usec) ((Int32x32To64(sec, 10000000) + EPOC_TIME) + (usec * 10))
static int
__hutimes(HANDLE handle, const struct __timeval *times)
@ -623,7 +624,11 @@ __la_open(const char *path, int flags, ...)
}
}
if (ws == NULL) {
#ifdef __BORLANDC__
r = _open(path, flags);
#else
r = _open(path, flags, pmode);
#endif
if (r < 0 && errno == EACCES && (flags & O_CREAT) != 0) {
/* simular other POSIX system action to pass a test */
attr = GetFileAttributesA(path);

View File

@ -125,11 +125,13 @@
#define waitpid __la_waitpid
#define write __la_write
#define O_RDONLY _O_RDONLY
#define O_WRONLY _O_WRONLY
#define O_TRUNC _O_TRUNC
#define O_CREAT _O_CREAT
#define O_EXCL _O_EXCL
#ifndef O_RDONLY
#define O_RDONLY _O_RDONLY
#define O_WRONLY _O_WRONLY
#define O_TRUNC _O_TRUNC
#define O_CREAT _O_CREAT
#define O_EXCL _O_EXCL
#endif
#ifndef _S_IFIFO
#define _S_IFIFO 0010000 /* pipe */
@ -155,21 +157,29 @@
#ifndef _S_IFMT
#define _S_IFMT 0170000 /* file type mask */
#endif
#define S_IFIFO _S_IFIFO
#ifndef S_IFIFO
#define S_IFIFO _S_IFIFO
#endif
//#define S_IFCHR _S_IFCHR
//#define S_IFDIR _S_IFDIR
#define S_IFBLK _S_IFBLK
#define S_IFLNK _S_IFLNK
#define S_IFSOCK _S_IFSOCK
#ifndef S_IFBLK
#define S_IFBLK _S_IFBLK
#endif
#ifndef S_IFLNK
#define S_IFLNK _S_IFLNK
#endif
#ifndef S_IFSOCK
#define S_IFSOCK _S_IFSOCK
#endif
//#define S_IFREG _S_IFREG
//#define S_IFMT _S_IFMT
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) /* block special */
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* fifo or socket */
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* char special */
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* directory */
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* regular file */
#ifndef S_ISBLK
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) /* block special */
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* fifo or socket */
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* char special */
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* directory */
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* regular file */
#endif
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* Symbolic link */
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) /* Socket */
@ -194,10 +204,12 @@
#define _S_IWOTH (_S_IWGRP >> 3) /* write permission, other */
#define _S_IROTH (_S_IRGRP >> 3) /* execute/search permission, other */
#define S_IRWXU _S_IRWXU
#define S_IXUSR _S_IXUSR
#define S_IWUSR _S_IWUSR
#define S_IRUSR _S_IRUSR
#ifndef S_IRWXU
#define S_IRWXU _S_IRWXU
#define S_IXUSR _S_IXUSR
#define S_IWUSR _S_IWUSR
#define S_IRUSR _S_IRUSR
#endif
#define S_IRWXG _S_IRWXG
#define S_IXGRP _S_IXGRP
#define S_IWGRP _S_IWGRP

View File

@ -479,7 +479,7 @@ archive_write_pax_header(struct archive_write *a,
path = archive_entry_pathname(entry_main);
path_w = archive_entry_pathname_w(entry_main);
if (path != NULL && path_w == NULL) {
archive_set_error(&a->archive, EILSEQ,
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Can't translate pathname '%s' to UTF-8", path);
ret = ARCHIVE_WARN;
hdrcharset = "BINARY";
@ -487,7 +487,7 @@ archive_write_pax_header(struct archive_write *a,
uname = archive_entry_uname(entry_main);
uname_w = archive_entry_uname_w(entry_main);
if (uname != NULL && uname_w == NULL) {
archive_set_error(&a->archive, EILSEQ,
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Can't translate uname '%s' to UTF-8", uname);
ret = ARCHIVE_WARN;
hdrcharset = "BINARY";
@ -495,7 +495,7 @@ archive_write_pax_header(struct archive_write *a,
gname = archive_entry_gname(entry_main);
gname_w = archive_entry_gname_w(entry_main);
if (gname != NULL && gname_w == NULL) {
archive_set_error(&a->archive, EILSEQ,
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Can't translate gname '%s' to UTF-8", gname);
ret = ARCHIVE_WARN;
hdrcharset = "BINARY";
@ -509,7 +509,7 @@ archive_write_pax_header(struct archive_write *a,
linkpath_w = archive_entry_symlink_w(entry_main);
}
if (linkpath != NULL && linkpath_w == NULL) {
archive_set_error(&a->archive, EILSEQ,
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Can't translate linkpath '%s' to UTF-8", linkpath);
ret = ARCHIVE_WARN;
hdrcharset = "BINARY";