]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/tagfile.cc
cherry pick 39a07ec8f2c612a5af234c7713571362f7ca90b4
[apt.git] / apt-pkg / tagfile.cc
index 418e6bed81569d4e10e536d6d0bc0fd5c719587a..1c79ee74ffaecc559f2a2daad8a4f63d30bdcce2 100644 (file)
@@ -16,6 +16,7 @@
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
 
 #include <string>
 #include <stdio.h>
@@ -29,7 +30,10 @@ using std::string;
 class pkgTagFilePrivate
 {
 public:
-   pkgTagFilePrivate(FileFd *pFd, unsigned long long Size) : Fd(*pFd), Size(Size)
+   pkgTagFilePrivate(FileFd *pFd, unsigned long long Size) : Fd(*pFd), Buffer(NULL),
+                                                            Start(NULL), End(NULL),
+                                                            Done(false), iOffset(0),
+                                                            Size(Size)
    {
    }
    FileFd &Fd;
@@ -278,10 +282,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)];