From ffbe056dc554b3f1fdf79b4726415a70f6d59dc1 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 28 Sep 2014 01:57:49 +0200 Subject: replace c-string Mode with c++-string ActiveSubprocess A long-lasting FIXME in the acquire code points out the problem that we e.g. for decompressors assign c-string representations of c++-strings to the Mode variable, which e.g. cppcheck points out as very bad. In practice, nothing major happens as the c++-strings do not run out of scope until Mode would do, but that is bad style and fragile, so the obvious proper fix is to use a c++ string for storage to begin with. The slight complications stems from the fact that progress reporting code in frontends potentially uses Mode and compares it with NULL, which can't be done with std::string, so instead of just changing the type we introduce a new variable and deprecate the old one. Git-Dch: Ignore --- apt-private/acqprogress.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-private/acqprogress.cc') diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc index 17a12799c..d6ce192ad 100644 --- a/apt-private/acqprogress.cc +++ b/apt-private/acqprogress.cc @@ -202,9 +202,9 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) S += strlen(S); // Show the short mode string - if (I->CurrentItem->Owner->Mode != 0) + if (I->CurrentItem->Owner->ActiveSubprocess.empty() == false) { - snprintf(S,End-S," %s",I->CurrentItem->Owner->Mode); + snprintf(S,End-S, " %s", I->CurrentItem->Owner->ActiveSubprocess.c_str()); S += strlen(S); } -- cgit v1.2.3