]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/edsp/edsplistparser.cc
apply various style suggestions by cppcheck
[apt.git] / apt-pkg / edsp / edsplistparser.cc
index 3e57ea822a28221479d3a00b3d0c504afdb262a1..d1c0cf7e8d95a911d7d178f80619e9bd39360508 100644 (file)
@@ -9,16 +9,20 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/edsplistparser.h>
-#include <apt-pkg/error.h>
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/strutl.h>
 #include <apt-pkg/md5.h>
-#include <apt-pkg/macros.h>
+#include <apt-pkg/deblistparser.h>
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/cacheiterators.h>
+#include <apt-pkg/tagfile.h>
+
+#include <string>
                                                                        /*}}}*/
 
 // ListParser::edspListParser - Constructor                            /*{{{*/
-edspListParser::edspListParser(FileFd *File, string const &Arch) : debListParser(File, Arch)
+edspListParser::edspListParser(FileFd *File, std::string const &Arch) : debListParser(File, Arch)
 {}
                                                                        /*}}}*/
 // ListParser::NewVersion - Fill in the version structure              /*{{{*/
@@ -31,11 +35,11 @@ bool edspListParser::NewVersion(pkgCache::VerIterator &Ver)
 // ListParser::Description - Return the description string             /*{{{*/
 // ---------------------------------------------------------------------
 /* Sorry, no description for the resolvers… */
-string edspListParser::Description()
+std::string edspListParser::Description()
 {
    return "";
 }
-string edspListParser::DescriptionLanguage()
+std::string edspListParser::DescriptionLanguage()
 {
    return "";
 }
@@ -63,47 +67,30 @@ unsigned short edspListParser::VersionHash()
 bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
                                pkgCache::VerIterator &Ver)
 {
-   const char *Start;
-   const char *Stop;
-   if (Section.Find("Status",Start,Stop) == false)
-      return true;
-
-   // UsePackage() is responsible for setting the flag in the default case
-   bool const static essential = _config->Find("pkgCacheGen::Essential", "") == "installed";
-   if (essential == true &&
-       Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false)
+   unsigned long state = 0;
+   if (Section.FindFlag("Hold",state,pkgCache::State::Hold) == false)
       return false;
+   if (state != 0)
+      Pkg->SelectedState = pkgCache::State::Hold;
 
-   // Isolate the first word
-   const char *I = Start;
-   for(; I < Stop && *I != ' '; I++);
-
-   // Process the flag field
-   WordList StatusList[] = {{"installed",pkgCache::State::Installed},
-                            {}};
-   if (GrabWord(string(Start,I-Start),StatusList,Pkg->CurrentState) == false)
-      return _error->Error("Malformed Status line");
-
-   /* A Status line marks the package as indicating the current
-      version as well. Only if it is actually installed.. Otherwise
-      the interesting dpkg handling of the status file creates bogus 
-      entries. */
-   if (!(Pkg->CurrentState == pkgCache::State::NotInstalled ||
-        Pkg->CurrentState == pkgCache::State::ConfigFiles))
+   state = 0;
+   if (Section.FindFlag("Installed",state,pkgCache::State::Installed) == false)
+      return false;
+   if (state != 0)
    {
-      if (Ver.end() == true)
-        _error->Warning("Encountered status field in a non-version description");
-      else
-        Pkg->CurrentVer = Ver.Index();
+      Pkg->CurrentState = pkgCache::State::Installed;
+      Pkg->CurrentVer = Ver.Index();
    }
-   
+
    return true;
 }
                                                                        /*}}}*/
 // ListParser::LoadReleaseInfo - Load the release information          /*{{{*/
-bool edspListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
-                                   FileFd &File, string component)
+APT_CONST bool edspListParser::LoadReleaseInfo(pkgCache::RlsFileIterator & /*FileI*/,
+                                   FileFd & /*File*/, std::string const &/*component*/)
 {
    return true;
 }
                                                                        /*}}}*/
+
+edspListParser::~edspListParser() {}