summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/debindexfile.cc
diff options
context:
space:
mode:
authorMartin Pitt <martin@piware.de>2010-10-13 12:45:47 +0200
committerMartin Pitt <martin@piware.de>2010-10-13 12:45:47 +0200
commit5473df3fec08eaea6e84b98551cc247e87f4b6df (patch)
tree16d6de2761d53a2cb58330b632e09ff51e6b87f9 /apt-pkg/deb/debindexfile.cc
parent3a97e9665d126a582c830376bfded145c0f9b2d1 (diff)
* apt-pkg/deb/debindexfile.cc:
- Use FileFd::Size() instead of stat()ing the sources/binary/translations indexes directly, so that we have transparent handling of gzipped indexes.
Diffstat (limited to 'apt-pkg/deb/debindexfile.cc')
-rw-r--r--apt-pkg/deb/debindexfile.cc22
1 files changed, 13 insertions, 9 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index ba5b3f266..a89a2574f 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -149,10 +149,11 @@ bool debSourcesIndex::Exists() const
/* */
unsigned long debSourcesIndex::Size() const
{
- struct stat S;
- if (stat(IndexFile("Sources").c_str(),&S) != 0)
+ FileFd f = FileFd (IndexFile("Sources"), FileFd::ReadOnlyGzip);
+
+ if (f.Failed())
return 0;
- return S.st_size;
+ return f.Size();
}
/*}}}*/
@@ -268,10 +269,11 @@ bool debPackagesIndex::Exists() const
/* This is really only used for progress reporting. */
unsigned long debPackagesIndex::Size() const
{
- struct stat S;
- if (stat(IndexFile("Packages").c_str(),&S) != 0)
+ FileFd f = FileFd (IndexFile("Packages"), FileFd::ReadOnlyGzip);
+
+ if (f.Failed())
return 0;
- return S.st_size;
+ return f.Size();
}
/*}}}*/
// PackagesIndex::Merge - Load the index file into a cache /*{{{*/
@@ -458,10 +460,12 @@ bool debTranslationsIndex::Exists() const
/* This is really only used for progress reporting. */
unsigned long debTranslationsIndex::Size() const
{
- struct stat S;
- if (stat(IndexFile(Language).c_str(),&S) != 0)
+ FileFd f = FileFd (IndexFile(Language), FileFd::ReadOnlyGzip);
+
+ if (f.Failed())
return 0;
- return S.st_size;
+
+ return f.Size();
}
/*}}}*/
// TranslationsIndex::Merge - Load the index file into a cache /*{{{*/