Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Mar 2009 00:36:13 +0000 (UTC)
From:      Tim Kientzle <kientzle@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r189383 - head/lib/libarchive
Message-ID:  <200903050036.n250aDXc057618@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kientzle
Date: Thu Mar  5 00:36:13 2009
New Revision: 189383
URL: http://svn.freebsd.org/changeset/base/189383

Log:
  Merge r342 from libarchive.googlecode.com: Remove some
  Windows special casing.

Modified:
  head/lib/libarchive/archive_write_disk.c

Modified: head/lib/libarchive/archive_write_disk.c
==============================================================================
--- head/lib/libarchive/archive_write_disk.c	Thu Mar  5 00:35:21 2009	(r189382)
+++ head/lib/libarchive/archive_write_disk.c	Thu Mar  5 00:36:13 2009	(r189383)
@@ -83,9 +83,6 @@ __FBSDID("$FreeBSD$");
 #ifdef HAVE_UTIME_H
 #include <utime.h>
 #endif
-#ifdef _WIN32
-#include <windows.h>
-#endif
 
 #include "archive.h"
 #include "archive_string.h"
@@ -519,9 +516,6 @@ static ssize_t
 write_data_block(struct archive_write_disk *a, const char *buff, size_t size)
 {
 	uint64_t start_size = size;
-#if _WIN32
-	HANDLE handle;
-#endif
 	ssize_t bytes_written = 0;
 	ssize_t block_size = 0, bytes_to_write;
 
@@ -530,9 +524,6 @@ write_data_block(struct archive_write_di
 		    "Attempt to write to an empty file");
 		return (ARCHIVE_WARN);
 	}
-#if _WIN32
-	handle = (HANDLE)_get_osfhandle(a->fd);
-#endif
 
 	if (a->flags & ARCHIVE_EXTRACT_SPARSE) {
 #if HAVE_STRUCT_STAT_ST_BLKSIZE
@@ -581,26 +572,9 @@ write_data_block(struct archive_write_di
 			if (a->offset + bytes_to_write > block_end)
 				bytes_to_write = block_end - a->offset;
 		}
-#ifdef _WIN32
 		/* Seek if necessary to the specified offset. */
 		if (offset != a->fd_offset) {
-			LARGE_INTEGER distance;
-			distance.QuadPart = offset;
-			if (!SetFilePointerEx(handle, distance, NULL, FILE_BEGIN)) {
-				archive_set_error(&a->archive, _dosmaperr(GetLastError()),
-				    "Seek failed");
-				return (ARCHIVE_FATAL);
-			}
- 		}
-		if (!WriteFile(handle, buff, bytes_to_write, &bytes_written, NULL)) {
-			archive_set_error(&a->archive, _dosmaperr(GetLastError()),
-			    "Write failed");
-			return (ARCHIVE_WARN);
-		}
-#else
-		/* Seek if necessary to the specified offset. */
-		if (a->offset != a->fd_offset) {
-			if (lseek(a->fd, a->offset, SEEK_SET) < 0) {
+			if (lseek(a->fd, offset, SEEK_SET) < 0) {
 				archive_set_error(&a->archive, errno,
 				    "Seek failed");
 				return (ARCHIVE_FATAL);
@@ -614,7 +588,6 @@ write_data_block(struct archive_write_di
 			archive_set_error(&a->archive, errno, "Write failed");
 			return (ARCHIVE_WARN);
 		}
-#endif
 		buff += bytes_written;
 		size -= bytes_written;
 		a->offset += bytes_written;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903050036.n250aDXc057618>