diff options
author | David Kalnischkies <david@kalnischkies.de> | 2014-09-28 01:57:49 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2014-09-28 01:57:49 +0200 |
commit | ffbe056dc554b3f1fdf79b4726415a70f6d59dc1 (patch) | |
tree | 1ab7fea04d330307028d1b451732a811452f6c15 /apt-pkg/acquire-item.h | |
parent | c4b91cbe7cd24126ead1c3fd4b89ff7069bcc148 (diff) |
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
Diffstat (limited to 'apt-pkg/acquire-item.h')
-rw-r--r-- | apt-pkg/acquire-item.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index d0a61f5ec..74b5de675 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -133,7 +133,12 @@ class pkgAcquire::Item : public WeakPointable /** \brief If not \b NULL, contains the name of a subprocess that * is operating on this object (for instance, "gzip" or "gpgv"). */ - const char *Mode; + APT_DEPRECATED const char *Mode; + + /** \brief contains the name of the subprocess that is operating on this object + * (for instance, "gzip", "rred" or "gpgv"). This is obsoleting #Mode from above + * as it can manage the lifetime of included string properly. */ + std::string ActiveSubprocess; /** \brief A client-supplied unique identifier. * |