]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/debindexfile.cc
merge with lp:~mvo/apt/debian-sid to get 0.7.25.1 and my changes back
[apt.git] / apt-pkg / deb / debindexfile.cc
index be8175e31c342ef8491b3b12cd86393095d7c097..201fd7fdf754bf59967ee2bb77683c9c80d31c66 100644 (file)
@@ -329,10 +329,11 @@ pkgCache::PkgFileIterator debPackagesIndex::FindInCache(pkgCache &Cache) const
 // TranslationsIndex::debTranslationsIndex - Contructor                        /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-debTranslationsIndex::debTranslationsIndex(string URI,string Dist,string Section) : 
-                  pkgIndexFile(true), URI(URI), Dist(Dist), Section(Section)
-{
-}
+debTranslationsIndex::debTranslationsIndex(string URI,string Dist,string Section,
+                                               char const * const Translation) :
+                       pkgIndexFile(true), URI(URI), Dist(Dist), Section(Section),
+                               Language(Translation)
+{}
                                                                        /*}}}*/
 // TranslationIndex::Trans* - Return the URI to the translation files  /*{{{*/
 // ---------------------------------------------------------------------
@@ -365,8 +366,8 @@ string debTranslationsIndex::IndexURI(const char *Type) const
 bool debTranslationsIndex::GetIndexes(pkgAcquire *Owner) const
 {
    if (TranslationsAvailable()) {
-     string TranslationFile = "Translation-" + LanguageCode();
-     new pkgAcqIndexTrans(Owner, IndexURI(LanguageCode().c_str()),
+     string const TranslationFile = string("Translation-").append(Language);
+     new pkgAcqIndexTrans(Owner, IndexURI(Language),
                          Info(TranslationFile.c_str()),
                          TranslationFile);
    }
@@ -385,7 +386,7 @@ string debTranslationsIndex::Describe(bool Short) const
       snprintf(S,sizeof(S),"%s",Info(TranslationFile().c_str()).c_str());
    else
       snprintf(S,sizeof(S),"%s (%s)",Info(TranslationFile().c_str()).c_str(),
-              IndexFile(LanguageCode().c_str()).c_str());
+              IndexFile(Language).c_str());
    return S;
 }
                                                                        /*}}}*/
@@ -407,20 +408,20 @@ string debTranslationsIndex::Info(const char *Type) const
    return Info;
 }
                                                                        /*}}}*/
-bool debTranslationsIndex::HasPackages() const
+bool debTranslationsIndex::HasPackages() const                         /*{{{*/
 {
    if(!TranslationsAvailable())
       return false;
    
-   return FileExists(IndexFile(LanguageCode().c_str()));
+   return FileExists(IndexFile(Language));
 }
-
+                                                                       /*}}}*/
 // TranslationsIndex::Exists - Check if the index is available         /*{{{*/
 // ---------------------------------------------------------------------
 /* */
 bool debTranslationsIndex::Exists() const
 {
-   return FileExists(IndexFile(LanguageCode().c_str()));
+   return FileExists(IndexFile(Language));
 }
                                                                        /*}}}*/
 // TranslationsIndex::Size - Return the size of the index              /*{{{*/
@@ -429,7 +430,7 @@ bool debTranslationsIndex::Exists() const
 unsigned long debTranslationsIndex::Size() const
 {
    struct stat S;
-   if (stat(IndexFile(LanguageCode().c_str()).c_str(),&S) != 0)
+   if (stat(IndexFile(Language).c_str(),&S) != 0)
       return 0;
    return S.st_size;
 }
@@ -440,7 +441,7 @@ unsigned long debTranslationsIndex::Size() const
 bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const
 {
    // Check the translation file, if in use
-   string TranslationFile = IndexFile(LanguageCode().c_str());
+   string TranslationFile = IndexFile(Language);
    if (TranslationsAvailable() && FileExists(TranslationFile))
    {
      FileFd Trans(TranslationFile,FileFd::ReadOnly);
@@ -472,7 +473,7 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const
 /* */
 pkgCache::PkgFileIterator debTranslationsIndex::FindInCache(pkgCache &Cache) const
 {
-   string FileName = IndexFile(LanguageCode().c_str());
+   string FileName = IndexFile(Language);
    
    pkgCache::PkgFileIterator File = Cache.FileBegin();
    for (; File.end() == false; File++)