diff netinstall/tar.cc @ 452:3d3049ae1304 r21-2-41

Import from CVS: tag r21-2-41
author cvs
date Mon, 13 Aug 2007 11:40:21 +0200
parents 3078fd1074e8
children
line wrap: on
line diff
--- a/netinstall/tar.cc	Mon Aug 13 11:39:21 2007 +0200
+++ b/netinstall/tar.cc	Mon Aug 13 11:40:21 2007 +0200
@@ -116,10 +116,37 @@
   return g ? 0 : 1;
 }
 
+/* For some reason the cygwin version uses a function that is not in
+   the original source. We duplicate it here - although this does mean
+   revealing some internals. */
+extern "C" {
+  z_off_t ZEXPORT tar_gzctell (gzFile file);
+  typedef struct gz_stream {
+    z_stream stream;
+    int      z_err;   /* error code for last stream operation */
+    int      z_eof;   /* set if end of input file */
+    FILE     *file;   /* .gz file */
+    Byte     *inbuf;  /* input buffer */
+    Byte     *outbuf; /* output buffer */
+    uLong    crc;     /* crc32 of uncompressed data */
+    char     *msg;    /* error message */
+    char     *path;   /* path name for debugging only */
+    int      transparent; /* 1 if input file is not a .gz file */
+    char     mode;    /* 'w' or 'r' */
+    long     startpos; /* start of compressed data in file (header skipped) */
+  } gz_stream;
+};
+
+z_off_t ZEXPORT tar_gzctell (gzFile file)
+{
+    gz_stream *s = (gz_stream *)file;
+    return ftell(s->file);
+}
+
 int
 tar_ftell ()
 {
-  return gztell (g);
+  return tar_gzctell (g);
 }
 
 static void
@@ -482,7 +509,7 @@
 
   if ((tar_open (pathname)))
     return 1;
-  while (c = tar_next_file ())
+  while ((c = tar_next_file ()))
     {
       int l = strlen (c);
       for (i=0; i<nmaps; i++)