]> git.saurik.com Git - apt.git/commitdiff
* apt-pkg/pkgcache.h:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 3 Jun 2010 07:22:00 +0000 (09:22 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 3 Jun 2010 07:22:00 +0000 (09:22 +0200)
  - switch {,Install-}Size to unsigned long long
* apt-pkg/depcache.cc:
  - deal with long long, not with int to remove 2GB Limit (LP: #250909)

apt-pkg/acquire-item.h
apt-pkg/deb/deblistparser.cc
apt-pkg/depcache.cc
apt-pkg/pkgcache.h
apt-pkg/tagfile.cc
apt-pkg/tagfile.h
debian/changelog

index b338b2a4199f9fe60cc437b2e298876a171e291c..36fc53b92eb7c4fbdb9e28a01d287de0e4bfbbd5 100644 (file)
@@ -112,10 +112,10 @@ class pkgAcquire::Item : public WeakPointable
    string ErrorText;
 
    /** \brief The size of the object to fetch. */
-   unsigned long FileSize;
+   unsigned long long FileSize;
 
    /** \brief How much of the object was already fetched. */
-   unsigned long PartialSize;
+   unsigned long long PartialSize;
 
    /** \brief If not \b NULL, contains the name of a subprocess that
     *  is operating on this object (for instance, "gzip" or "gpgv").
index 0551a5f7ca9e1c79f9096271bb94df503daa2062..83c5b8d2eb64d1e159e769deabb166dffba4de66 100644 (file)
@@ -133,10 +133,9 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver)
    }
 
    // Archive Size
-   Ver->Size = (unsigned)Section.FindI("Size");
-   
+   Ver->Size = Section.FindULL("Size");
    // Unpacked Size (in K)
-   Ver->InstalledSize = (unsigned)Section.FindI("Installed-Size");
+   Ver->InstalledSize = Section.FindULL("Installed-Size");
    Ver->InstalledSize *= 1024;
 
    // Priority
index 411ae5f6253aa02e766cadb5c583ae5c01b87bd9..6e0eeab5b9e646d1bc0bdfa0c994eb8377350b80 100644 (file)
@@ -422,8 +422,8 @@ void pkgDepCache::AddSizes(const PkgIterator &Pkg,signed long Mult)
    // Compute the size data
    if (P.NewInstall() == true)
    {
-      iUsrSize += (signed)(Mult*P.InstVerIter(*this)->InstalledSize);
-      iDownloadSize += (signed)(Mult*P.InstVerIter(*this)->Size);
+      iUsrSize += (signed long long)(Mult*P.InstVerIter(*this)->InstalledSize);
+      iDownloadSize += (signed long long)(Mult*P.InstVerIter(*this)->Size);
       return;
    }
    
@@ -432,9 +432,9 @@ void pkgDepCache::AddSizes(const PkgIterator &Pkg,signed long Mult)
        (P.InstallVer != (Version *)Pkg.CurrentVer() || 
        (P.iFlags & ReInstall) == ReInstall) && P.InstallVer != 0)
    {
-      iUsrSize += (signed)(Mult*((signed)P.InstVerIter(*this)->InstalledSize - 
-                       (signed)Pkg.CurrentVer()->InstalledSize));
-      iDownloadSize += (signed)(Mult*P.InstVerIter(*this)->Size);
+      iUsrSize += (signed long long)(Mult*((signed long long)P.InstVerIter(*this)->InstalledSize - 
+                       (signed long long)Pkg.CurrentVer()->InstalledSize));
+      iDownloadSize += (signed long long)(Mult*P.InstVerIter(*this)->Size);
       return;
    }
    
@@ -442,14 +442,14 @@ void pkgDepCache::AddSizes(const PkgIterator &Pkg,signed long Mult)
    if (Pkg.State() == pkgCache::PkgIterator::NeedsUnpack &&
        P.Delete() == false)
    {
-      iDownloadSize += (signed)(Mult*P.InstVerIter(*this)->Size);
+      iDownloadSize += (signed long long)(Mult*P.InstVerIter(*this)->Size);
       return;
    }
    
    // Removing
    if (Pkg->CurrentVer != 0 && P.InstallVer == 0)
    {
-      iUsrSize -= (signed)(Mult*Pkg.CurrentVer()->InstalledSize);
+      iUsrSize -= (signed long long)(Mult*Pkg.CurrentVer()->InstalledSize);
       return;
    }   
 }
index 643f240b0da6071456c1827e675736d5356e2000..426bb9f1300aa6ed628b5a0731ffec0840675c76 100644 (file)
@@ -532,9 +532,9 @@ struct pkgCache::Version
    /** \brief archive size for this version
 
        For Debian this is the size of the .deb file. */
-   map_ptrloc Size;              // These are the .deb size
+   unsigned long long Size;      // These are the .deb size
    /** \brief uncompressed size for this version */
-   map_ptrloc InstalledSize;
+   unsigned long long InstalledSize;
    /** \brief characteristic value representing this version
 
        No two packages in existence should have the same VerStr
index 0d4999ee7774a94e2bda998dac98524e95e864ba..1394d7e24acba2256d4d836641ad0188b7445e97 100644 (file)
@@ -365,6 +365,30 @@ signed int pkgTagSection::FindI(const char *Tag,signed long Default) const
    return Result;
 }
                                                                        /*}}}*/
+// TagSection::FindULL - Find an unsigned long long integer            /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+unsigned long long pkgTagSection::FindULL(const char *Tag, unsigned long long const &Default) const
+{
+   const char *Start;
+   const char *Stop;
+   if (Find(Tag,Start,Stop) == false)
+      return Default;
+
+   // Copy it into a temp buffer so we can use strtoull
+   char S[100];
+   if ((unsigned)(Stop - Start) >= sizeof(S))
+      return Default;
+   strncpy(S,Start,Stop-Start);
+   S[Stop - Start] = 0;
+   
+   char *End;
+   unsigned long long Result = strtoull(S,&End,10);
+   if (S == End)
+      return Default;
+   return Result;
+}
+                                                                       /*}}}*/
 // TagSection::FindFlag - Locate a yes/no type flag                    /*{{{*/
 // ---------------------------------------------------------------------
 /* The bits marked in Flag are masked on/off in Flags */
index f63a51d07843be82fe63a95daf64ff24797e5214..6891c1d81c448378d08d948bbc4af10beb75d602 100644 (file)
@@ -57,6 +57,7 @@ class pkgTagSection
    bool Find(const char *Tag,unsigned &Pos) const;
    string FindS(const char *Tag) const;
    signed int FindI(const char *Tag,signed long Default = 0) const ;
+   unsigned long long FindULL(const char *Tag, unsigned long long const &Default = 0) const;
    bool FindFlag(const char *Tag,unsigned long &Flags,
                 unsigned long Flag) const;
    bool Scan(const char *Start,unsigned long MaxLength);
index 3771ca41577afb2400f747d3899c11e84c5c566c..e153027b39527fd76795baf881ee0c3e61d783c4 100644 (file)
@@ -1,3 +1,13 @@
+apt (0.7.26~exp6) UNRELEASED; urgency=low
+
+  [ David Kalnischkies ]
+  * apt-pkg/pkgcache.h:
+    - switch {,Install-}Size to unsigned long long
+  * apt-pkg/depcache.cc:
+    - deal with long long, not with int to remove 2GB Limit (LP: #250909)
+
+ -- David Kalnischkies <kalnischkies@gmail.com>  Thu, 03 Jun 2010 09:19:01 +0200
+
 apt (0.7.26~exp5) experimental; urgency=low
 
   [ David Kalnischkies ]