]> git.saurik.com Git - apt.git/blobdiff - methods/rred.cc
enable FileFd to guess the compressor based on the filename if requested or
[apt.git] / methods / rred.cc
index 6c55880ca1726c782bd1f939c50952a7f083c0ba..56ad8220b8006e5ff2d4cd33140bb3064d794ff0 100644 (file)
@@ -1,10 +1,13 @@
 // Includes                                                                    /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/mmap.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/hashes.h>
+#include <apt-pkg/configuration.h>
 
 #include <sys/stat.h>
 #include <sys/uio.h>
@@ -257,7 +260,7 @@ RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From,                /*{{{*/
 #ifdef _POSIX_MAPPED_FILES
        MMap ed_cmds(MMap::ReadOnly);
        if (Patch.gzFd() != NULL) {
-               unsigned long mapSize = Patch.Size();
+               unsigned long long mapSize = Patch.Size();
                DynamicMMap* dyn = new DynamicMMap(0, mapSize, 0);
                if (dyn->validData() == false) {
                        delete dyn;
@@ -470,7 +473,7 @@ bool RredMethod::Fetch(FetchItem *Itm)                                              /*{{{*/
 {
    Debug = _config->FindB("Debug::pkgAcquire::RRed", false);
    URI Get = Itm->Uri;
-   string Path = Get.Host + Get.Path; // To account for relative paths
+   std::string Path = Get.Host + Get.Path; // To account for relative paths
 
    FetchResult Res;
    Res.Filename = Itm->DestFile;
@@ -486,7 +489,7 @@ bool RredMethod::Fetch(FetchItem *Itm)                                              /*{{{*/
    // Open the source and destination files (the d'tor of FileFd will do 
    // the cleanup/closing of the fds)
    FileFd From(Path,FileFd::ReadOnly);
-   FileFd Patch(Path+".ed",FileFd::ReadOnlyGzip);
+   FileFd Patch(Path+".ed",FileFd::ReadOnly, FileFd::Gzip);
    FileFd To(Itm->DestFile,FileFd::WriteAtomic);   
    To.EraseOnFailure();
    if (_error->PendingError() == true)
@@ -523,7 +526,7 @@ bool RredMethod::Fetch(FetchItem *Itm)                                              /*{{{*/
       and use the access time from the "old" file */
    struct stat BufBase, BufPatch;
    if (stat(Path.c_str(),&BufBase) != 0 ||
-       stat(string(Path+".ed").c_str(),&BufPatch) != 0)
+       stat(std::string(Path+".ed").c_str(),&BufPatch) != 0)
       return _error->Errno("stat",_("Failed to stat"));
 
    struct utimbuf TimeBuf;