summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/deblistparser.cc18
-rw-r--r--apt-pkg/deb/deblistparser.h5
2 files changed, 11 insertions, 12 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index ea4d8e063..0fc08d8fb 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -276,31 +276,27 @@ std::vector<std::string> debListParser::AvailableDescriptionLanguages()
description. If no Description-md5 is found in the section it will be
calculated.
*/
-MD5SumValue debListParser::Description_md5()
+APT::StringView debListParser::Description_md5()
{
StringView const value = Section.Find(pkgTagSection::Key::Description_md5);
- if (value.empty() == true)
+ if (unlikely(value.empty() == true))
{
StringView const desc = Section.Find(pkgTagSection::Key::Description);
if (desc == "\n")
- return MD5SumValue();
+ return StringView();
MD5Summation md5;
md5.Add(desc.data(), desc.size());
md5.Add("\n");
- return md5.Result();
+ MD5Buffer = md5.Result();
+ return StringView(MD5Buffer);
}
else if (likely(value.size() == 32))
{
- MD5SumValue sumvalue;
- if (sumvalue.Set(value))
- return sumvalue;
-
- _error->Error("Malformed Description-md5 line; includes invalid character '%.*s'", (int)value.length(), value.data());
- return MD5SumValue();
+ return value;
}
_error->Error("Malformed Description-md5 line; doesn't have the required length (32 != %d) '%.*s'", (int)value.size(), (int)value.length(), value.data());
- return MD5SumValue();
+ return StringView();
}
/*}}}*/
// ListParser::UsePackage - Update a package structure /*{{{*/
diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h
index 43ce0cfd3..3d5065953 100644
--- a/apt-pkg/deb/deblistparser.h
+++ b/apt-pkg/deb/deblistparser.h
@@ -45,6 +45,7 @@ class APT_HIDDEN debListParser : public pkgCacheListParser
private:
std::vector<std::string> forceEssential;
std::vector<std::string> forceImportant;
+ std::string MD5Buffer;
protected:
pkgTagFile Tags;
@@ -74,7 +75,9 @@ class APT_HIDDEN debListParser : public pkgCacheListParser
#endif
virtual bool NewVersion(pkgCache::VerIterator &Ver) APT_OVERRIDE;
virtual std::vector<std::string> AvailableDescriptionLanguages() APT_OVERRIDE;
- virtual MD5SumValue Description_md5() APT_OVERRIDE;
+#ifdef APT_PKG_EXPOSE_STRING_VIEW
+ virtual APT::StringView Description_md5() APT_OVERRIDE;
+#endif
virtual unsigned short VersionHash() APT_OVERRIDE;
virtual bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver) APT_OVERRIDE;
virtual bool UsePackage(pkgCache::PkgIterator &Pkg,