]> git.saurik.com Git - apt.git/blobdiff - methods/rred.cc
merged lp:~donkult/apt/experimental
[apt.git] / methods / rred.cc
index 80fc98ac5fa2f63678004baaca50cd4caf1dee00..ef00fcaa39de83364d5b284e77d0955378481096 100644 (file)
@@ -7,6 +7,7 @@
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/hashes.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>
 
 #include <sys/stat.h>
 #include <sys/uio.h>
@@ -53,7 +54,7 @@ protected:
        virtual bool Fetch(FetchItem *Itm);
 
 public:
        virtual bool Fetch(FetchItem *Itm);
 
 public:
-       RredMethod() : pkgAcqMethod("1.1",SingleInstance | SendConfig) {};
+       RredMethod() : pkgAcqMethod("1.1",SingleInstance | SendConfig), Debug(false) {};
 };
                                                                                /*}}}*/
 /** \brief applyFile - in reverse order with a tail recursion                  {{{
 };
                                                                                /*}}}*/
 /** \brief applyFile - in reverse order with a tail recursion                  {{{
@@ -241,7 +242,9 @@ RredMethod::State RredMethod::patchFile(FileFd &Patch, FileFd &From,                /*{{{*/
    return result;
 }
                                                                                /*}}}*/
    return result;
 }
                                                                                /*}}}*/
-struct EdCommand {                                                             /*{{{*/
+/* struct EdCommand                                                            {{{*/
+#ifdef _POSIX_MAPPED_FILES
+struct EdCommand {
   size_t data_start;
   size_t data_end;
   size_t data_lines;
   size_t data_start;
   size_t data_end;
   size_t data_lines;
@@ -250,13 +253,14 @@ struct EdCommand {                                                                /*{{{*/
   char type;
 };
 #define IOV_COUNT 1024 /* Don't really want IOV_MAX since it can be arbitrarily large */
   char type;
 };
 #define IOV_COUNT 1024 /* Don't really want IOV_MAX since it can be arbitrarily large */
+#endif
                                                                                /*}}}*/
 RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From,           /*{{{*/
                                        FileFd &out_file, Hashes *hash) const {
 #ifdef _POSIX_MAPPED_FILES
        MMap ed_cmds(MMap::ReadOnly);
        if (Patch.gzFd() != NULL) {
                                                                                /*}}}*/
 RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From,           /*{{{*/
                                        FileFd &out_file, Hashes *hash) const {
 #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;
                DynamicMMap* dyn = new DynamicMMap(0, mapSize, 0);
                if (dyn->validData() == false) {
                        delete dyn;
@@ -469,7 +473,7 @@ bool RredMethod::Fetch(FetchItem *Itm)                                              /*{{{*/
 {
    Debug = _config->FindB("Debug::pkgAcquire::RRed", false);
    URI Get = Itm->Uri;
 {
    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;
 
    FetchResult Res;
    Res.Filename = Itm->DestFile;
@@ -522,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 ||
       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;
       return _error->Errno("stat",_("Failed to stat"));
 
    struct utimbuf TimeBuf;