From 32baf2043470364725a69a077d09f48d28badc14 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Thu, 5 Mar 2009 00:36:13 +0000 Subject: [PATCH] Merge r342 from libarchive.googlecode.com: Remove some Windows special casing. --- lib/libarchive/archive_write_disk.c | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/lib/libarchive/archive_write_disk.c b/lib/libarchive/archive_write_disk.c index 448d92e91a11..b71c1da66906 100644 --- a/lib/libarchive/archive_write_disk.c +++ b/lib/libarchive/archive_write_disk.c @@ -83,9 +83,6 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_UTIME_H #include #endif -#ifdef _WIN32 -#include -#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_disk *a, const char *buff, size_t size) "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_disk *a, const char *buff, size_t size) 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_disk *a, const char *buff, size_t size) archive_set_error(&a->archive, errno, "Write failed"); return (ARCHIVE_WARN); } -#endif buff += bytes_written; size -= bytes_written; a->offset += bytes_written;