From 2b4cead3c8eb3afb5aa5390b88c511477a7628d8 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 9 Mar 2015 15:54:39 +0100 Subject: fix some new compiler warnings reported by gcc-5 Git-Dch: Ignore --- apt-pkg/cacheset.cc | 4 ++-- apt-pkg/cacheset.h | 4 +++- apt-pkg/cdrom.cc | 10 +++++----- apt-pkg/contrib/configuration.cc | 10 +++++----- apt-pkg/deb/debmetaindex.cc | 9 ++++++--- apt-pkg/sourcelist.cc | 2 +- 6 files changed, 22 insertions(+), 17 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc index 9127a4064..0ad99713a 100644 --- a/apt-pkg/cacheset.cc +++ b/apt-pkg/cacheset.cc @@ -754,7 +754,7 @@ pkgCache::VerIterator CacheSetHelper::canNotGetCandInstVer(pkgCacheFile &Cache, /*}}}*/ /*}}}*/ // showPackageSelection - by selector and given pattern /*{{{*/ -APT_CONST void CacheSetHelper::showPackageSelection(pkgCache::PkgIterator const &pkg, enum PkgSelector const select, +void CacheSetHelper::showPackageSelection(pkgCache::PkgIterator const &pkg, enum PkgSelector const select, std::string const &pattern) { switch (select) { APT_IGNORE_DEPRECATED_PUSH @@ -784,7 +784,7 @@ APT_CONST void CacheSetHelper::showFnmatchSelection(pkgCache::PkgIterator const /*}}}*/ /*}}}*/ // showVersionSelection /*{{{*/ -APT_CONST void CacheSetHelper::showVersionSelection(pkgCache::PkgIterator const &Pkg, +void CacheSetHelper::showVersionSelection(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver, enum VerSelector const select, std::string const &pattern) { switch (select) { APT_IGNORE_DEPRECATED_PUSH diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h index 884e8b859..97aee8c2d 100644 --- a/apt-pkg/cacheset.h +++ b/apt-pkg/cacheset.h @@ -225,7 +225,9 @@ public: inline std::string FullName(bool const Pretty) const { return getPkg().FullName(Pretty); } inline std::string FullName() const { return getPkg().FullName(); } APT_DEPRECATED inline const char *Section() const { - APT_IGNORE_DEPRECATED(return getPkg().Section();) + APT_IGNORE_DEPRECATED_PUSH + return getPkg().Section(); + APT_IGNORE_DEPRECATED_POP } inline bool Purge() const {return getPkg().Purge(); } inline const char *Arch() const {return getPkg().Arch(); } diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index aaa7b82e0..5eccbe5de 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -466,7 +466,7 @@ bool pkgCdrom::WriteSourceList(string Name,vector &List,bool Source) // Open the stream for reading ifstream F((FileExists(File)?File.c_str():"/dev/null"), ios::in ); - if (!F != 0) + if (F.fail() == true) return _error->Errno("ifstream::ifstream","Opening %s",File.c_str()); string NewFile = File + ".new"; @@ -477,7 +477,7 @@ bool pkgCdrom::WriteSourceList(string Name,vector &List,bool Source) "Failed to open %s.new",File.c_str()); // Create a short uri without the path - string ShortURI = "cdrom:[" + Name + "]/"; + string ShortURI = "cdrom:[" + Name + "]/"; string ShortURI2 = "cdrom:" + Name + "/"; // For Compatibility string Type; @@ -485,12 +485,12 @@ bool pkgCdrom::WriteSourceList(string Name,vector &List,bool Source) Type = "deb-src"; else Type = "deb"; - + char Buffer[300]; int CurLine = 0; bool First = true; while (F.eof() == false) - { + { F.getline(Buffer,sizeof(Buffer)); CurLine++; if (F.fail() && !F.eof()) @@ -754,7 +754,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/ FileExists(InfoDir + "/info") == true) { ifstream F((InfoDir + "/info").c_str()); - if (!F == 0) + if (F.good() == true) getline(F,Name); if (Name.empty() == false) diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 483d5bb1b..42e35d32a 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -629,19 +629,19 @@ string Configuration::Item::FullTag(const Item *Stop) const tag/value. AsSectional enables Sectional parsing.*/ bool ReadConfigFile(Configuration &Conf,const string &FName,bool const &AsSectional, unsigned const &Depth) -{ +{ // Open the stream for reading - ifstream F(FName.c_str(),ios::in); - if (!F != 0) + ifstream F(FName.c_str(),ios::in); + if (F.fail() == true) return _error->Errno("ifstream::ifstream",_("Opening configuration file %s"),FName.c_str()); string LineBuffer; string Stack[100]; unsigned int StackPos = 0; - + // Parser state string ParentTag; - + int CurLine = 0; bool InComment = false; while (F.eof() == false) diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 81e067424..aa2db8149 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -402,9 +402,12 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type { // parse arch=, arch+= and arch-= settings map::const_iterator arch = Options.find("arch"); - vector Archs = - (arch != Options.end()) ? VectorizeString(arch->second, ',') : - APT::Configuration::getArchitectures(); + vector Archs; + if (arch != Options.end()) + Archs = VectorizeString(arch->second, ','); + else + Archs = APT::Configuration::getArchitectures(); + if ((arch = Options.find("arch+")) != Options.end()) { std::vector const plusArch = VectorizeString(arch->second, ','); diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc index 7170e8b5b..8b960572b 100644 --- a/apt-pkg/sourcelist.cc +++ b/apt-pkg/sourcelist.cc @@ -331,7 +331,7 @@ bool pkgSourceList::ParseFileOldStyle(string File) { // Open the stream for reading ifstream F(File.c_str(),ios::in /*| ios::nocreate*/); - if (!F != 0) + if (F.fail() == true) return _error->Errno("ifstream::ifstream",_("Opening %s"),File.c_str()); // CNC:2003-12-10 - 300 is too short. -- cgit v1.2.3