From c3bfdbfa3ae868515a67142d2df6200a3cb34d35 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 24 May 2020 16:36:03 +0200 Subject: Silence clang warning -Wstring-plus-int ../apt-pkg/init.cc:137:39: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int] Cnf.CndSet("Dir::State", STATE_DIR + 1); ../apt-pkg/init.cc:137:39: note: use array indexing to silence this warning We have a few instances of that & it should be reasonably clear that we are not actually trying to append here, but ignoring or silencing this warning with an override is far more costly than just using what clang suggests here. Reported-By: clang Gbp-Dch: Ignore --- apt-pkg/deb/debsystem.cc | 2 +- apt-pkg/init.cc | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index 6904879b6..7d4bf7213 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -270,7 +270,7 @@ static std::string getDpkgStatusLocation(Configuration const &Cnf) { Configuration PathCnf; PathCnf.Set("Dir", Cnf.Find("Dir", "/")); PathCnf.Set("Dir::State::status", "status"); - auto const cnfstatedir = Cnf.Find("Dir::State", STATE_DIR + 1); + auto const cnfstatedir = Cnf.Find("Dir::State", &STATE_DIR[1]); // if the state dir ends in apt, replace it with dpkg - // for the default this gives us the same as the fallback below. // This can't be a ../dpkg as that would play bad with symlinks diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc index a619368ec..b9d9b15d2 100644 --- a/apt-pkg/init.cc +++ b/apt-pkg/init.cc @@ -134,18 +134,18 @@ bool pkgInitConfig(Configuration &Cnf) Cnf.CndSet("Dir","/"); // State - Cnf.CndSet("Dir::State", STATE_DIR + 1); + Cnf.CndSet("Dir::State", &STATE_DIR[1]); Cnf.CndSet("Dir::State::lists","lists/"); Cnf.CndSet("Dir::State::cdroms","cdroms.list"); // Cache - Cnf.CndSet("Dir::Cache", CACHE_DIR + 1); + Cnf.CndSet("Dir::Cache", &CACHE_DIR[1]); Cnf.CndSet("Dir::Cache::archives","archives/"); Cnf.CndSet("Dir::Cache::srcpkgcache","srcpkgcache.bin"); Cnf.CndSet("Dir::Cache::pkgcache","pkgcache.bin"); // Configuration - Cnf.CndSet("Dir::Etc", CONF_DIR + 1); + Cnf.CndSet("Dir::Etc", &CONF_DIR[1]); Cnf.CndSet("Dir::Etc::sourcelist","sources.list"); Cnf.CndSet("Dir::Etc::sourceparts","sources.list.d"); Cnf.CndSet("Dir::Etc::main","apt.conf"); @@ -162,7 +162,7 @@ bool pkgInitConfig(Configuration &Cnf) Cnf.CndSet("Dir::Media::MountPath","/media/apt"); // State - Cnf.CndSet("Dir::Log", LOG_DIR + 1); + Cnf.CndSet("Dir::Log", &LOG_DIR[1]); Cnf.CndSet("Dir::Log::Terminal","term.log"); Cnf.CndSet("Dir::Log::History","history.log"); Cnf.CndSet("Dir::Log::Planner","eipp.log.xz"); -- cgit v1.2.3