Просмотр исходного кода

* apt-pkg/pkgcachegen.cc:
- do not add multiple identical descriptions for the same
language (closes: #400768)

egon лет назад: 18
Родитель
Сommit
c76c44b10a
3 измененных файлов с 26 добавлено и 5 удалено
  1. 2 1
      apt-pkg/pkgcache.cc
  2. 16 4
      apt-pkg/pkgcachegen.cc
  3. 8 0
      debian/changelog

+ 2 - 1
apt-pkg/pkgcache.cc

@@ -622,7 +622,8 @@ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const
    for (; Desc.end() == false; Desc++)
       if (pkgIndexFile::LanguageCode() == Desc.LanguageCode())
 	 break;
-   if (Desc.end() == true) Desc = DescDefault;
+   if (Desc.end() == true) 
+      Desc = DescDefault;
    return Desc;
 };
 

+ 16 - 4
apt-pkg/pkgcachegen.cc

@@ -139,10 +139,21 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
  	 {
  	    pkgCache::DescIterator Desc = Ver.DescriptionList();
  	    map_ptrloc *LastDesc = &Ver->DescriptionList;
-
- 	    for (; Desc.end() == false; LastDesc = &Desc->NextDesc, Desc++)
+	    bool duplicate=false;
+
+	    // don't add a new description if we have one for the given
+	    // md5 && language
+ 	    for ( ; Desc.end() == false; LastDesc = &Desc->NextDesc, Desc++)
+	       if (MD5SumValue(Desc.md5()) == CurMd5 && 
+	           Desc.LanguageCode() == List.DescriptionLanguage())
+		  duplicate=true;
+	    if(duplicate)
+	       continue;
+	    
+ 	    for (Desc = Ver.DescriptionList();
+		 Desc.end() == false; 
+		 LastDesc = &Desc->NextDesc, Desc++)
 	    {
-
  	       if (MD5SumValue(Desc.md5()) == CurMd5) 
                {
  		  // Add new description
@@ -434,7 +445,8 @@ bool pkgCacheGenerator::NewFileDesc(pkgCache::DescIterator &Desc,
 // ---------------------------------------------------------------------
 /* This puts a description structure in the linked list */
 map_ptrloc pkgCacheGenerator::NewDescription(pkgCache::DescIterator &Desc,
-					    const string &Lang, const MD5SumValue &md5sum,
+					    const string &Lang, 
+                                            const MD5SumValue &md5sum,
 					    map_ptrloc Next)
 {
    // Get a structure

+ 8 - 0
debian/changelog

@@ -1,3 +1,11 @@
+apt (0.7.15~exp2) experimental; urgency=low
+
+  * apt-pkg/pkgcachegen.cc:
+    - do not add multiple identical descriptions for the same 
+      language (closes: #400768)
+
+ -- Michael Vogt <mvo@debian.org>  Tue, 23 Sep 2008 07:29:59 +0200
+
 apt (0.7.15~exp1) experimental; urgency=low
 
   [ Christian Perrier ]