X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/93bf083d699c60f1ac40297bfa6783fb0cb800d8..33ca57b65170c12161da263b548c506135e0898e:/methods/gzip.cc diff --git a/methods/gzip.cc b/methods/gzip.cc index acba7fc52..f1bf60ce6 100644 --- a/methods/gzip.cc +++ b/methods/gzip.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: gzip.cc,v 1.3 1998/10/30 07:53:53 jgg Exp $ +// $Id: gzip.cc,v 1.8 1999/07/30 05:37:00 jgg Exp $ /* ###################################################################### GZip method - Take a file URI in and decompress it into the target @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include @@ -23,7 +23,7 @@ class GzipMethod : public pkgAcqMethod { - virtual bool Fetch(string Message,URI Get); + virtual bool Fetch(FetchItem *Itm); public: @@ -33,11 +33,17 @@ class GzipMethod : public pkgAcqMethod // GzipMethod::Fetch - Decompress the passed URI /*{{{*/ // --------------------------------------------------------------------- /* */ -bool GzipMethod::Fetch(string Message,URI Get) +bool GzipMethod::Fetch(FetchItem *Itm) { + URI Get = Itm->Uri; + + FetchResult Res; + Res.Filename = Itm->DestFile; + URIStart(Res); + // Open the source and destintation files FileFd From(Get.Path,FileFd::ReadOnly); - FileFd To(DestFile,FileFd::WriteEmpty); + FileFd To(Itm->DestFile,FileFd::WriteEmpty); To.EraseOnFailure(); if (_error->PendingError() == true) return false; @@ -90,13 +96,15 @@ bool GzipMethod::Fetch(string Message,URI Get) struct utimbuf TimeBuf; TimeBuf.actime = Buf.st_atime; TimeBuf.modtime = Buf.st_mtime; - if (utime(DestFile.c_str(),&TimeBuf) != 0) + if (utime(Itm->DestFile.c_str(),&TimeBuf) != 0) return _error->Errno("utime","Failed to set modification time"); + if (stat(Itm->DestFile.c_str(),&Buf) != 0) + return _error->Errno("stat","Failed to stat"); + // Return a Done response - FetchResult Res; Res.LastModified = Buf.st_mtime; - Res.Filename = DestFile; + Res.Size = Buf.st_size; URIDone(Res); return true;