Sophie

Sophie

distrib > Mandriva > mes5 > i586 > by-pkgid > 8904b4ed5d1b7596e6e4524fbeb09e7f > files > 1

libtar-1.2.11-8mdv2009.0.src.rpm

2005-01-21  Gwenole Beauchesne  <gbeauchesne@mandriva.com>

	* 64-bit fixes causing a slight API change. This is necessary if you
	want .tar.gz support (as the libtar sample application). Note that it
	already worked as is on x86_64 but the code was not fully 64-bit clean
	and relied on behaviour that turned to work there.

--- libtar-1.2.11/lib/libtar.h.64bit-fixes	2003-01-07 02:40:59.000000000 +0100
+++ libtar-1.2.11/lib/libtar.h	2005-07-21 17:07:25.000000000 +0200
@@ -62,10 +62,10 @@ struct tar_header
 
 /***** handle.c ************************************************************/
 
-typedef int (*openfunc_t)(const char *, int, ...);
-typedef int (*closefunc_t)(int);
-typedef ssize_t (*readfunc_t)(int, void *, size_t);
-typedef ssize_t (*writefunc_t)(int, const void *, size_t);
+typedef long (*openfunc_t)(const char *, int, ...);
+typedef int (*closefunc_t)(long);
+typedef ssize_t (*readfunc_t)(long, void *, size_t);
+typedef ssize_t (*writefunc_t)(long, const void *, size_t);
 
 typedef struct
 {
--- libtar-1.2.11/lib/handle.c.64bit-fixes	2003-01-07 02:40:59.000000000 +0100
+++ libtar-1.2.11/lib/handle.c	2005-07-21 17:09:42.000000000 +0200
@@ -27,7 +27,7 @@
 
 const char libtar_version[] = PACKAGE_VERSION;
 
-static tartype_t default_type = { open, close, read, write };
+static tartype_t default_type = { (openfunc_t)open, (closefunc_t)close, (readfunc_t)read, (writefunc_t)write };
 
 
 static int
--- libtar-1.2.11/libtar/libtar.c.64bit-fixes	2005-07-21 16:50:59.000000000 +0200
+++ libtar-1.2.11/libtar/libtar.c	2005-07-21 17:10:17.000000000 +0200
@@ -27,6 +27,10 @@
 # include <unistd.h>
 #endif
 
+#ifdef HAVE_MALLOC_H
+# include <malloc.h>
+#endif
+
 #ifdef DEBUG
 # include <signal.h>
 #endif
@@ -57,7 +61,7 @@ segv_handler(int sig)
 
 int use_zlib = 0;
 
-int
+long
 gzopen_frontend(char *pathname, int oflags, int mode)
 {
 	char *gzoflags;
@@ -92,7 +96,7 @@ gzopen_frontend(char *pathname, int ofla
 		return -1;
 	}
 
-	return (int)gzf;
+	return (long)gzf;
 }
 
 tartype_t gztype = { (openfunc_t) gzopen_frontend, (closefunc_t) gzclose,
@@ -288,6 +292,11 @@ main(int argc, char *argv[])
 
 	progname = basename(argv[0]);
 
+#ifdef M_MMAP_THRESHOLD
+	/* force allocation out of brk space */
+	mallopt(M_MMAP_THRESHOLD, 0);
+#endif
+
 	while ((c = getopt(argc, argv, "cC:gtvVxz")) != -1)
 		switch (c)
 		{