]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/tagfile.cc
some more coverity fixes
[apt.git] / apt-pkg / tagfile.cc
index 79811899a9f6987567cc9113a141eeadeac9cee1..83c1a9a55c820ce0182c58ebeeb2fda221f2b2ee 100644 (file)
@@ -218,6 +218,16 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long long Offset)
    return true;
 }
                                                                        /*}}}*/
+// pkgTagSection::pkgTagSection - Constructor                          /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+pkgTagSection::pkgTagSection()
+   : Section(0), TagCount(0), Stop(0), d(NULL)
+{
+   memset(&Indexes, 0, sizeof(Indexes));
+   memset(&AlphaIndexes, 0, sizeof(AlphaIndexes));
+}
+                                                                       /*}}}*/
 // TagSection::Scan - Scan for the end of the header information       /*{{{*/
 // ---------------------------------------------------------------------
 /* This looks for the first double new line in the data stream.
@@ -282,10 +292,17 @@ void pkgTagSection::Trim()
    for (; Stop > Section + 2 && (Stop[-2] == '\n' || Stop[-2] == '\r'); Stop--);
 }
                                                                        /*}}}*/
+// TagSection::Exists - return True if a tag exists                    /*{{{*/
+bool pkgTagSection::Exists(const char* const Tag)
+{
+   unsigned int tmp;
+   return Find(Tag, tmp);
+}
+                                                                       /*}}}*/
 // TagSection::Find - Locate a tag                                     /*{{{*/
 // ---------------------------------------------------------------------
 /* This searches the section for a tag that matches the given string. */
-bool pkgTagSection::Find(const char *Tag,unsigned &Pos) const
+bool pkgTagSection::Find(const char *Tag,unsigned int &Pos) const
 {
    unsigned int Length = strlen(Tag);
    unsigned int I = AlphaIndexes[AlphaHash(Tag)];