"Hrvoje Niksic" wrote:

In other words, large files now work on Windows?  I must admit, that
was almost too easy.  :-)

Don't open the champagne bottle just yet :)

Now could someone try this with Borland and/or Watcom and MingW?  I'm
pretty sure I broke them in some places, but it's near impossible to
fix it without having the compilers available for testing.

Patch attached.


errno/WSAGetLastError() handling and reporting is still broken for all Win32 compilers. Search for SET_ERRNO() in the mail-archive. And also
here:
http://www.mail-archive.com/wget%40sunsite.dk/msg06475.html


*_ERRNO() is in my working copy. Drop that until I come up with a use for them.

--gv
diff -u3 -Hb -r CVS-Latest/src/mswindows.h src/mswindows.h
--- CVS-Latest/src/mswindows.h  Fri Feb 25 23:23:21 2005
+++ src/mswindows.h     Sat Feb 26 13:54:53 2005
@@ -83,7 +83,11 @@
/* Define a wgint type under Windows. */
typedef __int64 wgint;
#define SIZEOF_WGINT 8
+#ifdef __GNUC__
+#define WGINT_MAX 9223372036854775807LL
+#else
#define WGINT_MAX 9223372036854775807I64
+#endif

#define str_to_wgint str_to_int64
__int64 str_to_int64 (const char *, char **, int);
@@ -99,7 +103,7 @@
# define fstat(fd, buf) _fstati64 (fd, buf)
#endif

-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__)
# define struct_stat struct _stati64
#elif defined(__BORLANDC__)
# define struct_stat struct stati64
diff -u3 -Hb -r CVS-Latest/src/sysdep.h src/sysdep.h
--- CVS-Latest/src/sysdep.h     Wed Feb 23 21:21:04 2005
+++ src/sysdep.h        Sat Feb 26 13:43:34 2005
@@ -108,6 +108,17 @@
#endif
#endif

+/* Hacks for setting/getting errno / h_errno.  */
+#ifdef WINDOWS
+# define GET_ERRNO()      errno = WSAGetLastError()
+# define SET_ERRNO(e)     WSASetLastError (errno = (e))
+# define SET_H_ERRNO(e)   WSASetLastError (e)
+#else
+# define GET_ERRNO()      ((void)0)
+# define SET_ERRNO(e)     ((void)(errno = (e)))
+# define SET_H_ERRNO(e)   ((void)(h_errno = (e)))
+#endif
+
/* Define a large integral type useful for storing large sizes that
   exceed sizes of one download, such as when printing the sum of all
   downloads.  Note that this has nothing to do with large file
@@ -127,7 +138,7 @@
typedef long long LARGE_INT;
#  define LARGE_INT_FMT "%lld"
# else
-#  if _MSC_VER
+#  if defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__)
/* Use __int64 under Windows. */
typedef __int64 LARGE_INT;
#   define LARGE_INT_FMT "%I64"

Reply via email to