]> git.saurik.com Git - apt.git/commitdiff
merge with debian/experimental
authorDavid Kalnischkies <kalnischkies@gmail.com>
Tue, 13 Sep 2011 15:52:22 +0000 (17:52 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Tue, 13 Sep 2011 15:52:22 +0000 (17:52 +0200)
119 files changed:
apt-inst/contrib/arfile.cc
apt-inst/contrib/arfile.h
apt-inst/contrib/extracttar.cc
apt-inst/database.cc
apt-inst/deb/debfile.cc
apt-inst/deb/dpkgdb.cc
apt-inst/dirstream.cc
apt-inst/extract.cc
apt-inst/filelist.cc
apt-pkg/acquire-item.cc
apt-pkg/acquire-method.cc
apt-pkg/acquire-worker.cc
apt-pkg/acquire.cc
apt-pkg/algorithms.cc
apt-pkg/aptconfiguration.cc
apt-pkg/cachefile.cc
apt-pkg/cachefilter.cc
apt-pkg/cacheset.cc
apt-pkg/cdrom.cc
apt-pkg/clean.cc
apt-pkg/contrib/cdromutl.cc
apt-pkg/contrib/cmndline.cc
apt-pkg/contrib/configuration.cc
apt-pkg/contrib/crc-16.cc
apt-pkg/contrib/crc-16.h
apt-pkg/contrib/error.cc
apt-pkg/contrib/fileutl.cc
apt-pkg/contrib/fileutl.h
apt-pkg/contrib/hashes.cc
apt-pkg/contrib/hashes.h
apt-pkg/contrib/hashsum.cc
apt-pkg/contrib/hashsum_template.h
apt-pkg/contrib/md5.cc
apt-pkg/contrib/md5.h
apt-pkg/contrib/mmap.cc
apt-pkg/contrib/mmap.h
apt-pkg/contrib/netrc.cc
apt-pkg/contrib/progress.cc
apt-pkg/contrib/progress.h
apt-pkg/contrib/sha1.cc
apt-pkg/contrib/sha1.h
apt-pkg/contrib/sha2.h
apt-pkg/contrib/sha2_internal.cc
apt-pkg/contrib/strutl.cc
apt-pkg/contrib/strutl.h
apt-pkg/deb/debindexfile.cc
apt-pkg/deb/deblistparser.cc
apt-pkg/deb/debmetaindex.cc
apt-pkg/deb/debrecords.cc
apt-pkg/deb/debsrcrecords.cc
apt-pkg/deb/debsystem.cc
apt-pkg/deb/debversion.cc
apt-pkg/deb/dpkgpm.cc
apt-pkg/depcache.cc
apt-pkg/edsp.cc
apt-pkg/edsp/edspindexfile.cc
apt-pkg/edsp/edsplistparser.cc
apt-pkg/edsp/edspsystem.cc
apt-pkg/indexcopy.cc
apt-pkg/indexcopy.h
apt-pkg/indexfile.cc
apt-pkg/indexrecords.cc
apt-pkg/indexrecords.h
apt-pkg/init.cc
apt-pkg/orderlist.cc
apt-pkg/packagemanager.cc
apt-pkg/pkgcache.cc
apt-pkg/pkgcachegen.cc
apt-pkg/pkgrecords.cc
apt-pkg/pkgrecords.h
apt-pkg/pkgsystem.cc
apt-pkg/policy.cc
apt-pkg/sourcelist.cc
apt-pkg/srcrecords.cc
apt-pkg/tagfile.cc
apt-pkg/tagfile.h
apt-pkg/vendor.cc
apt-pkg/vendorlist.cc
apt-pkg/version.cc
apt-pkg/versionmatch.cc
buildlib/config.h.in
cmdline/acqprogress.cc
cmdline/apt-cache.cc
cmdline/apt-cdrom.cc
cmdline/apt-config.cc
cmdline/apt-extracttemplates.cc
cmdline/apt-get.cc
cmdline/apt-mark.cc
cmdline/apt-sortpkgs.cc
configure.in
debian/changelog
ftparchive/apt-ftparchive.cc
ftparchive/cachedb.cc
ftparchive/cachedb.h
ftparchive/contents.cc
ftparchive/contents.h
ftparchive/multicompress.cc
ftparchive/multicompress.h
ftparchive/override.cc
ftparchive/writer.cc
ftparchive/writer.h
methods/bzip2.cc
methods/cdrom.cc
methods/connect.cc
methods/copy.cc
methods/file.cc
methods/ftp.cc
methods/ftp.h
methods/gpgv.cc
methods/gzip.cc
methods/http.cc
methods/http.h
methods/http_main.cc
methods/https.cc
methods/mirror.cc
methods/rfc2553emu.cc
methods/rred.cc
methods/rsh.cc
methods/rsh.h

index 8018f4d30792dd99a4fc67da30850f05081edce1..533c563f9a05ff5418353570e0ca6f803e8169e4 100644 (file)
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/arfile.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 
 #include <stdlib.h>
-                                                                       /*}}}*/
+
 #include <apti18n.h>
+                                                                       /*}}}*/
 
 struct ARArchive::MemberHeader
 {
index 7f6c683024a3a36d5ea87eda0fcec972e16f3416..e2063cd716a6430c9eb3acc7919df05c9f7cb29e 100644 (file)
@@ -54,7 +54,7 @@ struct ARArchive::Member
    unsigned long UID;
    unsigned long GID;
    unsigned long Mode;
-   unsigned long Size;
+   unsigned long long Size;
    
    // Location of the data.
    unsigned long Start;
index 01b6b38360bd61dd1dcfe505aed9a9312b0dc47f..487027c3daccf16bcba2291f89a53adef758764a 100644 (file)
@@ -16,8 +16,9 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#include <apt-pkg/extracttar.h>
+#include<config.h>
 
+#include <apt-pkg/extracttar.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
@@ -28,6 +29,7 @@
 #include <signal.h>
 #include <fcntl.h>
 #include <iostream>
+
 #include <apti18n.h>
                                                                        /*}}}*/
 
index a5020f3d76c2c4025b6948141ae04c327c1b1141..0647959a9ffc2f1566b1c20cf3c66a5f1260599b 100644 (file)
@@ -8,6 +8,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/database.h>
                                                                        /*}}}*/
 
index a40cd1ae81fdb62cf25d185b8c3107f134e129ff..e80d8c73581a664c54e9a1414b69f0b6a69f2317 100644 (file)
@@ -16,6 +16,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/debfile.h>
 #include <apt-pkg/extracttar.h>
 #include <apt-pkg/error.h>
index a75cf59ca5858ab533de5f203c9222b1e02f0563..3112acdbd22c201e72239cc25708859b9896059d 100644 (file)
@@ -13,6 +13,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/dpkgdb.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
index 9b6a568482a5206af9dc9a84b6a6dec305be9cd9..bb0bf96c18a480bdaa32727b73637224a85f2b92 100644 (file)
@@ -11,6 +11,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/dirstream.h>
 #include <apt-pkg/error.h>
 
index cd8edb27aaab462b52b6061529ab23edcb5584d0..d48ff63ac3a40271a56f19b498876fe4556fa3bc 100644 (file)
@@ -44,6 +44,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/extract.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/debversion.h>
index 060aa53d76007587cbe814d6fc8b9d88f2141fba..879c07855b7b2e36754fb3584dba2adcee6696d1 100644 (file)
@@ -32,6 +32,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/filelist.h>
 #include <apt-pkg/mmap.h>
 #include <apt-pkg/error.h>
index 223303ea87874db9e92ac0e0ddcb800983e48fa0..9433e5c4ab278eeff3dd0495b56e713c1b89bc3c 100644 (file)
@@ -13,6 +13,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
@@ -24,8 +26,6 @@
 #include <apt-pkg/sha1.h>
 #include <apt-pkg/tagfile.h>
 
-#include <apti18n.h>
-    
 #include <sys/stat.h>
 #include <unistd.h>
 #include <errno.h>
@@ -33,6 +33,8 @@
 #include <sstream>
 #include <stdio.h>
 #include <ctime>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;
index 25c6c674d8cb5cfcaf3ed98e0264e39ab8bd58d8..1ae139b4099605cb4cb872770427fff1802e64a6 100644 (file)
@@ -15,6 +15,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
index 3e1fd98dbf893be00839a64641b5d7f33717c788..3bb977e1403f42a3920463f771f0a956024e9200 100644 (file)
@@ -12,6 +12,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/acquire-worker.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/strutl.h>
 
-#include <apti18n.h>
-
 #include <iostream>
 #include <sstream>
 #include <fstream>
-    
+
 #include <sys/stat.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <signal.h>
 #include <stdio.h>
 #include <errno.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;
@@ -256,9 +258,9 @@ bool pkgAcquire::Worker::RunMessages()
            
            CurrentItem = Itm;
            CurrentSize = 0;
-           TotalSize = atoi(LookupTag(Message,"Size","0").c_str());
-           ResumePoint = atoi(LookupTag(Message,"Resume-Point","0").c_str());
-           Itm->Owner->Start(Message,atoi(LookupTag(Message,"Size","0").c_str()));
+           TotalSize = strtoull(LookupTag(Message,"Size","0").c_str(), NULL, 10);
+           ResumePoint = strtoull(LookupTag(Message,"Resume-Point","0").c_str(), NULL, 10);
+           Itm->Owner->Start(Message,strtoull(LookupTag(Message,"Size","0").c_str(), NULL, 10));
 
            // Display update before completion
            if (Log != 0 && Log->MorePulses == true)
@@ -287,7 +289,7 @@ bool pkgAcquire::Worker::RunMessages()
               Log->Pulse(Owner->GetOwner());
            
            OwnerQ->ItemDone(Itm);
-           unsigned long long const ServerSize = atoll(LookupTag(Message,"Size","0").c_str());
+           unsigned long long const ServerSize = strtoull(LookupTag(Message,"Size","0").c_str(), NULL, 10);
            if (TotalSize != 0 && ServerSize != TotalSize)
               _error->Warning("Size of file %s is not what the server reported %s %llu",
                               Owner->DestFile.c_str(), LookupTag(Message,"Size","0").c_str(),TotalSize);
index 8c00748b2eb3a05a104a5027cec48911b6d2b7ba..3a547fb3a843e54056d1e10336bbe2bd79efea62 100644 (file)
@@ -13,6 +13,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/acquire.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/acquire-worker.h>
@@ -21,8 +23,6 @@
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
 
-#include <apti18n.h>
-
 #include <iostream>
 #include <sstream>
 #include <stdio.h>
@@ -30,6 +30,8 @@
 #include <dirent.h>
 #include <sys/time.h>
 #include <errno.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;
index 08d1f8cb7af1cbb89c8079b3d94406ca61f2075b..40368c91f1dc2e49b08571b9a3458f91dbfbb3fe 100644 (file)
@@ -14,6 +14,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/edsp.h>
 
-#include <apti18n.h>
 #include <sys/types.h>
 #include <cstdlib>
 #include <algorithm>
 #include <iostream>
-
 #include <stdio.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 using namespace std;
 
index 6ec5fa03a5d4f42113daf75864c3c8a6c1efa961..e1bc94f31302230051edd4986274a9c8d4da78e6 100644 (file)
@@ -8,6 +8,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
index 964c5bd8bc9ad486472ea3854947bac4fc809874..b60b1cc0f8e1e90dd80becd541eae3ccf37daeb3 100644 (file)
@@ -12,6 +12,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/cachefile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/sourcelist.h>
@@ -21,7 +23,7 @@
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/fileutl.h>
-    
+
 #include <apti18n.h>
                                                                        /*}}}*/
 // CacheFile::CacheFile - Constructor                                  /*{{{*/
index 8f0725ea3fd98271b413b3c251cfc885c117c2f9..210a9a9ab8f2eac5047500daabe5c31aedc55bf8 100644 (file)
@@ -4,6 +4,8 @@
     Collection of functor classes */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/cachefilter.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/pkgcache.h>
index a1de613e2636c6e65b5fa94f4634c47edbd6e194..386ecfb5fad83f4f7106348c6c79a7ba2e3dfec0 100644 (file)
@@ -9,6 +9,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/cachefilter.h>
 #include <apt-pkg/cacheset.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/versionmatch.h>
 
-#include <apti18n.h>
-
 #include <vector>
 
 #include <regex.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 namespace APT {
 // FromTask - Return all packages in the cache from a specific task    /*{{{*/
index df1ffedf23e11f6ea5f5cff361b8f68035bca312..392cd890e648d0d520741277f886ffc05ff0419a 100644 (file)
@@ -1,5 +1,6 @@
 /*
  */
+#include<config.h>
 
 #include<apt-pkg/init.h>
 #include<apt-pkg/error.h>
@@ -10,8 +11,6 @@
 
 #include<sstream>
 #include<fstream>
-#include<config.h>
-#include<apti18n.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <dirent.h>
@@ -22,6 +21,8 @@
 
 #include "indexcopy.h"
 
+#include<apti18n.h>
+
 using namespace std;
 
 // FindPackages - Find the package files on the CDROM                  /*{{{*/
index 9850b93b4bd460b5af5bc21a89b36c4ce3f20b7b..1f96e941b22ef4e333ad240ba5f4f8bbc961892b 100644 (file)
@@ -8,17 +8,19 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Includes                                                            /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/clean.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
 
-#include <apti18n.h>    
-
 #include <dirent.h>
 #include <sys/stat.h>
 #include <unistd.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 // ArchiveCleaner::Go - Perform smart cleanup of the archive           /*{{{*/
 // ---------------------------------------------------------------------
index e25caf1a53aface16d4075fef1588e4ff60f7046..9de795b60d92e25a212fa2e0bf5ac5bfac6b4d6e 100644 (file)
@@ -10,6 +10,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/cdromutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/md5.h>
@@ -17,8 +19,6 @@
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/strutl.h>
 
-#include <apti18n.h>
-    
 #include <sys/wait.h>
 #include <sys/statvfs.h>
 #include <dirent.h>
@@ -26,6 +26,8 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <stdio.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 // IsMounted - Returns true if the mount point is mounted              /*{{{*/
index 5a994409663e299b6e4ca6991f1a13ba28950709..34e90da207c0578cf02d4368f4de066f0b4fa33e 100644 (file)
    ##################################################################### */
                                                                        /*}}}*/
 // Include files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 
-#include <apti18n.h>    
+#include <apti18n.h>
                                                                        /*}}}*/
 using namespace std;
 
index ece05e8f630db3d8c9894fa754f542cd1253b9c9..0f7b37ee9964d0592b09806da07fdf50a44fc5d3 100644 (file)
    ##################################################################### */
                                                                        /*}}}*/
 // Include files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
-#include <apti18n.h>
 
 #include <vector>
 #include <fstream>
 #include <iostream>
 
+#include <apti18n.h>
+
 using namespace std;
                                                                        /*}}}*/
 
index b300ed67e48275ff9dffc81ad6de90d1b2f89956..4058821f9f9ea11be10d0ebf1cccf35a0703f17a 100644 (file)
@@ -15,6 +15,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/crc-16.h>
                                                                        /*}}}*/
 
@@ -63,7 +65,7 @@ static unsigned short const crc16_table[256] =
 /* Recompute the FCS with one more character appended. */
 #define CalcFCS(fcs, c) (((fcs) >> 8) ^ crc16_table[((fcs) ^ (c)) & 0xff])
 unsigned short AddCRC16(unsigned short fcs, void const *Buf,
-                       unsigned long len) 
+                       unsigned long long len)
 {
    unsigned char const *buf = (unsigned char const *)Buf;
    while (len--)
index f30678bac6c6d6efd2f93c30c2861744e28a5ae2..702de40b21135a0596b6802465d6660704f15a30 100644 (file)
@@ -12,6 +12,6 @@
 
 #define INIT_FCS  0xffff
 unsigned short AddCRC16(unsigned short fcs, void const *buf,
-                       unsigned long len);
+                       unsigned long long len);
 
 #endif
index edb290f3468fe9e52035780451b1513be2b4071c..122e2c8098eb6b063b87bdbcc0ef576b3bbc2c8c 100644 (file)
@@ -13,6 +13,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/error.h>
 
 #include <iostream>
@@ -24,8 +26,7 @@
 #include <string>
 #include <cstring>
 
-#include "config.h"
-                                                                       /*}}}*/
+                                                                       /*}}}*/
 
 // Global Error Object                                                 /*{{{*/
 /* If the implementation supports posix threads then the accessor function
index 85dc6f6006a7ed963dd017459b8c19e65bf442ac..95058cbdee77b036c42aaabfb6cbe0222259fd7a 100644 (file)
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/configuration.h>
 
-#include <apti18n.h>
-
 #include <cstdlib>
 #include <cstring>
 #include <cstdio>
 #include <set>
 #include <algorithm>
 
-#include <config.h>
 #ifdef WORDS_BIGENDIAN
 #include <inttypes.h>
 #endif
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;
@@ -132,10 +133,10 @@ bool CopyFile(FileFd &From,FileFd &To)
    
    // Buffered copy between fds
    SPtrArray<unsigned char> Buf = new unsigned char[64000];
-   unsigned long Size = From.Size();
+   unsigned long long Size = From.Size();
    while (Size != 0)
    {
-      unsigned long ToRead = Size;
+      unsigned long long ToRead = Size;
       if (Size > 64000)
         ToRead = 64000;
       
@@ -810,7 +811,7 @@ FileFd::~FileFd()
 // ---------------------------------------------------------------------
 /* We are carefull to handle interruption by a signal while reading 
    gracefully. */
-bool FileFd::Read(void *To,unsigned long Size,unsigned long *Actual)
+bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
 {
    int Res;
    errno = 0;
@@ -849,13 +850,13 @@ bool FileFd::Read(void *To,unsigned long Size,unsigned long *Actual)
    }
    
    Flags |= Fail;
-   return _error->Error(_("read, still have %lu to read but none left"),Size);
+   return _error->Error(_("read, still have %llu to read but none left"), Size);
 }
                                                                        /*}}}*/
 // FileFd::Write - Write to the file                                   /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool FileFd::Write(const void *From,unsigned long Size)
+bool FileFd::Write(const void *From,unsigned long long Size)
 {
    int Res;
    errno = 0;
@@ -882,13 +883,13 @@ bool FileFd::Write(const void *From,unsigned long Size)
       return true;
    
    Flags |= Fail;
-   return _error->Error(_("write, still have %lu to write but couldn't"),Size);
+   return _error->Error(_("write, still have %llu to write but couldn't"), Size);
 }
                                                                        /*}}}*/
 // FileFd::Seek - Seek in the file                                     /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool FileFd::Seek(unsigned long To)
+bool FileFd::Seek(unsigned long long To)
 {
    int res;
    if (gz)
@@ -898,7 +899,7 @@ bool FileFd::Seek(unsigned long To)
    if (res != (signed)To)
    {
       Flags |= Fail;
-      return _error->Error("Unable to seek to %lu",To);
+      return _error->Error("Unable to seek to %llu", To);
    }
    
    return true;
@@ -907,7 +908,7 @@ bool FileFd::Seek(unsigned long To)
 // FileFd::Skip - Seek in the file                                     /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool FileFd::Skip(unsigned long Over)
+bool FileFd::Skip(unsigned long long Over)
 {
    int res;
    if (gz)
@@ -917,7 +918,7 @@ bool FileFd::Skip(unsigned long Over)
    if (res < 0)
    {
       Flags |= Fail;
-      return _error->Error("Unable to seek ahead %lu",Over);
+      return _error->Error("Unable to seek ahead %llu",Over);
    }
    
    return true;
@@ -926,7 +927,7 @@ bool FileFd::Skip(unsigned long Over)
 // FileFd::Truncate - Truncate the file                                /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool FileFd::Truncate(unsigned long To)
+bool FileFd::Truncate(unsigned long long To)
 {
    if (gz)
    {
@@ -936,7 +937,7 @@ bool FileFd::Truncate(unsigned long To)
    if (ftruncate(iFd,To) != 0)
    {
       Flags |= Fail;
-      return _error->Error("Unable to truncate to %lu",To);
+      return _error->Error("Unable to truncate to %llu",To);
    }
    
    return true;
@@ -945,7 +946,7 @@ bool FileFd::Truncate(unsigned long To)
 // FileFd::Tell - Current seek position                                        /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-unsigned long FileFd::Tell()
+unsigned long long FileFd::Tell()
 {
    off_t Res;
    if (gz)
@@ -960,7 +961,7 @@ unsigned long FileFd::Tell()
 // FileFd::FileSize - Return the size of the file                      /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-unsigned long FileFd::FileSize()
+unsigned long long FileFd::FileSize()
 {
    struct stat Buf;
 
@@ -972,9 +973,9 @@ unsigned long FileFd::FileSize()
 // FileFd::Size - Return the size of the content in the file           /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-unsigned long FileFd::Size()
+unsigned long long FileFd::Size()
 {
-   unsigned long size = FileSize();
+   unsigned long long size = FileSize();
 
    // only check gzsize if we are actually a gzip file, just checking for
    // "gz" is not sufficient as uncompressed files will be opened with
@@ -984,6 +985,7 @@ unsigned long FileFd::Size()
        /* unfortunately zlib.h doesn't provide a gzsize(), so we have to do
        * this ourselves; the original (uncompressed) file size is the last 32
        * bits of the file */
+       // FIXME: Size for gz-files is limited by 32bit… no largefile support
        off_t orig_pos = lseek(iFd, 0, SEEK_CUR);
        if (lseek(iFd, -4, SEEK_END) < 0)
           return _error->Errno("lseek","Unable to seek to end of gzipped file");
index a1b177f385364e1b7c3dc0fa5923913c84a9a5f6..973a38cff6841cf22834c4a7243df74bb8565086 100644 (file)
@@ -49,21 +49,36 @@ class FileFd
    enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOnlyGzip,
                   WriteAtomic};
    
-   inline bool Read(void *To,unsigned long Size,bool AllowEof)
+   inline bool Read(void *To,unsigned long long Size,bool AllowEof)
    {
-      unsigned long Jnk;
+      unsigned long long Jnk;
       if (AllowEof)
         return Read(To,Size,&Jnk);
       return Read(To,Size);
    }   
-   bool Read(void *To,unsigned long Size,unsigned long *Actual = 0);
-   bool Write(const void *From,unsigned long Size);
-   bool Seek(unsigned long To);
-   bool Skip(unsigned long To);
-   bool Truncate(unsigned long To);
-   unsigned long Tell();
-   unsigned long Size();
-   unsigned long FileSize();
+   bool Read(void *To,unsigned long long Size,unsigned long long *Actual = 0);
+   bool Write(const void *From,unsigned long long Size);
+   bool Seek(unsigned long long To);
+   bool Skip(unsigned long long To);
+   bool Truncate(unsigned long long To);
+   unsigned long long Tell();
+   unsigned long long Size();
+   unsigned long long FileSize();
+
+   /* You want to use 'unsigned long long' if you are talking about a file
+      to be able to support large files (>2 or >4 GB) properly.
+      This shouldn't happen all to often for the indexes, but deb's might be…
+      And as the auto-conversation converts a 'unsigned long *' to a 'bool'
+      instead of 'unsigned long long *' we need to provide this explicitely -
+      otherwise applications magically start to fail… */
+   __deprecated bool Read(void *To,unsigned long long Size,unsigned long *Actual)
+   {
+       unsigned long long R;
+       bool const T = Read(To, Size, &R);
+       *Actual = R;
+       return T;
+   }
+
    bool Open(string FileName,OpenMode Mode,unsigned long Perms = 0666);
    bool OpenDescriptor(int Fd, OpenMode Mode, bool AutoClose=false);
    bool Close();
index 4407574fa0efd99b801f22f6d9941ce4c0f77b5d..fd76bf22998c44e764b78306d1fa17d8140da42e 100644 (file)
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/hashes.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/macros.h>
 
-#include <unistd.h>    
+#include <unistd.h>
 #include <string>
 #include <iostream>
                                                                        /*}}}*/
@@ -106,18 +108,18 @@ string HashString::toStr() const
 // Hashes::AddFD - Add the contents of the FD                          /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool Hashes::AddFD(int const Fd,unsigned long Size, bool const addMD5,
+bool Hashes::AddFD(int const Fd,unsigned long long Size, bool const addMD5,
                   bool const addSHA1, bool const addSHA256, bool const addSHA512)
 {
    unsigned char Buf[64*64];
-   int Res = 0;
+   ssize_t Res = 0;
    int ToEOF = (Size == 0);
    while (Size != 0 || ToEOF)
    {
-      unsigned n = sizeof(Buf);
-      if (!ToEOF) n = min(Size,(unsigned long)n);
+      unsigned long long n = sizeof(Buf);
+      if (!ToEOF) n = min(Size, n);
       Res = read(Fd,Buf,n);
-      if (Res < 0 || (!ToEOF && (unsigned) Res != n)) // error, or short read
+      if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read
         return false;
       if (ToEOF && Res == 0) // EOF
         break;
index e702fcca2fd9459d2fd2e66f1b95aaf94bd764ca..40c2ad064f5b286d5cd95c99a050579ef55599e5 100644 (file)
@@ -62,14 +62,14 @@ class Hashes
    SHA256Summation SHA256;
    SHA512Summation SHA512;
    
-   inline bool Add(const unsigned char *Data,unsigned long Size)
+   inline bool Add(const unsigned char *Data,unsigned long long Size)
    {
       return MD5.Add(Data,Size) && SHA1.Add(Data,Size) && SHA256.Add(Data,Size) && SHA512.Add(Data,Size);
    };
    inline bool Add(const char *Data) {return Add((unsigned char *)Data,strlen(Data));};
-   inline bool AddFD(int const Fd,unsigned long Size = 0)
+   inline bool AddFD(int const Fd,unsigned long long Size = 0)
    { return AddFD(Fd, Size, true, true, true, true); };
-   bool AddFD(int const Fd, unsigned long Size, bool const addMD5,
+   bool AddFD(int const Fd, unsigned long long Size, bool const addMD5,
              bool const addSHA1, bool const addSHA256, bool const addSHA512);
    inline bool Add(const unsigned char *Beg,const unsigned char *End) 
                   {return Add(Beg,End-Beg);};
index 728747d7ab00ed47b44cc36706ae88daf549d994..0edcbb3643acb50bd1d5e03289dc77520c654223 100644 (file)
@@ -1,4 +1,5 @@
 // Cryptographic API Base
+#include <config.h>
 
 #include <unistd.h>
 #include "hashsum_template.h"
@@ -6,16 +7,16 @@
 // Summation::AddFD - Add content of file into the checksum            /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool SummationImplementation::AddFD(int const Fd, unsigned long Size) {
+bool SummationImplementation::AddFD(int const Fd, unsigned long long Size) {
    unsigned char Buf[64 * 64];
-   int Res = 0;
+   ssize_t Res = 0;
    int ToEOF = (Size == 0);
    while (Size != 0 || ToEOF)
    {
-      unsigned n = sizeof(Buf);
-      if (!ToEOF) n = min(Size,(unsigned long)n);
+      unsigned long long n = sizeof(Buf);
+      if (!ToEOF) n = min(Size, n);
       Res = read(Fd, Buf, n);
-      if (Res < 0 || (!ToEOF && (unsigned) Res != n)) // error, or short read
+      if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read
         return false;
       if (ToEOF && Res == 0) // EOF
         break;
index 85d94c2afafdd6df9990df20b7a9d53a4eb936e1..9157754e36fe26916b4a73f2ea4d09fadde10b16 100644 (file)
@@ -87,8 +87,8 @@ class HashSumValue
 class SummationImplementation
 {
    public:
-   virtual bool Add(const unsigned char *inbuf, unsigned long inlen) = 0;
-   inline bool Add(const char *inbuf, unsigned long const inlen)
+   virtual bool Add(const unsigned char *inbuf, unsigned long long inlen) = 0;
+   inline bool Add(const char *inbuf, unsigned long long const inlen)
    { return Add((unsigned char *)inbuf, inlen); };
 
    inline bool Add(const unsigned char *Data)
@@ -101,7 +101,7 @@ class SummationImplementation
    inline bool Add(const char *Beg, const char *End)
    { return Add((const unsigned char *)Beg, End - Beg); };
 
-   bool AddFD(int Fd, unsigned long Size = 0);
+   bool AddFD(int Fd, unsigned long long Size = 0);
 };
 
 #endif
index 65e20e9bb76241a13344ebce6b096ac0a8a22c71..4351aeb22f23d6b0d17e7b54cf5c4e066798ad6e 100644 (file)
@@ -35,6 +35,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/md5.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/macros.h>
@@ -43,7 +45,6 @@
 #include <unistd.h>
 #include <netinet/in.h>                          // For htonl
 #include <inttypes.h>
-#include <config.h>
                                                                        /*}}}*/
 
 // byteSwap - Swap bytes in a buffer                                   /*{{{*/
@@ -186,7 +187,7 @@ MD5Summation::MD5Summation()
 // MD5Summation::Add - 'Add' a data set to the hash                    /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool MD5Summation::Add(const unsigned char *data,unsigned long len)
+bool MD5Summation::Add(const unsigned char *data,unsigned long long len)
 {
    if (Done == true)
       return false;
index e76428325fab5f90d1c5caba08886a6cde9637bd..305cdb20df2018c293b2e705738c58f52e77a7e3 100644 (file)
@@ -45,7 +45,7 @@ class MD5Summation : public SummationImplementation
 
    public:
 
-   bool Add(const unsigned char *inbuf, unsigned long inlen);
+   bool Add(const unsigned char *inbuf, unsigned long long inlen);
    using SummationImplementation::Add;
 
    MD5SumValue Result();
index 19381ae4719ea7005ac338463bdbe7e4a5e3cd95..a110a70195cd39783705f2f6096dbd69645f609f 100644 (file)
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
 #define _BSD_SOURCE
+#include <config.h>
+
 #include <apt-pkg/mmap.h>
 #include <apt-pkg/error.h>
 
-#include <apti18n.h>
-
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <stdlib.h>
 #include <errno.h>
-
 #include <cstring>
-                                                                       /*}}}*/
+
+#include <apti18n.h>
+                                                                       /*}}}*/
 
 // MMap::MMap - Constructor                                            /*{{{*/
 // ---------------------------------------------------------------------
@@ -94,7 +95,7 @@ bool MMap::Map(FileFd &Fd)
            return false;
       }
       else
-        return _error->Errno("mmap",_("Couldn't make mmap of %lu bytes"),
+        return _error->Errno("mmap",_("Couldn't make mmap of %llu bytes"),
                              iSize);
      }
 
@@ -165,7 +166,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
       return true;
    
 #ifdef _POSIX_SYNCHRONIZED_IO
-   unsigned long PSize = sysconf(_SC_PAGESIZE);
+   unsigned long long PSize = sysconf(_SC_PAGESIZE);
    if ((Flags & ReadOnly) != ReadOnly)
    {
       if (SyncToFd != 0)
@@ -176,7 +177,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
       }
       else
       {
-        if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0)
+        if (msync((char *)Base+(unsigned long long)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0)
            return _error->Errno("msync", _("Unable to synchronize mmap"));
       }
    }
@@ -196,7 +197,7 @@ DynamicMMap::DynamicMMap(FileFd &F,unsigned long Flags,unsigned long const &Work
    if (_error->PendingError() == true)
       return;
    
-   unsigned long EndOfFile = Fd->Size();
+   unsigned long long EndOfFile = Fd->Size();
    if (EndOfFile > WorkSpace)
       WorkSpace = EndOfFile;
    else if(WorkSpace > 0)
@@ -284,7 +285,7 @@ DynamicMMap::~DynamicMMap()
       return;
    }
    
-   unsigned long EndOfFile = iSize;
+   unsigned long long EndOfFile = iSize;
    iSize = WorkSpace;
    Close(false);
    if(ftruncate(Fd->Fd(),EndOfFile) < 0)
@@ -294,9 +295,9 @@ DynamicMMap::~DynamicMMap()
 // DynamicMMap::RawAllocate - Allocate a raw chunk of unaligned space  /*{{{*/
 // ---------------------------------------------------------------------
 /* This allocates a block of memory aligned to the given size */
-unsigned long DynamicMMap::RawAllocate(unsigned long Size,unsigned long Aln)
+unsigned long DynamicMMap::RawAllocate(unsigned long long Size,unsigned long Aln)
 {
-   unsigned long Result = iSize;
+   unsigned long long Result = iSize;
    if (Aln != 0)
       Result += Aln - (iSize%Aln);
 
@@ -411,7 +412,7 @@ bool DynamicMMap::Grow() {
        if (GrowFactor <= 0)
                return _error->Error(_("Unable to increase size of the MMap as automatic growing is disabled by user."));
 
-       unsigned long const newSize = WorkSpace + GrowFactor;
+       unsigned long long const newSize = WorkSpace + GrowFactor;
 
        if(Fd != 0) {
                Fd->Seek(newSize - 1);
index 2bf2c15408319b3693a1e6b4dcf87e82e6ddb073..e0ff8db95049f494299a5a835c1caba9cd9463cc 100644 (file)
@@ -41,7 +41,7 @@ class MMap
    protected:
    
    unsigned long Flags;
-   unsigned long iSize;
+   unsigned long long iSize;
    void *Base;
 
    // In case mmap can not be used, we keep a dup of the file
@@ -60,8 +60,8 @@ class MMap
    // Simple accessors
    inline operator void *() {return Base;};
    inline void *Data() {return Base;}; 
-   inline unsigned long Size() {return iSize;};
-   inline void AddSize(unsigned long const size) {iSize += size;};
+   inline unsigned long long Size() {return iSize;};
+   inline void AddSize(unsigned long long const size) {iSize += size;};
    inline bool validData() const { return Base != (void *)-1 && Base != 0; };
    
    // File manipulators
@@ -99,7 +99,7 @@ class DynamicMMap : public MMap
    public:
 
    // Allocation
-   unsigned long RawAllocate(unsigned long Size,unsigned long Aln = 0);
+   unsigned long RawAllocate(unsigned long long Size,unsigned long Aln = 0);
    unsigned long Allocate(unsigned long ItemSize);
    unsigned long WriteString(const char *String,unsigned long Len = (unsigned long)-1);
    inline unsigned long WriteString(const string &S) {return WriteString(S.c_str(),S.length());};
index 9ff5796c53dde219d961e5884a1f3eb57bc2ac51..b9d0749e2b8dc9c5baddb080f1f660d6eda9bec0 100644 (file)
@@ -11,6 +11,7 @@
 
    ##################################################################### */
                                                                        /*}}}*/
+#include <config.h>
 
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/fileutl.h>
index 84ee4c124cf3c1c0c9c733f5a58e1aeca4e5f499..317048845c1a89fb9a1ee0d8941ad413d0b05518 100644 (file)
@@ -8,15 +8,17 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/progress.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 
-#include <apti18n.h>
-
 #include <iostream>
 #include <stdio.h>
 #include <cstring>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;
@@ -35,7 +37,7 @@ OpProgress::OpProgress() : Current(0), Total(0), Size(0), SubTotal(1),
 /* Current is the Base Overall progress in units of Total. Cur is the sub
    progress in units of SubTotal. Size is a scaling factor that says what
    percent of Total SubTotal is. */
-void OpProgress::Progress(unsigned long Cur)
+void OpProgress::Progress(unsigned long long Cur)
 {
    if (Total == 0 || Size == 0 || SubTotal == 0)
       Percent = 0;
@@ -47,8 +49,8 @@ void OpProgress::Progress(unsigned long Cur)
 // OpProgress::OverallProgress - Set the overall progress              /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-void OpProgress::OverallProgress(unsigned long Current, unsigned long Total,
-                                unsigned long Size,const string &Op)
+void OpProgress::OverallProgress(unsigned long long Current, unsigned long long Total,
+                                unsigned long long Size,const string &Op)
 {
    this->Current = Current;
    this->Total = Total;
@@ -65,7 +67,7 @@ void OpProgress::OverallProgress(unsigned long Current, unsigned long Total,
 // OpProgress::SubProgress - Set the sub progress state                        /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-void OpProgress::SubProgress(unsigned long SubTotal,const string &Op,
+void OpProgress::SubProgress(unsigned long long SubTotal,const string &Op,
                             float const Percent)
 {
    this->SubTotal = SubTotal;
index 3a914d17f6aca935059a30a56834875b85d745ea..5344323f6379e3953d3eebf682c03c34bad960fe 100644 (file)
@@ -30,10 +30,10 @@ using std::string;
 class Configuration;
 class OpProgress
 {
-   unsigned long Current;
-   unsigned long Total;
-   unsigned long Size;
-   unsigned long SubTotal;
+   unsigned long long Current;
+   unsigned long long Total;
+   unsigned long long Size;
+   unsigned long long SubTotal;
    float LastPercent;
    
    // Change reduction code
@@ -54,10 +54,10 @@ class OpProgress
    
    public:
    
-   void Progress(unsigned long Current);
-   void SubProgress(unsigned long SubTotal, const string &Op = "", float const Percent = -1);
-   void OverallProgress(unsigned long Current,unsigned long Total,
-                       unsigned long Size,const string &Op);
+   void Progress(unsigned long long Current);
+   void SubProgress(unsigned long long SubTotal, const string &Op = "", float const Percent = -1);
+   void OverallProgress(unsigned long long Current,unsigned long long Total,
+                       unsigned long long Size,const string &Op);
    virtual void Done() {};
    
    OpProgress();
index 5b9db202d0b2d161f36d00350e1424a6fc6db0ac..b5a6a244064f21dbc2200cb8b1b51b39df929914 100644 (file)
@@ -29,6 +29,8 @@
  */
                                                                        /*}}} */
 // Include Files                                                        /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/sha1.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/macros.h>
@@ -36,7 +38,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <inttypes.h>
-#include <config.h>
                                                                        /*}}}*/
 
 // SHA1Transform - Alters an existing SHA-1 hash                       /*{{{*/
@@ -241,7 +242,7 @@ SHA1SumValue SHA1Summation::Result()
 // SHA1Summation::Add - Adds content of buffer into the checksum        /*{{{*/
 // ---------------------------------------------------------------------
 /* May not be called after Result() is called */
-bool SHA1Summation::Add(const unsigned char *data,unsigned long len)
+bool SHA1Summation::Add(const unsigned char *data,unsigned long long len)
 {
    if (Done)
       return false;
index 2701fc67e3084fb5e5c637d27e64ca512b576cb2..916faec1bca5cd9e5d3b9adf968ae0a62e44becf 100644 (file)
@@ -34,7 +34,7 @@ class SHA1Summation : public SummationImplementation
    bool Done;
    
    public:
-   bool Add(const unsigned char *inbuf, unsigned long inlen);
+   bool Add(const unsigned char *inbuf, unsigned long long inlen);
    using SummationImplementation::Add;
 
    SHA1SumValue Result();
index 386225889b69d3e15b4fbe7c89e68a4f780acc7c..51c921dbd7af7344560a9a52b3573d2d845ccb1a 100644 (file)
@@ -30,7 +30,7 @@ class SHA2SummationBase : public SummationImplementation
  protected:
    bool Done;
  public:
-   bool Add(const unsigned char *inbuf, unsigned long len) = 0;
+   bool Add(const unsigned char *inbuf, unsigned long long len) = 0;
 
    void Result();
 };
@@ -41,7 +41,7 @@ class SHA256Summation : public SHA2SummationBase
    unsigned char Sum[32];
 
    public:
-   bool Add(const unsigned char *inbuf, unsigned long len)
+   bool Add(const unsigned char *inbuf, unsigned long long len)
    {
       if (Done) 
          return false;
@@ -73,7 +73,7 @@ class SHA512Summation : public SHA2SummationBase
    unsigned char Sum[64];
 
    public:
-   bool Add(const unsigned char *inbuf, unsigned long len)
+   bool Add(const unsigned char *inbuf, unsigned long long len)
    {
       if (Done) 
          return false;
index 565db2f91d2faefbb4693c0186b7e8d39c200650..ff995cdf289f89ede8ce790ec349d7f0537e24f6 100644 (file)
@@ -31,6 +31,7 @@
  *
  * $Id: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $
  */
+#include <config.h>
 
 #include <string.h>    /* memcpy()/memset() or bcopy()/bzero() */
 #include <assert.h>    /* assert() */
index 867bb313bae5e1d732185a04a77614dd83911598..aaf44b7ff95fff6601300c06f6a1c0a4bc4b9ac5 100644 (file)
    ##################################################################### */
                                                                        /*}}}*/
 // Includes                                                            /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
 
-#include <apti18n.h>
-    
 #include <ctype.h>
 #include <string.h>
 #include <stdio.h>
@@ -31,7 +31,7 @@
 #include <stdarg.h>
 #include <iconv.h>
 
-#include "config.h"
+#include <apti18n.h>
 
 using namespace std;
                                                                        /*}}}*/
@@ -970,6 +970,34 @@ bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base)
    return true;
 }
                                                                        /*}}}*/
+// StrToNum - Convert a fixed length string to a number                        /*{{{*/
+// ---------------------------------------------------------------------
+/* This is used in decoding the crazy fixed length string headers in 
+   tar and ar files. */
+bool StrToNum(const char *Str,unsigned long long &Res,unsigned Len,unsigned Base)
+{
+   char S[30];
+   if (Len >= sizeof(S))
+      return false;
+   memcpy(S,Str,Len);
+   S[Len] = 0;
+   
+   // All spaces is a zero
+   Res = 0;
+   unsigned I;
+   for (I = 0; S[I] == ' '; I++);
+   if (S[I] == 0)
+      return true;
+   
+   char *End;
+   Res = strtoull(S,&End,Base);
+   if (End == S)
+      return false;
+   
+   return true;
+}
+                                                                       /*}}}*/
+
 // Base256ToNum - Convert a fixed length binary to a number             /*{{{*/
 // ---------------------------------------------------------------------
 /* This is used in decoding the 256bit encoded fixed length fields in
index fba85cf94382d888d0aa11cbe46daf0d93774fe1..ab4b547225676252de0c1f2e47a52658a7afe0df 100644 (file)
@@ -56,6 +56,7 @@ string LookupTag(const string &Message,const char *Tag,const char *Default = 0);
 int StringToBool(const string &Text,int Default = -1);
 bool ReadMessages(int Fd, vector<string> &List);
 bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0);
+bool StrToNum(const char *Str,unsigned long long &Res,unsigned Len,unsigned Base = 0);
 bool Base256ToNum(const char *Str,unsigned long &Res,unsigned int Len);
 bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length);
 bool TokSplitString(char Tok,char *Input,char **List,
index e3d4063dc3e50ad2451849188feec1ff4cd0787d..27c1f7f3222b9b3b255841e7ba2d7b925b3ac4a7 100644 (file)
@@ -9,6 +9,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/debindexfile.h>
 #include <apt-pkg/debsrcrecords.h>
 #include <apt-pkg/deblistparser.h>
index 952433428ef5c0ce0d83785e5edf949ec21767e6..a4a974897f94d64611be4a71b87affbfd4eabbf8 100644 (file)
@@ -10,6 +10,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/deblistparser.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
index e1f8219e361b314c066084d18e80ec87558cfa8f..1d3754b0054b5add45b76a782df0fef77ee72ee3 100644 (file)
@@ -1,4 +1,5 @@
 // ijones, walters
+#include <config.h>
 
 #include <apt-pkg/debmetaindex.h>
 #include <apt-pkg/debindexfile.h>
index 2571aae529e7db1678a77ddbed837c5ed24559ff..4dfc8b56a8a5103fd6a30a8314b7ce3e5b519647 100644 (file)
@@ -8,6 +8,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/debrecords.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
index 749305005f46730ccdfbb110312a4890e585ce69..c9c20267b8ed7ee9998e0022a84446003909dab0 100644 (file)
@@ -9,6 +9,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/deblistparser.h>
 #include <apt-pkg/debsrcrecords.h>
 #include <apt-pkg/error.h>
index 7644bc66bed295f5e063fc180427dd4203664e73..080af5659d778ed61ce932df3eb0680c59e0fb55 100644 (file)
@@ -10,6 +10,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/debsystem.h>
 #include <apt-pkg/debversion.h>
 #include <apt-pkg/debindexfile.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/fileutl.h>
-#include <apti18n.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <errno.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 debSystem debSys;
index 755ffbe96036b40370c09f3ce35a043a987fdeef..ba32b2dd4d0757d482889d0f6f8f675b929bb9bb 100644 (file)
@@ -11,6 +11,7 @@
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
 #define APT_COMPATIBILITY 986
+#include <config.h>
 
 #include <apt-pkg/debversion.h>
 #include <apt-pkg/pkgcache.h>
index 3c4c244ccff39ce62374f32efa69cb10eb4d8a8b..2c34465c092fee4a1241b62649d3443a6760bd00 100644 (file)
@@ -8,6 +8,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Includes                                                            /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/dpkgpm.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
@@ -40,7 +42,6 @@
 #include <sys/ioctl.h>
 #include <pty.h>
 
-#include <config.h>
 #include <apti18n.h>
                                                                        /*}}}*/
 
index e9527647e044686223b623b834a5f37abf7f6211..f816630aef900a0a4b4813175e733d2b2e9e4e92 100644 (file)
@@ -8,6 +8,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/depcache.h>
 #include <apt-pkg/version.h>
 #include <apt-pkg/versionmatch.h>
 #include <apt-pkg/tagfile.h>
 
 #include <iostream>
-#include <sstream>    
+#include <sstream>
 #include <set>
 
 #include <sys/stat.h>
 
-#include <apti18n.h>    
+#include <apti18n.h>
                                                                        /*}}}*/
 // helper for Install-Recommends-Sections and Never-MarkAuto-Sections  /*{{{*/
 static bool 
@@ -169,14 +171,14 @@ bool pkgDepCache::readStateFile(OpProgress *Prog)                 /*{{{*/
    string const state = _config->FindFile("Dir::State::extended_states");
    if(RealFileExists(state)) {
       state_file.Open(state, FileFd::ReadOnly);
-      int const file_size = state_file.Size();
+      off_t const file_size = state_file.Size();
       if(Prog != NULL)
         Prog->OverallProgress(0, file_size, 1, 
                               _("Reading state information"));
 
       pkgTagFile tagfile(&state_file);
       pkgTagSection section;
-      int amt = 0;
+      off_t amt = 0;
       bool const debug_autoremove = _config->FindB("Debug::pkgAutoRemove",false);
       while(tagfile.Step(section)) {
         string const pkgname = section.FindS("Package");
index 4d2230613513c67383eb9a39e501dc06df5eb16a..44f7dbfd68bb9cb3f8ef53a7e7ae09407cfeb543 100644 (file)
@@ -5,6 +5,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/edsp.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/policy.h>
 #include <apt-pkg/tagfile.h>
 
-#include <apti18n.h>
 #include <limits>
-
 #include <stdio.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 // we could use pkgCache::DepType and ::Priority, but these would be localized strings…
index f5881e66362a9b95b0363f232642fa13bd74cd69..b417a75626df01a42b120eec4d8299c0946ede9d 100644 (file)
@@ -6,6 +6,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/edspindexfile.h>
 #include <apt-pkg/edsplistparser.h>
 #include <apt-pkg/sourcelist.h>
index 3349e8cce3c7482f5b5f674c82f02bf47a3fcdf0..e00abdbcc3852ab4977a58ff777624d6143113e9 100644 (file)
@@ -9,6 +9,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/edsplistparser.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
index ac0bb8beb877d5462b47b8567113597fcc838c21..10d75771a50a10d62af3f664cc01b176310cdccb 100644 (file)
@@ -9,17 +9,20 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/edspsystem.h>
 #include <apt-pkg/debversion.h>
 #include <apt-pkg/edspindexfile.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/fileutl.h>
-#include <apti18n.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <errno.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 edspSystem edspSys;
index 747e464bee445dc262e3e57eabdf358155c88a65..4df018ef45512c26244a16bbf175db24be81ffa6 100644 (file)
@@ -10,7 +10,7 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#include "indexcopy.h"
+#include<config.h>
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/progress.h>
@@ -21,7 +21,6 @@
 #include <apt-pkg/indexrecords.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/cdrom.h>
-#include <apti18n.h>
 
 #include <iostream>
 #include <sstream>
 #include <sys/types.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <stdlib.h>
+
+#include "indexcopy.h"
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;
@@ -53,7 +56,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
    bool Debug = _config->FindB("Debug::aptcdrom",false);
    
    // Prepare the progress indicator
-   unsigned long TotalSize = 0;
+   off_t TotalSize = 0;
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    {
       struct stat Buf;
@@ -64,14 +67,14 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
       TotalSize += Buf.st_size;
    }   
 
-   unsigned long CurrentSize = 0;
+   off_t CurrentSize = 0;
    unsigned int NotFound = 0;
    unsigned int WrongSize = 0;
    unsigned int Packages = 0;
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    {      
       string OrigPath = string(*I,CDROM.length());
-      unsigned long FileSize = 0;
+      off_t FileSize = 0;
       
       // Open the package file
       FileFd Pkg;
@@ -164,7 +167,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
         if(Progress)
            Progress->Progress(Parser.Offset());
         string File;
-        unsigned long Size;
+        unsigned long long Size;
         if (GetFile(File,Size) == false)
         {
            fclose(TargetFl);
@@ -219,7 +222,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
            }       
                                            
            // Size match
-           if ((unsigned)Buf.st_size != Size)
+           if ((unsigned long long)Buf.st_size != Size)
            {
               if (Debug == true)
                  clog << "Wrong Size: " << File << endl;
@@ -453,7 +456,7 @@ bool IndexCopy::GrabFirst(string Path,string &To,unsigned int Depth)
 // PackageCopy::GetFile - Get the file information from the section    /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool PackageCopy::GetFile(string &File,unsigned long &Size)
+bool PackageCopy::GetFile(string &File,unsigned long long &Size)
 {
    File = Section->FindS("Filename");
    Size = Section->FindI("Size");
@@ -479,7 +482,7 @@ bool PackageCopy::RewriteEntry(FILE *Target,string File)
 // SourceCopy::GetFile - Get the file information from the section     /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool SourceCopy::GetFile(string &File,unsigned long &Size)
+bool SourceCopy::GetFile(string &File,unsigned long long &Size)
 {
    string Files = Section->FindS("Files");
    if (Files.empty() == true)
@@ -502,7 +505,7 @@ bool SourceCopy::GetFile(string &File,unsigned long &Size)
       return _error->Error("Error parsing file record");
    
    // Parse the size and append the directory
-   Size = atoi(sSize.c_str());
+   Size = strtoull(sSize.c_str(), NULL, 10);
    File = Base + File;
    return true;
 }
@@ -785,7 +788,7 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,   /*{{{*/
    bool Debug = _config->FindB("Debug::aptcdrom",false);
    
    // Prepare the progress indicator
-   unsigned long TotalSize = 0;
+   off_t TotalSize = 0;
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    {
       struct stat Buf;
@@ -796,14 +799,14 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/
       TotalSize += Buf.st_size;
    }   
 
-   unsigned long CurrentSize = 0;
+   off_t CurrentSize = 0;
    unsigned int NotFound = 0;
    unsigned int WrongSize = 0;
    unsigned int Packages = 0;
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    {      
       string OrigPath = string(*I,CDROM.length());
-      unsigned long FileSize = 0;
+      off_t FileSize = 0;
       
       // Open the package file
       FileFd Pkg;
index 277fb561c0b3410efa34da2b87b5279a29e8d3d3..60c90dd4a2d9fdc1eb1de72f0476fbd517e93ad0 100644 (file)
@@ -37,7 +37,7 @@ class IndexCopy                                                               /*{{{*/
    bool ReconstructChop(unsigned long &Chop,string Dir,string File);
    void ConvertToSourceList(string CD,string &Path);
    bool GrabFirst(string Path,string &To,unsigned int Depth);
-   virtual bool GetFile(string &Filename,unsigned long &Size) = 0;
+   virtual bool GetFile(string &Filename,unsigned long long &Size) = 0;
    virtual bool RewriteEntry(FILE *Target,string File) = 0;
    virtual const char *GetFileName() = 0;
    virtual const char *Type() = 0;
@@ -53,7 +53,7 @@ class PackageCopy : public IndexCopy                                  /*{{{*/
 {
    protected:
    
-   virtual bool GetFile(string &Filename,unsigned long &Size);
+   virtual bool GetFile(string &Filename,unsigned long long &Size);
    virtual bool RewriteEntry(FILE *Target,string File);
    virtual const char *GetFileName() {return "Packages";};
    virtual const char *Type() {return "Package";};
@@ -64,7 +64,7 @@ class SourceCopy : public IndexCopy                                   /*{{{*/
 {
    protected:
    
-   virtual bool GetFile(string &Filename,unsigned long &Size);
+   virtual bool GetFile(string &Filename,unsigned long long &Size);
    virtual bool RewriteEntry(FILE *Target,string File);
    virtual const char *GetFileName() {return "Sources";};
    virtual const char *Type() {return "Source";};
index f18ddbfaae1556ae8688b800b447eea14ff3503a..68e9df4c8bf2142edfa2f2f9819bf3ada9a81dd3 100644 (file)
@@ -8,6 +8,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/indexfile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/aptconfiguration.h>
index 10e154ad2305b33c1887bace3777d846d61604b5..9326407643169b5bc15918adaf42b2c13d6a43d2 100644 (file)
@@ -3,15 +3,17 @@
 // $Id: indexrecords.cc,v 1.1.2.4 2003/12/30 02:11:43 mdz Exp $
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/indexrecords.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
-#include <apti18n.h>
 #include <sys/stat.h>
 #include <clocale>
 
+#include <apti18n.h>
                                                                        /*}}}*/
 string indexRecords::GetDist() const
 {
@@ -78,7 +80,7 @@ bool indexRecords::Load(const string Filename)                                /*{{{*/
 
       string Name;
       string Hash;
-      size_t Size;
+      unsigned long long Size;
       while (Start < End)
       {
         if (!parseSumData(Start, End, Name, Hash, Size))
@@ -145,7 +147,7 @@ vector<string> indexRecords::MetaKeys()                                     /*{{{*/
 }
                                                                        /*}}}*/
 bool indexRecords::parseSumData(const char *&Start, const char *End,   /*{{{*/
-                                  string &Name, string &Hash, size_t &Size)
+                                  string &Name, string &Hash, unsigned long long &Size)
 {
    Name = "";
    Hash = "";
@@ -182,7 +184,7 @@ bool indexRecords::parseSumData(const char *&Start, const char *End,        /*{{{*/
    if (EntryEnd == End)
       return false;
    
-   Size = strtol (Start, NULL, 10);
+   Size = strtoull (Start, NULL, 10);
       
    /* Skip over intermediate blanks */
    Start = EntryEnd;
index 5b532c1a528790e57727138490f9b46fa423e16d..0f933b93caa75d0f8ce7fcff19d58566428db56d 100644 (file)
@@ -17,7 +17,7 @@
 class indexRecords
 {
    bool parseSumData(const char *&Start, const char *End, string &Name,
-                    string &Hash, size_t &Size);
+                    string &Hash, unsigned long long &Size);
    public:
    struct checkSum;
    string ErrorText;
@@ -53,7 +53,7 @@ struct indexRecords::checkSum
 {
    string MetaKeyFilename;
    HashString Hash;
-   size_t Size;      
+   unsigned long long Size;
 };
 
 #endif
index 8f20c31df172b28e69ae89ec4139228453fe991f..97a39e96e8831318a7c189ed6979558749249d32 100644 (file)
@@ -8,14 +8,16 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/init.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
 
-#include <apti18n.h>
-#include <config.h>
 #include <cstdlib>
 #include <sys/stat.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 #define Stringfy_(x) # x
index a58efa987469f87672e6b5e3efec82c189233743..eb19e18dbd0e8d4a332d188fed548fe608fae450 100644 (file)
@@ -63,6 +63,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/orderlist.h>
 #include <apt-pkg/depcache.h>
 #include <apt-pkg/error.h>
index a3ba26f7c28e37d58582651c7a7774d1d137c0ea..fa28dc5b2dccd4806a332ba386bc47765365e24a 100644 (file)
@@ -13,6 +13,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/packagemanager.h>
 #include <apt-pkg/orderlist.h>
 #include <apt-pkg/depcache.h>
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/sptr.h>
-    
-#include <apti18n.h>    
+
+#include <apti18n.h>
 #include <iostream>
-#include <fcntl.h> 
+#include <fcntl.h>
                                                                        /*}}}*/
 using namespace std;
 
index faccafbef1757810387dfacc813e72795faeb865..94c58f1f0bc5c42f75ae9896ab530c55d1caeb92 100644 (file)
@@ -20,6 +20,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/policy.h>
 #include <apt-pkg/version.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/macros.h>
 
-#include <apti18n.h>
-    
 #include <string>
 #include <sys/stat.h>
 #include <unistd.h>
-
 #include <ctype.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using std::string;
index f41bb5a0a571733014d6e5c6eda2192ae0e63e37..a39aa9f5969b929110976ac1eff7ec5876735dca 100644 (file)
@@ -11,6 +11,7 @@
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
 #define APT_COMPATIBILITY 986
+#include <config.h>
 
 #include <apt-pkg/pkgcachegen.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/macros.h>
-
 #include <apt-pkg/tagfile.h>
 
-#include <apti18n.h>
-
 #include <vector>
-
 #include <sys/stat.h>
 #include <unistd.h>
 #include <errno.h>
 #include <stdio.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 typedef vector<pkgIndexFile *>::iterator FileIterator;
 template <typename Iter> std::vector<Iter*> pkgCacheGenerator::Dynamic<Iter>::toReMap;
index 1a7585d8fe7f67c6de9073746a19268c681fe49f..7709f133a9148f1d672144ef35fff249bcb33286 100644 (file)
@@ -9,12 +9,14 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/indexfile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
-    
-#include <apti18n.h>   
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 // Records::pkgRecords - Constructor                                   /*{{{*/
index ce92cacc48ee836d28a40ffd65f4d5a19505df99..8741533b99dcc0ebeca9db63d5894037cfdd546b 100644 (file)
@@ -19,7 +19,6 @@
 
 
 #include <apt-pkg/pkgcache.h>
-#include <apt-pkg/fileutl.h>
 #include <vector>
 
 class pkgRecords                                                       /*{{{*/
index 6dd2d3ee4df348eab8e2e05c3f3d5beff22126be..f61c140facec1926a4f27a472b1866ac824abdee 100644 (file)
@@ -10,6 +10,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/policy.h>
 #include <cassert>
index 0cc77e0afb7d31749c731f7aa7fdf041b28252b5..e6c44ebe27e5e075553b2505020dc025383581f9 100644 (file)
@@ -23,6 +23,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/policy.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/sptr.h>
 
-#include <apti18n.h>
-
 #include <iostream>
 #include <sstream>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;
index 47800b0c2be2cb37974bef82ec4d6dc84a627598..e20ec4704fff8a7387dd9e9c1db3e50d6bf4a25f 100644 (file)
@@ -8,15 +8,17 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/sourcelist.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
 
-#include <apti18n.h>
-
 #include <fstream>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;
index 946ac1a1aa3267d5eccc5bed81858b1b4899fa2d..8c1de2ea5da1a3e7d25860713c3b803b5a5fe949 100644 (file)
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/srcrecords.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/sourcelist.h>
 #include <apt-pkg/strutl.h>
-    
-#include <apti18n.h>    
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 // SrcRecords::pkgSrcRecords - Constructor                             /*{{{*/
index a8f04b23af304654b4d011a217c1290c2e0aac8a..418e6bed81569d4e10e536d6d0bc0fd5c719587a 100644 (file)
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 
-#include <apti18n.h>
-    
 #include <string>
 #include <stdio.h>
 #include <ctype.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using std::string;
@@ -27,7 +29,7 @@ using std::string;
 class pkgTagFilePrivate
 {
 public:
-   pkgTagFilePrivate(FileFd *pFd, unsigned long Size) : Fd(*pFd), Size(Size)
+   pkgTagFilePrivate(FileFd *pFd, unsigned long long Size) : Fd(*pFd), Size(Size)
    {
    }
    FileFd &Fd;
@@ -35,14 +37,14 @@ public:
    char *Start;
    char *End;
    bool Done;
-   unsigned long iOffset;
-   unsigned long Size;
+   unsigned long long iOffset;
+   unsigned long long Size;
 };
 
 // TagFile::pkgTagFile - Constructor                                   /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long Size)
+pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long long Size)
 {
    d = new pkgTagFilePrivate(pFd, Size);
 
@@ -84,7 +86,7 @@ unsigned long pkgTagFile::Offset()
 bool pkgTagFile::Resize()
 {
    char *tmp;
-   unsigned long EndSize = d->End - d->Start;
+   unsigned long long EndSize = d->End - d->Start;
 
    // fail is the buffer grows too big
    if(d->Size > 1024*1024+1)
@@ -136,8 +138,8 @@ bool pkgTagFile::Step(pkgTagSection &Tag)
    then fills the rest from the file */
 bool pkgTagFile::Fill()
 {
-   unsigned long EndSize = d->End - d->Start;
-   unsigned long Actual = 0;
+   unsigned long long EndSize = d->End - d->Start;
+   unsigned long long Actual = 0;
    
    memmove(d->Buffer,d->Start,EndSize);
    d->Start = d->Buffer;
@@ -178,12 +180,12 @@ bool pkgTagFile::Fill()
 // ---------------------------------------------------------------------
 /* This jumps to a pre-recorded file location and reads the record
    that is there */
-bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long Offset)
+bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long long Offset)
 {
    // We are within a buffer space of the next hit..
    if (Offset >= d->iOffset && d->iOffset + (d->End - d->Start) > Offset)
    {
-      unsigned long Dist = Offset - d->iOffset;
+      unsigned long long Dist = Offset - d->iOffset;
       d->Start += Dist;
       d->iOffset += Dist;
       return Step(Tag);
index 3a2dee7c7462b1dc3c09e8a8114e6da5a79fdc37..28f7fcc243e0cd4c9f3f77e33a8c13889fc9d90f 100644 (file)
@@ -94,9 +94,9 @@ class pkgTagFile
 
    bool Step(pkgTagSection &Section);
    unsigned long Offset();
-   bool Jump(pkgTagSection &Tag,unsigned long Offset);
+   bool Jump(pkgTagSection &Tag,unsigned long long Offset);
 
-   pkgTagFile(FileFd *F,unsigned long Size = 32*1024);
+   pkgTagFile(FileFd *F,unsigned long long Size = 32*1024);
    virtual ~pkgTagFile();
 };
 
index 2350afe693f2d1ca3ac47a0f1fcfd7e3f1b4671b..eab6d448fc3ece7e793636c95984a8affbda6381 100644 (file)
@@ -1,3 +1,5 @@
+#include<config.h>
+
 #include <iostream>
 #include <apt-pkg/error.h>
 #include <apt-pkg/vendor.h>
index 4cc500727bd8cf58010d59777e9184a3459c9935..731f11acf52a43bc27c15ff43fca71953e5de517 100644 (file)
@@ -1,3 +1,5 @@
+#include<config.h>
+
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
 #include <apti18n.h>
index 42e449d36b7d063060fc7335f175f53f4814573d..a9d4fb763d12c0fc15e7645b7dfc1217fa17ad4f 100644 (file)
@@ -8,6 +8,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/version.h>
 #include <apt-pkg/pkgcache.h>
 
index 6d667acade4e7a51fb1d442337b09918f2186c81..f336b3c3525c92079514a2d2056ace0124a1af85 100644 (file)
@@ -11,8 +11,9 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#include <apt-pkg/versionmatch.h>
+#include<config.h>
 
+#include <apt-pkg/versionmatch.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 
@@ -21,7 +22,6 @@
 #include <fnmatch.h>
 #include <sys/types.h>
 #include <regex.h>
-
                                                                        /*}}}*/
 
 // VersionMatch::pkgVersionMatch - Constructor                         /*{{{*/
index b3609a7005e80959d629728319bb5e038455aa3a..256911231c1bac1c7136084265d0ac3963662a6f 100644 (file)
@@ -33,6 +33,9 @@
 /* If there is no socklen_t, define this for the netdb shim */
 #undef NEED_SOCKLEN_T_DEFINE
 
+/* Define to the size of the filesize containing structures */
+#undef _FILE_OFFSET_BITS
+
 /* Define the arch name string */
 #undef COMMON_ARCH
 
index d2db949ea05962a64421b8c8c170ccf9d79b1a57..1ccb088040ff01e262039a12839c38fa287d6211 100644 (file)
@@ -8,19 +8,21 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include files                                                       /*{{{*/
-#include "acqprogress.h"
+#include<config.h>
+
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/acquire-worker.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 
-#include <apti18n.h>
-    
 #include <stdio.h>
 #include <signal.h>
 #include <iostream>
 #include <unistd.h>
+
+#include "acqprogress.h"
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;
@@ -161,7 +163,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
       ScreenWidth = sizeof(Buffer)-1;
 
    // Put in the percent done
-   sprintf(S,"%ld%%",long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems)));
+   sprintf(S,"%.0f%%",((CurrentBytes + CurrentItems)*100.0)/(TotalBytes+TotalItems));
 
    bool Shown = false;
    for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
@@ -212,11 +214,11 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
       if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false)
       {
         if (Mode == Short)
-           snprintf(S,End-S," %lu%%",
-                    long(double(I->CurrentSize*100.0)/double(I->TotalSize)));
+           snprintf(S,End-S," %.0f%%",
+                    (I->CurrentSize*100.0)/I->TotalSize);
         else
-           snprintf(S,End-S,"/%sB %lu%%",SizeToStr(I->TotalSize).c_str(),
-                    long(double(I->CurrentSize*100.0)/double(I->TotalSize)));
+           snprintf(S,End-S,"/%sB %.0f%%",SizeToStr(I->TotalSize).c_str(),
+                    (I->CurrentSize*100.0)/I->TotalSize);
       }      
       S += strlen(S);
       snprintf(S,End-S,"]");
@@ -236,7 +238,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
    if (CurrentCPS != 0)
    {      
       char Tmp[300];
-      unsigned long ETA = (unsigned long)((TotalBytes - CurrentBytes)/CurrentCPS);
+      unsigned long long ETA = (TotalBytes - CurrentBytes)/CurrentCPS;
       sprintf(Tmp," %sB/s %s",SizeToStr(CurrentCPS).c_str(),TimeToStr(ETA).c_str());
       unsigned int Len = strlen(Buffer);
       unsigned int LenT = strlen(Tmp);
index db5475227a709d289124902c88757834b7b95918..a4cdf784e29c959c4be8012a727029f7e68980b2 100644 (file)
@@ -13,8 +13,9 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/error.h>
-#include <cassert>
 #include <apt-pkg/pkgcachegen.h>
 #include <apt-pkg/cachefile.h>
 #include <apt-pkg/cacheset.h>
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/sptr.h>
 
-#include <config.h>
-#include <apti18n.h>
-
+#include <cassert>
 #include <locale.h>
 #include <iostream>
 #include <unistd.h>
 #include <errno.h>
 #include <regex.h>
 #include <stdio.h>
-
 #include <iomanip>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;
index d1268edf9a239358db91d9d9746667fa159c8ef5..8608b1215e74ec16e2744e8277b0123da15fbaeb 100644 (file)
@@ -11,6 +11,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/acquire.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/cdrom.h>
-#include <config.h>
-#include <apti18n.h>
-    
-//#include "indexcopy.h"
 
 #include <locale.h>
 #include <iostream>
@@ -36,6 +34,8 @@
 #include <dirent.h>
 #include <unistd.h>
 #include <stdio.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;
index 589ee7ada62a5d68cc3b47676d2f5ae7e9110a63..df29589751e2763b6fbbc5ed961a12bdd2874a7f 100644 (file)
@@ -16,6 +16,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
 
-#include <config.h>
-#include <apti18n.h>
-
 #include <locale.h>
 #include <iostream>
 #include <string>
 #include <vector>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 using namespace std;
 
index 07bc0c25d053d6a17453d67e3d84d87078211bf5..5d7b76c23e33b2804e9775f36807efc9314f80c8 100644 (file)
@@ -13,6 +13,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/init.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/pkgcache.h>
@@ -28,7 +30,7 @@
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
-       
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -36,7 +38,6 @@
 #include <fstream>
 
 #include <locale.h>
-#include <config.h>
 #include <apti18n.h>
 #include "apt-extracttemplates.h"
                                                                        /*}}}*/
index 4a05648fa7dc388fbc4a49f9ebcb7d6f305cb8e0..3e72749b4471bebb4fa702d80107209d3fbc26d5 100644 (file)
@@ -25,8 +25,7 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#define _LARGEFILE_SOURCE
-#define _LARGEFILE64_SOURCE
+#include <config.h>
 
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/error.h>
@@ -46,9 +45,6 @@
 #include <apt-pkg/md5.h>
 #include <apt-pkg/versionmatch.h>
 
-#include <config.h>
-#include <apti18n.h>
-
 #include "acqprogress.h"
 
 #include <set>
@@ -68,8 +64,7 @@
 #include <sys/wait.h>
 #include <sstream>
 
-#define statfs statfs64
-#define statvfs statvfs64
+#include <apti18n.h>
                                                                        /*}}}*/
 
 #define RAMFS_MAGIC     0x858458f6
index b2c6649793b09f566d0b8f934082ae27e1604188..8c9a47913e2d2854b05fa688b02e9866ac50a6d5 100644 (file)
@@ -5,6 +5,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/cachefile.h>
 #include <apt-pkg/cacheset.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/strutl.h>
 
-#include <config.h>
-#include <apti18n.h>
-
 #include <algorithm>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 using namespace std;
 
index f95a434cc1e87ddaba2bd03b93a97794e6671326..44b74cf6c0901fcd3af204e2cb5fb1b07cddb425 100644 (file)
@@ -12,6 +12,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/strutl.h>
 
-#include <config.h>
-#include <apti18n.h>
-    
 #include <vector>
 #include <algorithm>
 
 #include <locale.h>
 #include <unistd.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;
index 89c4b240cca055a7f054b095bd6c43436765f172..e37160cb9e4c34009839e6122878e0bd4854f1a5 100644 (file)
@@ -31,6 +31,10 @@ AC_CHECK_TOOL_PREFIX
 AC_PROG_CC
 AC_ISC_POSIX
 
+dnl check for large file support and enable it if possible
+dnl do this early as other stuff might depend on it
+AC_SYS_LARGEFILE
+
 dnl Check for other programs
 AC_PROG_CXX
 AC_PROG_CPP
@@ -151,7 +155,7 @@ if test "$cross_compiling" = "yes" -a "x$archline" = "x"; then
   AC_MSG_ERROR(When cross compiling, architecture must be present in sizetable)
 fi
 AC_C_BIGENDIAN
-   
+
 dnl We do not need this if we have inttypes!
 HAVE_C9X=yes
 if test x"$apt_cv_c9x_ints" = x"no"; then
index c9439b0d47e41820c80df092e1fb79d21c59512c..f14930aa41ffe779f2b7fdbb6070b9231dec0c50 100644 (file)
@@ -1,3 +1,12 @@
+apt (0.8.16~exp6) experimental; urgency=low
+
+  [ David Kalnischkies ]
+  * Support large files in the complete toolset. Indexes of this
+    size are pretty unlikely for now, but we need it for deb
+    packages which could become bigger than 4GB now (LP: #815895)
+
+ -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 13 Sep 2011 17:51:49 +0200
+
 apt (0.8.16~exp5) experimental; urgency=low
 
   * merged the latest debian-sid fixes
index fabaaec1d5eb98f2f2ff51c3beb59678d13e34d3..f289eb00dbe0334155c55ea25a0fe4aae1d18b0d 100644 (file)
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#include "apt-ftparchive.h"
-    
+#include <config.h>
+
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/init.h>
-#include <config.h>
-#include <apti18n.h>
 #include <algorithm>
 
 #include <climits>
 #include <sys/time.h>
 #include <regex.h>
 
+#include "apt-ftparchive.h"
 #include "contents.h"
 #include "multicompress.h"
-#include "writer.h"    
+#include "writer.h"
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;    
@@ -205,7 +206,7 @@ bool PackageMap::GenPackages(Configuration &Setup,struct CacheDB::Stats &Stats)
    Packages.Output = 0;      // Just in case
    
    // Finish compressing
-   unsigned long Size;
+   unsigned long long Size;
    if (Comp.Finalize(Size) == false)
    {
       c0out << endl;
@@ -291,7 +292,7 @@ bool PackageMap::GenSources(Configuration &Setup,struct CacheDB::Stats &Stats)
    Sources.Output = 0;      // Just in case
    
    // Finish compressing
-   unsigned long Size;
+   unsigned long long Size;
    if (Comp.Finalize(Size) == false)
    {
       c0out << endl;
@@ -362,11 +363,11 @@ bool PackageMap::GenContents(Configuration &Setup,
       if (_error->PendingError() == true)
         return false;
       
-      unsigned long Size = Head.Size();
+      unsigned long long Size = Head.Size();
       unsigned char Buf[4096];
       while (Size != 0)
       {
-        unsigned long ToRead = Size;
+        unsigned long long ToRead = Size;
         if (Size > sizeof(Buf))
            ToRead = sizeof(Buf);
         
@@ -400,7 +401,7 @@ bool PackageMap::GenContents(Configuration &Setup,
    Contents.Finish();
    
    // Finish compressing
-   unsigned long Size;
+   unsigned long long Size;
    if (Comp.Finalize(Size) == false || _error->PendingError() == true)
    {
       c0out << endl;
index 7e4c2e9fec82320baa16ea2739ff6e553dd2412f..a1d70f912f8020c1ffebf62b2094028d530d93a0 100644 (file)
@@ -10,9 +10,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#include "cachedb.h"
+#include <config.h>
 
-#include <apti18n.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/sha1.h>
@@ -21,6 +20,9 @@
 #include <apt-pkg/configuration.h>
     
 #include <netinet/in.h>       // htonl, etc
+
+#include <apti18n.h>
+#include "cachedb.h"
                                                                        /*}}}*/
 
 // CacheDB::ReadyDB - Ready the DB2                                    /*{{{*/
index 15e796325ea15aa6544a5beada700f74f742bfcf..6bd5aa36c34c162b64e86ed7c439a058452f10be 100644 (file)
@@ -81,7 +81,7 @@ class CacheDB
    {
       uint32_t Flags;
       uint32_t mtime;          
-      uint32_t FileSize;
+      uint64_t FileSize;
       uint8_t  MD5[16];
       uint8_t  SHA1[20];
       uint8_t  SHA256[32];
@@ -114,7 +114,7 @@ class CacheDB
       double SHA512Bytes;
       unsigned long Packages;
       unsigned long Misses;  
-      unsigned long DeLinkBytes;
+      unsigned long long DeLinkBytes;
       
       inline void Add(const Stats &S) {
         Bytes += S.Bytes; 
@@ -133,7 +133,7 @@ class CacheDB
    inline bool DBFailed() {return Dbp != 0 && DBLoaded == false;};
    inline bool Loaded() {return DBLoaded == true;};
    
-   inline off_t GetFileSize(void) {return CurStat.FileSize;}
+   inline unsigned long long GetFileSize(void) {return CurStat.FileSize;}
    
    bool SetFile(string const &FileName,struct stat St,FileFd *Fd);
    bool GetFileInfo(string const &FileName, bool const &DoControl, bool const &DoContents, bool const &GenContentsOnly,
index eadced626125cfb574d0dca5544f8412d769131d..65d8dd1cebe87eca6292985967f74a938fc85647 100644 (file)
@@ -33,9 +33,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#include "contents.h"
+#include <config.h>
 
-#include <apti18n.h>
 #include <apt-pkg/debfile.h>
 #include <apt-pkg/extracttar.h>
 #include <apt-pkg/error.h>
@@ -43,6 +42,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <malloc.h>
+
+#include <apti18n.h>
+#include "contents.h"
                                                                        /*}}}*/
 
 // GenContents::~GenContents - Free allocated memory                   /*{{{*/
@@ -347,7 +349,7 @@ bool ContentsExtract::DoItem(Item &Itm,int &Fd)
 // ContentsExtract::TakeContents - Load the contents data              /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool ContentsExtract::TakeContents(const void *NewData,unsigned long Length)
+bool ContentsExtract::TakeContents(const void *NewData,unsigned long long Length)
 {
    if (Length == 0)
    {
index 5b5092b66b167dfd93fc84ac5ccf588807612bd1..f549ce17fce7b407ffa47eecde2705ee0ba30609 100644 (file)
@@ -71,15 +71,15 @@ class ContentsExtract : public pkgDirStream
 
    // The Data Block
    char *Data;
-   unsigned long MaxSize;
-   unsigned long CurSize;
+   unsigned long long MaxSize;
+   unsigned long long CurSize;
    void AddData(const char *Text);
    
    bool Read(debDebFile &Deb);
    
    virtual bool DoItem(Item &Itm,int &Fd);      
    void Reset() {CurSize = 0;};
-   bool TakeContents(const void *Data,unsigned long Length);
+   bool TakeContents(const void *Data,unsigned long long Length);
    void Add(GenContents &Contents,string const &Package);
    
    ContentsExtract() : Data(0), MaxSize(0), CurSize(0) {};
index 08853b0aa70644bc49f1208aa786526c94cce49d..bf0f858d99fd5732c1603c551d0029457ddc265c 100644 (file)
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#include "multicompress.h"
-    
-#include <apti18n.h>
+#include <config.h>
+
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/md5.h>
-    
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <utime.h>
 #include <unistd.h>
-#include <iostream>    
+#include <iostream>
+
+#include "multicompress.h"
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;
@@ -213,7 +215,7 @@ bool MultiCompress::Die()
 // MultiCompress::Finalize - Finish up writing                         /*{{{*/
 // ---------------------------------------------------------------------
 /* This is only necessary for statistics reporting. */
-bool MultiCompress::Finalize(unsigned long &OutSize)
+bool MultiCompress::Finalize(unsigned long long &OutSize)
 {
    OutSize = 0;
    if (Input == 0 || Die() == false)
@@ -381,7 +383,7 @@ bool MultiCompress::Child(int const &FD)
       stash a hash of the data to use later. */
    SetNonBlock(FD,false);
    unsigned char Buffer[32*1024];
-   unsigned long FileSize = 0;
+   unsigned long long FileSize = 0;
    MD5Summation MD5;
    while (1)
    {
@@ -443,7 +445,7 @@ bool MultiCompress::Child(int const &FD)
             
       // Compute the hash
       MD5Summation OldMD5;
-      unsigned long NewFileSize = 0;
+      unsigned long long NewFileSize = 0;
       while (1)
       {
         int Res = read(CompFd,Buffer,sizeof(Buffer));
index 19dede174bb33915cfd747057b73bd63b8491418..4839af47dba312dd9139ca05a36d65746bddc6bc 100644 (file)
@@ -54,7 +54,7 @@ class MultiCompress
    FILE *Input;
    unsigned long UpdateMTime;
    
-   bool Finalize(unsigned long &OutSize);
+   bool Finalize(unsigned long long &OutSize);
    bool OpenOld(int &Fd,pid_t &Proc);
    bool CloseOld(int Fd,pid_t Proc);
    static bool GetStat(string const &Output,string const &Compress,struct stat &St);
index bd583a66f0256d464438a11ccc098e3b04475dea..d363fd0fe9830a5510ef8aea848f960b346020aa 100644 (file)
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#include "override.h"
-    
+#include <config.h>
+
 #include <apti18n.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 
 #include <stdio.h>
-    
+
 #include "override.h"
                                                                        /*}}}*/
 
@@ -34,7 +34,7 @@ bool Override::ReadOverride(string const &File,bool const &Source)
       return _error->Errno("fopen",_("Unable to open %s"),File.c_str());
    
    char Line[500];
-   unsigned long Counter = 0;
+   unsigned long long Counter = 0;
    while (fgets(Line,sizeof(Line),F) != 0)
    {
       Counter++;
@@ -57,7 +57,7 @@ bool Override::ReadOverride(string const &File,bool const &Source)
       for (; isspace(*End) == 0 && *End != 0; End++);
       if (*End == 0)
       {
-        _error->Warning(_("Malformed override %s line %lu #1"),File.c_str(),
+        _error->Warning(_("Malformed override %s line %llu #1"),File.c_str(),
                         Counter);
         continue;
       }      
@@ -71,7 +71,7 @@ bool Override::ReadOverride(string const &File,bool const &Source)
         for (; isspace(*End) == 0 && *End != 0; End++);
         if (*End == 0)
         {
-           _error->Warning(_("Malformed override %s line %lu #2"),File.c_str(),
+           _error->Warning(_("Malformed override %s line %llu #2"),File.c_str(),
                            Counter);
            continue;
         }
@@ -85,7 +85,7 @@ bool Override::ReadOverride(string const &File,bool const &Source)
       for (; isspace(*End) == 0 && *End != 0; End++);
       if (*End == 0)
       {
-        _error->Warning(_("Malformed override %s line %lu #3"),File.c_str(),
+        _error->Warning(_("Malformed override %s line %llu #3"),File.c_str(),
                         Counter);
         continue;
       }      
@@ -142,7 +142,7 @@ bool Override::ReadExtraOverride(string const &File,bool const &Source)
       return _error->Errno("fopen",_("Unable to open %s"),File.c_str());
   
    char Line[500];
-   unsigned long Counter = 0;
+   unsigned long long Counter = 0;
    while (fgets(Line,sizeof(Line),F) != 0)
    {
       Counter++;
@@ -163,7 +163,7 @@ bool Override::ReadExtraOverride(string const &File,bool const &Source)
       for (; isspace(*End) == 0 && *End != 0; End++);
       if (*End == 0)
       {
-        _error->Warning(_("Malformed override %s line %lu #1"),File.c_str(),
+        _error->Warning(_("Malformed override %s line %llu #1"),File.c_str(),
                         Counter);
         continue;
       }      
@@ -175,7 +175,7 @@ bool Override::ReadExtraOverride(string const &File,bool const &Source)
       for (; isspace(*End) == 0 && *End != 0; End++);
       if (*End == 0)
       {
-        _error->Warning(_("Malformed override %s line %lu #2"),File.c_str(),
+        _error->Warning(_("Malformed override %s line %llu #2"),File.c_str(),
                         Counter);
         continue;
       }
@@ -188,7 +188,7 @@ bool Override::ReadExtraOverride(string const &File,bool const &Source)
       for (; isspace(*(End-1)) && End > Value; End--);
       if (End == Value)
       {
-        _error->Warning(_("Malformed override %s line %lu #3"),File.c_str(),
+        _error->Warning(_("Malformed override %s line %llu #3"),File.c_str(),
                         Counter);
         continue;
       }      
index 9741aec78217597240563830240fe2548e88431a..27e53faf81f90a6b3a318f94aa5cdcda6d4a0951 100644 (file)
@@ -11,9 +11,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#include "writer.h"
-    
-#include <apti18n.h>
+#include <config.h>
+
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <iostream>
 #include <sstream>
 #include <memory>
-    
+
+#include "writer.h"
 #include "cachedb.h"
 #include "apt-ftparchive.h"
 #include "multicompress.h"
+
+#include <apti18n.h>
                                                                        /*}}}*/
 using namespace std;
 FTWScanner *FTWScanner::Owner;
@@ -246,8 +248,8 @@ bool FTWScanner::LoadFileList(string const &Dir, string const &File)
 // ---------------------------------------------------------------------
 /* */
 bool FTWScanner::Delink(string &FileName,const char *OriginalPath,
-                       unsigned long &DeLinkBytes,
-                       off_t const &FileSize)
+                       unsigned long long &DeLinkBytes,
+                       unsigned long long const &FileSize)
 {
    // See if this isn't an internaly prefix'd file name.
    if (InternalPrefix.empty() == false &&
@@ -377,7 +379,7 @@ bool PackagesWriter::DoPackage(string FileName)
       return false;
    }
 
-   off_t FileSize = Db.GetFileSize();
+   unsigned long long FileSize = Db.GetFileSize();
    if (Delink(FileName,OriginalPath,Stats.DeLinkBytes,FileSize) == false)
       return false;
    
@@ -413,7 +415,7 @@ bool PackagesWriter::DoPackage(string FileName)
    }
 
    char Size[40];
-   sprintf(Size,"%lu", (unsigned long) FileSize);
+   sprintf(Size,"%llu", (unsigned long long) FileSize);
    
    // Strip the DirStrip prefix from the FileName and add the PathPrefix
    string NewFileName;
@@ -610,7 +612,7 @@ bool SourcesWriter::DoPackage(string FileName)
    if (St.st_size > 128*1024)
       return _error->Error("DSC file '%s' is too large!",FileName.c_str());
          
-   if (BufSize < (unsigned)St.st_size+1)
+   if (BufSize < (unsigned long long)St.st_size+1)
    {
       BufSize = St.st_size+1;
       Buffer = (char *)realloc(Buffer,St.st_size+1);
@@ -1065,7 +1067,7 @@ void ReleaseWriter::Finish()
       for(map<string,struct CheckSum>::const_iterator I = CheckSums.begin();
          I != CheckSums.end(); ++I)
       {
-        fprintf(Output, " %s %16ld %s\n",
+        fprintf(Output, " %s %16llu %s\n",
                 (*I).second.MD5.c_str(),
                 (*I).second.size,
                 (*I).first.c_str());
@@ -1077,7 +1079,7 @@ void ReleaseWriter::Finish()
       for(map<string,struct CheckSum>::const_iterator I = CheckSums.begin();
          I != CheckSums.end(); ++I)
       {
-        fprintf(Output, " %s %16ld %s\n",
+        fprintf(Output, " %s %16llu %s\n",
                 (*I).second.SHA1.c_str(),
                 (*I).second.size,
                 (*I).first.c_str());
@@ -1089,7 +1091,7 @@ void ReleaseWriter::Finish()
       for(map<string,struct CheckSum>::const_iterator I = CheckSums.begin();
          I != CheckSums.end(); ++I)
       {
-        fprintf(Output, " %s %16ld %s\n",
+        fprintf(Output, " %s %16llu %s\n",
                 (*I).second.SHA256.c_str(),
                 (*I).second.size,
                 (*I).first.c_str());
@@ -1101,7 +1103,7 @@ void ReleaseWriter::Finish()
        I != CheckSums.end();
        ++I)
    {
-      fprintf(Output, " %s %32ld %s\n",
+      fprintf(Output, " %s %16llu %s\n",
               (*I).second.SHA512.c_str(),
               (*I).second.size,
               (*I).first.c_str());
index c6026e954ea133ac8bb878f52cbbea2446d0d032..a43b8387665b5b7e84eee1ee6d37eeac2d3c1b2b 100644 (file)
@@ -48,7 +48,7 @@ class FTWScanner
    static int ScannerFile(const char *File, bool const &ReadLink);
 
    bool Delink(string &FileName,const char *OriginalPath,
-              unsigned long &Bytes,off_t const &FileSize);
+              unsigned long long &Bytes,unsigned long long const &FileSize);
 
    inline void NewLine(unsigned const &Priority)
    {
@@ -159,7 +159,7 @@ class SourcesWriter : public FTWScanner
    Override BOver;
    Override SOver;
    char *Buffer;
-   unsigned long BufSize;
+   unsigned long long BufSize;
    
    public:
 
@@ -198,7 +198,7 @@ protected:
       string SHA256;
       string SHA512;
       // Limited by FileFd::Size()
-      unsigned long size;
+      unsigned long long size;
       ~CheckSum() {};
    };
    map<string,struct CheckSum> CheckSums;
index 42932ddedbcc9fc4cee3835c6f60fb13f792f211..eff83bda737e9b775039bc7fef948a6b475b5744 100644 (file)
@@ -13,6 +13,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/acquire-method.h>
index ae699dfc33b5479648b251446d374231a68c12bc..bc115d25946e720bf18479924fb5b8ea8c5d2c65 100644 (file)
@@ -8,6 +8,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/cdrom.h>
 #include <apt-pkg/cdromutl.h>
index a5af1f1a68f094d929d4748405e00bd49c3b6bbe..16fb6e793519c6e590a2df9d3029a92337767401 100644 (file)
@@ -11,7 +11,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#include "connect.h"
+#include <config.h>
+
 #include <apt-pkg/error.h>
 #include <apt-pkg/fileutl.h>
 
@@ -29,6 +30,7 @@
 #include <arpa/inet.h>
 #include <netdb.h>
 
+#include "connect.h"
 #include "rfc2553emu.h"
 #include <apti18n.h>
                                                                        /*}}}*/
index a6bb372a3754d9b8d72ee5f85f81b2ebf586904f..94467e054c7e5f687fa1fd36fa287d82580ba232 100644 (file)
@@ -9,6 +9,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/error.h>
index 9cdd5bc2d3b3a3ea9ff14f2732ef832780e146cd..9fc4cd76c32b18f9adfb98318413eafde94354c1 100644 (file)
@@ -13,6 +13,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/hashes.h>
index eb7fedd85509bca7e838670d829ebad976ed8f40..861647aeab9b2423ed318d84786dd1268dcffb2b 100644 (file)
@@ -15,6 +15,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/error.h>
@@ -30,7 +32,6 @@
 #include <errno.h>
 #include <stdarg.h>
 #include <iostream>
-#include <apti18n.h>
 
 // Internet stuff
 #include <netinet/in.h>
@@ -41,6 +42,7 @@
 #include "rfc2553emu.h"
 #include "connect.h"
 #include "ftp.h"
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;
@@ -628,7 +630,7 @@ bool FTPConn::ExtGoPasv()
 // FTPConn::Size - Return the size of a file                           /*{{{*/
 // ---------------------------------------------------------------------
 /* Grab the file size from the server, 0 means no size or empty file */
-bool FTPConn::Size(const char *Path,unsigned long &Size)
+bool FTPConn::Size(const char *Path,unsigned long long &Size)
 {
    // Query the size
    unsigned int Tag;
@@ -638,7 +640,7 @@ bool FTPConn::Size(const char *Path,unsigned long &Size)
       return false;
    
    char *End;
-   Size = strtol(Msg.c_str(),&End,10);
+   Size = strtoull(Msg.c_str(),&End,10);
    if (Tag >= 400 || End == Msg.c_str())
       Size = 0;
    return true;
@@ -840,7 +842,7 @@ bool FTPConn::Finalize()
 // ---------------------------------------------------------------------
 /* This opens a data connection, sends REST and RETR and then
    transfers the file over. */
-bool FTPConn::Get(const char *Path,FileFd &To,unsigned long Resume,
+bool FTPConn::Get(const char *Path,FileFd &To,unsigned long long Resume,
                  Hashes &Hash,bool &Missing)
 {
    Missing = false;
@@ -1003,7 +1005,7 @@ bool FtpMethod::Fetch(FetchItem *Itm)
    
    // Get the files information
    Status(_("Query"));
-   unsigned long Size;
+   unsigned long long Size;
    if (Server->Size(File,Size) == false ||
        Server->ModTime(File,FailTime) == false)
    {
@@ -1025,7 +1027,7 @@ bool FtpMethod::Fetch(FetchItem *Itm)
    struct stat Buf;
    if (stat(Itm->DestFile.c_str(),&Buf) == 0)
    {
-      if (Size == (unsigned)Buf.st_size && FailTime == Buf.st_mtime)
+      if (Size == (unsigned long long)Buf.st_size && FailTime == Buf.st_mtime)
       {
         Res.Size = Buf.st_size;
         Res.LastModified = Buf.st_mtime;
@@ -1035,7 +1037,7 @@ bool FtpMethod::Fetch(FetchItem *Itm)
       }
       
       // Resume?
-      if (FailTime == Buf.st_mtime && Size > (unsigned)Buf.st_size)
+      if (FailTime == Buf.st_mtime && Size > (unsigned long long)Buf.st_size)
         Res.ResumePoint = Buf.st_size;
    }
    
index d7f1f7fbece776cb0bfba3febbcf4fbc44da0384..b4913ca575335e9077a6e70a60c33e1beba5255c 100644 (file)
@@ -53,9 +53,9 @@ class FTPConn
    bool ExtGoPasv();
    
    // Query
-   bool Size(const char *Path,unsigned long &Size);
+   bool Size(const char *Path,unsigned long long &Size);
    bool ModTime(const char *Path, time_t &Time);
-   bool Get(const char *Path,FileFd &To,unsigned long Resume,
+   bool Get(const char *Path,FileFd &To,unsigned long long Resume,
            Hashes &MD5,bool &Missing);
    
    FTPConn(URI Srv);
index 3ad3e8d84ca7e6b83a7cb8d2ab0afab960b31fc7..251bcbc900071c88513fcc926a6f8a4feb32d47d 100644 (file)
@@ -1,9 +1,10 @@
+#include <config.h>
+
 #include <apt-pkg/error.h>
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/indexcopy.h>
-#include <apti18n.h>
 
 #include <utime.h>
 #include <stdio.h>
 #include <sys/wait.h>
 #include <iostream>
 #include <sstream>
-
 #include <vector>
 
+#include <apti18n.h>
+
 #define GNUPGPREFIX "[GNUPG:]"
 #define GNUPGBADSIG "[GNUPG:] BADSIG"
 #define GNUPGNOPUBKEY "[GNUPG:] NO_PUBKEY"
index fc4e1ecfd68c93cb9824ac74a7a6a3d2eadd662d..f4bb052e26191073d1a2822a66853d2e2cdc88f7 100644 (file)
@@ -9,6 +9,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/acquire-method.h>
@@ -62,7 +64,7 @@ bool GzipMethod::Fetch(FetchItem *Itm)
    while (1) 
    {
       unsigned char Buffer[4*1024];
-      unsigned long Count;
+      unsigned long long Count = 0;
       
       if (!From.Read(Buffer,sizeof(Buffer),&Count))
       {
index 65a0cbbb7f3da99d2a40bd681a0ed9880f3cb1df..b60cfeb9ed53fe3c374fe8e5808384ce5b6e2629 100644 (file)
@@ -25,6 +25,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/error.h>
@@ -41,8 +43,6 @@
 #include <string.h>
 #include <iostream>
 #include <map>
-#include <apti18n.h>
-
 
 // Internet stuff
 #include <netdb.h>
@@ -51,6 +51,8 @@
 #include "connect.h"
 #include "rfc2553emu.h"
 #include "http.h"
+
+#include <apti18n.h>
                                                                        /*}}}*/
 using namespace std;
 
@@ -63,15 +65,15 @@ bool AllowRedirect = false;
 bool Debug = false;
 URI Proxy;
 
-unsigned long CircleBuf::BwReadLimit=0;
-unsigned long CircleBuf::BwTickReadData=0;
+unsigned long long CircleBuf::BwReadLimit=0;
+unsigned long long CircleBuf::BwTickReadData=0;
 struct timeval CircleBuf::BwReadTick={0,0};
 const unsigned int CircleBuf::BW_HZ=10;
  
 // CircleBuf::CircleBuf - Circular input buffer                                /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-CircleBuf::CircleBuf(unsigned long Size) : Size(Size), Hash(0)
+CircleBuf::CircleBuf(unsigned long long Size) : Size(Size), Hash(0)
 {
    Buf = new unsigned char[Size];
    Reset();
@@ -87,7 +89,7 @@ void CircleBuf::Reset()
    InP = 0;
    OutP = 0;
    StrPos = 0;
-   MaxGet = (unsigned int)-1;
+   MaxGet = (unsigned long long)-1;
    OutQueue = string();
    if (Hash != 0)
    {
@@ -102,7 +104,7 @@ void CircleBuf::Reset()
    is non-blocking.. */
 bool CircleBuf::Read(int Fd)
 {
-   unsigned long BwReadMax;
+   unsigned long long BwReadMax;
 
    while (1)
    {
@@ -117,7 +119,7 @@ bool CircleBuf::Read(int Fd)
         struct timeval now;
         gettimeofday(&now,0);
 
-        unsigned long d = (now.tv_sec-CircleBuf::BwReadTick.tv_sec)*1000000 +
+        unsigned long long d = (now.tv_sec-CircleBuf::BwReadTick.tv_sec)*1000000 +
            now.tv_usec-CircleBuf::BwReadTick.tv_usec;
         if(d > 1000000/BW_HZ) {
            CircleBuf::BwReadTick = now;
@@ -131,7 +133,7 @@ bool CircleBuf::Read(int Fd)
       }
 
       // Write the buffer segment
-      int Res;
+      ssize_t Res;
       if(CircleBuf::BwReadLimit) {
         Res = read(Fd,Buf + (InP%Size), 
                    BwReadMax > LeftRead() ? LeftRead() : BwReadMax);
@@ -180,7 +182,7 @@ void CircleBuf::FillOut()
         return;
       
       // Write the buffer segment
-      unsigned long Sz = LeftRead();
+      unsigned long long Sz = LeftRead();
       if (OutQueue.length() - StrPos < Sz)
         Sz = OutQueue.length() - StrPos;
       memcpy(Buf + (InP%Size),OutQueue.c_str() + StrPos,Sz);
@@ -214,7 +216,7 @@ bool CircleBuf::Write(int Fd)
         return true;
       
       // Write the buffer segment
-      int Res;
+      ssize_t Res;
       Res = write(Fd,Buf + (OutP%Size),LeftWrite());
 
       if (Res == 0)
@@ -240,7 +242,7 @@ bool CircleBuf::Write(int Fd)
 bool CircleBuf::WriteTillEl(string &Data,bool Single)
 {
    // We cheat and assume it is unneeded to have more than one buffer load
-   for (unsigned long I = OutP; I < InP; I++)
+   for (unsigned long long I = OutP; I < InP; I++)
    {      
       if (Buf[I%Size] != '\n')
         continue;
@@ -258,7 +260,7 @@ bool CircleBuf::WriteTillEl(string &Data,bool Single)
       Data = "";
       while (OutP < I)
       {
-        unsigned long Sz = LeftWrite();
+        unsigned long long Sz = LeftWrite();
         if (Sz == 0)
            return false;
         if (I - OutP < Sz)
@@ -453,7 +455,7 @@ bool ServerState::RunData()
            return false;
                 
         // See if we are done
-        unsigned long Len = strtol(Data.c_str(),0,16);
+        unsigned long long Len = strtoull(Data.c_str(),0,16);
         if (Len == 0)
         {
            In.Limit(-1);
@@ -596,7 +598,7 @@ bool ServerState::HeaderLine(string Line)
       if (StartPos != 0)
         return true;
       
-      if (sscanf(Val.c_str(),"%lu",&Size) != 1)
+      if (sscanf(Val.c_str(),"%llu",&Size) != 1)
         return _error->Error(_("The HTTP server sent an invalid Content-Length header"));
       return true;
    }
@@ -611,9 +613,9 @@ bool ServerState::HeaderLine(string Line)
    {
       HaveContent = true;
       
-      if (sscanf(Val.c_str(),"bytes %lu-%*u/%lu",&StartPos,&Size) != 2)
+      if (sscanf(Val.c_str(),"bytes %llu-%*u/%llu",&StartPos,&Size) != 2)
         return _error->Error(_("The HTTP server sent an invalid Content-Range header"));
-      if ((unsigned)StartPos > Size)
+      if ((unsigned long long)StartPos > Size)
         return _error->Error(_("This HTTP server has broken range support"));
       return true;
    }
@@ -716,7 +718,7 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out)
    if (stat(Itm->DestFile.c_str(),&SBuf) >= 0 && SBuf.st_size > 0)
    {
       // In this case we send an if-range query with a range header
-      sprintf(Buf,"Range: bytes=%li-\r\nIf-Range: %s\r\n",(long)SBuf.st_size - 1,
+      sprintf(Buf,"Range: bytes=%lli-\r\nIf-Range: %s\r\n",(long long)SBuf.st_size - 1,
              TimeRFC1123(SBuf.st_mtime).c_str());
       Req += Buf;
    }
index 6302807c5e743fcfa2a764eaf462906596ec1f0d..c47d7184aab68fc5b50cab41594c952de1b00c30 100644 (file)
@@ -23,29 +23,29 @@ class HttpMethod;
 class CircleBuf
 {
    unsigned char *Buf;
-   unsigned long Size;
-   unsigned long InP;
-   unsigned long OutP;
+   unsigned long long Size;
+   unsigned long long InP;
+   unsigned long long OutP;
    string OutQueue;
-   unsigned long StrPos;
-   unsigned long MaxGet;
+   unsigned long long StrPos;
+   unsigned long long MaxGet;
    struct timeval Start;
    
-   static unsigned long BwReadLimit;
-   static unsigned long BwTickReadData;
+   static unsigned long long BwReadLimit;
+   static unsigned long long BwTickReadData;
    static struct timeval BwReadTick;
    static const unsigned int BW_HZ;
 
-   unsigned long LeftRead() const
+   unsigned long long LeftRead() const
    {
-      unsigned long Sz = Size - (InP - OutP);
+      unsigned long long Sz = Size - (InP - OutP);
       if (Sz > Size - (InP%Size))
         Sz = Size - (InP%Size);
       return Sz;
    }
-   unsigned long LeftWrite() const
+   unsigned long long LeftWrite() const
    {
-      unsigned long Sz = InP - OutP;
+      unsigned long long Sz = InP - OutP;
       if (InP > MaxGet)
         Sz = MaxGet - OutP;
       if (Sz > Size - (OutP%Size))
@@ -67,7 +67,7 @@ class CircleBuf
    bool WriteTillEl(string &Data,bool Single = false);
    
    // Control the write limit
-   void Limit(long Max) {if (Max == -1) MaxGet = 0-1; else MaxGet = OutP + Max;}   
+   void Limit(long long Max) {if (Max == -1) MaxGet = 0-1; else MaxGet = OutP + Max;}   
    bool IsLimit() const {return MaxGet == OutP;};
    void Print() const {cout << MaxGet << ',' << OutP << endl;};
 
@@ -79,7 +79,7 @@ class CircleBuf
    void Reset();
    void Stats();
 
-   CircleBuf(unsigned long Size);
+   CircleBuf(unsigned long long Size);
    ~CircleBuf() {delete [] Buf; delete Hash;};
 };
 
@@ -92,8 +92,8 @@ struct ServerState
    char Code[MAXLEN];
    
    // These are some statistics from the last parsed header lines
-   unsigned long Size;
-   signed long StartPos;
+   unsigned long long Size;
+   signed long long StartPos;
    time_t Date;
    bool HaveContent;
    enum {Chunked,Stream,Closes} Encoding;
index 7815c2fc1e34c5d7847bfa4e673c59272413404e..2ca91bfc91699ffaecc787ab70e8749adaaefa6b 100644 (file)
@@ -1,3 +1,5 @@
+#include <config.h>
+
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-method.h>
 #include <signal.h>
index fc649d6c217f800aad3ba147e9a8ff1320394f38..06a0e285aa2d5cbb594ea007ef043277288ef38a 100644 (file)
@@ -10,6 +10,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/error.h>
 #include <errno.h>
 #include <string.h>
 #include <iostream>
-#include <apti18n.h>
 #include <sstream>
 
 #include "config.h"
 #include "https.h"
-
+#include <apti18n.h>
                                                                        /*}}}*/
 using namespace std;
 
@@ -51,7 +52,7 @@ HttpsMethod::progress_callback(void *clientp, double dltotal, double dlnow,
 {
    HttpsMethod *me = (HttpsMethod *)clientp;
    if(dltotal > 0 && me->Res.Size == 0) {
-      me->Res.Size = (unsigned long)dltotal;
+      me->Res.Size = (unsigned long long)dltotal;
       me->URIStart(me->Res);
    }
    return 0;
index a3e60ab150ddcffaf9a86a490d9857f8ac8437a1..61a7f12fd0aef68bbf424f42d28253e9e5de20b2 100644 (file)
@@ -8,6 +8,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-method.h>
@@ -34,7 +36,7 @@ using namespace std;
 
 #include "mirror.h"
 #include "http.h"
-#include "apti18n.h"
+#include <apti18n.h>
                                                                        /*}}}*/
 
 /* Done:
index 66bc906e9707574c6c646259fc014fde2689bee2..f00e8588960f3e2cdd892a69aa091683e7785026 100644 (file)
 
    ##################################################################### */
                                                                        /*}}}*/
-#include "rfc2553emu.h"
+#include <config.h>
+
 #include <stdlib.h>
 #include <arpa/inet.h>
 #include <netinet/in.h>
 #include <string.h>
 #include <stdio.h>
+#include "rfc2553emu.h"
 
 #ifndef HAVE_GETADDRINFO
 // getaddrinfo - Resolve a hostname                                    /*{{{*/
index 6c55880ca1726c782bd1f939c50952a7f083c0ba..bc941ed049f84a3e0b85379f7505372bbbe1e4f1 100644 (file)
@@ -1,4 +1,6 @@
 // Includes                                                                    /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/mmap.h>
 #include <apt-pkg/error.h>
@@ -257,7 +259,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;
index 21f0d0a22220bf466dd5b33aaf0165ceef0a60e5..c95a4d3eb5cee7cc09d9be60f295d5c954e95f1f 100644 (file)
@@ -11,7 +11,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#include "rsh.h"
+#include <config.h>
+
 #include <apt-pkg/error.h>
 
 #include <sys/stat.h>
@@ -22,6 +23,8 @@
 #include <stdio.h>
 #include <errno.h>
 #include <stdarg.h>
+#include "rsh.h"
+
 #include <apti18n.h>
                                                                        /*}}}*/
 
@@ -248,7 +251,7 @@ bool RSHConn::WriteMsg(string &Text,bool Sync,const char *Fmt,...)
 // ---------------------------------------------------------------------
 /* Right now for successfull transfer the file size must be known in 
    advance. */
-bool RSHConn::Size(const char *Path,unsigned long &Size)
+bool RSHConn::Size(const char *Path,unsigned long long &Size)
 {
    // Query the size
    string Msg;
@@ -260,7 +263,7 @@ bool RSHConn::Size(const char *Path,unsigned long &Size)
    // FIXME: Sense if the bad reply is due to a File Not Found. 
    
    char *End;
-   Size = strtoul(Msg.c_str(),&End,10);
+   Size = strtoull(Msg.c_str(),&End,10);
    if (End == Msg.c_str())
       return _error->Error(_("File not found"));
    return true;
@@ -285,8 +288,8 @@ bool RSHConn::ModTime(const char *Path, time_t &Time)
 // RSHConn::Get - Get a file                                           /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool RSHConn::Get(const char *Path,FileFd &To,unsigned long Resume,
-                  Hashes &Hash,bool &Missing, unsigned long Size)
+bool RSHConn::Get(const char *Path,FileFd &To,unsigned long long Resume,
+                  Hashes &Hash,bool &Missing, unsigned long long Size)
 {
    Missing = false;
 
@@ -311,7 +314,7 @@ bool RSHConn::Get(const char *Path,FileFd &To,unsigned long Resume,
       return false;
 
    // Copy loop
-   unsigned int MyLen = Resume;
+   unsigned long long MyLen = Resume;
    unsigned char Buffer[4096];
    while (MyLen < Size)
    {
@@ -425,7 +428,7 @@ bool RSHMethod::Fetch(FetchItem *Itm)
    Status(_("Connecting to %s"), Get.Host.c_str());
 
    // Get the files information
-   unsigned long Size;
+   unsigned long long Size;
    if (Server->Size(File,Size) == false ||
        Server->ModTime(File,FailTime) == false)
    {
@@ -446,7 +449,7 @@ bool RSHMethod::Fetch(FetchItem *Itm)
    // See if the file exists
    struct stat Buf;
    if (stat(Itm->DestFile.c_str(),&Buf) == 0) {
-      if (Size == (unsigned)Buf.st_size && FailTime == Buf.st_mtime) {
+      if (Size == (unsigned long long)Buf.st_size && FailTime == Buf.st_mtime) {
         Res.Size = Buf.st_size;
         Res.LastModified = Buf.st_mtime;
         Res.ResumePoint = Buf.st_size;
@@ -455,7 +458,7 @@ bool RSHMethod::Fetch(FetchItem *Itm)
       }
 
       // Resume?
-      if (FailTime == Buf.st_mtime && Size > (unsigned)Buf.st_size)
+      if (FailTime == Buf.st_mtime && Size > (unsigned long long)Buf.st_size)
         Res.ResumePoint = Buf.st_size;
    }
 
index 98ca6a88ce69162526fe94fafd5d67fd53c58196..c81396b5fd0bb0b5b4d3bd1179f4cc424c12d7d2 100644 (file)
@@ -41,10 +41,10 @@ class RSHConn
    void Close();
 
    // Query
-   bool Size(const char *Path,unsigned long &Size);
+   bool Size(const char *Path,unsigned long long &Size);
    bool ModTime(const char *Path, time_t &Time);
-   bool Get(const char *Path,FileFd &To,unsigned long Resume,
-            Hashes &Hash,bool &Missing, unsigned long Size);
+   bool Get(const char *Path,FileFd &To,unsigned long long Resume,
+            Hashes &Hash,bool &Missing, unsigned long long Size);
 
    RSHConn(URI Srv);
    ~RSHConn();