From 0c4e666cb6bf1a8b978cae07e29d7325bc530cae Mon Sep 17 00:00:00 2001 From: hniksic Date: Fri, 25 Feb 2005 16:23:24 -0800 Subject: [PATCH] [svn] Large file fixes for Borland C, published in <87u0o0cgr1.fsf@xemacs.org>. --- src/ChangeLog | 14 ++++++++++++++ src/mswindows.c | 6 +++--- src/mswindows.h | 22 +++++++++++++--------- src/utils.c | 7 +++---- windows/Makefile.src | 4 ++-- windows/Makefile.src.bor | 3 +-- windows/Makefile.top.bor | 2 +- 7 files changed, 37 insertions(+), 21 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 921f2d4c..c80da5a5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +2005-02-26 Hrvoje Niksic + + * utils.c: Use the nnnI64 syntax for __int64 constants under all + Windows compilers. + (SPRINTF_WGINT): Use "%I64" under all Windows compilers. + + * mswindows.h (WGINT_MAX): Use the nnnI64 syntax for + __int64 constants under all Windows compilers. + (struct_stat): Use `struct stati64' under Borland C. + (fstat): Don't redefine to _fstati64 under Borland. + + * mswindows.c: Define str_to_int64 under Borland C as well as + under (older) Visual C. + 2005-02-25 Hrvoje Niksic * ftp.c (getftp): Initialize err to suppress compiler warning. diff --git a/src/mswindows.c b/src/mswindows.c index 8c3e84a5..ca1f46a8 100644 --- a/src/mswindows.c +++ b/src/mswindows.c @@ -86,7 +86,7 @@ xsleep (double seconds) #endif /* not HAVE_USLEEP */ } -#if defined(_MSC_VER) && _MSC_VER < 1300 +#if defined(__BORLANDC__) || (defined(_MSC_VER) && _MSC_VER < 1300) static inline int char_value (char c, int base) @@ -195,7 +195,7 @@ str_to_int64 (const char *nptr, char **endptr, int base) return result; } -#else /* !defined(_MSC_VER) || _MSC_VER >= 1300 */ +#else /* !defined(__BORLANDC__) && (!defined(_MSC_VER) || _MSC_VER >= 1300) */ __int64 str_to_int64 (const char *nptr, char **endptr, int base) @@ -207,7 +207,7 @@ str_to_int64 (const char *nptr, char **endptr, int base) #endif } -#endif /* !defined(_MSC_VER) || _MSC_VER >= 1300 */ +#endif /* !defined(__BORLANDC__) && (!defined(_MSC_VER) || _MSC_VER >= 1300) */ void windows_main_junk (int *argc, char **argv, char **exec_name) diff --git a/src/mswindows.h b/src/mswindows.h index ced740cd..0b795af4 100644 --- a/src/mswindows.h +++ b/src/mswindows.h @@ -83,12 +83,7 @@ so, delete this exception statement from your version. */ /* Define a wgint type under Windows. */ typedef __int64 wgint; #define SIZEOF_WGINT 8 - -#if defined(_MSC_VER) || defined (__WATCOMC__) -# define WGINT_MAX 9223372036854775807I64 -#else -# define WGINT_MAX 9223372036854775807LL -#endif +#define WGINT_MAX 9223372036854775807I64 #define str_to_wgint str_to_int64 __int64 str_to_int64 (const char *, char **, int); @@ -99,13 +94,22 @@ __int64 str_to_int64 (const char *, char **, int); /* Transparently support large files, in spirit similar to the POSIX LFS API. */ #define stat(fname, buf) _stati64 (fname, buf) -#define fstat(fd, buf) _fstati64 (fd, buf) -#define struct_stat struct _stati64 + +#ifndef __BORLANDC__ +# define fstat(fd, buf) _fstati64 (fd, buf) +#endif + +#if defined(_MSC_VER) +# define struct_stat struct _stati64 +#elif defined(__BORLANDC__) +# define struct_stat struct stati64 +#else +# define struct_stat struct stat +#endif #define PATH_SEPARATOR '\\' #ifdef HAVE_ISATTY -/* Microsoft VC supports _isatty; Borland? */ #ifdef _MSC_VER # define isatty _isatty #endif diff --git a/src/utils.c b/src/utils.c index 7259d019..2589a233 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1263,9 +1263,8 @@ numdigit (wgint number) # define C100000000000000000 100000000000000000LL # define C1000000000000000000 1000000000000000000LL # else -# if defined(_MSC_VER) || defined(__WATCOM__) -/* Otherwise, if __int64 is available (under Windows), use __int64 - constants. */ +# if defined(WINDOWS) +/* Use __int64 constants under Windows. */ # define C10000000000 10000000000I64 # define C100000000000 100000000000I64 # define C1000000000000 1000000000000I64 @@ -1287,7 +1286,7 @@ numdigit (wgint number) # if SIZEOF_LONG_LONG >= SIZEOF_WGINT # define SPRINTF_WGINT(buf, n) sprintf(buf, "%lld", (long long) (n)) # else -# ifdef _MSC_VER +# ifdef WINDOWS # define SPRINTF_WGINT(buf, n) sprintf(buf, "%I64", (__int64) (n)) # endif # endif diff --git a/windows/Makefile.src b/windows/Makefile.src index cde223d0..c4946eb0 100644 --- a/windows/Makefile.src +++ b/windows/Makefile.src @@ -72,13 +72,13 @@ SRC = cmpt.c safe-ctype.c convert.c connect.c host.c http.c netrc.c \ ftp-basic.c ftp.c ftp-ls.c ftp-opie.c getopt.c hash.c \ html-parse.c html-url.c progress.c retr.c recur.c res.c url.c cookies.c \ init.c utils.c main.c version.c xmalloc.c mswindows.c \ - gen-md5.c gnu-md5.c log.c string_t.c $(SSLSRC) + gen-md5.c gnu-md5.c log.c $(SSLSRC) OBJ = cmpt$o safe-ctype$o convert$o connect$o host$o http$o netrc$o \ ftp-basic$o ftp$o ftp-ls$o ftp-opie$o getopt$o hash$o \ html-parse$o html-url$o progress$o retr$o recur$o res$o url$o cookies$o \ init$o utils$o main$o version$o xmalloc$o mswindows$o \ - gen-md5$o gnu-md5$o log$o string_t$o $(SSLOBJ) + gen-md5$o gnu-md5$o log$o $(SSLOBJ) .SUFFIXES: .c .obj diff --git a/windows/Makefile.src.bor b/windows/Makefile.src.bor index 32ff46cf..e01c087c 100644 --- a/windows/Makefile.src.bor +++ b/windows/Makefile.src.bor @@ -14,7 +14,7 @@ OBJS=cmpt.obj connect.obj convert.obj ftp.obj ftp-basic.obj \ http.obj init.obj log.obj main.obj gnu-md5.obj netrc.obj \ safe-ctype.obj hash.obj progress.obj gen-md5.obj cookies.obj \ recur.obj res.obj retr.obj url.obj utils.obj version.obj xmalloc.obj \ - mswindows.obj string_t.obj + mswindows.obj LIBDIR=$(MAKEDIR)\..\lib @@ -48,7 +48,6 @@ recur.obj+ res.obj+ retr.obj+ safe-ctype.obj+ -string_t.obj+ url.obj+ utils.obj+ version.obj+ diff --git a/windows/Makefile.top.bor b/windows/Makefile.top.bor index e264f6c7..e4554813 100644 --- a/windows/Makefile.top.bor +++ b/windows/Makefile.top.bor @@ -38,7 +38,7 @@ all: Makefile $(SUBDIRS) $(SUBDIRS): cd $@ - $(MAKE) + $(MAKEDIR)\$(MAKE) cd .. # install everything -- 2.39.2