summaryrefslogtreecommitdiff
path: root/apt-pkg/indexcopy.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-09-13 17:46:48 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-09-13 17:46:48 +0200
commit650faab01603caac04494d54cf6b10a65c00ea13 (patch)
treed89d9ec876c195d8f757e1351858ea7c200dd269 /apt-pkg/indexcopy.cc
parentea54214002c09eeb4dd498d97a564471ec9993c5 (diff)
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)
Diffstat (limited to 'apt-pkg/indexcopy.cc')
-rw-r--r--apt-pkg/indexcopy.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc
index dcba78dce..f52ecbbcb 100644
--- a/apt-pkg/indexcopy.cc
+++ b/apt-pkg/indexcopy.cc
@@ -29,6 +29,7 @@
#include <sys/types.h>
#include <fcntl.h>
#include <stdio.h>
+#include <stdlib.h>
#include "indexcopy.h"
#include <apti18n.h>
@@ -55,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;
@@ -66,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;
@@ -166,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);
@@ -221,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;
@@ -455,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");
@@ -481,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)
@@ -504,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;
}
@@ -787,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;
@@ -798,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;