Browse Source

Refactor to avoid loop/dangling gcc warnings

Gbp-Dch: Ignore
tags/debian/1.5_alpha1
David Kalnischkies 4 years ago
parent
commit
f78fb67f4b
4 changed files with 11 additions and 9 deletions
  1. +4
    -8
      ftparchive/apt-ftparchive.cc
  2. +1
    -1
      test/interactive-helper/aptwebserver.cc
  3. +4
    -0
      test/libapt/fileutl_test.cc
  4. +2
    -0
      test/libapt/srvrecs_test.cc

+ 4
- 8
ftparchive/apt-ftparchive.cc View File

@@ -1002,7 +1002,7 @@ static bool Clean(CommandLine &CmdL)
stable_sort(PkgList.begin(),PkgList.end(),PackageMap::SrcDBCompare());

string CacheDir = Setup.FindDir("Dir::CacheDir");
for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); )
{
if(I->BinCacheDB != "")
@@ -1016,15 +1016,11 @@ static bool Clean(CommandLine &CmdL)
if (DB_SRC.Clean() == false)
_error->DumpErrors();

string CacheDB = I->BinCacheDB;
string SrcCacheDB = I->SrcCacheDB;
while(I != PkgList.end() &&
I->BinCacheDB == CacheDB &&
I->SrcCacheDB == SrcCacheDB)
++I;
I = std::find_if(I, PkgList.end(),
[&](PackageMap const &PM) { return PM.BinCacheDB != I->BinCacheDB || PM.SrcCacheDB != I->SrcCacheDB;
});
}

return true;
}
/*}}}*/


+ 1
- 1
test/interactive-helper/aptwebserver.cc View File

@@ -127,7 +127,7 @@ static bool sendHead(std::ostream &log, int const client, int const httpcode, st

std::stringstream buffer;
auto const empties = _config->FindVector("aptwebserver::empty-response-header");
for (auto && e: empties)
for (auto const &e: empties)
buffer << e << ":" << std::endl;
_config->Dump(buffer, "aptwebserver::response-header", "%t: %v%n", false);
std::vector<std::string> addheaders = VectorizeString(buffer.str(), '\n');


+ 4
- 0
test/libapt/fileutl_test.cc View File

@@ -25,7 +25,9 @@ static void TestFileFd(mode_t const a_umask, mode_t const ExpectedFilePermission

static const char* fname = "apt-filefd-test.txt";
if (FileExists(fname) == true)
{
EXPECT_EQ(0, unlink(fname));
}

FileFd f;
umask(a_umask);
@@ -290,7 +292,9 @@ TEST(FileUtlTest, Popen)

// ensure that after a close all is good again
if(FileExists("/proc/self/fd"))
{
EXPECT_EQ(Glob("/proc/self/fd/*").size(), OpenFds.size());
}

// ReadWrite is not supported
_error->PushToStack();


+ 2
- 0
test/libapt/srvrecs_test.cc View File

@@ -77,7 +77,9 @@ TEST(SrvRecTest,Randomness)
EXPECT_TRUE(std::all_of(first_pull.begin(), first_pull.end(), [](SrvRec const &R) { return R.priority == 20; }));
EXPECT_TRUE(std::all_of(second_pull.begin(), second_pull.end(), [](SrvRec const &R) { return R.priority == 20; }));
if (startingClock != -1 && startingClock != clock())
{
EXPECT_FALSE(std::equal(first_pull.begin(), first_pull.end(), second_pull.begin()));
}

EXPECT_TRUE(std::all_of(base2.begin(), base2.end(), [](SrvRec const &R) { return R.priority == 30; }));
}

Loading…
Cancel
Save