From c76c44b10a40bc4ae755effad8a53802a6e4952a Mon Sep 17 00:00:00 2001 From: egon Date: Tue, 23 Sep 2008 07:31:23 +0200 Subject: * apt-pkg/pkgcachegen.cc: - do not add multiple identical descriptions for the same language (closes: #400768) --- apt-pkg/pkgcachegen.cc | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'apt-pkg/pkgcachegen.cc') diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index d00cd4e64..f71547f39 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/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 -- cgit v1.2.3