From c1409d1be88557529c62883be3174793481233de Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 12 Mar 2014 20:33:05 +0100 Subject: add hashsum support in apt-file download and add more tests --- apt-pkg/contrib/fileutl.cc | 11 +++++++++++ apt-pkg/contrib/fileutl.h | 1 + 2 files changed, 12 insertions(+) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 52411a762..79bcf112c 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1841,3 +1841,14 @@ std::string GetTempDir() return string(tmpdir); } + +bool Rename(std::string From, std::string To) +{ + if (rename(From.c_str(),To.c_str()) != 0) + { + _error->Error(_("rename failed, %s (%s -> %s)."),strerror(errno), + From.c_str(),To.c_str()); + return false; + } + return true; +} diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index e752e9621..f0569b6fd 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -164,6 +164,7 @@ bool RealFileExists(std::string File); bool DirectoryExists(std::string const &Path) __attrib_const; bool CreateDirectory(std::string const &Parent, std::string const &Path); time_t GetModificationTime(std::string const &Path); +bool Rename(std::string From, std::string To); std::string GetTempDir(); -- cgit v1.2.3-70-g09d2 From a5414e56403537678d5be87acf59c37a05f55719 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 24 Feb 2014 23:10:25 +0100 Subject: add default and override handling for Cnf::FindVector Automatically handle the override of list options via its parent value which can even be a comma-separated list of values. It also adds an easy way of providing a default for the list. --- apt-pkg/aptconfiguration.cc | 72 ++++++--------------------------------- apt-pkg/contrib/configuration.cc | 14 ++++++-- apt-pkg/contrib/configuration.h | 16 ++++++++- apt-pkg/contrib/strutl.cc | 4 ++- prepare-release | 1 + test/libapt/configuration_test.cc | 34 ++++++++++++++++-- test/libapt/getlanguages_test.cc | 8 +++++ 7 files changed, 81 insertions(+), 68 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index 0b0b546c5..f5c758e14 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -49,11 +49,6 @@ const Configuration::getCompressionTypes(bool const &Cached) { setDefaultConfigurationForCompressors(); std::vector const compressors = getCompressors(); - // accept non-list order as override setting for config settings on commandline - std::string const overrideOrder = _config->Find("Acquire::CompressionTypes::Order",""); - if (overrideOrder.empty() == false) - types.push_back(overrideOrder); - // load the order setting into our vector std::vector const order = _config->FindVector("Acquire::CompressionTypes::Order"); for (std::vector::const_iterator o = order.begin(); @@ -227,61 +222,11 @@ std::vector const Configuration::getLanguages(bool const &All, } } } else { + // cornercase: LANG=C, so we use only "en" Translation environment.push_back("en"); } - // Support settings like Acquire::Languages=none on the command line to - // override the configuration settings vector of languages. - string const forceLang = _config->Find("Acquire::Languages",""); - if (forceLang.empty() == false) { - if (forceLang == "none") { - codes.clear(); - allCodes.clear(); - allCodes.push_back("none"); - } else { - if (forceLang == "environment") - codes = environment; - else - codes.push_back(forceLang); - allCodes = codes; - for (std::vector::const_iterator b = builtin.begin(); - b != builtin.end(); ++b) - if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end()) - allCodes.push_back(*b); - } - if (All == true) - return allCodes; - else - return codes; - } - - // cornercase: LANG=C, so we use only "en" Translation - if (envShort == "C") { - allCodes = codes = environment; - allCodes.insert(allCodes.end(), builtin.begin(), builtin.end()); - if (All == true) - return allCodes; - else - return codes; - } - - std::vector const lang = _config->FindVector("Acquire::Languages"); - // the default setting -> "environment, en" - if (lang.empty() == true) { - codes = environment; - if (envShort != "en") - codes.push_back("en"); - allCodes = codes; - for (std::vector::const_iterator b = builtin.begin(); - b != builtin.end(); ++b) - if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end()) - allCodes.push_back(*b); - if (All == true) - return allCodes; - else - return codes; - } - + std::vector const lang = _config->FindVector("Acquire::Languages", "environment,en"); // the configs define the order, so add the environment // then needed and ensure the codes are not listed twice. bool noneSeen = false; @@ -308,10 +253,15 @@ std::vector const Configuration::getLanguages(bool const &All, allCodes.push_back(*l); } - for (std::vector::const_iterator b = builtin.begin(); - b != builtin.end(); ++b) - if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end()) - allCodes.push_back(*b); + if (allCodes.empty() == false) { + for (std::vector::const_iterator b = builtin.begin(); + b != builtin.end(); ++b) + if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end()) + allCodes.push_back(*b); + } else { + // "none" was forced + allCodes.push_back("none"); + } if (All == true) return allCodes; diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 4ef4663c0..8eddd56d4 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -246,12 +247,18 @@ string Configuration::FindDir(const char *Name,const char *Default) const // Configuration::FindVector - Find a vector of values /*{{{*/ // --------------------------------------------------------------------- /* Returns a vector of config values under the given item */ -vector Configuration::FindVector(const char *Name) const +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13) +vector Configuration::FindVector(const char *Name) const { return FindVector(Name, ""); } +#endif +vector Configuration::FindVector(const char *Name, std::string const &Default) const { vector Vec; const Item *Top = Lookup(Name); if (Top == NULL) - return Vec; + return VectorizeString(Default, ','); + + if (Top->Value.empty() == false) + return VectorizeString(Top->Value, ','); Item *I = Top->Child; while(I != NULL) @@ -259,6 +266,9 @@ vector Configuration::FindVector(const char *Name) const Vec.push_back(I->Value); I = I->Next; } + if (Vec.empty() == true) + return VectorizeString(Default, ','); + return Vec; } /*}}}*/ diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h index 8e09ea0a6..c256139f4 100644 --- a/apt-pkg/contrib/configuration.h +++ b/apt-pkg/contrib/configuration.h @@ -74,8 +74,22 @@ class Configuration std::string Find(std::string const &Name, std::string const &Default) const {return Find(Name.c_str(),Default.c_str());}; std::string FindFile(const char *Name,const char *Default = 0) const; std::string FindDir(const char *Name,const char *Default = 0) const; + /** return a list of child options + * + * Options like Acquire::Languages are handled as lists which + * can be overridden and have a default. For the later two a comma + * separated list of values is supported. + * + * \param Name of the parent node + * \param Default list of values separated by commas */ + std::vector FindVector(const char *Name, std::string const &Default) const; + std::vector FindVector(std::string const &Name, std::string const &Default) const { return FindVector(Name.c_str(), Default); }; +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) + std::vector FindVector(const char *Name) const { return FindVector(Name, ""); }; +#else std::vector FindVector(const char *Name) const; - std::vector FindVector(std::string const &Name) const { return FindVector(Name.c_str()); }; +#endif + std::vector FindVector(std::string const &Name) const { return FindVector(Name.c_str(), ""); }; int FindI(const char *Name,int const &Default = 0) const; int FindI(std::string const &Name,int const &Default = 0) const {return FindI(Name.c_str(),Default);}; bool FindB(const char *Name,bool const &Default = false) const; diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index d4f53ea3a..f8bb3890d 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -1130,9 +1130,11 @@ bool TokSplitString(char Tok,char *Input,char **List, also, but the advantage is that we have an iteratable vector */ vector VectorizeString(string const &haystack, char const &split) { + vector exploded; + if (haystack.empty() == true) + return exploded; string::const_iterator start = haystack.begin(); string::const_iterator end = start; - vector exploded; do { for (; end != haystack.end() && *end != split; ++end); exploded.push_back(string(start, end)); diff --git a/prepare-release b/prepare-release index 6141ce6e4..6229ee1fd 100755 --- a/prepare-release +++ b/prepare-release @@ -1,6 +1,7 @@ #!/bin/sh set -e +cd "$(readlink -f $(dirname $0))" dpkg-checkbuilddeps -d 'libxml2-utils' if [ -n "${GBP_BUILD_DIR}" ]; then diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc index 2c974ee0a..957e905d5 100644 --- a/test/libapt/configuration_test.cc +++ b/test/libapt/configuration_test.cc @@ -98,9 +98,37 @@ int main(int argc,const char *argv[]) { equals(Cnf.FindDir("Dir::State"), "/rootdir/dev/null"); equals(Cnf.FindDir("Dir::State::lists"), "/rootdir/dev/null"); - Cnf.Set("Moo::Bar", "1"); - Cnf.Clear(); - equals(Cnf.Find("Moo::Bar"), ""); + Cnf.Set("Moo::Bar", "1"); + Cnf.Clear(); + equals(Cnf.Find("Moo::Bar"), ""); + + std::vector vec = Cnf.FindVector("Test::Vector", ""); + equals(vec.size(), 0); + vec = Cnf.FindVector("Test::Vector", "foo"); + equals(vec.size(), 1); + equals(vec[0], "foo"); + vec = Cnf.FindVector("Test::Vector", "foo,bar"); + equals(vec.size(), 2); + equals(vec[0], "foo"); + equals(vec[1], "bar"); + Cnf.Set("Test::Vector::", "baz"); + Cnf.Set("Test::Vector::", "bob"); + Cnf.Set("Test::Vector::", "dob"); + vec = Cnf.FindVector("Test::Vector"); + equals(vec.size(), 3); + equals(vec[0], "baz"); + equals(vec[1], "bob"); + equals(vec[2], "dob"); + vec = Cnf.FindVector("Test::Vector", "foo,bar"); + equals(vec.size(), 3); + equals(vec[0], "baz"); + equals(vec[1], "bob"); + equals(vec[2], "dob"); + Cnf.Set("Test::Vector", "abel,bravo"); + vec = Cnf.FindVector("Test::Vector", "foo,bar"); + equals(vec.size(), 2); + equals(vec[0], "abel"); + equals(vec[1], "bravo"); //FIXME: Test for configuration file parsing; // currently only integration/ tests test them implicitly diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc index cef89bde6..51cfecee3 100644 --- a/test/libapt/getlanguages_test.cc +++ b/test/libapt/getlanguages_test.cc @@ -105,6 +105,14 @@ int main(int argc,char *argv[]) vec = APT::Configuration::getLanguages(false, false, env); equals(vec.size(), 1); equals(vec[0], "fr"); + + _config->Set("Acquire::Languages", "environment,en"); + env[0] = "de_DE.UTF-8"; + vec = APT::Configuration::getLanguages(false, false, env); + equals(vec.size(), 3); + equals(vec[0], "de_DE"); + equals(vec[1], "de"); + equals(vec[2], "en"); _config->Set("Acquire::Languages", ""); _config->Set("Acquire::Languages::1", "environment"); -- cgit v1.2.3-70-g09d2 From 255c9e4b74fe677d723c51d3450869ad45ca5463 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 25 Feb 2014 22:10:40 +0100 Subject: make doxygen more quiet, fix issues and disable latex Git-Dch: Ignore --- apt-pkg/acquire-item.h | 15 ++++++++------- apt-pkg/acquire-worker.h | 4 ++-- apt-pkg/acquire.h | 4 ++-- apt-pkg/cachefilter.h | 2 +- apt-pkg/cacheset.h | 7 +++++-- apt-pkg/contrib/error.h | 4 ++-- apt-pkg/depcache.h | 6 +++--- apt-pkg/pkgcache.h | 8 ++++---- doc/Doxyfile.in | 10 +++++----- 9 files changed, 32 insertions(+), 28 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index 5a1c7979c..0524743c6 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -64,7 +64,7 @@ class pkgAcquire::Item : public WeakPointable /** \brief Insert this item into its owner's queue. * - * \param ItemDesc Metadata about this item (its URI and + * \param Item Metadata about this item (its URI and * description). */ inline void QueueURI(ItemDesc &Item) @@ -79,7 +79,7 @@ class pkgAcquire::Item : public WeakPointable * * \param From The file to be renamed. * - * \param To The new name of #From. If #To exists it will be + * \param To The new name of \a From. If \a To exists it will be * overwritten. */ void Rename(std::string From,std::string To); @@ -115,7 +115,7 @@ class pkgAcquire::Item : public WeakPointable } Status; /** \brief Contains a textual description of the error encountered - * if #Status is #StatError or #StatAuthError. + * if #ItemState is #StatError or #StatAuthError. */ std::string ErrorText; @@ -293,7 +293,6 @@ class pkgAcquire::Item : public WeakPointable /** \brief Rename failed file and set error * * \param state respresenting the error we encountered - * \param errorMsg a message describing the error */ bool RenameOnError(RenameOnErrorState const state); }; @@ -636,7 +635,7 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item /** \brief Create an index diff item. * * After filling in its basic fields, this invokes Finish(true) if - * #diffs is empty, or QueueNextDiff() otherwise. + * \a diffs is empty, or QueueNextDiff() otherwise. * * \param Owner The pkgAcquire object that owns this item. * @@ -651,6 +650,8 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item * reconstructed package index file; the index file will be tested * against this value when it is entirely reconstructed. * + * \param ServerSha1 is the sha1sum of the current file on the server + * * \param diffs The remaining diffs from the index of diffs. They * should be ordered so that each diff appears before any diff * that depends on it. @@ -1162,8 +1163,8 @@ class pkgAcqFile : public pkgAcquire::Item * \param IsIndexFile The file is considered a IndexFile and cache-control * headers like "cache-control: max-age=0" are send * - * If DestFilename is empty, download to DestDir/ if - * DestDir is non-empty, $CWD/ otherwise. If + * If DestFilename is empty, download to DestDir/\ if + * DestDir is non-empty, $CWD/\ otherwise. If * DestFilename is NOT empty, DestDir is ignored and DestFilename * is the absolute name to which the file should be downloaded. */ diff --git a/apt-pkg/acquire-worker.h b/apt-pkg/acquire-worker.h index 848a6bad7..a558f69a7 100644 --- a/apt-pkg/acquire-worker.h +++ b/apt-pkg/acquire-worker.h @@ -136,8 +136,8 @@ class pkgAcquire::Worker : public WeakPointable /** \brief Retrieve any available messages from the subprocess. * - * The messages are retrieved as in ::ReadMessages(), and - * MessageFailure() is invoked if an error occurs; in particular, + * The messages are retrieved as in \link strutl.h ReadMessages()\endlink, and + * #MethodFailure() is invoked if an error occurs; in particular, * if the pipe to the subprocess dies unexpectedly while a message * is being read. * diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index 3d5d7a4b7..2c0b37635 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -282,13 +282,13 @@ class pkgAcquire */ void Shutdown(); - /** \brief Get the first #Worker object. + /** \brief Get the first Worker object. * * \return the first active worker in this download process. */ inline Worker *WorkersBegin() {return Workers;}; - /** \brief Advance to the next #Worker object. + /** \brief Advance to the next Worker object. * * \return the worker immediately following I, or \b NULL if none * exists. diff --git a/apt-pkg/cachefilter.h b/apt-pkg/cachefilter.h index 34b7d0b46..81ae1383c 100644 --- a/apt-pkg/cachefilter.h +++ b/apt-pkg/cachefilter.h @@ -47,7 +47,7 @@ public: /** \class PackageArchitectureMatchesSpecification \brief matching against architecture specification strings - The strings are of the format - where either component, + The strings are of the format \-\ where either component, or the whole string, can be the wildcard "any" as defined in debian-policy §11.1 "Architecture specification strings". diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h index b69d74b8e..ce502d8ca 100644 --- a/apt-pkg/cacheset.h +++ b/apt-pkg/cacheset.h @@ -479,14 +479,16 @@ protected: /*{{{*/ /** \brief returns the candidate version of the package \param Cache to be used to query for information - \param Pkg we want the candidate version from this package */ + \param Pkg we want the candidate version from this package + \param helper used in this container instance */ static pkgCache::VerIterator getCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper); /** \brief returns the installed version of the package \param Cache to be used to query for information - \param Pkg we want the installed version from this package */ + \param Pkg we want the installed version from this package + \param helper used in this container instance */ static pkgCache::VerIterator getInstalledVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper); /*}}}*/ @@ -558,6 +560,7 @@ public: /*{{{*/ non specifically requested and executes regex's if needed on names. \param Cache the packages and versions are in \param cmdline Command line the versions should be extracted from + \param fallback version specification \param helper responsible for error and message handling */ static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline, Version const &fallback, CacheSetHelper &helper) { diff --git a/apt-pkg/contrib/error.h b/apt-pkg/contrib/error.h index bcee70b1a..c06e45ee4 100644 --- a/apt-pkg/contrib/error.h +++ b/apt-pkg/contrib/error.h @@ -232,11 +232,11 @@ public: /*{{{*/ * if you want to check if also no notices happened set the parameter * flag to \b false. * - * \param WithoutNotice does notices count, default is \b true, so no + * \param threshold minimim level considered * * \return \b true if an the list is empty, \b false otherwise */ - bool empty(MsgType const &trashhold = WARNING) const; + bool empty(MsgType const &threshold = WARNING) const; /** \brief returns and removes the first (or last) message in the list * diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index f6848f383..a02a86b87 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -381,8 +381,8 @@ class pkgDepCache : protected pkgCache::Namespace /** \brief Update the Marked and Garbage fields of all packages. * * This routine is implicitly invoked after all state manipulators - * and when an ActionGroup is destroyed. It invokes #MarkRequired - * and #Sweep to do its dirty work. + * and when an ActionGroup is destroyed. It invokes the private + * MarkRequired() and Sweep() to do its dirty work. * * \param rootFunc A predicate that returns \b true for packages * that should be added to the root set. @@ -465,7 +465,7 @@ class pkgDepCache : protected pkgCache::Namespace * * The parameters are the same as in the calling MarkDelete: * \param Pkg the package that MarkDelete wants to remove. - * \param Purge should we purge instead of "only" remove? + * \param MarkPurge should we purge instead of "only" remove? * \param Depth recursive deep of this Marker call * \param FromUser was the remove requested by the user? */ diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index c31c5f30b..669904c84 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -451,7 +451,7 @@ struct pkgCache::PackageFile /** \brief Modification time for the file */ time_t mtime; - /* @TODO document PackageFile::Flags */ + /** @TODO document PackageFile::Flags */ unsigned long Flags; // Linked list @@ -474,7 +474,7 @@ struct pkgCache::VerFile map_ptrloc NextFile; // PkgVerFile /** \brief position in the package file */ map_ptrloc Offset; // File offset - /* @TODO document pkgCache::VerFile::Size */ + /** @TODO document pkgCache::VerFile::Size */ unsigned long Size; }; /*}}}*/ @@ -488,7 +488,7 @@ struct pkgCache::DescFile map_ptrloc NextFile; // PkgVerFile /** \brief position in the file */ map_ptrloc Offset; // File offset - /* @TODO document pkgCache::DescFile::Size */ + /** @TODO document pkgCache::DescFile::Size */ unsigned long Size; }; /*}}}*/ @@ -571,7 +571,7 @@ struct pkgCache::Description and to check that the Translation is up-to-date. */ map_ptrloc md5sum; // StringItem - /* @TODO document pkgCache::Description::FileList */ + /** @TODO document pkgCache::Description::FileList */ map_ptrloc FileList; // DescFile /** \brief next translation for this description */ map_ptrloc NextDesc; // Description diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 306bab1dc..ffd7c88b9 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -40,7 +40,7 @@ PROJECT_NUMBER = @PACKAGE_VERSION@ # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = +PROJECT_BRIEF = "commandline package manager" # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not @@ -197,7 +197,7 @@ TAB_SIZE = 8 # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. -ALIASES = +ALIASES = "TODO=\todo" # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding @@ -601,7 +601,7 @@ CITE_BIB_FILES = # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. -QUIET = NO +QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank @@ -748,7 +748,7 @@ IMAGE_PATH = # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. -INPUT_FILTER = +INPUT_FILTER = "sed -e 's#//[ ]*FIXME:\?#/// \\todo#'" # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. @@ -1287,7 +1287,7 @@ EXTRA_SEARCH_MAPPINGS = # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. -GENERATE_LATEX = YES +GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be -- cgit v1.2.3-70-g09d2 From d3e8fbb395f57954acd7a2095f02ce530a05ec6a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 01:20:53 +0100 Subject: warning: extra ‘;’ [-Wpedantic] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Git-Dch: Ignore Reported-By: gcc -Wpedantic --- apt-inst/filelist.h | 152 +++++++++++++------------- apt-pkg/acquire.cc | 2 +- apt-pkg/cacheiterators.h | 226 +++++++++++++++++++-------------------- apt-pkg/cacheset.h | 176 +++++++++++++++--------------- apt-pkg/cdrom.cc | 6 +- apt-pkg/contrib/configuration.cc | 3 +- apt-pkg/contrib/error.cc | 2 +- apt-pkg/contrib/gpgv.h | 2 +- apt-pkg/contrib/progress.cc | 12 +-- apt-pkg/contrib/strutl.cc | 2 +- apt-pkg/contrib/strutl.h | 38 +++---- apt-pkg/depcache.cc | 4 +- apt-pkg/indexcopy.cc | 4 +- apt-pkg/install-progress.cc | 4 +- apt-pkg/install-progress.h | 32 +++--- apt-pkg/pkgcache.cc | 20 ++-- apt-pkg/pkgcache.h | 42 ++++---- apt-pkg/upgrade.h | 2 +- apt-private/acqprogress.cc | 62 +++++------ cmdline/apt-cdrom.cc | 26 ++--- ftparchive/override.cc | 8 +- methods/cdrom.cc | 2 +- methods/http.cc | 6 +- methods/https.cc | 2 +- methods/mirror.cc | 28 ++--- methods/rsh.cc | 2 +- methods/server.cc | 20 ++-- methods/server.h | 2 +- 28 files changed, 443 insertions(+), 444 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-inst/filelist.h b/apt-inst/filelist.h index 0405d61df..8c4891bcf 100644 --- a/apt-inst/filelist.h +++ b/apt-inst/filelist.h @@ -42,25 +42,25 @@ class pkgFLCache struct Package; struct Diversion; struct ConfFile; - + class NodeIterator; class DirIterator; class PkgIterator; class DiverIterator; - + protected: std::string CacheFile; DynamicMMap ⤅ map_ptrloc LastTreeLookup; unsigned long LastLookupSize; - + // Helpers for the addition algorithms map_ptrloc TreeLookup(map_ptrloc *Base,const char *Text,const char *TextEnd, unsigned long Size,unsigned int *Count = 0, bool Insert = false); - + public: - + // Pointers to the arrays of items Header *HeaderP; Node *NodeP; @@ -70,10 +70,10 @@ class pkgFLCache ConfFile *ConfP; char *StrP; unsigned char *AnyP; - + // Quick accessors Node *FileHash; - + // Accessors Header &Head() {return *HeaderP;}; void PrintTree(map_ptrloc Base,unsigned long Size); @@ -89,7 +89,7 @@ class pkgFLCache void DropNode(map_ptrloc Node); inline DiverIterator DiverBegin(); - + // Diversion control void BeginDiverLoad(); void FinishDiverLoad(); @@ -97,7 +97,7 @@ class pkgFLCache const char *To); bool AddConfFile(const char *Name,const char *NameEnd, PkgIterator const &Owner,const unsigned char *Sum); - + pkgFLCache(DynamicMMap &Map); // ~pkgFLCache(); }; @@ -109,7 +109,7 @@ struct pkgFLCache::Header short MajorVersion; short MinorVersion; bool Dirty; - + // Size of structure values unsigned HeaderSz; unsigned NodeSz; @@ -117,7 +117,7 @@ struct pkgFLCache::Header unsigned PackageSz; unsigned DiversionSz; unsigned ConfFileSz; - + // Structure Counts; unsigned int NodeCount; unsigned int DirCount; @@ -126,13 +126,13 @@ struct pkgFLCache::Header unsigned int ConfFileCount; unsigned int HashSize; unsigned long UniqNodes; - + // Offsets map_ptrloc FileHash; map_ptrloc DirTree; map_ptrloc Packages; map_ptrloc Diversions; - + /* Allocation pools, there should be one of these for each structure excluding the header */ DynamicMMap::Pool Pools[5]; @@ -177,7 +177,7 @@ struct pkgFLCache::Diversion map_ptrloc OwnerPkg; // Package map_ptrloc DivertFrom; // Node map_ptrloc DivertTo; // String - + map_ptrloc Next; // Diversion unsigned long Flags; @@ -194,120 +194,120 @@ class pkgFLCache::PkgIterator { Package *Pkg; pkgFLCache *Owner; - + public: - + inline bool end() const {return Owner == 0 || Pkg == Owner->PkgP?true:false;} - + // Accessors - inline Package *operator ->() {return Pkg;}; - inline Package const *operator ->() const {return Pkg;}; - inline Package const &operator *() const {return *Pkg;}; - inline operator Package *() {return Pkg == Owner->PkgP?0:Pkg;}; - inline operator Package const *() const {return Pkg == Owner->PkgP?0:Pkg;}; - - inline unsigned long Offset() const {return Pkg - Owner->PkgP;}; - inline const char *Name() const {return Pkg->Name == 0?0:Owner->StrP + Pkg->Name;}; + inline Package *operator ->() {return Pkg;} + inline Package const *operator ->() const {return Pkg;} + inline Package const &operator *() const {return *Pkg;} + inline operator Package *() {return Pkg == Owner->PkgP?0:Pkg;} + inline operator Package const *() const {return Pkg == Owner->PkgP?0:Pkg;} + + inline unsigned long Offset() const {return Pkg - Owner->PkgP;} + inline const char *Name() const {return Pkg->Name == 0?0:Owner->StrP + Pkg->Name;} inline pkgFLCache::NodeIterator Files() const; - PkgIterator() : Pkg(0), Owner(0) {}; - PkgIterator(pkgFLCache &Owner,Package *Trg) : Pkg(Trg), Owner(&Owner) {}; + PkgIterator() : Pkg(0), Owner(0) {} + PkgIterator(pkgFLCache &Owner,Package *Trg) : Pkg(Trg), Owner(&Owner) {} }; class pkgFLCache::DirIterator { Directory *Dir; pkgFLCache *Owner; - + public: - + // Accessors - inline Directory *operator ->() {return Dir;}; - inline Directory const *operator ->() const {return Dir;}; - inline Directory const &operator *() const {return *Dir;}; - inline operator Directory *() {return Dir == Owner->DirP?0:Dir;}; - inline operator Directory const *() const {return Dir == Owner->DirP?0:Dir;}; + inline Directory *operator ->() {return Dir;} + inline Directory const *operator ->() const {return Dir;} + inline Directory const &operator *() const {return *Dir;} + inline operator Directory *() {return Dir == Owner->DirP?0:Dir;} + inline operator Directory const *() const {return Dir == Owner->DirP?0:Dir;} - inline const char *Name() const {return Dir->Name == 0?0:Owner->StrP + Dir->Name;}; + inline const char *Name() const {return Dir->Name == 0?0:Owner->StrP + Dir->Name;} - DirIterator() : Dir(0), Owner(0) {}; - DirIterator(pkgFLCache &Owner,Directory *Trg) : Dir(Trg), Owner(&Owner) {}; + DirIterator() : Dir(0), Owner(0) {} + DirIterator(pkgFLCache &Owner,Directory *Trg) : Dir(Trg), Owner(&Owner) {} }; class pkgFLCache::DiverIterator { Diversion *Diver; pkgFLCache *Owner; - + public: // Iteration - void operator ++(int) {if (Diver != Owner->DiverP) Diver = Owner->DiverP + Diver->Next;}; - inline void operator ++() {operator ++(0);}; - inline bool end() const {return Owner == 0 || Diver == Owner->DiverP;}; + void operator ++(int) {if (Diver != Owner->DiverP) Diver = Owner->DiverP + Diver->Next;} + inline void operator ++() {operator ++(0);} + inline bool end() const {return Owner == 0 || Diver == Owner->DiverP;} // Accessors - inline Diversion *operator ->() {return Diver;}; - inline Diversion const *operator ->() const {return Diver;}; - inline Diversion const &operator *() const {return *Diver;}; - inline operator Diversion *() {return Diver == Owner->DiverP?0:Diver;}; - inline operator Diversion const *() const {return Diver == Owner->DiverP?0:Diver;}; + inline Diversion *operator ->() {return Diver;} + inline Diversion const *operator ->() const {return Diver;} + inline Diversion const &operator *() const {return *Diver;} + inline operator Diversion *() {return Diver == Owner->DiverP?0:Diver;} + inline operator Diversion const *() const {return Diver == Owner->DiverP?0:Diver;} - inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Diver->OwnerPkg);}; + inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Diver->OwnerPkg);} inline NodeIterator DivertFrom() const; inline NodeIterator DivertTo() const; DiverIterator() : Diver(0), Owner(0) {}; - DiverIterator(pkgFLCache &Owner,Diversion *Trg) : Diver(Trg), Owner(&Owner) {}; + DiverIterator(pkgFLCache &Owner,Diversion *Trg) : Diver(Trg), Owner(&Owner) {} }; class pkgFLCache::NodeIterator { Node *Nde; - enum {NdePkg, NdeHash} Type; + enum {NdePkg, NdeHash} Type; pkgFLCache *Owner; - + public: - + // Iteration - void operator ++(int) {if (Nde != Owner->NodeP) Nde = Owner->NodeP + - (Type == NdePkg?Nde->NextPkg:Nde->Next);}; - inline void operator ++() {operator ++(0);}; - inline bool end() const {return Owner == 0 || Nde == Owner->NodeP;}; + void operator ++(int) {if (Nde != Owner->NodeP) Nde = Owner->NodeP + + (Type == NdePkg?Nde->NextPkg:Nde->Next);} + inline void operator ++() {operator ++(0);} + inline bool end() const {return Owner == 0 || Nde == Owner->NodeP;} // Accessors - inline Node *operator ->() {return Nde;}; - inline Node const *operator ->() const {return Nde;}; - inline Node const &operator *() const {return *Nde;}; - inline operator Node *() {return Nde == Owner->NodeP?0:Nde;}; - inline operator Node const *() const {return Nde == Owner->NodeP?0:Nde;}; - inline unsigned long Offset() const {return Nde - Owner->NodeP;}; - inline DirIterator Dir() const {return DirIterator(*Owner,Owner->DirP + Nde->Dir);}; - inline DiverIterator Diversion() const {return DiverIterator(*Owner,Owner->DiverP + Nde->Pointer);}; - inline const char *File() const {return Nde->File == 0?0:Owner->StrP + Nde->File;}; - inline const char *DirN() const {return Owner->StrP + Owner->DirP[Nde->Dir].Name;}; + inline Node *operator ->() {return Nde;} + inline Node const *operator ->() const {return Nde;} + inline Node const &operator *() const {return *Nde;} + inline operator Node *() {return Nde == Owner->NodeP?0:Nde;} + inline operator Node const *() const {return Nde == Owner->NodeP?0:Nde;} + inline unsigned long Offset() const {return Nde - Owner->NodeP;} + inline DirIterator Dir() const {return DirIterator(*Owner,Owner->DirP + Nde->Dir);} + inline DiverIterator Diversion() const {return DiverIterator(*Owner,Owner->DiverP + Nde->Pointer);} + inline const char *File() const {return Nde->File == 0?0:Owner->StrP + Nde->File;} + inline const char *DirN() const {return Owner->StrP + Owner->DirP[Nde->Dir].Name;} Package *RealPackage() const; - + NodeIterator() : Nde(0), Type(NdeHash), Owner(0) {}; - NodeIterator(pkgFLCache &Owner) : Nde(Owner.NodeP), Type(NdeHash), Owner(&Owner) {}; - NodeIterator(pkgFLCache &Owner,Node *Trg) : Nde(Trg), Type(NdeHash), Owner(&Owner) {}; - NodeIterator(pkgFLCache &Owner,Node *Trg,Package *) : Nde(Trg), Type(NdePkg), Owner(&Owner) {}; + NodeIterator(pkgFLCache &Owner) : Nde(Owner.NodeP), Type(NdeHash), Owner(&Owner) {} + NodeIterator(pkgFLCache &Owner,Node *Trg) : Nde(Trg), Type(NdeHash), Owner(&Owner) {} + NodeIterator(pkgFLCache &Owner,Node *Trg,Package *) : Nde(Trg), Type(NdePkg), Owner(&Owner) {} }; /* Inlines with forward references that cannot be included directly in their respsective classes */ -inline pkgFLCache::NodeIterator pkgFLCache::DiverIterator::DivertFrom() const - {return NodeIterator(*Owner,Owner->NodeP + Diver->DivertFrom);}; +inline pkgFLCache::NodeIterator pkgFLCache::DiverIterator::DivertFrom() const + {return NodeIterator(*Owner,Owner->NodeP + Diver->DivertFrom);} inline pkgFLCache::NodeIterator pkgFLCache::DiverIterator::DivertTo() const - {return NodeIterator(*Owner,Owner->NodeP + Diver->DivertTo);}; + {return NodeIterator(*Owner,Owner->NodeP + Diver->DivertTo);} inline pkgFLCache::NodeIterator pkgFLCache::PkgIterator::Files() const - {return NodeIterator(*Owner,Owner->NodeP + Pkg->Files,Pkg);}; + {return NodeIterator(*Owner,Owner->NodeP + Pkg->Files,Pkg);} inline pkgFLCache::DiverIterator pkgFLCache::DiverBegin() - {return DiverIterator(*this,DiverP + HeaderP->Diversions);}; + {return DiverIterator(*this,DiverP + HeaderP->Diversions);} -inline pkgFLCache::PkgIterator pkgFLCache::GetPkg(const char *Name,bool Insert) - {return GetPkg(Name,Name+strlen(Name),Insert);}; +inline pkgFLCache::PkgIterator pkgFLCache::GetPkg(const char *Name,bool Insert) + {return GetPkg(Name,Name+strlen(Name),Insert);} #endif diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 120e809e1..e8fa68338 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -468,7 +468,7 @@ void pkgAcquire::Bump() pkgAcquire::Worker *pkgAcquire::WorkerStep(Worker *I) { return I->NextAcquire; -}; +} /*}}}*/ // Acquire::Clean - Cleans a directory /*{{{*/ // --------------------------------------------------------------------- diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index ea6a4afba..ca8bc5ca0 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -55,26 +55,26 @@ template class pkgCache::Iterator : public: // Iteration virtual void operator ++(int) = 0; - virtual void operator ++() = 0; // Should be {operator ++(0);}; - inline bool end() const {return Owner == 0 || S == OwnerPointer();}; + virtual void operator ++() = 0; // Should be {operator ++(0);} + inline bool end() const {return Owner == 0 || S == OwnerPointer();} // Comparison - inline bool operator ==(const Itr &B) const {return S == B.S;}; - inline bool operator !=(const Itr &B) const {return S != B.S;}; + inline bool operator ==(const Itr &B) const {return S == B.S;} + inline bool operator !=(const Itr &B) const {return S != B.S;} // Accessors - inline Str *operator ->() {return S;}; - inline Str const *operator ->() const {return S;}; - inline operator Str *() {return S == OwnerPointer() ? 0 : S;}; - inline operator Str const *() const {return S == OwnerPointer() ? 0 : S;}; - inline Str &operator *() {return *S;}; - inline Str const &operator *() const {return *S;}; - inline pkgCache *Cache() const {return Owner;}; + inline Str *operator ->() {return S;} + inline Str const *operator ->() const {return S;} + inline operator Str *() {return S == OwnerPointer() ? 0 : S;} + inline operator Str const *() const {return S == OwnerPointer() ? 0 : S;} + inline Str &operator *() {return *S;} + inline Str const &operator *() const {return *S;} + inline pkgCache *Cache() const {return Owner;} // Mixed stuff - inline void operator =(const Itr &B) {S = B.S; Owner = B.Owner;}; - inline bool IsGood() const { return S && Owner && ! end();}; - inline unsigned long Index() const {return S - OwnerPointer();}; + inline void operator =(const Itr &B) {S = B.S; Owner = B.Owner;} + inline bool IsGood() const { return S && Owner && ! end();} + inline unsigned long Index() const {return S - OwnerPointer();} void ReMap(void const * const oldMap, void const * const newMap) { if (Owner == 0 || S == 0) @@ -83,8 +83,8 @@ template class pkgCache::Iterator : } // Constructors - look out for the variable assigning - inline Iterator() : S(0), Owner(0) {}; - inline Iterator(pkgCache &Owner,Str *T = 0) : S(T), Owner(&Owner) {}; + inline Iterator() : S(0), Owner(0) {} + inline Iterator(pkgCache &Owner,Str *T = 0) : S(T), Owner(&Owner) {} }; /*}}}*/ // Group Iterator /*{{{*/ @@ -98,19 +98,19 @@ class pkgCache::GrpIterator: public Iterator { protected: inline Group* OwnerPointer() const { return (Owner != 0) ? Owner->GrpP : 0; - }; + } public: // This constructor is the 'begin' constructor, never use it. inline GrpIterator(pkgCache &Owner) : Iterator(Owner), HashIndex(-1) { S = OwnerPointer(); operator ++(0); - }; + } virtual void operator ++(int); - virtual void operator ++() {operator ++(0);}; + virtual void operator ++() {operator ++(0);} - inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}; + inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;} inline PkgIterator PackageList() const; PkgIterator FindPkg(std::string Arch = "any") const; /** \brief find the package with the "best" architecture @@ -127,8 +127,8 @@ class pkgCache::GrpIterator: public Iterator { inline GrpIterator(pkgCache &Owner, Group *Trg) : Iterator(Owner, Trg), HashIndex(0) { if (S == 0) S = OwnerPointer(); - }; - inline GrpIterator() : Iterator(), HashIndex(0) {}; + } + inline GrpIterator() : Iterator(), HashIndex(0) {} }; /*}}}*/ @@ -139,27 +139,27 @@ class pkgCache::PkgIterator: public Iterator { protected: inline Package* OwnerPointer() const { return (Owner != 0) ? Owner->PkgP : 0; - }; + } public: // This constructor is the 'begin' constructor, never use it. inline PkgIterator(pkgCache &Owner) : Iterator(Owner), HashIndex(-1) { S = OwnerPointer(); operator ++(0); - }; + } virtual void operator ++(int); - virtual void operator ++() {operator ++(0);}; + virtual void operator ++() {operator ++(0);} enum OkState {NeedsNothing,NeedsUnpack,NeedsConfigure}; // Accessors - inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}; - inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}; + inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;} + inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;} inline bool Purge() const {return S->CurrentState == pkgCache::State::Purge || - (S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);}; - inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;}; - inline GrpIterator Group() const { return GrpIterator(*Owner, Owner->GrpP + S->Group);}; + (S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);} + inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;} + inline GrpIterator Group() const { return GrpIterator(*Owner, Owner->GrpP + S->Group);} inline VerIterator VersionList() const; inline VerIterator CurrentVer() const; @@ -177,8 +177,8 @@ class pkgCache::PkgIterator: public Iterator { inline PkgIterator(pkgCache &Owner,Package *Trg) : Iterator(Owner, Trg), HashIndex(0) { if (S == 0) S = OwnerPointer(); - }; - inline PkgIterator() : Iterator(), HashIndex(0) {}; + } + inline PkgIterator() : Iterator(), HashIndex(0) {} }; /*}}}*/ // Version Iterator /*{{{*/ @@ -186,12 +186,12 @@ class pkgCache::VerIterator : public Iterator { protected: inline Version* OwnerPointer() const { return (Owner != 0) ? Owner->VerP : 0; - }; + } public: // Iteration - void operator ++(int) {if (S != Owner->VerP) S = Owner->VerP + S->NextVer;}; - inline void operator ++() {operator ++(0);}; + void operator ++(int) {if (S != Owner->VerP) S = Owner->VerP + S->NextVer;} + inline void operator ++() {operator ++(0);} // Comparison int CompareVer(const VerIterator &B) const; @@ -201,17 +201,17 @@ class pkgCache::VerIterator : public Iterator { referring to the same "real" version */ inline bool SimilarVer(const VerIterator &B) const { return (B.end() == false && S->Hash == B->Hash && strcmp(VerStr(), B.VerStr()) == 0); - }; + } // Accessors - inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;}; - inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}; + inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;} + inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;} inline const char *Arch() const { if ((S->MultiArch & pkgCache::Version::All) == pkgCache::Version::All) return "all"; return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch; - }; - inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);}; + } + inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);} inline DescIterator DescriptionList() const; DescIterator TranslatedDescription() const; @@ -219,7 +219,7 @@ class pkgCache::VerIterator : public Iterator { inline PrvIterator ProvidesList() const; inline VerFileIterator FileList() const; bool Downloadable() const; - inline const char *PriorityType() const {return Owner->Priority(S->Priority);}; + inline const char *PriorityType() const {return Owner->Priority(S->Priority);} const char *MultiArchType() const; std::string RelStr() const; @@ -229,8 +229,8 @@ class pkgCache::VerIterator : public Iterator { inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Iterator(Owner, Trg) { if (S == 0) S = OwnerPointer(); - }; - inline VerIterator() : Iterator() {}; + } + inline VerIterator() : Iterator() {} }; /*}}}*/ // Description Iterator /*{{{*/ @@ -238,26 +238,26 @@ class pkgCache::DescIterator : public Iterator { protected: inline Description* OwnerPointer() const { return (Owner != 0) ? Owner->DescP : 0; - }; + } public: // Iteration - void operator ++(int) {if (S != Owner->DescP) S = Owner->DescP + S->NextDesc;}; - inline void operator ++() {operator ++(0);}; + void operator ++(int) {if (S != Owner->DescP) S = Owner->DescP + S->NextDesc;} + inline void operator ++() {operator ++(0);} // Comparison int CompareDesc(const DescIterator &B) const; // Accessors - inline const char *LanguageCode() const {return Owner->StrP + S->language_code;}; - inline const char *md5() const {return Owner->StrP + S->md5sum;}; + inline const char *LanguageCode() const {return Owner->StrP + S->language_code;} + inline const char *md5() const {return Owner->StrP + S->md5sum;} inline DescFileIterator FileList() const; - inline DescIterator() : Iterator() {}; + inline DescIterator() : Iterator() {} inline DescIterator(pkgCache &Owner,Description *Trg = 0) : Iterator(Owner, Trg) { if (S == 0) S = Owner.DescP; - }; + } }; /*}}}*/ // Dependency iterator /*{{{*/ @@ -267,21 +267,21 @@ class pkgCache::DepIterator : public Iterator { protected: inline Dependency* OwnerPointer() const { return (Owner != 0) ? Owner->DepP : 0; - }; + } public: // Iteration void operator ++(int) {if (S != Owner->DepP) S = Owner->DepP + - (Type == DepVer ? S->NextDepends : S->NextRevDepends);}; - inline void operator ++() {operator ++(0);}; + (Type == DepVer ? S->NextDepends : S->NextRevDepends);} + inline void operator ++() {operator ++(0);} // Accessors - inline const char *TargetVer() const {return S->Version == 0?0:Owner->StrP + S->Version;}; - inline PkgIterator TargetPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->Package);}; - inline PkgIterator SmartTargetPkg() const {PkgIterator R(*Owner,0);SmartTargetPkg(R);return R;}; - inline VerIterator ParentVer() const {return VerIterator(*Owner,Owner->VerP + S->ParentVer);}; - inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->ParentVer].ParentPkg);}; - inline bool Reverse() const {return Type == DepRev;}; + inline const char *TargetVer() const {return S->Version == 0?0:Owner->StrP + S->Version;} + inline PkgIterator TargetPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->Package);} + inline PkgIterator SmartTargetPkg() const {PkgIterator R(*Owner,0);SmartTargetPkg(R);return R;} + inline VerIterator ParentVer() const {return VerIterator(*Owner,Owner->VerP + S->ParentVer);} + inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->ParentVer].ParentPkg);} + inline bool Reverse() const {return Type == DepRev;} bool IsCritical() const; bool IsNegative() const; bool IsIgnorable(PrvIterator const &Prv) const; @@ -292,8 +292,8 @@ class pkgCache::DepIterator : public Iterator { void GlobOr(DepIterator &Start,DepIterator &End); Version **AllTargets() const; bool SmartTargetPkg(PkgIterator &Result) const; - inline const char *CompType() const {return Owner->CompType(S->CompareOp);}; - inline const char *DepType() const {return Owner->DepType(S->Type);}; + inline const char *CompType() const {return Owner->CompType(S->CompareOp);} + inline const char *DepType() const {return Owner->DepType(S->Type);} //Nice printable representation friend std::ostream& operator <<(std::ostream& out, DepIterator D); @@ -302,13 +302,13 @@ class pkgCache::DepIterator : public Iterator { Iterator(Owner, Trg), Type(DepVer) { if (S == 0) S = Owner.DepP; - }; + } inline DepIterator(pkgCache &Owner, Dependency *Trg, Package*) : Iterator(Owner, Trg), Type(DepRev) { if (S == 0) S = Owner.DepP; - }; - inline DepIterator() : Iterator(), Type(DepVer) {}; + } + inline DepIterator() : Iterator(), Type(DepVer) {} }; /*}}}*/ // Provides iterator /*{{{*/ @@ -318,34 +318,34 @@ class pkgCache::PrvIterator : public Iterator { protected: inline Provides* OwnerPointer() const { return (Owner != 0) ? Owner->ProvideP : 0; - }; + } public: // Iteration void operator ++(int) {if (S != Owner->ProvideP) S = Owner->ProvideP + - (Type == PrvVer?S->NextPkgProv:S->NextProvides);}; - inline void operator ++() {operator ++(0);}; + (Type == PrvVer?S->NextPkgProv:S->NextProvides);} + inline void operator ++() {operator ++(0);} // Accessors - inline const char *Name() const {return Owner->StrP + Owner->PkgP[S->ParentPkg].Name;}; - inline const char *ProvideVersion() const {return S->ProvideVersion == 0?0:Owner->StrP + S->ProvideVersion;}; - inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);}; - inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner->VerP + S->Version);}; - inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->Version].ParentPkg);}; + inline const char *Name() const {return Owner->StrP + Owner->PkgP[S->ParentPkg].Name;} + inline const char *ProvideVersion() const {return S->ProvideVersion == 0?0:Owner->StrP + S->ProvideVersion;} + inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);} + inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner->VerP + S->Version);} + inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->Version].ParentPkg);} bool IsMultiArchImplicit() const; - inline PrvIterator() : Iterator(), Type(PrvVer) {}; + inline PrvIterator() : Iterator(), Type(PrvVer) {} inline PrvIterator(pkgCache &Owner, Provides *Trg, Version*) : Iterator(Owner, Trg), Type(PrvVer) { if (S == 0) S = Owner.ProvideP; - }; + } inline PrvIterator(pkgCache &Owner, Provides *Trg, Package*) : Iterator(Owner, Trg), Type(PrvPkg) { if (S == 0) S = Owner.ProvideP; - }; + } }; /*}}}*/ // Package file /*{{{*/ @@ -353,32 +353,32 @@ class pkgCache::PkgFileIterator : public Iterator protected: inline PackageFile* OwnerPointer() const { return (Owner != 0) ? Owner->PkgFileP : 0; - }; + } public: // Iteration - void operator ++(int) {if (S != Owner->PkgFileP) S = Owner->PkgFileP + S->NextFile;}; - inline void operator ++() {operator ++(0);}; + void operator ++(int) {if (S != Owner->PkgFileP) S = Owner->PkgFileP + S->NextFile;} + inline void operator ++() {operator ++(0);} // Accessors - inline const char *FileName() const {return S->FileName == 0?0:Owner->StrP + S->FileName;}; - inline const char *Archive() const {return S->Archive == 0?0:Owner->StrP + S->Archive;}; - inline const char *Component() const {return S->Component == 0?0:Owner->StrP + S->Component;}; - inline const char *Version() const {return S->Version == 0?0:Owner->StrP + S->Version;}; - inline const char *Origin() const {return S->Origin == 0?0:Owner->StrP + S->Origin;}; - inline const char *Codename() const {return S->Codename ==0?0:Owner->StrP + S->Codename;}; - inline const char *Label() const {return S->Label == 0?0:Owner->StrP + S->Label;}; - inline const char *Site() const {return S->Site == 0?0:Owner->StrP + S->Site;}; - inline const char *Architecture() const {return S->Architecture == 0?0:Owner->StrP + S->Architecture;}; - inline const char *IndexType() const {return S->IndexType == 0?0:Owner->StrP + S->IndexType;}; + inline const char *FileName() const {return S->FileName == 0?0:Owner->StrP + S->FileName;} + inline const char *Archive() const {return S->Archive == 0?0:Owner->StrP + S->Archive;} + inline const char *Component() const {return S->Component == 0?0:Owner->StrP + S->Component;} + inline const char *Version() const {return S->Version == 0?0:Owner->StrP + S->Version;} + inline const char *Origin() const {return S->Origin == 0?0:Owner->StrP + S->Origin;} + inline const char *Codename() const {return S->Codename ==0?0:Owner->StrP + S->Codename;} + inline const char *Label() const {return S->Label == 0?0:Owner->StrP + S->Label;} + inline const char *Site() const {return S->Site == 0?0:Owner->StrP + S->Site;} + inline const char *Architecture() const {return S->Architecture == 0?0:Owner->StrP + S->Architecture;} + inline const char *IndexType() const {return S->IndexType == 0?0:Owner->StrP + S->IndexType;} bool IsOk(); std::string RelStr(); // Constructors - inline PkgFileIterator() : Iterator() {}; - inline PkgFileIterator(pkgCache &Owner) : Iterator(Owner, Owner.PkgFileP) {}; - inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Iterator(Owner, Trg) {}; + inline PkgFileIterator() : Iterator() {} + inline PkgFileIterator(pkgCache &Owner) : Iterator(Owner, Owner.PkgFileP) {} + inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Iterator(Owner, Trg) {} }; /*}}}*/ // Version File /*{{{*/ @@ -386,18 +386,18 @@ class pkgCache::VerFileIterator : public pkgCache::IteratorVerFileP : 0; - }; + } public: // Iteration - void operator ++(int) {if (S != Owner->VerFileP) S = Owner->VerFileP + S->NextFile;}; - inline void operator ++() {operator ++(0);}; + void operator ++(int) {if (S != Owner->VerFileP) S = Owner->VerFileP + S->NextFile;} + inline void operator ++() {operator ++(0);} // Accessors - inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);}; + inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);} - inline VerFileIterator() : Iterator() {}; - inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Iterator(Owner, Trg) {}; + inline VerFileIterator() : Iterator() {} + inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Iterator(Owner, Trg) {} }; /*}}}*/ // Description File /*{{{*/ @@ -405,40 +405,40 @@ class pkgCache::DescFileIterator : public Iterator { protected: inline DescFile* OwnerPointer() const { return (Owner != 0) ? Owner->DescFileP : 0; - }; + } public: // Iteration - void operator ++(int) {if (S != Owner->DescFileP) S = Owner->DescFileP + S->NextFile;}; - inline void operator ++() {operator ++(0);}; + void operator ++(int) {if (S != Owner->DescFileP) S = Owner->DescFileP + S->NextFile;} + inline void operator ++() {operator ++(0);} // Accessors - inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);}; + inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);} - inline DescFileIterator() : Iterator() {}; - inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Iterator(Owner, Trg) {}; + inline DescFileIterator() : Iterator() {} + inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Iterator(Owner, Trg) {} }; /*}}}*/ // Inlined Begin functions can't be in the class because of order problems /*{{{*/ inline pkgCache::PkgIterator pkgCache::GrpIterator::PackageList() const - {return PkgIterator(*Owner,Owner->PkgP + S->FirstPackage);}; + {return PkgIterator(*Owner,Owner->PkgP + S->FirstPackage);} inline pkgCache::VerIterator pkgCache::PkgIterator::VersionList() const - {return VerIterator(*Owner,Owner->VerP + S->VersionList);}; + {return VerIterator(*Owner,Owner->VerP + S->VersionList);} inline pkgCache::VerIterator pkgCache::PkgIterator::CurrentVer() const - {return VerIterator(*Owner,Owner->VerP + S->CurrentVer);}; + {return VerIterator(*Owner,Owner->VerP + S->CurrentVer);} inline pkgCache::DepIterator pkgCache::PkgIterator::RevDependsList() const - {return DepIterator(*Owner,Owner->DepP + S->RevDepends,S);}; + {return DepIterator(*Owner,Owner->DepP + S->RevDepends,S);} inline pkgCache::PrvIterator pkgCache::PkgIterator::ProvidesList() const - {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);}; + {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);} inline pkgCache::DescIterator pkgCache::VerIterator::DescriptionList() const - {return DescIterator(*Owner,Owner->DescP + S->DescriptionList);}; + {return DescIterator(*Owner,Owner->DescP + S->DescriptionList);} inline pkgCache::PrvIterator pkgCache::VerIterator::ProvidesList() const - {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);}; + {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);} inline pkgCache::DepIterator pkgCache::VerIterator::DependsList() const - {return DepIterator(*Owner,Owner->DepP + S->DependsList,S);}; + {return DepIterator(*Owner,Owner->DepP + S->DependsList,S);} inline pkgCache::VerFileIterator pkgCache::VerIterator::FileList() const - {return VerFileIterator(*Owner,Owner->VerFileP + S->FileList);}; + {return VerFileIterator(*Owner,Owner->VerFileP + S->FileList);} inline pkgCache::DescFileIterator pkgCache::DescIterator::FileList() const - {return DescFileIterator(*Owner,Owner->DescFileP + S->FileList);}; + {return DescFileIterator(*Owner,Owner->DescFileP + S->FileList);} /*}}}*/ #endif diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h index ce502d8ca..ef28bbc34 100644 --- a/apt-pkg/cacheset.h +++ b/apt-pkg/cacheset.h @@ -43,8 +43,8 @@ class CacheSetHelper { /*{{{*/ public: /*{{{*/ CacheSetHelper(bool const ShowError = true, GlobalError::MsgType ErrorType = GlobalError::ERROR) : - ShowError(ShowError), ErrorType(ErrorType) {}; - virtual ~CacheSetHelper() {}; + ShowError(ShowError), ErrorType(ErrorType) {} + virtual ~CacheSetHelper() {} virtual void showTaskSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern); virtual void showRegExSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern); @@ -76,9 +76,9 @@ public: /*{{{*/ virtual pkgCache::VerIterator canNotFindInstalledVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg); - bool showErrors() const { return ShowError; }; - bool showErrors(bool const newValue) { if (ShowError == newValue) return ShowError; else return ((ShowError = newValue) == false); }; - GlobalError::MsgType errorType() const { return ErrorType; }; + bool showErrors() const { return ShowError; } + bool showErrors(bool const newValue) { if (ShowError == newValue) return ShowError; else return ((ShowError = newValue) == false); } + GlobalError::MsgType errorType() const { return ErrorType; } GlobalError::MsgType errorType(GlobalError::MsgType const &newValue) { if (ErrorType == newValue) return ErrorType; @@ -87,7 +87,7 @@ public: /*{{{*/ ErrorType = newValue; return oldValue; } - }; + } /*}}}*/ protected: @@ -124,12 +124,12 @@ public: inline pkgCache::PkgIterator::OkState State() const { return getPkg().State(); } inline const char *CandVersion() const { return getPkg().CandVersion(); } inline const char *CurVersion() const { return getPkg().CurVersion(); } - inline pkgCache *Cache() const { return getPkg().Cache(); }; - inline unsigned long Index() const {return getPkg().Index();}; + inline pkgCache *Cache() const { return getPkg().Cache(); } + inline unsigned long Index() const {return getPkg().Index();} // we have only valid iterators here - inline bool end() const { return false; }; + inline bool end() const { return false; } - inline pkgCache::Package const * operator->() const {return &*getPkg();}; + inline pkgCache::Package const * operator->() const {return &*getPkg();} }; /*}}}*/ @@ -154,7 +154,7 @@ public: unsigned short ID; const char * const Alias; Position Pos; - Modifier (unsigned short const &id, const char * const alias, Position const &pos) : ID(id), Alias(alias), Pos(pos) {}; + Modifier (unsigned short const &id, const char * const alias, Position const &pos) : ID(id), Alias(alias), Pos(pos) {} }; static bool FromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci, @@ -177,12 +177,12 @@ public: /*{{{*/ public: const_iterator(typename Container::const_iterator i) : _iter(i) {} pkgCache::PkgIterator getPkg(void) const { return *_iter; } - inline pkgCache::PkgIterator operator*(void) const { return *_iter; }; + inline pkgCache::PkgIterator operator*(void) const { return *_iter; } operator typename Container::const_iterator(void) const { return _iter; } inline const_iterator& operator++() { ++_iter; return *this; } inline const_iterator operator++(int) { const_iterator tmp(*this); operator++(); return tmp; } - inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; }; - inline bool operator==(const_iterator const &i) const { return _iter == i._iter; }; + inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; } + inline bool operator==(const_iterator const &i) const { return _iter == i._iter; } friend std::ostream& operator<<(std::ostream& out, const_iterator i) { return operator<<(out, *i); } }; class iterator : public PackageContainerInterface::const_iterator, @@ -191,43 +191,43 @@ public: /*{{{*/ public: iterator(typename Container::iterator i) : _iter(i) {} pkgCache::PkgIterator getPkg(void) const { return *_iter; } - inline pkgCache::PkgIterator operator*(void) const { return *_iter; }; + inline pkgCache::PkgIterator operator*(void) const { return *_iter; } operator typename Container::iterator(void) const { return _iter; } operator typename PackageContainer::const_iterator() { return typename PackageContainer::const_iterator(_iter); } inline iterator& operator++() { ++_iter; return *this; } inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; } - inline bool operator!=(iterator const &i) const { return _iter != i._iter; }; - inline bool operator==(iterator const &i) const { return _iter == i._iter; }; - inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; }; - inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; }; + inline bool operator!=(iterator const &i) const { return _iter != i._iter; } + inline bool operator==(iterator const &i) const { return _iter == i._iter; } + inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; } + inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; } friend std::ostream& operator<<(std::ostream& out, iterator i) { return operator<<(out, *i); } }; /*}}}*/ - bool insert(pkgCache::PkgIterator const &P) { if (P.end() == true) return false; _cont.insert(P); return true; }; - template void insert(PackageContainer const &pkgcont) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typename Cont::const_iterator)pkgcont.end()); }; - void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }; + bool insert(pkgCache::PkgIterator const &P) { if (P.end() == true) return false; _cont.insert(P); return true; } + template void insert(PackageContainer const &pkgcont) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typename Cont::const_iterator)pkgcont.end()); } + void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); } - bool empty() const { return _cont.empty(); }; - void clear() { return _cont.clear(); }; + bool empty() const { return _cont.empty(); } + void clear() { return _cont.clear(); } //FIXME: on ABI break, replace the first with the second without bool - void erase(iterator position) { _cont.erase((typename Container::iterator)position); }; - iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); }; - size_t erase(const pkgCache::PkgIterator x) { return _cont.erase(x); }; - void erase(iterator first, iterator last) { _cont.erase(first, last); }; - size_t size() const { return _cont.size(); }; + void erase(iterator position) { _cont.erase((typename Container::iterator)position); } + iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); } + size_t erase(const pkgCache::PkgIterator x) { return _cont.erase(x); } + void erase(iterator first, iterator last) { _cont.erase(first, last); } + size_t size() const { return _cont.size(); } - const_iterator begin() const { return const_iterator(_cont.begin()); }; - const_iterator end() const { return const_iterator(_cont.end()); }; - iterator begin() { return iterator(_cont.begin()); }; - iterator end() { return iterator(_cont.end()); }; - const_iterator find(pkgCache::PkgIterator const &P) const { return const_iterator(_cont.find(P)); }; + const_iterator begin() const { return const_iterator(_cont.begin()); } + const_iterator end() const { return const_iterator(_cont.end()); } + iterator begin() { return iterator(_cont.begin()); } + iterator end() { return iterator(_cont.end()); } + const_iterator find(pkgCache::PkgIterator const &P) const { return const_iterator(_cont.find(P)); } - void setConstructor(Constructor const &by) { ConstructedBy = by; }; - Constructor getConstructor() const { return ConstructedBy; }; + void setConstructor(Constructor const &by) { ConstructedBy = by; } + Constructor getConstructor() const { return ConstructedBy; } - PackageContainer() : ConstructedBy(UNKNOWN) {}; - PackageContainer(Constructor const &by) : ConstructedBy(by) {}; + PackageContainer() : ConstructedBy(UNKNOWN) {} + PackageContainer(Constructor const &by) : ConstructedBy(by) {} /** \brief returns all packages in the cache who belong to the given task @@ -365,7 +365,7 @@ private: /*{{{*/ template<> template void PackageContainer >::insert(PackageContainer const &pkgcont) { for (typename PackageContainer::const_iterator p = pkgcont.begin(); p != pkgcont.end(); ++p) _cont.push_back(*p); -}; +} // these two are 'inline' as otherwise the linker has problems with seeing these untemplated // specializations again and again - but we need to see them, so that library users can use them template<> inline bool PackageContainer >::insert(pkgCache::PkgIterator const &P) { @@ -373,11 +373,11 @@ template<> inline bool PackageContainer >::inse return false; _cont.push_back(P); return true; -}; +} template<> inline void PackageContainer >::insert(const_iterator begin, const_iterator end) { for (const_iterator p = begin; p != end; ++p) _cont.push_back(*p); -}; +} typedef PackageContainer > PackageSet; typedef PackageContainer > PackageList; @@ -392,27 +392,27 @@ public: virtual pkgCache::VerIterator getVer() const = 0; operator pkgCache::VerIterator(void) { return getVer(); } - inline pkgCache *Cache() const { return getVer().Cache(); }; - inline unsigned long Index() const {return getVer().Index();}; - inline int CompareVer(const pkgCache::VerIterator &B) const { return getVer().CompareVer(B); }; - inline const char *VerStr() const { return getVer().VerStr(); }; - inline const char *Section() const { return getVer().Section(); }; - inline const char *Arch() const { return getVer().Arch(); }; - inline pkgCache::PkgIterator ParentPkg() const { return getVer().ParentPkg(); }; - inline pkgCache::DescIterator DescriptionList() const { return getVer().DescriptionList(); }; - inline pkgCache::DescIterator TranslatedDescription() const { return getVer().TranslatedDescription(); }; - inline pkgCache::DepIterator DependsList() const { return getVer().DependsList(); }; - inline pkgCache::PrvIterator ProvidesList() const { return getVer().ProvidesList(); }; - inline pkgCache::VerFileIterator FileList() const { return getVer().FileList(); }; - inline bool Downloadable() const { return getVer().Downloadable(); }; - inline const char *PriorityType() const { return getVer().PriorityType(); }; - inline std::string RelStr() const { return getVer().RelStr(); }; - inline bool Automatic() const { return getVer().Automatic(); }; - inline pkgCache::VerFileIterator NewestFile() const { return getVer().NewestFile(); }; + inline pkgCache *Cache() const { return getVer().Cache(); } + inline unsigned long Index() const {return getVer().Index();} + inline int CompareVer(const pkgCache::VerIterator &B) const { return getVer().CompareVer(B); } + inline const char *VerStr() const { return getVer().VerStr(); } + inline const char *Section() const { return getVer().Section(); } + inline const char *Arch() const { return getVer().Arch(); } + inline pkgCache::PkgIterator ParentPkg() const { return getVer().ParentPkg(); } + inline pkgCache::DescIterator DescriptionList() const { return getVer().DescriptionList(); } + inline pkgCache::DescIterator TranslatedDescription() const { return getVer().TranslatedDescription(); } + inline pkgCache::DepIterator DependsList() const { return getVer().DependsList(); } + inline pkgCache::PrvIterator ProvidesList() const { return getVer().ProvidesList(); } + inline pkgCache::VerFileIterator FileList() const { return getVer().FileList(); } + inline bool Downloadable() const { return getVer().Downloadable(); } + inline const char *PriorityType() const { return getVer().PriorityType(); } + inline std::string RelStr() const { return getVer().RelStr(); } + inline bool Automatic() const { return getVer().Automatic(); } + inline pkgCache::VerFileIterator NewestFile() const { return getVer().NewestFile(); } // we have only valid iterators here - inline bool end() const { return false; }; + inline bool end() const { return false; } - inline pkgCache::Version const * operator->() const { return &*getVer(); }; + inline pkgCache::Version const * operator->() const { return &*getVer(); } }; /*}}}*/ @@ -446,7 +446,7 @@ public: Version SelectVersion; Modifier (unsigned short const &id, const char * const alias, Position const &pos, Version const &select) : ID(id), Alias(alias), Pos(pos), - SelectVersion(select) {}; + SelectVersion(select) {} }; static bool FromCommandLine(VersionContainerInterface * const vci, pkgCacheFile &Cache, @@ -509,12 +509,12 @@ public: /*{{{*/ public: const_iterator(typename Container::const_iterator i) : _iter(i) {} pkgCache::VerIterator getVer(void) const { return *_iter; } - inline pkgCache::VerIterator operator*(void) const { return *_iter; }; + inline pkgCache::VerIterator operator*(void) const { return *_iter; } operator typename Container::const_iterator(void) const { return _iter; } inline const_iterator& operator++() { ++_iter; return *this; } inline const_iterator operator++(int) { const_iterator tmp(*this); operator++(); return tmp; } - inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; }; - inline bool operator==(const_iterator const &i) const { return _iter == i._iter; }; + inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; } + inline bool operator==(const_iterator const &i) const { return _iter == i._iter; } friend std::ostream& operator<<(std::ostream& out, const_iterator i) { return operator<<(out, *i); } }; class iterator : public VersionContainerInterface::const_iterator, @@ -523,36 +523,36 @@ public: /*{{{*/ public: iterator(typename Container::iterator i) : _iter(i) {} pkgCache::VerIterator getVer(void) const { return *_iter; } - inline pkgCache::VerIterator operator*(void) const { return *_iter; }; + inline pkgCache::VerIterator operator*(void) const { return *_iter; } operator typename Container::iterator(void) const { return _iter; } operator typename VersionContainer::const_iterator() { return typename VersionContainer::const_iterator(_iter); } inline iterator& operator++() { ++_iter; return *this; } inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; } - inline bool operator!=(iterator const &i) const { return _iter != i._iter; }; - inline bool operator==(iterator const &i) const { return _iter == i._iter; }; - inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; }; - inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; }; + inline bool operator!=(iterator const &i) const { return _iter != i._iter; } + inline bool operator==(iterator const &i) const { return _iter == i._iter; } + inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; } + inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; } friend std::ostream& operator<<(std::ostream& out, iterator i) { return operator<<(out, *i); } }; /*}}}*/ - bool insert(pkgCache::VerIterator const &V) { if (V.end() == true) return false; _cont.insert(V); return true; }; - template void insert(VersionContainer const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); }; - void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }; - bool empty() const { return _cont.empty(); }; - void clear() { return _cont.clear(); }; + bool insert(pkgCache::VerIterator const &V) { if (V.end() == true) return false; _cont.insert(V); return true; } + template void insert(VersionContainer const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); } + void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); } + bool empty() const { return _cont.empty(); } + void clear() { return _cont.clear(); } //FIXME: on ABI break, replace the first with the second without bool - void erase(iterator position) { _cont.erase((typename Container::iterator)position); }; - iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); }; - size_t erase(const pkgCache::VerIterator x) { return _cont.erase(x); }; - void erase(iterator first, iterator last) { _cont.erase(first, last); }; - size_t size() const { return _cont.size(); }; - - const_iterator begin() const { return const_iterator(_cont.begin()); }; - const_iterator end() const { return const_iterator(_cont.end()); }; - iterator begin() { return iterator(_cont.begin()); }; - iterator end() { return iterator(_cont.end()); }; - const_iterator find(pkgCache::VerIterator const &V) const { return const_iterator(_cont.find(V)); }; + void erase(iterator position) { _cont.erase((typename Container::iterator)position); } + iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); } + size_t erase(const pkgCache::VerIterator x) { return _cont.erase(x); } + void erase(iterator first, iterator last) { _cont.erase(first, last); } + size_t size() const { return _cont.size(); } + + const_iterator begin() const { return const_iterator(_cont.begin()); } + const_iterator end() const { return const_iterator(_cont.end()); } + iterator begin() { return iterator(_cont.begin()); } + iterator end() { return iterator(_cont.end()); } + const_iterator find(pkgCache::VerIterator const &V) const { return const_iterator(_cont.find(V)); } /** \brief returns all versions specified on the commandline @@ -659,7 +659,7 @@ public: /*{{{*/ template<> template void VersionContainer >::insert(VersionContainer const &vercont) { for (typename VersionContainer::const_iterator v = vercont.begin(); v != vercont.end(); ++v) _cont.push_back(*v); -}; +} // these two are 'inline' as otherwise the linker has problems with seeing these untemplated // specializations again and again - but we need to see them, so that library users can use them template<> inline bool VersionContainer >::insert(pkgCache::VerIterator const &V) { @@ -667,11 +667,11 @@ template<> inline bool VersionContainer >::inse return false; _cont.push_back(V); return true; -}; +} template<> inline void VersionContainer >::insert(const_iterator begin, const_iterator end) { for (const_iterator v = begin; v != end; ++v) _cont.push_back(*v); -}; +} typedef VersionContainer > VersionSet; typedef VersionContainer > VersionList; } diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 3ae1e8b1d..838c8887a 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -933,10 +933,10 @@ pkgUdevCdromDevices::Dlopen() /*{{{*/ // convenience interface, this will just call ScanForRemovable vector pkgUdevCdromDevices::Scan() -{ +{ bool CdromOnly = _config->FindB("APT::cdrom::CdromOnly", true); - return ScanForRemovable(CdromOnly); -}; + return ScanForRemovable(CdromOnly); +} /*}}}*/ /*{{{*/ vector diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 8eddd56d4..003fd01d8 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -43,8 +43,7 @@ Configuration::Configuration() : ToFree(true) } Configuration::Configuration(const Item *Root) : Root((Item *)Root), ToFree(false) { -}; - +} /*}}}*/ // Configuration::~Configuration - Destructor /*{{{*/ // --------------------------------------------------------------------- diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc index d457781c3..2d25f5ed9 100644 --- a/apt-pkg/contrib/error.cc +++ b/apt-pkg/contrib/error.cc @@ -223,7 +223,7 @@ void GlobalError::DumpErrors(std::ostream &out, MsgType const &threshold, void GlobalError::Discard() { Messages.clear(); PendingFlag = false; -}; +} /*}}}*/ // GlobalError::empty - does our error list include anything? /*{{{*/ bool GlobalError::empty(MsgType const &trashhold) const { diff --git a/apt-pkg/contrib/gpgv.h b/apt-pkg/contrib/gpgv.h index 1d79a52ac..d9712d6a8 100644 --- a/apt-pkg/contrib/gpgv.h +++ b/apt-pkg/contrib/gpgv.h @@ -45,7 +45,7 @@ inline void ExecGPGV(std::string const &File, std::string const &FileSig, int const &statusfd = -1) { int fd[2]; ExecGPGV(File, FileSig, statusfd, fd); -}; +} #undef APT_noreturn diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc index 916e1d730..9d74ed495 100644 --- a/apt-pkg/contrib/progress.cc +++ b/apt-pkg/contrib/progress.cc @@ -125,14 +125,14 @@ bool OpProgress::CheckChange(float Interval) // OpTextProgress::OpTextProgress - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ -OpTextProgress::OpTextProgress(Configuration &Config) : - NoUpdate(false), NoDisplay(false), LastLen(0) +OpTextProgress::OpTextProgress(Configuration &Config) : + NoUpdate(false), NoDisplay(false), LastLen(0) { if (Config.FindI("quiet",0) >= 1 || Config.FindB("quiet::NoUpdate", false) == true) NoUpdate = true; if (Config.FindI("quiet",0) >= 2) NoDisplay = true; -}; +} /*}}}*/ // OpTextProgress::Done - Clean up the display /*{{{*/ // --------------------------------------------------------------------- @@ -150,12 +150,12 @@ void OpTextProgress::Done() cout << endl; OldOp = string(); } - + if (NoUpdate == true && NoDisplay == false && OldOp.empty() == false) { OldOp = string(); - cout << endl; - } + cout << endl; + } } /*}}}*/ // OpTextProgress::Update - Simple text spinner /*{{{*/ diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index f8bb3890d..0d85b4fd3 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -153,7 +153,7 @@ char *_strrstrip(char *String) End++; *End = 0; return String; -}; +} /*}}}*/ // strtabexpand - Converts tabs into 8 spaces /*{{{*/ // --------------------------------------------------------------------- diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index 8d746f10e..3a6d38b75 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -37,8 +37,8 @@ namespace APT { namespace String { std::string Strip(const std::string &s); bool Endswith(const std::string &s, const std::string &ending); - }; -}; + } +} bool UTF8ToCodeset(const char *codeset, const std::string &orig, std::string *dest); @@ -104,17 +104,17 @@ int tolower_ascii(int const c) __attrib_const __hot; std::string StripEpoch(const std::string &VerStr); #define APT_MKSTRCMP(name,func) \ -inline int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));}; \ -inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \ -inline int name(const std::string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));}; \ -inline int name(const std::string& A,const std::string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());}; \ -inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);}; +inline int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));} \ +inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));} \ +inline int name(const std::string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));} \ +inline int name(const std::string& A,const std::string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());} \ +inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);} #define APT_MKSTRCMP2(name,func) \ -inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \ -inline int name(const std::string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));}; \ -inline int name(const std::string& A,const std::string& B) {return func(A.begin(),A.end(),B.begin(),B.end());}; \ -inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);}; +inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));} \ +inline int name(const std::string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));} \ +inline int name(const std::string& A,const std::string& B) {return func(A.begin(),A.end(),B.begin(),B.end());} \ +inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);} int stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd); int stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd); @@ -132,18 +132,18 @@ int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, std::string::const_iterator B,std::string::const_iterator BEnd); -inline int stringcmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));}; -inline int stringcasecmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));}; +inline int stringcmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));} +inline int stringcasecmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));} #endif -APT_MKSTRCMP2(stringcmp,stringcmp); -APT_MKSTRCMP2(stringcasecmp,stringcasecmp); +APT_MKSTRCMP2(stringcmp,stringcmp) +APT_MKSTRCMP2(stringcasecmp,stringcasecmp) // Return the length of a NULL-terminated string array size_t strv_length(const char **str_array); -inline const char *DeNull(const char *s) {return (s == 0?"(null)":s);}; +inline const char *DeNull(const char *s) {return (s == 0?"(null)":s);} class URI { @@ -159,13 +159,13 @@ class URI unsigned int Port; operator std::string(); - inline void operator =(const std::string &From) {CopyFrom(From);}; + inline void operator =(const std::string &From) {CopyFrom(From);} inline bool empty() {return Access.empty();}; static std::string SiteOnly(const std::string &URI); static std::string NoUserPassword(const std::string &URI); - URI(std::string Path) {CopyFrom(Path);}; - URI() : Port(0) {}; + URI(std::string Path) {CopyFrom(Path);} + URI() : Port(0) {} }; struct SubstVar diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index a12e6963d..90d0c9314 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1686,9 +1686,9 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator const &Dep) /*}}}*/ // Policy::GetPriority - Get the priority of the package pin /*{{{*/ signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgIterator const &Pkg) -{ return 0; }; +{ return 0; } signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgFileIterator const &File) -{ return 0; }; +{ return 0; } /*}}}*/ pkgDepCache::InRootSetFunc *pkgDepCache::GetRootSetFunc() /*{{{*/ { diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index 9ea244139..89c9d531f 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -646,12 +646,12 @@ bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut, int const &statusfd, int fd[2]) { ExecGPGV(File, FileOut, statusfd, fd); return false; -}; +} bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut, int const &statusfd) { ExecGPGV(File, FileOut, statusfd); return false; -}; +} /*}}}*/ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/ vector &List, pkgCdromStatus *log) diff --git a/apt-pkg/install-progress.cc b/apt-pkg/install-progress.cc index a3a4cc0e1..aec744360 100644 --- a/apt-pkg/install-progress.cc +++ b/apt-pkg/install-progress.cc @@ -371,5 +371,5 @@ bool PackageManagerText::StatusChanged(std::string PackageName, -}; // namespace progress -}; // namespace apt +} // namespace progress +} // namespace apt diff --git a/apt-pkg/install-progress.h b/apt-pkg/install-progress.h index 8a5b68a8f..8bcc32927 100644 --- a/apt-pkg/install-progress.h +++ b/apt-pkg/install-progress.h @@ -24,7 +24,7 @@ namespace Progress { int last_reported_progress; public: - PackageManager() + PackageManager() : percentage(0.0), last_reported_progress(-1) {}; virtual ~PackageManager() {}; @@ -32,8 +32,8 @@ namespace Progress { virtual void Start(int child_pty=-1) {}; virtual void Stop() {}; - /* When dpkg is invoked (may happen multiple times for each - * install/remove block + /* When dpkg is invoked (may happen multiple times for each + * install/remove block */ virtual void StartDpkg() {}; @@ -44,18 +44,18 @@ namespace Progress { return 500000; }; - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, - std::string HumanReadableAction) ; - virtual void Error(std::string PackageName, + std::string HumanReadableAction); + virtual void Error(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, - std::string ErrorMessage) {}; + std::string ErrorMessage) {} virtual void ConffilePrompt(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, - std::string ConfMessage) {}; + std::string ConfMessage) {} }; class PackageManagerProgressFd : public PackageManager @@ -72,11 +72,11 @@ namespace Progress { virtual void StartDpkg(); virtual void Stop(); - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); - virtual void Error(std::string PackageName, + virtual void Error(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string ErrorMessage); @@ -101,11 +101,11 @@ namespace Progress { virtual void StartDpkg(); virtual void Stop(); - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); - virtual void Error(std::string PackageName, + virtual void Error(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string ErrorMessage); @@ -134,7 +134,7 @@ namespace Progress { ~PackageManagerFancy(); virtual void Start(int child_pty=-1); virtual void Stop(); - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); @@ -143,14 +143,14 @@ namespace Progress { class PackageManagerText : public PackageManager { public: - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); }; -}; // namespace Progress -}; // namespace APT +} // namespace Progress +} // namespace APT #endif diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 67a2a709d..7d57640c5 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -414,7 +414,7 @@ pkgCache::PkgIterator pkgCache::GrpIterator::NextPkg(pkgCache::PkgIterator const // GrpIterator::operator ++ - Postfix incr /*{{{*/ // --------------------------------------------------------------------- /* This will advance to the next logical group in the hash table. */ -void pkgCache::GrpIterator::operator ++(int) +void pkgCache::GrpIterator::operator ++(int) { // Follow the current links if (S != Owner->GrpP) @@ -426,12 +426,12 @@ void pkgCache::GrpIterator::operator ++(int) HashIndex++; S = Owner->GrpP + Owner->HeaderP->GrpHashTable[HashIndex]; } -}; +} /*}}}*/ // PkgIterator::operator ++ - Postfix incr /*{{{*/ // --------------------------------------------------------------------- /* This will advance to the next logical package in the hash table. */ -void pkgCache::PkgIterator::operator ++(int) +void pkgCache::PkgIterator::operator ++(int) { // Follow the current links if (S != Owner->PkgP) @@ -443,7 +443,7 @@ void pkgCache::PkgIterator::operator ++(int) HashIndex++; S = Owner->PkgP + Owner->HeaderP->PkgHashTable[HashIndex]; } -}; +} /*}}}*/ // PkgIterator::State - Check the State of the package /*{{{*/ // --------------------------------------------------------------------- @@ -475,26 +475,26 @@ pkgCache::PkgIterator::OkState pkgCache::PkgIterator::State() const // --------------------------------------------------------------------- /* Return string representing of the candidate version. */ const char * -pkgCache::PkgIterator::CandVersion() const +pkgCache::PkgIterator::CandVersion() const { //TargetVer is empty, so don't use it. VerIterator version = pkgPolicy(Owner).GetCandidateVer(*this); if (version.IsGood()) return version.VerStr(); return 0; -}; +} /*}}}*/ // PkgIterator::CurVersion - Returns the current version string /*{{{*/ // --------------------------------------------------------------------- /* Return string representing of the current version. */ const char * -pkgCache::PkgIterator::CurVersion() const +pkgCache::PkgIterator::CurVersion() const { VerIterator version = CurrentVer(); if (version.IsGood()) return CurrentVer().VerStr(); return 0; -}; +} /*}}}*/ // ostream operator to handle string representation of a package /*{{{*/ // --------------------------------------------------------------------- @@ -978,7 +978,7 @@ string pkgCache::PkgFileIterator::RelStr() /*}}}*/ // VerIterator::TranslatedDescription - Return the a DescIter for locale/*{{{*/ // --------------------------------------------------------------------- -/* return a DescIter for the current locale or the default if none is +/* return a DescIter for the current locale or the default if none is * found */ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const @@ -1012,7 +1012,7 @@ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const if (strcmp(Desc.LanguageCode(), "") == 0) return Desc; return DescriptionList(); -}; +} /*}}}*/ // PrvIterator::IsMultiArchImplicit - added by the cache generation /*{{{*/ diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 669904c84..9a88246a1 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -176,13 +176,13 @@ class pkgCache /*{{{*/ char *StrP; virtual bool ReMap(bool const &Errorchecks = true); - inline bool Sync() {return Map.Sync();}; - inline MMap &GetMap() {return Map;}; - inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();}; + inline bool Sync() {return Map.Sync();} + inline MMap &GetMap() {return Map;} + inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();} // String hashing function (512 range) - inline unsigned long Hash(const std::string &S) const {return sHash(S);}; - inline unsigned long Hash(const char *S) const {return sHash(S);}; + inline unsigned long Hash(const std::string &S) const {return sHash(S);} + inline unsigned long Hash(const char *S) const {return sHash(S);} // Useful transformation things const char *Priority(unsigned char Priority); @@ -192,7 +192,7 @@ class pkgCache /*{{{*/ PkgIterator FindPkg(const std::string &Name); PkgIterator FindPkg(const std::string &Name, const std::string &Arch); - Header &Head() {return *HeaderP;}; + Header &Head() {return *HeaderP;} inline GrpIterator GrpBegin(); inline GrpIterator GrpEnd(); inline PkgIterator PkgBegin(); @@ -200,7 +200,7 @@ class pkgCache /*{{{*/ inline PkgFileIterator FileBegin(); inline PkgFileIterator FileEnd(); - inline bool MultiArchCache() const { return MultiArchEnabled; }; + inline bool MultiArchCache() const { return MultiArchEnabled; } inline char const * const NativeArch() const; // Make me a function @@ -212,7 +212,7 @@ class pkgCache /*{{{*/ static const char *DepType(unsigned char Dep); pkgCache(MMap *Map,bool DoMap = true); - virtual ~pkgCache() {}; + virtual ~pkgCache() {} private: bool MultiArchEnabled; @@ -662,26 +662,26 @@ struct pkgCache::StringItem inline char const * const pkgCache::NativeArch() const - { return StrP + HeaderP->Architecture; }; + { return StrP + HeaderP->Architecture; } #include -inline pkgCache::GrpIterator pkgCache::GrpBegin() - {return GrpIterator(*this);}; -inline pkgCache::GrpIterator pkgCache::GrpEnd() - {return GrpIterator(*this,GrpP);}; -inline pkgCache::PkgIterator pkgCache::PkgBegin() - {return PkgIterator(*this);}; -inline pkgCache::PkgIterator pkgCache::PkgEnd() - {return PkgIterator(*this,PkgP);}; +inline pkgCache::GrpIterator pkgCache::GrpBegin() + {return GrpIterator(*this);} +inline pkgCache::GrpIterator pkgCache::GrpEnd() + {return GrpIterator(*this,GrpP);} +inline pkgCache::PkgIterator pkgCache::PkgBegin() + {return PkgIterator(*this);} +inline pkgCache::PkgIterator pkgCache::PkgEnd() + {return PkgIterator(*this,PkgP);} inline pkgCache::PkgFileIterator pkgCache::FileBegin() - {return PkgFileIterator(*this,PkgFileP + HeaderP->FileList);}; + {return PkgFileIterator(*this,PkgFileP + HeaderP->FileList);} inline pkgCache::PkgFileIterator pkgCache::FileEnd() - {return PkgFileIterator(*this,PkgFileP);}; + {return PkgFileIterator(*this,PkgFileP);} // Oh I wish for Real Name Space Support class pkgCache::Namespace /*{{{*/ -{ +{ public: typedef pkgCache::GrpIterator GrpIterator; typedef pkgCache::PkgIterator PkgIterator; @@ -690,7 +690,7 @@ class pkgCache::Namespace /*{{{*/ typedef pkgCache::DepIterator DepIterator; typedef pkgCache::PrvIterator PrvIterator; typedef pkgCache::PkgFileIterator PkgFileIterator; - typedef pkgCache::VerFileIterator VerFileIterator; + typedef pkgCache::VerFileIterator VerFileIterator; typedef pkgCache::Version Version; typedef pkgCache::Description Description; typedef pkgCache::Package Package; diff --git a/apt-pkg/upgrade.h b/apt-pkg/upgrade.h index c4973472f..436d38300 100644 --- a/apt-pkg/upgrade.h +++ b/apt-pkg/upgrade.h @@ -15,7 +15,7 @@ namespace APT { // FIXME: make this "enum class UpgradeMode {" once we enable c++11 enum UpgradeMode { FORBID_REMOVE_PACKAGES = 1, - FORBID_INSTALL_NEW_PACKAGES = 2, + FORBID_INSTALL_NEW_PACKAGES = 2 }; bool Upgrade(pkgDepCache &Cache, int UpgradeMode); } diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc index d25ffef75..66e1600f1 100644 --- a/apt-private/acqprogress.cc +++ b/apt-private/acqprogress.cc @@ -42,12 +42,12 @@ AcqTextStatus::AcqTextStatus(unsigned int &ScreenWidth,unsigned int const Quiet) // AcqTextStatus::Start - Downloading has started /*{{{*/ // --------------------------------------------------------------------- /* */ -void AcqTextStatus::Start() +void AcqTextStatus::Start() { - pkgAcquireStatus::Start(); + pkgAcquireStatus::Start(); BlankLine[0] = 0; ID = 1; -}; +} /*}}}*/ // AcqTextStatus::IMSHit - Called when an item got a HIT response /*{{{*/ // --------------------------------------------------------------------- @@ -58,14 +58,14 @@ void AcqTextStatus::IMSHit(pkgAcquire::ItemDesc &Itm) return; if (Quiet <= 0) - cout << '\r' << BlankLine << '\r'; - + cout << '\r' << BlankLine << '\r'; + cout << _("Hit ") << Itm.Description; if (Itm.Owner->FileSize != 0) cout << " [" << SizeToStr(Itm.Owner->FileSize) << "B]"; cout << endl; Update = true; -}; +} /*}}}*/ // AcqTextStatus::Fetch - An item has started to download /*{{{*/ // --------------------------------------------------------------------- @@ -75,20 +75,20 @@ void AcqTextStatus::Fetch(pkgAcquire::ItemDesc &Itm) Update = true; if (Itm.Owner->Complete == true) return; - + Itm.Owner->ID = ID++; - + if (Quiet > 1) return; if (Quiet <= 0) cout << '\r' << BlankLine << '\r'; - + cout << _("Get:") << Itm.Owner->ID << ' ' << Itm.Description; if (Itm.Owner->FileSize != 0) cout << " [" << SizeToStr(Itm.Owner->FileSize) << "B]"; cout << endl; -}; +} /*}}}*/ // AcqTextStatus::Done - Completed a download /*{{{*/ // --------------------------------------------------------------------- @@ -96,7 +96,7 @@ void AcqTextStatus::Fetch(pkgAcquire::ItemDesc &Itm) void AcqTextStatus::Done(pkgAcquire::ItemDesc &Itm) { Update = true; -}; +} /*}}}*/ // AcqTextStatus::Fail - Called when an item fails to download /*{{{*/ // --------------------------------------------------------------------- @@ -109,10 +109,10 @@ void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm) // Ignore certain kinds of transient failures (bad code) if (Itm.Owner->Status == pkgAcquire::Item::StatIdle) return; - + if (Quiet <= 0) cout << '\r' << BlankLine << '\r'; - + if (Itm.Owner->Status == pkgAcquire::Item::StatDone) { cout << _("Ign ") << Itm.Description << endl; @@ -122,9 +122,9 @@ void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm) cout << _("Err ") << Itm.Description << endl; cout << " " << Itm.Owner->ErrorText << endl; } - + Update = true; -}; +} /*}}}*/ // AcqTextStatus::Stop - Finished downloading /*{{{*/ // --------------------------------------------------------------------- @@ -154,12 +154,12 @@ void AcqTextStatus::Stop() bool AcqTextStatus::Pulse(pkgAcquire *Owner) { pkgAcquireStatus::Pulse(Owner); - + if (Quiet > 0) return true; - + enum {Long = 0,Medium,Short} Mode = Medium; - + char Buffer[sizeof(BlankLine)]; char *End = Buffer + sizeof(Buffer); char *S = Buffer; @@ -174,8 +174,8 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) I = Owner->WorkerStep(I)) { S += strlen(S); - - // There is no item running + + // There is no item running if (I->CurrentItem == 0) { if (I->Status.empty() == false) @@ -183,12 +183,12 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) snprintf(S,End-S," [%s]",I->Status.c_str()); Shown = true; } - + continue; } Shown = true; - + // Add in the short description if (I->CurrentItem->Owner->ID != 0) snprintf(S,End-S," [%lu %s",I->CurrentItem->Owner->ID, @@ -203,7 +203,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) snprintf(S,End-S," %s",I->CurrentItem->Owner->Mode); S += strlen(S); } - + // Add the current progress if (Mode == Long) snprintf(S,End-S," %llu",I->CurrentSize); @@ -213,7 +213,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) snprintf(S,End-S," %sB",SizeToStr(I->CurrentSize).c_str()); } S += strlen(S); - + // Add the total size and percent if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false) { @@ -223,7 +223,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) else snprintf(S,End-S,"/%sB %.0f%%",SizeToStr(I->TotalSize).c_str(), (I->CurrentSize*100.0)/I->TotalSize); - } + } S += strlen(S); snprintf(S,End-S,"]"); } @@ -231,26 +231,26 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) // Show something.. if (Shown == false) snprintf(S,End-S,_(" [Working]")); - + /* Put in the ETA and cps meter, block off signals to prevent strangeness during resizing */ sigset_t Sigs,OldSigs; sigemptyset(&Sigs); sigaddset(&Sigs,SIGWINCH); sigprocmask(SIG_BLOCK,&Sigs,&OldSigs); - + if (CurrentCPS != 0) - { + { char Tmp[300]; unsigned long long ETA = (TotalBytes - CurrentBytes)/CurrentCPS; sprintf(Tmp," %sB/s %s",SizeToStr(CurrentCPS).c_str(),TimeToStr(ETA).c_str()); unsigned int Len = strlen(Buffer); unsigned int LenT = strlen(Tmp); if (Len + LenT < ScreenWidth) - { + { memset(Buffer + Len,' ',ScreenWidth - Len); strcpy(Buffer + ScreenWidth - LenT,Tmp); - } + } } Buffer[ScreenWidth] = 0; BlankLine[ScreenWidth] = 0; @@ -268,7 +268,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) memset(BlankLine,' ',strlen(Buffer)); BlankLine[strlen(Buffer)] = 0; - + Update = false; return true; diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index 20c6e8892..9aaebefd7 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -54,7 +54,7 @@ class pkgCdromTextStatus : public pkgCdromStatus /*{{{*/ { protected: OpTextProgress Progress; - void Prompt(const char *Text); + void Prompt(const char *Text); string PromptLine(const char *Text); bool AskCdromName(string &name); @@ -64,12 +64,12 @@ public: virtual OpProgress* GetOpProgress(); }; -void pkgCdromTextStatus::Prompt(const char *Text) +void pkgCdromTextStatus::Prompt(const char *Text) { char C; cout << Text << ' ' << flush; if (read(STDIN_FILENO,&C,1) < 0) - _error->Errno("pkgCdromTextStatus::Prompt", + _error->Errno("pkgCdromTextStatus::Prompt", "Failed to read from standard input (not a terminal?)"); if (C != '\n') cout << endl; @@ -78,37 +78,37 @@ void pkgCdromTextStatus::Prompt(const char *Text) string pkgCdromTextStatus::PromptLine(const char *Text) { cout << Text << ':' << endl; - + string Res; getline(cin,Res); return Res; } -bool pkgCdromTextStatus::AskCdromName(string &name) +bool pkgCdromTextStatus::AskCdromName(string &name) { cout << _("Please provide a name for this Disc, such as 'Debian 5.0.3 Disk 1'") << flush; name = PromptLine(""); - + return true; } - -void pkgCdromTextStatus::Update(string text, int current) + +void pkgCdromTextStatus::Update(string text, int current) { if(text.size() > 0) cout << text << flush; } -bool pkgCdromTextStatus::ChangeCdrom() +bool pkgCdromTextStatus::ChangeCdrom() { Prompt(_("Please insert a Disc in the drive and press enter")); return true; } -OpProgress* pkgCdromTextStatus::GetOpProgress() -{ - return &Progress; -}; +OpProgress* pkgCdromTextStatus::GetOpProgress() +{ + return &Progress; +} /*}}}*/ // SetupAutoDetect /*{{{*/ bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i, bool &automounted) diff --git a/ftparchive/override.cc b/ftparchive/override.cc index d2130db8a..82cbc4c19 100644 --- a/ftparchive/override.cc +++ b/ftparchive/override.cc @@ -201,7 +201,7 @@ bool Override::ReadExtraOverride(string const &File,bool const &Source) } /*}}}*/ -// Override::GetItem - Get a architecture specific item /*{{{*/ +// Override::GetItem - Get a architecture specific item /*{{{*/ // --------------------------------------------------------------------- /* Returns a override item for the given package and the given architecture. * Treats "all" special @@ -232,10 +232,10 @@ Override::Item* Override::GetItem(string const &Package, string const &Architect { result->FieldOverride[foI->first] = foI->second; } - } - } + } + } return result; -}; +} // Override::Item::SwapMaint - Swap the maintainer field if necessary /*{{{*/ diff --git a/methods/cdrom.cc b/methods/cdrom.cc index 22d4b9164..3c14d9dfb 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -62,7 +62,7 @@ CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly | MountedByApt(false) { UdevCdroms.Dlopen(); -}; +} /*}}}*/ // CDROMMethod::Exit - Unmount the disc if necessary /*{{{*/ // --------------------------------------------------------------------- diff --git a/methods/http.cc b/methods/http.cc index 42b31beeb..16c6d19e1 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -61,7 +61,7 @@ unsigned long long CircleBuf::BwReadLimit=0; unsigned long long CircleBuf::BwTickReadData=0; struct timeval CircleBuf::BwReadTick={0,0}; const unsigned int CircleBuf::BW_HZ=10; - + // CircleBuf::CircleBuf - Circular input buffer /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -87,8 +87,8 @@ void CircleBuf::Reset() { delete Hash; Hash = new Hashes; - } -}; + } +} /*}}}*/ // CircleBuf::Read - Read from a FD into the circular buffer /*{{{*/ // --------------------------------------------------------------------- diff --git a/methods/https.cc b/methods/https.cc index febe6a0f0..b0c7ee71d 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -432,7 +432,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm) delete File; return true; -}; +} int main() { diff --git a/methods/mirror.cc b/methods/mirror.cc index 085f3717b..977eddcf5 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -60,7 +60,7 @@ using namespace std; MirrorMethod::MirrorMethod() : HttpMethod(), DownloadedMirrorFile(false), Debug(false) { -}; +} // HttpMethod::Configuration - Handle a configuration message /*{{{*/ // --------------------------------------------------------------------- @@ -90,17 +90,17 @@ bool MirrorMethod::Clean(string Dir) pkgSourceList list; list.ReadMainList(); - DIR *D = opendir(Dir.c_str()); + DIR *D = opendir(Dir.c_str()); if (D == 0) return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str()); - + string StartDir = SafeGetCWD(); if (chdir(Dir.c_str()) != 0) { closedir(D); return _error->Errno("chdir",_("Unable to change to %s"),Dir.c_str()); } - + for (struct dirent *Dir = readdir(D); Dir != 0; Dir = readdir(D)) { // Skip some files.. @@ -123,23 +123,23 @@ bool MirrorMethod::Clean(string Dir) // nothing found, nuke it if (I == list.end()) unlink(Dir->d_name); - }; + } closedir(D); if (chdir(StartDir.c_str()) != 0) return _error->Errno("chdir",_("Unable to change to %s"),StartDir.c_str()); - return true; + return true; } bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str) { - // not that great to use pkgAcquire here, but we do not have + // not that great to use pkgAcquire here, but we do not have // any other way right now string fetch = BaseUri; fetch.replace(0,strlen("mirror://"),"http://"); -#if 0 // no need for this, the getArchitectures() will also include the main +#if 0 // no need for this, the getArchitectures() will also include the main // arch // append main architecture fetch += "?arch=" + _config->Find("Apt::Architecture"); @@ -173,7 +173,7 @@ bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str) if(Debug) clog << "MirrorMethod::DownloadMirrorFile() success: " << res << endl; - + return res; } @@ -187,13 +187,13 @@ bool MirrorMethod::RandomizeMirrorFile(string mirror_file) if (!FileExists(mirror_file)) return false; - // read + // read ifstream in(mirror_file.c_str()); while ( !in.eof() ) { getline(in, line); content.push_back(line); } - + // we want the file to be random for each different machine, but also // "stable" on the same machine. this is to avoid running into out-of-sync // issues (i.e. Release/Release.gpg different on each mirror) @@ -422,10 +422,10 @@ bool MirrorMethod::Fetch(FetchItem *Itm) if(Debug) clog << "Fetch: " << Itm->Uri << endl << endl; - + // now run the real fetcher return HttpMethod::Fetch(Itm); -}; +} void MirrorMethod::Fail(string Err,bool Transient) { @@ -437,7 +437,7 @@ void MirrorMethod::Fail(string Err,bool Transient) // try the next mirror on fail (if its not a expected failure, // e.g. translations are ok to ignore) - if (!Queue->FailIgnore && TryNextMirror()) + if (!Queue->FailIgnore && TryNextMirror()) return; // all mirrors failed, so bail out diff --git a/methods/rsh.cc b/methods/rsh.cc index 550f77eca..f065f6b89 100644 --- a/methods/rsh.cc +++ b/methods/rsh.cc @@ -368,7 +368,7 @@ RSHMethod::RSHMethod() : pkgAcqMethod("1.0",SendConfig) signal(SIGINT,SigTerm); Server = 0; FailFd = -1; -}; +} /*}}}*/ // RSHMethod::Configuration - Handle a configuration message /*{{{*/ // --------------------------------------------------------------------- diff --git a/methods/server.cc b/methods/server.cc index ef90c809c..90e83d1af 100644 --- a/methods/server.cc +++ b/methods/server.cc @@ -119,10 +119,10 @@ bool ServerState::HeaderLine(string Line) string::size_type Pos2 = Pos; while (Pos2 < Line.length() && isspace(Line[Pos2]) != 0) Pos2++; - + string Tag = string(Line,0,Pos); string Val = string(Line,Pos2); - + if (stringcasecmp(Tag.c_str(),Tag.c_str()+4,"HTTP") == 0) { // Evil servers return no version @@ -159,14 +159,14 @@ bool ServerState::HeaderLine(string Line) } return true; - } - + } + if (stringcasecmp(Tag,"Content-Length:") == 0) { if (Encoding == Closes) Encoding = Stream; HaveContent = true; - + // The length is already set from the Content-Range header if (StartPos != 0) return true; @@ -184,7 +184,7 @@ bool ServerState::HeaderLine(string Line) HaveContent = true; return true; } - + if (stringcasecmp(Tag,"Content-Range:") == 0) { HaveContent = true; @@ -201,12 +201,12 @@ bool ServerState::HeaderLine(string Line) return _error->Error(_("This HTTP server has broken range support")); return true; } - + if (stringcasecmp(Tag,"Transfer-Encoding:") == 0) { HaveContent = true; if (stringcasecmp(Val,"chunked") == 0) - Encoding = Chunked; + Encoding = Chunked; return true; } @@ -218,7 +218,7 @@ bool ServerState::HeaderLine(string Line) Persistent = true; return true; } - + if (stringcasecmp(Tag,"Last-Modified:") == 0) { if (RFC1123StrToTime(Val.c_str(), Date) == false) @@ -413,7 +413,7 @@ bool ServerMethod::Fetch(FetchItem *) } return true; -}; +} /*}}}*/ // ServerMethod::Loop - Main loop /*{{{*/ int ServerMethod::Loop() diff --git a/methods/server.h b/methods/server.h index 2b81e6173..f1db9adf7 100644 --- a/methods/server.h +++ b/methods/server.h @@ -62,7 +62,7 @@ struct ServerState /** \brief IO error while retrieving */ RUN_HEADERS_IO_ERROR, /** \brief Parse error after retrieving */ - RUN_HEADERS_PARSE_ERROR, + RUN_HEADERS_PARSE_ERROR }; /** \brief Get the headers before the data */ RunHeadersResult RunHeaders(FileFd * const File); -- cgit v1.2.3-70-g09d2 From cf4ff3b78dc347188949370db914fe6329be6c99 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 01:54:10 +0100 Subject: warning: cast from type A to type B casts away qualifiers [-Wcast-qual] Git-Dch: Ignore Reported-By: gcc -Wcast-qual --- apt-inst/contrib/extracttar.cc | 6 +++--- apt-pkg/cacheiterators.h | 2 +- apt-pkg/contrib/fileutl.cc | 4 ++-- apt-pkg/contrib/hashes.h | 2 +- apt-pkg/contrib/hashsum_template.h | 42 +++++++++++++++++++------------------- apt-pkg/pkgcachegen.cc | 14 ++++++------- 6 files changed, 35 insertions(+), 35 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-inst/contrib/extracttar.cc b/apt-inst/contrib/extracttar.cc index 41301d1a6..41c509809 100644 --- a/apt-inst/contrib/extracttar.cc +++ b/apt-inst/contrib/extracttar.cc @@ -120,7 +120,7 @@ bool ExtractTar::StartGzip() int Pipes[2]; if (pipe(Pipes) != 0) return _error->Errno("pipe",_("Failed to create pipes")); - + // Fork off the process GZPid = ExecFork(); @@ -136,9 +136,9 @@ bool ExtractTar::StartGzip() dup2(Fd,STDERR_FILENO); close(Fd); SetCloseExec(STDOUT_FILENO,false); - SetCloseExec(STDIN_FILENO,false); + SetCloseExec(STDIN_FILENO,false); SetCloseExec(STDERR_FILENO,false); - + const char *Args[3]; string confvar = string("dir::bin::") + DecompressProg; string argv0 = _config->Find(confvar.c_str(),DecompressProg.c_str()); diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index ca8bc5ca0..64fec5daa 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -79,7 +79,7 @@ template class pkgCache::Iterator : void ReMap(void const * const oldMap, void const * const newMap) { if (Owner == 0 || S == 0) return; - S += (Str*)(newMap) - (Str*)(oldMap); + S += (Str const * const)(newMap) - (Str const * const)(oldMap); } // Constructors - look out for the variable assigning diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 52411a762..17833f090 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1400,7 +1400,7 @@ bool FileFd::Write(const void *From,unsigned long long Size) return FileFdErrno("write",_("Write error")); } - From = (char *)From + Res; + From = (char const *)From + Res; Size -= Res; if (d != NULL) d->seekpos += Res; @@ -1424,7 +1424,7 @@ bool FileFd::Write(int Fd, const void *From, unsigned long long Size) if (Res < 0) return _error->Errno("write",_("Write error")); - From = (char *)From + Res; + From = (char const *)From + Res; Size -= Res; } while (Res > 0 && Size > 0); diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h index 0a8bcd259..636cad257 100644 --- a/apt-pkg/contrib/hashes.h +++ b/apt-pkg/contrib/hashes.h @@ -77,7 +77,7 @@ class Hashes { return MD5.Add(Data,Size) && SHA1.Add(Data,Size) && SHA256.Add(Data,Size) && SHA512.Add(Data,Size); }; - inline bool Add(const char *Data) {return Add((unsigned char *)Data,strlen(Data));}; + inline bool Add(const char *Data) {return Add((unsigned char const *)Data,strlen(Data));}; inline bool AddFD(int const Fd,unsigned long long Size = 0) { return AddFD(Fd, Size, true, true, true, true); }; bool AddFD(int const Fd, unsigned long long Size, bool const addMD5, diff --git a/apt-pkg/contrib/hashsum_template.h b/apt-pkg/contrib/hashsum_template.h index 9bf160b2b..97b6a4ad9 100644 --- a/apt-pkg/contrib/hashsum_template.h +++ b/apt-pkg/contrib/hashsum_template.h @@ -28,18 +28,18 @@ template class HashSumValue { unsigned char Sum[N/8]; - + public: // Accessors bool operator ==(const HashSumValue &rhs) const { return memcmp(Sum,rhs.Sum,sizeof(Sum)) == 0; - }; + } bool operator !=(const HashSumValue &rhs) const { return memcmp(Sum,rhs.Sum,sizeof(Sum)) != 0; - }; + } std::string Value() const { @@ -49,7 +49,7 @@ class HashSumValue }; char Result[((N/8)*2)+1]; Result[(N/8)*2] = 0; - + // Convert each char into two letters int J = 0; int I = 0; @@ -59,31 +59,31 @@ class HashSumValue Result[I + 1] = Conv[Sum[J] & 0xF]; } return std::string(Result); - }; - + } + inline void Value(unsigned char S[N/8]) { - for (int I = 0; I != sizeof(Sum); I++) + for (int I = 0; I != sizeof(Sum); ++I) S[I] = Sum[I]; - }; + } - inline operator std::string() const + inline operator std::string() const { return Value(); - }; + } - bool Set(std::string Str) + bool Set(std::string Str) { return Hex2Num(Str,Sum,sizeof(Sum)); - }; + } - inline void Set(unsigned char S[N/8]) + inline void Set(unsigned char S[N/8]) { - for (int I = 0; I != sizeof(Sum); I++) + for (int I = 0; I != sizeof(Sum); ++I) Sum[I] = S[I]; - }; + } - HashSumValue(std::string Str) + HashSumValue(std::string Str) { memset(Sum,0,sizeof(Sum)); Set(Str); @@ -99,17 +99,17 @@ class SummationImplementation public: virtual bool Add(const unsigned char *inbuf, unsigned long long inlen) = 0; inline bool Add(const char *inbuf, unsigned long long const inlen) - { return Add((unsigned char *)inbuf, inlen); }; + { return Add((const unsigned char *)inbuf, inlen); } inline bool Add(const unsigned char *Data) - { return Add(Data, strlen((const char *)Data)); }; + { return Add(Data, strlen((const char *)Data)); } inline bool Add(const char *Data) - { return Add((const unsigned char *)Data, strlen((const char *)Data)); }; + { return Add((const unsigned char *)Data, strlen((const char *)Data)); } inline bool Add(const unsigned char *Beg, const unsigned char *End) - { return Add(Beg, End - Beg); }; + { return Add(Beg, End - Beg); } inline bool Add(const char *Beg, const char *End) - { return Add((const unsigned char *)Beg, End - Beg); }; + { return Add((const unsigned char *)Beg, End - Beg); } bool AddFD(int Fd, unsigned long long Size = 0); bool AddFD(FileFd &Fd, unsigned long long Size = 0); diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 7ce7aba7b..96b35f669 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -118,11 +118,11 @@ void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newM Cache.ReMap(false); - CurrentFile += (pkgCache::PackageFile*) newMap - (pkgCache::PackageFile*) oldMap; + CurrentFile += (pkgCache::PackageFile const * const) newMap - (pkgCache::PackageFile const * const) oldMap; for (size_t i = 0; i < _count(UniqHash); ++i) if (UniqHash[i] != 0) - UniqHash[i] += (pkgCache::StringItem*) newMap - (pkgCache::StringItem*) oldMap; + UniqHash[i] += (pkgCache::StringItem const * const) newMap - (pkgCache::StringItem const * const) oldMap; for (std::vector::const_iterator i = Dynamic::toReMap.begin(); i != Dynamic::toReMap.end(); ++i) @@ -398,7 +398,7 @@ bool pkgCacheGenerator::MergeListVersion(ListParser &List, pkgCache::PkgIterator Pkg.Name(), "NewVersion", 1); if (oldMap != Map.Data()) - LastVer += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap; + LastVer += (map_ptrloc const * const) Map.Data() - (map_ptrloc const * const) oldMap; *LastVer = verindex; if (unlikely(List.NewVersion(Ver) == false)) @@ -909,7 +909,7 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg, if (unlikely(index == 0)) return false; if (OldDepLast != 0 && oldMap != Map.Data()) - OldDepLast += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap; + OldDepLast += (map_ptrloc const * const) Map.Data() - (map_ptrloc const * const) oldMap; } } return NewDepends(Pkg, Ver, index, Op, Type, OldDepLast); @@ -948,7 +948,7 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg, for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; ++D) OldDepLast = &D->NextDepends; } else if (oldMap != Map.Data()) - OldDepLast += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap; + OldDepLast += (map_ptrloc const * const) Map.Data() - (map_ptrloc const * const) oldMap; Dep->NextDepends = *OldDepLast; *OldDepLast = Dep.Index(); @@ -1125,8 +1125,8 @@ unsigned long pkgCacheGenerator::WriteUniqString(const char *S, if (unlikely(idxString == 0)) return 0; if (oldMap != Map.Data()) { - Last += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap; - I += (pkgCache::StringItem*) Map.Data() - (pkgCache::StringItem*) oldMap; + Last += (map_ptrloc const * const) Map.Data() - (map_ptrloc const * const) oldMap; + I += (pkgCache::StringItem const * const) Map.Data() - (pkgCache::StringItem const * const) oldMap; } *Last = Item; -- cgit v1.2.3-70-g09d2 From e788a834ce421042e727b72e43177edaa47e53a7 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 02:18:11 +0100 Subject: warning: useless cast to type A [-Wuseless-cast] Git-Dch: Ignore Reported-By: gcc -Wuseless-cast --- apt-pkg/acquire-item.cc | 12 ++++++------ apt-pkg/algorithms.cc | 4 ++-- apt-pkg/cdrom.cc | 8 ++++---- apt-pkg/contrib/fileutl.cc | 4 ++-- apt-pkg/contrib/hashsum_template.h | 2 +- apt-pkg/contrib/mmap.cc | 2 +- apt-pkg/contrib/netrc.cc | 2 +- apt-pkg/deb/debsrcrecords.cc | 2 +- apt-pkg/indexcopy.cc | 12 ++++++------ apt-pkg/indexrecords.cc | 4 ++-- 10 files changed, 26 insertions(+), 26 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index de03011bf..88b10d4b1 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -709,7 +709,7 @@ bool pkgAcqIndexDiffs::QueueNextDiff() /*{{{*/ } // queue the right diff - Desc.URI = string(RealURI) + ".diff/" + available_patches[0].file + ".gz"; + Desc.URI = RealURI + ".diff/" + available_patches[0].file + ".gz"; Desc.Description = Description + " " + available_patches[0].file + string(".pdiff"); DestFile = _config->FindDir("Dir::State::lists") + "partial/"; DestFile += URItoFileName(RealURI + ".diff/" + available_patches[0].file); @@ -797,7 +797,7 @@ pkgAcqIndexMergeDiffs::pkgAcqIndexMergeDiffs(pkgAcquire *Owner, Desc.Owner = this; Desc.ShortDesc = ShortDesc; - Desc.URI = string(RealURI) + ".diff/" + patch.file + ".gz"; + Desc.URI = RealURI + ".diff/" + patch.file + ".gz"; Desc.Description = Description + " " + patch.file + string(".pdiff"); DestFile = _config->FindDir("Dir::State::lists") + "partial/"; DestFile += URItoFileName(RealURI + ".diff/" + patch.file); @@ -1558,7 +1558,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/ { std::vector types = APT::Configuration::getCompressionTypes(); for (std::vector::const_iterator t = types.begin(); t != types.end(); ++t) - if (MetaIndexParser->Exists(string((*Target)->MetaKey).append(".").append(*t)) == true) + if (MetaIndexParser->Exists((*Target)->MetaKey + "." + *t) == true) { compressedAvailable = true; break; @@ -1596,7 +1596,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/ else if (transInRelease == false || Record != NULL || compressedAvailable == true) { if (_config->FindB("Acquire::PDiffs",true) == true && transInRelease == true && - MetaIndexParser->Exists(string((*Target)->MetaKey).append(".diff/Index")) == true) + MetaIndexParser->Exists((*Target)->MetaKey + ".diff/Index") == true) new pkgAcqDiffIndex(Owner, (*Target)->URI, (*Target)->Description, (*Target)->ShortDesc, ExpectedIndexHash); else @@ -1610,7 +1610,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/ in the Meta-Index file. Ideal would be if pkgAcqDiffIndex would test this instead, but passing the required info to it is to much hassle */ if(_config->FindB("Acquire::PDiffs",true) == true && (verify == false || - MetaIndexParser->Exists(string((*Target)->MetaKey).append(".diff/Index")) == true)) + MetaIndexParser->Exists((*Target)->MetaKey + ".diff/Index") == true)) new pkgAcqDiffIndex(Owner, (*Target)->URI, (*Target)->Description, (*Target)->ShortDesc, ExpectedIndexHash); else @@ -1635,7 +1635,7 @@ bool pkgAcqMetaIndex::VerifyVendor(string Message) /*{{{*/ missingkeys += (Fingerprint); } if(!missingkeys.empty()) - _error->Warning("%s", string(msg+missingkeys).c_str()); + _error->Warning("%s", (msg + missingkeys).c_str()); string Transformed = MetaIndexParser->GetExpectedDist(); diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 8320e7ef0..2e167119d 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -885,8 +885,8 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix) } if (Debug == true) - clog << " Considering " << Pkg.FullName(false) << ' ' << (int)Scores[Pkg->ID] << - " as a solution to " << I.FullName(false) << ' ' << (int)Scores[I->ID] << endl; + clog << " Considering " << Pkg.FullName(false) << ' ' << Scores[Pkg->ID] << + " as a solution to " << I.FullName(false) << ' ' << Scores[I->ID] << endl; /* Try to fix the package under consideration rather than fiddle with the VList package */ diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 838c8887a..ea5ed7e92 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -440,7 +440,7 @@ bool pkgCdrom::WriteDatabase(Configuration &Cnf) Out.close(); if (FileExists(DFile) == true) - rename(DFile.c_str(), string(DFile + '~').c_str()); + rename(DFile.c_str(), (DFile + '~').c_str()); if (rename(NewFile.c_str(),DFile.c_str()) != 0) return _error->Errno("rename","Failed to rename %s.new to %s", DFile.c_str(),DFile.c_str()); @@ -553,7 +553,7 @@ bool pkgCdrom::WriteSourceList(string Name,vector &List,bool Source) Out.close(); - rename(File.c_str(),string(File + '~').c_str()); + rename(File.c_str(), (File + '~').c_str()); if (rename(NewFile.c_str(),File.c_str()) != 0) return _error->Errno("rename","Failed to rename %s.new to %s", File.c_str(),File.c_str()); @@ -737,7 +737,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/ if (InfoDir.empty() == false && FileExists(InfoDir + "/info") == true) { - ifstream F(string(InfoDir + "/info").c_str()); + ifstream F((InfoDir + "/info").c_str()); if (!F == 0) getline(F,Name); @@ -981,7 +981,7 @@ pkgUdevCdromDevices::ScanForRemovable(bool CdromOnly) cdrom.DeviceName = string(devnode); if (mountpath != "") { cdrom.MountPath = mountpath; - string s = string(mountpath); + string s = mountpath; cdrom.Mounted = IsMounted(s); } else { cdrom.Mounted = false; diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 17833f090..464950abd 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -891,7 +891,7 @@ bool FileFd::Open(string FileName,unsigned int const Mode,CompressMode Compress, { for (; compressor != compressors.end(); ++compressor) { - std::string file = std::string(FileName).append(compressor->Extension); + std::string file = FileName + compressor->Extension; if (FileExists(file) == false) continue; FileName = file; @@ -1793,7 +1793,7 @@ bool FileFd::FileFdError(const char *Description,...) { } /*}}}*/ -gzFile FileFd::gzFd() { return (gzFile) d->gz; } +gzFile FileFd::gzFd() { return d->gz; } // Glob - wrapper around "glob()" /*{{{*/ diff --git a/apt-pkg/contrib/hashsum_template.h b/apt-pkg/contrib/hashsum_template.h index 97b6a4ad9..f96188eb8 100644 --- a/apt-pkg/contrib/hashsum_template.h +++ b/apt-pkg/contrib/hashsum_template.h @@ -104,7 +104,7 @@ class SummationImplementation inline bool Add(const unsigned char *Data) { return Add(Data, strlen((const char *)Data)); } inline bool Add(const char *Data) - { return Add((const unsigned char *)Data, strlen((const char *)Data)); } + { return Add((const unsigned char *)Data, strlen(Data)); } inline bool Add(const unsigned char *Beg, const unsigned char *End) { return Add(Beg, End - Beg); } diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 51e8eb30f..37acba340 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -198,7 +198,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop) { #ifdef _POSIX_SYNCHRONIZED_IO unsigned long long const PSize = sysconf(_SC_PAGESIZE); - if (msync((char *)Base+(unsigned long long)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0) + if (msync((char *)Base+(Start/PSize)*PSize, Stop - Start, MS_SYNC) < 0) return _error->Errno("msync", _("Unable to synchronize mmap")); #endif } diff --git a/apt-pkg/contrib/netrc.cc b/apt-pkg/contrib/netrc.cc index de95aa4ab..32b146581 100644 --- a/apt-pkg/contrib/netrc.cc +++ b/apt-pkg/contrib/netrc.cc @@ -198,7 +198,7 @@ void maybe_add_auth (URI &Uri, string NetRCFile) // if host did not work, try Host+Path next, this will trigger // a lookup uri.startswith(host) in the netrc file parser (because // of the "/" - char *hostpath = strdup(string(Uri.Host+Uri.Path).c_str()); + char *hostpath = strdup((Uri.Host + Uri.Path).c_str()); if (hostpath && parsenetrc_string(hostpath, login, password, netrcfile) == 0) { if (_config->FindB("Debug::Acquire::netrc", false) == true) diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc index 90182b4a4..daa54d036 100644 --- a/apt-pkg/deb/debsrcrecords.cc +++ b/apt-pkg/deb/debsrcrecords.cc @@ -57,7 +57,7 @@ const char **debSrcRecordParser::Binaries() } while (*bin != '\0'); StaticBinList.push_back(NULL); - return (const char **) &StaticBinList[0]; + return &StaticBinList[0]; } /*}}}*/ // SrcRecordParser::BuildDepends - Return the Build-Depends information /*{{{*/ diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index 89c9d531f..38356df18 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -65,7 +65,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector &List, for (std::vector::const_iterator c = compressor.begin(); c != compressor.end(); ++c) { - if (stat(std::string(file + c->Extension).c_str(), &Buf) != 0) + if (stat((file + c->Extension).c_str(), &Buf) != 0) continue; found = true; break; @@ -160,7 +160,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector &List, // Get the size struct stat Buf; - if (stat(string(CDROM + Prefix + File).c_str(),&Buf) != 0 || + if (stat((CDROM + Prefix + File).c_str(),&Buf) != 0 || Buf.st_size == 0) { bool Mangled = false; @@ -175,7 +175,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector &List, } if (Mangled == false || - stat(string(CDROM + Prefix + File).c_str(),&Buf) != 0) + stat((CDROM + Prefix + File).c_str(),&Buf) != 0) { if (Debug == true) clog << "Missed(2): " << OrigFile << endl; @@ -286,7 +286,7 @@ bool IndexCopy::ReconstructPrefix(string &Prefix,string OrigPath,string CD, while (1) { struct stat Buf; - if (stat(string(CD + MyPrefix + File).c_str(),&Buf) != 0) + if (stat((CD + MyPrefix + File).c_str(),&Buf) != 0) { if (Debug == true) cout << "Failed, " << CD + MyPrefix + File << endl; @@ -315,7 +315,7 @@ bool IndexCopy::ReconstructChop(unsigned long &Chop,string Dir,string File) while (1) { struct stat Buf; - if (stat(string(Dir + File).c_str(),&Buf) != 0) + if (stat((Dir + File).c_str(),&Buf) != 0) { File = ChopDirs(File,1); Depth++; @@ -676,7 +676,7 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/ for (std::vector::const_iterator c = compressor.begin(); c != compressor.end(); ++c) { - if (stat(std::string(file + c->Extension).c_str(), &Buf) != 0) + if (stat((file + c->Extension).c_str(), &Buf) != 0) continue; found = true; break; diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc index f8097c3c6..c1c397e31 100644 --- a/apt-pkg/indexrecords.cc +++ b/apt-pkg/indexrecords.cc @@ -129,10 +129,10 @@ bool indexRecords::Load(const string Filename) /*{{{*/ // get the user settings for this archive and use what expires earlier int MaxAge = _config->FindI("Acquire::Max-ValidTime", 0); if (Label.empty() == false) - MaxAge = _config->FindI(string("Acquire::Max-ValidTime::" + Label).c_str(), MaxAge); + MaxAge = _config->FindI(("Acquire::Max-ValidTime::" + Label).c_str(), MaxAge); int MinAge = _config->FindI("Acquire::Min-ValidTime", 0); if (Label.empty() == false) - MinAge = _config->FindI(string("Acquire::Min-ValidTime::" + Label).c_str(), MinAge); + MinAge = _config->FindI(("Acquire::Min-ValidTime::" + Label).c_str(), MinAge); if(MaxAge == 0 && (MinAge == 0 || ValidUntil == 0)) // No user settings, use the one from the Release file -- cgit v1.2.3-70-g09d2 From ef74268b47fae1afd302a4a524b53143cbfd6ce1 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 03:32:13 +0100 Subject: warning: cannot optimize loop, the loop counter may overflow [-Wunsafe-loop-optimizations] Git-Dch: Ignore Reported-By: gcc -Wunsafe-loop-optimizations --- apt-pkg/contrib/strutl.cc | 2 +- apt-pkg/pkgcachegen.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 0d85b4fd3..61fcc6a7d 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -1184,7 +1184,7 @@ unsigned long RegexChoice(RxChoiceList *Rxs,const char **ListBegin, R->Hit = false; unsigned long Hits = 0; - for (; ListBegin != ListEnd; ListBegin++) + for (; ListBegin < ListEnd; ++ListBegin) { // Check if the name is a regex const char *I; diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 96b35f669..006f3952b 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -1249,10 +1249,10 @@ static bool CheckValidity(const string &CacheFile, static unsigned long ComputeSize(FileIterator Start,FileIterator End) { unsigned long TotalSize = 0; - for (; Start != End; ++Start) + for (; Start < End; ++Start) { if ((*Start)->HasPackages() == false) - continue; + continue; TotalSize += (*Start)->Size(); } return TotalSize; -- cgit v1.2.3-70-g09d2 From 54298f49d71347616df19b8d2f59c907374e07b3 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 1 Mar 2014 22:27:11 +0100 Subject: move defines for version to macros.h also adds namespaced attributes for good usage Git-Dch: Ignore --- apt-pkg/contrib/macros.h | 84 ++++++++++++++++++++++++++++++++++++++---------- apt-pkg/init.h | 11 +------ buildlib/libversion.mak | 6 ++-- prepare-release | 2 +- 4 files changed, 72 insertions(+), 31 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h index e53d01b8f..294242e68 100644 --- a/apt-pkg/contrib/macros.h +++ b/apt-pkg/contrib/macros.h @@ -54,37 +54,87 @@ #define CLRFLAG(v,f) ((v) &=~FLAG(f)) #define CHKFLAG(v,f) ((v) & FLAG(f) ? true : false) -// some nice optional GNUC features -#if __GNUC__ >= 3 - #define __must_check __attribute__ ((warn_unused_result)) - #define __deprecated __attribute__ ((deprecated)) - #define __attrib_const __attribute__ ((__const__)) - /* likely() and unlikely() can be used to mark boolean expressions - as (not) likely true which will help the compiler to optimise */ +#ifdef __GNUC__ +#define APT_GCC_VERSION (__GNUC__ << 8 | __GNUC_MINOR__) +#else +#define APT_GCC_VERSION 0 +#endif + +/* likely() and unlikely() can be used to mark boolean expressions + as (not) likely true which will help the compiler to optimise */ +#if APT_GCC_VERSION >= 0x0300 #define likely(x) __builtin_expect (!!(x), 1) #define unlikely(x) __builtin_expect (!!(x), 0) #else - #define __must_check /* no warn_unused_result */ - #define __deprecated /* no deprecated */ - #define __attrib_const /* no const attribute */ #define likely(x) (x) #define unlikely(x) (x) #endif +#if APT_GCC_VERSION >= 0x0300 + #define APT_UNUSED __attribute__((unused)) + #define APT_CONST __attribute__((const)) + #define APT_PURE __attribute__((pure)) + #define APT_NORETURN __attribute__((noreturn)) + #define APT_PRINTF(n) __attribute__((format(printf, n, n + 1))) +#else + #define APT_UNUSED + #define APT_CONST + #define APT_PURE + #define APT_NORETURN + #define APT_PRINTF(n) +#endif + +#if APT_GCC_VERSION > 0x0302 + #define APT_NONNULL(...) __attribute__((nonnull(__VA_ARGS__))) + #define APT_MUSTCHECK __attribute__((warn_unused_result)) +#else + #define APT_NONNULL(...) + #define APT_REQRET +#endif + +#if APT_GCC_VERSION >= 0x0400 + #define APT_SENTINEL __attribute__((sentinel)) +#else + #define APT_SENTINEL +#endif + // cold functions are unlikely() to be called -#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4 - #define __cold __attribute__ ((__cold__)) - #define __hot __attribute__ ((__hot__)) +#if APT_GCC_VERSION >= 0x0403 + #define APT_COLD __attribute__ ((__cold__)) + #define APT_HOT __attribute__ ((__hot__)) #else - #define __cold /* no cold marker */ - #define __hot /* no hot marker */ + #define __cold + #define __hot #endif -#ifdef __GNUG__ -// Methods have a hidden this parameter that is visible to this attribute +#ifndef APT_10_CLEANER_HEADERS +#if APT_GCC_VERSION >= 0x0300 + #define __must_check __attribute__ ((warn_unused_result)) + #define __deprecated __attribute__ ((deprecated)) + #define __attrib_const __attribute__ ((__const__)) #define __like_printf(n) __attribute__((format(printf, n, n + 1))) #else + #define __must_check /* no warn_unused_result */ + #define __deprecated /* no deprecated */ + #define __attrib_const /* no const attribute */ #define __like_printf(n) /* no like-printf */ #endif +#if APT_GCC_VERSION >= 0x0403 + #define __cold __attribute__ ((__cold__)) + #define __hot __attribute__ ((__hot__)) +#else + #define __cold /* no cold marker */ + #define __hot /* no hot marker */ +#endif +#endif + +// These lines are extracted by the makefiles and the buildsystem +// Increasing MAJOR or MINOR results in the need of recompiling all +// reverse-dependencies of libapt-pkg against the new SONAME. +// Non-ABI-Breaks should only increase RELEASE number. +// See also buildlib/libversion.mak +#define APT_PKG_MAJOR 4 +#define APT_PKG_MINOR 12 +#define APT_PKG_RELEASE 0 #endif diff --git a/apt-pkg/init.h b/apt-pkg/init.h index b6f3df753..4ee7a95ac 100644 --- a/apt-pkg/init.h +++ b/apt-pkg/init.h @@ -1,6 +1,5 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: init.h,v 1.9.2.2 2004/01/02 18:51:00 mdz Exp $ /* ###################################################################### Init - Initialize the package library @@ -17,19 +16,11 @@ #include #include #endif +#include class pkgSystem; class Configuration; -// These lines are extracted by the makefiles and the buildsystem -// Increasing MAJOR or MINOR results in the need of recompiling all -// reverse-dependencies of libapt-pkg against the new SONAME. -// Non-ABI-Breaks should only increase RELEASE number. -// See also buildlib/libversion.mak -#define APT_PKG_MAJOR 4 -#define APT_PKG_MINOR 12 -#define APT_PKG_RELEASE 0 - extern const char *pkgVersion; extern const char *pkgLibVersion; diff --git a/buildlib/libversion.mak b/buildlib/libversion.mak index 796c956e7..deb3da377 100644 --- a/buildlib/libversion.mak +++ b/buildlib/libversion.mak @@ -2,9 +2,9 @@ # Version number of libapt-pkg. # Please increase MAJOR with each ABI break, # with each non-ABI break to the lib, please increase RELEASE. -# The versionnumber is extracted from apt-pkg/init.h - see also there. -LIBAPTPKG_MAJOR=$(shell awk -v ORS='.' '/^\#define APT_PKG_M/ {print $$3}' $(BASE)/apt-pkg/init.h | sed 's/\.$$//') -LIBAPTPKG_RELEASE=$(shell grep -E '^\#define APT_PKG_RELEASE' $(BASE)/apt-pkg/init.h | cut -d ' ' -f 3) +# The versionnumber is extracted from apt-pkg/macros.h - see also there. +LIBAPTPKG_MAJOR=$(shell awk -v ORS='.' '/^\#define APT_PKG_M/ {print $$3}' $(BASE)/apt-pkg/contrib/macros.h | sed 's/\.$$//') +LIBAPTPKG_RELEASE=$(shell grep -E '^\#define APT_PKG_RELEASE' $(BASE)/apt-pkg/contrib/macros.h | cut -d ' ' -f 3) # Version number of libapt-inst # Please increase MAJOR with each ABI break, diff --git a/prepare-release b/prepare-release index 6229ee1fd..7b7fd1224 100755 --- a/prepare-release +++ b/prepare-release @@ -11,7 +11,7 @@ fi VERSION=$(dpkg-parsechangelog | sed -n -e '/^Version:/s/^Version: //p') DISTRIBUTION=$(dpkg-parsechangelog | sed -n -e '/^Distribution:/s/^Distribution: //p') -LIBAPTPKGVERSION="$(awk -v ORS='.' '/^\#define APT_PKG_M/ {print $3}' apt-pkg/init.h | sed 's/\.$//')" +LIBAPTPKGVERSION="$(awk -v ORS='.' '/^\#define APT_PKG_M/ {print $3}' apt-pkg/contrib/macros.h | sed 's/\.$//')" LIBAPTINSTVERSION="$(egrep '^MAJOR=' apt-inst/makefile |cut -d '=' -f 2)" librarysymbolsfromfile() { -- cgit v1.2.3-70-g09d2 From 453b82a388013e522b3a1b9fcd6ed0810dab1f4f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 5 Mar 2014 22:11:25 +0100 Subject: cleanup headers and especially #includes everywhere Beside being a bit cleaner it hopefully also resolves oddball problems I have with high levels of parallel jobs. Git-Dch: Ignore Reported-By: iwyu (include-what-you-use) --- apt-inst/contrib/arfile.cc | 4 +- apt-inst/contrib/extracttar.cc | 6 ++- apt-inst/deb/debfile.cc | 12 +++-- apt-inst/deb/debfile.h | 6 ++- apt-inst/dirstream.cc | 1 - apt-inst/extract.cc | 9 +++- apt-inst/extract.h | 5 +- apt-inst/filelist.cc | 2 - apt-pkg/acquire-item.cc | 15 ++++-- apt-pkg/acquire-item.h | 4 ++ apt-pkg/acquire-method.cc | 12 ++++- apt-pkg/acquire-method.h | 1 + apt-pkg/acquire-worker.cc | 7 ++- apt-pkg/acquire-worker.h | 3 ++ apt-pkg/acquire.cc | 6 +++ apt-pkg/acquire.h | 7 ++- apt-pkg/algorithms.cc | 13 +++-- apt-pkg/algorithms.h | 5 +- apt-pkg/aptconfiguration.cc | 9 +++- apt-pkg/cachefile.cc | 9 +++- apt-pkg/cachefile.h | 9 +++- apt-pkg/cachefilter.cc | 4 +- apt-pkg/cachefilter.h | 1 + apt-pkg/cacheiterators.h | 4 ++ apt-pkg/cacheset.cc | 16 ++++-- apt-pkg/cacheset.h | 7 ++- apt-pkg/cdrom.cc | 34 ++++++------ apt-pkg/cdrom.h | 2 + apt-pkg/clean.cc | 4 ++ apt-pkg/clean.h | 7 ++- apt-pkg/contrib/cdromutl.cc | 5 +- apt-pkg/contrib/cmndline.cc | 5 ++ apt-pkg/contrib/configuration.cc | 13 +++-- apt-pkg/contrib/error.cc | 4 +- apt-pkg/contrib/error.h | 27 +++++----- apt-pkg/contrib/fileutl.cc | 12 +++-- apt-pkg/contrib/fileutl.h | 11 ++-- apt-pkg/contrib/gpgv.cc | 18 ++++--- apt-pkg/contrib/gpgv.h | 14 +++-- apt-pkg/contrib/hashes.cc | 6 ++- apt-pkg/contrib/hashes.h | 13 +++-- apt-pkg/contrib/hashsum.cc | 3 ++ apt-pkg/contrib/hashsum_template.h | 10 ++-- apt-pkg/contrib/macros.h | 8 +-- apt-pkg/contrib/md5.cc | 6 +-- apt-pkg/contrib/md5.h | 9 ++-- apt-pkg/contrib/mmap.cc | 4 +- apt-pkg/contrib/netrc.cc | 3 +- apt-pkg/contrib/netrc.h | 6 ++- apt-pkg/contrib/progress.cc | 2 + apt-pkg/contrib/sha1.cc | 5 +- apt-pkg/contrib/sha1.h | 7 +-- apt-pkg/contrib/sha2.h | 10 ++-- apt-pkg/contrib/sha2_internal.cc | 1 + apt-pkg/contrib/sha2_internal.h | 1 + apt-pkg/contrib/strutl.cc | 9 +++- apt-pkg/contrib/strutl.h | 23 +++++---- apt-pkg/deb/debindexfile.cc | 14 ++++- apt-pkg/deb/debindexfile.h | 10 +++- apt-pkg/deb/deblistparser.cc | 9 ++++ apt-pkg/deb/deblistparser.h | 7 +++ apt-pkg/deb/debmetaindex.cc | 11 +++- apt-pkg/deb/debmetaindex.h | 8 ++- apt-pkg/deb/debrecords.cc | 8 ++- apt-pkg/deb/debrecords.h | 3 ++ apt-pkg/deb/debsrcrecords.cc | 11 +++- apt-pkg/deb/debsrcrecords.h | 7 ++- apt-pkg/deb/debsystem.cc | 9 +++- apt-pkg/deb/debsystem.h | 10 +++- apt-pkg/deb/debversion.cc | 2 + apt-pkg/deb/debversion.h | 6 +-- apt-pkg/deb/dpkgpm.cc | 52 ++++++++++--------- apt-pkg/deb/dpkgpm.h | 13 ++++- apt-pkg/depcache.cc | 14 +++-- apt-pkg/depcache.h | 12 ++++- apt-pkg/edsp.cc | 17 ++++-- apt-pkg/edsp.h | 5 +- apt-pkg/edsp/edspindexfile.cc | 17 +++--- apt-pkg/edsp/edspindexfile.h | 4 ++ apt-pkg/edsp/edsplistparser.cc | 10 ++-- apt-pkg/edsp/edsplistparser.h | 4 ++ apt-pkg/edsp/edspsystem.cc | 15 +++--- apt-pkg/edsp/edspsystem.h | 9 ++++ apt-pkg/indexcopy.cc | 6 +-- apt-pkg/indexcopy.h | 10 ++-- apt-pkg/indexfile.cc | 10 +++- apt-pkg/indexfile.h | 15 +++--- apt-pkg/indexrecords.cc | 7 ++- apt-pkg/indexrecords.h | 6 ++- apt-pkg/init.cc | 4 +- apt-pkg/init.h | 2 + apt-pkg/install-progress.cc | 30 ++++++----- apt-pkg/metaindex.h | 15 ++++-- apt-pkg/orderlist.cc | 6 ++- apt-pkg/orderlist.h | 6 ++- apt-pkg/packagemanager.cc | 11 +++- apt-pkg/packagemanager.h | 12 +++-- apt-pkg/pkgcache.cc | 7 ++- apt-pkg/pkgcachegen.cc | 20 ++++--- apt-pkg/pkgcachegen.h | 12 +++-- apt-pkg/pkgrecords.cc | 6 ++- apt-pkg/pkgrecords.h | 3 +- apt-pkg/pkgsystem.cc | 1 - apt-pkg/pkgsystem.h | 2 +- apt-pkg/policy.cc | 10 +++- apt-pkg/policy.h | 5 +- apt-pkg/sourcelist.cc | 11 +++- apt-pkg/sourcelist.h | 12 ++++- apt-pkg/srcrecords.cc | 7 ++- apt-pkg/tagfile.cc | 2 + apt-pkg/update.cc | 23 +++------ apt-pkg/upgrade.cc | 19 +++---- apt-pkg/upgrade.h | 2 + apt-pkg/vendor.cc | 8 ++- apt-pkg/vendor.h | 2 +- apt-pkg/vendorlist.cc | 9 +++- apt-pkg/vendorlist.h | 2 +- apt-pkg/version.cc | 2 +- apt-pkg/versionmatch.cc | 7 ++- apt-pkg/versionmatch.h | 3 +- apt-private/acqprogress.cc | 5 +- apt-private/private-cachefile.cc | 12 +++-- apt-private/private-cachefile.h | 2 + apt-private/private-cacheset.cc | 13 ++++- apt-private/private-cacheset.h | 15 ++++++ apt-private/private-cmndline.cc | 6 +-- apt-private/private-download.cc | 6 +-- apt-private/private-download.h | 2 +- apt-private/private-install.cc | 68 ++++++++++-------------- apt-private/private-install.h | 18 ++++++- apt-private/private-list.cc | 43 +++++----------- apt-private/private-list.h | 2 +- apt-private/private-main.cc | 12 +++-- apt-private/private-main.h | 3 +- apt-private/private-moo.cc | 12 +++-- apt-private/private-output.cc | 14 +++-- apt-private/private-output.h | 5 +- apt-private/private-search.cc | 44 ++++++---------- apt-private/private-search.h | 2 +- apt-private/private-show.cc | 40 +++++++------- apt-private/private-show.h | 2 +- apt-private/private-sources.cc | 21 ++++++-- apt-private/private-sources.h | 7 ++- apt-private/private-update.cc | 39 +++++--------- apt-private/private-upgrade.cc | 18 ++++--- apt-private/private-upgrade.h | 4 +- apt-private/private-utils.cc | 8 +-- apt-private/private-utils.h | 2 - buildlib/apti18n.h.in | 3 +- buildlib/config.h.in | 1 + cmdline/acqprogress.cc | 2 + cmdline/apt-cache.cc | 51 ++++++++++-------- cmdline/apt-cdrom.cc | 9 +--- cmdline/apt-config.cc | 2 +- cmdline/apt-dump-solver.cc | 6 ++- cmdline/apt-extracttemplates.cc | 9 ++-- cmdline/apt-extracttemplates.h | 3 +- cmdline/apt-get.cc | 83 +++++++++++++++--------------- cmdline/apt-helper.cc | 12 ++--- cmdline/apt-internal-solver.cc | 10 +++- cmdline/apt-mark.cc | 29 +++++++---- cmdline/apt-sortpkgs.cc | 6 +-- cmdline/apt.cc | 40 +++----------- ftparchive/apt-ftparchive.cc | 17 ++++-- ftparchive/cachedb.cc | 4 ++ ftparchive/cachedb.h | 8 +-- ftparchive/contents.cc | 3 +- ftparchive/contents.h | 8 +-- ftparchive/multicompress.cc | 6 ++- ftparchive/multicompress.h | 3 +- ftparchive/override.cc | 3 ++ ftparchive/writer.cc | 25 ++++++--- ftparchive/writer.h | 4 +- methods/cdrom.cc | 4 +- methods/connect.cc | 2 +- methods/copy.cc | 3 +- methods/file.cc | 3 +- methods/ftp.cc | 5 ++ methods/ftp.h | 2 + methods/gpgv.cc | 16 +++--- methods/gzip.cc | 14 ++--- methods/http.cc | 13 ++--- methods/http.h | 4 ++ methods/http_main.cc | 5 -- methods/https.cc | 9 ++-- methods/https.h | 7 ++- methods/mirror.cc | 10 ++-- methods/mirror.h | 2 + methods/rred.cc | 5 +- methods/rsh.cc | 4 ++ methods/rsh.h | 2 + methods/server.cc | 27 ++++------ methods/server.h | 3 ++ test/interactive-helper/aptwebserver.cc | 34 ++++++------ test/interactive-helper/extract-control.cc | 3 ++ test/interactive-helper/mthdcat.cc | 2 + test/interactive-helper/rpmver.cc | 2 + test/interactive-helper/test_udevcdrom.cc | 8 +-- test/interactive-helper/testdeb.cc | 7 +++ test/libapt/cdromfindpackages_test.cc | 4 ++ test/libapt/cdromreducesourcelist_test.cc | 4 +- test/libapt/commandline_test.cc | 3 ++ test/libapt/commandlineasstring_test.cc | 2 + test/libapt/compareversion_test.cc | 9 ++-- test/libapt/configuration_test.cc | 2 + test/libapt/fileutl_test.cc | 7 ++- test/libapt/getarchitectures_test.cc | 5 +- test/libapt/getlanguages_test.cc | 2 + test/libapt/getlistoffilesindir_test.cc | 7 +-- test/libapt/globalerror_test.cc | 6 ++- test/libapt/hashsums_test.cc | 15 +++--- test/libapt/indexcopytosourcelist_test.cc | 9 ++-- test/libapt/parsedepends_test.cc | 6 +++ test/libapt/sourcelist_test.cc | 9 +++- test/libapt/strutil_test.cc | 7 ++- test/libapt/tagfile_test.cc | 6 ++- test/libapt/uri_test.cc | 4 ++ 217 files changed, 1348 insertions(+), 788 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-inst/contrib/arfile.cc b/apt-inst/contrib/arfile.cc index 77dbc55d6..905110781 100644 --- a/apt-inst/contrib/arfile.cc +++ b/apt-inst/contrib/arfile.cc @@ -21,7 +21,9 @@ #include #include -#include +#include +#include +#include #include /*}}}*/ diff --git a/apt-inst/contrib/extracttar.cc b/apt-inst/contrib/extracttar.cc index 41c509809..0ba3f0521 100644 --- a/apt-inst/contrib/extracttar.cc +++ b/apt-inst/contrib/extracttar.cc @@ -23,9 +23,11 @@ #include #include #include -#include +#include -#include +#include +#include +#include #include #include #include diff --git a/apt-inst/deb/debfile.cc b/apt-inst/deb/debfile.cc index 8684f03f7..3803329fa 100644 --- a/apt-inst/deb/debfile.cc +++ b/apt-inst/deb/debfile.cc @@ -21,11 +21,17 @@ #include #include #include -#include #include - +#include +#include +#include +#include + +#include +#include +#include #include -#include + #include /*}}}*/ diff --git a/apt-inst/deb/debfile.h b/apt-inst/deb/debfile.h index ecef71d21..880bcf6c5 100644 --- a/apt-inst/deb/debfile.h +++ b/apt-inst/deb/debfile.h @@ -27,11 +27,15 @@ #include #include #include -#include + +#include #ifndef APT_8_CLEANER_HEADERS #include #endif +#ifndef APT_10_CLEANER_HEADERS +#include +#endif class FileFd; diff --git a/apt-inst/dirstream.cc b/apt-inst/dirstream.cc index 085a0dcbf..39ebb3bb4 100644 --- a/apt-inst/dirstream.cc +++ b/apt-inst/dirstream.cc @@ -18,7 +18,6 @@ #include #include -#include #include #include #include diff --git a/apt-inst/extract.cc b/apt-inst/extract.cc index 60edc702e..b2956d91d 100644 --- a/apt-inst/extract.cc +++ b/apt-inst/extract.cc @@ -50,13 +50,20 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include #include -#include #include #include #include + #include /*}}}*/ using namespace std; diff --git a/apt-inst/extract.h b/apt-inst/extract.h index 7143fa409..8ad9ac629 100644 --- a/apt-inst/extract.h +++ b/apt-inst/extract.h @@ -17,11 +17,12 @@ #ifndef PKGLIB_EXTRACT_H #define PKGLIB_EXTRACT_H - - #include #include #include +#include + +#include class pkgExtract : public pkgDirStream { diff --git a/apt-inst/filelist.cc b/apt-inst/filelist.cc index defc4f4df..b4a4f3d9d 100644 --- a/apt-inst/filelist.cc +++ b/apt-inst/filelist.cc @@ -39,8 +39,6 @@ #include #include -#include -#include #include #include #include diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 3b22743e7..44a1f32df 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -22,12 +22,21 @@ #include #include #include -#include #include #include #include -#include - +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include #include #include #include diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index 0524743c6..f48d2a0d7 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -24,6 +24,10 @@ #include #include #include +#include + +#include +#include #ifndef APT_8_CLEANER_HEADERS #include diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc index 5bc1c159a..746c553f1 100644 --- a/apt-pkg/acquire-method.cc +++ b/apt-pkg/acquire-method.cc @@ -23,10 +23,18 @@ #include #include #include - +#include +#include +#include + +#include +#include +#include +#include +#include +#include #include #include -#include /*}}}*/ using namespace std; diff --git a/apt-pkg/acquire-method.h b/apt-pkg/acquire-method.h index 00f99e0a0..f0f2a537a 100644 --- a/apt-pkg/acquire-method.h +++ b/apt-pkg/acquire-method.h @@ -21,6 +21,7 @@ #define PKGLIB_ACQUIRE_METHOD_H #include +#include #include #include diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index de62080da..047a655ce 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -14,20 +14,23 @@ // Include Files /*{{{*/ #include +#include #include #include #include #include #include #include +#include +#include +#include #include #include -#include #include +#include #include -#include #include #include #include diff --git a/apt-pkg/acquire-worker.h b/apt-pkg/acquire-worker.h index a558f69a7..67aee4b59 100644 --- a/apt-pkg/acquire-worker.h +++ b/apt-pkg/acquire-worker.h @@ -22,6 +22,9 @@ #include #include +#include +#include +#include /** \brief A fetch subprocess. * diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index e8fa68338..a654d8219 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -23,12 +23,18 @@ #include #include +#include +#include #include #include #include +#include +#include +#include #include #include +#include #include #include diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index 2c0b37635..1aac0ba11 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -72,8 +72,13 @@ #include #include +#include #include +#include + +#ifndef APT_10_CLEANER_HEADERS #include +#endif #ifndef APT_8_CLEANER_HEADERS using std::vector; @@ -353,7 +358,7 @@ class pkgAcquire void SetLog(pkgAcquireStatus *Progress) { Log = Progress; } /** \brief Construct a new pkgAcquire. */ - pkgAcquire(pkgAcquireStatus *Log) __deprecated; + pkgAcquire(pkgAcquireStatus *Log) APT_DEPRECATED; pkgAcquire(); /** \brief Destroy this pkgAcquire object. diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 2e167119d..a7b676660 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -19,19 +19,18 @@ #include #include #include -#include #include -#include #include -#include -#include #include +#include +#include +#include +#include -#include +#include +#include #include -#include #include -#include #include /*}}}*/ diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index 489d81159..82b6426c6 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -33,8 +33,11 @@ #include #include +#include +#include #include +#include #include @@ -140,7 +143,7 @@ class pkgProblemResolver /*{{{*/ // Try to resolve problems only by using keep bool ResolveByKeep(); - __deprecated void InstallProtect(); + APT_DEPRECATED void InstallProtect(); pkgProblemResolver(pkgDepCache *Cache); ~pkgProblemResolver(); diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index 4c609c603..941a9c334 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -17,14 +17,19 @@ #include #include -#include #include #include #include - +#include +#include +#include +#include +#include #include #include #include + +#include /*}}}*/ namespace APT { // getCompressionTypes - Return Vector of usable compressiontypes /*{{{*/ diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc index 2401b015e..0fd40106f 100644 --- a/apt-pkg/cachefile.cc +++ b/apt-pkg/cachefile.cc @@ -21,9 +21,16 @@ #include #include #include -#include #include #include +#include +#include +#include + +#include +#include +#include +#include #include /*}}}*/ diff --git a/apt-pkg/cachefile.h b/apt-pkg/cachefile.h index 802b12b61..36b20893a 100644 --- a/apt-pkg/cachefile.h +++ b/apt-pkg/cachefile.h @@ -17,8 +17,12 @@ #ifndef PKGLIB_CACHEFILE_H #define PKGLIB_CACHEFILE_H +#include + #include #include +#include +#include #ifndef APT_8_CLEANER_HEADERS #include @@ -26,6 +30,7 @@ #include #endif +class MMap; class pkgPolicy; class pkgSourceList; class OpProgress; @@ -60,13 +65,13 @@ class pkgCacheFile inline unsigned char &operator [](pkgCache::DepIterator const &I) {return (*DCache)[I];}; bool BuildCaches(OpProgress *Progress = NULL,bool WithLock = true); - __deprecated bool BuildCaches(OpProgress &Progress,bool const &WithLock = true) { return BuildCaches(&Progress, WithLock); }; + APT_DEPRECATED bool BuildCaches(OpProgress &Progress,bool const &WithLock = true) { return BuildCaches(&Progress, WithLock); }; bool BuildSourceList(OpProgress *Progress = NULL); bool BuildPolicy(OpProgress *Progress = NULL); bool BuildDepCache(OpProgress *Progress = NULL); bool Open(OpProgress *Progress = NULL, bool WithLock = true); inline bool ReadOnlyOpen(OpProgress *Progress = NULL) { return Open(Progress, false); }; - __deprecated bool Open(OpProgress &Progress,bool const &WithLock = true) { return Open(&Progress, WithLock); }; + APT_DEPRECATED bool Open(OpProgress &Progress,bool const &WithLock = true) { return Open(&Progress, WithLock); }; static void RemoveCaches(); void Close(); diff --git a/apt-pkg/cachefilter.cc b/apt-pkg/cachefilter.cc index 57b9af159..e388f2450 100644 --- a/apt-pkg/cachefilter.cc +++ b/apt-pkg/cachefilter.cc @@ -9,10 +9,12 @@ #include #include #include +#include #include +#include #include - +#include #include #include diff --git a/apt-pkg/cachefilter.h b/apt-pkg/cachefilter.h index 81ae1383c..49d2855f5 100644 --- a/apt-pkg/cachefilter.h +++ b/apt-pkg/cachefilter.h @@ -7,6 +7,7 @@ #define APT_CACHEFILTER_H // Include Files /*{{{*/ #include +#include #include diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index 64fec5daa..d9c8ed1e4 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -29,7 +29,11 @@ /*}}}*/ #ifndef PKGLIB_CACHEITERATORS_H #define PKGLIB_CACHEITERATORS_H +#include + #include +#include +#include #include diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc index 8a30d00a2..a58631d5b 100644 --- a/apt-pkg/cacheset.cc +++ b/apt-pkg/cacheset.cc @@ -16,14 +16,22 @@ #include #include #include -#include #include #include #include - -#include - +#include +#include +#include +#include +#include + +#include +#include +#include #include +#include +#include +#include #include /*}}}*/ diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h index ef28bbc34..16a3daa42 100644 --- a/apt-pkg/cacheset.h +++ b/apt-pkg/cacheset.h @@ -9,7 +9,6 @@ #ifndef APT_CACHESET_H #define APT_CACHESET_H // Include Files /*{{{*/ -#include #include #include #include @@ -17,11 +16,17 @@ #include #include +#include + #include #include +#include #ifndef APT_8_CLEANER_HEADERS #include +#endif +#ifndef APT_10_CLEANER_HEADERS +#include #endif /*}}}*/ diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 6f946b030..262ff9eab 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -1,28 +1,30 @@ /* */ -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include +#include #include -#include #include #include #include #include #include -#include "indexcopy.h" - #include using namespace std; diff --git a/apt-pkg/cdrom.h b/apt-pkg/cdrom.h index c58593550..f4a873808 100644 --- a/apt-pkg/cdrom.h +++ b/apt-pkg/cdrom.h @@ -4,6 +4,8 @@ #include #include +#include + #ifndef APT_8_CLEANER_HEADERS #include using namespace std; diff --git a/apt-pkg/clean.cc b/apt-pkg/clean.cc index 2dea8ffdd..0ee3b765d 100644 --- a/apt-pkg/clean.cc +++ b/apt-pkg/clean.cc @@ -16,7 +16,11 @@ #include #include #include +#include +#include +#include +#include #include #include #include diff --git a/apt-pkg/clean.h b/apt-pkg/clean.h index ad4049e83..930d54a7f 100644 --- a/apt-pkg/clean.h +++ b/apt-pkg/clean.h @@ -10,8 +10,13 @@ #ifndef APTPKG_CLEAN_H #define APTPKG_CLEAN_H - +#ifndef APT_10_CLEANER_HEADERS #include +#endif + +#include + +class pkgCache; class pkgArchiveCleaner { diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc index 20210ec0a..096d3bcf5 100644 --- a/apt-pkg/contrib/cdromutl.cc +++ b/apt-pkg/contrib/cdromutl.cc @@ -19,7 +19,10 @@ #include #include -#include +#include +#include +#include +#include #include #include #include diff --git a/apt-pkg/contrib/cmndline.cc b/apt-pkg/contrib/cmndline.cc index ed5800007..3799c822d 100644 --- a/apt-pkg/contrib/cmndline.cc +++ b/apt-pkg/contrib/cmndline.cc @@ -18,6 +18,11 @@ #include #include +#include +#include +#include +#include + #include /*}}}*/ using namespace std; diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 003fd01d8..00f6ad0f9 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -21,11 +21,18 @@ #include #include #include -#include - +#include + +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include #include diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc index 2d25f5ed9..892cd4874 100644 --- a/apt-pkg/contrib/error.cc +++ b/apt-pkg/contrib/error.cc @@ -17,12 +17,14 @@ #include +#include +#include +#include #include #include #include #include #include - #include #include diff --git a/apt-pkg/contrib/error.h b/apt-pkg/contrib/error.h index c06e45ee4..919b1e6d4 100644 --- a/apt-pkg/contrib/error.h +++ b/apt-pkg/contrib/error.h @@ -46,6 +46,7 @@ #include #include +#include #include class GlobalError /*{{{*/ @@ -73,7 +74,7 @@ public: /*{{{*/ * * \return \b false */ - bool FatalE(const char *Function,const char *Description,...) __like_printf(3) __cold; + bool FatalE(const char *Function,const char *Description,...) APT_PRINTF(3) APT_COLD; /** \brief add an Error message with errno to the list * @@ -82,7 +83,7 @@ public: /*{{{*/ * * \return \b false */ - bool Errno(const char *Function,const char *Description,...) __like_printf(3) __cold; + bool Errno(const char *Function,const char *Description,...) APT_PRINTF(3) APT_COLD; /** \brief add a warning message with errno to the list * @@ -94,7 +95,7 @@ public: /*{{{*/ * * \return \b false */ - bool WarningE(const char *Function,const char *Description,...) __like_printf(3) __cold; + bool WarningE(const char *Function,const char *Description,...) APT_PRINTF(3) APT_COLD; /** \brief add a notice message with errno to the list * @@ -103,7 +104,7 @@ public: /*{{{*/ * * \return \b false */ - bool NoticeE(const char *Function,const char *Description,...) __like_printf(3) __cold; + bool NoticeE(const char *Function,const char *Description,...) APT_PRINTF(3) APT_COLD; /** \brief add a debug message with errno to the list * @@ -112,7 +113,7 @@ public: /*{{{*/ * * \return \b false */ - bool DebugE(const char *Function,const char *Description,...) __like_printf(3) __cold; + bool DebugE(const char *Function,const char *Description,...) APT_PRINTF(3) APT_COLD; /** \brief adds an errno message with the given type * @@ -121,7 +122,7 @@ public: /*{{{*/ * \param Description of the error */ bool InsertErrno(MsgType const &type, const char* Function, - const char* Description,...) __like_printf(4) __cold; + const char* Description,...) APT_PRINTF(4) APT_COLD; /** \brief adds an errno message with the given type * @@ -155,7 +156,7 @@ public: /*{{{*/ * * \return \b false */ - bool Fatal(const char *Description,...) __like_printf(2) __cold; + bool Fatal(const char *Description,...) APT_PRINTF(2) APT_COLD; /** \brief add an Error message to the list * @@ -163,7 +164,7 @@ public: /*{{{*/ * * \return \b false */ - bool Error(const char *Description,...) __like_printf(2) __cold; + bool Error(const char *Description,...) APT_PRINTF(2) APT_COLD; /** \brief add a warning message to the list * @@ -174,7 +175,7 @@ public: /*{{{*/ * * \return \b false */ - bool Warning(const char *Description,...) __like_printf(2) __cold; + bool Warning(const char *Description,...) APT_PRINTF(2) APT_COLD; /** \brief add a notice message to the list * @@ -187,7 +188,7 @@ public: /*{{{*/ * * \return \b false */ - bool Notice(const char *Description,...) __like_printf(2) __cold; + bool Notice(const char *Description,...) APT_PRINTF(2) APT_COLD; /** \brief add a debug message to the list * @@ -195,14 +196,14 @@ public: /*{{{*/ * * \return \b false */ - bool Debug(const char *Description,...) __like_printf(2) __cold; + bool Debug(const char *Description,...) APT_PRINTF(2) APT_COLD; /** \brief adds an error message with the given type * * \param type of the error message * \param Description of the error */ - bool Insert(MsgType const &type, const char* Description,...) __like_printf(3) __cold; + bool Insert(MsgType const &type, const char* Description,...) APT_PRINTF(3) APT_COLD; /** \brief adds an error message with the given type * @@ -218,7 +219,7 @@ public: /*{{{*/ * should call this method again in that case */ bool Insert(MsgType type, const char* Description, - va_list &args, size_t &msgSize) __cold; + va_list &args, size_t &msgSize) APT_COLD; /** \brief is an error in the list? * diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 464950abd..55ba41128 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -26,16 +26,22 @@ #include #include #include - +#include + +#include +#include +#include +#include +#include +#include +#include #include #include #include - #include #include #include #include -#include #include #include #include diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index e752e9621..6fdea1294 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -27,6 +27,7 @@ #include #include #include +#include #include @@ -94,7 +95,7 @@ class FileFd And as the auto-conversation converts a 'unsigned long *' to a 'bool' instead of 'unsigned long long *' we need to provide this explicitely - otherwise applications magically start to fail… */ - __deprecated bool Read(void *To,unsigned long long Size,unsigned long *Actual) + bool Read(void *To,unsigned long long Size,unsigned long *Actual) APT_DEPRECATED { unsigned long long R; bool const T = Read(To, Size, &R); @@ -118,7 +119,7 @@ class FileFd // Simple manipulators inline int Fd() {return iFd;}; inline void Fd(int fd) { OpenDescriptor(fd, ReadWrite);}; - __deprecated gzFile gzFd(); + gzFile gzFd() APT_DEPRECATED; inline bool IsOpen() {return iFd >= 0;}; inline bool Failed() {return (Flags & Fail) == Fail;}; @@ -152,8 +153,8 @@ class FileFd bool OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor); // private helpers to set Fail flag and call _error->Error - bool FileFdErrno(const char* Function, const char* Description,...) __like_printf(3) __cold; - bool FileFdError(const char* Description,...) __like_printf(2) __cold; + bool FileFdErrno(const char* Function, const char* Description,...) APT_PRINTF(3) APT_COLD; + bool FileFdError(const char* Description,...) APT_PRINTF(2) APT_COLD; }; bool RunScripts(const char *Cnf); @@ -161,7 +162,7 @@ bool CopyFile(FileFd &From,FileFd &To); int GetLock(std::string File,bool Errors = true); bool FileExists(std::string File); bool RealFileExists(std::string File); -bool DirectoryExists(std::string const &Path) __attrib_const; +bool DirectoryExists(std::string const &Path) APT_CONST; bool CreateDirectory(std::string const &Parent, std::string const &Path); time_t GetModificationTime(std::string const &Path); diff --git a/apt-pkg/contrib/gpgv.cc b/apt-pkg/contrib/gpgv.cc index 9de227062..f24dd9640 100644 --- a/apt-pkg/contrib/gpgv.cc +++ b/apt-pkg/contrib/gpgv.cc @@ -2,21 +2,23 @@ // Include Files /*{{{*/ #include +#include +#include +#include +#include +#include + #include #include #include #include #include -#include -#include #include #include - -#include -#include -#include -#include -#include +#include +#include +#include +#include #include /*}}}*/ diff --git a/apt-pkg/contrib/gpgv.h b/apt-pkg/contrib/gpgv.h index d9712d6a8..ab3c68de5 100644 --- a/apt-pkg/contrib/gpgv.h +++ b/apt-pkg/contrib/gpgv.h @@ -9,17 +9,17 @@ #ifndef CONTRIB_GPGV_H #define CONTRIB_GPGV_H +#include + #include #include +#ifndef APT_10_CLEANER_HEADERS #include - -#if __GNUC__ >= 4 - #define APT_noreturn __attribute__ ((noreturn)) -#else - #define APT_noreturn /* no support */ #endif +class FileFd; + /** \brief generates and run the command to verify a file with gpgv * * If File and FileSig specify the same file it is assumed that we @@ -40,15 +40,13 @@ * @param FileSig is the signature (detached or clear-signed) */ void ExecGPGV(std::string const &File, std::string const &FileSig, - int const &statusfd, int fd[2]) APT_noreturn; + int const &statusfd, int fd[2]) APT_NORETURN; inline void ExecGPGV(std::string const &File, std::string const &FileSig, int const &statusfd = -1) { int fd[2]; ExecGPGV(File, FileSig, statusfd, fd); } -#undef APT_noreturn - /** \brief Split an inline signature into message and signature * * Takes a clear-signed message and puts the first signed message diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc index 890573d9c..5efafa511 100644 --- a/apt-pkg/contrib/hashes.cc +++ b/apt-pkg/contrib/hashes.cc @@ -16,8 +16,12 @@ #include #include #include -#include +#include +#include +#include +#include +#include #include #include #include diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h index 636cad257..979ee1eb8 100644 --- a/apt-pkg/contrib/hashes.h +++ b/apt-pkg/contrib/hashes.h @@ -17,17 +17,22 @@ #include #include #include -#include -#include -#include #include - +#include #ifndef APT_8_CLEANER_HEADERS using std::min; using std::vector; #endif +#ifndef APT_10_CLEANER_HEADERS +#include +#include +#include +#endif + + +class FileFd; // helper class that contains hash function name // and hash diff --git a/apt-pkg/contrib/hashsum.cc b/apt-pkg/contrib/hashsum.cc index d02177724..25ccc187d 100644 --- a/apt-pkg/contrib/hashsum.cc +++ b/apt-pkg/contrib/hashsum.cc @@ -1,6 +1,9 @@ // Cryptographic API Base #include +#include + +#include #include #include "hashsum_template.h" diff --git a/apt-pkg/contrib/hashsum_template.h b/apt-pkg/contrib/hashsum_template.h index f96188eb8..869dc5cb7 100644 --- a/apt-pkg/contrib/hashsum_template.h +++ b/apt-pkg/contrib/hashsum_template.h @@ -10,20 +10,24 @@ #ifndef APTPKG_HASHSUM_TEMPLATE_H #define APTPKG_HASHSUM_TEMPLATE_H -#include #include #include -#include -#include #include +#ifndef APT_10_CLEANER_HEADERS +#include +#include +#include +#endif #ifndef APT_8_CLEANER_HEADERS using std::string; using std::min; #endif +class FileFd; + template class HashSumValue { diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h index 294242e68..d97053553 100644 --- a/apt-pkg/contrib/macros.h +++ b/apt-pkg/contrib/macros.h @@ -71,13 +71,13 @@ #endif #if APT_GCC_VERSION >= 0x0300 - #define APT_UNUSED __attribute__((unused)) + #define APT_DEPRECATED __attribute__ ((deprecated)) #define APT_CONST __attribute__((const)) #define APT_PURE __attribute__((pure)) #define APT_NORETURN __attribute__((noreturn)) #define APT_PRINTF(n) __attribute__((format(printf, n, n + 1))) #else - #define APT_UNUSED + #define APT_DEPRECATED #define APT_CONST #define APT_PURE #define APT_NORETURN @@ -103,8 +103,8 @@ #define APT_COLD __attribute__ ((__cold__)) #define APT_HOT __attribute__ ((__hot__)) #else - #define __cold - #define __hot + #define APT_COLD + #define APT_HOT #endif #ifndef APT_10_CLEANER_HEADERS diff --git a/apt-pkg/contrib/md5.cc b/apt-pkg/contrib/md5.cc index 4351aeb22..b487a96f9 100644 --- a/apt-pkg/contrib/md5.cc +++ b/apt-pkg/contrib/md5.cc @@ -38,13 +38,9 @@ #include #include -#include -#include +#include #include -#include -#include // For htonl -#include /*}}}*/ // byteSwap - Swap bytes in a buffer /*{{{*/ diff --git a/apt-pkg/contrib/md5.h b/apt-pkg/contrib/md5.h index 195455645..f4992c223 100644 --- a/apt-pkg/contrib/md5.h +++ b/apt-pkg/contrib/md5.h @@ -23,14 +23,15 @@ #ifndef APTPKG_MD5_H #define APTPKG_MD5_H - -#include -#include -#include #include #include "hashsum_template.h" +#ifndef APT_10_CLEANER_HEADERS +#include +#include +#include +#endif #ifndef APT_8_CLEANER_HEADERS using std::string; using std::min; diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 37acba340..b2a53a6cb 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -22,11 +22,11 @@ #include #include #include +#include +#include #include -#include #include -#include #include #include #include diff --git a/apt-pkg/contrib/netrc.cc b/apt-pkg/contrib/netrc.cc index 32b146581..feaed67c8 100644 --- a/apt-pkg/contrib/netrc.cc +++ b/apt-pkg/contrib/netrc.cc @@ -15,14 +15,13 @@ #include #include -#include -#include #include #include #include #include #include +#include #include #include "netrc.h" diff --git a/apt-pkg/contrib/netrc.h b/apt-pkg/contrib/netrc.h index 6feb5b726..dbeb45386 100644 --- a/apt-pkg/contrib/netrc.h +++ b/apt-pkg/contrib/netrc.h @@ -16,6 +16,8 @@ #include +#include + #ifndef APT_8_CLEANER_HEADERS #include #endif @@ -25,9 +27,9 @@ class URI; -// kill this export on the next ABI break - strongly doubt its in use anyway +// FIXME: kill this export on the next ABI break - strongly doubt its in use anyway // outside of the apt itself, its really a internal interface -__deprecated int parsenetrc (char *host, char *login, char *password, char *filename); +APT_DEPRECATED int parsenetrc (char *host, char *login, char *password, char *filename); void maybe_add_auth (URI &Uri, std::string NetRCFile); #endif diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc index 9d74ed495..4ff4f181d 100644 --- a/apt-pkg/contrib/progress.cc +++ b/apt-pkg/contrib/progress.cc @@ -14,6 +14,8 @@ #include #include +#include +#include #include #include #include diff --git a/apt-pkg/contrib/sha1.cc b/apt-pkg/contrib/sha1.cc index b5a6a2440..bf6bc6cb6 100644 --- a/apt-pkg/contrib/sha1.cc +++ b/apt-pkg/contrib/sha1.cc @@ -32,12 +32,9 @@ #include #include -#include -#include +#include #include -#include -#include /*}}}*/ // SHA1Transform - Alters an existing SHA-1 hash /*{{{*/ diff --git a/apt-pkg/contrib/sha1.h b/apt-pkg/contrib/sha1.h index a8d55eb13..5770c315a 100644 --- a/apt-pkg/contrib/sha1.h +++ b/apt-pkg/contrib/sha1.h @@ -14,12 +14,13 @@ #ifndef APTPKG_SHA1_H #define APTPKG_SHA1_H +#include "hashsum_template.h" + +#ifndef APT_10_CLEANER_HEADERS #include #include #include - -#include "hashsum_template.h" - +#endif #ifndef APT_8_CLEANER_HEADERS using std::string; using std::min; diff --git a/apt-pkg/contrib/sha2.h b/apt-pkg/contrib/sha2.h index 8e0c99a1b..a25ad4d32 100644 --- a/apt-pkg/contrib/sha2.h +++ b/apt-pkg/contrib/sha2.h @@ -14,14 +14,18 @@ #ifndef APTPKG_SHA2_H #define APTPKG_SHA2_H -#include #include -#include -#include #include "sha2_internal.h" #include "hashsum_template.h" +#ifndef APT_10_CLEANER_HEADERS +#include +#include +#include +#endif + + typedef HashSumValue<512> SHA512SumValue; typedef HashSumValue<256> SHA256SumValue; diff --git a/apt-pkg/contrib/sha2_internal.cc b/apt-pkg/contrib/sha2_internal.cc index bb2560252..131ff5beb 100644 --- a/apt-pkg/contrib/sha2_internal.cc +++ b/apt-pkg/contrib/sha2_internal.cc @@ -33,6 +33,7 @@ */ #include +#include #include /* memcpy()/memset() or bcopy()/bzero() */ #include /* assert() */ #include "sha2_internal.h" diff --git a/apt-pkg/contrib/sha2_internal.h b/apt-pkg/contrib/sha2_internal.h index d9d429c92..1b82d965d 100644 --- a/apt-pkg/contrib/sha2_internal.h +++ b/apt-pkg/contrib/sha2_internal.h @@ -44,6 +44,7 @@ #ifdef SHA2_USE_INTTYPES_H +#include #include #endif /* SHA2_USE_INTTYPES_H */ diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 61fcc6a7d..2100ee47b 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -21,6 +21,11 @@ #include #include +#include +#include +#include +#include +#include #include #include #include @@ -33,9 +38,9 @@ #include #include - -using namespace std; /*}}}*/ +using namespace std; + // Strip - Remove white space from the front and back of a string /*{{{*/ // --------------------------------------------------------------------- namespace APT { diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index 3a6d38b75..79479957d 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -18,15 +18,18 @@ #include -#include #include #include #include #include #include +#include #include "macros.h" +#ifndef APT_10_CLEANER_HEADERS +#include +#endif #ifndef APT_8_CLEANER_HEADERS using std::string; using std::vector; @@ -60,9 +63,9 @@ std::string Base64Encode(const std::string &Str); std::string OutputInDepth(const unsigned long Depth, const char* Separator=" "); std::string URItoFileName(const std::string &URI); std::string TimeRFC1123(time_t Date); -bool RFC1123StrToTime(const char* const str,time_t &time) __must_check; -bool FTPMDTMStrToTime(const char* const str,time_t &time) __must_check; -__deprecated bool StrToTime(const std::string &Val,time_t &Result); +bool RFC1123StrToTime(const char* const str,time_t &time) APT_MUSTCHECK; +bool FTPMDTMStrToTime(const char* const str,time_t &time) APT_MUSTCHECK; +APT_DEPRECATED bool StrToTime(const std::string &Val,time_t &Result); std::string LookupTag(const std::string &Message,const char *Tag,const char *Default = 0); int StringToBool(const std::string &Text,int Default = -1); bool ReadMessages(int Fd, std::vector &List); @@ -76,7 +79,7 @@ bool TokSplitString(char Tok,char *Input,char **List, unsigned long ListMax); // split a given string by a char -std::vector VectorizeString(std::string const &haystack, char const &split) __attrib_const; +std::vector VectorizeString(std::string const &haystack, char const &split) APT_CONST; /* \brief Return a vector of strings from string "input" where "sep" * is used as the delimiter string. @@ -94,13 +97,13 @@ std::vector VectorizeString(std::string const &haystack, char const */ std::vector StringSplit(std::string const &input, std::string const &sep, - unsigned int maxsplit=std::numeric_limits::max()) __attrib_const; + unsigned int maxsplit=std::numeric_limits::max()) APT_CONST; -void ioprintf(std::ostream &out,const char *format,...) __like_printf(2); -void strprintf(std::string &out,const char *format,...) __like_printf(2); -char *safe_snprintf(char *Buffer,char *End,const char *Format,...) __like_printf(3); +void ioprintf(std::ostream &out,const char *format,...) APT_PRINTF(2); +void strprintf(std::string &out,const char *format,...) APT_PRINTF(2); +char *safe_snprintf(char *Buffer,char *End,const char *Format,...) APT_PRINTF(3); bool CheckDomainList(const std::string &Host, const std::string &List); -int tolower_ascii(int const c) __attrib_const __hot; +int tolower_ascii(int const c) APT_CONST APT_HOT; std::string StripEpoch(const std::string &VerStr); #define APT_MKSTRCMP(name,func) \ diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 909dfcf47..1b35d0d52 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -23,7 +22,18 @@ #include #include #include - +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include #include /*}}}*/ diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h index e079d40c2..3bcb3b64f 100644 --- a/apt-pkg/deb/debindexfile.h +++ b/apt-pkg/deb/debindexfile.h @@ -16,9 +16,17 @@ #ifndef PKGLIB_DEBINDEXFILE_H #define PKGLIB_DEBINDEXFILE_H +#include +#include +#include +#include +#include + +class OpProgress; +class pkgAcquire; +class pkgCacheGenerator; -#include class debStatusIndex : public pkgIndexFile { diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 3374865ac..7777d654e 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -21,8 +21,17 @@ #include #include #include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include #include /*}}}*/ diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 0531b20f3..c0973260f 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -13,11 +13,18 @@ #include #include +#include +#include + +#include +#include #ifndef APT_8_CLEANER_HEADERS #include #endif +class FileFd; + class debListParser : public pkgCacheGenerator::ListParser { public: diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 504877558..6fd12add8 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -9,8 +9,15 @@ #include #include #include -#include - +#include +#include +#include + +#include +#include +#include +#include +#include #include #include diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h index cef8d68f7..2286fa8b2 100644 --- a/apt-pkg/deb/debmetaindex.h +++ b/apt-pkg/deb/debmetaindex.h @@ -3,7 +3,7 @@ #define PKGLIB_DEBMETAINDEX_H #include -#include +#include #include #include @@ -12,6 +12,12 @@ #ifndef APT_8_CLEANER_HEADERS #include #endif +#ifndef APT_10_CLEANER_HEADERS +#include +#endif + +class pkgAcquire; +class pkgIndexFile; class debReleaseIndex : public metaIndex { public: diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index 184c07c33..6063db5a8 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -12,10 +12,16 @@ #include #include -#include #include #include +#include +#include +#include +#include +#include +#include +#include #include /*}}}*/ diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index b5e3bbdba..bdac6c90b 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -17,6 +17,9 @@ #include #include #include +#include + +#include #ifndef APT_8_CLEANER_HEADERS #include diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc index daa54d036..b09588dd3 100644 --- a/apt-pkg/deb/debsrcrecords.cc +++ b/apt-pkg/deb/debsrcrecords.cc @@ -15,12 +15,19 @@ #include #include #include -#include #include +#include +#include -using std::max; +#include +#include +#include +#include +#include +#include /*}}}*/ +using std::max; using std::string; // SrcRecordParser::Binaries - Return the binaries field /*{{{*/ diff --git a/apt-pkg/deb/debsrcrecords.h b/apt-pkg/deb/debsrcrecords.h index a8fb465bb..b65d1480b 100644 --- a/apt-pkg/deb/debsrcrecords.h +++ b/apt-pkg/deb/debsrcrecords.h @@ -11,11 +11,16 @@ #ifndef PKGLIB_DEBSRCRECORDS_H #define PKGLIB_DEBSRCRECORDS_H - #include #include #include +#include +#include +#include + +class pkgIndexFile; + class debSrcRecordParser : public pkgSrcRecords::Parser { /** \brief dpointer placeholder (for later in case we need it) */ diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index b95ff15df..db557e537 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -19,7 +19,14 @@ #include #include #include -#include +#include +#include + +#include +#include +#include +#include +#include #include #include #include diff --git a/apt-pkg/deb/debsystem.h b/apt-pkg/deb/debsystem.h index 855123516..a945f68fb 100644 --- a/apt-pkg/deb/debsystem.h +++ b/apt-pkg/deb/debsystem.h @@ -12,11 +12,19 @@ #include #include +#include +#include +class Configuration; +class pkgIndexFile; +class pkgPackageManager; class debSystemPrivate; -class debStatusIndex; class pkgDepCache; +#ifndef APT_10_CLEANER_HEADERS +class debStatusIndex; +#endif + class debSystem : public pkgSystem { // private d-pointer diff --git a/apt-pkg/deb/debversion.cc b/apt-pkg/deb/debversion.cc index 74e2552ff..a5eacb7f5 100644 --- a/apt-pkg/deb/debversion.cc +++ b/apt-pkg/deb/debversion.cc @@ -15,6 +15,8 @@ #include #include +#include +#include #include #include /*}}}*/ diff --git a/apt-pkg/deb/debversion.h b/apt-pkg/deb/debversion.h index f1d6f3cc5..981ea9ad2 100644 --- a/apt-pkg/deb/debversion.h +++ b/apt-pkg/deb/debversion.h @@ -12,12 +12,12 @@ #ifndef PKGLIB_DEBVERSION_H #define PKGLIB_DEBVERSION_H +#include +#include -#include - class debVersioningSystem : public pkgVersioningSystem -{ +{ public: static int CmpFragment(const char *A, const char *AEnd, const char *B, diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index adf59516e..9fee7c923 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -10,41 +10,45 @@ // Includes /*{{{*/ #include -#include -#include +#include #include #include -#include -#include +#include +#include #include -#include -#include #include +#include +#include +#include +#include +#include +#include -#include -#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include +#include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include /*}}}*/ diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index c144f78e1..859c74b46 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -11,11 +11,20 @@ #define PKGLIB_DPKGPM_H #include +#include +#include + #include #include #include -#include +#include + +#ifndef APT_10_CLEANER_HEADERS #include +#endif + +class pkgDepCache; +namespace APT { namespace Progress { class PackageManager; } } #ifndef APT_8_CLEANER_HEADERS using std::vector; @@ -82,7 +91,7 @@ class pkgDPkgPM : public pkgPackageManager // Helpers bool RunScriptsWithPkgs(const char *Cnf); - __deprecated bool SendV2Pkgs(FILE *F); + APT_DEPRECATED bool SendV2Pkgs(FILE *F); bool SendPkgsInfo(FILE * const F, unsigned int const &Version); void WriteHistoryTag(std::string const &tag, std::string value); std::string ExpandShortPackageName(pkgDepCache &Cache, diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index b45f5d9b5..149dbc0e7 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -11,20 +11,26 @@ #include #include -#include #include #include #include -#include #include #include #include #include -#include #include #include #include - +#include +#include +#include + +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index 50f810806..3ffc3b47d 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -40,18 +40,26 @@ #include #include +#include + +#include -#include #include -#include #include +#include +#include #ifndef APT_8_CLEANER_HEADERS #include #include #endif +#ifndef APT_10_CLEANER_HEADERS +#include +#include +#endif class OpProgress; +class pkgVersioningSystem; class pkgDepCache : protected pkgCache::Namespace { diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index dbd2dba46..ee42267bc 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -11,16 +11,25 @@ #include #include #include -#include -#include #include #include #include +#include +#include +#include +#include -#include +#include +#include +#include +#include +#include #include - +#include +#include +#include #include +#include #include /*}}}*/ diff --git a/apt-pkg/edsp.h b/apt-pkg/edsp.h index 828ee3753..ae20ed7db 100644 --- a/apt-pkg/edsp.h +++ b/apt-pkg/edsp.h @@ -9,8 +9,11 @@ #ifndef PKGLIB_EDSP_H #define PKGLIB_EDSP_H -#include #include +#include +#include + +#include #include #include diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc index 80b9f79ea..10313fd61 100644 --- a/apt-pkg/edsp/edspindexfile.cc +++ b/apt-pkg/edsp/edspindexfile.cc @@ -10,15 +10,20 @@ #include #include -#include -#include -#include #include -#include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include -#include +#include +#include +#include /*}}}*/ // edspIndex::edspIndex - Constructor /*{{{*/ diff --git a/apt-pkg/edsp/edspindexfile.h b/apt-pkg/edsp/edspindexfile.h index de10f2d2f..bd3b41cf2 100644 --- a/apt-pkg/edsp/edspindexfile.h +++ b/apt-pkg/edsp/edspindexfile.h @@ -9,11 +9,15 @@ #define PKGLIB_EDSPINDEXFILE_H #include +#include #ifndef APT_8_CLEANER_HEADERS #include #endif +class OpProgress; +class pkgCacheGenerator; + class edspIndex : public debStatusIndex { /** \brief dpointer placeholder (for later in case we need it) */ diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc index 37959f37b..139deb9f1 100644 --- a/apt-pkg/edsp/edsplistparser.cc +++ b/apt-pkg/edsp/edsplistparser.cc @@ -12,11 +12,13 @@ #include #include -#include -#include -#include #include -#include +#include +#include +#include +#include + +#include /*}}}*/ // ListParser::edspListParser - Constructor /*{{{*/ diff --git a/apt-pkg/edsp/edsplistparser.h b/apt-pkg/edsp/edsplistparser.h index a7bf9de95..959fb587f 100644 --- a/apt-pkg/edsp/edsplistparser.h +++ b/apt-pkg/edsp/edsplistparser.h @@ -12,6 +12,10 @@ #define PKGLIB_EDSPLISTPARSER_H #include +#include +#include + +#include #ifndef APT_8_CLEANER_HEADERS #include diff --git a/apt-pkg/edsp/edspsystem.cc b/apt-pkg/edsp/edspsystem.cc index b509fa001..92edb8d77 100644 --- a/apt-pkg/edsp/edspsystem.cc +++ b/apt-pkg/edsp/edspsystem.cc @@ -11,16 +11,17 @@ // Include Files /*{{{*/ #include -#include +#include #include #include -#include -#include +#include #include -#include -#include -#include -#include +#include +#include + +#include +#include +#include #include /*}}}*/ diff --git a/apt-pkg/edsp/edspsystem.h b/apt-pkg/edsp/edspsystem.h index ca703fa84..eafff39ba 100644 --- a/apt-pkg/edsp/edspsystem.h +++ b/apt-pkg/edsp/edspsystem.h @@ -11,8 +11,17 @@ #define PKGLIB_EDSPSYSTEM_H #include +#include +#include +#include + +class Configuration; +class pkgDepCache; +class pkgIndexFile; +class pkgPackageManager; class edspIndex; + class edspSystem : public pkgSystem { /** \brief dpointer placeholder (for later in case we need it) */ diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index 59afa86ec..3a1385fa5 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -20,17 +20,17 @@ #include #include #include -#include #include +#include +#include #include #include #include #include -#include -#include #include #include +#include #include "indexcopy.h" #include diff --git a/apt-pkg/indexcopy.h b/apt-pkg/indexcopy.h index e6a07a887..43cdb3f0a 100644 --- a/apt-pkg/indexcopy.h +++ b/apt-pkg/indexcopy.h @@ -14,16 +14,18 @@ #include #include -#include #include +#ifndef APT_10_CLEANER_HEADERS +#include +class FileFd; +#endif #ifndef APT_8_CLEANER_HEADERS using std::string; using std::vector; #endif class pkgTagSection; -class FileFd; class indexRecords; class pkgCdromStatus; @@ -99,9 +101,9 @@ class SigVerify /*{{{*/ bool CopyAndVerify(std::string CDROM,std::string Name,std::vector &SigList, std::vector PkgList,std::vector SrcList); - __deprecated static bool RunGPGV(std::string const &File, std::string const &FileOut, + APT_DEPRECATED static bool RunGPGV(std::string const &File, std::string const &FileOut, int const &statusfd, int fd[2]); - __deprecated static bool RunGPGV(std::string const &File, std::string const &FileOut, + APT_DEPRECATED static bool RunGPGV(std::string const &File, std::string const &FileOut, int const &statusfd = -1); }; /*}}}*/ diff --git a/apt-pkg/indexfile.cc b/apt-pkg/indexfile.cc index 875c80336..89615cb41 100644 --- a/apt-pkg/indexfile.cc +++ b/apt-pkg/indexfile.cc @@ -13,7 +13,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include #include /*}}}*/ @@ -82,7 +88,7 @@ bool pkgIndexFile::TranslationsAvailable() { is already done in getLanguages(). Note also that this check is rather bad (doesn't take three character like ast into account). TODO: Remove method with next API break */ -__attribute__ ((deprecated)) bool pkgIndexFile::CheckLanguageCode(const char *Lang) +APT_DEPRECATED bool pkgIndexFile::CheckLanguageCode(const char *Lang) { if (strlen(Lang) == 2 || (strlen(Lang) == 5 && Lang[2] == '_')) return true; @@ -98,7 +104,7 @@ __attribute__ ((deprecated)) bool pkgIndexFile::CheckLanguageCode(const char *La /* As we have now possibly more than one LanguageCode this method is supersided by a) private classmembers or b) getLanguages(). TODO: Remove method with next API break */ -__attribute__ ((deprecated)) std::string pkgIndexFile::LanguageCode() { +APT_DEPRECATED std::string pkgIndexFile::LanguageCode() { if (TranslationsAvailable() == false) return ""; return APT::Configuration::getLanguages()[0]; diff --git a/apt-pkg/indexfile.h b/apt-pkg/indexfile.h index 9a5c74200..98cdda603 100644 --- a/apt-pkg/indexfile.h +++ b/apt-pkg/indexfile.h @@ -22,18 +22,21 @@ #ifndef PKGLIB_INDEXFILE_H #define PKGLIB_INDEXFILE_H - -#include -#include #include #include +#include +#include #include +#include + #ifndef APT_8_CLEANER_HEADERS using std::string; #endif - +#ifndef APT_10_CLEANER_HEADERS class pkgAcquire; +#endif + class pkgCacheGenerator; class OpProgress; @@ -79,10 +82,10 @@ class pkgIndexFile virtual bool HasPackages() const = 0; virtual unsigned long Size() const = 0; virtual bool Merge(pkgCacheGenerator &/*Gen*/, OpProgress* /*Prog*/) const { return false; }; - __deprecated virtual bool Merge(pkgCacheGenerator &Gen, OpProgress &Prog) const + APT_DEPRECATED virtual bool Merge(pkgCacheGenerator &Gen, OpProgress &Prog) const { return Merge(Gen, &Prog); }; virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const {return true;}; - __deprecated virtual bool MergeFileProvides(pkgCacheGenerator &Gen, OpProgress &Prog) const + APT_DEPRECATED virtual bool MergeFileProvides(pkgCacheGenerator &Gen, OpProgress &Prog) const {return MergeFileProvides(Gen, &Prog);}; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc index c1c397e31..1123d1690 100644 --- a/apt-pkg/indexrecords.cc +++ b/apt-pkg/indexrecords.cc @@ -14,8 +14,13 @@ #include #include -#include +#include +#include #include +#include +#include +#include +#include #include /*}}}*/ diff --git a/apt-pkg/indexrecords.h b/apt-pkg/indexrecords.h index d003ec0fa..e31f889ad 100644 --- a/apt-pkg/indexrecords.h +++ b/apt-pkg/indexrecords.h @@ -5,17 +5,19 @@ #ifndef PKGLIB_INDEXRECORDS_H #define PKGLIB_INDEXRECORDS_H - -#include #include #include #include #include +#include #ifndef APT_8_CLEANER_HEADERS #include #endif +#ifndef APT_10_CLEANER_HEADERS +#include +#endif class indexRecords { diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc index 6ab5ec42d..3a35f852e 100644 --- a/apt-pkg/init.cc +++ b/apt-pkg/init.cc @@ -15,9 +15,11 @@ #include #include #include +#include +#include +#include #include -#include #include /*}}}*/ diff --git a/apt-pkg/init.h b/apt-pkg/init.h index 4ee7a95ac..d062392e3 100644 --- a/apt-pkg/init.h +++ b/apt-pkg/init.h @@ -16,7 +16,9 @@ #include #include #endif +#ifndef APT_10_CLEANER_HEADERS #include +#endif class pkgSystem; class Configuration; diff --git a/apt-pkg/install-progress.cc b/apt-pkg/install-progress.cc index 657330b60..6f43e0bc0 100644 --- a/apt-pkg/install-progress.cc +++ b/apt-pkg/install-progress.cc @@ -1,17 +1,23 @@ +#include + #include #include #include #include -#include - -#include +#include +#include +#include +#include +#include #include #include #include #include #include +#include + namespace APT { namespace Progress { @@ -329,15 +335,15 @@ bool PackageManagerFancy::StatusChanged(std::string PackageName, int row = GetNumberTerminalRows(); - static string save_cursor = "\033[s"; - static string restore_cursor = "\033[u"; - - static string set_bg_color = "\033[42m"; // green - static string set_fg_color = "\033[30m"; // black - - static string restore_bg = "\033[49m"; - static string restore_fg = "\033[39m"; - + static std::string save_cursor = "\033[s"; + static std::string restore_cursor = "\033[u"; + + static std::string set_bg_color = "\033[42m"; // green + static std::string set_fg_color = "\033[30m"; // black + + static std::string restore_bg = "\033[49m"; + static std::string restore_fg = "\033[39m"; + std::cout << save_cursor // move cursor position to last row << "\033[" << row << ";0f" diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h index 18a90a29d..ffabaadbf 100644 --- a/apt-pkg/metaindex.h +++ b/apt-pkg/metaindex.h @@ -1,12 +1,19 @@ #ifndef PKGLIB_METAINDEX_H #define PKGLIB_METAINDEX_H - -#include -#include #include #include +#include + +#include +#include + +#ifndef APT_10_CLEANER_HEADERS +#include +class pkgCacheGenerator; +class OpProgress; +#endif #ifndef APT_8_CLEANER_HEADERS #include #include @@ -15,8 +22,6 @@ using std::string; #endif class pkgAcquire; -class pkgCacheGenerator; -class OpProgress; class metaIndex { diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc index 21b5fc4e7..a1fcbcc98 100644 --- a/apt-pkg/orderlist.cc +++ b/apt-pkg/orderlist.cc @@ -68,10 +68,14 @@ #include #include #include -#include #include #include +#include +#include +#include +#include +#include #include /*}}}*/ diff --git a/apt-pkg/orderlist.h b/apt-pkg/orderlist.h index a2d7b321b..1fdfbf559 100644 --- a/apt-pkg/orderlist.h +++ b/apt-pkg/orderlist.h @@ -16,10 +16,12 @@ #ifndef PKGLIB_ORDERLIST_H #define PKGLIB_ORDERLIST_H - #include +#include #include +#include + class pkgDepCache; class pkgOrderList : protected pkgCache::Namespace { @@ -46,7 +48,7 @@ class pkgOrderList : protected pkgCache::Namespace bool Debug; // Main visit function - __deprecated bool VisitNode(PkgIterator Pkg) { return VisitNode(Pkg, "UNKNOWN"); }; + APT_DEPRECATED bool VisitNode(PkgIterator Pkg) { return VisitNode(Pkg, "UNKNOWN"); }; bool VisitNode(PkgIterator Pkg, char const* from); bool VisitDeps(DepFunc F,PkgIterator Pkg); bool VisitRDeps(DepFunc F,PkgIterator Pkg); diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 0be76b311..4d08fb3ba 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -13,7 +13,7 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include +#include #include #include @@ -24,7 +24,14 @@ #include #include #include - +#include +#include +#include +#include + +#include +#include +#include #include #include diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h index d684463eb..a86b176a4 100644 --- a/apt-pkg/packagemanager.h +++ b/apt-pkg/packagemanager.h @@ -23,15 +23,17 @@ #ifndef PKGLIB_PACKAGEMANAGER_H #define PKGLIB_PACKAGEMANAGER_H -#include #include -#include #include +#include #include -#include #include +#ifndef APT_10_CLEANER_HEADERS +#include +#include +#endif #ifndef APT_8_CLEANER_HEADERS #include using std::string; @@ -109,7 +111,7 @@ class pkgPackageManager : protected pkgCache::Namespace #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) OrderResult DoInstall(APT::Progress::PackageManager *progress); // compat - __deprecated OrderResult DoInstall(int statusFd=-1); + APT_DEPRECATED OrderResult DoInstall(int statusFd=-1); #else OrderResult DoInstall(int statusFd=-1); #endif @@ -124,7 +126,7 @@ class pkgPackageManager : protected pkgCache::Namespace // stuff that needs to be done after the fork OrderResult DoInstallPostFork(APT::Progress::PackageManager *progress); // compat - __deprecated OrderResult DoInstallPostFork(int statusFd=-1); + APT_DEPRECATED OrderResult DoInstallPostFork(int statusFd=-1); #else OrderResult DoInstallPostFork(int statusFd=-1); #endif diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 9c14e626e..a19b9571c 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -29,12 +29,15 @@ #include #include #include +#include #include +#include +#include +#include +#include #include #include -#include -#include #include /*}}}*/ diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 185b9ca45..525f1dfb4 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -18,20 +18,26 @@ #include #include #include -#include #include #include #include #include -#include #include #include - +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include #include #include #include -#include -#include #include /*}}}*/ @@ -1333,7 +1339,7 @@ DynamicMMap* pkgCacheGenerator::CreateDynamicMMap(FileFd *CacheF, unsigned long the cache will be stored there. This is pretty much mandetory if you are using AllowMem. AllowMem lets the function be run as non-root where it builds the cache 'fast' into a memory buffer. */ -__deprecated bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, +APT_DEPRECATED bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, MMap **OutMap, bool AllowMem) { return pkgCacheGenerator::MakeStatusCache(List, &Progress, OutMap, AllowMem); } bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress, @@ -1534,7 +1540,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress // CacheGenerator::MakeOnlyStatusCache - Build only a status files cache/*{{{*/ // --------------------------------------------------------------------- /* */ -__deprecated bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap) +APT_DEPRECATED bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap) { return pkgCacheGenerator::MakeOnlyStatusCache(&Progress, OutMap); } bool pkgCacheGenerator::MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap) { diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index e8901025e..9ccf71c7b 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -19,16 +19,18 @@ #ifndef PKGLIB_PKGCACHEGEN_H #define PKGLIB_PKGCACHEGEN_H - -#include #include +#include +#include +#include #include #include +#include +class FileFd; class pkgSourceList; class OpProgress; -class MMap; class pkgIndexFile; class pkgCacheGenerator /*{{{*/ @@ -80,7 +82,7 @@ class pkgCacheGenerator /*{{{*/ bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver, map_ptrloc const Version, unsigned int const &Op, unsigned int const &Type, map_ptrloc* &OldDepLast); - __deprecated unsigned long NewVersion(pkgCache::VerIterator &Ver,const std::string &VerStr,unsigned long Next) + unsigned long NewVersion(pkgCache::VerIterator &Ver,const std::string &VerStr,unsigned long Next) APT_DEPRECATED { return NewVersion(Ver, VerStr, 0, 0, Next); } unsigned long NewVersion(pkgCache::VerIterator &Ver,const std::string &VerStr, map_ptrloc const ParentPkg, unsigned long const Hash, @@ -102,7 +104,7 @@ class pkgCacheGenerator /*{{{*/ bool HasFileDeps() {return FoundFileDeps;}; bool MergeFileProvides(ListParser &List); - __deprecated bool FinishCache(OpProgress *Progress); + bool FinishCache(OpProgress *Progress) APT_DEPRECATED; static bool MakeStatusCache(pkgSourceList &List,OpProgress *Progress, MMap **OutMap = 0,bool AllowMem = false); diff --git a/apt-pkg/pkgrecords.cc b/apt-pkg/pkgrecords.cc index 36dab3480..c403e4dc3 100644 --- a/apt-pkg/pkgrecords.cc +++ b/apt-pkg/pkgrecords.cc @@ -14,7 +14,11 @@ #include #include #include -#include +#include +#include + +#include +#include #include /*}}}*/ diff --git a/apt-pkg/pkgrecords.h b/apt-pkg/pkgrecords.h index ca0984bbf..b5237b3a0 100644 --- a/apt-pkg/pkgrecords.h +++ b/apt-pkg/pkgrecords.h @@ -17,8 +17,9 @@ #ifndef PKGLIB_PKGRECORDS_H #define PKGLIB_PKGRECORDS_H - #include + +#include #include class pkgRecords /*{{{*/ diff --git a/apt-pkg/pkgsystem.cc b/apt-pkg/pkgsystem.cc index 05ba6e0e6..ee6c3f4ec 100644 --- a/apt-pkg/pkgsystem.cc +++ b/apt-pkg/pkgsystem.cc @@ -13,7 +13,6 @@ #include #include -#include #include #include /*}}}*/ diff --git a/apt-pkg/pkgsystem.h b/apt-pkg/pkgsystem.h index eb75df412..6e33c67ed 100644 --- a/apt-pkg/pkgsystem.h +++ b/apt-pkg/pkgsystem.h @@ -38,6 +38,7 @@ #define PKGLIB_PKGSYSTEM_H #include +#include #include @@ -50,7 +51,6 @@ class pkgPackageManager; class pkgVersioningSystem; class Configuration; class pkgIndexFile; -class PkgFileIterator; class pkgSystem { diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index 2176f1f42..ae30b6f50 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -33,7 +33,15 @@ #include #include #include - +#include +#include +#include + +#include +#include +#include +#include +#include #include #include diff --git a/apt-pkg/policy.h b/apt-pkg/policy.h index 5172a3c3b..f15d8c0a0 100644 --- a/apt-pkg/policy.h +++ b/apt-pkg/policy.h @@ -33,10 +33,13 @@ #ifndef PKGLIB_POLICY_H #define PKGLIB_POLICY_H - #include +#include +#include #include + #include +#include #ifndef APT_8_CLEANER_HEADERS using std::vector; diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc index 1f5179885..e37899ec6 100644 --- a/apt-pkg/sourcelist.cc +++ b/apt-pkg/sourcelist.cc @@ -18,7 +18,16 @@ #include #include #include - +#include +#include + +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/apt-pkg/sourcelist.h b/apt-pkg/sourcelist.h index 0ccb4aa00..af7569375 100644 --- a/apt-pkg/sourcelist.h +++ b/apt-pkg/sourcelist.h @@ -27,18 +27,26 @@ #ifndef PKGLIB_SOURCELIST_H #define PKGLIB_SOURCELIST_H +#include +#include + +#include + #include #include #include -#include -#include +#ifndef APT_8_CLEANER_HEADERS +#include +#endif #ifndef APT_8_CLEANER_HEADERS #include using std::string; using std::vector; #endif +class FileFd; +class pkgTagSection; class pkgAcquire; class pkgIndexFile; class metaIndex; diff --git a/apt-pkg/srcrecords.cc b/apt-pkg/srcrecords.cc index 60b62850a..775cf2e5f 100644 --- a/apt-pkg/srcrecords.cc +++ b/apt-pkg/srcrecords.cc @@ -16,8 +16,13 @@ #include #include #include -#include #include +#include +#include + +#include +#include +#include #include /*}}}*/ diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index e1459c80e..906321456 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include /*}}}*/ diff --git a/apt-pkg/update.cc b/apt-pkg/update.cc index 97be5490b..5d5b19626 100644 --- a/apt-pkg/update.cc +++ b/apt-pkg/update.cc @@ -1,24 +1,17 @@ - // Include Files /*{{{*/ #include -#include -#include -#include -#include -#include -#include #include -#include -#include +#include +#include #include -#include +#include +#include +#include +#include -#include -#include -#include -#include -#include +#include +#include #include /*}}}*/ diff --git a/apt-pkg/upgrade.cc b/apt-pkg/upgrade.cc index d6f6933dd..7926845c2 100644 --- a/apt-pkg/upgrade.cc +++ b/apt-pkg/upgrade.cc @@ -1,24 +1,17 @@ - // Include Files /*{{{*/ #include #include -#include -#include #include -#include -#include -#include #include -#include -#include +#include #include +#include +#include +#include +#include -#include -#include -#include -#include -#include +#include #include /*}}}*/ diff --git a/apt-pkg/upgrade.h b/apt-pkg/upgrade.h index 436d38300..aa883df10 100644 --- a/apt-pkg/upgrade.h +++ b/apt-pkg/upgrade.h @@ -10,6 +10,8 @@ #ifndef PKGLIB_UPGRADE_H #define PKGLIB_UPGRADE_H +class pkgDepCache; + namespace APT { namespace Upgrade { // FIXME: make this "enum class UpgradeMode {" once we enable c++11 diff --git a/apt-pkg/vendor.cc b/apt-pkg/vendor.cc index f19534171..986636e97 100644 --- a/apt-pkg/vendor.cc +++ b/apt-pkg/vendor.cc @@ -1,10 +1,14 @@ #include -#include -#include #include #include +#include +#include +#include +#include +#include + Vendor::Vendor(std::string VendorID, std::string Origin, std::vector *FingerprintList) diff --git a/apt-pkg/vendor.h b/apt-pkg/vendor.h index 6484adf9b..2d2e2b0ae 100644 --- a/apt-pkg/vendor.h +++ b/apt-pkg/vendor.h @@ -11,7 +11,7 @@ using std::string; #endif // A class representing a particular software provider. -class __deprecated Vendor +class APT_DEPRECATED Vendor { public: struct Fingerprint diff --git a/apt-pkg/vendorlist.cc b/apt-pkg/vendorlist.cc index 602425624..fb33ff17d 100644 --- a/apt-pkg/vendorlist.cc +++ b/apt-pkg/vendorlist.cc @@ -3,9 +3,16 @@ #include #include #include + +#include +#include +#include +#include + #include #if __GNUC__ >= 4 + #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif @@ -157,5 +164,5 @@ const Vendor* pkgVendorList::FindVendor(const std::vector GPGVOutput) /* /*}}}*/ #if __GNUC__ >= 4 - #pragma GCC diagnostic warning "-Wdeprecated-declarations" + #pragma GCC diagnostic pop #endif diff --git a/apt-pkg/vendorlist.h b/apt-pkg/vendorlist.h index a86ccde7c..bc3702a93 100644 --- a/apt-pkg/vendorlist.h +++ b/apt-pkg/vendorlist.h @@ -27,7 +27,7 @@ using std::vector; class Vendor; class Configuration; -class __deprecated pkgVendorList +class APT_DEPRECATED pkgVendorList { protected: std::vector VendorList; diff --git a/apt-pkg/version.cc b/apt-pkg/version.cc index cb2c34c0f..29bee46da 100644 --- a/apt-pkg/version.cc +++ b/apt-pkg/version.cc @@ -11,8 +11,8 @@ #include #include -#include +#include #include /*}}}*/ diff --git a/apt-pkg/versionmatch.cc b/apt-pkg/versionmatch.cc index 26262a010..284098bdf 100644 --- a/apt-pkg/versionmatch.cc +++ b/apt-pkg/versionmatch.cc @@ -16,11 +16,16 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include #include #include -#include #include /*}}}*/ diff --git a/apt-pkg/versionmatch.h b/apt-pkg/versionmatch.h index 433396fc9..a889878ad 100644 --- a/apt-pkg/versionmatch.h +++ b/apt-pkg/versionmatch.h @@ -35,9 +35,10 @@ #ifndef PKGLIB_VERSIONMATCH_H #define PKGLIB_VERSIONMATCH_H +#include +#include #include -#include #ifndef APT_8_CLEANER_HEADERS using std::string; diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc index d08ed072f..fe7a45e12 100644 --- a/apt-private/acqprogress.cc +++ b/apt-private/acqprogress.cc @@ -10,18 +10,21 @@ // Include files /*{{{*/ #include +#include #include #include #include #include #include +#include + +#include #include #include #include #include -#include "acqprogress.h" #include /*}}}*/ diff --git a/apt-private/private-cachefile.cc b/apt-private/private-cachefile.cc index c822b9bad..5e955ac39 100644 --- a/apt-private/private-cachefile.cc +++ b/apt-private/private-cachefile.cc @@ -4,11 +4,17 @@ #include #include #include +#include +#include +#include +#include -#include +#include +#include -#include "private-output.h" -#include "private-cachefile.h" +#include +#include +#include #include /*}}}*/ diff --git a/apt-private/private-cachefile.h b/apt-private/private-cachefile.h index f24d93020..94d93df2c 100644 --- a/apt-private/private-cachefile.h +++ b/apt-private/private-cachefile.h @@ -3,6 +3,8 @@ #include #include +#include +#include // class CacheFile - Cover class for some dependency cache functions /*{{{*/ diff --git a/apt-private/private-cacheset.cc b/apt-private/private-cacheset.cc index a7dc0e800..4a63c7e81 100644 --- a/apt-private/private-cacheset.cc +++ b/apt-private/private-cacheset.cc @@ -1,9 +1,18 @@ +#include + #include #include #include -#include +#include +#include +#include +#include + +#include + +#include -#include "private-cacheset.h" +#include bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile, LocalitySortedVersionSet &output_set, diff --git a/apt-private/private-cacheset.h b/apt-private/private-cacheset.h index 26c7f1ac2..854d16922 100644 --- a/apt-private/private-cacheset.h +++ b/apt-private/private-cacheset.h @@ -1,17 +1,32 @@ #ifndef APT_PRIVATE_CACHESET_H #define APT_PRIVATE_CACHESET_H +#include #include #include #include +#include +#include +#include +#include +#include +#include #include #include +#include +#include +#include +#include +#include +#include #include "private-output.h" #include +class OpProgress; + struct VersionSortDescriptionLocality { bool operator () (const pkgCache::VerIterator &v_lhs, diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index 132da04d5..2b2a35637 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -2,15 +2,13 @@ #include #include -#include -#include +#include +#include #include #include -#include "private-cmndline.h" - #include /*}}}*/ diff --git a/apt-private/private-download.cc b/apt-private/private-download.cc index 80795f964..a095f0c67 100644 --- a/apt-private/private-download.cc +++ b/apt-private/private-download.cc @@ -7,10 +7,8 @@ #include #include -#include "private-output.h" -#include "private-download.h" - -#include +#include +#include #include #include diff --git a/apt-private/private-download.h b/apt-private/private-download.h index b8cc8da1e..1447845ed 100644 --- a/apt-private/private-download.h +++ b/apt-private/private-download.h @@ -1,7 +1,7 @@ #ifndef APT_PRIVATE_DOWNLOAD_H #define APT_PRIVATE_DOWNLOAD_H -#include +class pkgAcquire; bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser); bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure); diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index ff609f567..8092af939 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -1,57 +1,45 @@ // Include Files /*{{{*/ #include -#include -#include -#include -#include -#include -#include -#include +#include #include -#include -#include -#include -#include -#include +#include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include -#include "private-install.h" -#include "private-download.h" -#include "private-cachefile.h" -#include "private-output.h" -#include "private-cacheset.h" -#include "acqprogress.h" +#include +#include +#include +#include +#include +#include #include /*}}}*/ +class pkgSourceList; // InstallPackages - Actually download and install the packages /*{{{*/ // --------------------------------------------------------------------- diff --git a/apt-private/private-install.h b/apt-private/private-install.h index 2187146d3..79769d470 100644 --- a/apt-private/private-install.h +++ b/apt-private/private-install.h @@ -1,15 +1,29 @@ #ifndef APT_PRIVATE_INSTALL_H #define APT_PRIVATE_INSTALL_H +#include +#include +#include +#include +#include #include -#include #include +#include + +#include +#include +#include +#include +#include +#include -#include "private-cachefile.h" #include "private-output.h" #include +class CacheFile; +class CommandLine; + #define RAMFS_MAGIC 0x858458f6 bool DoInstall(CommandLine &Cmd); diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index bc4539aeb..7664ca134 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -1,43 +1,28 @@ // Include Files /*{{{*/ #include -#include #include #include #include -#include -#include -#include #include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include #include -#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "private-cmndline.h" -#include "private-list.h" -#include "private-output.h" -#include "private-cacheset.h" +#include #include /*}}}*/ diff --git a/apt-private/private-list.h b/apt-private/private-list.h index 6f5aad27a..749744dd1 100644 --- a/apt-private/private-list.h +++ b/apt-private/private-list.h @@ -1,7 +1,7 @@ #ifndef APT_PRIVATE_LIST_H #define APT_PRIVATE_LIST_H -#include +class CommandLine; bool List(CommandLine &Cmd); diff --git a/apt-private/private-main.cc b/apt-private/private-main.cc index 1fdf3f0be..2d3965172 100644 --- a/apt-private/private-main.cc +++ b/apt-private/private-main.cc @@ -1,9 +1,13 @@ +#include -#include -#include - +#include #include -#include "private-main.h" + +#include + +#include +#include +#include #include diff --git a/apt-private/private-main.h b/apt-private/private-main.h index f9a95c4ec..257c51a0b 100644 --- a/apt-private/private-main.h +++ b/apt-private/private-main.h @@ -1,9 +1,8 @@ #ifndef APT_PRIVATE_MAIN_H #define APT_PRIVATE_MAIN_H -#include +class CommandLine; void CheckSimulateMode(CommandLine &CmdL); - #endif diff --git a/apt-private/private-moo.cc b/apt-private/private-moo.cc index 9c4f6bf15..a87999150 100644 --- a/apt-private/private-moo.cc +++ b/apt-private/private-moo.cc @@ -13,11 +13,15 @@ #include #include -#include -#include +#include +#include -#include "private-moo.h" -#include "private-output.h" +#include +#include +#include +#include +#include +#include #include /*}}}*/ diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index 52f65d794..bbd8545ad 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -7,16 +7,22 @@ #include #include #include +#include +#include +#include +#include +#include + +#include +#include +#include +#include #include #include -#include #include #include -#include "private-output.h" -#include "private-cachefile.h" - #include /*}}}*/ diff --git a/apt-private/private-output.h b/apt-private/private-output.h index 2a2a69458..81643f90a 100644 --- a/apt-private/private-output.h +++ b/apt-private/private-output.h @@ -1,17 +1,14 @@ #ifndef APT_PRIVATE_OUTPUT_H #define APT_PRIVATE_OUTPUT_H +#include -#include #include #include -#include "private-cachefile.h" - // forward declaration class pkgCacheFile; class CacheFile; -class pkgCache; class pkgDepCache; class pkgRecords; diff --git a/apt-private/private-search.cc b/apt-private/private-search.cc index 0b1a929b0..8106333b6 100644 --- a/apt-private/private-search.cc +++ b/apt-private/private-search.cc @@ -1,40 +1,30 @@ // Includes /*{{{*/ -#include +#include + #include -#include #include -#include -#include -#include #include -#include -#include #include -#include -#include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include -#include -#include -#include -#include +#include +#include +#include + +#include #include -#include -#include -#include -#include -#include -#include +#include #include +#include +#include -#include "private-search.h" -#include "private-cacheset.h" +#include /*}}}*/ bool FullTextSearch(CommandLine &CmdL) /*{{{*/ diff --git a/apt-private/private-search.h b/apt-private/private-search.h index 17faffebc..539915f1f 100644 --- a/apt-private/private-search.h +++ b/apt-private/private-search.h @@ -1,7 +1,7 @@ #ifndef APT_PRIVATE_SEARCH_H #define APT_PRIVATE_SEARCH_H -#include +class CommandLine; bool FullTextSearch(CommandLine &CmdL); diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc index 94f944af1..8ae6a6dac 100644 --- a/apt-private/private-show.cc +++ b/apt-private/private-show.cc @@ -1,30 +1,32 @@ // Includes /*{{{*/ -#include +#include + #include -#include #include -#include -#include -#include #include -#include +#include #include +#include #include -#include -#include -#include -#include -#include -#include #include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include -#include +#include +#include +#include + +#include +#include +#include -#include "private-output.h" -#include "private-cacheset.h" -#include "private-show.h" +#include /*}}}*/ namespace APT { @@ -33,7 +35,7 @@ namespace APT { // DisplayRecord - Displays the complete record for the package /*{{{*/ // --------------------------------------------------------------------- static bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V, - ostream &out) + std::ostream &out) { pkgCache *Cache = CacheFile.GetPkgCache(); if (unlikely(Cache == NULL)) diff --git a/apt-private/private-show.h b/apt-private/private-show.h index b428c7af0..a15367e28 100644 --- a/apt-private/private-show.h +++ b/apt-private/private-show.h @@ -1,7 +1,7 @@ #ifndef APT_PRIVATE_SHOW_H #define APT_PRIVATE_SHOW_H -#include +class CommandLine; namespace APT { namespace Cmd { diff --git a/apt-private/private-sources.cc b/apt-private/private-sources.cc index 41cf6b313..301936b9d 100644 --- a/apt-private/private-sources.cc +++ b/apt-private/private-sources.cc @@ -1,10 +1,23 @@ +#include #include -#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include -#include "private-output.h" -#include "private-sources.h" -#include "private-utils.h" +#include +#include +#include +#include + +#include /* Interface discussion with donkult (for the future): apt [add-{archive,release,component}|edit|change-release|disable]-sources diff --git a/apt-private/private-sources.h b/apt-private/private-sources.h index b394622be..4c58af180 100644 --- a/apt-private/private-sources.h +++ b/apt-private/private-sources.h @@ -1,3 +1,8 @@ -#include +#ifndef APT_PRIVATE_SOURCES_H +#define APT_PRIVATE_SOURCES_H + +class CommandLine; bool EditSources(CommandLine &CmdL); + +#endif diff --git a/apt-private/private-update.cc b/apt-private/private-update.cc index 1f6fb6f79..da83d7741 100644 --- a/apt-private/private-update.cc +++ b/apt-private/private-update.cc @@ -1,38 +1,23 @@ // Include files /*{{{*/ #include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include +#include +#include -#include -#include -#include +#include +#include +#include +#include -#include "private-cachefile.h" -#include "private-output.h" -#include "private-update.h" -#include "acqprogress.h" +#include +#include #include /*}}}*/ diff --git a/apt-private/private-upgrade.cc b/apt-private/private-upgrade.cc index a97e6d25b..68b2c5e00 100644 --- a/apt-private/private-upgrade.cc +++ b/apt-private/private-upgrade.cc @@ -1,12 +1,18 @@ - // Includes /*{{{*/ -#include +#include + #include +#include +#include + +#include +#include +#include +#include + #include -#include "private-install.h" -#include "private-cachefile.h" -#include "private-upgrade.h" -#include "private-output.h" + +#include /*}}}*/ // this is actually performing the various upgrade operations diff --git a/apt-private/private-upgrade.h b/apt-private/private-upgrade.h index 5efc66bf7..64c4c0874 100644 --- a/apt-private/private-upgrade.h +++ b/apt-private/private-upgrade.h @@ -1,13 +1,11 @@ #ifndef APTPRIVATE_PRIVATE_UPGRADE_H #define APTPRIVATE_PRIVATE_UPGRADE_H -#include - +class CommandLine; bool DoDistUpgrade(CommandLine &CmdL); bool DoUpgrade(CommandLine &CmdL); bool DoUpgradeNoNewPackages(CommandLine &CmdL); bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL); - #endif diff --git a/apt-private/private-utils.cc b/apt-private/private-utils.cc index 813f19329..9547a1b75 100644 --- a/apt-private/private-utils.cc +++ b/apt-private/private-utils.cc @@ -1,9 +1,12 @@ -#include +#include #include #include -#include "private-utils.h" +#include + +#include +#include // DisplayFileInPager - Display File with pager /*{{{*/ void DisplayFileInPager(std::string filename) @@ -26,7 +29,6 @@ void DisplayFileInPager(std::string filename) ExecWait(Process, "sensible-pager", false); } /*}}}*/ - // EditFileInSensibleEditor - Edit File with editor /*{{{*/ void EditFileInSensibleEditor(std::string filename) { diff --git a/apt-private/private-utils.h b/apt-private/private-utils.h index 258dd06a8..4bb535e86 100644 --- a/apt-private/private-utils.h +++ b/apt-private/private-utils.h @@ -6,6 +6,4 @@ void DisplayFileInPager(std::string filename); void EditFileInSensibleEditor(std::string filename); - - #endif diff --git a/buildlib/apti18n.h.in b/buildlib/apti18n.h.in index a9d48dd97..2202c5b19 100644 --- a/buildlib/apti18n.h.in +++ b/buildlib/apti18n.h.in @@ -8,7 +8,8 @@ #ifdef USE_NLS // apt will use the gettext implementation of the C library -# include +#include +#include # ifdef APT_DOMAIN # define _(x) dgettext(APT_DOMAIN,x) # define P_(msg,plural,n) dngettext(APT_DOMAIN,msg,plural,n) diff --git a/buildlib/config.h.in b/buildlib/config.h.in index bd43a40b9..6779e07bc 100644 --- a/buildlib/config.h.in +++ b/buildlib/config.h.in @@ -42,3 +42,4 @@ #define APT_8_CLEANER_HEADERS #define APT_9_CLEANER_HEADERS +#define APT_10_CLEANER_HEADERS diff --git a/cmdline/acqprogress.cc b/cmdline/acqprogress.cc index 3ac350aca..c362c1edf 100644 --- a/cmdline/acqprogress.cc +++ b/cmdline/acqprogress.cc @@ -10,12 +10,14 @@ // Include files /*{{{*/ #include +#include #include #include #include #include #include +#include #include #include #include diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index d50e0c724..0860ee7bf 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -15,40 +15,49 @@ // Include Files /*{{{*/ #include -#include +#include #include #include -#include -#include -#include #include -#include +#include #include +#include +#include +#include #include -#include -#include +#include #include -#include -#include +#include +#include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include -#include -#include #include +#include -#include -#include -#include -#include -#include #include +#include #include -#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include #include /*}}}*/ diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index 8e1d27e52..facb6002b 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -20,22 +20,15 @@ #include #include #include -#include -#include #include #include #include -#include #include -#include #include -#include +#include #include -#include -#include #include -#include #include diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc index 26f0ea161..d95780c73 100644 --- a/cmdline/apt-config.cc +++ b/cmdline/apt-config.cc @@ -26,10 +26,10 @@ #include #include -#include #include #include #include +#include #include diff --git a/cmdline/apt-dump-solver.cc b/cmdline/apt-dump-solver.cc index c26cdc70a..04e13bde9 100644 --- a/cmdline/apt-dump-solver.cc +++ b/cmdline/apt-dump-solver.cc @@ -9,10 +9,12 @@ // Include Files /*{{{*/ #include -#include - +#include +#include #include #include + +#include /*}}}*/ // ShowHelp - Show a help screen /*{{{*/ diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc index a27008233..a82623444 100644 --- a/cmdline/apt-extracttemplates.cc +++ b/cmdline/apt-extracttemplates.cc @@ -18,8 +18,8 @@ #include #include #include +#include #include -#include #include #include #include @@ -30,14 +30,13 @@ #include #include #include +#include +#include +#include #include #include -#include #include -#include - -#include #include "apt-extracttemplates.h" diff --git a/cmdline/apt-extracttemplates.h b/cmdline/apt-extracttemplates.h index 6d07a09c2..9cc3f5f25 100644 --- a/cmdline/apt-extracttemplates.h +++ b/cmdline/apt-extracttemplates.h @@ -11,11 +11,12 @@ #define _APTEXTRACTTEMPLATE_H_ #include -#include #include #include +class pkgCache; + class DebFile : public pkgDirStream { FileFd File; diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 9a4eb0881..a830c2387 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -27,66 +27,67 @@ // Include Files /*{{{*/ #include +#include +#include #include -#include +#include +#include +#include #include -#include +#include #include -#include -#include -#include -#include +#include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include #include -#include -#include -#include +#include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include +#include +#include +#include +#include #include #include -#include +#include +#include #include -#include #include -#include -#include +#include #include -#include - -#include - -#include -#include -#include - -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include #include -#include -#include -#include -#include -#include #include - -#include -#include +#include +#include +#include +#include +#include +#include +#include #include /*}}}*/ diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc index 8ff2fa037..d66b3ffae 100644 --- a/cmdline/apt-helper.cc +++ b/cmdline/apt-helper.cc @@ -7,6 +7,7 @@ // Include Files /*{{{*/ #include +#include #include #include #include @@ -20,14 +21,9 @@ #include #include -#include -#include -#include -#include -#include -#include - - +#include +#include +#include #include /*}}}*/ diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc index 0c2ff0f43..b85c07c33 100644 --- a/cmdline/apt-internal-solver.cc +++ b/cmdline/apt-internal-solver.cc @@ -20,7 +20,15 @@ #include #include #include - +#include +#include +#include +#include + +#include +#include +#include +#include #include #include diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc index 53b5ec158..ed348358a 100644 --- a/cmdline/apt-mark.cc +++ b/cmdline/apt-mark.cc @@ -11,20 +11,31 @@ #include #include #include +#include #include -#include #include -#include +#include +#include +#include +#include +#include +#include + +#include -#include #include -#include -#include -#include -#include #include - -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include /*}}}*/ diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc index 8d9cb23de..c2b11890a 100644 --- a/cmdline/apt-sortpkgs.cc +++ b/cmdline/apt-sortpkgs.cc @@ -25,9 +25,9 @@ #include #include - -#include -#include +#include +#include +#include #include /*}}}*/ diff --git a/cmdline/apt.cc b/cmdline/apt.cc index 1b7626948..5dbf868d7 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -11,39 +11,12 @@ // Include Files /*{{{*/ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - +#include #include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include - -#include +#include +#include #include #include @@ -55,11 +28,14 @@ #include #include #include -#include #include - /*}}}*/ +#include +#include +#include +#include + /*}}}*/ static bool ShowHelp(CommandLine &) { diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc index f13e4648a..692f19e25 100644 --- a/ftparchive/apt-ftparchive.cc +++ b/ftparchive/apt-ftparchive.cc @@ -17,14 +17,23 @@ #include #include #include -#include +#include +#include #include #include -#include - +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cachedb.h" +#include "override.h" #include "apt-ftparchive.h" -#include "contents.h" #include "multicompress.h" #include "writer.h" diff --git a/ftparchive/cachedb.cc b/ftparchive/cachedb.cc index c2318bf53..523c6b5fa 100644 --- a/ftparchive/cachedb.cc +++ b/ftparchive/cachedb.cc @@ -19,8 +19,12 @@ #include #include #include +#include #include // htonl, etc +#include +#include +#include #include "cachedb.h" diff --git a/ftparchive/cachedb.h b/ftparchive/cachedb.h index b9ced9418..49b9a0ef5 100644 --- a/ftparchive/cachedb.h +++ b/ftparchive/cachedb.h @@ -12,17 +12,19 @@ #ifndef CACHEDB_H #define CACHEDB_H - #include #include -#include -#include #include #include +#include +#include +#include #include "contents.h" +class FileFd; + class CacheDB { protected: diff --git a/ftparchive/contents.cc b/ftparchive/contents.cc index be4d2a61e..7a1fb779e 100644 --- a/ftparchive/contents.cc +++ b/ftparchive/contents.cc @@ -36,13 +36,12 @@ #include #include -#include +#include #include #include #include #include -#include #include "contents.h" diff --git a/ftparchive/contents.h b/ftparchive/contents.h index 4af9db574..dbbb83350 100644 --- a/ftparchive/contents.h +++ b/ftparchive/contents.h @@ -9,11 +9,13 @@ /*}}}*/ #ifndef CONTENTS_H #define CONTENTS_H - -#include -#include + #include +#include +#include +#include + class debDebFile; class GenContents diff --git a/ftparchive/multicompress.cc b/ftparchive/multicompress.cc index 1555d2f2d..f35d5304a 100644 --- a/ftparchive/multicompress.cc +++ b/ftparchive/multicompress.cc @@ -20,13 +20,15 @@ #include #include #include +#include +#include -#include +#include +#include #include #include #include #include -#include #include "multicompress.h" #include diff --git a/ftparchive/multicompress.h b/ftparchive/multicompress.h index 388fad22e..ddd1815a3 100644 --- a/ftparchive/multicompress.h +++ b/ftparchive/multicompress.h @@ -22,7 +22,8 @@ #include #include #include - +#include + class MultiCompress { // An output file diff --git a/ftparchive/override.cc b/ftparchive/override.cc index 38d76a6a3..b4cd49b6c 100644 --- a/ftparchive/override.cc +++ b/ftparchive/override.cc @@ -16,6 +16,9 @@ #include #include +#include +#include +#include #include "override.h" diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index edc0fddea..153c4fb42 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -13,28 +13,37 @@ // Include Files /*{{{*/ #include -#include -#include #include -#include -#include -#include #include +#include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include -#include -#include #include #include #include +#include +#include "apt-ftparchive.h" #include "writer.h" #include "cachedb.h" -#include "apt-ftparchive.h" #include "multicompress.h" #include diff --git a/ftparchive/writer.h b/ftparchive/writer.h index 4932b0cc8..86884dcfc 100644 --- a/ftparchive/writer.h +++ b/ftparchive/writer.h @@ -13,14 +13,16 @@ #ifndef WRITER_H #define WRITER_H - #include #include #include #include #include #include +#include +#include +#include "contents.h" #include "cachedb.h" #include "override.h" #include "apt-ftparchive.h" diff --git a/methods/cdrom.cc b/methods/cdrom.cc index 3c14d9dfb..74e2ecc6b 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -19,9 +19,9 @@ #include #include +#include +#include #include -#include -#include #include #include diff --git a/methods/connect.cc b/methods/connect.cc index d9c9a1dd4..e2cbf4f5c 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -23,7 +23,7 @@ #include #include #include - +#include #include #include diff --git a/methods/copy.cc b/methods/copy.cc index f2a8f9ed8..d59f032ff 100644 --- a/methods/copy.cc +++ b/methods/copy.cc @@ -17,9 +17,10 @@ #include #include +#include #include #include -#include + #include /*}}}*/ diff --git a/methods/file.cc b/methods/file.cc index 3d0687c5b..12db62203 100644 --- a/methods/file.cc +++ b/methods/file.cc @@ -21,8 +21,9 @@ #include #include +#include #include -#include + #include /*}}}*/ diff --git a/methods/ftp.cc b/methods/ftp.cc index 4108b2da3..66787a7be 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -23,7 +23,11 @@ #include #include #include +#include +#include +#include +#include #include #include #include @@ -42,6 +46,7 @@ #include "rfc2553emu.h" #include "connect.h" #include "ftp.h" + #include /*}}}*/ diff --git a/methods/ftp.h b/methods/ftp.h index 8055c389f..119d0c7e8 100644 --- a/methods/ftp.h +++ b/methods/ftp.h @@ -12,6 +12,8 @@ #include +#include +#include #include class FTPConn diff --git a/methods/gpgv.cc b/methods/gpgv.cc index 25bf64ddd..ae521a2ed 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -1,19 +1,21 @@ #include -#include #include -#include -#include -#include #include +#include #include +#include -#include -#include +#include #include +#include +#include +#include +#include #include +#include #include -#include +#include #include #include diff --git a/methods/gzip.cc b/methods/gzip.cc index 3269ffbb8..ace5e9f71 100644 --- a/methods/gzip.cc +++ b/methods/gzip.cc @@ -11,17 +11,19 @@ // Include Files /*{{{*/ #include -#include -#include #include -#include +#include +#include #include +#include +#include +#include #include #include -#include -#include -#include +#include +#include + #include /*}}}*/ diff --git a/methods/http.cc b/methods/http.cc index e1bb2e130..82f16e9b2 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -33,24 +33,21 @@ #include #include #include +#include +#include +#include +#include +#include #include #include #include -#include #include #include -#include -#include #include -#include - -// Internet stuff -#include #include "config.h" #include "connect.h" -#include "rfc2553emu.h" #include "http.h" #include diff --git a/methods/http.h b/methods/http.h index 450a42eed..5406ce4a7 100644 --- a/methods/http.h +++ b/methods/http.h @@ -12,14 +12,18 @@ #define APT_HTTP_H #include +#include #include +#include +#include #include "server.h" using std::cout; using std::endl; +class FileFd; class HttpMethod; class Hashes; diff --git a/methods/http_main.cc b/methods/http_main.cc index 2ca91bfc9..3b346a514 100644 --- a/methods/http_main.cc +++ b/methods/http_main.cc @@ -1,14 +1,9 @@ #include -#include -#include #include -#include "connect.h" -#include "rfc2553emu.h" #include "http.h" - int main() { setlocale(LC_ALL, ""); diff --git a/methods/https.cc b/methods/https.cc index 041214179..c4aff8f38 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -18,19 +18,20 @@ #include #include #include +#include +#include #include #include #include -#include #include -#include -#include #include #include +#include +#include -#include "config.h" #include "https.h" + #include /*}}}*/ using namespace std; diff --git a/methods/https.h b/methods/https.h index 3199b29f2..faac8a3cd 100644 --- a/methods/https.h +++ b/methods/https.h @@ -11,14 +11,19 @@ #ifndef APT_HTTPS_H #define APT_HTTPS_H -#include +#include + #include +#include +#include +#include #include "server.h" using std::cout; using std::endl; +class Hashes; class HttpsMethod; class FileFd; diff --git a/methods/mirror.cc b/methods/mirror.cc index b30636758..d3aef91bc 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -16,18 +16,18 @@ #include #include #include -#include #include #include #include +#include +#include +#include +#include #include -#include #include - -#include +#include #include -#include #include #include diff --git a/methods/mirror.h b/methods/mirror.h index 1dd9f2ec6..6c0ce370e 100644 --- a/methods/mirror.h +++ b/methods/mirror.h @@ -11,6 +11,8 @@ #ifndef APT_MIRROR_H #define APT_MIRROR_H +#include + #include #include #include diff --git a/methods/rred.cc b/methods/rred.cc index 7169fc731..cabb3c456 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -8,19 +8,18 @@ #include #include -#include #include #include #include #include #include +#include +#include #include #include #include -#include -#include #include #include #include diff --git a/methods/rsh.cc b/methods/rsh.cc index 8088cac38..bd46d2515 100644 --- a/methods/rsh.cc +++ b/methods/rsh.cc @@ -17,7 +17,11 @@ #include #include #include +#include +#include +#include +#include #include #include #include diff --git a/methods/rsh.h b/methods/rsh.h index d7efa3f06..c2c06acfe 100644 --- a/methods/rsh.h +++ b/methods/rsh.h @@ -11,6 +11,8 @@ #define APT_RSH_H #include +#include + #include class Hashes; diff --git a/methods/server.cc b/methods/server.cc index 90e83d1af..5a13f18a7 100644 --- a/methods/server.cc +++ b/methods/server.cc @@ -10,32 +10,27 @@ // Include Files /*{{{*/ #include -#include #include #include #include -#include -#include +#include +#include -#include +#include +#include +#include +#include #include #include +#include #include -#include -#include -#include -#include -#include #include +#include #include +#include +#include -// Internet stuff -#include - -#include "config.h" -#include "connect.h" -#include "rfc2553emu.h" -#include "http.h" +#include "server.h" #include /*}}}*/ diff --git a/methods/server.h b/methods/server.h index b4870698f..d1e151f8a 100644 --- a/methods/server.h +++ b/methods/server.h @@ -12,7 +12,10 @@ #define APT_SERVER_H #include +#include +#include +#include #include using std::cout; diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index fb9f7d34e..34476e1af 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -1,27 +1,29 @@ #include -#include -#include -#include #include #include -#include - -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include #include -#include -#include -#include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include static char const * httpcodeToStr(int const httpcode) /*{{{*/ { diff --git a/test/interactive-helper/extract-control.cc b/test/interactive-helper/extract-control.cc index 94fe9dca8..852ec4ee9 100644 --- a/test/interactive-helper/extract-control.cc +++ b/test/interactive-helper/extract-control.cc @@ -1,7 +1,10 @@ +#include + #include #include #include +#include #include #include diff --git a/test/interactive-helper/mthdcat.cc b/test/interactive-helper/mthdcat.cc index 25d09a3f5..2961b2080 100644 --- a/test/interactive-helper/mthdcat.cc +++ b/test/interactive-helper/mthdcat.cc @@ -2,6 +2,8 @@ All this does is cat a file into the method without closing the FD when the file ends */ +#include + #include int main() diff --git a/test/interactive-helper/rpmver.cc b/test/interactive-helper/rpmver.cc index 15c96cbbe..017c92fba 100644 --- a/test/interactive-helper/rpmver.cc +++ b/test/interactive-helper/rpmver.cc @@ -1,3 +1,5 @@ +#include + #include #include #include diff --git a/test/interactive-helper/test_udevcdrom.cc b/test/interactive-helper/test_udevcdrom.cc index 88f5f0153..b87dcd935 100644 --- a/test/interactive-helper/test_udevcdrom.cc +++ b/test/interactive-helper/test_udevcdrom.cc @@ -1,7 +1,10 @@ +#include + #include -#include -#include +#include +#include +#include #include #include @@ -17,5 +20,4 @@ int main() std::cerr << l[i].DeviceName << " " << l[i].Mounted << " " << l[i].MountPath << std::endl; - } diff --git a/test/interactive-helper/testdeb.cc b/test/interactive-helper/testdeb.cc index 9520d1b50..6aae9f563 100644 --- a/test/interactive-helper/testdeb.cc +++ b/test/interactive-helper/testdeb.cc @@ -1,7 +1,14 @@ +#include + #include #include #include #include +#include +#include + +#include +#include class NullStream : public pkgDirStream { diff --git a/test/libapt/cdromfindpackages_test.cc b/test/libapt/cdromfindpackages_test.cc index e9f5a51b0..583de1423 100644 --- a/test/libapt/cdromfindpackages_test.cc +++ b/test/libapt/cdromfindpackages_test.cc @@ -1,9 +1,13 @@ +#include + #include #include #include #include #include +#include +#include #include "assert.h" diff --git a/test/libapt/cdromreducesourcelist_test.cc b/test/libapt/cdromreducesourcelist_test.cc index b0314769d..196d0136e 100644 --- a/test/libapt/cdromreducesourcelist_test.cc +++ b/test/libapt/cdromreducesourcelist_test.cc @@ -1,7 +1,7 @@ +#include + #include -#include -#include #include #include diff --git a/test/libapt/commandline_test.cc b/test/libapt/commandline_test.cc index de8a30bd6..d8c5bc5bd 100644 --- a/test/libapt/commandline_test.cc +++ b/test/libapt/commandline_test.cc @@ -1,4 +1,7 @@ +#include + #include +#include #include "assert.h" diff --git a/test/libapt/commandlineasstring_test.cc b/test/libapt/commandlineasstring_test.cc index a38957d7e..5c005e956 100644 --- a/test/libapt/commandlineasstring_test.cc +++ b/test/libapt/commandlineasstring_test.cc @@ -1,3 +1,5 @@ +#include + #include #include diff --git a/test/libapt/compareversion_test.cc b/test/libapt/compareversion_test.cc index 44f8e9d78..43b98f240 100644 --- a/test/libapt/compareversion_test.cc +++ b/test/libapt/compareversion_test.cc @@ -16,17 +16,16 @@ ##################################################################### */ /*}}}*/ -#include +#include + #include -#include #include #include -#include -#include +#include +#include #include #include -#include #include using namespace std; diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc index d2efc1b4b..c9235500c 100644 --- a/test/libapt/configuration_test.cc +++ b/test/libapt/configuration_test.cc @@ -1,3 +1,5 @@ +#include + #include #include diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc index d256ea55a..8da832ba9 100644 --- a/test/libapt/fileutl_test.cc +++ b/test/libapt/fileutl_test.cc @@ -1,14 +1,13 @@ +#include + #include #include -#include "assert.h" #include #include - -#include -#include #include +#include "assert.h" int main() { diff --git a/test/libapt/getarchitectures_test.cc b/test/libapt/getarchitectures_test.cc index 508d5e458..f4dfc6ae8 100644 --- a/test/libapt/getarchitectures_test.cc +++ b/test/libapt/getarchitectures_test.cc @@ -1,11 +1,12 @@ +#include + #include #include -#include "assert.h" #include #include -#include +#include "assert.h" int main() { diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc index 51cfecee3..15aa4e879 100644 --- a/test/libapt/getlanguages_test.cc +++ b/test/libapt/getlanguages_test.cc @@ -1,3 +1,5 @@ +#include + #include #include diff --git a/test/libapt/getlistoffilesindir_test.cc b/test/libapt/getlistoffilesindir_test.cc index b2c95e840..df125fc83 100644 --- a/test/libapt/getlistoffilesindir_test.cc +++ b/test/libapt/getlistoffilesindir_test.cc @@ -1,12 +1,13 @@ +#include + #include -#include "assert.h" #include #include - -#include #include +#include "assert.h" + #define P(x) std::string(argv[1]).append("/").append(x) int main(int argc,char *argv[]) diff --git a/test/libapt/globalerror_test.cc b/test/libapt/globalerror_test.cc index 742fa53bd..e913fdc12 100644 --- a/test/libapt/globalerror_test.cc +++ b/test/libapt/globalerror_test.cc @@ -1,10 +1,14 @@ +#include + #include -#include "assert.h" +#include #include #include #include +#include "assert.h" + int main() { std::string const textOfErrnoZero(strerror(0)); diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc index 410e2c44d..d743faec6 100644 --- a/test/libapt/hashsums_test.cc +++ b/test/libapt/hashsums_test.cc @@ -1,12 +1,15 @@ +#include + #include #include #include #include #include #include -#include -#include +#include +#include +#include #include "assert.h" @@ -50,22 +53,22 @@ int main(int argc, char** argv) // test HashSumValue which doesn't calculate but just stores sums { - string md5sum = argv[2]; + std::string md5sum = argv[2]; MD5SumValue md5(md5sum); equals(md5.Value(), md5sum); } { - string sha1sum = argv[3]; + std::string sha1sum = argv[3]; SHA1SumValue sha1(sha1sum); equals(sha1.Value(), sha1sum); } { - string sha2sum = argv[4]; + std::string sha2sum = argv[4]; SHA256SumValue sha2(sha2sum); equals(sha2.Value(), sha2sum); } { - string sha2sum = argv[5]; + std::string sha2sum = argv[5]; SHA512SumValue sha2(sha2sum); equals(sha2.Value(), sha2sum); } diff --git a/test/libapt/indexcopytosourcelist_test.cc b/test/libapt/indexcopytosourcelist_test.cc index 69d8fae86..e04ab261b 100644 --- a/test/libapt/indexcopytosourcelist_test.cc +++ b/test/libapt/indexcopytosourcelist_test.cc @@ -1,8 +1,11 @@ +#include + #include #include #include #include +#include #include "assert.h" @@ -12,14 +15,14 @@ public: IndexCopy::ConvertToSourceList(CD, Path); return Path; } - bool GetFile(std::string &Filename,unsigned long long &Size) { return false; } - bool RewriteEntry(FILE *Target,std::string File) { return false; } + bool GetFile(std::string &/*Filename*/, unsigned long long &/*Size*/) { return false; } + bool RewriteEntry(FILE * /*Target*/, std::string /*File*/) { return false; } const char *GetFileName() { return NULL; } const char *Type() { return NULL; } }; -int main(int argc, char const *argv[]) { +int main() { NoCopy ic; std::string const CD("/media/cdrom/"); diff --git a/test/libapt/parsedepends_test.cc b/test/libapt/parsedepends_test.cc index 5a2c65573..5564e2bc0 100644 --- a/test/libapt/parsedepends_test.cc +++ b/test/libapt/parsedepends_test.cc @@ -1,5 +1,11 @@ +#include + #include #include +#include + +#include +#include #include "assert.h" diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc index 0637df03b..71aa54f1e 100644 --- a/test/libapt/sourcelist_test.cc +++ b/test/libapt/sourcelist_test.cc @@ -1,11 +1,16 @@ +#include + +#include #include -#include +#include -#include "assert.h" +#include #include #include #include +#include "assert.h" + char *tempfile = NULL; int tempfile_fd = -1; diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index a4516e7a1..618f4daba 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -1,5 +1,10 @@ +#include + #include +#include +#include + #include "assert.h" int main() @@ -44,7 +49,7 @@ int main() // Split input = "status: libnet1:amd64: unpacked"; - vector result = StringSplit(input, ": "); + std::vector result = StringSplit(input, ": "); equals(result[0], "status"); equals(result[1], "libnet1:amd64"); equals(result[2], "unpacked"); diff --git a/test/libapt/tagfile_test.cc b/test/libapt/tagfile_test.cc index 24f258275..aaf46e3e9 100644 --- a/test/libapt/tagfile_test.cc +++ b/test/libapt/tagfile_test.cc @@ -1,11 +1,15 @@ +#include + #include #include -#include "assert.h" +#include #include #include #include +#include "assert.h" + char *tempfile = NULL; int tempfile_fd = -1; diff --git a/test/libapt/uri_test.cc b/test/libapt/uri_test.cc index 8216ade71..6559f1390 100644 --- a/test/libapt/uri_test.cc +++ b/test/libapt/uri_test.cc @@ -1,5 +1,9 @@ +#include + #include +#include + #include "assert.h" int main() { -- cgit v1.2.3-70-g09d2 From a02db58fd50ef7fc2f0284852c6b3f98e458a232 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 6 Mar 2014 00:33:10 +0100 Subject: follow method attribute suggestions by gcc Git-Dch: Ignore Reported-By: gcc -Wsuggest-attribute={pure,const,noreturn} --- apt-inst/extract.cc | 2 +- apt-inst/filelist.cc | 6 +++--- apt-pkg/acquire-item.cc | 2 +- apt-pkg/acquire.cc | 6 +++--- apt-pkg/acquire.h | 4 ++-- apt-pkg/algorithms.h | 2 +- apt-pkg/cacheiterators.h | 35 ++++++++++++++++++----------------- apt-pkg/cacheset.cc | 10 +++++----- apt-pkg/contrib/cmndline.h | 8 +++++--- apt-pkg/contrib/crc-16.h | 4 +++- apt-pkg/contrib/error.h | 8 ++++---- apt-pkg/contrib/fileutl.h | 2 +- apt-pkg/contrib/gpgv.h | 2 +- apt-pkg/contrib/hashes.cc | 2 +- apt-pkg/contrib/hashes.h | 2 +- apt-pkg/contrib/strutl.h | 36 ++++++++++++++++++------------------ apt-pkg/deb/debindexfile.cc | 2 +- apt-pkg/deb/debindexfile.h | 8 ++++---- apt-pkg/deb/debsystem.cc | 2 +- apt-pkg/deb/debversion.h | 14 +++++++------- apt-pkg/depcache.cc | 4 ++-- apt-pkg/depcache.h | 3 ++- apt-pkg/edsp/edspindexfile.h | 2 +- apt-pkg/edsp/edsplistparser.cc | 2 +- apt-pkg/edsp/edspsystem.h | 8 ++++---- apt-pkg/indexcopy.cc | 6 ++---- apt-pkg/indexfile.h | 2 +- apt-pkg/indexrecords.cc | 14 +++++++------- apt-pkg/install-progress.cc | 4 ++-- apt-pkg/orderlist.h | 8 ++++---- apt-pkg/packagemanager.h | 2 +- apt-pkg/pkgcache.h | 14 ++++++++------ apt-pkg/pkgcachegen.h | 2 +- apt-pkg/pkgsystem.cc | 4 +++- apt-pkg/policy.cc | 4 ++-- apt-pkg/sourcelist.h | 3 ++- apt-pkg/srcrecords.h | 3 ++- apt-pkg/tagfile.cc | 2 +- apt-pkg/vendor.cc | 2 +- apt-pkg/version.h | 2 +- apt-pkg/versionmatch.h | 14 +++++++------- apt-private/private-cachefile.h | 2 +- apt-private/private-cmndline.cc | 2 +- cmdline/apt-cache.cc | 2 +- cmdline/apt-cdrom.cc | 2 +- methods/ftp.h | 2 +- methods/http.cc | 4 ++-- methods/rsh.h | 2 +- methods/server.h | 2 +- test/libapt/assert.h | 4 +++- 50 files changed, 148 insertions(+), 136 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-inst/extract.cc b/apt-inst/extract.cc index b2956d91d..b60784450 100644 --- a/apt-inst/extract.cc +++ b/apt-inst/extract.cc @@ -260,7 +260,7 @@ bool pkgExtract::DoItem(Item &Itm, int &/*Fd*/) // Extract::Finished - Sequence finished, erase the temp files /*{{{*/ // --------------------------------------------------------------------- /* */ -bool pkgExtract::Finished() +APT_CONST bool pkgExtract::Finished() { return true; } diff --git a/apt-inst/filelist.cc b/apt-inst/filelist.cc index b4a4f3d9d..4dbc4a2d7 100644 --- a/apt-inst/filelist.cc +++ b/apt-inst/filelist.cc @@ -85,7 +85,7 @@ pkgFLCache::Header::Header() // FLCache::Header::CheckSizes - Check if the two headers have same *sz /*{{{*/ // --------------------------------------------------------------------- /* Compare to make sure we are matching versions */ -bool pkgFLCache::Header::CheckSizes(Header &Against) const +APT_PURE bool pkgFLCache::Header::CheckSizes(Header &Against) const { if (HeaderSz == Against.HeaderSz && NodeSz == Against.NodeSz && @@ -353,7 +353,7 @@ pkgFLCache::NodeIterator pkgFLCache::GetNode(const char *Name, // --------------------------------------------------------------------- /* This is one of two hashing functions. The other is inlined into the GetNode routine. */ -pkgFLCache::Node *pkgFLCache::HashNode(NodeIterator const &Nde) +APT_PURE pkgFLCache::Node *pkgFLCache::HashNode(NodeIterator const &Nde) { // Hash the node unsigned long HashPos = 0; @@ -570,7 +570,7 @@ bool pkgFLCache::AddConfFile(const char *Name,const char *NameEnd, // --------------------------------------------------------------------- /* Since the package pointer is indirected in all sorts of interesting ways this is used to get a pointer to the owning package */ -pkgFLCache::Package *pkgFLCache::NodeIterator::RealPackage() const +APT_PURE pkgFLCache::Package *pkgFLCache::NodeIterator::RealPackage() const { if (Nde->Pointer == 0) return 0; diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 44a1f32df..ad38e3116 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -2162,7 +2162,7 @@ void pkgAcqArchive::Failed(string Message,pkgAcquire::MethodConfig *Cnf) /*}}}*/ // AcqArchive::IsTrusted - Determine whether this archive comes from a trusted source /*{{{*/ // --------------------------------------------------------------------- -bool pkgAcqArchive::IsTrusted() +APT_PURE bool pkgAcqArchive::IsTrusted() { return Trusted; } diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index a654d8219..a187a00ae 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -526,7 +526,7 @@ bool pkgAcquire::Clean(string Dir) // Acquire::TotalNeeded - Number of bytes to fetch /*{{{*/ // --------------------------------------------------------------------- /* This is the total number of bytes needed */ -unsigned long long pkgAcquire::TotalNeeded() +APT_PURE unsigned long long pkgAcquire::TotalNeeded() { unsigned long long Total = 0; for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); ++I) @@ -537,7 +537,7 @@ unsigned long long pkgAcquire::TotalNeeded() // Acquire::FetchNeeded - Number of bytes needed to get /*{{{*/ // --------------------------------------------------------------------- /* This is the number of bytes that is not local */ -unsigned long long pkgAcquire::FetchNeeded() +APT_PURE unsigned long long pkgAcquire::FetchNeeded() { unsigned long long Total = 0; for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); ++I) @@ -549,7 +549,7 @@ unsigned long long pkgAcquire::FetchNeeded() // Acquire::PartialPresent - Number of partial bytes we already have /*{{{*/ // --------------------------------------------------------------------- /* This is the number of bytes that is not local */ -unsigned long long pkgAcquire::PartialPresent() +APT_PURE unsigned long long pkgAcquire::PartialPresent() { unsigned long long Total = 0; for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); ++I) diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index 1aac0ba11..ef16d8556 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -298,7 +298,7 @@ class pkgAcquire * \return the worker immediately following I, or \b NULL if none * exists. */ - Worker *WorkerStep(Worker *I); + Worker *WorkerStep(Worker *I) APT_PURE; /** \brief Get the head of the list of items. */ inline ItemIterator ItemsBegin() {return Items.begin();}; @@ -481,7 +481,7 @@ class pkgAcquire::Queue * \return the first item in the queue whose URI is #URI and that * is being downloaded by #Owner. */ - QItem *FindItem(std::string URI,pkgAcquire::Worker *Owner); + QItem *FindItem(std::string URI,pkgAcquire::Worker *Owner) APT_PURE; /** Presumably this should start downloading an item? * diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index 82b6426c6..f35bd9a13 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -114,7 +114,7 @@ class pkgProblemResolver /*{{{*/ // Sort stuff static pkgProblemResolver *This; - static int ScoreSort(const void *a,const void *b); + static int ScoreSort(const void *a,const void *b) APT_PURE; struct PackageKill { diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index d9c8ed1e4..2fdf8404d 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -30,6 +30,7 @@ #ifndef PKGLIB_CACHEITERATORS_H #define PKGLIB_CACHEITERATORS_H #include +#include #include #include @@ -163,15 +164,15 @@ class pkgCache::PkgIterator: public Iterator { inline bool Purge() const {return S->CurrentState == pkgCache::State::Purge || (S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);} inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;} - inline GrpIterator Group() const { return GrpIterator(*Owner, Owner->GrpP + S->Group);} + inline APT_PURE GrpIterator Group() const { return GrpIterator(*Owner, Owner->GrpP + S->Group);} - inline VerIterator VersionList() const; - inline VerIterator CurrentVer() const; - inline DepIterator RevDependsList() const; - inline PrvIterator ProvidesList() const; - OkState State() const; - const char *CandVersion() const; - const char *CurVersion() const; + inline VerIterator VersionList() const APT_PURE; + inline VerIterator CurrentVer() const APT_PURE; + inline DepIterator RevDependsList() const APT_PURE; + inline PrvIterator ProvidesList() const APT_PURE; + OkState State() const APT_PURE; + const char *CandVersion() const APT_PURE; + const char *CurVersion() const APT_PURE; //Nice printable representation friend std::ostream& operator <<(std::ostream& out, PkgIterator i); @@ -224,7 +225,7 @@ class pkgCache::VerIterator : public Iterator { inline VerFileIterator FileList() const; bool Downloadable() const; inline const char *PriorityType() const {return Owner->Priority(S->Priority);} - const char *MultiArchType() const; + const char *MultiArchType() const APT_PURE; std::string RelStr() const; bool Automatic() const; @@ -286,13 +287,13 @@ class pkgCache::DepIterator : public Iterator { inline VerIterator ParentVer() const {return VerIterator(*Owner,Owner->VerP + S->ParentVer);} inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->ParentVer].ParentPkg);} inline bool Reverse() const {return Type == DepRev;} - bool IsCritical() const; - bool IsNegative() const; - bool IsIgnorable(PrvIterator const &Prv) const; - bool IsIgnorable(PkgIterator const &Pkg) const; - bool IsMultiArchImplicit() const; - bool IsSatisfied(VerIterator const &Ver) const; - bool IsSatisfied(PrvIterator const &Prv) const; + bool IsCritical() const APT_PURE; + bool IsNegative() const APT_PURE; + bool IsIgnorable(PrvIterator const &Prv) const APT_PURE; + bool IsIgnorable(PkgIterator const &Pkg) const APT_PURE; + bool IsMultiArchImplicit() const APT_PURE; + bool IsSatisfied(VerIterator const &Ver) const APT_PURE; + bool IsSatisfied(PrvIterator const &Prv) const APT_PURE; void GlobOr(DepIterator &Start,DepIterator &End); Version **AllTargets() const; bool SmartTargetPkg(PkgIterator &Result) const; @@ -337,7 +338,7 @@ class pkgCache::PrvIterator : public Iterator { inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner->VerP + S->Version);} inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->Version].ParentPkg);} - bool IsMultiArchImplicit() const; + bool IsMultiArchImplicit() const APT_PURE; inline PrvIterator() : Iterator(), Type(PrvVer) {} inline PrvIterator(pkgCache &Owner, Provides *Trg, Version*) : diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc index a58631d5b..d453a2bfb 100644 --- a/apt-pkg/cacheset.cc +++ b/apt-pkg/cacheset.cc @@ -614,7 +614,7 @@ void CacheSetHelper::canNotFindFnmatch(PackageContainerInterface * const pci, pk } #endif /*}}}*/ // canNotFindPackage - handle the case no package is found from a string/*{{{*/ -void CacheSetHelper::canNotFindPackage(PackageContainerInterface * const /*pci*/, pkgCacheFile &/*Cache*/, std::string const &/*str*/) { +APT_CONST void CacheSetHelper::canNotFindPackage(PackageContainerInterface * const /*pci*/, pkgCacheFile &/*Cache*/, std::string const &/*str*/) { } /*}}}*/ // canNotFindAllVer /*{{{*/ @@ -663,24 +663,24 @@ pkgCache::VerIterator CacheSetHelper::canNotFindInstalledVer(pkgCacheFile &Cache } /*}}}*/ // showTaskSelection /*{{{*/ -void CacheSetHelper::showTaskSelection(pkgCache::PkgIterator const &/*pkg*/, +APT_CONST void CacheSetHelper::showTaskSelection(pkgCache::PkgIterator const &/*pkg*/, std::string const &/*pattern*/) { } /*}}}*/ // showRegExSelection /*{{{*/ -void CacheSetHelper::showRegExSelection(pkgCache::PkgIterator const &/*pkg*/, +APT_CONST void CacheSetHelper::showRegExSelection(pkgCache::PkgIterator const &/*pkg*/, std::string const &/*pattern*/) { } /*}}}*/ #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) // showFnmatchSelection /*{{{*/ -void CacheSetHelper::showFnmatchSelection(pkgCache::PkgIterator const &pkg, +APT_CONST void CacheSetHelper::showFnmatchSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern) { } /*}}}*/ #endif // showSelectedVersion /*{{{*/ -void CacheSetHelper::showSelectedVersion(pkgCache::PkgIterator const &/*Pkg*/, +APT_CONST void CacheSetHelper::showSelectedVersion(pkgCache::PkgIterator const &/*Pkg*/, pkgCache::VerIterator const /*Ver*/, std::string const &/*ver*/, bool const /*verIsRel*/) { diff --git a/apt-pkg/contrib/cmndline.h b/apt-pkg/contrib/cmndline.h index 180276633..143df58b2 100644 --- a/apt-pkg/contrib/cmndline.h +++ b/apt-pkg/contrib/cmndline.h @@ -44,6 +44,8 @@ #ifndef PKGLIB_CMNDLINE_H #define PKGLIB_CMNDLINE_H +#include + #ifndef APT_8_CLEANER_HEADERS #include #endif @@ -80,14 +82,14 @@ class CommandLine bool Parse(int argc,const char **argv); void ShowHelp(); - unsigned int FileSize() const; + unsigned int FileSize() const APT_PURE; bool DispatchArg(Dispatch *List,bool NoMatch = true); static char const * GetCommand(Dispatch const * const Map, - unsigned int const argc, char const * const * const argv); + unsigned int const argc, char const * const * const argv) APT_PURE; static CommandLine::Args MakeArgs(char ShortOpt, char const *LongOpt, - char const *ConfName, unsigned long Flags); + char const *ConfName, unsigned long Flags) APT_CONST; CommandLine(Args *AList,Configuration *Conf); ~CommandLine(); diff --git a/apt-pkg/contrib/crc-16.h b/apt-pkg/contrib/crc-16.h index 702de40b2..08acdafb7 100644 --- a/apt-pkg/contrib/crc-16.h +++ b/apt-pkg/contrib/crc-16.h @@ -10,8 +10,10 @@ #ifndef APTPKG_CRC16_H #define APTPKG_CRC16_H +#include + #define INIT_FCS 0xffff unsigned short AddCRC16(unsigned short fcs, void const *buf, - unsigned long long len); + unsigned long long len) APT_PURE; #endif diff --git a/apt-pkg/contrib/error.h b/apt-pkg/contrib/error.h index 919b1e6d4..ed8c19153 100644 --- a/apt-pkg/contrib/error.h +++ b/apt-pkg/contrib/error.h @@ -141,7 +141,7 @@ public: /*{{{*/ */ bool InsertErrno(MsgType type, const char* Function, const char* Description, va_list &args, - int const errsv, size_t &msgSize); + int const errsv, size_t &msgSize) APT_COLD; /** \brief add an fatal error message to the list * @@ -225,7 +225,7 @@ public: /*{{{*/ * * \return \b true if an error is included in the list, \b false otherwise */ - inline bool PendingError() const {return PendingFlag;}; + inline bool PendingError() const APT_PURE {return PendingFlag;}; /** \brief is the list empty? * @@ -237,7 +237,7 @@ public: /*{{{*/ * * \return \b true if an the list is empty, \b false otherwise */ - bool empty(MsgType const &threshold = WARNING) const; + bool empty(MsgType const &threshold = WARNING) const APT_PURE; /** \brief returns and removes the first (or last) message in the list * @@ -303,7 +303,7 @@ public: /*{{{*/ void MergeWithStack(); /** \brief return the deep of the stack */ - size_t StackCount() const { + size_t StackCount() const APT_PURE { return Stacks.size(); } diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index 6fdea1294..35f3ab0f4 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -119,7 +119,7 @@ class FileFd // Simple manipulators inline int Fd() {return iFd;}; inline void Fd(int fd) { OpenDescriptor(fd, ReadWrite);}; - gzFile gzFd() APT_DEPRECATED; + gzFile gzFd() APT_DEPRECATED APT_PURE; inline bool IsOpen() {return iFd >= 0;}; inline bool Failed() {return (Flags & Fail) == Fail;}; diff --git a/apt-pkg/contrib/gpgv.h b/apt-pkg/contrib/gpgv.h index ab3c68de5..f018893fd 100644 --- a/apt-pkg/contrib/gpgv.h +++ b/apt-pkg/contrib/gpgv.h @@ -41,7 +41,7 @@ class FileFd; */ void ExecGPGV(std::string const &File, std::string const &FileSig, int const &statusfd, int fd[2]) APT_NORETURN; -inline void ExecGPGV(std::string const &File, std::string const &FileSig, +inline APT_NORETURN void ExecGPGV(std::string const &File, std::string const &FileSig, int const &statusfd = -1) { int fd[2]; ExecGPGV(File, FileSig, statusfd, fd); diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc index 5efafa511..1fce0d75f 100644 --- a/apt-pkg/contrib/hashes.cc +++ b/apt-pkg/contrib/hashes.cc @@ -116,7 +116,7 @@ const char** HashString::SupportedHashes() return _SupportedHashes; } -bool HashString::empty() const +APT_PURE bool HashString::empty() const { return (Type.empty() || Hash.empty()); } diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h index 979ee1eb8..5cd1af03b 100644 --- a/apt-pkg/contrib/hashes.h +++ b/apt-pkg/contrib/hashes.h @@ -66,7 +66,7 @@ class HashString bool empty() const; // return the list of hashes we support - static const char** SupportedHashes(); + static APT_CONST const char** SupportedHashes(); }; class Hashes diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index 79479957d..185cdc3fc 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -107,43 +107,43 @@ int tolower_ascii(int const c) APT_CONST APT_HOT; std::string StripEpoch(const std::string &VerStr); #define APT_MKSTRCMP(name,func) \ -inline int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));} \ -inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));} \ -inline int name(const std::string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));} \ -inline int name(const std::string& A,const std::string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());} \ -inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);} +inline APT_PURE int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));} \ +inline APT_PURE int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));} \ +inline APT_PURE int name(const std::string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));} \ +inline APT_PURE int name(const std::string& A,const std::string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());} \ +inline APT_PURE int name(const std::string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);} #define APT_MKSTRCMP2(name,func) \ -inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));} \ -inline int name(const std::string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));} \ -inline int name(const std::string& A,const std::string& B) {return func(A.begin(),A.end(),B.begin(),B.end());} \ -inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);} +inline APT_PURE int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));} \ +inline APT_PURE int name(const std::string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));} \ +inline APT_PURE int name(const std::string& A,const std::string& B) {return func(A.begin(),A.end(),B.begin(),B.end());} \ +inline APT_PURE int name(const std::string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);} -int stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd); -int stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd); +int APT_PURE stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd); +int APT_PURE stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd); /* We assume that GCC 3 indicates that libstdc++3 is in use too. In that case the definition of string::const_iterator is not the same as const char * and we need these extra functions */ #if __GNUC__ >= 3 -int stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd, +int APT_PURE stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd, const char *B,const char *BEnd); -int stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd, +int APT_PURE stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd, std::string::const_iterator B,std::string::const_iterator BEnd); -int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, +int APT_PURE stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, const char *B,const char *BEnd); -int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, +int APT_PURE stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, std::string::const_iterator B,std::string::const_iterator BEnd); -inline int stringcmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));} -inline int stringcasecmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));} +inline APT_PURE int stringcmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));} +inline APT_PURE int stringcasecmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));} #endif APT_MKSTRCMP2(stringcmp,stringcmp) APT_MKSTRCMP2(stringcasecmp,stringcasecmp) // Return the length of a NULL-terminated string array -size_t strv_length(const char **str_array); +size_t APT_PURE strv_length(const char **str_array); inline const char *DeNull(const char *s) {return (s == 0?"(null)":s);} diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 1b35d0d52..eee758b7a 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -660,7 +660,7 @@ pkgCache::PkgFileIterator debStatusIndex::FindInCache(pkgCache &Cache) const // StatusIndex::Exists - Check if the index is available /*{{{*/ // --------------------------------------------------------------------- /* */ -bool debStatusIndex::Exists() const +APT_CONST bool debStatusIndex::Exists() const { // Abort if the file does not exist. return true; diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h index 3bcb3b64f..017c69a0a 100644 --- a/apt-pkg/deb/debindexfile.h +++ b/apt-pkg/deb/debindexfile.h @@ -38,7 +38,7 @@ class debStatusIndex : public pkgIndexFile public: - virtual const Type *GetType() const; + virtual const Type *GetType() const APT_CONST; // Interface for acquire virtual std::string Describe(bool /*Short*/) const {return File;}; @@ -71,7 +71,7 @@ class debPackagesIndex : public pkgIndexFile public: - virtual const Type *GetType() const; + virtual const Type *GetType() const APT_CONST; // Stuff for accessing files on remote items virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const; @@ -110,7 +110,7 @@ class debTranslationsIndex : public pkgIndexFile public: - virtual const Type *GetType() const; + virtual const Type *GetType() const APT_CONST; // Interface for acquire virtual std::string Describe(bool Short) const; @@ -142,7 +142,7 @@ class debSourcesIndex : public pkgIndexFile public: - virtual const Type *GetType() const; + virtual const Type *GetType() const APT_CONST; // Stuff for accessing files on remote items virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record, diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index db557e537..142f3a6e6 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -202,7 +202,7 @@ bool debSystem::Initialize(Configuration &Cnf) // --------------------------------------------------------------------- /* The standard name for a deb is 'deb'.. There are no separate versions of .deb to worry about.. */ -bool debSystem::ArchiveSupported(const char *Type) +APT_PURE bool debSystem::ArchiveSupported(const char *Type) { if (strcmp(Type,"deb") == 0) return true; diff --git a/apt-pkg/deb/debversion.h b/apt-pkg/deb/debversion.h index 981ea9ad2..434ff4a2e 100644 --- a/apt-pkg/deb/debversion.h +++ b/apt-pkg/deb/debversion.h @@ -19,19 +19,19 @@ class debVersioningSystem : public pkgVersioningSystem { public: - + static int CmpFragment(const char *A, const char *AEnd, const char *B, - const char *BEnd); - + const char *BEnd) APT_PURE; + // Compare versions.. virtual int DoCmpVersion(const char *A,const char *Aend, - const char *B,const char *Bend); - virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer); - virtual int DoCmpReleaseVer(const char *A,const char *Aend, + const char *B,const char *Bend) APT_PURE; + virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) APT_PURE; + virtual APT_PURE int DoCmpReleaseVer(const char *A,const char *Aend, const char *B,const char *Bend) { return DoCmpVersion(A,Aend,B,Bend); - } + } virtual std::string UpstreamVersion(const char *A); debVersioningSystem(); diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 149dbc0e7..e2c412757 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1691,9 +1691,9 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator const &Dep) } /*}}}*/ // Policy::GetPriority - Get the priority of the package pin /*{{{*/ -signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgIterator const &/*Pkg*/) +APT_CONST signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgIterator const &/*Pkg*/) { return 0; } -signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgFileIterator const &/*File*/) +APT_CONST signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgFileIterator const &/*File*/) { return 0; } /*}}}*/ pkgDepCache::InRootSetFunc *pkgDepCache::GetRootSetFunc() /*{{{*/ diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index 3ffc3b47d..bde648c65 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -239,7 +240,7 @@ class pkgDepCache : protected pkgCache::Namespace unsigned char DepState; // DepState Flags // Update of candidate version - const char *StripEpoch(const char *Ver); + const char *StripEpoch(const char *Ver) APT_PURE; void Update(PkgIterator Pkg,pkgCache &Cache); // Various test members for the current status of the package diff --git a/apt-pkg/edsp/edspindexfile.h b/apt-pkg/edsp/edspindexfile.h index bd3b41cf2..609a2cde4 100644 --- a/apt-pkg/edsp/edspindexfile.h +++ b/apt-pkg/edsp/edspindexfile.h @@ -25,7 +25,7 @@ class edspIndex : public debStatusIndex public: - virtual const Type *GetType() const; + virtual const Type *GetType() const APT_CONST; virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc index 139deb9f1..212dc7840 100644 --- a/apt-pkg/edsp/edsplistparser.cc +++ b/apt-pkg/edsp/edsplistparser.cc @@ -86,7 +86,7 @@ bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg, } /*}}}*/ // ListParser::LoadReleaseInfo - Load the release information /*{{{*/ -bool edspListParser::LoadReleaseInfo(pkgCache::PkgFileIterator & /*FileI*/, +APT_CONST bool edspListParser::LoadReleaseInfo(pkgCache::PkgFileIterator & /*FileI*/, FileFd & /*File*/, std::string /*component*/) { return true; diff --git a/apt-pkg/edsp/edspsystem.h b/apt-pkg/edsp/edspsystem.h index eafff39ba..65e36d714 100644 --- a/apt-pkg/edsp/edspsystem.h +++ b/apt-pkg/edsp/edspsystem.h @@ -31,11 +31,11 @@ class edspSystem : public pkgSystem public: - virtual bool Lock(); - virtual bool UnLock(bool NoErrors = false); - virtual pkgPackageManager *CreatePM(pkgDepCache *Cache) const; + virtual bool Lock() APT_CONST; + virtual bool UnLock(bool NoErrors = false) APT_CONST; + virtual pkgPackageManager *CreatePM(pkgDepCache *Cache) const APT_CONST; virtual bool Initialize(Configuration &Cnf); - virtual bool ArchiveSupported(const char *Type); + virtual bool ArchiveSupported(const char *Type) APT_CONST; virtual signed Score(Configuration const &Cnf); virtual bool AddStatusFiles(std::vector &List); virtual bool FindIndex(pkgCache::PkgFileIterator File, diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index 3a1385fa5..854ba1bd7 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -642,15 +642,13 @@ bool SigVerify::CopyAndVerify(string CDROM,string Name,vector &SigList, } /*}}}*/ // SigVerify::RunGPGV - deprecated wrapper calling ExecGPGV /*{{{*/ -bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut, +APT_NORETURN bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut, int const &statusfd, int fd[2]) { ExecGPGV(File, FileOut, statusfd, fd); - return false; } -bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut, +APT_NORETURN bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut, int const &statusfd) { ExecGPGV(File, FileOut, statusfd); - return false; } /*}}}*/ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/ diff --git a/apt-pkg/indexfile.h b/apt-pkg/indexfile.h index 98cdda603..b5c9ac77e 100644 --- a/apt-pkg/indexfile.h +++ b/apt-pkg/indexfile.h @@ -54,7 +54,7 @@ class pkgIndexFile // Global list of Items supported static Type **GlobalList; static unsigned long GlobalListLen; - static Type *GetType(const char *Type); + static Type *GetType(const char *Type) APT_PURE; const char *Label; diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc index 1123d1690..5353d1098 100644 --- a/apt-pkg/indexrecords.cc +++ b/apt-pkg/indexrecords.cc @@ -27,33 +27,33 @@ using std::string; -string indexRecords::GetDist() const +APT_PURE string indexRecords::GetDist() const { return this->Dist; } -string indexRecords::GetSuite() const +APT_PURE string indexRecords::GetSuite() const { return this->Suite; } -bool indexRecords::CheckDist(const string MaybeDist) const +APT_PURE bool indexRecords::CheckDist(const string MaybeDist) const { return (this->Dist == MaybeDist || this->Suite == MaybeDist); } -string indexRecords::GetExpectedDist() const +APT_PURE string indexRecords::GetExpectedDist() const { return this->ExpectedDist; } -time_t indexRecords::GetValidUntil() const +APT_PURE time_t indexRecords::GetValidUntil() const { return this->ValidUntil; } -const indexRecords::checkSum *indexRecords::Lookup(const string MetaKey) +APT_PURE const indexRecords::checkSum *indexRecords::Lookup(const string MetaKey) { std::map::const_iterator sum = Entries.find(MetaKey); if (sum == Entries.end()) @@ -61,7 +61,7 @@ const indexRecords::checkSum *indexRecords::Lookup(const string MetaKey) return sum->second; } -bool indexRecords::Exists(string const &MetaKey) const +APT_PURE bool indexRecords::Exists(string const &MetaKey) const { return Entries.count(MetaKey) == 1; } diff --git a/apt-pkg/install-progress.cc b/apt-pkg/install-progress.cc index 6f43e0bc0..dfe4fb18c 100644 --- a/apt-pkg/install-progress.cc +++ b/apt-pkg/install-progress.cc @@ -93,7 +93,7 @@ void PackageManagerProgressFd::StartDpkg() WriteToStatusFd(status.str()); } -void PackageManagerProgressFd::Stop() +APT_CONST void PackageManagerProgressFd::Stop() { } @@ -176,7 +176,7 @@ void PackageManagerProgressDeb822Fd::StartDpkg() WriteToStatusFd(status.str()); } -void PackageManagerProgressDeb822Fd::Stop() +APT_CONST void PackageManagerProgressDeb822Fd::Stop() { } diff --git a/apt-pkg/orderlist.h b/apt-pkg/orderlist.h index 1fdfbf559..b8bad81b3 100644 --- a/apt-pkg/orderlist.h +++ b/apt-pkg/orderlist.h @@ -70,9 +70,9 @@ class pkgOrderList : protected pkgCache::Namespace // For pre sorting static pkgOrderList *Me; - static int OrderCompareA(const void *a, const void *b); - static int OrderCompareB(const void *a, const void *b); - int FileCmp(PkgIterator A,PkgIterator B); + static int OrderCompareA(const void *a, const void *b) APT_PURE; + static int OrderCompareB(const void *a, const void *b) APT_PURE; + int FileCmp(PkgIterator A,PkgIterator B) APT_PURE; public: @@ -102,7 +102,7 @@ class pkgOrderList : protected pkgCache::Namespace inline void RmFlag(Package *Pkg,unsigned long F) {Flags[Pkg->ID] &= ~F;}; // IsNow will return true if the Pkg has been not been either configured or unpacked inline bool IsNow(PkgIterator Pkg) {return (Flags[Pkg->ID] & (States & (~Removed))) == 0;}; - bool IsMissing(PkgIterator Pkg); + bool IsMissing(PkgIterator Pkg) APT_PURE; void WipeFlags(unsigned long F); void SetFileList(std::string *FileList) {this->FileList = FileList;}; diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h index a86b176a4..344ed9192 100644 --- a/apt-pkg/packagemanager.h +++ b/apt-pkg/packagemanager.h @@ -75,7 +75,7 @@ class pkgPackageManager : protected pkgCache::Namespace bool CreateOrderList(); // Analysis helpers - bool DepAlwaysTrue(DepIterator D); + bool DepAlwaysTrue(DepIterator D) APT_PURE; // Install helpers bool ConfigureAll(); diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index b3a714511..5e8a9630a 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -74,9 +74,11 @@ #ifndef PKGLIB_PKGCACHE_H #define PKGLIB_PKGCACHE_H +#include +#include + #include #include -#include #ifndef APT_8_CLEANER_HEADERS using std::string; @@ -156,8 +158,8 @@ class pkgCache /*{{{*/ std::string CacheFile; MMap ⤅ - unsigned long sHash(const std::string &S) const; - unsigned long sHash(const char *S) const; + unsigned long sHash(const std::string &S) const APT_PURE; + unsigned long sHash(const char *S) const APT_PURE; public: @@ -207,8 +209,8 @@ class pkgCache /*{{{*/ pkgVersioningSystem *VS; // Converters - static const char *CompTypeDeb(unsigned char Comp); - static const char *CompType(unsigned char Comp); + static const char *CompTypeDeb(unsigned char Comp) APT_CONST; + static const char *CompType(unsigned char Comp) APT_CONST; static const char *DepType(unsigned char Dep); pkgCache(MMap *Map,bool DoMap = true); @@ -318,7 +320,7 @@ struct pkgCache::Header /** \brief Size of the complete cache file */ unsigned long CacheFileSize; - bool CheckSizes(Header &Against) const; + bool CheckSizes(Header &Against) const APT_PURE; Header(); }; /*}}}*/ diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index 9ccf71c7b..898b34358 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -104,7 +104,7 @@ class pkgCacheGenerator /*{{{*/ bool HasFileDeps() {return FoundFileDeps;}; bool MergeFileProvides(ListParser &List); - bool FinishCache(OpProgress *Progress) APT_DEPRECATED; + bool FinishCache(OpProgress *Progress) APT_DEPRECATED APT_CONST; static bool MakeStatusCache(pkgSourceList &List,OpProgress *Progress, MMap **OutMap = 0,bool AllowMem = false); diff --git a/apt-pkg/pkgsystem.cc b/apt-pkg/pkgsystem.cc index ee6c3f4ec..14d090c7a 100644 --- a/apt-pkg/pkgsystem.cc +++ b/apt-pkg/pkgsystem.cc @@ -13,6 +13,8 @@ #include #include +#include + #include #include /*}}}*/ @@ -35,7 +37,7 @@ pkgSystem::pkgSystem() : Label(NULL), VS(NULL) // System::GetSystem - Get the named system /*{{{*/ // --------------------------------------------------------------------- /* */ -pkgSystem *pkgSystem::GetSystem(const char *Label) +APT_PURE pkgSystem *pkgSystem::GetSystem(const char *Label) { for (unsigned I = 0; I != GlobalListLen; I++) if (strcmp(SysList[I]->Label,Label) == 0) diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index ae30b6f50..3cfc32829 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -333,7 +333,7 @@ pkgCache::VerIterator pkgPolicy::GetMatch(pkgCache::PkgIterator const &Pkg) // Policy::GetPriority - Get the priority of the package pin /*{{{*/ // --------------------------------------------------------------------- /* */ -signed short pkgPolicy::GetPriority(pkgCache::PkgIterator const &Pkg) +APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgIterator const &Pkg) { if (Pins[Pkg->ID].Type != pkgVersionMatch::None) { @@ -345,7 +345,7 @@ signed short pkgPolicy::GetPriority(pkgCache::PkgIterator const &Pkg) return 0; } -signed short pkgPolicy::GetPriority(pkgCache::PkgFileIterator const &File) +APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgFileIterator const &File) { return PFPriority[File->ID]; } diff --git a/apt-pkg/sourcelist.h b/apt-pkg/sourcelist.h index af7569375..9df0c1d74 100644 --- a/apt-pkg/sourcelist.h +++ b/apt-pkg/sourcelist.h @@ -29,6 +29,7 @@ #include #include +#include #include @@ -63,7 +64,7 @@ class pkgSourceList // Global list of Items supported static Type **GlobalList; static unsigned long GlobalListLen; - static Type *GetType(const char *Type); + static Type *GetType(const char *Type) APT_PURE; const char *Name; const char *Label; diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h index ed69d0d72..9915debfe 100644 --- a/apt-pkg/srcrecords.h +++ b/apt-pkg/srcrecords.h @@ -13,6 +13,7 @@ #ifndef PKGLIB_SRCRECORDS_H #define PKGLIB_SRCRECORDS_H +#include #include #include @@ -73,7 +74,7 @@ class pkgSrcRecords //FIXME: Add a parameter to specify which architecture to use for [wildcard] matching virtual bool BuildDepends(std::vector &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true) = 0; - static const char *BuildDepType(unsigned char const &Type); + static const char *BuildDepType(unsigned char const &Type) APT_PURE; virtual bool Files(std::vector &F) = 0; diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index 906321456..91d176e3c 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -85,7 +85,7 @@ pkgTagFile::~pkgTagFile() } /*}}}*/ // TagFile::Offset - Return the current offset in the buffer /*{{{*/ -unsigned long pkgTagFile::Offset() +APT_PURE unsigned long pkgTagFile::Offset() { return d->iOffset; } diff --git a/apt-pkg/vendor.cc b/apt-pkg/vendor.cc index 986636e97..d4add560e 100644 --- a/apt-pkg/vendor.cc +++ b/apt-pkg/vendor.cc @@ -35,7 +35,7 @@ const std::string Vendor::LookupFingerprint(std::string Print) const return (*Elt).second; } -bool Vendor::CheckDist(std::string /*Dist*/) +APT_CONST bool Vendor::CheckDist(std::string /*Dist*/) { return true; } diff --git a/apt-pkg/version.h b/apt-pkg/version.h index e0e0e6c14..d98809f7e 100644 --- a/apt-pkg/version.h +++ b/apt-pkg/version.h @@ -33,7 +33,7 @@ class pkgVersioningSystem // Global list of VS's static pkgVersioningSystem **GlobalList; static unsigned long GlobalListLen; - static pkgVersioningSystem *GetVS(const char *Label); + static pkgVersioningSystem *GetVS(const char *Label) APT_PURE; const char *Label; diff --git a/apt-pkg/versionmatch.h b/apt-pkg/versionmatch.h index a889878ad..4c8f704c8 100644 --- a/apt-pkg/versionmatch.h +++ b/apt-pkg/versionmatch.h @@ -45,7 +45,7 @@ using std::string; #endif class pkgVersionMatch -{ +{ // Version Matching std::string VerStr; bool VerPrefixMatch; @@ -61,20 +61,20 @@ class pkgVersionMatch std::string RelComponent; std::string RelArchitecture; bool MatchAll; - + // Origin Matching std::string OrSite; - + public: - + enum MatchType {None = 0,Version,Release,Origin} Type; - - bool MatchVer(const char *A,std::string B,bool Prefix); + + bool MatchVer(const char *A,std::string B,bool Prefix) APT_PURE; bool ExpressionMatches(const char *pattern, const char *string); bool ExpressionMatches(const std::string& pattern, const char *string); bool FileMatch(pkgCache::PkgFileIterator File); pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg); - + pkgVersionMatch(std::string Data,MatchType Type); }; diff --git a/apt-private/private-cachefile.h b/apt-private/private-cachefile.h index 94d93df2c..67c5e8cdc 100644 --- a/apt-private/private-cachefile.h +++ b/apt-private/private-cachefile.h @@ -13,7 +13,7 @@ class CacheFile : public pkgCacheFile { static pkgCache *SortCache; - static int NameComp(const void *a,const void *b); + static int NameComp(const void *a,const void *b) APT_PURE; public: pkgCache::Package **List; diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index 2b2a35637..682be0a19 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -12,7 +12,7 @@ #include /*}}}*/ -static bool strcmp_match_in_list(char const * const Cmd, ...) /*{{{*/ +APT_SENTINEL static bool strcmp_match_in_list(char const * const Cmd, ...) /*{{{*/ { va_list args; bool found = false; diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 0860ee7bf..84b775390 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -1118,7 +1118,7 @@ static bool Dotty(CommandLine &CmdL) /* This displays the package record from the proper package index file. It is not used by DumpAvail for performance reasons. */ -static unsigned char const* skipDescriptionFields(unsigned char const * DescP) +static APT_PURE unsigned char const* skipDescriptionFields(unsigned char const * DescP) { char const * const TagName = "\nDescription"; size_t const TagLen = strlen(TagName); diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index facb6002b..b7447463d 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -98,7 +98,7 @@ bool pkgCdromTextStatus::ChangeCdrom() return true; } -OpProgress* pkgCdromTextStatus::GetOpProgress() +APT_CONST OpProgress* pkgCdromTextStatus::GetOpProgress() { return &Progress; } diff --git a/methods/ftp.h b/methods/ftp.h index 119d0c7e8..dd92f0086 100644 --- a/methods/ftp.h +++ b/methods/ftp.h @@ -78,7 +78,7 @@ class FtpMethod : public pkgAcqMethod static std::string FailFile; static int FailFd; static time_t FailTime; - static void SigTerm(int); + static APT_NORETURN void SigTerm(int); public: diff --git a/methods/http.cc b/methods/http.cc index 82f16e9b2..ed6e3517d 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -470,7 +470,7 @@ bool HttpServerState::WriteResponse(const std::string &Data) /*{{{*/ return Out.Read(Data); } /*}}}*/ -bool HttpServerState::IsOpen() /*{{{*/ +APT_PURE bool HttpServerState::IsOpen() /*{{{*/ { return (ServerFd != -1); } @@ -485,7 +485,7 @@ bool HttpServerState::InitHashes(FileFd &File) /*{{{*/ return In.Hash->AddFD(File, StartPos); } /*}}}*/ -Hashes * HttpServerState::GetHashes() /*{{{*/ +APT_PURE Hashes * HttpServerState::GetHashes() /*{{{*/ { return In.Hash; } diff --git a/methods/rsh.h b/methods/rsh.h index c2c06acfe..dd259e744 100644 --- a/methods/rsh.h +++ b/methods/rsh.h @@ -64,7 +64,7 @@ class RSHMethod : public pkgAcqMethod static std::string FailFile; static int FailFd; static time_t FailTime; - static void SigTerm(int); + static APT_NORETURN void SigTerm(int); public: diff --git a/methods/server.h b/methods/server.h index d1e151f8a..0f45ab994 100644 --- a/methods/server.h +++ b/methods/server.h @@ -129,7 +129,7 @@ class ServerMethod : public pkgAcqMethod static std::string FailFile; static int FailFd; static time_t FailTime; - static void SigTerm(int); + static APT_NORETURN void SigTerm(int); virtual bool Configuration(std::string Message); virtual bool Flush() { return Server->Flush(File); }; diff --git a/test/libapt/assert.h b/test/libapt/assert.h index cde6a6351..357801592 100644 --- a/test/libapt/assert.h +++ b/test/libapt/assert.h @@ -1,6 +1,8 @@ #include #include +#include + #if __GNUC__ >= 4 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmissing-declarations" @@ -10,7 +12,7 @@ #define equalsNot(x,y) assertEqualsNot(y, x, __LINE__) template < typename X, typename Y > -void OutputAssertEqual(X expect, char const* compare, Y get, unsigned long const &line) { +APT_NORETURN void OutputAssertEqual(X expect, char const* compare, Y get, unsigned long const &line) { std::cerr << "Test FAILED: »" << expect << "« " << compare << " »" << get << "« at line " << line << std::endl; std::exit(EXIT_FAILURE); } -- cgit v1.2.3-70-g09d2 From 79bde56ea93b396e509fff0ad7a490f949aa5aa4 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 9 Mar 2014 13:32:07 +0100 Subject: if mountpoint has a ".disk" directory it is mounted Checking that parent-directory of mountpoint and mountpoint are on different devices is fine most of the time, but is too restrictive for our testcases and there shouldn't be anything wrong with 'normal' users copying disk-contents around either if they want to. We check for the existance of the ".disk/" directory now as this will not be present if the disk isn't 'mounted'. Disks doesn't need to have such a directory through, so for those we fall back to the old way of detecting mounted or not mounted. --- apt-pkg/contrib/cdromutl.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc index 096d3bcf5..176cc2024 100644 --- a/apt-pkg/contrib/cdromutl.cc +++ b/apt-pkg/contrib/cdromutl.cc @@ -45,11 +45,16 @@ bool IsMounted(string &Path) { if (Path.empty() == true) return false; - + // Need that trailing slash for directories if (Path[Path.length() - 1] != '/') Path += '/'; - + + // if the path has a ".disk" directory we treat it as mounted + // this way even extracted copies of disks are recognized + if (DirectoryExists(Path + ".disk/") == true) + return true; + /* First we check if the path is actually mounted, we do this by stating the path and the previous directory (careful of links!) and comparing their device fields. */ -- cgit v1.2.3-70-g09d2 From 454b97a57ff3b7ced87ac359658adecaae7af7ee Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 9 Mar 2014 14:38:07 +0100 Subject: no error for non-existing mountpoints in MountCdrom The mountpoint might be auto-generated by the mount command so pushing an error on the stack will confuse the following code and let it believe an unrecoverable error occured while potentially everything is okay. Same goes for umount as a non-existing mountpoint is by definition not mounted. --- apt-pkg/contrib/cdromutl.cc | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc index 176cc2024..f850e08a5 100644 --- a/apt-pkg/contrib/cdromutl.cc +++ b/apt-pkg/contrib/cdromutl.cc @@ -74,7 +74,13 @@ bool IsMounted(string &Path) leave /etc/mtab inconsitant. We drop all messages this produces. */ bool UnmountCdrom(string Path) { - if (IsMounted(Path) == false) + // do not generate errors, even if the mountpoint does not exist + // the mountpoint might be auto-created by the mount command + // and a non-existing mountpoint is surely not mounted + _error->PushToStack(); + bool const mounted = IsMounted(Path); + _error->RevertToStack(); + if (mounted == false) return true; for (int i=0;i<3;i++) @@ -86,8 +92,9 @@ bool UnmountCdrom(string Path) if (Child == 0) { // Make all the fds /dev/null - for (int I = 0; I != 3; I++) - dup2(open("/dev/null",O_RDWR),I); + int const null_fd = open("/dev/null",O_RDWR); + for (int I = 0; I != 3; ++I) + dup2(null_fd, I); if (_config->Exists("Acquire::cdrom::"+Path+"::UMount") == true) { @@ -121,19 +128,24 @@ bool UnmountCdrom(string Path) /* We fork mount and drop all messages */ bool MountCdrom(string Path, string DeviceName) { - if (IsMounted(Path) == true) + // do not generate errors, even if the mountpoint does not exist + // the mountpoint might be auto-created by the mount command + _error->PushToStack(); + bool const mounted = IsMounted(Path); + _error->RevertToStack(); + if (mounted == true) return true; - + int Child = ExecFork(); // The child if (Child == 0) { // Make all the fds /dev/null - int null_fd = open("/dev/null",O_RDWR); - for (int I = 0; I != 3; I++) + int const null_fd = open("/dev/null",O_RDWR); + for (int I = 0; I != 3; ++I) dup2(null_fd, I); - + if (_config->Exists("Acquire::cdrom::"+Path+"::Mount") == true) { if (system(_config->Find("Acquire::cdrom::"+Path+"::Mount").c_str()) != 0) -- cgit v1.2.3-70-g09d2 From 12844170ad33d96cb0c5fa411f4eb62fea6e3d5d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 10 Mar 2014 01:49:37 +0100 Subject: support very long mtab entries in mountpoint discovery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Old code limited lines to 250 characters which is probably enough for everybody, but who knows… It also takes care of device nodes which start with the same prefix. --- apt-pkg/contrib/cdromutl.cc | 48 ++++++++++++------------ test/libapt/cdromfindmountpointfordevice_test.cc | 26 +++++++++++++ test/libapt/makefile | 6 +++ test/libapt/run-tests | 8 ++++ 4 files changed, 63 insertions(+), 25 deletions(-) create mode 100644 test/libapt/cdromfindmountpointfordevice_test.cc (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc index f850e08a5..936e377fb 100644 --- a/apt-pkg/contrib/cdromutl.cc +++ b/apt-pkg/contrib/cdromutl.cc @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -262,37 +263,34 @@ bool IdentCdrom(string CD,string &Res,unsigned int Version) return true; } /*}}}*/ - // FindMountPointForDevice - Find mountpoint for the given device /*{{{*/ string FindMountPointForDevice(const char *devnode) { - char buf[255]; - char *out[10]; - int i=0; - // this is the order that mount uses as well - const char *mount[] = { "/etc/mtab", - "/proc/mount", - NULL }; + std::vector const mounts = _config->FindVector("Dir::state::MountPoints", "/etc/mtab,/proc/mount"); - for (i=0; mount[i] != NULL; i++) { - if (FileExists(mount[i])) { - FILE *f=fopen(mount[i], "r"); - while ( fgets(buf, sizeof(buf), f) != NULL) { - if (strncmp(buf, devnode, strlen(devnode)) == 0) { - if(TokSplitString(' ', buf, out, 10)) - { - fclose(f); - // unescape the \0XXX chars in the path - string mount_point = out[1]; - return DeEscapeString(mount_point); - } - } - } - fclose(f); + for (std::vector::const_iterator m = mounts.begin(); m != mounts.end(); ++m) + if (FileExists(*m) == true) + { + char * line = NULL; + size_t line_len = 0; + FILE * f = fopen(m->c_str(), "r"); + while(getline(&line, &line_len, f) != -1) + { + char * out[] = { NULL, NULL, NULL }; + TokSplitString(' ', line, out, 3); + if (out[2] != NULL || out[1] == NULL || out[0] == NULL) + continue; + if (strcmp(out[0], devnode) != 0) + continue; + fclose(f); + // unescape the \0XXX chars in the path + string mount_point = out[1]; + return DeEscapeString(mount_point); + } + fclose(f); } - } - + return string(); } /*}}}*/ diff --git a/test/libapt/cdromfindmountpointfordevice_test.cc b/test/libapt/cdromfindmountpointfordevice_test.cc new file mode 100644 index 000000000..26dcd1459 --- /dev/null +++ b/test/libapt/cdromfindmountpointfordevice_test.cc @@ -0,0 +1,26 @@ +#include + +#include +#include + +#include +#include + +#include "assert.h" + +int main(int argc, char const *argv[]) { + if (argc != 2) { + std::cout << "One parameter expected - given " << argc << std::endl; + return 100; + } + + _config->Set("Dir::state::Mountpoints", argv[1]); + equals("/", FindMountPointForDevice("rootfs")); + equals("/", FindMountPointForDevice("/dev/disk/by-uuid/fadcbc52-6284-4874-aaaa-dcee1f05fe21")); + equals("/sys", FindMountPointForDevice("sysfs")); + equals("/sys0", FindMountPointForDevice("sysfs0")); + equals("/boot/efi", FindMountPointForDevice("/dev/sda1")); + equals("/tmp", FindMountPointForDevice("tmpfs")); + + return 0; +} diff --git a/test/libapt/makefile b/test/libapt/makefile index a8e053d6e..66d6ea783 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -94,6 +94,12 @@ SLIBS = -lapt-pkg SOURCE = cdromreducesourcelist_test.cc include $(PROGRAM_H) +# test cdroms FindMountPointForDevice for udev autodetection +PROGRAM = CdromFindMountPointForDevice${BASENAME} +SLIBS = -lapt-pkg +SOURCE = cdromfindmountpointfordevice_test.cc +include $(PROGRAM_H) + # test IndexCopy::ConvertToSourceList PROGRAM = IndexCopyToSourceList${BASENAME} SLIBS = -lapt-pkg diff --git a/test/libapt/run-tests b/test/libapt/run-tests index a056f31f9..0baedcf9e 100755 --- a/test/libapt/run-tests +++ b/test/libapt/run-tests @@ -108,6 +108,14 @@ do "${tmppath}/dists/unstable/InRelease" \ "${tmppath}/dists/broken/Release.gpg" ln -s "${tmppath}/dists/unstable" "${tmppath}/dists/sid" + elif [ $name = "CdromFindMountPointForDevice${EXT}" ]; then + tmppath=$(mktemp) + echo 'rootfs / rootfs rw 0 0 +sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0 +sysfs0 /sys0 sysfs rw,nosuid,nodev,noexec,relatime 0 0 +/dev/disk/by-uuid/fadcbc52-6284-4874-aaaa-dcee1f05fe21 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0 +/dev/sda1 /boot/efi vfat rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=utf8,shortname=lower,quiet,utf8,errors=remount-ro,rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=utf8,shortname=lower,quiet,utf8,errors=remount-ro,rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=utf8,shortname=lower,quiet,utf8,errors=remount-ro,rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=utf8,shortname=lower,quiet,utf8,errors=remount-ro 0 0 +tmpfs /tmp tmpfs rw,nosuid,nodev,relatime 0 0' > $tmppath fi echo -n "Testing with ${NAME} " -- cgit v1.2.3-70-g09d2 From 84baaae93badc2da7c1f4f356456762895cef278 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 31 May 2013 19:27:57 +0200 Subject: move fd duplication closer to the gz/bz2 open calls Git-Dch: Ignore --- apt-pkg/contrib/fileutl.cc | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 55ba41128..2188f616a 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1067,30 +1067,12 @@ bool FileFd::OpenDescriptor(int Fd, unsigned int const Mode, APT::Configuration: { Close(); Flags = (AutoClose) ? FileFd::AutoClose : 0; - if (AutoClose == false && ( -#ifdef HAVE_ZLIB - compressor.Name == "gzip" || -#endif -#ifdef HAVE_BZ2 - compressor.Name == "bzip2" || -#endif - false)) - { - // Need to duplicate fd here or gzclose for cleanup will close the fd as well - iFd = dup(Fd); - } - else - iFd = Fd; + iFd = Fd; this->FileName = ""; - if (Fd == -1 || OpenInternDescriptor(Mode, compressor) == false) + if (OpenInternDescriptor(Mode, compressor) == false) { if (iFd != -1 && ( -#ifdef HAVE_ZLIB - compressor.Name == "gzip" || -#endif -#ifdef HAVE_BZ2 - compressor.Name == "bzip2" || -#endif + (Flags & Compressed) == Compressed || AutoClose == true)) { close (iFd); @@ -1102,6 +1084,8 @@ bool FileFd::OpenDescriptor(int Fd, unsigned int const Mode, APT::Configuration: } bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor) { + if (iFd == -1) + return false; if (compressor.Name == "." || compressor.Binary.empty() == true) return true; @@ -1110,6 +1094,21 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C d = new FileFdPrivate(); d->openmode = Mode; d->compressor = compressor; + if (AutoClose == false && ( +#ifdef HAVE_ZLIB + compressor.Name == "gzip" || +#endif +#ifdef HAVE_BZ2 + compressor.Name == "bzip2" || +#endif + false)) + { + // Need to duplicate fd here or gz/bz2 close for cleanup will close the fd as well + int const internFd = dup(iFd); + if (internFd == -1) + return FileFdErrno("OpenInternDescriptor", _("Could not open file descriptor %d"), iFd); + iFd = internFd; + } } #ifdef HAVE_ZLIB -- cgit v1.2.3-70-g09d2 From 69d6988a1914881952c013cb63b4d835c3db0db7 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 9 Jun 2013 14:32:48 +0200 Subject: refactor setup of file opening via zlib/bz2 lib Git-Dch: Ignore --- apt-pkg/contrib/fileutl.cc | 73 +++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 37 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 2188f616a..057cb6a94 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1089,19 +1089,32 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C if (compressor.Name == "." || compressor.Binary.empty() == true) return true; +#if defined HAVE_ZLIB || defined HAVE_BZ2 + // the API to open files is similar, so setup to avoid code duplicates later + // and while at it ensure that we close before opening (if its a reopen) + void* (*compress_open)(int, const char *) = NULL; +#define APT_COMPRESS_INIT(NAME,OPEN,CLOSE,STRUCT) \ + if (compressor.Name == NAME) \ + { \ + compress_open = (void*(*)(int, const char *)) OPEN; \ + if (d != NULL && STRUCT != NULL) { CLOSE(STRUCT); STRUCT = NULL; } \ + } +#ifdef HAVE_ZLIB + APT_COMPRESS_INIT("gzip", gzdopen, gzclose, d->gz) +#endif +#ifdef HAVE_BZ2 + APT_COMPRESS_INIT("bzip2", BZ2_bzdopen, BZ2_bzclose, d->bz2) +#endif +#undef APT_COMPRESS_INIT +#endif + if (d == NULL) { d = new FileFdPrivate(); d->openmode = Mode; d->compressor = compressor; - if (AutoClose == false && ( -#ifdef HAVE_ZLIB - compressor.Name == "gzip" || -#endif -#ifdef HAVE_BZ2 - compressor.Name == "bzip2" || -#endif - false)) +#if defined HAVE_ZLIB || defined HAVE_BZ2 + if (AutoClose == false && compress_open != NULL) { // Need to duplicate fd here or gz/bz2 close for cleanup will close the fd as well int const internFd = dup(iFd); @@ -1109,44 +1122,30 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C return FileFdErrno("OpenInternDescriptor", _("Could not open file descriptor %d"), iFd); iFd = internFd; } +#endif } -#ifdef HAVE_ZLIB - if (compressor.Name == "gzip") +#if defined HAVE_ZLIB || defined HAVE_BZ2 + if (compress_open != NULL) { - if (d->gz != NULL) - { - gzclose(d->gz); - d->gz = NULL; - } + void* compress_struct = NULL; if ((Mode & ReadWrite) == ReadWrite) - d->gz = gzdopen(iFd, "r+"); + compress_struct = compress_open(iFd, "r+"); else if ((Mode & WriteOnly) == WriteOnly) - d->gz = gzdopen(iFd, "w"); + compress_struct = compress_open(iFd, "w"); else - d->gz = gzdopen(iFd, "r"); - if (d->gz == NULL) + compress_struct = compress_open(iFd, "r"); + if (compress_struct == NULL) return false; - Flags |= Compressed; - return true; - } + +#ifdef HAVE_ZLIB + if (compressor.Name == "gzip") + d->gz = (gzFile) compress_struct; #endif #ifdef HAVE_BZ2 - if (compressor.Name == "bzip2") - { - if (d->bz2 != NULL) - { - BZ2_bzclose(d->bz2); - d->bz2 = NULL; - } - if ((Mode & ReadWrite) == ReadWrite) - d->bz2 = BZ2_bzdopen(iFd, "r+"); - else if ((Mode & WriteOnly) == WriteOnly) - d->bz2 = BZ2_bzdopen(iFd, "w"); - else - d->bz2 = BZ2_bzdopen(iFd, "r"); - if (d->bz2 == NULL) - return false; + if (compressor.Name == "bzip2") + d->bz2 = (BZFILE*) compress_struct; +#endif Flags |= Compressed; return true; } -- cgit v1.2.3-70-g09d2 From 7f350a377e0c65a656b9b5437e27d037fd742901 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 12 Mar 2014 14:39:18 +0100 Subject: use liblzma-dev to provide xz/lzma support We have xz/lzma support for a while, but only via an external binary provided by xz-utils. Now that the Debian archive provides xz by default and dpkg pre-depends on the library provided by liblzma-dev we can switch now to use this library as well to avoid requiring an external binary. For now the binary is in a prio:required package, but this might change in the future. API wise it is quiet similar to bz2 code expect that it doesn't provide file I/O methods, so we piece this together on our own. --- apt-pkg/aptconfiguration.cc | 8 ++ apt-pkg/contrib/fileutl.cc | 280 ++++++++++++++++++++++++++++++++++++++------ apt-pkg/makefile | 3 + buildlib/config.h.in | 3 + buildlib/environment.mak.in | 1 + configure.ac | 7 ++ debian/control | 8 +- 7 files changed, 271 insertions(+), 39 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index 941a9c334..6ba047560 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -462,8 +462,16 @@ const Configuration::getCompressors(bool const Cached) { #endif if (_config->Exists("Dir::Bin::xz") == false || FileExists(_config->FindFile("Dir::Bin::xz")) == true) compressors.push_back(Compressor("xz",".xz","xz","-6","-d",4)); +#ifdef HAVE_LZMA + else + compressors.push_back(Compressor("xz",".xz","false", NULL, NULL, 4)); +#endif if (_config->Exists("Dir::Bin::lzma") == false || FileExists(_config->FindFile("Dir::Bin::lzma")) == true) compressors.push_back(Compressor("lzma",".lzma","lzma","-9","-d",5)); +#ifdef HAVE_LZMA + else + compressors.push_back(Compressor("lzma",".lzma","false", NULL, NULL, 5)); +#endif std::vector const comp = _config->FindVector("APT::Compressor"); for (std::vector::const_iterator c = comp.begin(); diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 057cb6a94..22730ec04 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -58,6 +58,9 @@ #ifdef HAVE_BZ2 #include #endif +#ifdef HAVE_LZMA + #include +#endif #ifdef WORDS_BIGENDIAN #include @@ -72,13 +75,47 @@ class FileFdPrivate { public: #ifdef HAVE_ZLIB gzFile gz; -#else - void* gz; #endif #ifdef HAVE_BZ2 BZFILE* bz2; -#else - void* bz2; +#endif +#ifdef HAVE_LZMA + struct LZMAFILE { + FILE* file; + uint8_t buffer[4096]; + lzma_stream stream; + lzma_ret err; + bool eof; + bool compressing; + + LZMAFILE() : file(NULL), eof(false), compressing(false) {} + ~LZMAFILE() { + if (compressing == true) + { + for (;;) { + stream.avail_out = sizeof(buffer)/sizeof(buffer[0]); + stream.next_out = buffer; + err = lzma_code(&stream, LZMA_FINISH); + if (err != LZMA_OK && err != LZMA_STREAM_END) + { + _error->Error("~LZMAFILE: Compress finalisation failed"); + break; + } + size_t const n = sizeof(buffer)/sizeof(buffer[0]) - stream.avail_out; + if (n && fwrite(buffer, 1, n, file) != n) + { + _error->Errno("~LZMAFILE",_("Write error")); + break; + } + if (err == LZMA_STREAM_END) + break; + } + } + lzma_end(&stream); + fclose(file); + } + }; + LZMAFILE* lzma; #endif int compressed_fd; pid_t compressor_pid; @@ -86,7 +123,16 @@ class FileFdPrivate { APT::Configuration::Compressor compressor; unsigned int openmode; unsigned long long seekpos; - FileFdPrivate() : gz(NULL), bz2(NULL), + FileFdPrivate() : +#ifdef HAVE_ZLIB + gz(NULL), +#endif +#ifdef HAVE_BZ2 + bz2(NULL), +#endif +#ifdef HAVE_LZMA + lzma(NULL), +#endif compressed_fd(-1), compressor_pid(-1), pipe(false), openmode(0), seekpos(0) {}; bool CloseDown(std::string const &FileName) @@ -106,6 +152,12 @@ class FileFdPrivate { BZ2_bzclose(bz2); bz2 = NULL; } +#endif +#ifdef HAVE_LZMA + if (lzma != NULL) { + delete lzma; + lzma = NULL; + } #endif if (compressor_pid > 0) ExecWait(compressor_pid, "FileFdCompressor", true); @@ -1089,12 +1141,14 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C if (compressor.Name == "." || compressor.Binary.empty() == true) return true; -#if defined HAVE_ZLIB || defined HAVE_BZ2 +#if defined HAVE_ZLIB || defined HAVE_BZ2 || defined HAVE_LZMA // the API to open files is similar, so setup to avoid code duplicates later // and while at it ensure that we close before opening (if its a reopen) void* (*compress_open)(int, const char *) = NULL; + if (false) + /* dummy so that the rest can be 'else if's */; #define APT_COMPRESS_INIT(NAME,OPEN,CLOSE,STRUCT) \ - if (compressor.Name == NAME) \ + else if (compressor.Name == NAME) \ { \ compress_open = (void*(*)(int, const char *)) OPEN; \ if (d != NULL && STRUCT != NULL) { CLOSE(STRUCT); STRUCT = NULL; } \ @@ -1105,6 +1159,17 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C #ifdef HAVE_BZ2 APT_COMPRESS_INIT("bzip2", BZ2_bzdopen, BZ2_bzclose, d->bz2) #endif +#ifdef HAVE_LZMA + else if (compressor.Name == "xz" || compressor.Name == "lzma") + { + compress_open = (void*(*)(int, const char*)) fdopen; + if (d != NULL && d->lzma != NULL) + { + delete d->lzma; + d->lzma = NULL; + } + } +#endif #undef APT_COMPRESS_INIT #endif @@ -1113,7 +1178,7 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C d = new FileFdPrivate(); d->openmode = Mode; d->compressor = compressor; -#if defined HAVE_ZLIB || defined HAVE_BZ2 +#if defined HAVE_ZLIB || defined HAVE_BZ2 || defined HAVE_LZMA if (AutoClose == false && compress_open != NULL) { // Need to duplicate fd here or gz/bz2 close for cleanup will close the fd as well @@ -1125,7 +1190,7 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C #endif } -#if defined HAVE_ZLIB || defined HAVE_BZ2 +#if defined HAVE_ZLIB || defined HAVE_BZ2 || defined HAVE_LZMA if (compress_open != NULL) { void* compress_struct = NULL; @@ -1138,13 +1203,60 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C if (compress_struct == NULL) return false; + if (false) + /* dummy so that the rest can be 'else if's */; #ifdef HAVE_ZLIB - if (compressor.Name == "gzip") + else if (compressor.Name == "gzip") d->gz = (gzFile) compress_struct; #endif #ifdef HAVE_BZ2 - if (compressor.Name == "bzip2") + else if (compressor.Name == "bzip2") d->bz2 = (BZFILE*) compress_struct; +#endif +#ifdef HAVE_LZMA + else if (compressor.Name == "xz" || compressor.Name == "lzma") + { + uint32_t const xzlevel = 6; + uint64_t const memlimit = UINT64_MAX; + if (d->lzma == NULL) + d->lzma = new FileFdPrivate::LZMAFILE; + d->lzma->file = (FILE*) compress_struct; + d->lzma->stream = LZMA_STREAM_INIT; + + if ((Mode & ReadWrite) == ReadWrite) + return FileFdError("ReadWrite mode is not supported for file %s", FileName.c_str()); + + if ((Mode & WriteOnly) == WriteOnly) + { + if (compressor.Name == "xz") + { + if (lzma_easy_encoder(&d->lzma->stream, xzlevel, LZMA_CHECK_CRC32) != LZMA_OK) + return false; + } + else + { + lzma_options_lzma options; + lzma_lzma_preset(&options, xzlevel); + if (lzma_alone_encoder(&d->lzma->stream, &options) != LZMA_OK) + return false; + } + d->lzma->compressing = true; + } + else + { + if (compressor.Name == "xz") + { + if (lzma_auto_decoder(&d->lzma->stream, memlimit, 0) != LZMA_OK) + return false; + } + else + { + if (lzma_alone_decoder(&d->lzma->stream, memlimit) != LZMA_OK) + return false; + } + d->lzma->compressing = false; + } + } #endif Flags |= Compressed; return true; @@ -1202,7 +1314,7 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C } else { - if (FileName.empty() == true) + if (d->compressed_fd != -1) dup2(d->compressed_fd,STDIN_FILENO); dup2(Pipe[1],STDOUT_FILENO); } @@ -1271,24 +1383,55 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual) *((char *)To) = '\0'; do { + if (false) + /* dummy so that the rest can be 'else if's */; #ifdef HAVE_ZLIB - if (d != NULL && d->gz != NULL) + else if (d != NULL && d->gz != NULL) Res = gzread(d->gz,To,Size); - else #endif #ifdef HAVE_BZ2 - if (d != NULL && d->bz2 != NULL) + else if (d != NULL && d->bz2 != NULL) Res = BZ2_bzread(d->bz2,To,Size); - else #endif +#ifdef HAVE_LZMA + else if (d != NULL && d->lzma != NULL) + { + if (d->lzma->eof == true) + break; + + d->lzma->stream.next_out = (uint8_t *) To; + d->lzma->stream.avail_out = Size; + if (d->lzma->stream.avail_in == 0) + { + d->lzma->stream.next_in = d->lzma->buffer; + d->lzma->stream.avail_in = fread(d->lzma->buffer, 1, sizeof(d->lzma->buffer)/sizeof(d->lzma->buffer[0]), d->lzma->file); + } + d->lzma->err = lzma_code(&d->lzma->stream, LZMA_RUN); + if (d->lzma->err == LZMA_STREAM_END) + { + d->lzma->eof = true; + Res = Size - d->lzma->stream.avail_out; + } + else if (d->lzma->err != LZMA_OK) + { + Res = -1; + errno = 0; + } + else + Res = Size - d->lzma->stream.avail_out; + } +#endif + else Res = read(iFd,To,Size); if (Res < 0) { if (errno == EINTR) continue; + if (false) + /* dummy so that the rest can be 'else if's */; #ifdef HAVE_ZLIB - if (d != NULL && d->gz != NULL) + else if (d != NULL && d->gz != NULL) { int err; char const * const errmsg = gzerror(d->gz, &err); @@ -1297,13 +1440,17 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual) } #endif #ifdef HAVE_BZ2 - if (d != NULL && d->bz2 != NULL) + else if (d != NULL && d->bz2 != NULL) { int err; char const * const errmsg = BZ2_bzerror(d->bz2, &err); if (err != BZ_IO_ERROR) return FileFdError("BZ2_bzread: %s (%d: %s)", _("Read error"), err, errmsg); } +#endif +#ifdef HAVE_LZMA + else if (d != NULL && d->lzma != NULL) + return FileFdError("lzma_read: %s (%d)", _("Read error"), d->lzma->err); #endif return FileFdErrno("read",_("Read error")); } @@ -1368,23 +1515,45 @@ bool FileFd::Write(const void *From,unsigned long long Size) errno = 0; do { + if (false) + /* dummy so that the rest can be 'else if's */; #ifdef HAVE_ZLIB - if (d != NULL && d->gz != NULL) - Res = gzwrite(d->gz,From,Size); - else + else if (d != NULL && d->gz != NULL) + Res = gzwrite(d->gz,From,Size); #endif #ifdef HAVE_BZ2 - if (d != NULL && d->bz2 != NULL) - Res = BZ2_bzwrite(d->bz2,(void*)From,Size); - else + else if (d != NULL && d->bz2 != NULL) + Res = BZ2_bzwrite(d->bz2,(void*)From,Size); #endif - Res = write(iFd,From,Size); +#ifdef HAVE_LZMA + else if (d != NULL && d->lzma != NULL) + { + d->lzma->stream.next_in = (uint8_t *)From; + d->lzma->stream.avail_in = Size; + d->lzma->stream.next_out = d->lzma->buffer; + d->lzma->stream.avail_out = sizeof(d->lzma->buffer)/sizeof(d->lzma->buffer[0]); + d->lzma->err = lzma_code(&d->lzma->stream, LZMA_RUN); + if (d->lzma->err != LZMA_OK) + return false; + size_t const n = sizeof(d->lzma->buffer)/sizeof(d->lzma->buffer[0]) - d->lzma->stream.avail_out; + size_t const m = (n == 0) ? 0 : fwrite(d->lzma->buffer, 1, n, d->lzma->file); + if (m != n) + Res = -1; + else + Res = Size - d->lzma->stream.avail_in; + } +#endif + else + Res = write(iFd,From,Size); + if (Res < 0 && errno == EINTR) continue; if (Res < 0) { + if (false) + /* dummy so that the rest can be 'else if's */; #ifdef HAVE_ZLIB - if (d != NULL && d->gz != NULL) + else if (d != NULL && d->gz != NULL) { int err; char const * const errmsg = gzerror(d->gz, &err); @@ -1393,13 +1562,17 @@ bool FileFd::Write(const void *From,unsigned long long Size) } #endif #ifdef HAVE_BZ2 - if (d != NULL && d->bz2 != NULL) + else if (d != NULL && d->bz2 != NULL) { int err; char const * const errmsg = BZ2_bzerror(d->bz2, &err); if (err != BZ_IO_ERROR) return FileFdError("BZ2_bzwrite: %s (%d: %s)", _("Write error"), err, errmsg); } +#endif +#ifdef HAVE_LZMA + else if (d != NULL && d->lzma != NULL) + return FileFdErrno("lzma_fwrite", _("Write error")); #endif return FileFdErrno("write",_("Write error")); } @@ -1447,6 +1620,9 @@ bool FileFd::Seek(unsigned long long To) if (d != NULL && (d->pipe == true #ifdef HAVE_BZ2 || d->bz2 != NULL +#endif +#ifdef HAVE_LZMA + || d->lzma != NULL #endif )) { @@ -1459,12 +1635,21 @@ bool FileFd::Seek(unsigned long long To) if ((d->openmode & ReadOnly) != ReadOnly) return FileFdError("Reopen is only implemented for read-only files!"); + if (false) + /* dummy so that the rest can be 'else if's */; #ifdef HAVE_BZ2 - if (d->bz2 != NULL) - { - BZ2_bzclose(d->bz2); - d->bz2 = NULL; - } + else if (d->bz2 != NULL) + { + BZ2_bzclose(d->bz2); + d->bz2 = NULL; + } +#endif +#ifdef HAVE_LZMA + else if (d->lzma != NULL) + { + delete d->lzma; + d->lzma = NULL; + } #endif if (iFd != -1) close(iFd); @@ -1514,6 +1699,9 @@ bool FileFd::Skip(unsigned long long Over) if (d != NULL && (d->pipe == true #ifdef HAVE_BZ2 || d->bz2 != NULL +#endif +#ifdef HAVE_LZMA + || d->lzma != NULL #endif )) { @@ -1552,8 +1740,18 @@ bool FileFd::Truncate(unsigned long long To) // truncating /dev/null is always successful - as we get an error otherwise if (To == 0 && FileName == "/dev/null") return true; -#if defined HAVE_ZLIB || defined HAVE_BZ2 - if (d != NULL && (d->gz != NULL || d->bz2 != NULL)) +#if defined HAVE_ZLIB || defined HAVE_BZ2 || defined HAVE_LZMA + if (d != NULL && ( +#ifdef HAVE_ZLIB + d->gz != NULL || +#endif +#ifdef HAVE_BZ2 + d->bz2 != NULL || +#endif +#ifdef HAVE_LZMA + d->lzma != NULL || +#endif + false)) return FileFdError("Truncating compressed files is not implemented (%s)", FileName.c_str()); #endif if (ftruncate(iFd,To) != 0) @@ -1574,6 +1772,9 @@ unsigned long long FileFd::Tell() if (d != NULL && (d->pipe == true #ifdef HAVE_BZ2 || d->bz2 != NULL +#endif +#ifdef HAVE_LZMA + || d->lzma != NULL #endif )) return d->seekpos; @@ -1653,6 +1854,9 @@ unsigned long long FileFd::Size() if (d != NULL && (d->pipe == true #ifdef HAVE_BZ2 || (d->bz2 && size > 0) +#endif +#ifdef HAVE_LZMA + || (d->lzma && size > 0) #endif )) { @@ -1797,7 +2001,13 @@ bool FileFd::FileFdError(const char *Description,...) { } /*}}}*/ -gzFile FileFd::gzFd() { return d->gz; } +APT_DEPRECATED gzFile FileFd::gzFd() { +#ifdef HAVE_ZLIB + return d->gz; +#else + return NULL; +#endif +} // Glob - wrapper around "glob()" /*{{{*/ diff --git a/apt-pkg/makefile b/apt-pkg/makefile index a90131f80..1d456873b 100644 --- a/apt-pkg/makefile +++ b/apt-pkg/makefile @@ -21,6 +21,9 @@ endif ifeq ($(HAVE_BZ2),yes) SLIBS+= -lbz2 endif +ifeq ($(HAVE_LZMA),yes) +SLIBS+= -llzma +endif APT_DOMAIN:=libapt-pkg$(LIBAPTPKG_MAJOR) # Source code for the contributed non-core things diff --git a/buildlib/config.h.in b/buildlib/config.h.in index 6779e07bc..6b72fb393 100644 --- a/buildlib/config.h.in +++ b/buildlib/config.h.in @@ -11,6 +11,9 @@ /* Define if we have the bz2 library for bzip2 */ #undef HAVE_BZ2 +/* Define if we have the lzma library for lzma/xz */ +#undef HAVE_LZMA + /* These two are used by the statvfs shim for glibc2.0 and bsd */ /* Define if we have sys/vfs.h */ #undef HAVE_VFS_H diff --git a/buildlib/environment.mak.in b/buildlib/environment.mak.in index 9cc449573..c1bf29672 100644 --- a/buildlib/environment.mak.in +++ b/buildlib/environment.mak.in @@ -61,6 +61,7 @@ INTLLIBS = @INTLLIBS@ HAVE_STATVFS = @HAVE_STATVFS@ HAVE_ZLIB = @HAVE_ZLIB@ HAVE_BZ2 = @HAVE_BZ2@ +HAVE_LZMA = @HAVE_LZMA@ NEED_SOCKLEN_T_DEFINE = @NEED_SOCKLEN_T_DEFINE@ # Shared library things diff --git a/configure.ac b/configure.ac index 40556ee54..4f782f873 100644 --- a/configure.ac +++ b/configure.ac @@ -107,6 +107,13 @@ if test "x$HAVE_BZ2" = "xyes"; then AC_DEFINE(HAVE_BZ2) fi +HAVE_LZMA=no +AC_CHECK_LIB(lzma, lzma_easy_encoder,[AC_CHECK_HEADER(lzma.h, [HAVE_LZMA=yes], [])], []) +AC_SUBST(HAVE_LZMA) +if test "x$HAVE_LZMA" = "xyes"; then + AC_DEFINE(HAVE_LZMA) +fi + dnl Converts the ARCH to be something singular for this general CPU family dnl This is often the dpkg architecture string. dnl First check against the full canonical canoncial-system-type in $target diff --git a/debian/control b/debian/control index 5ce68414e..cb6f9b995 100644 --- a/debian/control +++ b/debian/control @@ -7,8 +7,9 @@ Uploaders: Michael Vogt , Christian Perrier Standards-Version: 3.9.5 Build-Depends: dpkg-dev (>= 1.15.8), debhelper (>= 8.1.3~), libdb-dev, gettext (>= 0.12), libcurl4-gnutls-dev (>= 7.19.4~), - zlib1g-dev, libbz2-dev, xsltproc, docbook-xsl, docbook-xml, - po4a (>= 0.34-2), autotools-dev, autoconf, automake + zlib1g-dev, libbz2-dev, liblzma-dev, + xsltproc, docbook-xsl, docbook-xml, po4a (>= 0.34-2), + autotools-dev, autoconf, automake Build-Depends-Indep: doxygen, debiandoc-sgml, graphviz Build-Conflicts: autoconf2.13, automake1.4 Vcs-Git: git://anonscm.debian.org/apt/apt.git @@ -41,7 +42,7 @@ Package: libapt-pkg4.12 Architecture: any Multi-Arch: same Pre-Depends: ${misc:Pre-Depends} -Depends: ${shlibs:Depends}, ${misc:Depends}, xz-utils +Depends: ${shlibs:Depends}, ${misc:Depends} Breaks: apt (<< 0.9.4~), libapt-inst1.5 (<< 0.9.9~) Section: libs Description: package management runtime library @@ -107,7 +108,6 @@ Description: documentation for APT development Package: apt-utils Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} -Suggests: xz-utils Description: package management related utility programs This package contains some less used commandline utilities related to package management with APT. -- cgit v1.2.3-70-g09d2 From 4239dbca053512b6f8357ed143c24c50685b890f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 12 Mar 2014 16:16:14 +0100 Subject: refactor FileFd to hide some #ifdefs They tend to be ugly to look at, so hide them. Git-Dch: Ignore --- apt-pkg/contrib/fileutl.cc | 299 ++++++++++++++++++++------------------------- 1 file changed, 131 insertions(+), 168 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 22730ec04..26945c183 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1,6 +1,5 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: fileutl.cc,v 1.42 2002/09/14 05:29:22 jgg Exp $ /* ###################################################################### File Utilities @@ -59,6 +58,7 @@ #include #endif #ifdef HAVE_LZMA + #include #include #endif @@ -71,103 +71,6 @@ using namespace std; -class FileFdPrivate { - public: -#ifdef HAVE_ZLIB - gzFile gz; -#endif -#ifdef HAVE_BZ2 - BZFILE* bz2; -#endif -#ifdef HAVE_LZMA - struct LZMAFILE { - FILE* file; - uint8_t buffer[4096]; - lzma_stream stream; - lzma_ret err; - bool eof; - bool compressing; - - LZMAFILE() : file(NULL), eof(false), compressing(false) {} - ~LZMAFILE() { - if (compressing == true) - { - for (;;) { - stream.avail_out = sizeof(buffer)/sizeof(buffer[0]); - stream.next_out = buffer; - err = lzma_code(&stream, LZMA_FINISH); - if (err != LZMA_OK && err != LZMA_STREAM_END) - { - _error->Error("~LZMAFILE: Compress finalisation failed"); - break; - } - size_t const n = sizeof(buffer)/sizeof(buffer[0]) - stream.avail_out; - if (n && fwrite(buffer, 1, n, file) != n) - { - _error->Errno("~LZMAFILE",_("Write error")); - break; - } - if (err == LZMA_STREAM_END) - break; - } - } - lzma_end(&stream); - fclose(file); - } - }; - LZMAFILE* lzma; -#endif - int compressed_fd; - pid_t compressor_pid; - bool pipe; - APT::Configuration::Compressor compressor; - unsigned int openmode; - unsigned long long seekpos; - FileFdPrivate() : -#ifdef HAVE_ZLIB - gz(NULL), -#endif -#ifdef HAVE_BZ2 - bz2(NULL), -#endif -#ifdef HAVE_LZMA - lzma(NULL), -#endif - compressed_fd(-1), compressor_pid(-1), pipe(false), - openmode(0), seekpos(0) {}; - bool CloseDown(std::string const &FileName) - { - bool Res = true; -#ifdef HAVE_ZLIB - if (gz != NULL) { - int const e = gzclose(gz); - gz = NULL; - // gzdclose() on empty files always fails with "buffer error" here, ignore that - if (e != 0 && e != Z_BUF_ERROR) - Res &= _error->Errno("close",_("Problem closing the gzip file %s"), FileName.c_str()); - } -#endif -#ifdef HAVE_BZ2 - if (bz2 != NULL) { - BZ2_bzclose(bz2); - bz2 = NULL; - } -#endif -#ifdef HAVE_LZMA - if (lzma != NULL) { - delete lzma; - lzma = NULL; - } -#endif - if (compressor_pid > 0) - ExecWait(compressor_pid, "FileFdCompressor", true); - compressor_pid = -1; - - return Res; - } - ~FileFdPrivate() { CloseDown(""); } -}; - // RunScripts - Run a set of scripts from a configuration subtree /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -932,6 +835,122 @@ bool ExecWait(pid_t Pid,const char *Name,bool Reap) } /*}}}*/ +class FileFdPrivate { /*{{{*/ + public: +#ifdef HAVE_ZLIB + gzFile gz; +#endif +#ifdef HAVE_BZ2 + BZFILE* bz2; +#endif +#ifdef HAVE_LZMA + struct LZMAFILE { + FILE* file; + uint8_t buffer[4096]; + lzma_stream stream; + lzma_ret err; + bool eof; + bool compressing; + + LZMAFILE() : file(NULL), eof(false), compressing(false) {} + ~LZMAFILE() { + if (compressing == true) + { + for (;;) { + stream.avail_out = sizeof(buffer)/sizeof(buffer[0]); + stream.next_out = buffer; + err = lzma_code(&stream, LZMA_FINISH); + if (err != LZMA_OK && err != LZMA_STREAM_END) + { + _error->Error("~LZMAFILE: Compress finalisation failed"); + break; + } + size_t const n = sizeof(buffer)/sizeof(buffer[0]) - stream.avail_out; + if (n && fwrite(buffer, 1, n, file) != n) + { + _error->Errno("~LZMAFILE",_("Write error")); + break; + } + if (err == LZMA_STREAM_END) + break; + } + } + lzma_end(&stream); + fclose(file); + } + }; + LZMAFILE* lzma; +#endif + int compressed_fd; + pid_t compressor_pid; + bool pipe; + APT::Configuration::Compressor compressor; + unsigned int openmode; + unsigned long long seekpos; + FileFdPrivate() : +#ifdef HAVE_ZLIB + gz(NULL), +#endif +#ifdef HAVE_BZ2 + bz2(NULL), +#endif +#ifdef HAVE_LZMA + lzma(NULL), +#endif + compressed_fd(-1), compressor_pid(-1), pipe(false), + openmode(0), seekpos(0) {}; + bool InternalClose(std::string const &FileName) + { + if (false) + /* dummy so that the rest can be 'else if's */; +#ifdef HAVE_ZLIB + else if (gz != NULL) { + int const e = gzclose(gz); + gz = NULL; + // gzdclose() on empty files always fails with "buffer error" here, ignore that + if (e != 0 && e != Z_BUF_ERROR) + return _error->Errno("close",_("Problem closing the gzip file %s"), FileName.c_str()); + } +#endif +#ifdef HAVE_BZ2 + else if (bz2 != NULL) { + BZ2_bzclose(bz2); + bz2 = NULL; + } +#endif +#ifdef HAVE_LZMA + else if (lzma != NULL) { + delete lzma; + lzma = NULL; + } +#endif + return true; + } + bool CloseDown(std::string const &FileName) + { + bool const Res = InternalClose(FileName); + + if (compressor_pid > 0) + ExecWait(compressor_pid, "FileFdCompressor", true); + compressor_pid = -1; + + return Res; + } + bool InternalStream() const { + return false +#ifdef HAVE_BZ2 + || bz2 != NULL +#endif +#ifdef HAVE_LZMA + || lzma != NULL +#endif + ; + } + + + ~FileFdPrivate() { CloseDown(""); } +}; + /*}}}*/ // FileFd::Open - Open a file /*{{{*/ // --------------------------------------------------------------------- /* The most commonly used open mode combinations are given with Mode */ @@ -1147,28 +1166,21 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C void* (*compress_open)(int, const char *) = NULL; if (false) /* dummy so that the rest can be 'else if's */; -#define APT_COMPRESS_INIT(NAME,OPEN,CLOSE,STRUCT) \ +#define APT_COMPRESS_INIT(NAME,OPEN) \ else if (compressor.Name == NAME) \ { \ compress_open = (void*(*)(int, const char *)) OPEN; \ - if (d != NULL && STRUCT != NULL) { CLOSE(STRUCT); STRUCT = NULL; } \ + if (d != NULL) d->InternalClose(FileName); \ } #ifdef HAVE_ZLIB - APT_COMPRESS_INIT("gzip", gzdopen, gzclose, d->gz) + APT_COMPRESS_INIT("gzip", gzdopen) #endif #ifdef HAVE_BZ2 - APT_COMPRESS_INIT("bzip2", BZ2_bzdopen, BZ2_bzclose, d->bz2) + APT_COMPRESS_INIT("bzip2", BZ2_bzdopen) #endif #ifdef HAVE_LZMA - else if (compressor.Name == "xz" || compressor.Name == "lzma") - { - compress_open = (void*(*)(int, const char*)) fdopen; - if (d != NULL && d->lzma != NULL) - { - delete d->lzma; - d->lzma = NULL; - } - } + APT_COMPRESS_INIT("xz", fdopen) + APT_COMPRESS_INIT("lzma", fdopen) #endif #undef APT_COMPRESS_INIT #endif @@ -1617,14 +1629,7 @@ bool FileFd::Write(int Fd, const void *From, unsigned long long Size) /* */ bool FileFd::Seek(unsigned long long To) { - if (d != NULL && (d->pipe == true -#ifdef HAVE_BZ2 - || d->bz2 != NULL -#endif -#ifdef HAVE_LZMA - || d->lzma != NULL -#endif - )) + if (d != NULL && (d->pipe == true || d->InternalStream() == true)) { // Our poor man seeking in pipes is costly, so try to avoid it unsigned long long seekpos = Tell(); @@ -1635,22 +1640,7 @@ bool FileFd::Seek(unsigned long long To) if ((d->openmode & ReadOnly) != ReadOnly) return FileFdError("Reopen is only implemented for read-only files!"); - if (false) - /* dummy so that the rest can be 'else if's */; -#ifdef HAVE_BZ2 - else if (d->bz2 != NULL) - { - BZ2_bzclose(d->bz2); - d->bz2 = NULL; - } -#endif -#ifdef HAVE_LZMA - else if (d->lzma != NULL) - { - delete d->lzma; - d->lzma = NULL; - } -#endif + d->InternalClose(FileName); if (iFd != -1) close(iFd); iFd = -1; @@ -1696,14 +1686,7 @@ bool FileFd::Seek(unsigned long long To) /* */ bool FileFd::Skip(unsigned long long Over) { - if (d != NULL && (d->pipe == true -#ifdef HAVE_BZ2 - || d->bz2 != NULL -#endif -#ifdef HAVE_LZMA - || d->lzma != NULL -#endif - )) + if (d != NULL && (d->pipe == true || d->InternalStream() == true)) { d->seekpos += Over; char buffer[1024]; @@ -1741,17 +1724,11 @@ bool FileFd::Truncate(unsigned long long To) if (To == 0 && FileName == "/dev/null") return true; #if defined HAVE_ZLIB || defined HAVE_BZ2 || defined HAVE_LZMA - if (d != NULL && ( + if (d != NULL && (d->InternalStream() == true #ifdef HAVE_ZLIB - d->gz != NULL || -#endif -#ifdef HAVE_BZ2 - d->bz2 != NULL || + || d->gz != NULL #endif -#ifdef HAVE_LZMA - d->lzma != NULL || -#endif - false)) + )) return FileFdError("Truncating compressed files is not implemented (%s)", FileName.c_str()); #endif if (ftruncate(iFd,To) != 0) @@ -1769,14 +1746,7 @@ unsigned long long FileFd::Tell() // seeking around, but not all users of FileFd use always Seek() and co // so d->seekpos isn't always true and we can just use it as a hint if // we have nothing else, but not always as an authority… - if (d != NULL && (d->pipe == true -#ifdef HAVE_BZ2 - || d->bz2 != NULL -#endif -#ifdef HAVE_LZMA - || d->lzma != NULL -#endif - )) + if (d != NULL && (d->pipe == true || d->InternalStream() == true)) return d->seekpos; off_t Res; @@ -1851,14 +1821,7 @@ unsigned long long FileFd::Size() // for compressor pipes st_size is undefined and at 'best' zero, // so we 'read' the content and 'seek' back - see there - if (d != NULL && (d->pipe == true -#ifdef HAVE_BZ2 - || (d->bz2 && size > 0) -#endif -#ifdef HAVE_LZMA - || (d->lzma && size > 0) -#endif - )) + if (d != NULL && (d->pipe == true || (d->InternalStream() == true && size > 0))) { unsigned long long const oldSeek = Tell(); char ignore[1000]; -- cgit v1.2.3-70-g09d2 From f6ffe501d432d1299808ae307936877cf2c5f8ce Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 15 Mar 2014 17:59:47 +0100 Subject: Fix handling of autoclosing for compressed files (Closes: #741685) AutoClose is both an argument in OpenDescriptor() and an enum. In commit 84baaae93badc2da7c1f4f356456762895cef278 code using the AutoClose parameter was moved to OpenDescriptorInternal(). In that function, AutoClose meant the enum value, so the check was always false. --- apt-pkg/contrib/fileutl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 1eabf37f4..ba79720d8 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1191,7 +1191,7 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C d->openmode = Mode; d->compressor = compressor; #if defined HAVE_ZLIB || defined HAVE_BZ2 || defined HAVE_LZMA - if (AutoClose == false && compress_open != NULL) + if ((Flags & AutoClose) != AutoClose && compress_open != NULL) { // Need to duplicate fd here or gz/bz2 close for cleanup will close the fd as well int const internFd = dup(iFd); -- cgit v1.2.3-70-g09d2 From c4b113e650dbdbb4c5c9c6f36437c94db6b214d9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 21 Mar 2014 11:04:26 +0100 Subject: continue reading in xz even if it outputs nothing It can happen that content in our buffer is not enough to produce a meaningful output in which case no output is created by liblzma, but still reports that everything is okay and we should go on. The code assumes it has reached the end through if it encounters a null read, so this commit makes it so that it looks like this read was interrupted just like the lowlevel read() on uncompressed files could. It subsequently fixes the issue with that as well as until now our loop would still break even if we wanted it to continue on. (This bug triggers our usual "Hash sum mismatch" error) Reported-By: Stefan Lippers-Hollmann --- apt-pkg/contrib/fileutl.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index ba79720d8..69406a9bf 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1430,7 +1430,15 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual) errno = 0; } else + { Res = Size - d->lzma->stream.avail_out; + if (Res == 0) + { + // lzma run was okay, but produced no output… + Res = -1; + errno = EINTR; + } + } } #endif else @@ -1439,7 +1447,12 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual) if (Res < 0) { if (errno == EINTR) + { + // trick the while-loop into running again + Res = 1; + errno = 0; continue; + } if (false) /* dummy so that the rest can be 'else if's */; #ifdef HAVE_ZLIB -- cgit v1.2.3-70-g09d2 From 63ff42089863cda53aee240ea0124106e8b4d983 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 21 Mar 2014 15:54:15 +0100 Subject: enable fvisibility=hidden for our private library While it is a huge undertaking to enable it for our public libraries as basically everything we exported so far could be seen as public interface our private library is new and under our full control, so we can do whatever we like with it. The benefits are not that big in return of course, but it reduces the size a bit, so thats great nontheless. Git-Dch: ignore --- apt-pkg/contrib/macros.h | 4 ++++ apt-private/acqprogress.h | 9 +++++---- apt-private/makefile | 1 + apt-private/private-cachefile.h | 7 ++++--- apt-private/private-cmndline.h | 3 ++- apt-private/private-download.h | 6 ++++-- apt-private/private-install.h | 8 +++++--- apt-private/private-list.h | 4 +++- apt-private/private-main.h | 4 +++- apt-private/private-moo.h | 2 +- apt-private/private-output.h | 21 ++++++++++++--------- apt-private/private-search.h | 4 +++- apt-private/private-show.h | 4 +++- apt-private/private-sources.h | 4 +++- apt-private/private-update.h | 4 +++- apt-private/private-upgrade.h | 6 ++++-- apt-private/private-utils.h | 8 +++++--- 17 files changed, 65 insertions(+), 34 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h index d97053553..2d6448e5e 100644 --- a/apt-pkg/contrib/macros.h +++ b/apt-pkg/contrib/macros.h @@ -94,8 +94,12 @@ #if APT_GCC_VERSION >= 0x0400 #define APT_SENTINEL __attribute__((sentinel)) + #define APT_PUBLIC __attribute__ ((visibility ("default"))) + #define APT_HIDDEN __attribute__ ((visibility ("hidden"))) #else #define APT_SENTINEL + #define APT_PUBLIC + #define APT_HIDDEN #endif // cold functions are unlikely() to be called diff --git a/apt-private/acqprogress.h b/apt-private/acqprogress.h index e12dafe50..71a10d78a 100644 --- a/apt-private/acqprogress.h +++ b/apt-private/acqprogress.h @@ -10,18 +10,19 @@ #define ACQPROGRESS_H #include +#include #include -class AcqTextStatus : public pkgAcquireStatus +class APT_PUBLIC AcqTextStatus : public pkgAcquireStatus { unsigned int &ScreenWidth; char BlankLine[1024]; unsigned long ID; unsigned long Quiet; - + public: - + virtual bool MediaChange(std::string Media,std::string Drive); virtual void IMSHit(pkgAcquire::ItemDesc &Itm); virtual void Fetch(pkgAcquire::ItemDesc &Itm); @@ -29,7 +30,7 @@ class AcqTextStatus : public pkgAcquireStatus virtual void Fail(pkgAcquire::ItemDesc &Itm); virtual void Start(); virtual void Stop(); - + bool Pulse(pkgAcquire *Owner); AcqTextStatus(unsigned int &ScreenWidth,unsigned int const Quiet); diff --git a/apt-private/makefile b/apt-private/makefile index 728890b9b..09736c6d3 100644 --- a/apt-private/makefile +++ b/apt-private/makefile @@ -16,6 +16,7 @@ LIBRARY=apt-private MAJOR=0.0 MINOR=0 SLIBS=$(PTHREADLIB) -lapt-pkg +CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden PRIVATES=list install download output cachefile cacheset update upgrade cmndline moo search show main utils sources SOURCE += $(foreach private, $(PRIVATES), private-$(private).cc) diff --git a/apt-private/private-cachefile.h b/apt-private/private-cachefile.h index 67c5e8cdc..dce7e0a3a 100644 --- a/apt-private/private-cachefile.h +++ b/apt-private/private-cachefile.h @@ -5,16 +5,17 @@ #include #include #include +#include // class CacheFile - Cover class for some dependency cache functions /*{{{*/ // --------------------------------------------------------------------- /* */ -class CacheFile : public pkgCacheFile +class APT_PUBLIC CacheFile : public pkgCacheFile { static pkgCache *SortCache; - static int NameComp(const void *a,const void *b) APT_PURE; - + APT_HIDDEN static int NameComp(const void *a,const void *b) APT_PURE; + public: pkgCache::Package **List; diff --git a/apt-private/private-cmndline.h b/apt-private/private-cmndline.h index 76045ffe7..d0af16782 100644 --- a/apt-private/private-cmndline.h +++ b/apt-private/private-cmndline.h @@ -2,9 +2,10 @@ #define APT_PRIVATE_CMNDLINE_H #include +#include #include -std::vector getCommandArgs(char const * const Program, char const * const Cmd); +APT_PUBLIC std::vector getCommandArgs(char const * const Program, char const * const Cmd); #endif diff --git a/apt-private/private-download.h b/apt-private/private-download.h index 1447845ed..a108aa531 100644 --- a/apt-private/private-download.h +++ b/apt-private/private-download.h @@ -1,9 +1,11 @@ #ifndef APT_PRIVATE_DOWNLOAD_H #define APT_PRIVATE_DOWNLOAD_H +#include + class pkgAcquire; -bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser); -bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure); +APT_PUBLIC bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser); +APT_PUBLIC bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure); #endif diff --git a/apt-private/private-install.h b/apt-private/private-install.h index 79769d470..5e18560c5 100644 --- a/apt-private/private-install.h +++ b/apt-private/private-install.h @@ -9,6 +9,9 @@ #include #include #include +#include + +#include #include #include @@ -17,7 +20,6 @@ #include #include -#include "private-output.h" #include @@ -26,13 +28,13 @@ class CommandLine; #define RAMFS_MAGIC 0x858458f6 -bool DoInstall(CommandLine &Cmd); +APT_PUBLIC bool DoInstall(CommandLine &Cmd); bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache, std::map &verset); bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache); -bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, +APT_PUBLIC bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, bool Safety = true); diff --git a/apt-private/private-list.h b/apt-private/private-list.h index 749744dd1..461f527cb 100644 --- a/apt-private/private-list.h +++ b/apt-private/private-list.h @@ -1,9 +1,11 @@ #ifndef APT_PRIVATE_LIST_H #define APT_PRIVATE_LIST_H +#include + class CommandLine; -bool List(CommandLine &Cmd); +APT_PUBLIC bool List(CommandLine &Cmd); #endif diff --git a/apt-private/private-main.h b/apt-private/private-main.h index 257c51a0b..23d4aca68 100644 --- a/apt-private/private-main.h +++ b/apt-private/private-main.h @@ -1,8 +1,10 @@ #ifndef APT_PRIVATE_MAIN_H #define APT_PRIVATE_MAIN_H +#include + class CommandLine; -void CheckSimulateMode(CommandLine &CmdL); +APT_PUBLIC void CheckSimulateMode(CommandLine &CmdL); #endif diff --git a/apt-private/private-moo.h b/apt-private/private-moo.h index 7bfc5c1fc..b8e1cfed6 100644 --- a/apt-private/private-moo.h +++ b/apt-private/private-moo.h @@ -3,7 +3,7 @@ class CommandLine; -bool DoMoo(CommandLine &CmdL); +APT_PUBLIC bool DoMoo(CommandLine &CmdL); bool DoMoo1(CommandLine &CmdL); bool DoMoo2(CommandLine &CmdL); bool DoMoo3(CommandLine &CmdL); diff --git a/apt-private/private-output.h b/apt-private/private-output.h index 81643f90a..9633d0c37 100644 --- a/apt-private/private-output.h +++ b/apt-private/private-output.h @@ -2,6 +2,7 @@ #define APT_PRIVATE_OUTPUT_H #include +#include #include #include @@ -13,22 +14,24 @@ class pkgDepCache; class pkgRecords; -extern std::ostream c0out; -extern std::ostream c1out; -extern std::ostream c2out; -extern std::ofstream devnull; -extern unsigned int ScreenWidth; +APT_PUBLIC extern std::ostream c0out; +APT_PUBLIC extern std::ostream c1out; +APT_PUBLIC extern std::ostream c2out; +APT_PUBLIC extern std::ofstream devnull; +APT_PUBLIC extern unsigned int ScreenWidth; -bool InitOutput(); -void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, +APT_PUBLIC bool InitOutput(); + +void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, pkgCache::VerIterator V, std::ostream &out, bool include_summary=true); // helper to describe global state -bool ShowList(std::ostream &out, std::string Title, std::string List, +APT_PUBLIC void ShowBroken(std::ostream &out,CacheFile &Cache,bool Now); + +APT_PUBLIC bool ShowList(std::ostream &out, std::string Title, std::string List, std::string VersionsList); -void ShowBroken(std::ostream &out,CacheFile &Cache,bool Now); void ShowNew(std::ostream &out,CacheFile &Cache); void ShowDel(std::ostream &out,CacheFile &Cache); void ShowKept(std::ostream &out,CacheFile &Cache); diff --git a/apt-private/private-search.h b/apt-private/private-search.h index 539915f1f..d4786233a 100644 --- a/apt-private/private-search.h +++ b/apt-private/private-search.h @@ -1,9 +1,11 @@ #ifndef APT_PRIVATE_SEARCH_H #define APT_PRIVATE_SEARCH_H +#include + class CommandLine; -bool FullTextSearch(CommandLine &CmdL); +APT_PUBLIC bool FullTextSearch(CommandLine &CmdL); #endif diff --git a/apt-private/private-show.h b/apt-private/private-show.h index a15367e28..359aeeb28 100644 --- a/apt-private/private-show.h +++ b/apt-private/private-show.h @@ -1,12 +1,14 @@ #ifndef APT_PRIVATE_SHOW_H #define APT_PRIVATE_SHOW_H +#include + class CommandLine; namespace APT { namespace Cmd { - bool ShowPackage(CommandLine &CmdL); + APT_PUBLIC bool ShowPackage(CommandLine &CmdL); } } #endif diff --git a/apt-private/private-sources.h b/apt-private/private-sources.h index 4c58af180..0c421902e 100644 --- a/apt-private/private-sources.h +++ b/apt-private/private-sources.h @@ -1,8 +1,10 @@ #ifndef APT_PRIVATE_SOURCES_H #define APT_PRIVATE_SOURCES_H +#include + class CommandLine; -bool EditSources(CommandLine &CmdL); +APT_PUBLIC bool EditSources(CommandLine &CmdL); #endif diff --git a/apt-private/private-update.h b/apt-private/private-update.h index d3d0b7af9..e584f70cf 100644 --- a/apt-private/private-update.h +++ b/apt-private/private-update.h @@ -1,8 +1,10 @@ #ifndef APT_PRIVATE_UPDATE_H #define APT_PRIVATE_UPDATE_H +#include + class CommandLine; -bool DoUpdate(CommandLine &CmdL); +APT_PUBLIC bool DoUpdate(CommandLine &CmdL); #endif diff --git a/apt-private/private-upgrade.h b/apt-private/private-upgrade.h index 64c4c0874..16bb93c9b 100644 --- a/apt-private/private-upgrade.h +++ b/apt-private/private-upgrade.h @@ -1,10 +1,12 @@ #ifndef APTPRIVATE_PRIVATE_UPGRADE_H #define APTPRIVATE_PRIVATE_UPGRADE_H +#include + class CommandLine; -bool DoDistUpgrade(CommandLine &CmdL); -bool DoUpgrade(CommandLine &CmdL); +APT_PUBLIC bool DoDistUpgrade(CommandLine &CmdL); +APT_PUBLIC bool DoUpgrade(CommandLine &CmdL); bool DoUpgradeNoNewPackages(CommandLine &CmdL); bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL); diff --git a/apt-private/private-utils.h b/apt-private/private-utils.h index 4bb535e86..432699787 100644 --- a/apt-private/private-utils.h +++ b/apt-private/private-utils.h @@ -1,9 +1,11 @@ #ifndef APT_PRIVATE_UTILS_H #define APT_PRIVATE_UTILS_H -#include +#include -void DisplayFileInPager(std::string filename); -void EditFileInSensibleEditor(std::string filename); +#include + +APT_PUBLIC void DisplayFileInPager(std::string filename); +APT_PUBLIC void EditFileInSensibleEditor(std::string filename); #endif -- cgit v1.2.3-70-g09d2 From ce62f1def6565375ce9c56eb1237ccdc0ca138ba Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 21 Mar 2014 16:26:01 +0100 Subject: mark optional (private) symbols as hidden This methods should not be used by anyone expect the library itself as they are helpers for the specific class and therefore perfect candidates for hidding. Git-Dch: Ignore --- apt-pkg/acquire-method.h | 4 ++- apt-pkg/cdrom.h | 4 ++- apt-pkg/contrib/fileutl.h | 6 ++--- apt-pkg/deb/deblistparser.h | 3 ++- apt-pkg/edsp.h | 11 ++++---- apt-pkg/pkgcachegen.h | 18 ++++++------- apt-pkg/tagfile.h | 8 +++--- debian/libapt-pkg4.12.symbols | 59 ++++++++++++++----------------------------- 8 files changed, 50 insertions(+), 63 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/acquire-method.h b/apt-pkg/acquire-method.h index f0f2a537a..221ccf273 100644 --- a/apt-pkg/acquire-method.h +++ b/apt-pkg/acquire-method.h @@ -20,6 +20,8 @@ #ifndef PKGLIB_ACQUIRE_METHOD_H #define PKGLIB_ACQUIRE_METHOD_H +#include + #include #include @@ -107,7 +109,7 @@ class pkgAcqMethod virtual ~pkgAcqMethod() {}; private: - void Dequeue(); + APT_HIDDEN void Dequeue(); }; /** @} */ diff --git a/apt-pkg/cdrom.h b/apt-pkg/cdrom.h index 0ed4a6a73..0f2c2cd02 100644 --- a/apt-pkg/cdrom.h +++ b/apt-pkg/cdrom.h @@ -1,6 +1,8 @@ #ifndef PKGLIB_CDROM_H #define PKGLIB_CDROM_H +#include + #include #include @@ -73,7 +75,7 @@ class pkgCdrom /*{{{*/ bool Add(pkgCdromStatus *log); private: - bool MountAndIdentCDROM(Configuration &Database, std::string &CDROM, + APT_HIDDEN bool MountAndIdentCDROM(Configuration &Database, std::string &CDROM, std::string &ident, pkgCdromStatus * const log, bool const interactive); }; /*}}}*/ diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index 278a25742..f25ed3622 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -150,11 +150,11 @@ class FileFd private: FileFdPrivate* d; - bool OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor); + APT_HIDDEN bool OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor); // private helpers to set Fail flag and call _error->Error - bool FileFdErrno(const char* Function, const char* Description,...) APT_PRINTF(3) APT_COLD; - bool FileFdError(const char* Description,...) APT_PRINTF(2) APT_COLD; + APT_HIDDEN bool FileFdErrno(const char* Function, const char* Description,...) APT_PRINTF(3) APT_COLD; + APT_HIDDEN bool FileFdError(const char* Description,...) APT_PRINTF(2) APT_COLD; }; bool RunScripts(const char *Cnf); diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 286244cc9..baace79fe 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -102,7 +103,7 @@ class debListParser : public pkgCacheGenerator::ListParser virtual ~debListParser() {}; private: - unsigned char ParseMultiArch(bool const showErrors); + APT_HIDDEN unsigned char ParseMultiArch(bool const showErrors); }; #endif diff --git a/apt-pkg/edsp.h b/apt-pkg/edsp.h index ae20ed7db..f3092d3c6 100644 --- a/apt-pkg/edsp.h +++ b/apt-pkg/edsp.h @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -32,15 +33,15 @@ class EDSP /*{{{*/ static const char * const PrioMap[]; static const char * const DepMap[]; - bool static ReadLine(int const input, std::string &line); - bool static StringToBool(char const *answer, bool const defValue); + APT_HIDDEN bool static ReadLine(int const input, std::string &line); + APT_HIDDEN bool static StringToBool(char const *answer, bool const defValue); - void static WriteScenarioVersion(pkgDepCache &Cache, FILE* output, + APT_HIDDEN void static WriteScenarioVersion(pkgDepCache &Cache, FILE* output, pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver); - void static WriteScenarioDependency(FILE* output, + APT_HIDDEN void static WriteScenarioDependency(FILE* output, pkgCache::VerIterator const &Ver); - void static WriteScenarioLimitedDependency(FILE* output, + APT_HIDDEN void static WriteScenarioLimitedDependency(FILE* output, pkgCache::VerIterator const &Ver, APT::PackageSet const &pkgset); public: diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index 5994dab9f..1e1a71026 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -38,10 +38,10 @@ class pkgCacheGenerator /*{{{*/ private: pkgCache::StringItem *UniqHash[26]; - map_ptrloc WriteStringInMap(std::string const &String) { return WriteStringInMap(String.c_str()); }; - map_ptrloc WriteStringInMap(const char *String); - map_ptrloc WriteStringInMap(const char *String, const unsigned long &Len); - map_ptrloc AllocateInMap(const unsigned long &size); + APT_HIDDEN map_ptrloc WriteStringInMap(std::string const &String) { return WriteStringInMap(String.c_str()); }; + APT_HIDDEN map_ptrloc WriteStringInMap(const char *String); + APT_HIDDEN map_ptrloc WriteStringInMap(const char *String, const unsigned long &Len); + APT_HIDDEN map_ptrloc AllocateInMap(const unsigned long &size); public: @@ -117,14 +117,14 @@ class pkgCacheGenerator /*{{{*/ ~pkgCacheGenerator(); private: - bool MergeListGroup(ListParser &List, std::string const &GrpName); - bool MergeListPackage(ListParser &List, pkgCache::PkgIterator &Pkg); - bool MergeListVersion(ListParser &List, pkgCache::PkgIterator &Pkg, + APT_HIDDEN bool MergeListGroup(ListParser &List, std::string const &GrpName); + APT_HIDDEN bool MergeListPackage(ListParser &List, pkgCache::PkgIterator &Pkg); + APT_HIDDEN bool MergeListVersion(ListParser &List, pkgCache::PkgIterator &Pkg, std::string const &Version, pkgCache::VerIterator* &OutVer); - bool AddImplicitDepends(pkgCache::GrpIterator &G, pkgCache::PkgIterator &P, + APT_HIDDEN bool AddImplicitDepends(pkgCache::GrpIterator &G, pkgCache::PkgIterator &P, pkgCache::VerIterator &V); - bool AddImplicitDepends(pkgCache::VerIterator &V, pkgCache::PkgIterator &D); + APT_HIDDEN bool AddImplicitDepends(pkgCache::VerIterator &V, pkgCache::PkgIterator &D); }; /*}}}*/ // This is the abstract package list parser class. /*{{{*/ diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h index 2f600d397..d5b62e76d 100644 --- a/apt-pkg/tagfile.h +++ b/apt-pkg/tagfile.h @@ -20,6 +20,8 @@ #ifndef PKGLIB_TAGFILE_H #define PKGLIB_TAGFILE_H +#include + #include #include @@ -93,9 +95,9 @@ class pkgTagFile { pkgTagFilePrivate *d; - bool Fill(); - bool Resize(); - bool Resize(unsigned long long const newSize); + APT_HIDDEN bool Fill(); + APT_HIDDEN bool Resize(); + APT_HIDDEN bool Resize(unsigned long long const newSize); public: diff --git a/debian/libapt-pkg4.12.symbols b/debian/libapt-pkg4.12.symbols index c1747bc9e..b6c2f75b0 100644 --- a/debian/libapt-pkg4.12.symbols +++ b/debian/libapt-pkg4.12.symbols @@ -184,9 +184,7 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"pkgRecords::Parser::~Parser()@Base" 0.8.0 (c++)"pkgRecords::pkgRecords(pkgCache&)@Base" 0.8.0 (c++)"pkgRecords::~pkgRecords()@Base" 0.8.0 - (c++)"pkgTagFile::Fill()@Base" 0.8.0 (c++)"pkgTagFile::Step(pkgTagSection&)@Base" 0.8.0 - (c++)"pkgTagFile::Resize()@Base" 0.8.0 (c++)"pkgTagFile::~pkgTagFile()@Base" 0.8.0 (c++)"CdromDevice::~CdromDevice()@Base" 0.8.0 (c++)"CommandLine::DispatchArg(CommandLine::Dispatch*, bool)@Base" 0.8.0 @@ -517,11 +515,8 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"pkgCacheGenerator::SelectFile(std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&, pkgIndexFile const&, unsigned long)@Base" 0.8.0 (c++)"pkgCacheGenerator::FinishCache(OpProgress*)@Base" 0.8.0 (c++)"pkgCacheGenerator::NewFileDesc(pkgCache::DescIterator&, pkgCacheGenerator::ListParser&)@Base" 0.8.0 - (c++)"pkgCacheGenerator::AllocateInMap(unsigned long const&)@Base" 0.8.0 (c++)"pkgCacheGenerator::MakeStatusCache(pkgSourceList&, OpProgress*, MMap**, bool)@Base" 0.8.0 (c++)"pkgCacheGenerator::WriteUniqString(char const*, unsigned int)@Base" 0.8.0 - (c++)"pkgCacheGenerator::WriteStringInMap(char const*)@Base" 0.8.0 - (c++)"pkgCacheGenerator::WriteStringInMap(char const*, unsigned long const&)@Base" 0.8.0 (c++)"pkgCacheGenerator::CreateDynamicMMap(FileFd*, unsigned long)@Base" 0.8.0 (c++)"pkgCacheGenerator::MergeFileProvides(pkgCacheGenerator::ListParser&)@Base" 0.8.0 (c++)"pkgCacheGenerator::MakeOnlyStatusCache(OpProgress*, DynamicMMap**)@Base" 0.8.0 @@ -1126,24 +1121,24 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (arch=sh4|c++)"pkgAcqMethod::PrintStatus(char const*, char const*, __builtin_va_list&) const@Base" 0.8.15~exp1 (arch=alpha|c++)"pkgAcqMethod::PrintStatus(char const*, char const*, __va_list_tag&) const@Base" 0.8.15~exp1 ### architecture specific: va_list & size_t - (arch=i386 hurd-i386 kfreebsd-i386|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, char*&, unsigned int&)@Base" 0.8.11.4 - (arch=armel armhf|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, std::__va_list&, unsigned int&)@Base" 0.8.11.4 - (arch=alpha|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, __va_list_tag&, unsigned long&)@Base" 0.8.11.4 - (arch=powerpc powerpcspe x32|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, __va_list_tag (&) [1], unsigned int&)@Base" 0.8.11.4 - (arch=amd64 kfreebsd-amd64 s390 s390x|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, __va_list_tag (&) [1], unsigned long&)@Base" 0.8.11.4 - (arch=hppa mips mipsel sparc|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, void*&, unsigned int&)@Base" 0.8.11.4 - (arch=ia64 sparc64|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, void*&, unsigned long&)@Base" 0.8.11.4 - (arch=sh4|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, __builtin_va_list&, unsigned int&)@Base" 0.8.11.4 - (arch=ppc64|c++|optional=private)"GlobalError::Insert(GlobalError::MsgType, char const*, char*&, unsigned long&)@Base" 0.8.11.4 - (arch=i386 hurd-i386 kfreebsd-i386|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, char*&, int, unsigned int&)@Base" 0.8.11.4 - (arch=armel armhf|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, std::__va_list&, int, unsigned int&)@Base" 0.8.11.4 - (arch=alpha|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, __va_list_tag&, int, unsigned long&)@Base" 0.8.11.4 - (arch=powerpc powerpcspe x32|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, __va_list_tag (&) [1], int, unsigned int&)@Base" 0.8.11.4 - (arch=amd64 kfreebsd-amd64 s390 s390x|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, __va_list_tag (&) [1], int, unsigned long&)@Base" 0.8.11.4 - (arch=hppa mips mipsel sparc|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, void*&, int, unsigned int&)@Base" 0.8.11.4 - (arch=ia64 sparc64|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, void*&, int, unsigned long&)@Base" 0.8.11.4 1 - (arch=sh4|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, __builtin_va_list&, int, unsigned int&)@Base" 0.8.11.4 - (arch=ppc64|c++|optional=private)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, char*&, int, unsigned long&)@Base" 0.8.11.4 + (arch=i386 hurd-i386 kfreebsd-i386|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, char*&, unsigned int&)@Base" 0.8.11.4 + (arch=armel armhf|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, std::__va_list&, unsigned int&)@Base" 0.8.11.4 + (arch=alpha|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, __va_list_tag&, unsigned long&)@Base" 0.8.11.4 + (arch=powerpc powerpcspe x32|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, __va_list_tag (&) [1], unsigned int&)@Base" 0.8.11.4 + (arch=amd64 kfreebsd-amd64 s390 s390x|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, __va_list_tag (&) [1], unsigned long&)@Base" 0.8.11.4 + (arch=hppa mips mipsel sparc|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, void*&, unsigned int&)@Base" 0.8.11.4 + (arch=ia64 sparc64|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, void*&, unsigned long&)@Base" 0.8.11.4 + (arch=sh4|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, __builtin_va_list&, unsigned int&)@Base" 0.8.11.4 + (arch=ppc64|c++)"GlobalError::Insert(GlobalError::MsgType, char const*, char*&, unsigned long&)@Base" 0.8.11.4 + (arch=i386 hurd-i386 kfreebsd-i386|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, char*&, int, unsigned int&)@Base" 0.8.11.4 + (arch=armel armhf|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, std::__va_list&, int, unsigned int&)@Base" 0.8.11.4 + (arch=alpha|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, __va_list_tag&, int, unsigned long&)@Base" 0.8.11.4 + (arch=powerpc powerpcspe x32|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, __va_list_tag (&) [1], int, unsigned int&)@Base" 0.8.11.4 + (arch=amd64 kfreebsd-amd64 s390 s390x|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, __va_list_tag (&) [1], int, unsigned long&)@Base" 0.8.11.4 + (arch=hppa mips mipsel sparc|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, void*&, int, unsigned int&)@Base" 0.8.11.4 + (arch=ia64 sparc64|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, void*&, int, unsigned long&)@Base" 0.8.11.4 1 + (arch=sh4|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, __builtin_va_list&, int, unsigned int&)@Base" 0.8.11.4 + (arch=ppc64|c++)"GlobalError::InsertErrno(GlobalError::MsgType, char const*, char const*, char*&, int, unsigned long&)@Base" 0.8.11.4 ### architecture specific: size_t (arch=i386 armel armhf hppa hurd-i386 kfreebsd-i386 mips mipsel powerpc powerpcspe sh4 sparc x32|c++)"_strtabexpand(char*, unsigned int)@Base" 0.8.0 (arch=alpha amd64 ia64 kfreebsd-amd64 s390 s390x sparc64 ppc64|c++)"_strtabexpand(char*, unsigned long)@Base" 0.8.0 @@ -1196,7 +1191,7 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"APT::Configuration::getCompressorExtensions()@Base" 0.8.12 (c++)"APT::Configuration::setDefaultConfigurationForCompressors()@Base" 0.8.12 (c++)"pkgAcqMetaClearSig::Custom600Headers()@Base" 0.8.13 - (c++|optional=private)"debListParser::NewProvidesAllArch(pkgCache::VerIterator&, std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&)@Base" 0.8.13.2 + (c++)"debListParser::NewProvidesAllArch(pkgCache::VerIterator&, std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&)@Base" 0.8.13.2 (c++)"pkgDepCache::IsModeChangeOk(pkgDepCache::ModeList, pkgCache::PkgIterator const&, unsigned long, bool)@Base" 0.8.13.2 (c++)"pkgCache::DepIterator::IsNegative() const@Base" 0.8.15~exp1 (c++)"Configuration::CndSet(char const*, int)@Base" 0.8.15.3 @@ -1237,18 +1232,14 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"EDSP::ReadRequest(int, std::list, std::allocator >, std::allocator, std::allocator > > >&, std::list, std::allocator >, std::allocator, std::allocator > > >&, bool&, bool&, bool&)@Base" 0.8.16~exp2 (c++)"EDSP::ApplyRequest(std::list, std::allocator >, std::allocator, std::allocator > > > const&, std::list, std::allocator >, std::allocator, std::allocator > > > const&, pkgDepCache&)@Base" 0.8.16~exp2 (c++)"EDSP::ReadResponse(int, pkgDepCache&, OpProgress*)@Base" 0.8.16~exp2 - (c++)"EDSP::StringToBool(char const*, bool)@Base" 0.8.16~exp2 (c++)"EDSP::WriteRequest(pkgDepCache&, _IO_FILE*, bool, bool, bool, OpProgress*)@Base" 0.8.16~exp2 (c++)"EDSP::ExecuteSolver(char const*, int*, int*)@Base" 0.8.16~exp2 (c++)"EDSP::WriteProgress(unsigned short, char const*, _IO_FILE*)@Base" 0.8.16~exp2 (c++)"EDSP::WriteScenario(pkgDepCache&, _IO_FILE*, OpProgress*)@Base" 0.8.16~exp2 (c++)"EDSP::WriteSolution(pkgDepCache&, _IO_FILE*)@Base" 0.8.16~exp2 (c++)"EDSP::ResolveExternal(char const*, pkgDepCache&, bool, bool, bool, OpProgress*)@Base" 0.8.16~exp2 - (c++)"EDSP::WriteScenarioVersion(pkgDepCache&, _IO_FILE*, pkgCache::PkgIterator const&, pkgCache::VerIterator const&)@Base" 0.8.16~exp2 - (c++)"EDSP::WriteScenarioDependency(pkgDepCache&, _IO_FILE*, pkgCache::PkgIterator const&, pkgCache::VerIterator const&)@Base" 0.8.16~exp2 (c++)"EDSP::DepMap@Base" 0.8.16~exp2 (c++)"EDSP::PrioMap@Base" 0.8.16~exp2 - (c++)"EDSP::ReadLine(int, std::basic_string, std::allocator >&)@Base" 0.8.16~exp2 (c++)"pkgDepCache::Policy::GetPriority(pkgCache::PkgIterator const&)@Base" 0.8.16~exp6 (c++)"pkgDepCache::Policy::GetPriority(pkgCache::PkgFileIterator const&)@Base" 0.8.16~exp6 (c++)"typeinfo for edspIFType@Base" 0.8.16~exp2 @@ -1385,7 +1376,6 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"SummationImplementation::AddFD(FileFd&, unsigned long long)@Base" 0.8.16~exp9 (c++)"Hashes::AddFD(FileFd&, unsigned long long, bool, bool, bool, bool)@Base" 0.8.16~exp9 (c++|optional=deprecated,previous-inline)"FileFd::gzFd()@Base" 0.8.0 - (c++|optional=private)"FileFd::OpenInternDescriptor(unsigned int, APT::Configuration::Compressor const&)@Base" 0.8.16~exp9 ### CacheSet rework: making them real containers breaks bigtime the API (for the CacheSetHelper) (c++)"APT::PackageContainer, std::allocator > >::const_iterator::getPkg() const@Base" 0.8.16~exp9 (c++)"APT::PackageContainer, std::allocator > >::getConstructor() const@Base" 0.8.16~exp9 @@ -1425,7 +1415,6 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"APT::VersionContainerInterface::getInstalledVer(pkgCacheFile&, pkgCache::PkgIterator const&, APT::CacheSetHelper&)@Base" 0.8.16~exp9 (c++)"APT::VersionContainerInterface::FromModifierCommandLine(unsigned short&, APT::VersionContainerInterface*, pkgCacheFile&, char const*, std::list > const&, APT::CacheSetHelper&)@Base" 0.8.16~exp9 (c++)"EDSP::WriteLimitedScenario(pkgDepCache&, _IO_FILE*, APT::PackageContainer, std::allocator > > const&, OpProgress*)@Base" 0.8.16~exp9 - (c++)"EDSP::WriteScenarioLimitedDependency(pkgDepCache&, _IO_FILE*, pkgCache::PkgIterator const&, pkgCache::VerIterator const&, APT::PackageContainer, std::allocator > > const&)@Base" 0.8.16~exp9 (c++)"typeinfo for APT::PackageContainer, std::allocator > >::const_iterator@Base" 0.8.16~exp9 (c++)"typeinfo for APT::PackageContainer, std::allocator > >@Base" 0.8.16~exp9 (c++)"typeinfo for APT::PackageContainer > >::const_iterator@Base" 0.8.16~exp9 @@ -1537,11 +1526,6 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"pkgCache::DepIterator::IsIgnorable(pkgCache::PkgIterator const&) const@Base" 0.8.16~exp10 (c++)"pkgCache::DepIterator::IsIgnorable(pkgCache::PrvIterator const&) const@Base" 0.8.16~exp10 (c++)"FileFd::Write(int, void const*, unsigned long long)@Base" 0.8.16~exp14 - (c++|optional=private)"pkgCacheGenerator::MergeListGroup(pkgCacheGenerator::ListParser&, std::basic_string, std::allocator > const&)@Base" 0.8.16~exp7 - (c++|optional=private)"pkgCacheGenerator::MergeListPackage(pkgCacheGenerator::ListParser&, pkgCache::PkgIterator&)@Base" 0.8.16~exp7 - (c++|optional=private)"pkgCacheGenerator::MergeListVersion(pkgCacheGenerator::ListParser&, pkgCache::PkgIterator&, std::basic_string, std::allocator > const&, pkgCache::VerIterator*&)@Base" 0.8.16~exp7 - (c++|optional=private)"pkgCacheGenerator::AddImplicitDepends(pkgCache::GrpIterator&, pkgCache::PkgIterator&, pkgCache::VerIterator&)@Base" 0.8.16~exp7 - (c++|optional=private)"pkgCacheGenerator::AddImplicitDepends(pkgCache::VerIterator&, pkgCache::PkgIterator&)@Base" 0.8.16~exp7 (c++)"pkgTagSection::Exists(char const*)@Base" 0.9.7.9~exp1 (c++)"_strrstrip(char*)@Base" 0.9.7.9~exp2 (c++)"SplitClearSignedFile(std::basic_string, std::allocator > const&, FileFd*, std::vector, std::allocator >, std::allocator, std::allocator > > >*, FileFd*)@Base" 0.9.7.9~exp2 @@ -1550,7 +1534,6 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"SigVerify::RunGPGV(std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&, int const&)@Base" 0.9.7.9~exp2 (c++)"Configuration::Dump(std::basic_ostream >&, char const*, char const*, bool)@Base" 0.9.3 (c++)"AcquireUpdate(pkgAcquire&, int, bool, bool)@Base" 0.9.3 - (c++|optional=private)"pkgAcqMethod::Dequeue()@Base" 0.9.4 (c++)"pkgCache::DepIterator::IsMultiArchImplicit() const@Base" 0.9.6 (c++)"pkgCache::PrvIterator::IsMultiArchImplicit() const@Base" 0.9.6 (c++)"APT::PackageContainerInterface::FromGroup(APT::PackageContainerInterface*, pkgCacheFile&, std::basic_string, std::allocator >, APT::CacheSetHelper&)@Base" 0.9.7 @@ -1565,8 +1548,6 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"pkgCache::DepIterator::IsSatisfied(pkgCache::VerIterator const&) const@Base" 0.9.8 (c++)"pkgCacheGenerator::NewDepends(pkgCache::PkgIterator&, pkgCache::VerIterator&, unsigned int, unsigned int const&, unsigned int const&, unsigned int*&)@Base" 0.9.8 (c++)"pkgCacheGenerator::NewVersion(pkgCache::VerIterator&, std::basic_string, std::allocator > const&, unsigned int, unsigned long, unsigned long)@Base" 0.9.8 - (c++)"FileFd::FileFdErrno(char const*, char const*, ...)@Base" 0.9.9 - (c++)"FileFd::FileFdError(char const*, ...)@Base" 0.9.9 (c++)"operator<<(std::basic_ostream >&, GlobalError::Item)@Base" 0.9.9 (c++)"pkgDepCache::IsDeleteOkProtectInstallRequests(pkgCache::PkgIterator const&, bool, unsigned long, bool)@Base" 0.9.9.1 (c++)"pkgDepCache::IsInstallOkMultiArchSameVersionSynced(pkgCache::PkgIterator const&, bool, unsigned long, bool)@Base" 0.9.9.1 @@ -1579,7 +1560,6 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"APT::CacheFilter::PackageNameMatchesFnmatch::operator()(pkgCache::GrpIterator const&)@Base" 0.9.11 (c++)"APT::CacheFilter::PackageNameMatchesFnmatch::operator()(pkgCache::PkgIterator const&)@Base" 0.9.11 (c++)"APT::PackageContainerInterface::FromFnmatch(APT::PackageContainerInterface*, pkgCacheFile&, std::basic_string, std::allocator >, APT::CacheSetHelper&)@Base" 0.9.11 - (c++|optional=private)"pkgTagFile::Resize(unsigned long long)@Base" 0.9.11 (c++)"pkgTagSection::pkgTagSection()@Base" 0.9.11 (c++)"strv_length(char const**)@Base" 0.9.11 (c++)"StringSplit(std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&, unsigned int)@Base" 0.9.11.3 @@ -1591,7 +1571,6 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"HashString::GetHashForFile(std::basic_string, std::allocator >) const@Base" 0.9.13.1 (c++)"indexRecords::GetSuite() const@Base" 0.9.13.2 (c++)"GetTempDir()@Base" 0.9.14.2 - (c++|optional=private)"pkgCdrom::MountAndIdentCDROM(Configuration&, std::basic_string, std::allocator >&, std::basic_string, std::allocator >&, pkgCdromStatus*)@Base" 0.9.15.2 ### demangle strangeness - buildd report it as MISSING and as new… (c++)"pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire*, std::basic_string, std::allocator >, std::basic_string, std::allocator >, std::basic_string, std::allocator >, std::basic_string, std::allocator >, std::basic_string, std::allocator >, std::basic_string, std::allocator >, std::vector > const*, indexRecords*)@Base" 0.8.0 ### gcc-4.6 artefacts -- cgit v1.2.3-70-g09d2 From e5b7e019232f89a97e8ba3cbffa295595daa0351 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 1 Apr 2014 11:30:00 +0200 Subject: Add new Debug::RunScripts option This debug option will display all scripts that are run by apts RunScripts and RunScriptsWithPkgs helpers. --- apt-pkg/contrib/fileutl.cc | 6 +++++- apt-pkg/deb/dpkgpm.cc | 4 ++++ doc/apt.conf.5.xml | 12 ++++++++++++ doc/examples/configure-index | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 69406a9bf..188bb87ee 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -104,7 +104,11 @@ bool RunScripts(const char *Cnf) { if (Opts->Value.empty() == true) continue; - + + if(_config->FindB("Debug::RunScripts", false) == true) + std::clog << "Running external script: '" + << Opts->Value << "'" << std::endl; + if (system(Opts->Value.c_str()) != 0) _exit(100+Count); } diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 5a5fff13b..e68c2ca34 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -410,6 +410,10 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf) if (Opts->Value.empty() == true) continue; + if(_config->FindB("Debug::RunScripts", false) == true) + std::clog << "Running external script with list of all .deb file: '" + << Opts->Value << "'" << std::endl; + // Determine the protocol version string OptSec = Opts->Value; string::size_type Pos; diff --git a/doc/apt.conf.5.xml b/doc/apt.conf.5.xml index 78f6a27a2..fcbf20dac 100644 --- a/doc/apt.conf.5.xml +++ b/doc/apt.conf.5.xml @@ -1184,6 +1184,18 @@ DPkg::TriggersPending "true"; + + + + + Display the external commands that are called by apt hooks. + This includes e.g. the config options + DPkg::{Pre,Post}-Invoke or + APT::Update::{Pre,Post}-Invoke. + + + +