diff options
author | Roger Leigh <rleigh@debian.org> | 2013-05-05 00:52:20 +0100 |
---|---|---|
committer | Roger Leigh <rleigh@debian.org> | 2013-05-05 00:52:20 +0100 |
commit | 9f8ad585580b6340b032b5e05ab6425a67a434be (patch) | |
tree | d94ddd62de27dde4a165e260a6a6a4e5862a9173 /lib/sbuild | |
parent | 1ef1e72b29fbb849d7219b83fd9ac5c396f0b386 (diff) | |
download | schroot-9f8ad585580b6340b032b5e05ab6425a67a434be.tar.gz |
all: Place const before typename for const references
Diffstat (limited to 'lib/sbuild')
83 files changed, 771 insertions, 771 deletions
diff --git a/lib/sbuild/auth/auth.cc b/lib/sbuild/auth/auth.cc index 46911310..cb15aad2 100644 --- a/lib/sbuild/auth/auth.cc +++ b/lib/sbuild/auth/auth.cc @@ -58,7 +58,7 @@ namespace sbuild {auth::auth::PAM_END, N_("PAM failed to shut down cleanly")} }; - auth::auth (std::string const& service_name): + auth::auth (const std::string& service_name): service(service_name), uid(getuid()), gid(getgid()), @@ -86,7 +86,7 @@ namespace sbuild { stop(); } - catch (error const& e) + catch (const error& e) { log_exception_error(e); } @@ -114,7 +114,7 @@ namespace sbuild } void - auth::set_ruser (std::string const& ruser) + auth::set_ruser (const std::string& ruser) { passwd pwent(ruser); if (!pwent) @@ -129,7 +129,7 @@ namespace sbuild } void - auth::set_ruser (passwd const& rpwent) + auth::set_ruser (const passwd& rpwent) { group grent(rpwent.pw_gid); if (!grent) @@ -183,7 +183,7 @@ namespace sbuild } void - auth::set_user (std::string const& user) + auth::set_user (const std::string& user) { passwd pwent(user); if (!pwent) @@ -198,7 +198,7 @@ namespace sbuild } void - auth::set_user (passwd const& pwent) + auth::set_user (const passwd& pwent) { this->uid = pwent.pw_uid; this->gid = pwent.pw_gid; @@ -218,7 +218,7 @@ namespace sbuild } void - auth::set_command (string_list const& command) + auth::set_command (const string_list& command) { this->command = command; } @@ -236,7 +236,7 @@ namespace sbuild } void - auth::set_wd (std::string const& wd) + auth::set_wd (const std::string& wd) { this->wd = wd; } @@ -260,7 +260,7 @@ namespace sbuild } void - auth::set_user_environment (environment const& environment) + auth::set_user_environment (const environment& environment) { this->user_environment = environment; } diff --git a/lib/sbuild/auth/auth.h b/lib/sbuild/auth/auth.h index 5f00a51f..0c694901 100644 --- a/lib/sbuild/auth/auth.h +++ b/lib/sbuild/auth/auth.h @@ -110,7 +110,7 @@ namespace sbuild * This is passed to pam_start() when initialising PAM, and is * used to load the correct configuration file from /etc/pam.d. */ - auth (std::string const& service_name); + auth (const std::string& service_name); public: /** @@ -179,7 +179,7 @@ namespace sbuild * @param user the name to set. */ void - set_user (std::string const& user); + set_user (const std::string& user); protected: /** @@ -193,7 +193,7 @@ namespace sbuild * @param pwent user to set as a passwd entry. */ void - set_user (passwd const& pwent); + set_user (const passwd& pwent); public: /** @@ -213,7 +213,7 @@ namespace sbuild * item being a separate argument. */ void - set_command (string_list const& command); + set_command (const string_list& command); /** * Get the home directory. This is the $HOME to set in the session, @@ -240,7 +240,7 @@ namespace sbuild * @param wd the current working directory. */ void - set_wd (std::string const& wd); + set_wd (const std::string& wd); /** * Get the name of the shell. This is the shell to run in the @@ -276,7 +276,7 @@ namespace sbuild * @param environment an environment list. */ void - set_user_environment (environment const& environment); + set_user_environment (const environment& environment); /** * Get the minimal environment. This is essential environment @@ -357,7 +357,7 @@ namespace sbuild * @param ruser the remote user name to set. */ void - set_ruser (std::string const& ruser); + set_ruser (const std::string& ruser); protected: /** @@ -371,7 +371,7 @@ namespace sbuild * @param rpwent remote user to set as a passwd entry. */ void - set_ruser (passwd const& rpwent); + set_ruser (const passwd& rpwent); public: /** diff --git a/lib/sbuild/auth/deny.cc b/lib/sbuild/auth/deny.cc index 6eae07fd..6988d219 100644 --- a/lib/sbuild/auth/deny.cc +++ b/lib/sbuild/auth/deny.cc @@ -40,7 +40,7 @@ namespace sbuild namespace auth { - deny::deny (std::string const& service_name): + deny::deny (const std::string& service_name): auth(service_name), initialised(false) { @@ -53,14 +53,14 @@ namespace sbuild { stop(); } - catch (error const& e) + catch (const error& e) { log_exception_error(e); } } auth::ptr - deny::create (std::string const& service_name) + deny::create (const std::string& service_name) { return ptr(new deny(service_name)); } diff --git a/lib/sbuild/auth/deny.h b/lib/sbuild/auth/deny.h index a1e4585c..9658671f 100644 --- a/lib/sbuild/auth/deny.h +++ b/lib/sbuild/auth/deny.h @@ -44,7 +44,7 @@ namespace sbuild * This is passed to pam_start() when initialising PAM, and is * used to load the correct configuration file from /etc/pam.d. */ - deny (std::string const& service_name); + deny (const std::string& service_name); public: /** @@ -62,7 +62,7 @@ namespace sbuild * @returns a shared pointer to the created object. */ static auth::ptr - create (std::string const& service_name); + create (const std::string& service_name); /** * Get the PAM environment. This is the environment as set by PAM diff --git a/lib/sbuild/auth/pam-message.cc b/lib/sbuild/auth/pam-message.cc index d88e5deb..36da753d 100644 --- a/lib/sbuild/auth/pam-message.cc +++ b/lib/sbuild/auth/pam-message.cc @@ -26,7 +26,7 @@ namespace sbuild { pam_message::pam_message (message_type type, - std::string const& message): + const std::string& message): type(type), message(message), response() diff --git a/lib/sbuild/auth/pam-message.h b/lib/sbuild/auth/pam-message.h index 0252f4be..2faea617 100644 --- a/lib/sbuild/auth/pam-message.h +++ b/lib/sbuild/auth/pam-message.h @@ -61,7 +61,7 @@ namespace sbuild * @param message the message to display. */ pam_message (message_type type, - std::string const& message); + const std::string& message); /// The destructor. virtual ~pam_message (); diff --git a/lib/sbuild/auth/pam.cc b/lib/sbuild/auth/pam.cc index 6fcc0aa0..84663c24 100644 --- a/lib/sbuild/auth/pam.cc +++ b/lib/sbuild/auth/pam.cc @@ -122,7 +122,7 @@ namespace sbuild return PAM_SUCCESS; } - catch (std::exception const& e) + catch (const std::exception& e) { log_exception_error(e); } @@ -137,7 +137,7 @@ namespace sbuild sbuild::feature feature_pam("PAM", N_("Pluggable Authentication Modules")); } - pam::pam (std::string const& service_name): + pam::pam (const std::string& service_name): auth(service_name), pamh(0), conv() @@ -151,14 +151,14 @@ namespace sbuild { stop(); } - catch (error const& e) + catch (const error& e) { log_exception_error(e); } } auth::ptr - pam::create (std::string const& service_name) + pam::create (const std::string& service_name) { return ptr(new pam(service_name)); } @@ -264,7 +264,7 @@ namespace sbuild throw error(_("Set RHOST"), PAM, pam_strerror(pam_status)); } } - catch (error const& e) + catch (const error& e) { delete[] hostname; hostname = 0; diff --git a/lib/sbuild/auth/pam.h b/lib/sbuild/auth/pam.h index 81ed60fc..33abe03f 100644 --- a/lib/sbuild/auth/pam.h +++ b/lib/sbuild/auth/pam.h @@ -47,7 +47,7 @@ namespace sbuild * This is passed to pam_start() when initialising PAM, and is * used to load the correct configuration file from /etc/pam.d. */ - pam (std::string const& service_name); + pam (const std::string& service_name); public: /** @@ -65,7 +65,7 @@ namespace sbuild * @returns a shared pointer to the created object. */ static auth::ptr - create (std::string const& service_name); + create (const std::string& service_name); virtual environment get_auth_environment () const; diff --git a/lib/sbuild/chroot/chroot.cc b/lib/sbuild/chroot/chroot.cc index e0cc2fb4..4270f6e6 100644 --- a/lib/sbuild/chroot/chroot.cc +++ b/lib/sbuild/chroot/chroot.cc @@ -141,7 +141,7 @@ namespace sbuild } chroot::ptr - chroot::create (std::string const& type) + chroot::create (const std::string& type) { facet::facet::ptr fac = facet::factory::create(type); facet::storage::ptr store = std::dynamic_pointer_cast<facet::storage>(fac); @@ -165,9 +165,9 @@ namespace sbuild } chroot::ptr - chroot::clone_session (std::string const& session_id, - std::string const& alias, - std::string const& user, + chroot::clone_session (const std::string& session_id, + const std::string& alias, + const std::string& user, bool root) const { ptr session = 0; @@ -201,7 +201,7 @@ namespace sbuild } void - chroot::set_name (std::string const& name) + chroot::set_name (const std::string& name) { std::string::size_type pos = name.find_first_of(config::namespace_separator); if (pos != std::string::npos) @@ -231,7 +231,7 @@ namespace sbuild } void - chroot::set_description (std::string const& description) + chroot::set_description (const std::string& description) { this->description = description; } @@ -243,7 +243,7 @@ namespace sbuild } void - chroot::set_mount_location (std::string const& location) + chroot::set_mount_location (const std::string& location) { if (!location.empty() && !is_absname(location)) throw error(location, LOCATION_ABS); @@ -263,7 +263,7 @@ namespace sbuild } void - chroot::set_users (string_list const& users) + chroot::set_users (const string_list& users) { this->users = users; } @@ -275,7 +275,7 @@ namespace sbuild } void - chroot::set_groups (string_list const& groups) + chroot::set_groups (const string_list& groups) { this->groups = groups; } @@ -287,7 +287,7 @@ namespace sbuild } void - chroot::set_root_users (string_list const& users) + chroot::set_root_users (const string_list& users) { this->root_users = users; } @@ -299,7 +299,7 @@ namespace sbuild } void - chroot::set_root_groups (string_list const& groups) + chroot::set_root_groups (const string_list& groups) { this->root_groups = groups; } @@ -311,7 +311,7 @@ namespace sbuild } void - chroot::set_aliases (string_list const& aliases) + chroot::set_aliases (const string_list& aliases) { for (const auto& alias : aliases) { @@ -355,7 +355,7 @@ namespace sbuild } void - chroot::set_default_shell (std::string const& default_shell) + chroot::set_default_shell (const std::string& default_shell) { this->default_shell = default_shell; } @@ -367,7 +367,7 @@ namespace sbuild } void - chroot::set_environment_filter (regex const& environment_filter) + chroot::set_environment_filter (const regex& environment_filter) { this->environment_filter = environment_filter; } @@ -399,7 +399,7 @@ namespace sbuild } void - chroot::set_script_config (std::string const& script_config) + chroot::set_script_config (const std::string& script_config) { this->script_config = script_config; @@ -424,7 +424,7 @@ namespace sbuild } void - chroot::set_profile (std::string const& profile) + chroot::set_profile (const std::string& profile) { this->profile = profile; @@ -446,7 +446,7 @@ namespace sbuild } void - chroot::set_command_prefix (string_list const& command_prefix) + chroot::set_command_prefix (const string_list& command_prefix) { this->command_prefix = command_prefix; } @@ -491,7 +491,7 @@ namespace sbuild } void - chroot::set_verbosity (std::string const& verbosity) + chroot::set_verbosity (const std::string& verbosity) { if (verbosity == "quiet") this->message_verbosity = VERBOSITY_QUIET; @@ -764,7 +764,7 @@ namespace sbuild } void - chroot::set_keyfile (keyfile const& keyfile) + chroot::set_keyfile (const keyfile& keyfile) { bool session = static_cast<bool>(get_facet<facet::session>()); diff --git a/lib/sbuild/chroot/chroot.h b/lib/sbuild/chroot/chroot.h index 39110923..f4b055b7 100644 --- a/lib/sbuild/chroot/chroot.h +++ b/lib/sbuild/chroot/chroot.h @@ -127,7 +127,7 @@ namespace sbuild * @returns a shared_ptr to the new chroot. */ static chroot::ptr - create (std::string const& type); + create (const std::string& type); /** * Copy the chroot. This is a virtual copy constructor. @@ -147,9 +147,9 @@ namespace sbuild * @returns a session chroot. */ chroot::ptr - clone_session (std::string const& session_id, - std::string const& alias, - std::string const& user, + clone_session (const std::string& session_id, + const std::string& alias, + const std::string& user, bool root) const; /** @@ -174,7 +174,7 @@ namespace sbuild * @param name the name. */ void - set_name (std::string const& name); + set_name (const std::string& name); /** * Get the description of the chroot. @@ -190,7 +190,7 @@ namespace sbuild * @param description the description. */ void - set_description (std::string const& description); + set_description (const std::string& description); /** * Get the mount location of the chroot. @@ -206,7 +206,7 @@ namespace sbuild * @param location the mount location. */ void - set_mount_location (std::string const& location); + set_mount_location (const std::string& location); public: /** @@ -235,7 +235,7 @@ namespace sbuild * @param users a list of users. */ void - set_users (string_list const& users); + set_users (const string_list& users); /** * Get the groups allowed to access the chroot. @@ -251,7 +251,7 @@ namespace sbuild * @param groups a list of groups. */ void - set_groups (string_list const& groups); + set_groups (const string_list& groups); /** * Get the users allowed to access the chroot as root. Members @@ -271,7 +271,7 @@ namespace sbuild * @param users a list of users. */ void - set_root_users (string_list const& users); + set_root_users (const string_list& users); /** * Get the groups allowed to access the chroot as root. Members @@ -291,7 +291,7 @@ namespace sbuild * @param groups a list of groups. */ void - set_root_groups (string_list const& groups); + set_root_groups (const string_list& groups); /** * Get the aliases of the chroot. These are alternative names for @@ -309,7 +309,7 @@ namespace sbuild * @param aliases a list of names. */ void - set_aliases (string_list const& aliases); + set_aliases (const string_list& aliases); /** * Check if the environment should be preserved in the chroot. @@ -341,7 +341,7 @@ namespace sbuild * @param default_shell the default shell. */ void - set_default_shell (std::string const& default_shell); + set_default_shell (const std::string& default_shell); /** * Get the environment filter of the chroot. This is a POSIX @@ -361,7 +361,7 @@ namespace sbuild * @param environment_filter the filter. */ void - set_environment_filter (regex const& environment_filter); + set_environment_filter (const regex& environment_filter); /** * Get the activity status of the chroot. The chroot is active if @@ -415,7 +415,7 @@ namespace sbuild * @param script_config the script configuration file. */ void - set_script_config (std::string const& script_config); + set_script_config (const std::string& script_config); /** * Get the configuration profile for the chroot. This is a @@ -435,7 +435,7 @@ namespace sbuild * @param profile the script configuration file. */ void - set_profile (std::string const& profile); + set_profile (const std::string& profile); /** * Get the command_prefix for the chroot. This is a command to @@ -453,7 +453,7 @@ namespace sbuild * @param command_prefix the command prefix. */ void - set_command_prefix (string_list const& command_prefix); + set_command_prefix (const string_list& command_prefix); /** * Get the message verbosity. @@ -485,7 +485,7 @@ namespace sbuild * @param verbosity the verbosity level. */ void - set_verbosity (std::string const& verbosity); + set_verbosity (const std::string& verbosity); /** * Get the type of the chroot. @@ -697,7 +697,7 @@ namespace sbuild */ friend std::ostream& operator << (std::ostream& stream, - ptr const& rhs) + const ptr& rhs) { rhs->print_details(stream); return stream; @@ -712,7 +712,7 @@ namespace sbuild */ friend keyfile const& - operator >> (keyfile const& keyfile, + operator >> (const keyfile& keyfile, ptr& rhs) { rhs->set_keyfile(keyfile); @@ -729,7 +729,7 @@ namespace sbuild friend keyfile& operator << (keyfile& keyfile, - ptr const& rhs) + const ptr& rhs) { rhs->get_keyfile(keyfile); return keyfile; @@ -772,7 +772,7 @@ namespace sbuild * @param keyfile the keyfile to get the properties from. */ void - set_keyfile (keyfile const& keyfile); + set_keyfile (const keyfile& keyfile); /** * Get a list of the keys used during keyfile parsing. diff --git a/lib/sbuild/chroot/config.cc b/lib/sbuild/chroot/config.cc index 1bccaf65..fc6872fe 100644 --- a/lib/sbuild/chroot/config.cc +++ b/lib/sbuild/chroot/config.cc @@ -52,8 +52,8 @@ namespace sbuild { bool - chroot_alphasort (chroot::chroot::ptr const& c1, - chroot::chroot::ptr const& c2) + chroot_alphasort (const chroot::chroot::ptr& c1, + const chroot::chroot::ptr& c2) { return c1->get_name() < c2->get_name(); } @@ -92,8 +92,8 @@ namespace sbuild this->namespaces.insert(std::make_pair(std::string("source"), chroot_map())); } - config::config (std::string const& chroot_namespace, - std::string const& file): + config::config (const std::string& chroot_namespace, + const std::string& file): namespaces(), aliases() { @@ -109,8 +109,8 @@ namespace sbuild } void - config::add (std::string const& chroot_namespace, - std::string const& location) + config::add (const std::string& chroot_namespace, + const std::string& location) { /// @todo Remove and require explicit use of add_config_file or /// add_config_directory; the caller should be aware which is @@ -122,8 +122,8 @@ namespace sbuild } void - config::add_config_file (std::string const& chroot_namespace, - std::string const& file) + config::add_config_file (const std::string& chroot_namespace, + const std::string& file) { log_debug(DEBUG_NOTICE) << "Loading config file: " << file << endl; @@ -135,8 +135,8 @@ namespace sbuild } void - config::add_config_directory (std::string const& chroot_namespace, - std::string const& dir) + config::add_config_directory (const std::string& chroot_namespace, + const std::string& dir) { log_debug(DEBUG_NOTICE) << "Loading config directory: " << dir << endl; @@ -170,7 +170,7 @@ namespace sbuild if (!stat(filename).is_regular()) throw error(filename, FILE_NOTREG); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { log_exception_warning(e); continue; @@ -181,12 +181,12 @@ namespace sbuild } void - config::add (std::string const& chroot_namespace, + config::add (const std::string& chroot_namespace, chroot::ptr& chroot, - keyfile const& kconfig) + const keyfile& kconfig) { - std::string const& name(chroot->get_name()); - std::string const& fullname(chroot_namespace + namespace_separator + chroot->get_name()); + const std::string& name(chroot->get_name()); + const std::string& fullname(chroot_namespace + namespace_separator + chroot->get_name()); chroot_map& chroots = find_namespace(chroot_namespace); @@ -210,7 +210,7 @@ namespace sbuild } // Set up aliases. - string_list const& aliases = chroot->get_aliases(); + const string_list& aliases = chroot->get_aliases(); for (const auto& alias : aliases) { try @@ -254,7 +254,7 @@ namespace sbuild } } } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { log_exception_warning(e); } @@ -290,10 +290,10 @@ namespace sbuild } config::chroot_list - config::get_chroots (std::string const& chroot_namespace) const + config::get_chroots (const std::string& chroot_namespace) const { chroot_list ret; - chroot_map const& chroots = find_namespace(chroot_namespace); + const chroot_map& chroots = find_namespace(chroot_namespace); for (const auto& chroot : chroots) ret.push_back(chroot.second); @@ -304,7 +304,7 @@ namespace sbuild } config::chroot_map& - config::find_namespace (std::string const& chroot_namespace) + config::find_namespace (const std::string& chroot_namespace) { chroot_namespace_map::iterator pos = this->namespaces.find(chroot_namespace); @@ -315,7 +315,7 @@ namespace sbuild } config::chroot_map const& - config::find_namespace (std::string const& chroot_namespace) const + config::find_namespace (const std::string& chroot_namespace) const { chroot_namespace_map::const_iterator pos = this->namespaces.find(chroot_namespace); @@ -326,7 +326,7 @@ namespace sbuild } const chroot::ptr - config::find_chroot (std::string const& name) const + config::find_chroot (const std::string& name) const { std::string chroot_namespace; std::string chroot_name; @@ -337,8 +337,8 @@ namespace sbuild } const chroot::ptr - config::find_chroot (std::string const& namespace_hint, - std::string const& name) const + config::find_chroot (const std::string& namespace_hint, + const std::string& name) const { std::string chroot_namespace(namespace_hint); std::string chroot_name(name); @@ -354,10 +354,10 @@ namespace sbuild } const chroot::ptr - config::find_chroot_in_namespace (std::string const& chroot_namespace, - std::string const& name) const + config::find_chroot_in_namespace (const std::string& chroot_namespace, + const std::string& name) const { - chroot_map const& chroots = find_namespace(chroot_namespace); + const chroot_map& chroots = find_namespace(chroot_namespace); log_debug(DEBUG_NOTICE) << "Looking for chroot " << name << " in namespace " << chroot_namespace << std::endl; @@ -373,8 +373,8 @@ namespace sbuild } const chroot::ptr - config::find_alias (std::string const& namespace_hint, - std::string const& name) const + config::find_alias (const std::string& namespace_hint, + const std::string& name) const { std::string chroot_namespace(namespace_hint); std::string alias_name(name); @@ -398,8 +398,8 @@ namespace sbuild } std::string - config::lookup_alias (std::string const& namespace_hint, - std::string const& name) const + config::lookup_alias (const std::string& namespace_hint, + const std::string& name) const { std::string chroot_namespace(namespace_hint); std::string alias_name(name); @@ -426,10 +426,10 @@ namespace sbuild // TODO: Only printed aliases before... Add variant which doesn't use // namespaces to get all namespaces. string_list - config::get_chroot_list (std::string const& chroot_namespace) const + config::get_chroot_list (const std::string& chroot_namespace) const { string_list ret; - chroot_map const& chroots = find_namespace(chroot_namespace); + const chroot_map& chroots = find_namespace(chroot_namespace); for (const auto& chroot : chroots) ret.push_back(chroot_namespace + namespace_separator + chroot.first); @@ -440,7 +440,7 @@ namespace sbuild } string_list - config::get_alias_list (std::string const& chroot_namespace) const + config::get_alias_list (const std::string& chroot_namespace) const { string_list ret; @@ -468,14 +468,14 @@ namespace sbuild { stream << _("Available chroots: "); - chroot_map const& chroots = find_namespace("chroot"); + const chroot_map& chroots = find_namespace("chroot"); for (chroot_map::const_iterator pos = chroots.begin(); pos != chroots.end(); ++pos) { stream << pos->second->get_name(); - string_list const& aliases = pos->second->get_aliases(); + const string_list& aliases = pos->second->get_aliases(); if (!aliases.empty()) { stream << " ["; @@ -498,8 +498,8 @@ namespace sbuild } config::chroot_map - config::validate_chroots (std::string const& namespace_hint, - string_list const& chroots) const + config::validate_chroots (const std::string& namespace_hint, + const string_list& chroots) const { string_list bad_chroots; chroot_map validated; @@ -522,8 +522,8 @@ namespace sbuild } void - config::load_data (std::string const& chroot_namespace, - std::string const& file) + config::load_data (const std::string& chroot_namespace, + const std::string& file) { log_debug(DEBUG_NOTICE) << "Loading data file: " << file << endl; @@ -567,14 +567,14 @@ namespace sbuild parse_data(chroot_namespace, input); lock.unset_lock(); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { throw error(file, e); } } void - config::parse_data (std::string const& chroot_namespace, + config::parse_data (const std::string& chroot_namespace, std::istream& stream) { /* Create key file */ @@ -585,11 +585,11 @@ namespace sbuild } void - config::load_keyfile (std::string const& chroot_namespace, + config::load_keyfile (const std::string& chroot_namespace, keyfile& kconfig) { /* Create chroot objects from key file */ - string_list const& groups = kconfig.get_groups(); + const string_list& groups = kconfig.get_groups(); for (const auto& group : groups) { std::string type = "plain"; // "plain" is the default type. @@ -652,7 +652,7 @@ namespace sbuild } void - config::get_namespace(std::string const& name, + config::get_namespace(const std::string& name, std::string& chroot_namespace, std::string& chroot_name) { diff --git a/lib/sbuild/chroot/config.h b/lib/sbuild/chroot/config.h index 24516a6f..ee4f260b 100644 --- a/lib/sbuild/chroot/config.h +++ b/lib/sbuild/chroot/config.h @@ -88,8 +88,8 @@ namespace sbuild * @param file initialise using a configuration file or a whole * directory containing configuration files. */ - config (std::string const& chroot_namespace, - std::string const& file); + config (const std::string& chroot_namespace, + const std::string& file); /// The destructor. virtual ~config (); @@ -104,8 +104,8 @@ namespace sbuild * whole directory containing configuration files. */ void - add (std::string const& chroot_namespace, - std::string const& location); + add (const std::string& chroot_namespace, + const std::string& location); private: /** @@ -117,8 +117,8 @@ namespace sbuild * @param file the file to load. */ void - add_config_file (std::string const& chroot_namespace, - std::string const& file); + add_config_file (const std::string& chroot_namespace, + const std::string& file); /** * Add a configuration directory. The configuration files in the @@ -129,8 +129,8 @@ namespace sbuild * @param dir the directory containing the files to load. */ void - add_config_directory (std::string const& chroot_namespace, - std::string const& dir); + add_config_directory (const std::string& chroot_namespace, + const std::string& dir); protected: /** @@ -145,9 +145,9 @@ namespace sbuild * @param kconfig the chroot configuration. */ void - add (std::string const& chroot_namespace, + add (const std::string& chroot_namespace, chroot::chroot::ptr& chroot, - keyfile const& kconfig); + const keyfile& kconfig); public: /** @@ -158,7 +158,7 @@ namespace sbuild * if no chroots are available. */ chroot_list - get_chroots (std::string const& chroot_namespace) const; + get_chroots (const std::string& chroot_namespace) const; protected: /** @@ -169,7 +169,7 @@ namespace sbuild * @returns the namespace. */ chroot_map& - find_namespace (std::string const& chroot_namespace); + find_namespace (const std::string& chroot_namespace); /** * Find a chroot namespace. If the namespace is not found, and @@ -179,7 +179,7 @@ namespace sbuild * @returns the namespace. */ chroot_map const& - find_namespace (std::string const& chroot_namespace) const; + find_namespace (const std::string& chroot_namespace) const; public: /** @@ -190,7 +190,7 @@ namespace sbuild * @param chroot_name the name without any namespace */ static void - get_namespace(std::string const& name, + get_namespace(const std::string& name, std::string& chroot_namespace, std::string& chroot_name); @@ -202,7 +202,7 @@ namespace sbuild * @returns the chroot if found, otherwise 0. */ const chroot::chroot::ptr - find_chroot (std::string const& name) const; + find_chroot (const std::string& name) const; /** * Find a chroot by its name. @@ -213,8 +213,8 @@ namespace sbuild * @returns the chroot if found, otherwise 0. */ const chroot::chroot::ptr - find_chroot (std::string const& namespace_hint, - std::string const& name) const; + find_chroot (const std::string& namespace_hint, + const std::string& name) const; /** * Find a chroot by its name in a specific namespace. @@ -224,8 +224,8 @@ namespace sbuild * @returns the chroot if found, otherwise 0. */ const chroot::chroot::ptr - find_chroot_in_namespace (std::string const& chroot_namespace, - std::string const& name) const; + find_chroot_in_namespace (const std::string& chroot_namespace, + const std::string& name) const; /** * Find a chroot by its name or an alias. @@ -236,8 +236,8 @@ namespace sbuild * @returns the chroot if found, otherwise 0. */ const chroot::chroot::ptr - find_alias (std::string const& namespace_hint, - std::string const& name) const; + find_alias (const std::string& namespace_hint, + const std::string& name) const; /** * Find the chroot name referred to by an alias. @@ -248,8 +248,8 @@ namespace sbuild * @returns the chroot name if found, otherwise an empty string. */ std::string - lookup_alias (std::string const& namespace_hint, - std::string const& name) const; + lookup_alias (const std::string& namespace_hint, + const std::string& name) const; /** * Get the names (including aliases) of all the available chroots, @@ -260,7 +260,7 @@ namespace sbuild * available. */ string_list - get_chroot_list (std::string const& chroot_namespace) const; + get_chroot_list (const std::string& chroot_namespace) const; /** * Get the names (including aliases) of all the available chroots, @@ -271,7 +271,7 @@ namespace sbuild * available. */ string_list - get_alias_list (std::string const& chroot_namespace) const; + get_alias_list (const std::string& chroot_namespace) const; /** * Print a single line of all the available chroots to the @@ -295,8 +295,8 @@ namespace sbuild * @returns an alias-chroot mapping. */ chroot_map - validate_chroots (std::string const& namespace_hint, - string_list const& chroots) const; + validate_chroots (const std::string& namespace_hint, + const string_list& chroots) const; private: /** @@ -309,8 +309,8 @@ namespace sbuild * @param file the file to load. */ void - load_data (std::string const& chroot_namespace, - std::string const& file); + load_data (const std::string& chroot_namespace, + const std::string& file); protected: /** @@ -322,7 +322,7 @@ namespace sbuild * @param stream the data stream to parse. */ virtual void - parse_data (std::string const& chroot_namespace, + parse_data (const std::string& chroot_namespace, std::istream& stream); /** @@ -334,7 +334,7 @@ namespace sbuild * @param kconfig the chroot configuration. */ virtual void - load_keyfile (std::string const& chroot_namespace, + load_keyfile (const std::string& chroot_namespace, keyfile& kconfig); /// A list of chroots (name->chroot mapping). diff --git a/lib/sbuild/chroot/facet/block-device-base.cc b/lib/sbuild/chroot/facet/block-device-base.cc index c17e1622..1f37945e 100644 --- a/lib/sbuild/chroot/facet/block-device-base.cc +++ b/lib/sbuild/chroot/facet/block-device-base.cc @@ -71,7 +71,7 @@ namespace sbuild } void - block_device_base::set_device (std::string const& device) + block_device_base::set_device (const std::string& device) { if (!is_absname(device)) throw error(device, chroot::DEVICE_ABS); @@ -120,7 +120,7 @@ namespace sbuild } void - block_device_base::set_keyfile (keyfile const& keyfile) + block_device_base::set_keyfile (const keyfile& keyfile) { keyfile::get_object_value(*this, &block_device_base::set_device, keyfile, owner->get_name(), "device", diff --git a/lib/sbuild/chroot/facet/block-device-base.h b/lib/sbuild/chroot/facet/block-device-base.h index 3e2aadb9..a53ed7c9 100644 --- a/lib/sbuild/chroot/facet/block-device-base.h +++ b/lib/sbuild/chroot/facet/block-device-base.h @@ -83,7 +83,7 @@ namespace sbuild * @param device the device. */ void - set_device (std::string const& device); + set_device (const std::string& device); virtual std::string get_path () const; @@ -102,7 +102,7 @@ namespace sbuild get_keyfile (keyfile& keyfile) const; virtual void - set_keyfile (keyfile const& keyfile); + set_keyfile (const keyfile& keyfile); /// The block device to use. std::string device; diff --git a/lib/sbuild/chroot/facet/block-device.cc b/lib/sbuild/chroot/facet/block-device.cc index 8d07d95e..1776a657 100644 --- a/lib/sbuild/chroot/facet/block-device.cc +++ b/lib/sbuild/chroot/facet/block-device.cc @@ -153,7 +153,7 @@ namespace sbuild #endif // SBUILD_FEATURE_UNION } } - catch (sbuild::stat::error const& e) // Failed to stat + catch (const sbuild::stat::error& e) // Failed to stat { // Don't throw if stopping a session and the device stat // failed. This is because the setup scripts shouldn't fail @@ -173,10 +173,10 @@ namespace sbuild } void - block_device::chroot_session_setup (chroot const& parent, - std::string const& session_id, - std::string const& alias, - std::string const& user, + block_device::chroot_session_setup (const chroot& parent, + const std::string& session_id, + const std::string& alias, + const std::string& user, bool root) { // Block devices need the mount device name specifying. diff --git a/lib/sbuild/chroot/facet/block-device.h b/lib/sbuild/chroot/facet/block-device.h index 453c2f3a..845ba116 100644 --- a/lib/sbuild/chroot/facet/block-device.h +++ b/lib/sbuild/chroot/facet/block-device.h @@ -98,10 +98,10 @@ namespace sbuild clone () const; virtual void - chroot_session_setup (chroot const& parent, - std::string const& session_id, - std::string const& alias, - std::string const& user, + chroot_session_setup (const chroot& parent, + const std::string& session_id, + const std::string& alias, + const std::string& user, bool root); protected: diff --git a/lib/sbuild/chroot/facet/btrfs-snapshot.cc b/lib/sbuild/chroot/facet/btrfs-snapshot.cc index 5abba576..c38f4738 100644 --- a/lib/sbuild/chroot/facet/btrfs-snapshot.cc +++ b/lib/sbuild/chroot/facet/btrfs-snapshot.cc @@ -119,7 +119,7 @@ namespace sbuild } void - btrfs_snapshot::set_source_subvolume (std::string const& source_subvolume) + btrfs_snapshot::set_source_subvolume (const std::string& source_subvolume) { if (!is_absname(source_subvolume)) throw error(source_subvolume, chroot::DIRECTORY_ABS); @@ -134,7 +134,7 @@ namespace sbuild } void - btrfs_snapshot::set_snapshot_directory (std::string const& snapshot_directory) + btrfs_snapshot::set_snapshot_directory (const std::string& snapshot_directory) { if (!is_absname(snapshot_directory)) throw error(source_subvolume, chroot::DIRECTORY_ABS); @@ -149,7 +149,7 @@ namespace sbuild } void - btrfs_snapshot::set_snapshot_name (std::string const& snapshot_name) + btrfs_snapshot::set_snapshot_name (const std::string& snapshot_name) { if (!is_absname(snapshot_name)) throw error(source_subvolume, chroot::DIRECTORY_ABS); @@ -240,7 +240,7 @@ namespace sbuild } void - btrfs_snapshot::set_keyfile (keyfile const& keyfile) + btrfs_snapshot::set_keyfile (const keyfile& keyfile) { bool issession = static_cast<bool>(owner->get_facet<session>()); @@ -266,10 +266,10 @@ namespace sbuild } void - btrfs_snapshot::chroot_session_setup (chroot const& parent, - std::string const& session_id, - std::string const& alias, - std::string const& user, + btrfs_snapshot::chroot_session_setup (const chroot& parent, + const std::string& session_id, + const std::string& alias, + const std::string& user, bool root) { // Btrfs snapshots need the snapshot name specifying. @@ -282,7 +282,7 @@ namespace sbuild } void - btrfs_snapshot::chroot_source_setup (chroot const& parent) + btrfs_snapshot::chroot_source_setup (const chroot& parent) { storage::ptr source_directory(directory::create(*this)); owner->replace_facet<storage>(source_directory); diff --git a/lib/sbuild/chroot/facet/btrfs-snapshot.h b/lib/sbuild/chroot/facet/btrfs-snapshot.h index 8cb86f43..1e84e5a7 100644 --- a/lib/sbuild/chroot/facet/btrfs-snapshot.h +++ b/lib/sbuild/chroot/facet/btrfs-snapshot.h @@ -99,7 +99,7 @@ namespace sbuild * @param source_subvolume the source subvolume. */ void - set_source_subvolume (std::string const& source_subvolume); + set_source_subvolume (const std::string& source_subvolume); /** * Get the snapshot directory. @@ -115,7 +115,7 @@ namespace sbuild * @param snapshot_directory the snapshot directory. */ void - set_snapshot_directory (std::string const& snapshot_directory); + set_snapshot_directory (const std::string& snapshot_directory); /** * Get the snapshot name. This is used by "btrfs subvolume @@ -133,7 +133,7 @@ namespace sbuild * @param snapshot_name the snapshot name. */ void - set_snapshot_name (std::string const& snapshot_name); + set_snapshot_name (const std::string& snapshot_name); virtual std::string get_path () const; @@ -160,17 +160,17 @@ namespace sbuild get_keyfile (keyfile& keyfile) const; virtual void - set_keyfile (keyfile const& keyfile); + set_keyfile (const keyfile& keyfile); virtual void - chroot_session_setup (chroot const& parent, - std::string const& session_id, - std::string const& alias, - std::string const& user, + chroot_session_setup (const chroot& parent, + const std::string& session_id, + const std::string& alias, + const std::string& user, bool root); virtual void - chroot_source_setup (chroot const& parent); + chroot_source_setup (const chroot& parent); private: /// Btrfs source subvolume diff --git a/lib/sbuild/chroot/facet/custom.cc b/lib/sbuild/chroot/facet/custom.cc index 93b0ec05..f55dc8b5 100644 --- a/lib/sbuild/chroot/facet/custom.cc +++ b/lib/sbuild/chroot/facet/custom.cc @@ -187,7 +187,7 @@ namespace sbuild } void - custom::set_keyfile (keyfile const& keyfile) + custom::set_keyfile (const keyfile& keyfile) { bool is_session = static_cast<bool>(owner->get_facet<session>()); diff --git a/lib/sbuild/chroot/facet/custom.h b/lib/sbuild/chroot/facet/custom.h index 5cddaf24..4363aa21 100644 --- a/lib/sbuild/chroot/facet/custom.h +++ b/lib/sbuild/chroot/facet/custom.h @@ -141,7 +141,7 @@ namespace sbuild get_keyfile (keyfile& keyfile) const; virtual void - set_keyfile (keyfile const& keyfile); + set_keyfile (const keyfile& keyfile); private: bool purgeable; diff --git a/lib/sbuild/chroot/facet/directory-base.cc b/lib/sbuild/chroot/facet/directory-base.cc index f29dfea0..0e5eea13 100644 --- a/lib/sbuild/chroot/facet/directory-base.cc +++ b/lib/sbuild/chroot/facet/directory-base.cc @@ -59,7 +59,7 @@ namespace sbuild } void - directory_base::set_directory (std::string const& directory) + directory_base::set_directory (const std::string& directory) { if (!is_absname(directory)) throw chroot::error(directory, chroot::DIRECTORY_ABS); @@ -94,7 +94,7 @@ namespace sbuild } void - directory_base::set_keyfile (keyfile const& keyfile) + directory_base::set_keyfile (const keyfile& keyfile) { // "directory" should be required, but we also accept "location" as // an alternative (but deprecated) variant. Therefore, ensure by diff --git a/lib/sbuild/chroot/facet/directory-base.h b/lib/sbuild/chroot/facet/directory-base.h index fc770c63..0f054286 100644 --- a/lib/sbuild/chroot/facet/directory-base.h +++ b/lib/sbuild/chroot/facet/directory-base.h @@ -77,7 +77,7 @@ namespace sbuild * @param directory the directory. */ void - set_directory (std::string const& directory); + set_directory (const std::string& directory); virtual void setup_env (environment& env) const; @@ -93,7 +93,7 @@ namespace sbuild get_keyfile (keyfile& keyfile) const; virtual void - set_keyfile (keyfile const& keyfile); + set_keyfile (const keyfile& keyfile); /// The directory to use. std::string directory; diff --git a/lib/sbuild/chroot/facet/facet.cc b/lib/sbuild/chroot/facet/facet.cc index 4c94feab..18f1f55e 100644 --- a/lib/sbuild/chroot/facet/facet.cc +++ b/lib/sbuild/chroot/facet/facet.cc @@ -83,7 +83,7 @@ namespace sbuild } void - facet::set_keyfile (keyfile const& keyfile) + facet::set_keyfile (const keyfile& keyfile) { } diff --git a/lib/sbuild/chroot/facet/facet.h b/lib/sbuild/chroot/facet/facet.h index a3b220ab..d5c25b8b 100644 --- a/lib/sbuild/chroot/facet/facet.h +++ b/lib/sbuild/chroot/facet/facet.h @@ -159,7 +159,7 @@ namespace sbuild * @param keyfile the keyfile to get the properties from. */ virtual void - set_keyfile (keyfile const& keyfile); + set_keyfile (const keyfile& keyfile); protected: /// Chroot owning this facet. @@ -173,8 +173,8 @@ namespace sbuild * @returns result of OR. */ facet::session_flags - inline operator | (facet::session_flags const& lhs, - facet::session_flags const& rhs) + inline operator | (const facet::session_flags& lhs, + const facet::session_flags& rhs) { return static_cast<facet::session_flags> (static_cast<int>(lhs) | static_cast<int>(rhs)); @@ -187,8 +187,8 @@ namespace sbuild * @returns result of AND. */ facet::session_flags - inline operator & (facet::session_flags const& lhs, - facet::session_flags const& rhs) + inline operator & (const facet::session_flags& lhs, + const facet::session_flags& rhs) { return static_cast<facet::session_flags> (static_cast<int>(lhs) & static_cast<int>(rhs)); diff --git a/lib/sbuild/chroot/facet/file.cc b/lib/sbuild/chroot/facet/file.cc index 481d60b2..4cb5e9ae 100644 --- a/lib/sbuild/chroot/facet/file.cc +++ b/lib/sbuild/chroot/facet/file.cc @@ -117,7 +117,7 @@ namespace sbuild } void - file::set_filename (std::string const& filename) + file::set_filename (const std::string& filename) { if (!is_absname(filename)) throw error(filename, chroot::FILE_ABS); @@ -132,7 +132,7 @@ namespace sbuild } void - file::set_location (std::string const& location) + file::set_location (const std::string& location) { if (!location.empty() && !is_absname(location)) throw chroot::error(location, chroot::LOCATION_ABS); @@ -250,7 +250,7 @@ namespace sbuild } void - file::set_keyfile (keyfile const& keyfile) + file::set_keyfile (const keyfile& keyfile) { bool is_session = static_cast<bool>(owner->get_facet<session>()); @@ -271,7 +271,7 @@ namespace sbuild } void - file::chroot_source_setup (chroot const& parent) + file::chroot_source_setup (const chroot& parent) { set_file_repack(true); } diff --git a/lib/sbuild/chroot/facet/file.h b/lib/sbuild/chroot/facet/file.h index b6f61487..f2f8a6e0 100644 --- a/lib/sbuild/chroot/facet/file.h +++ b/lib/sbuild/chroot/facet/file.h @@ -95,7 +95,7 @@ namespace sbuild * @param filename the filename. */ void - set_filename (std::string const& filename); + set_filename (const std::string& filename); /** * Get the location. This is a path to the chroot directory @@ -113,7 +113,7 @@ namespace sbuild * @param location the location. */ virtual void - set_location (std::string const& location); + set_location (const std::string& location); /** * Get the repack status. This is true if the unpacked archive @@ -159,10 +159,10 @@ namespace sbuild get_keyfile (keyfile& keyfile) const; virtual void - set_keyfile (keyfile const& keyfile); + set_keyfile (const keyfile& keyfile); virtual void - chroot_source_setup (chroot const& parent); + chroot_source_setup (const chroot& parent); private: /// The file to use. diff --git a/lib/sbuild/chroot/facet/fsunion.cc b/lib/sbuild/chroot/facet/fsunion.cc index c0acc4c7..1466e9d6 100644 --- a/lib/sbuild/chroot/facet/fsunion.cc +++ b/lib/sbuild/chroot/facet/fsunion.cc @@ -109,7 +109,7 @@ namespace sbuild void fsunion::set_union_overlay_directory - (std::string const& directory) + (const std::string& directory) { if (!is_absname(directory)) throw error(directory, FSUNION_OVERLAY_ABS); @@ -125,7 +125,7 @@ namespace sbuild void fsunion::set_union_underlay_directory - (std::string const& directory) + (const std::string& directory) { if (!is_absname(directory)) throw error(directory, FSUNION_UNDERLAY_ABS); @@ -140,7 +140,7 @@ namespace sbuild } void - fsunion::set_union_type (std::string const& type) + fsunion::set_union_type (const std::string& type) { if (type == "aufs" || type == "overlayfs" || @@ -170,7 +170,7 @@ namespace sbuild void fsunion::set_union_mount_options - (std::string const& union_mount_options) + (const std::string& union_mount_options) { this->union_mount_options = union_mount_options; } @@ -254,7 +254,7 @@ namespace sbuild } void - fsunion::set_keyfile (keyfile const& keyfile) + fsunion::set_keyfile (const keyfile& keyfile) { bool is_session = static_cast<bool>(owner->get_facet<session>()); @@ -285,10 +285,10 @@ namespace sbuild } void - fsunion::chroot_session_setup (chroot const& parent, - std::string const& session_id, - std::string const& alias, - std::string const& user, + fsunion::chroot_session_setup (const chroot& parent, + const std::string& session_id, + const std::string& alias, + const std::string& user, bool root) { // If the parent did not have a union facet, then neither should we. @@ -310,7 +310,7 @@ namespace sbuild } void - fsunion::chroot_source_setup (chroot const& parent) + fsunion::chroot_source_setup (const chroot& parent) { owner->remove_facet<fsunion>(); } diff --git a/lib/sbuild/chroot/facet/fsunion.h b/lib/sbuild/chroot/facet/fsunion.h index e4ffaaf8..333d8338 100644 --- a/lib/sbuild/chroot/facet/fsunion.h +++ b/lib/sbuild/chroot/facet/fsunion.h @@ -110,7 +110,7 @@ namespace sbuild * @param union_type the filesystem type. **/ virtual void - set_union_type (std::string const& union_type); + set_union_type (const std::string& union_type); /** * Get the filesystem union mount options (branch configuration). @@ -134,7 +134,7 @@ namespace sbuild * description **/ virtual void - set_union_mount_options (std::string const& union_mount_options); + set_union_mount_options (const std::string& union_mount_options); /** * Get the union overlay directory. @@ -150,7 +150,7 @@ namespace sbuild * @param directory the writeable overlay directory. */ virtual void - set_union_overlay_directory (std::string const& directory); + set_union_overlay_directory (const std::string& directory); /** * Get the union underlay directory. @@ -166,7 +166,7 @@ namespace sbuild * @param directory the writeable underlay directory. */ virtual void - set_union_underlay_directory (std::string const& directory); + set_union_underlay_directory (const std::string& directory); virtual void setup_env (environment& env) const; @@ -184,17 +184,17 @@ namespace sbuild get_keyfile (keyfile& keyfile) const; virtual void - set_keyfile (keyfile const& keyfile); + set_keyfile (const keyfile& keyfile); virtual void - chroot_session_setup (chroot const& parent, - std::string const& session_id, - std::string const& alias, - std::string const& user, + chroot_session_setup (const chroot& parent, + const std::string& session_id, + const std::string& alias, + const std::string& user, bool root); virtual void - chroot_source_setup (chroot const& parent); + chroot_source_setup (const chroot& parent); private: /// filesystem union type. diff --git a/lib/sbuild/chroot/facet/loopback.cc b/lib/sbuild/chroot/facet/loopback.cc index d02159ec..a6851b5a 100644 --- a/lib/sbuild/chroot/facet/loopback.cc +++ b/lib/sbuild/chroot/facet/loopback.cc @@ -119,7 +119,7 @@ namespace sbuild } void - loopback::set_filename (std::string const& filename) + loopback::set_filename (const std::string& filename) { if (!is_absname(filename)) throw error(filename, chroot::FILE_ABS); @@ -196,7 +196,7 @@ namespace sbuild } void - loopback::set_keyfile (keyfile const& keyfile) + loopback::set_keyfile (const keyfile& keyfile) { keyfile::get_object_value(*this, &loopback::set_filename, keyfile, owner->get_name(), "file", @@ -204,10 +204,10 @@ namespace sbuild } void - loopback::chroot_session_setup (chroot const& parent, - std::string const& session_id, - std::string const& alias, - std::string const& user, + loopback::chroot_session_setup (const chroot& parent, + const std::string& session_id, + const std::string& alias, + const std::string& user, bool root) { // Loopback chroots need the mount device name specifying. diff --git a/lib/sbuild/chroot/facet/loopback.h b/lib/sbuild/chroot/facet/loopback.h index ab8c38a9..26b6c001 100644 --- a/lib/sbuild/chroot/facet/loopback.h +++ b/lib/sbuild/chroot/facet/loopback.h @@ -95,7 +95,7 @@ namespace sbuild * @param filename the filename. */ void - set_filename (std::string const& filename); + set_filename (const std::string& filename); virtual std::string get_path () const; @@ -119,13 +119,13 @@ namespace sbuild get_keyfile (keyfile& keyfile) const; virtual void - set_keyfile (keyfile const& keyfile); + set_keyfile (const keyfile& keyfile); virtual void - chroot_session_setup (chroot const& parent, - std::string const& session_id, - std::string const& alias, - std::string const& user, + chroot_session_setup (const chroot& parent, + const std::string& session_id, + const std::string& alias, + const std::string& user, bool root); private: diff --git a/lib/sbuild/chroot/facet/lvm-snapshot.cc b/lib/sbuild/chroot/facet/lvm-snapshot.cc index 56bd3cb6..bb579636 100644 --- a/lib/sbuild/chroot/facet/lvm-snapshot.cc +++ b/lib/sbuild/chroot/facet/lvm-snapshot.cc @@ -117,7 +117,7 @@ namespace sbuild } void - lvm_snapshot::set_snapshot_device (std::string const& snapshot_device) + lvm_snapshot::set_snapshot_device (const std::string& snapshot_device) { if (!is_absname(snapshot_device)) throw error(snapshot_device, chroot::DEVICE_ABS); @@ -137,7 +137,7 @@ namespace sbuild } void - lvm_snapshot::set_snapshot_options (std::string const& snapshot_options) + lvm_snapshot::set_snapshot_options (const std::string& snapshot_options) { this->snapshot_options = snapshot_options; } @@ -179,7 +179,7 @@ namespace sbuild throw error(get_device(), chroot::DEVICE_NOTBLOCK); } } - catch (sbuild::stat::error const& e) // Failed to stat + catch (const sbuild::stat::error& e) // Failed to stat { // Don't throw if stopping a session and the device stat // failed. This is because the setup scripts shouldn't fail @@ -251,7 +251,7 @@ namespace sbuild } void - lvm_snapshot::set_keyfile (keyfile const& keyfile) + lvm_snapshot::set_keyfile (const keyfile& keyfile) { block_device_base::set_keyfile(keyfile); @@ -271,10 +271,10 @@ namespace sbuild } void - lvm_snapshot::chroot_session_setup (chroot const& parent, - std::string const& session_id, - std::string const& alias, - std::string const& user, + lvm_snapshot::chroot_session_setup (const chroot& parent, + const std::string& session_id, + const std::string& alias, + const std::string& user, bool root) { // LVM devices need the snapshot device name specifying. @@ -287,7 +287,7 @@ namespace sbuild } void - lvm_snapshot::chroot_source_setup (chroot const& parent) + lvm_snapshot::chroot_source_setup (const chroot& parent) { storage::ptr source_block(block_device::create(*this)); owner->replace_facet<storage>(source_block); diff --git a/lib/sbuild/chroot/facet/lvm-snapshot.h b/lib/sbuild/chroot/facet/lvm-snapshot.h index 4ce3128d..d3cdabfc 100644 --- a/lib/sbuild/chroot/facet/lvm-snapshot.h +++ b/lib/sbuild/chroot/facet/lvm-snapshot.h @@ -93,7 +93,7 @@ namespace sbuild * @param snapshot_device the device name. */ void - set_snapshot_device (std::string const& snapshot_device); + set_snapshot_device (const std::string& snapshot_device); /** * Get the logical volume snapshot options. These are used by @@ -111,7 +111,7 @@ namespace sbuild * @param snapshot_options the options. */ void - set_snapshot_options (std::string const& snapshot_options); + set_snapshot_options (const std::string& snapshot_options); virtual void setup_env (environment& env) const; @@ -135,17 +135,17 @@ namespace sbuild get_keyfile (keyfile& keyfile) const; virtual void - set_keyfile (keyfile const& keyfile); + set_keyfile (const keyfile& keyfile); virtual void - chroot_session_setup (chroot const& parent, - std::string const& session_id, - std::string const& alias, - std::string const& user, + chroot_session_setup (const chroot& parent, + const std::string& session_id, + const std::string& alias, + const std::string& user, bool root); virtual void - chroot_source_setup (chroot const& parent); + chroot_source_setup (const chroot& parent); private: /// LVM snapshot device name for lvcreate. diff --git a/lib/sbuild/chroot/facet/mountable.cc b/lib/sbuild/chroot/facet/mountable.cc index 223cb8bc..9b465645 100644 --- a/lib/sbuild/chroot/facet/mountable.cc +++ b/lib/sbuild/chroot/facet/mountable.cc @@ -89,7 +89,7 @@ namespace sbuild } void - mountable::set_mount_device (std::string const& mount_device) + mountable::set_mount_device (const std::string& mount_device) { this->mount_device = mount_device; } @@ -101,7 +101,7 @@ namespace sbuild } void - mountable::set_mount_options (std::string const& mount_options) + mountable::set_mount_options (const std::string& mount_options) { this->mount_options = mount_options; } @@ -113,7 +113,7 @@ namespace sbuild } void - mountable::set_location (std::string const& location) + mountable::set_location (const std::string& location) { if (!location.empty() && !is_absname(location)) throw chroot::error(location, chroot::LOCATION_ABS); @@ -168,7 +168,7 @@ namespace sbuild } void - mountable::set_keyfile (keyfile const& keyfile) + mountable::set_keyfile (const keyfile& keyfile) { bool issession = static_cast<bool>(owner->get_facet<session>()); diff --git a/lib/sbuild/chroot/facet/mountable.h b/lib/sbuild/chroot/facet/mountable.h index 4cc401e7..273af032 100644 --- a/lib/sbuild/chroot/facet/mountable.h +++ b/lib/sbuild/chroot/facet/mountable.h @@ -84,7 +84,7 @@ namespace sbuild * @param mount_device the mount device. */ virtual void - set_mount_device (std::string const& mount_device); + set_mount_device (const std::string& mount_device); /** * Get the filesystem mount options of the chroot block device. @@ -100,7 +100,7 @@ namespace sbuild * @param mount_options the mount options. */ virtual void - set_mount_options (std::string const& mount_options); + set_mount_options (const std::string& mount_options); /** * Get the location. This is a path to the chroot directory @@ -118,7 +118,7 @@ namespace sbuild * @param location the location. */ virtual void - set_location (std::string const& location); + set_location (const std::string& location); virtual void setup_env (environment& env) const; @@ -133,7 +133,7 @@ namespace sbuild get_keyfile (keyfile& keyfile) const; virtual void - set_keyfile (keyfile const& keyfile); + set_keyfile (const keyfile& keyfile); private: /// The device to mount. diff --git a/lib/sbuild/chroot/facet/personality.cc b/lib/sbuild/chroot/facet/personality.cc index bcf62c1d..da19f05a 100644 --- a/lib/sbuild/chroot/facet/personality.cc +++ b/lib/sbuild/chroot/facet/personality.cc @@ -83,7 +83,7 @@ namespace sbuild } void - personality::set_persona (sbuild::personality const& persona) + personality::set_persona (const sbuild::personality& persona) { this->persona = persona; } @@ -112,7 +112,7 @@ namespace sbuild } void - personality::set_keyfile (keyfile const& keyfile) + personality::set_keyfile (const keyfile& keyfile) { keyfile::get_object_value(*this, &personality::set_persona, keyfile, owner->get_name(), "personality", diff --git a/lib/sbuild/chroot/facet/personality.h b/lib/sbuild/chroot/facet/personality.h index 19f3ffe8..8dd28332 100644 --- a/lib/sbuild/chroot/facet/personality.h +++ b/lib/sbuild/chroot/facet/personality.h @@ -77,7 +77,7 @@ namespace sbuild * @param persona the personality. */ void - set_persona (sbuild::personality const& persona); + set_persona (const sbuild::personality& persona); virtual void get_details (format_detail& detail) const; @@ -89,7 +89,7 @@ namespace sbuild get_keyfile (keyfile& keyfile) const; virtual void - set_keyfile (keyfile const& keyfile); + set_keyfile (const keyfile& keyfile); private: /// Process execution domain (Linux only). diff --git a/lib/sbuild/chroot/facet/session-clonable.cc b/lib/sbuild/chroot/facet/session-clonable.cc index deee34e5..e5cc05e2 100644 --- a/lib/sbuild/chroot/facet/session-clonable.cc +++ b/lib/sbuild/chroot/facet/session-clonable.cc @@ -84,9 +84,9 @@ namespace sbuild } chroot::ptr - session_clonable::clone_session (std::string const& session_id, - std::string const& alias, - std::string const& user, + session_clonable::clone_session (const std::string& session_id, + const std::string& alias, + const std::string& user, bool root) const { chroot::ptr clone = owner->clone(); diff --git a/lib/sbuild/chroot/facet/session-clonable.h b/lib/sbuild/chroot/facet/session-clonable.h index 9ed1ccc2..6f830cd9 100644 --- a/lib/sbuild/chroot/facet/session-clonable.h +++ b/lib/sbuild/chroot/facet/session-clonable.h @@ -79,9 +79,9 @@ namespace sbuild * @returns a session chroot. */ virtual chroot::ptr - clone_session (std::string const& session_id, - std::string const& alias, - std::string const& user, + clone_session (const std::string& session_id, + const std::string& alias, + const std::string& user, bool root) const; }; diff --git a/lib/sbuild/chroot/facet/session-setup.h b/lib/sbuild/chroot/facet/session-setup.h index 7451f48f..6cbff2d4 100644 --- a/lib/sbuild/chroot/facet/session-setup.h +++ b/lib/sbuild/chroot/facet/session-setup.h @@ -65,10 +65,10 @@ namespace sbuild * @param root true if the user has root access, otherwise false. */ virtual void - chroot_session_setup (chroot const& parent, - std::string const& session_id, - std::string const& alias, - std::string const& user, + chroot_session_setup (const chroot& parent, + const std::string& session_id, + const std::string& alias, + const std::string& user, bool root) = 0; }; diff --git a/lib/sbuild/chroot/facet/session.cc b/lib/sbuild/chroot/facet/session.cc index 7a8a8dc6..25718223 100644 --- a/lib/sbuild/chroot/facet/session.cc +++ b/lib/sbuild/chroot/facet/session.cc @@ -96,7 +96,7 @@ namespace sbuild } void - session::set_original_name (std::string const& name) + session::set_original_name (const std::string& name) { this->original_chroot_name = name; this->selected_chroot_name = name; @@ -109,7 +109,7 @@ namespace sbuild } void - session::set_selected_name (std::string const& name) + session::set_selected_name (const std::string& name) { std::string ns, shortname; config::get_namespace(name, ns, shortname); @@ -142,7 +142,7 @@ namespace sbuild { lock.set_lock(lock::LOCK_EXCLUSIVE, 2); } - catch (lock::error const& e) + catch (const lock::error& e) { throw error(file, chroot::FILE_LOCK, e); } @@ -155,7 +155,7 @@ namespace sbuild { lock.unset_lock(); } - catch (lock::error const& e) + catch (const lock::error& e) { throw error(file, chroot::FILE_UNLOCK, e); } @@ -215,7 +215,7 @@ namespace sbuild } void - session::set_keyfile (keyfile const& keyfile) + session::set_keyfile (const keyfile& keyfile) { keyfile::get_object_value(*this, &session::set_original_name, keyfile, owner->get_name(), diff --git a/lib/sbuild/chroot/facet/session.h b/lib/sbuild/chroot/facet/session.h index b19bb621..d3f5a172 100644 --- a/lib/sbuild/chroot/facet/session.h +++ b/lib/sbuild/chroot/facet/session.h @@ -85,7 +85,7 @@ namespace sbuild * @param name the name. */ void - set_original_name (std::string const& name); + set_original_name (const std::string& name); /** * Get the selected name of the chroot (alias used). @@ -101,7 +101,7 @@ namespace sbuild * @param name the name. */ void - set_selected_name (std::string const& name); + set_selected_name (const std::string& name); /** * Set up persistent session information. @@ -124,7 +124,7 @@ namespace sbuild get_keyfile (keyfile& keyfile) const; virtual void - set_keyfile (keyfile const& keyfile); + set_keyfile (const keyfile& keyfile); private: /// Original chroot name prior to session cloning. diff --git a/lib/sbuild/chroot/facet/source-clonable.cc b/lib/sbuild/chroot/facet/source-clonable.cc index 149c9c8a..7c316d37 100644 --- a/lib/sbuild/chroot/facet/source-clonable.cc +++ b/lib/sbuild/chroot/facet/source-clonable.cc @@ -105,7 +105,7 @@ namespace sbuild } void - source_clonable::set_source_users (string_list const& source_users) + source_clonable::set_source_users (const string_list& source_users) { this->source_users = source_users; } @@ -117,7 +117,7 @@ namespace sbuild } void - source_clonable::set_source_groups (string_list const& source_groups) + source_clonable::set_source_groups (const string_list& source_groups) { this->source_groups = source_groups; } @@ -129,7 +129,7 @@ namespace sbuild } void - source_clonable::set_source_root_users (string_list const& users) + source_clonable::set_source_root_users (const string_list& users) { this->source_root_users = users; } @@ -141,7 +141,7 @@ namespace sbuild } void - source_clonable::set_source_root_groups (string_list const& groups) + source_clonable::set_source_root_groups (const string_list& groups) { this->source_root_groups = groups; } @@ -201,7 +201,7 @@ namespace sbuild } void - source_clonable::set_keyfile (keyfile const& keyfile) + source_clonable::set_keyfile (const keyfile& keyfile) { keyfile::get_object_value(*this, &source_clonable::set_source_clone, keyfile, owner->get_name(), diff --git a/lib/sbuild/chroot/facet/source-clonable.h b/lib/sbuild/chroot/facet/source-clonable.h index aeb4169c..471235e4 100644 --- a/lib/sbuild/chroot/facet/source-clonable.h +++ b/lib/sbuild/chroot/facet/source-clonable.h @@ -107,7 +107,7 @@ namespace sbuild * @param users a list of users. */ virtual void - set_source_users (string_list const& users); + set_source_users (const string_list& users); /** * Get the groups allowed to access the source chroot. @@ -123,7 +123,7 @@ namespace sbuild * @param groups a list of groups. */ virtual void - set_source_groups (string_list const& groups); + set_source_groups (const string_list& groups); /** * Get the users allowed to access the source chroot as root. @@ -143,7 +143,7 @@ namespace sbuild * @param users a list of users. */ virtual void - set_source_root_users (string_list const& users); + set_source_root_users (const string_list& users); /** * Get the groups allowed to access the source chroot as root. @@ -163,7 +163,7 @@ namespace sbuild * @param groups a list of groups. */ virtual void - set_source_root_groups (string_list const& groups); + set_source_root_groups (const string_list& groups); virtual session_flags get_session_flags () const; @@ -178,7 +178,7 @@ namespace sbuild get_keyfile (keyfile& keyfile) const; virtual void - set_keyfile (keyfile const& keyfile); + set_keyfile (const keyfile& keyfile); private: /// Is source chroot cloning permitted? diff --git a/lib/sbuild/chroot/facet/source-setup.h b/lib/sbuild/chroot/facet/source-setup.h index 00443f9a..ca5a3300 100644 --- a/lib/sbuild/chroot/facet/source-setup.h +++ b/lib/sbuild/chroot/facet/source-setup.h @@ -61,7 +61,7 @@ namespace sbuild * @param parent the parent of the cloned chroot. */ virtual void - chroot_source_setup (chroot const& parent) = 0; + chroot_source_setup (const chroot& parent) = 0; }; diff --git a/lib/sbuild/chroot/facet/unshare.cc b/lib/sbuild/chroot/facet/unshare.cc index 24b441f8..6898e939 100644 --- a/lib/sbuild/chroot/facet/unshare.cc +++ b/lib/sbuild/chroot/facet/unshare.cc @@ -223,7 +223,7 @@ namespace sbuild } void - unshare::set_keyfile (keyfile const& keyfile) + unshare::set_keyfile (const keyfile& keyfile) { keyfile::get_object_value(*this, &unshare::set_unshare_net, keyfile, owner->get_name(), "unshare.net", diff --git a/lib/sbuild/chroot/facet/unshare.h b/lib/sbuild/chroot/facet/unshare.h index 08a62d70..06bf2de2 100644 --- a/lib/sbuild/chroot/facet/unshare.h +++ b/lib/sbuild/chroot/facet/unshare.h @@ -154,7 +154,7 @@ namespace sbuild get_keyfile (keyfile& keyfile) const; virtual void - set_keyfile (keyfile const& keyfile); + set_keyfile (const keyfile& keyfile); private: /// Unshare networking. diff --git a/lib/sbuild/chroot/facet/userdata.cc b/lib/sbuild/chroot/facet/userdata.cc index 7c91700e..ea3bbb70 100644 --- a/lib/sbuild/chroot/facet/userdata.cc +++ b/lib/sbuild/chroot/facet/userdata.cc @@ -40,7 +40,7 @@ namespace sbuild { bool - validate_keyname(std::string const& key) + validate_keyname(const std::string& key) { // Valid names consist of one (or more) namespaces which consist // of [a-z][a-z0-9] followed by a . (namespace separator). The @@ -59,7 +59,7 @@ namespace sbuild } std::string - envname(std::string const& key) + envname(const std::string& key) { std::string ret(key); @@ -192,7 +192,7 @@ namespace sbuild } bool - userdata::get_data (std::string const& key, + userdata::get_data (const std::string& key, std::string& value) const { string_map::const_iterator pos = this->data.find(key); @@ -203,8 +203,8 @@ namespace sbuild } void - userdata::set_system_data (std::string const& key, - std::string const& value) + userdata::set_system_data (const std::string& key, + const std::string& value) { string_map::const_iterator inserted = data.find(key); if (inserted == data.end()) // Requires uniqueness checking. @@ -228,14 +228,14 @@ namespace sbuild } void - userdata::remove_data (std::string const& key) + userdata::remove_data (const std::string& key) { this->data.erase(key); } void - userdata::set_data (std::string const& key, - std::string const& value) + userdata::set_data (const std::string& key, + const std::string& value) { if (!validate_keyname(key)) throw error(key, KEYNAME_INVALID); @@ -244,20 +244,20 @@ namespace sbuild } void - userdata::set_data (string_map const& data) + userdata::set_data (const string_map& data) { for (const auto& elem : data) set_data(elem.first, elem.second); } void - userdata::set_user_data(string_map const& data) + userdata::set_user_data(const string_map& data) { set_data(data, this->user_modifiable_keys, false); } void - userdata::set_root_data(string_map const& data) + userdata::set_root_data(const string_map& data) { // root can use both user and root keys, so combine the sets. string_set modifiable_keys; @@ -270,15 +270,15 @@ namespace sbuild } void - userdata::set_system_data(string_map const& data) + userdata::set_system_data(const string_map& data) { for (const auto& elem : data) set_system_data(elem.first, elem.second); } void - userdata::set_data(string_map const& data, - string_set const& allowed_keys, + userdata::set_data(const string_map& data, + const string_set& allowed_keys, bool root) { // Require the key to be present in order to set it. This ensures @@ -322,7 +322,7 @@ namespace sbuild } void - userdata::set_user_modifiable_keys (string_set const& keys) + userdata::set_user_modifiable_keys (const string_set& keys) { this->user_modifiable_keys = keys; } @@ -334,7 +334,7 @@ namespace sbuild } void - userdata::set_root_modifiable_keys (string_set const& keys) + userdata::set_root_modifiable_keys (const string_set& keys) { this->root_modifiable_keys = keys; } @@ -368,7 +368,7 @@ namespace sbuild } void - userdata::set_keyfile (keyfile const& keyfile) + userdata::set_keyfile (const keyfile& keyfile) { keyfile::get_object_set_value(*this, &userdata::set_user_modifiable_keys, @@ -388,7 +388,7 @@ namespace sbuild // overridden by the user on the commandline. { string_list used_keys = owner->get_used_keys(); - std::string const& group = owner->get_name(); + const std::string& group = owner->get_name(); const string_list total(keyfile.get_keys(group)); const string_set a(total.begin(), total.end()); @@ -414,7 +414,7 @@ namespace sbuild if (keyfile.get_value(get_name(), elem, value)) set_data(elem, value); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { keyfile::size_type line = keyfile.get_line(group, elem); keyfile::error w(line, group, elem, @@ -422,7 +422,7 @@ namespace sbuild try { - sbuild::error_base const& r = + const sbuild::error_base& r = dynamic_cast<sbuild::error_base const&>(e); w.set_reason(r.get_reason()); } diff --git a/lib/sbuild/chroot/facet/userdata.h b/lib/sbuild/chroot/facet/userdata.h index 56a2c9f4..8bbe6bf0 100644 --- a/lib/sbuild/chroot/facet/userdata.h +++ b/lib/sbuild/chroot/facet/userdata.h @@ -93,12 +93,12 @@ namespace sbuild get_keyfile (keyfile& keyfile) const; virtual void - set_keyfile (keyfile const& keyfile); + set_keyfile (const keyfile& keyfile); template <typename T> bool - get_value (std::string const& key, + get_value (const std::string& key, T& value) const { log_debug(DEBUG_INFO) << "Getting userdata key=" << key << std::endl; @@ -110,7 +110,7 @@ namespace sbuild parse_value(found_item->second, value); return true; } - catch (parse_value_error const& e) + catch (const parse_value_error& e) { error ep(key, PARSE_ERROR, e); log_exception_warning(ep); @@ -137,7 +137,7 @@ namespace sbuild * @returns true if found, false if not found. */ bool - get_data (std::string const& key, + get_data (const std::string& key, std::string& value) const; /** @@ -147,7 +147,7 @@ namespace sbuild * @param data the user data to set. */ void - set_data (string_map const& data); + set_data (const string_map& data); /** * Set a single key-value pair. Note that this method does not @@ -157,8 +157,8 @@ namespace sbuild * @param value the value of the key. */ void - set_data (std::string const& key, - std::string const& value); + set_data (const std::string& key, + const std::string& value); /** * Set a single key-value pair. Note that this method does not @@ -168,8 +168,8 @@ namespace sbuild * @param value the value of the key. */ void - set_system_data (std::string const& key, - std::string const& value); + set_system_data (const std::string& key, + const std::string& value); /** * Remove a single key. If present, the specified key is removed. @@ -177,7 +177,7 @@ namespace sbuild * @param key the key to remove. */ void - remove_data (std::string const& key); + remove_data (const std::string& key); /** * Get the set of keys allowed to be modified by a user. @@ -193,7 +193,7 @@ namespace sbuild * @param keys a string set of keys. */ void - set_user_modifiable_keys (string_set const& keys); + set_user_modifiable_keys (const string_set& keys); /** * Get the set of keys allowed to be modified by root. @@ -209,7 +209,7 @@ namespace sbuild * @param keys a string set of keys. */ void - set_root_modifiable_keys (string_set const& keys); + set_root_modifiable_keys (const string_set& keys); /** * Set data for the current user. Only keys set using @@ -219,7 +219,7 @@ namespace sbuild * @param string_map a map of key-value pairs. */ void - set_user_data(string_map const& data); + set_user_data(const string_map& data); /** * Set data for root. Only keys set using @@ -229,7 +229,7 @@ namespace sbuild * @param data a map of key-value pairs. */ void - set_root_data(string_map const& data); + set_root_data(const string_map& data); /** * Set data without user or root checks. @@ -237,7 +237,7 @@ namespace sbuild * @param string_map a map of key-value pairs. */ void - set_system_data(string_map const& data); + set_system_data(const string_map& data); private: /** @@ -248,8 +248,8 @@ namespace sbuild * @param root whether or not the user is the root user. */ void - set_data(string_map const& data, - string_set const& allowed_keys, + set_data(const string_map& data, + const string_set& allowed_keys, bool root); /// Mapping between user keys and values. diff --git a/lib/sbuild/custom-error.h b/lib/sbuild/custom-error.h index 23ef9f16..effa8ced 100644 --- a/lib/sbuild/custom-error.h +++ b/lib/sbuild/custom-error.h @@ -184,7 +184,7 @@ namespace sbuild * * @param error the error. */ - custom_error (std::runtime_error const& error): + custom_error (const std::runtime_error& error): sbuild::error<T>(sbuild::error<T>::format_error(nullptr, nullptr, nullptr, error, nullptr, nullptr, nullptr), sbuild::error<T>::format_reason(nullptr, nullptr, nullptr, error, nullptr, nullptr, nullptr)) { @@ -195,7 +195,7 @@ namespace sbuild * * @param error the error. */ - custom_error (error_base const& error): + custom_error (const error_base& error): sbuild::error<T>(sbuild::error<T>::format_error(nullptr, nullptr, nullptr, error, nullptr, nullptr, nullptr), sbuild::error<T>::format_reason(nullptr, nullptr, nullptr, error, nullptr, nullptr, nullptr)) { @@ -209,7 +209,7 @@ namespace sbuild */ template<typename C> custom_error (C const& context, - std::runtime_error const& error): + const std::runtime_error& error): sbuild::error<T>(sbuild::error<T>::format_error(context, nullptr, nullptr, error, nullptr, nullptr, nullptr), sbuild::error<T>::format_reason(context, nullptr, nullptr, error, nullptr, nullptr, nullptr)) { @@ -223,7 +223,7 @@ namespace sbuild */ template<typename C> custom_error (C const& context, - error_base const& error): + const error_base& error): sbuild::error<T>(sbuild::error<T>::format_error(context, nullptr, nullptr, error, nullptr, nullptr, nullptr), sbuild::error<T>::format_reason(context, nullptr, nullptr, error, nullptr, nullptr, nullptr)) { diff --git a/lib/sbuild/environment.cc b/lib/sbuild/environment.cc index cd7f5599..b5d758f3 100644 --- a/lib/sbuild/environment.cc +++ b/lib/sbuild/environment.cc @@ -44,7 +44,7 @@ namespace sbuild } void - environment::set_filter (regex const& filter) + environment::set_filter (const regex& filter) { this->filter = filter; } @@ -66,14 +66,14 @@ namespace sbuild } void - environment::add (environment const& environment) + environment::add (const environment& environment) { for (const auto& env : environment) add(env); } void - environment::add (std::string const& value) + environment::add (const std::string& value) { std::string::size_type pos = value.find('='); if (pos != std::string::npos && pos != 0) @@ -91,7 +91,7 @@ namespace sbuild } void - environment::add (value_type const& value) + environment::add (const value_type& value) { remove(value); if (!value.first.empty() && !value.second.empty()) @@ -121,14 +121,14 @@ namespace sbuild } void - environment::remove (environment const& environment) + environment::remove (const environment& environment) { for (const auto& env : environment) remove(env); } void - environment::remove (std::string const& value) + environment::remove (const std::string& value) { std::string::size_type pos = value.find('='); if (pos != std::string::npos && pos != 0) @@ -146,7 +146,7 @@ namespace sbuild } void - environment::remove (value_type const& value) + environment::remove (const value_type& value) { iterator pos = find(value.first); if (pos != end()) diff --git a/lib/sbuild/environment.h b/lib/sbuild/environment.h index dea09091..de1234d4 100644 --- a/lib/sbuild/environment.h +++ b/lib/sbuild/environment.h @@ -64,7 +64,7 @@ namespace sbuild * @param filter the filter regex. */ void - set_filter (regex const& filter); + set_filter (const regex& filter); /** * Get environment filter. @@ -91,7 +91,7 @@ namespace sbuild * @param environment the environment variables to add. */ void - add (environment const& environment); + add (const environment& environment); /** * Add environment variable. Any existing variable sharing the @@ -100,7 +100,7 @@ namespace sbuild * @param value the environment variable to add. */ void - add (value_type const& value); + add (const value_type& value); /** * Add environment variable. Any existing variable sharing the @@ -110,8 +110,8 @@ namespace sbuild * @param value the environment variable value to add. */ void - add (std::string const& name, - std::string const& value) + add (const std::string& name, + const std::string& value) { add(std::make_pair(name, value)); } @@ -125,7 +125,7 @@ namespace sbuild */ template<typename T> void - add (std::string const& name, + add (const std::string& name, T const& value) { std::ostringstream varstring; @@ -142,7 +142,7 @@ namespace sbuild * in the form key=value. */ void - add (std::string const& value); + add (const std::string& value); /** * Remove environment variables. Any variables sharing the names @@ -161,7 +161,7 @@ namespace sbuild * @param environment the environment variables to remove. */ void - remove (environment const& environment); + remove (const environment& environment); /** * Remove environment variable. Any variable sharing the name @@ -170,7 +170,7 @@ namespace sbuild * @param value the environment variable to remove. */ void - remove (std::string const& value); + remove (const std::string& value); /** * Remove environment variable. Any variable sharing the name @@ -179,7 +179,7 @@ namespace sbuild * @param value the environment variable to remove. */ void - remove (value_type const& value); + remove (const value_type& value); /** * Get the value of an environment variable. @@ -191,7 +191,7 @@ namespace sbuild */ template <typename T> bool - get (std::string const& name, + get (const std::string& name, T& value) const { log_debug(DEBUG_INFO) << "Getting environment variable=" << name @@ -204,7 +204,7 @@ namespace sbuild parse_value(pos->second, value); return true; } - catch (parse_value_error const& e) + catch (const parse_value_error& e) { log_warning() << boost::format("%1%: %2%\n") % name % e.what(); @@ -262,7 +262,7 @@ namespace sbuild */ template <typename T> friend environment - operator + (environment const& lhs, + operator + (const environment& lhs, T const& rhs) { environment ret(lhs); @@ -279,7 +279,7 @@ namespace sbuild */ template <typename T> friend environment - operator - (environment const& lhs, + operator - (const environment& lhs, T const& rhs) { environment ret(lhs); @@ -298,7 +298,7 @@ namespace sbuild friend std::basic_ostream<charT,traits>& operator << (std::basic_ostream<charT,traits>& stream, - environment const& rhs) + const environment& rhs) { for (const auto& env : rhs) { diff --git a/lib/sbuild/error.h b/lib/sbuild/error.h index 7408b27f..d1a4526b 100644 --- a/lib/sbuild/error.h +++ b/lib/sbuild/error.h @@ -41,7 +41,7 @@ namespace sbuild * * @param error the error message. */ - error_base(std::string const& error): + error_base(const std::string& error): runtime_error(error), reason() { @@ -53,8 +53,8 @@ namespace sbuild * @param error the error message. * @param reason further information about the error */ - error_base(std::string const& error, - std::string const& reason): + error_base(const std::string& error, + const std::string& reason): runtime_error(error), reason(reason) { @@ -93,7 +93,7 @@ namespace sbuild * @param reason further information about the error */ void - set_reason (std::string const& reason) + set_reason (const std::string& reason) { this->reason = reason; } @@ -120,7 +120,7 @@ namespace sbuild * * @param error the error message. */ - error(std::string const& error): + error(const std::string& error): error_base(error) { } @@ -131,8 +131,8 @@ namespace sbuild * @param error the error message. * @param reason further information about the error */ - error(std::string const& error, - std::string const& reason): + error(const std::string& error, + const std::string& reason): error_base(error, reason) { } @@ -199,7 +199,7 @@ namespace sbuild format_error (A const& context1, B const& context2, C const& context3, - std::runtime_error const& error, + const std::runtime_error& error, D const& detail1, E const& detail2, F const& detail3); @@ -236,7 +236,7 @@ namespace sbuild */ static void add_detail(boost::format& fmt, - std::nullptr_t const& value); + const std::nullptr_t& value); /** * Add detail to format string. @@ -337,12 +337,12 @@ namespace sbuild { try { - sbuild::error_base const& eb(dynamic_cast<sbuild::error_base const&>(value)); + const sbuild::error_base& eb(dynamic_cast<sbuild::error_base const&>(value)); if (!reason.empty()) reason += '\n'; reason += eb.why(); } - catch (std::bad_cast const& discard) + catch (const std::bad_cast& discard) { } } diff --git a/lib/sbuild/error.tcc b/lib/sbuild/error.tcc index 107ccf84..ca1b9c63 100644 --- a/lib/sbuild/error.tcc +++ b/lib/sbuild/error.tcc @@ -133,7 +133,7 @@ inline std::string sbuild::error<T>::format_error (A const& context1, B const& context2, C const& context3, - std::runtime_error const& error, + const std::runtime_error& error, D const& detail1, E const& detail2, F const& detail3) @@ -210,7 +210,7 @@ sbuild::error<T>::format_error (A const& context1, template<typename T> inline void sbuild::error<T>::add_detail(boost::format& fmt, - std::nullptr_t const& value) + const std::nullptr_t& value) { // Current versions of boost::format don't like being passed // nullptr. Hence this specialisation. diff --git a/lib/sbuild/feature.cc b/lib/sbuild/feature.cc index d1583e8f..e414b16f 100644 --- a/lib/sbuild/feature.cc +++ b/lib/sbuild/feature.cc @@ -26,8 +26,8 @@ namespace sbuild { - feature::feature(std::string const& feature, - std::string const& description) + feature::feature(const std::string& feature, + const std::string& description) { registered_features().insert(std::make_pair(feature, description)); } diff --git a/lib/sbuild/feature.h b/lib/sbuild/feature.h index 473eff53..a4d43841 100644 --- a/lib/sbuild/feature.h +++ b/lib/sbuild/feature.h @@ -31,8 +31,8 @@ namespace sbuild class feature { public: - feature (std::string const& feature, - std::string const& description); + feature (const std::string& feature, + const std::string& description); ~feature (); diff --git a/lib/sbuild/format-detail.cc b/lib/sbuild/format-detail.cc index eda875c7..2249ff85 100644 --- a/lib/sbuild/format-detail.cc +++ b/lib/sbuild/format-detail.cc @@ -27,7 +27,7 @@ namespace sbuild { - format_detail::format_detail (std::string const& title, + format_detail::format_detail (const std::string& title, std::locale locale): title(title), locale(locale), @@ -40,8 +40,8 @@ namespace sbuild } format_detail& - format_detail::add (std::string const& name, - std::string const& value) + format_detail::add (const std::string& name, + const std::string& value) { for (const auto& item : this->items) { @@ -63,7 +63,7 @@ namespace sbuild } format_detail& - format_detail::add (std::string const& name, + format_detail::add (const std::string& name, bool value) { const char *desc = 0; @@ -76,8 +76,8 @@ namespace sbuild } format_detail& - format_detail::add (std::string const& name, - string_list const& value) + format_detail::add (const std::string& name, + const string_list& value) { return add(name, string_list_to_string(value, " ")); } diff --git a/lib/sbuild/format-detail.h b/lib/sbuild/format-detail.h index 66e477ad..ebc1a5a5 100644 --- a/lib/sbuild/format-detail.h +++ b/lib/sbuild/format-detail.h @@ -57,8 +57,8 @@ namespace sbuild * @returns a reference to the format_detail object. */ format_detail& - add (std::string const& name, - std::string const& value); + add (const std::string& name, + const std::string& value); /** * Add a name-value pair (bool specialisation). @@ -68,7 +68,7 @@ namespace sbuild * @returns a reference to the format_detail object. */ format_detail& - add (std::string const& name, + add (const std::string& name, bool value); /** @@ -79,8 +79,8 @@ namespace sbuild * @returns a reference to the format_detail object. */ format_detail& - add (std::string const& name, - string_list const& value); + add (const std::string& name, + const string_list& value); /** * Add a name-value pair. @@ -91,7 +91,7 @@ namespace sbuild */ template<typename T> format_detail& - add (std::string const& name, + add (const std::string& name, T const& value) { std::ostringstream varstring; @@ -121,7 +121,7 @@ namespace sbuild friend std::basic_ostream<charT,traits>& operator << (std::basic_ostream<charT,traits>& stream, - format_detail const& rhs) + const format_detail& rhs) { std::locale loc = stream.getloc(); int max_width = 0; diff --git a/lib/sbuild/i18n.h b/lib/sbuild/i18n.h index 37678a33..a9fa9894 100644 --- a/lib/sbuild/i18n.h +++ b/lib/sbuild/i18n.h @@ -65,7 +65,7 @@ namespace sbuild * @returns the translated message. */ inline const char * - gettext (std::string const& message) + gettext (const std::string& message) { return gettext(message.c_str()); } diff --git a/lib/sbuild/keyfile-reader.cc b/lib/sbuild/keyfile-reader.cc index ec62c596..5c0fae01 100644 --- a/lib/sbuild/keyfile-reader.cc +++ b/lib/sbuild/keyfile-reader.cc @@ -39,7 +39,7 @@ namespace sbuild {} keyfile_reader::keyfile_reader (keyfile& store, - std::string const& file): + const std::string& file): keyfile_reader(store) { std::ifstream fs(file.c_str()); @@ -109,7 +109,7 @@ namespace sbuild } void - keyfile_reader::parse_line (std::string const& line) + keyfile_reader::parse_line (const std::string& line) { if (comment_set == true) { diff --git a/lib/sbuild/keyfile-reader.h b/lib/sbuild/keyfile-reader.h index 59d552ef..aabc990a 100644 --- a/lib/sbuild/keyfile-reader.h +++ b/lib/sbuild/keyfile-reader.h @@ -49,7 +49,7 @@ namespace sbuild * @param file the file to load the configuration from. */ keyfile_reader (keyfile& store, - std::string const& file); + const std::string& file); /** * The constructor. @@ -91,7 +91,7 @@ namespace sbuild * @param line the line to parse. */ virtual void - parse_line (std::string const& line); + parse_line (const std::string& line); /** * Stop processing input. Any cleanup may be done here. For diff --git a/lib/sbuild/keyfile-writer.cc b/lib/sbuild/keyfile-writer.cc index c00ca000..9a25b17c 100644 --- a/lib/sbuild/keyfile-writer.cc +++ b/lib/sbuild/keyfile-writer.cc @@ -25,12 +25,12 @@ namespace sbuild { - keyfile_writer::keyfile_writer(keyfile const& store): + keyfile_writer::keyfile_writer(const keyfile& store): store(store) {} - keyfile_writer::keyfile_writer (keyfile const& store, - std::string const& file): + keyfile_writer::keyfile_writer (const keyfile& store, + const std::string& file): keyfile_writer(store) { std::ofstream fs(file.c_str()); @@ -45,7 +45,7 @@ namespace sbuild } } - keyfile_writer::keyfile_writer (keyfile const& store, + keyfile_writer::keyfile_writer (const keyfile& store, std::ostream& stream): keyfile_writer(store) { @@ -88,7 +88,7 @@ namespace sbuild } void - sbuild::keyfile_writer::print_comment (keyfile::comment_type const& comment, + sbuild::keyfile_writer::print_comment (const keyfile::comment_type& comment, std::ostream& stream) { std::string::size_type last_pos = 0; diff --git a/lib/sbuild/keyfile-writer.h b/lib/sbuild/keyfile-writer.h index 5e6f14b3..6f208072 100644 --- a/lib/sbuild/keyfile-writer.h +++ b/lib/sbuild/keyfile-writer.h @@ -40,7 +40,7 @@ namespace sbuild * * @param store the keyfile to operate with. */ - keyfile_writer(keyfile const& store); + keyfile_writer(const keyfile& store); /** * The constructor. @@ -48,8 +48,8 @@ namespace sbuild * @param store the keyfile to operate with. * @param file the file to load the configuration from. */ - keyfile_writer (keyfile const& store, - std::string const& file); + keyfile_writer (const keyfile& store, + const std::string& file); /** * The constructor. @@ -57,7 +57,7 @@ namespace sbuild * @param store the keyfile to operate with. * @param stream the stream to load the configuration from. */ - keyfile_writer (keyfile const& store, + keyfile_writer (const keyfile& store, std::ostream& stream); /// The destructor. @@ -74,7 +74,7 @@ namespace sbuild protected: /// The keyfile to operate with. - keyfile const& store; + const keyfile& store; /** * Print a comment to a stream. The comment will have hash ('#') @@ -88,7 +88,7 @@ namespace sbuild * log_exception_* functions and split_string. */ static void - print_comment (keyfile::comment_type const& comment, + print_comment (const keyfile::comment_type& comment, std::ostream& stream); /** @@ -101,7 +101,7 @@ namespace sbuild friend std::ostream& operator << (std::ostream& stream, - keyfile_writer const& kp) + const keyfile_writer& kp) { kp.write_stream(stream); return stream; diff --git a/lib/sbuild/keyfile.cc b/lib/sbuild/keyfile.cc index cd648ab7..b5804b43 100644 --- a/lib/sbuild/keyfile.cc +++ b/lib/sbuild/keyfile.cc @@ -152,14 +152,14 @@ namespace sbuild } sbuild::keyfile::key_list - sbuild::keyfile::get_keys (group_name_type const& group) const + sbuild::keyfile::get_keys (const group_name_type& group) const { key_list ret; const group_type *found_group = find_group(group); if (found_group) { - item_map_type const& items(std::get<1>(*found_group)); + const item_map_type& items(std::get<1>(*found_group)); for (const auto& item : items) ret.push_back(item.first); } @@ -168,8 +168,8 @@ namespace sbuild } void - sbuild::keyfile::check_keys (group_name_type const& group, - key_list const& keys) const + sbuild::keyfile::check_keys (const group_name_type& group, + const key_list& keys) const { const string_list total(get_keys(group)); @@ -192,28 +192,28 @@ namespace sbuild } bool - sbuild::keyfile::has_group (group_name_type const& group) const + sbuild::keyfile::has_group (const group_name_type& group) const { return (find_group(group) != 0); } bool - sbuild::keyfile::has_key (group_name_type const& group, - key_type const& key) const + sbuild::keyfile::has_key (const group_name_type& group, + const key_type& key) const { return (find_item(group, key) != 0); } void - sbuild::keyfile::set_group (group_name_type const& group, - comment_type const& comment) + sbuild::keyfile::set_group (const group_name_type& group, + const comment_type& comment) { set_group(group, comment, 0); } void - sbuild::keyfile::set_group (group_name_type const& group, - comment_type const& comment, + sbuild::keyfile::set_group (const group_name_type& group, + const comment_type& comment, size_type line) { if (!has_group(group)) @@ -226,7 +226,7 @@ namespace sbuild } sbuild::keyfile::comment_type - sbuild::keyfile::get_comment (group_name_type const& group) const + sbuild::keyfile::get_comment (const group_name_type& group) const { const group_type *found_group = find_group(group); if (found_group) @@ -236,8 +236,8 @@ namespace sbuild } sbuild::keyfile::comment_type - sbuild::keyfile::get_comment (group_name_type const& group, - key_type const& key) const + sbuild::keyfile::get_comment (const group_name_type& group, + const key_type& key) const { const item_type *found_item = find_item(group, key); if (found_item) @@ -247,7 +247,7 @@ namespace sbuild } sbuild::keyfile::size_type - sbuild::keyfile::get_line (group_name_type const& group) const + sbuild::keyfile::get_line (const group_name_type& group) const { const group_type *found_group = find_group(group); if (found_group) @@ -257,8 +257,8 @@ namespace sbuild } sbuild::keyfile::size_type - sbuild::keyfile::get_line (group_name_type const& group, - key_type const& key) const + sbuild::keyfile::get_line (const group_name_type& group, + const key_type& key) const { const item_type *found_item = find_item(group, key); if (found_item) @@ -268,8 +268,8 @@ namespace sbuild } bool - sbuild::keyfile::get_locale_string (group_name_type const& group, - key_type const& key, + sbuild::keyfile::get_locale_string (const group_name_type& group, + const key_type& key, value_type& value) const { std::string localename; @@ -277,7 +277,7 @@ namespace sbuild { localename = std::locale("").name(); } - catch (std::runtime_error const& e) // Invalid locale + catch (const std::runtime_error& e) // Invalid locale { localename = std::locale::classic().name(); } @@ -305,8 +305,8 @@ namespace sbuild } bool - sbuild::keyfile::get_locale_string (group_name_type const& group, - key_type const& key, + sbuild::keyfile::get_locale_string (const group_name_type& group, + const key_type& key, priority priority, value_type& value) const { @@ -316,9 +316,9 @@ namespace sbuild } bool - sbuild::keyfile::get_locale_string (group_name_type const& group, - key_type const& key, - std::string const& locale, + sbuild::keyfile::get_locale_string (const group_name_type& group, + const key_type& key, + const std::string& locale, value_type& value) const { std::string lkey = key + '[' + locale + ']'; @@ -326,9 +326,9 @@ namespace sbuild } bool - sbuild::keyfile::get_locale_string (group_name_type const& group, - key_type const& key, - std::string const& locale, + sbuild::keyfile::get_locale_string (const group_name_type& group, + const key_type& key, + const std::string& locale, priority priority, value_type& value) const { @@ -338,7 +338,7 @@ namespace sbuild } void - sbuild::keyfile::remove_group (group_name_type const& group) + sbuild::keyfile::remove_group (const group_name_type& group) { group_map_type::iterator pos = this->groups.find(group); if (pos != this->groups.end()) @@ -346,8 +346,8 @@ namespace sbuild } void - sbuild::keyfile::remove_key (group_name_type const& group, - key_type const& key) + sbuild::keyfile::remove_key (const group_name_type& group, + const key_type& key) { group_type *found_group = find_group(group); if (found_group) @@ -360,24 +360,24 @@ namespace sbuild } sbuild::keyfile& - sbuild::keyfile::operator += (keyfile const& rhs) + sbuild::keyfile::operator += (const keyfile& rhs) { for (const auto& gp : rhs.groups) { - group_type const& group = gp.second; - group_name_type const& groupname = std::get<0>(group); - comment_type const& comment = std::get<2>(group); - size_type const& line = std::get<3>(group); + const group_type& group = gp.second; + const group_name_type& groupname = std::get<0>(group); + const comment_type& comment = std::get<2>(group); + const size_type& line = std::get<3>(group); set_group(groupname, comment, line); - item_map_type const& items(std::get<1>(group)); + const item_map_type& items(std::get<1>(group)); for (const auto& it : items) { - item_type const& item = it.second; - key_type const& key(std::get<0>(item)); - internal_value_type const& value(std::get<1>(item)); - comment_type const& comment(std::get<2>(item)); - size_type const& line(std::get<3>(item)); + const item_type& item = it.second; + const key_type& key(std::get<0>(item)); + const internal_value_type& value(std::get<1>(item)); + const comment_type& comment(std::get<2>(item)); + const size_type& line(std::get<3>(item)); set_value(groupname, key, value, comment, line); } } @@ -385,8 +385,8 @@ namespace sbuild } sbuild::keyfile - operator + (sbuild::keyfile const& lhs, - sbuild::keyfile const& rhs) + operator + (const sbuild::keyfile& lhs, + const sbuild::keyfile& rhs) { sbuild::keyfile ret(lhs); ret += rhs; @@ -394,7 +394,7 @@ namespace sbuild } const sbuild::keyfile::group_type * - sbuild::keyfile::find_group (group_name_type const& group) const + sbuild::keyfile::find_group (const group_name_type& group) const { group_map_type::const_iterator pos = this->groups.find(group); if (pos != this->groups.end()) @@ -404,7 +404,7 @@ namespace sbuild } sbuild::keyfile::group_type * - sbuild::keyfile::find_group (group_name_type const& group) + sbuild::keyfile::find_group (const group_name_type& group) { group_map_type::iterator pos = this->groups.find(group); if (pos != this->groups.end()) @@ -414,13 +414,13 @@ namespace sbuild } const sbuild::keyfile::item_type * - sbuild::keyfile::find_item (group_name_type const& group, - key_type const& key) const + sbuild::keyfile::find_item (const group_name_type& group, + const key_type& key) const { const group_type *found_group = find_group(group); if (found_group) { - item_map_type const& items = std::get<1>(*found_group); + const item_map_type& items = std::get<1>(*found_group); item_map_type::const_iterator pos = items.find(key); if (pos != items.end()) return &pos->second; @@ -430,8 +430,8 @@ namespace sbuild } sbuild::keyfile::item_type * - sbuild::keyfile::find_item (group_name_type const& group, - key_type const& key) + sbuild::keyfile::find_item (const group_name_type& group, + const key_type& key) { group_type *found_group = find_group(group); if (found_group) @@ -446,8 +446,8 @@ namespace sbuild } void - sbuild::keyfile::check_priority (group_name_type const& group, - key_type const& key, + sbuild::keyfile::check_priority (const group_name_type& group, + const key_type& key, priority priority, bool valid) const { diff --git a/lib/sbuild/keyfile.h b/lib/sbuild/keyfile.h index baef3094..dbd92012 100644 --- a/lib/sbuild/keyfile.h +++ b/lib/sbuild/keyfile.h @@ -150,7 +150,7 @@ namespace sbuild * group, or the group does not exist, the list will be empty. */ key_list - get_keys (group_name_type const& group) const; + get_keys (const group_name_type& group) const; /** * Check for unused keys in a group. If keys other than the @@ -161,8 +161,8 @@ namespace sbuild * @param keys the keys which have been used. */ void - check_keys (group_name_type const& group, - key_list const& keys) const; + check_keys (const group_name_type& group, + const key_list& keys) const; /** * Check if a group exists. @@ -171,7 +171,7 @@ namespace sbuild * @returns true if the group exists, otherwise false. */ bool - has_group (group_name_type const& group) const; + has_group (const group_name_type& group) const; /** * Check if a key exists. @@ -181,8 +181,8 @@ namespace sbuild * @returns true if the key exists, otherwise false. */ bool - has_key (group_name_type const& group, - key_type const& key) const; + has_key (const group_name_type& group, + const key_type& key) const; /** * Set a group. The group will be created (and the comment set) @@ -192,8 +192,8 @@ namespace sbuild * @param comment the comment to set. */ void - set_group (group_name_type const& group, - comment_type const& comment); + set_group (const group_name_type& group, + const comment_type& comment); /** * Set a group. The group will be created (and the comment set) @@ -204,8 +204,8 @@ namespace sbuild * @param line the line number in the input file, or 0 otherwise. */ void - set_group (group_name_type const& group, - comment_type const& comment, + set_group (const group_name_type& group, + const comment_type& comment, size_type line); /** @@ -215,7 +215,7 @@ namespace sbuild * @returns the comment. */ comment_type - get_comment (group_name_type const& group) const; + get_comment (const group_name_type& group) const; /** * Get a key comment. @@ -225,8 +225,8 @@ namespace sbuild * @returns the comment. */ comment_type - get_comment (group_name_type const& group, - key_type const& key) const; + get_comment (const group_name_type& group, + const key_type& key) const; /** * Get a group line number. @@ -235,7 +235,7 @@ namespace sbuild * @returns the line number, or 0 if not available. */ size_type - get_line (group_name_type const& group) const; + get_line (const group_name_type& group) const; /** * Get a key line number. @@ -245,8 +245,8 @@ namespace sbuild * @returns the line number, or 0 if not available. */ size_type - get_line (group_name_type const& group, - key_type const& key) const; + get_line (const group_name_type& group, + const key_type& key) const; /** * Get a key value. @@ -260,8 +260,8 @@ namespace sbuild */ template <typename T> bool - get_value (group_name_type const& group, - key_type const& key, + get_value (const group_name_type& group, + const key_type& key, T& value) const { log_debug(DEBUG_INFO) << "Getting keyfile group=" << group @@ -269,13 +269,13 @@ namespace sbuild const item_type *found_item = find_item(group, key); if (found_item) { - internal_value_type const& strval(std::get<1>(*found_item)); + const internal_value_type& strval(std::get<1>(*found_item)); try { parse_value(boost::any_cast<std::string const&>(strval), value); return true; } - catch (parse_value_error const& e) + catch (const parse_value_error& e) { size_type line = get_line(group, key); if (line) @@ -309,8 +309,8 @@ namespace sbuild */ template <typename T> bool - get_value (group_name_type const& group, - key_type const& key, + get_value (const group_name_type& group, + const key_type& key, priority priority, T& value) const { @@ -329,8 +329,8 @@ namespace sbuild * case value will be unchanged). */ bool - get_locale_string (group_name_type const& group, - key_type const& key, + get_locale_string (const group_name_type& group, + const key_type& key, value_type& value) const; /** @@ -345,8 +345,8 @@ namespace sbuild * case value will be unchanged). */ bool - get_locale_string (group_name_type const& group, - key_type const& key, + get_locale_string (const group_name_type& group, + const key_type& key, priority priority, value_type& value) const; @@ -361,9 +361,9 @@ namespace sbuild * case value will be unchanged). */ bool - get_locale_string (group_name_type const& group, - key_type const& key, - std::string const& locale, + get_locale_string (const group_name_type& group, + const key_type& key, + const std::string& locale, value_type& value) const; /** @@ -380,9 +380,9 @@ namespace sbuild * case value will be unchanged). */ bool - get_locale_string (group_name_type const& group, - key_type const& key, - std::string const& locale, + get_locale_string (const group_name_type& group, + const key_type& key, + const std::string& locale, priority priority, value_type& value) const; @@ -400,8 +400,8 @@ namespace sbuild */ template <typename C> bool - get_list_value (group_name_type const& group, - key_type const& key, + get_list_value (const group_name_type& group, + const key_type& key, C& container) const { value_type item_value; @@ -417,7 +417,7 @@ namespace sbuild { parse_value(item, tmp); } - catch (parse_value_error const& e) + catch (const parse_value_error& e) { size_type line = get_line(group, key); if (line) @@ -456,8 +456,8 @@ namespace sbuild */ template <typename C> bool - get_list_value (group_name_type const& group, - key_type const& key, + get_list_value (const group_name_type& group, + const key_type& key, priority priority, C& container) const { @@ -480,8 +480,8 @@ namespace sbuild */ template <typename C> bool - get_set_value (group_name_type const& group, - key_type const& key, + get_set_value (const group_name_type& group, + const key_type& key, C& container) const { value_type item_value; @@ -497,7 +497,7 @@ namespace sbuild { parse_value(item, tmp); } - catch (parse_value_error const& e) + catch (const parse_value_error& e) { size_type line = get_line(group, key); if (line) @@ -536,8 +536,8 @@ namespace sbuild */ template <typename C> bool - get_set_value (group_name_type const& group, - key_type const& key, + get_set_value (const group_name_type& group, + const key_type& key, priority priority, C& container) const { @@ -556,8 +556,8 @@ namespace sbuild */ template <typename T> void - set_value (group_name_type const& group, - key_type const& key, + set_value (const group_name_type& group, + const key_type& key, T const& value) { set_value(group, key, value, comment_type()); @@ -574,10 +574,10 @@ namespace sbuild */ template <typename T> void - set_value (group_name_type const& group, - key_type const& key, + set_value (const group_name_type& group, + const key_type& key, T const& value, - comment_type const& comment) + const comment_type& comment) { set_value(group, key, value, comment, 0); } @@ -593,10 +593,10 @@ namespace sbuild * @param line the line number in the input file, or 0 otherwise. */ void - set_value (group_name_type const& group, - key_type const& key, - internal_value_type const& value, - comment_type const& comment, + set_value (const group_name_type& group, + const key_type& key, + const internal_value_type& value, + const comment_type& comment, size_type line) { set_group(group, ""); @@ -627,10 +627,10 @@ namespace sbuild */ template <typename T> void - set_value (group_name_type const& group, - key_type const& key, + set_value (const group_name_type& group, + const key_type& key, T const& value, - comment_type const& comment, + const comment_type& comment, size_type line) { std::ostringstream os; @@ -663,8 +663,8 @@ namespace sbuild */ template <typename I> void - set_list_value (group_name_type const& group, - key_type const& key, + set_list_value (const group_name_type& group, + const key_type& key, I begin, I end) { @@ -683,11 +683,11 @@ namespace sbuild */ template <typename I> void - set_list_value (group_name_type const& group, - key_type const& key, + set_list_value (const group_name_type& group, + const key_type& key, I begin, I end, - comment_type const& comment) + const comment_type& comment) { set_list_value (group, key, begin, end, comment, 0); } @@ -705,11 +705,11 @@ namespace sbuild */ template <typename I> void - set_list_value (group_name_type const& group, - key_type const& key, + set_list_value (const group_name_type& group, + const key_type& key, I begin, I end, - comment_type const& comment, + const comment_type& comment, size_type line) { value_type strval; @@ -741,8 +741,8 @@ namespace sbuild */ template <typename I> void - set_set_value (group_name_type const& group, - key_type const& key, + set_set_value (const group_name_type& group, + const key_type& key, I begin, I end) { @@ -763,11 +763,11 @@ namespace sbuild */ template <typename I> void - set_set_value (group_name_type const& group, - key_type const& key, + set_set_value (const group_name_type& group, + const key_type& key, I begin, I end, - comment_type const& comment) + const comment_type& comment) { std::vector<typename std::iterator_traits<I>::value_type> l(begin, end); std::sort(l.begin(), l.end()); @@ -787,11 +787,11 @@ namespace sbuild */ template <typename I> void - set_set_value (group_name_type const& group, - key_type const& key, + set_set_value (const group_name_type& group, + const key_type& key, I begin, I end, - comment_type const& comment, + const comment_type& comment, size_type line) { std::vector<typename std::iterator_traits<I>::value_type> l(begin, end); @@ -805,7 +805,7 @@ namespace sbuild * @param group the group to remove. */ void - remove_group (group_name_type const& group); + remove_group (const group_name_type& group); /** * Remove a key. @@ -814,8 +814,8 @@ namespace sbuild * @param key the key to remove. */ void - remove_key (group_name_type const& group, - key_type const& key); + remove_key (const group_name_type& group, + const key_type& key); /** * Add a keyfile to the keyfile. @@ -824,7 +824,7 @@ namespace sbuild * @returns the modified keyfile. */ keyfile& - operator += (keyfile const& rhs); + operator += (const keyfile& rhs); /** * Add a keyfile to the keyfile. @@ -834,8 +834,8 @@ namespace sbuild * @returns the new keyfile. */ friend keyfile - operator + (keyfile const& lhs, - keyfile const& rhs); + operator + (const keyfile& lhs, + const keyfile& rhs); protected: /** @@ -845,7 +845,7 @@ namespace sbuild * @returns the group, or 0 if not found. */ const group_type * - find_group (group_name_type const& group) const; + find_group (const group_name_type& group) const; /** * Find a group by it's name. @@ -854,7 +854,7 @@ namespace sbuild * @returns the group, or 0 if not found. */ group_type * - find_group (group_name_type const& group); + find_group (const group_name_type& group); /** * Find a key by it's group and name. @@ -864,8 +864,8 @@ namespace sbuild * @returns the key, or 0 if not found. */ const item_type * - find_item (group_name_type const& group, - key_type const& key) const; + find_item (const group_name_type& group, + const key_type& key) const; /** * Find a key by it's group and name. @@ -875,8 +875,8 @@ namespace sbuild * @returns the key, or 0 if not found. */ item_type * - find_item (group_name_type const& group, - key_type const& key); + find_item (const group_name_type& group, + const key_type& key); /** * Check if a key is missing or present when not permitted. @@ -887,8 +887,8 @@ namespace sbuild * @param valid true if key exists, false if not existing. */ void - check_priority (group_name_type const& group, - key_type const& key, + check_priority (const group_name_type& group, + const key_type& key, priority priority, bool valid) const; @@ -915,15 +915,15 @@ namespace sbuild set_object_value (C const& object, T (C::* method)() const, keyfile& keyfile, - group_name_type const& group, - key_type const& key) + const group_name_type& group, + const key_type& key) { try { if (method) keyfile.set_value(group, key, (object.*method)()); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { throw error(group, key, PASSTHROUGH_GK, e); } @@ -946,15 +946,15 @@ namespace sbuild set_object_value (C const& object, T const& (C::* method)() const, keyfile& keyfile, - group_name_type const& group, - key_type const& key) + const group_name_type& group, + const key_type& key) { try { if (method) keyfile.set_value(group, key, (object.*method)()); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { throw error(group, key, PASSTHROUGH_GK, e); } @@ -978,8 +978,8 @@ namespace sbuild set_object_list_value (C const& object, T (C::* method)() const, keyfile& keyfile, - group_name_type const& group, - key_type const& key) + const group_name_type& group, + const key_type& key) { try { @@ -988,7 +988,7 @@ namespace sbuild (object.*method)().begin(), (object.*method)().end()); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { throw error(group, key, PASSTHROUGH_GK, e); } @@ -1013,8 +1013,8 @@ namespace sbuild set_object_list_value (C const& object, T const& (C::* method)() const, keyfile& keyfile, - group_name_type const& group, - key_type const& key) + const group_name_type& group, + const key_type& key) { try { @@ -1023,7 +1023,7 @@ namespace sbuild (object.*method)().begin(), (object.*method)().end()); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { throw error(group, key, PASSTHROUGH_GK, e); } @@ -1047,8 +1047,8 @@ namespace sbuild set_object_set_value (C const& object, T (C::* method)() const, keyfile& keyfile, - group_name_type const& group, - key_type const& key) + const group_name_type& group, + const key_type& key) { try { @@ -1057,7 +1057,7 @@ namespace sbuild (object.*method)().begin(), (object.*method)().end()); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { throw error(group, key, PASSTHROUGH_GK, e); } @@ -1082,8 +1082,8 @@ namespace sbuild set_object_set_value (C const& object, T const& (C::* method)() const, keyfile& keyfile, - group_name_type const& group, - key_type const& key) + const group_name_type& group, + const key_type& key) { try { @@ -1092,7 +1092,7 @@ namespace sbuild (object.*method)().begin(), (object.*method)().end()); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { throw error(group, key, PASSTHROUGH_GK, e); } @@ -1116,9 +1116,9 @@ namespace sbuild static void get_object_value (C& object, void (C::* method)(T param), - keyfile const& keyfile, - group_name_type const& group, - key_type const& key, + const keyfile& keyfile, + const group_name_type& group, + const key_type& key, keyfile::priority priority) { try @@ -1128,7 +1128,7 @@ namespace sbuild && method) (object.*method)(value); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { size_type line = keyfile.get_line(group, key); if (line) @@ -1156,9 +1156,9 @@ namespace sbuild static void get_object_value (C& object, void (C::* method)(T const& param), - keyfile const& keyfile, - group_name_type const& group, - key_type const& key, + const keyfile& keyfile, + const group_name_type& group, + const key_type& key, keyfile::priority priority) { try @@ -1168,7 +1168,7 @@ namespace sbuild && method) (object.*method)(value); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { size_type line = keyfile.get_line(group, key); if (line) @@ -1196,9 +1196,9 @@ namespace sbuild static void get_object_list_value (C& object, void (C::* method)(T param), - keyfile const& keyfile, - group_name_type const& group, - key_type const& key, + const keyfile& keyfile, + const group_name_type& group, + const key_type& key, keyfile::priority priority) { try @@ -1208,7 +1208,7 @@ namespace sbuild && method) (object.*method)(value); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { size_type line = keyfile.get_line(group, key); if (line) @@ -1239,9 +1239,9 @@ namespace sbuild static void get_object_list_value (C& object, void (C::* method)(T const& param), - keyfile const& keyfile, - group_name_type const& group, - key_type const& key, + const keyfile& keyfile, + const group_name_type& group, + const key_type& key, keyfile::priority priority) { try @@ -1251,7 +1251,7 @@ namespace sbuild && method) (object.*method)(value); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { size_type line = keyfile.get_line(group, key); if (line) @@ -1281,9 +1281,9 @@ namespace sbuild static void get_object_set_value (C& object, void (C::* method)(T param), - keyfile const& keyfile, - group_name_type const& group, - key_type const& key, + const keyfile& keyfile, + const group_name_type& group, + const key_type& key, keyfile::priority priority) { try @@ -1293,7 +1293,7 @@ namespace sbuild && method) (object.*method)(value); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { size_type line = keyfile.get_line(group, key); if (line) @@ -1324,9 +1324,9 @@ namespace sbuild static void get_object_set_value (C& object, void (C::* method)(T const& param), - keyfile const& keyfile, - group_name_type const& group, - key_type const& key, + const keyfile& keyfile, + const group_name_type& group, + const key_type& key, keyfile::priority priority) { try @@ -1336,7 +1336,7 @@ namespace sbuild && method) (object.*method)(value); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { size_type line = keyfile.get_line(group, key); if (line) diff --git a/lib/sbuild/lock.cc b/lib/sbuild/lock.cc index 8eac089c..80f6eeac 100644 --- a/lib/sbuild/lock.cc +++ b/lib/sbuild/lock.cc @@ -102,7 +102,7 @@ namespace sbuild } void - lock::set_timer(struct itimerval const& timer) + lock::set_timer(const struct itimerval& timer) { set_alarm(); @@ -202,7 +202,7 @@ namespace sbuild unset_timer(); } - catch (error const& e) + catch (const error& e) { unset_timer(); throw; diff --git a/lib/sbuild/lock.h b/lib/sbuild/lock.h index d44a5dc4..83388209 100644 --- a/lib/sbuild/lock.h +++ b/lib/sbuild/lock.h @@ -114,7 +114,7 @@ namespace sbuild * @param timer the timeout to set. */ void - set_timer (struct itimerval const& timer); + set_timer (const struct itimerval& timer); /** * Remove any itimer currently set up. This will clear any diff --git a/lib/sbuild/log.cc b/lib/sbuild/log.cc index 3fbaa94a..e650857c 100644 --- a/lib/sbuild/log.cc +++ b/lib/sbuild/log.cc @@ -45,18 +45,18 @@ namespace sbuild * @param ctty true to log to the CTTY or false to log to cerr. */ void - log_reason (std::exception const& e, + log_reason (const std::exception& e, bool ctty) { try { - error_base const& eb(dynamic_cast<error_base const&>(e)); + const error_base& eb(dynamic_cast<error_base const&>(e)); string_list lines = split_string(eb.why(), "\n"); for (const auto& line : lines) ctty ? log_ctty_info() : log_info() << line << std::endl; } - catch (std::bad_cast const& discard) + catch (const std::bad_cast& discard) { } } @@ -67,7 +67,7 @@ namespace sbuild * @param e the exception to log. */ void - log_exception_reason (std::exception const& e) + log_exception_reason (const std::exception& e) { log_reason(e, false); } @@ -79,7 +79,7 @@ namespace sbuild * @param e the exception to log. */ void - log_ctty_exception_reason (std::exception const& e) + log_ctty_exception_reason (const std::exception& e) { log_reason(e, true); } @@ -140,28 +140,28 @@ namespace sbuild } void - log_exception_warning (std::exception const& e) + log_exception_warning (const std::exception& e) { log_warning() << e.what() << std::endl; log_exception_reason(e); } void - log_exception_error (std::exception const& e) + log_exception_error (const std::exception& e) { log_error() << e.what() << std::endl; log_exception_reason(e); } void - log_ctty_exception_warning (std::exception const& e) + log_ctty_exception_warning (const std::exception& e) { log_ctty_warning() << e.what() << std::endl; log_ctty_exception_reason(e); } void - log_ctty_exception_error (std::exception const& e) + log_ctty_exception_error (const std::exception& e) { log_ctty_error() << e.what() << std::endl; log_ctty_exception_reason(e); diff --git a/lib/sbuild/log.h b/lib/sbuild/log.h index ca5062cf..320e6490 100644 --- a/lib/sbuild/log.h +++ b/lib/sbuild/log.h @@ -99,7 +99,7 @@ namespace sbuild * @param e the exception to log. */ void - log_exception_warning (std::exception const& e); + log_exception_warning (const std::exception& e); /** * Log an exception as an error. @@ -107,7 +107,7 @@ namespace sbuild * @param e the exception to log. */ void - log_exception_error (std::exception const& e); + log_exception_error (const std::exception& e); /** * Log an exception as a warning to the Controlling TTY. @@ -115,7 +115,7 @@ namespace sbuild * @param e the exception to log. */ void - log_ctty_exception_warning (std::exception const& e); + log_ctty_exception_warning (const std::exception& e); /** * Log an exception as an error to the Controlling TTY. @@ -123,7 +123,7 @@ namespace sbuild * @param e the exception to log. */ void - log_ctty_exception_error (std::exception const& e); + log_ctty_exception_error (const std::exception& e); /** * Log an unknown exception as an error. diff --git a/lib/sbuild/mntstream.cc b/lib/sbuild/mntstream.cc index c67d5ff9..7f5e7d46 100644 --- a/lib/sbuild/mntstream.cc +++ b/lib/sbuild/mntstream.cc @@ -36,7 +36,7 @@ namespace sbuild {mntstream::MNT_READ, N_("Failed to read mount file ‘%1%’")} }; - mntstream::mntentry::mntentry (struct mntent const& entry): + mntstream::mntentry::mntentry (const struct mntent& entry): filesystem_name(entry.mnt_fsname), directory(entry.mnt_dir), type(entry.mnt_type), @@ -47,7 +47,7 @@ namespace sbuild } - mntstream::mntstream(std::string const& file): + mntstream::mntstream(const std::string& file): file(), mntfile(0), data(), @@ -64,7 +64,7 @@ namespace sbuild } void - mntstream::open(std::string const& file) + mntstream::open(const std::string& file) { this->mntfile = setmntent(file.c_str(), "r"); if (this->mntfile == 0) diff --git a/lib/sbuild/mntstream.h b/lib/sbuild/mntstream.h index 99b1b7c5..a406d6ed 100644 --- a/lib/sbuild/mntstream.h +++ b/lib/sbuild/mntstream.h @@ -73,7 +73,7 @@ namespace sbuild * * @param entry the mntent structure to wrap. */ - mntentry (struct mntent const& entry); + mntentry (const struct mntent& entry); /// Name of mounted filesystem. std::string filesystem_name; @@ -94,7 +94,7 @@ namespace sbuild * * @param file the file to read. */ - mntstream(std::string const& file); + mntstream(const std::string& file); /// The destructor. virtual ~mntstream(); @@ -109,7 +109,7 @@ namespace sbuild * @param file the file to read. * @see close() */ - void open(std::string const& file); + void open(const std::string& file); /** * Close the mount file. This uses the closemnt(3) call to diff --git a/lib/sbuild/parse-error.h b/lib/sbuild/parse-error.h index a7855f03..75cd247e 100644 --- a/lib/sbuild/parse-error.h +++ b/lib/sbuild/parse-error.h @@ -90,7 +90,7 @@ namespace sbuild */ template<typename D> parse_error (size_t line, - std::string const& group, + const std::string& group, error_type error, D const& detail): sbuild::error<T>(this->format_error(line, group, nullptr, error, detail, nullptr, nullptr), @@ -109,8 +109,8 @@ namespace sbuild */ template<typename D> parse_error (size_t line, - std::string const& group, - std::string const& key, + const std::string& group, + const std::string& key, error_type error, D const& detail): sbuild::error<T>(this->format_error(line, group, key, error, detail, nullptr, nullptr), @@ -126,7 +126,7 @@ namespace sbuild * @param detail the details of the error. */ template<typename D> - parse_error (std::string const& group, + parse_error (const std::string& group, error_type error, D const& detail): sbuild::error<T>(this->format_error(group, nullptr, nullptr, error, detail, nullptr, nullptr), @@ -143,8 +143,8 @@ namespace sbuild * @param detail the details of the error. */ template<typename D> - parse_error (std::string const& group, - std::string const& key, + parse_error (const std::string& group, + const std::string& key, error_type error, D const& detail): sbuild::error<T>(this->format_error(group, key, nullptr, error, detail, nullptr, nullptr), @@ -160,7 +160,7 @@ namespace sbuild */ template<typename C> parse_error (C const& context, - std::runtime_error const& error): + const std::runtime_error& error): sbuild::error<T>(sbuild::error<T>::format_error(context, nullptr, nullptr, error, nullptr, nullptr, nullptr), sbuild::error<T>::format_reason(context, nullptr, nullptr, error, nullptr, nullptr, nullptr)) { @@ -173,7 +173,7 @@ namespace sbuild * @param error the error. */ parse_error (size_t line, - std::runtime_error const& error): + const std::runtime_error& error): sbuild::error<T>(sbuild::error<T>::format_error(line, nullptr, nullptr, error, nullptr, nullptr, nullptr), sbuild::error<T>::format_reason(line, nullptr, nullptr, error, nullptr, nullptr, nullptr)) { @@ -187,8 +187,8 @@ namespace sbuild * @param error the error. */ parse_error (size_t line, - std::string const& group, - std::runtime_error const& error): + const std::string& group, + const std::runtime_error& error): sbuild::error<T>(sbuild::error<T>::format_error(line, group, nullptr, error, nullptr, nullptr, nullptr), sbuild::error<T>::format_reason(line, group, nullptr, error, nullptr, nullptr, nullptr)) { @@ -203,9 +203,9 @@ namespace sbuild * @param error the error. */ parse_error (size_t line, - std::string const& group, - std::string const& key, - std::runtime_error const& error): + const std::string& group, + const std::string& key, + const std::runtime_error& error): sbuild::error<T>(sbuild::error<T>::format_error(line, group, key, error, nullptr, nullptr, nullptr), sbuild::error<T>::format_reason(line, group, key, error, nullptr, nullptr, nullptr)) { @@ -217,8 +217,8 @@ namespace sbuild * @param group the group the error occurred within. * @param error the error. */ - parse_error (std::string const& group, - std::runtime_error const& error): + parse_error (const std::string& group, + const std::runtime_error& error): sbuild::error<T>(sbuild::error<T>::format_error(group, nullptr, nullptr, error, nullptr, nullptr, nullptr), sbuild::error<T>::format_reason(group, nullptr, nullptr, error, nullptr, nullptr, nullptr)) { @@ -231,9 +231,9 @@ namespace sbuild * @param key the key the error occurred within. * @param error the error. */ - parse_error (std::string const& group, - std::string const& key, - std::runtime_error const& error): + parse_error (const std::string& group, + const std::string& key, + const std::runtime_error& error): sbuild::error<T>(sbuild::error<T>::format_error(group, key, nullptr, error, nullptr, nullptr, nullptr), sbuild::error<T>::format_reason(group, key, nullptr, error, nullptr, nullptr, nullptr)) { diff --git a/lib/sbuild/parse-value.cc b/lib/sbuild/parse-value.cc index 987aa9a8..ccd18bfc 100644 --- a/lib/sbuild/parse-value.cc +++ b/lib/sbuild/parse-value.cc @@ -32,7 +32,7 @@ namespace sbuild }; void - parse_value (std::string const& value, + parse_value (const std::string& value, bool& parsed_value) { if (value == "true" || value == "yes" || value == "1") @@ -49,7 +49,7 @@ namespace sbuild } void - parse_value (std::string const& value, + parse_value (const std::string& value, std::string& parsed_value) { parsed_value = value; diff --git a/lib/sbuild/parse-value.h b/lib/sbuild/parse-value.h index 53015525..7b02f6c9 100644 --- a/lib/sbuild/parse-value.h +++ b/lib/sbuild/parse-value.h @@ -44,7 +44,7 @@ namespace sbuild * @returns true on success, false on failure. */ void - parse_value (std::string const& value, + parse_value (const std::string& value, bool& parsed_value); /** @@ -54,7 +54,7 @@ namespace sbuild * @returns true on success, false on failure. */ void - parse_value (std::string const& value, + parse_value (const std::string& value, std::string& parsed_value); /** @@ -65,7 +65,7 @@ namespace sbuild */ template <typename T> void - parse_value (std::string const& value, + parse_value (const std::string& value, T& parsed_value) { std::istringstream is(value); diff --git a/lib/sbuild/personality.cc b/lib/sbuild/personality.cc index 3c7eb1b6..3b29f298 100644 --- a/lib/sbuild/personality.cc +++ b/lib/sbuild/personality.cc @@ -86,7 +86,7 @@ namespace sbuild set_name("undefined"); } - sbuild::personality::personality (std::string const& persona): + sbuild::personality::personality (const std::string& persona): persona_name("undefined"), persona(find_personality("undefined")) { @@ -98,7 +98,7 @@ namespace sbuild } sbuild::personality::type - sbuild::personality::find_personality (std::string const& persona) + sbuild::personality::find_personality (const std::string& persona) { std::map<std::string,type>::const_iterator pos = personalities.find(persona); @@ -130,7 +130,7 @@ namespace sbuild } void - sbuild::personality::set_name (std::string const& persona) + sbuild::personality::set_name (const std::string& persona) { this->persona_name = persona; this->persona = find_personality(persona); diff --git a/lib/sbuild/personality.h b/lib/sbuild/personality.h index bf909ddf..911f0092 100644 --- a/lib/sbuild/personality.h +++ b/lib/sbuild/personality.h @@ -65,7 +65,7 @@ namespace sbuild * * @param persona the persona to set. */ - personality (std::string const& persona); + personality (const std::string& persona); ///* The destructor. ~personality (); @@ -75,7 +75,7 @@ namespace sbuild * * @returns the personality name. */ - std::string const& get_name () const; + const std::string& get_name () const; /** * Set the name of the personality. @@ -83,7 +83,7 @@ namespace sbuild * @param persona the persona to set. * @returns the personality name. */ - void set_name (std::string const& persona); + void set_name (const std::string& persona); /** * Get the personality. @@ -143,7 +143,7 @@ namespace sbuild friend std::basic_ostream<charT,traits>& operator << (std::basic_ostream<charT,traits>& stream, - personality const& rhs) + const personality& rhs) { return stream << find_personality(rhs.persona); } @@ -158,7 +158,7 @@ namespace sbuild * found). */ static type - find_personality (std::string const& persona); + find_personality (const std::string& persona); /** * Find a personality by number. diff --git a/lib/sbuild/regex.h b/lib/sbuild/regex.h index 9788f2b4..24e2d193 100644 --- a/lib/sbuild/regex.h +++ b/lib/sbuild/regex.h @@ -75,7 +75,7 @@ namespace sbuild * * @param pattern a regex */ - regex (std::string const& pattern): + regex (const std::string& pattern): comp(pattern, std::regex::extended), rstr(pattern) {} @@ -115,13 +115,13 @@ namespace sbuild } bool - compare (regex const& rhs) const + compare (const regex& rhs) const { return this->rstr != rhs.rstr; } bool - search (std::string const& str) const + search (const std::string& str) const { return std::regex_search(str, this->comp); } @@ -163,7 +163,7 @@ namespace sbuild friend std::basic_ostream<charT,traits>& operator << (std::basic_ostream<charT,traits>& stream, - regex const& rhs) + const regex& rhs) { return stream << rhs.str(); } @@ -180,7 +180,7 @@ namespace sbuild */ inline bool regex_search (const std::string& str, - regex const& regex) + const regex& regex) { return regex.search(str); } diff --git a/lib/sbuild/run-parts.cc b/lib/sbuild/run-parts.cc index 6803631b..04e09699 100644 --- a/lib/sbuild/run-parts.cc +++ b/lib/sbuild/run-parts.cc @@ -50,7 +50,7 @@ namespace sbuild {run_parts::READ, N_("Failed to read file descriptor")} }; - run_parts::run_parts (std::string const& directory, + run_parts::run_parts (const std::string& directory, bool lsb_mode, bool abort_on_error, mode_t umask): @@ -113,8 +113,8 @@ namespace sbuild } int - run_parts::run (string_list const& command, - environment const& env) + run_parts::run (const string_list& command, + const environment& env) { int exit_status = 0; @@ -155,9 +155,9 @@ namespace sbuild } int - run_parts::run_child (std::string const& file, - string_list const& command, - environment const& env) + run_parts::run_child (const std::string& file, + const string_list& command, + const environment& env) { int stdout_pipe[2]; int stderr_pipe[2]; @@ -207,7 +207,7 @@ namespace sbuild error e(file, EXEC, strerror(errno)); log_exception_error(e); } - catch (std::exception const& e) + catch (const std::exception& e) { log_exception_error(e); } @@ -322,7 +322,7 @@ namespace sbuild close(stderr_pipe[0]); wait_for_child(pid, exit_status); } - catch (error const& e) + catch (const error& e) { close(stdout_pipe[0]); close(stdout_pipe[1]); diff --git a/lib/sbuild/run-parts.h b/lib/sbuild/run-parts.h index 57fbb11d..483bf53d 100644 --- a/lib/sbuild/run-parts.h +++ b/lib/sbuild/run-parts.h @@ -67,7 +67,7 @@ namespace sbuild * @param abort_on_error stop executing scripts if one returns an error. * @param umask the umask to set when running scripts. */ - run_parts (std::string const& directory, + run_parts (const std::string& directory, bool lsb_mode = true, bool abort_on_error = true, mode_t umask = 022); @@ -117,8 +117,8 @@ namespace sbuild * success, or the exit status of the last failing script. */ int - run(string_list const& command, - environment const& env); + run(const string_list& command, + const environment& env); /** * Output the environment to an ostream. @@ -131,7 +131,7 @@ namespace sbuild friend std::basic_ostream<charT,traits>& operator << (std::basic_ostream<charT,traits>& stream, - run_parts const& rhs) + const run_parts& rhs) { if (!rhs.reverse) { @@ -159,9 +159,9 @@ namespace sbuild * @returns the return value of the execve system call on failure. */ int - run_child(std::string const& file, - string_list const& command, - environment const& env); + run_child(const std::string& file, + const string_list& command, + const environment& env); /** * Wait for a child process to complete, and check its exit status. diff --git a/lib/sbuild/session.cc b/lib/sbuild/session.cc index b198781e..93c1b1ee 100644 --- a/lib/sbuild/session.cc +++ b/lib/sbuild/session.cc @@ -187,9 +187,9 @@ namespace sbuild {session::USER_SWITCH, N_("(%1%→%2%): User switching is not permitted")} }; - session::session (std::string const& service, + session::session (const std::string& service, operation operation, - chroot_list const& chroots): + const chroot_list& chroots): authstat( #ifdef SBUILD_FEATURE_PAM auth::pam::create(service) @@ -240,7 +240,7 @@ namespace sbuild } void - session::set_chroots (chroot_list const& chroots) + session::set_chroots (const chroot_list& chroots) { this->chroots = chroots; } @@ -264,7 +264,7 @@ namespace sbuild } void - session::set_session_id (std::string const& session_id) + session::set_session_id (const std::string& session_id) { this->session_id = session_id; } @@ -276,7 +276,7 @@ namespace sbuild } void - session::set_verbosity (std::string const& verbosity) + session::set_verbosity (const std::string& verbosity) { this->verbosity = verbosity; } @@ -300,7 +300,7 @@ namespace sbuild } void - session::set_shell_override (std::string const& shell) + session::set_shell_override (const std::string& shell) { this->shell = shell; } @@ -312,7 +312,7 @@ namespace sbuild } void - session::set_user_options (string_map const& user_options) + session::set_user_options (const string_map& user_options) { this->user_options = user_options; } @@ -332,7 +332,7 @@ namespace sbuild void session::save_termios () { - string_list const& command(this->authstat->get_command()); + const string_list& command(this->authstat->get_command()); this->termios_ok = false; @@ -354,7 +354,7 @@ namespace sbuild void session::restore_termios () { - string_list const& command(this->authstat->get_command()); + const string_list& command(this->authstat->get_command()); // Restore if running a login shell and have a controlling terminal, // and have previously saved the terminal state. @@ -382,7 +382,7 @@ namespace sbuild * @returns true if the user is a member of group, otherwise false. */ bool - session::is_group_member (std::string const& groupname) const + session::is_group_member (const std::string& groupname) const { errno = 0; sbuild::group grp(groupname); @@ -430,16 +430,16 @@ namespace sbuild } void - session::get_chroot_membership (chroot::chroot::ptr const& chroot, + session::get_chroot_membership (const chroot::chroot::ptr& chroot, bool& in_users, bool& in_root_users, bool& in_groups, bool& in_root_groups) const { - string_list const& users = chroot->get_users(); - string_list const& root_users = chroot->get_root_users(); - string_list const& groups = chroot->get_groups(); - string_list const& root_groups = chroot->get_root_groups(); + const string_list& users = chroot->get_users(); + const string_list& root_users = chroot->get_root_users(); + const string_list& groups = chroot->get_groups(); + const string_list& root_groups = chroot->get_root_groups(); in_users = false; in_root_users = false; @@ -480,7 +480,7 @@ namespace sbuild auth::auth::status session::get_chroot_auth_status (auth::auth::status status, - chroot::chroot::ptr const& chroot) const + const chroot::chroot::ptr& chroot) const { bool in_users = false; bool in_root_users = false; @@ -574,20 +574,20 @@ namespace sbuild already bailing out, and an error may already have been raised */ } - catch (auth::auth::error const& e) + catch (const auth::auth::error& e) { try { this->authstat->cred_delete(); } - catch (auth::auth::error const& discard) + catch (const auth::auth::error& discard) { } throw; } this->authstat->cred_delete(); } - catch (auth::auth::error const& e) + catch (const auth::auth::error& e) { try { @@ -595,7 +595,7 @@ namespace sbuild and an error may already have been raised */ this->authstat->stop(); } - catch (auth::auth::error const& discard) + catch (const auth::auth::error& discard) { } throw; @@ -733,7 +733,7 @@ namespace sbuild save_termios(); run_chroot(chroot); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { log_debug(DEBUG_WARNING) << "Chroot session failed" << endl; @@ -745,7 +745,7 @@ namespace sbuild this->authstat->close_session(); } } - catch (error const& e) + catch (const error& e) { log_debug(DEBUG_WARNING) << "Chroot exec scripts or session failed" << endl; @@ -757,7 +757,7 @@ namespace sbuild error. */ setup_chroot(chroot, chroot::chroot::EXEC_STOP); } - catch (error const& e) + catch (const error& e) { log_debug(DEBUG_WARNING) << "Chroot setup scripts, exec scripts or session failed" << endl; @@ -765,7 +765,7 @@ namespace sbuild { setup_chroot(chroot, chroot::chroot::SETUP_STOP); } - catch (error const& discard) + catch (const error& discard) { log_debug(DEBUG_WARNING) << "Chroot setup scripts failed during stop" << endl; @@ -778,7 +778,7 @@ namespace sbuild setup_chroot(chroot, chroot::chroot::SETUP_STOP); } } - catch (error const& e) + catch (const error& e) { clear_sigterm_handler(); clear_sigint_handler(); @@ -798,11 +798,11 @@ namespace sbuild string_list session::get_login_directories (chroot::chroot::ptr& session_chroot, - environment const& env) const + const environment& env) const { string_list ret; - std::string const& wd(this->authstat->get_wd()); + const std::string& wd(this->authstat->get_wd()); if (!wd.empty()) { // Set specified working directory. @@ -833,11 +833,11 @@ namespace sbuild string_list session::get_command_directories (chroot::chroot::ptr& session_chroot, - environment const& env) const + const environment& env) const { string_list ret; - std::string const& wd(this->authstat->get_wd()); + const std::string& wd(this->authstat->get_wd()); if (!wd.empty()) // Set specified working directory. ret.push_back(wd); @@ -867,7 +867,7 @@ namespace sbuild if (get_preserve_environment()) { // $SHELL (if --preserve-environment used) - environment const& env(this->authstat->get_complete_environment()); + const environment& env(this->authstat->get_complete_environment()); std::string envshell; if (env.get("SHELL", envshell) && @@ -876,7 +876,7 @@ namespace sbuild } // passwd pw_shell - std::string const& shell = this->authstat->get_shell(); + const std::string& shell = this->authstat->get_shell(); if (!shell.empty()) ret.push_back(shell); @@ -907,7 +907,7 @@ namespace sbuild found_shell = shell; break; } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { error e1(shell, SHELL, e.what()); log_exception_warning(e1); @@ -1027,7 +1027,7 @@ namespace sbuild session::get_user_command (chroot::chroot::ptr& session_chroot, std::string& file, string_list& command, - environment const& env) const + const environment& env) const { /* Search for program in path. */ std::string path; @@ -1112,7 +1112,7 @@ namespace sbuild { session_chroot->lock(setup_type); } - catch (chroot::chroot::error const& e) + catch (const chroot::chroot::error& e) { this->chroot_status = false; this->lock_status = false; @@ -1121,7 +1121,7 @@ namespace sbuild // Release lock, which also removes session metadata. session_chroot->unlock(setup_type, 0); } - catch (chroot::chroot::error const& ignore) + catch (const chroot::chroot::error& ignore) { } throw error(session_chroot->get_name(), CHROOT_LOCK, e); @@ -1215,7 +1215,7 @@ namespace sbuild _exit (status); } - catch (std::exception const& e) + catch (const std::exception& e) { log_exception_error(e); } @@ -1235,7 +1235,7 @@ namespace sbuild { session_chroot->unlock(setup_type, exit_status); } - catch (chroot::chroot::error const& e) + catch (const chroot::chroot::error& e) { this->chroot_status = false; this->lock_status = false; @@ -1509,7 +1509,7 @@ namespace sbuild { run_child(session_chroot); } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { log_exception_error(e); } diff --git a/lib/sbuild/session.h b/lib/sbuild/session.h index e003e908..249a6650 100644 --- a/lib/sbuild/session.h +++ b/lib/sbuild/session.h @@ -114,9 +114,9 @@ namespace sbuild * @param operation the session operation to perform. * @param chroots the chroots to act upon. */ - session (std::string const& service, + session (const std::string& service, operation operation, - chroot_list const& chroots); + const chroot_list& chroots); /// The destructor. virtual ~session (); @@ -151,7 +151,7 @@ namespace sbuild * @param chroots a list of chroots. */ void - set_chroots (chroot_list const& chroots); + set_chroots (const chroot_list& chroots); /** * Get the operation this session will perform. @@ -185,7 +185,7 @@ namespace sbuild * @param session_id the session id. */ void - set_session_id (std::string const& session_id); + set_session_id (const std::string& session_id); /** * Get the message verbosity. @@ -202,7 +202,7 @@ namespace sbuild * @param verbosity the message verbosity. */ void - set_verbosity (std::string const& verbosity); + set_verbosity (const std::string& verbosity); /** * Check if the environment should be preserved in the chroot. @@ -234,7 +234,7 @@ namespace sbuild * @param shell true to preserve or false to clean. */ void - set_shell_override (std::string const& shell); + set_shell_override (const std::string& shell); /** * Get user options. @@ -250,7 +250,7 @@ namespace sbuild * @param user_options map of user options. */ void - set_user_options (string_map const& user_options); + set_user_options (const string_map& user_options); /** * Get the force status of this session. @@ -296,14 +296,14 @@ namespace sbuild * @returns true if the user is a member of group, otherwise false. */ bool - is_group_member (std::string const& groupname) const; + is_group_member (const std::string& groupname) const; protected: /** * Get the chroot authentication properties the user is included in. */ void - get_chroot_membership (chroot::chroot::ptr const& chroot, + get_chroot_membership (const chroot::chroot::ptr& chroot, bool& in_users, bool& in_root_users, bool& in_groups, @@ -316,7 +316,7 @@ namespace sbuild */ virtual auth::auth::status get_chroot_auth_status (auth::auth::status status, - chroot::chroot::ptr const& chroot) const; + const chroot::chroot::ptr& chroot) const; public: /** @@ -357,7 +357,7 @@ namespace sbuild */ virtual string_list get_login_directories (chroot::chroot::ptr& session_chroot, - environment const& env) const; + const environment& env) const; /** * Get a list of directories to change to when running a command @@ -369,7 +369,7 @@ namespace sbuild */ virtual string_list get_command_directories (chroot::chroot::ptr& session_chroot, - environment const& env) const; + const environment& env) const; /** * Get a list of candidate shells to run. This is typically the @@ -433,7 +433,7 @@ namespace sbuild get_user_command (chroot::chroot::ptr& session_chroot, std::string& file, string_list& command, - environment const& env) const; + const environment& env) const; private: /** diff --git a/lib/sbuild/types.h b/lib/sbuild/types.h index 82fa7e2b..8597b5fc 100644 --- a/lib/sbuild/types.h +++ b/lib/sbuild/types.h @@ -79,7 +79,7 @@ namespace sbuild friend std::basic_ostream<charT,traits>& operator << (std::basic_ostream<charT,traits>& stream, - date_base const& dt) + const date_base& dt) { std::ios_base::iostate err = std::ios_base::goodbit; @@ -125,7 +125,7 @@ namespace sbuild { stream.setstate(std::ios::failbit); } - catch (std::ios_base::failure const& discard) + catch (const std::ios_base::failure& discard) { flag = true; } diff --git a/lib/sbuild/util.cc b/lib/sbuild/util.cc index 44058e94..223c9f5e 100644 --- a/lib/sbuild/util.cc +++ b/lib/sbuild/util.cc @@ -44,7 +44,7 @@ namespace sbuild * @param dup the duplicate character to check for. * @returns a string with any duplicates removed. */ - std::string remove_duplicates (std::string const& str, + std::string remove_duplicates (const std::string& str, char dup) { std::string ret; @@ -141,7 +141,7 @@ namespace sbuild } bool - is_absname (std::string const& name) + is_absname (const std::string& name) { if (name.empty() || name[0] != '/') return false; @@ -150,7 +150,7 @@ namespace sbuild } bool - is_valid_sessionname (std::string const& name) + is_valid_sessionname (const std::string& name) { bool match = false; @@ -168,7 +168,7 @@ namespace sbuild } bool - is_valid_filename (std::string const& name, + is_valid_filename (const std::string& name, bool lsb_mode) { bool match = false; @@ -235,8 +235,8 @@ namespace sbuild } std::string - string_list_to_string (string_list const& list, - std::string const& separator) + string_list_to_string (const string_list& list, + const std::string& separator) { std::string ret; @@ -253,8 +253,8 @@ namespace sbuild } string_list - split_string (std::string const& value, - std::string const& separator) + split_string (const std::string& value, + const std::string& separator) { string_list ret; @@ -283,8 +283,8 @@ namespace sbuild } string_list - split_string_strict (std::string const& value, - std::string const& separator) + split_string_strict (const std::string& value, + const std::string& separator) { string_list ret; @@ -311,11 +311,11 @@ namespace sbuild } std::wstring - widen_string (std::string const& str, + widen_string (const std::string& str, std::locale locale) { typedef std::codecvt<wchar_t, char, mbstate_t> codecvt_type; - codecvt_type const& cvt = std::use_facet<codecvt_type>(locale); + const codecvt_type& cvt = std::use_facet<codecvt_type>(locale); mbstate_t state; const char *cbegin = str.data(), *cend = str.data() + str.size(), *cnext; wchar_t *wcnext; @@ -358,11 +358,11 @@ namespace sbuild } std::string - narrow_string (std::wstring const& str, + narrow_string (const std::wstring& str, std::locale locale) { typedef std::codecvt<wchar_t, char, mbstate_t> codecvt_type; - codecvt_type const& cvt = std::use_facet<codecvt_type>(locale); + const codecvt_type& cvt = std::use_facet<codecvt_type>(locale); mbstate_t state; const wchar_t *wcbegin = str.data(), *wcend = str.data() + str.size(), *wcnext; char *cnext; @@ -405,9 +405,9 @@ namespace sbuild } std::string - find_program_in_path (std::string const& program, - std::string const& path, - std::string const& prefix) + find_program_in_path (const std::string& program, + const std::string& path, + const std::string& prefix) { if (program.find_first_of('/') != std::string::npos) return program; @@ -432,7 +432,7 @@ namespace sbuild access (absname.c_str(), X_OK) == 0) return realname; } - catch (std::runtime_error const& e) + catch (const std::runtime_error& e) { } } @@ -441,7 +441,7 @@ namespace sbuild } char ** - string_list_to_strv (string_list const& str) + string_list_to_strv (const string_list& str) { char **ret = new char *[str.size() + 1]; @@ -467,9 +467,9 @@ namespace sbuild } int - exec (std::string const& file, - string_list const& command, - environment const& env) + exec (const std::string& file, + const string_list& command, + const environment& env) { char **argv = string_list_to_strv(command); char **envp = env.get_strv(); @@ -503,7 +503,7 @@ namespace sbuild } } - stat::stat (std::string const& file, + stat::stat (const std::string& file, bool link): file(file), fd(0), @@ -522,7 +522,7 @@ namespace sbuild } } - stat::stat (std::string const& file, + stat::stat (const std::string& file, int fd): file(file), fd(fd), @@ -575,7 +575,7 @@ namespace sbuild query_name(name); } - passwd::passwd (std::string const& name): + passwd::passwd (const std::string& name): ::passwd(), buffer(), valid(false) @@ -648,7 +648,7 @@ namespace sbuild } void - passwd::query_name (std::string const& name) + passwd::query_name (const std::string& name) { query_name(name.c_str()); } @@ -687,7 +687,7 @@ namespace sbuild query_name(name); } - group::group (std::string const& name): + group::group (const std::string& name): ::group(), buffer(), valid(false) @@ -757,7 +757,7 @@ namespace sbuild } void - group::query_name (std::string const& name) + group::query_name (const std::string& name) { query_name(name.c_str()); } diff --git a/lib/sbuild/util.h b/lib/sbuild/util.h index 219b8718..1f650f90 100644 --- a/lib/sbuild/util.h +++ b/lib/sbuild/util.h @@ -80,7 +80,7 @@ namespace sbuild * if name is empty. */ bool - is_absname (std::string const& name); + is_absname (const std::string& name); /** * Check if a filename matches the allowed pattern(s). This will @@ -91,7 +91,7 @@ namespace sbuild * @returns true if it matches, false if not. */ bool - is_valid_sessionname (std::string const& name); + is_valid_sessionname (const std::string& name); /** * Check if a filename matches the allowed pattern(s). This will @@ -103,7 +103,7 @@ namespace sbuild * @returns true if it matches, false if not. */ bool - is_valid_filename (std::string const& name, + is_valid_filename (const std::string& name, bool lsb_mode = true); /** @@ -133,8 +133,8 @@ namespace sbuild * @returns a string. */ std::string - string_list_to_string (string_list const& list, - std::string const& separator); + string_list_to_string (const string_list& list, + const std::string& separator); /** * Split a string into a string_list. The string is split using @@ -187,8 +187,8 @@ namespace sbuild * @returns a string_list. */ std::vector<std::string> - split_string (std::string const& value, - std::string const& separator); + split_string (const std::string& value, + const std::string& separator); /** * Split a string into a string_list. The string is split using @@ -246,8 +246,8 @@ namespace sbuild * @returns a string_list. */ std::vector<std::string> - split_string_strict (std::string const& value, - std::string const& separator); + split_string_strict (const std::string& value, + const std::string& separator); /** * Widen a string. The narrow string is converted into a wide @@ -259,7 +259,7 @@ namespace sbuild * @returns a wide string. */ std::wstring - widen_string (std::string const& str, + widen_string (const std::string& str, std::locale locale); /** @@ -272,7 +272,7 @@ namespace sbuild * @returns a narrow string. */ std::string - narrow_string (std::wstring const& str, + narrow_string (const std::wstring& str, std::locale locale); /** @@ -286,9 +286,9 @@ namespace sbuild * the program could not be found. */ std::string - find_program_in_path (std::string const& program, - std::string const& path, - std::string const& prefix); + find_program_in_path (const std::string& program, + const std::string& path, + const std::string& prefix); /** * Create a string vector from a string_list. The strings in the @@ -299,7 +299,7 @@ namespace sbuild * @returns a string vector. */ char ** - string_list_to_strv (string_list const& str); + string_list_to_strv (const string_list& str); /** * Delete a string vector. The strings in the vector, as well as @@ -322,9 +322,9 @@ namespace sbuild * @returns the return value of the execve system call on failure. */ int - exec (std::string const& file, - string_list const& command, - environment const& env); + exec (const std::string& file, + const string_list& command, + const environment& env); /** * Get the type name of a type, demangled if possible. @@ -409,7 +409,7 @@ namespace sbuild * @param file the filename to use. * @param link use lstat rather than stat (i.e. don't follow symlinks). */ - stat (std::string const& file, + stat (const std::string& file, bool link = false); /** @@ -418,7 +418,7 @@ namespace sbuild * reporting). * @param fd the file descriptor to use. */ - stat (std::string const& file, + stat (const std::string& file, int fd); /** @@ -455,7 +455,7 @@ namespace sbuild * stat(2). * @returns the stat struct. */ - struct ::stat const& get_detail() + const struct ::stat& get_detail() { return this->status; } /** @@ -629,8 +629,8 @@ namespace sbuild * @returns result of OR. */ stat::mode_bits - inline operator | (stat::mode_bits const& lhs, - stat::mode_bits const& rhs) + inline operator | (const stat::mode_bits& lhs, + const stat::mode_bits& rhs) { return static_cast<stat::mode_bits> (static_cast<int>(lhs) | static_cast<int>(rhs)); @@ -643,8 +643,8 @@ namespace sbuild * @returns result of OR. */ stat::mode_bits - inline operator | (mode_t const& lhs, - stat::mode_bits const& rhs) + inline operator | (const mode_t& lhs, + const stat::mode_bits& rhs) { return static_cast<stat::mode_bits> (lhs | static_cast<int>(rhs)); @@ -657,8 +657,8 @@ namespace sbuild * @returns result of OR. */ stat::mode_bits - inline operator | (stat::mode_bits const& lhs, - mode_t const& rhs) + inline operator | (const stat::mode_bits& lhs, + const mode_t& rhs) { return static_cast<stat::mode_bits> (static_cast<int>(lhs) | rhs); @@ -671,8 +671,8 @@ namespace sbuild * @returns result of AND. */ stat::mode_bits - inline operator & (stat::mode_bits const& lhs, - stat::mode_bits const& rhs) + inline operator & (const stat::mode_bits& lhs, + const stat::mode_bits& rhs) { return static_cast<stat::mode_bits> (static_cast<int>(lhs) & static_cast<int>(rhs)); @@ -685,8 +685,8 @@ namespace sbuild * @returns result of AND. */ stat::mode_bits - inline operator & (mode_t const& lhs, - stat::mode_bits const& rhs) + inline operator & (const mode_t& lhs, + const stat::mode_bits& rhs) { return static_cast<stat::mode_bits> (lhs & static_cast<int>(rhs)); @@ -699,8 +699,8 @@ namespace sbuild * @returns result of AND. */ stat::mode_bits - inline operator & (stat::mode_bits const& lhs, - mode_t const& rhs) + inline operator & (const stat::mode_bits& lhs, + const mode_t& rhs) { return static_cast<stat::mode_bits> (static_cast<int>(lhs) & rhs); @@ -772,7 +772,7 @@ namespace sbuild * * @param name the user name to search for. */ - passwd (std::string const& name); + passwd (const std::string& name); /** * Clear search result. The query result is undefined following @@ -803,7 +803,7 @@ namespace sbuild * @param name the user name to search for. */ void - query_name (std::string const& name); + query_name (const std::string& name); /** * Check if the query result is valid. @@ -849,7 +849,7 @@ namespace sbuild * * @param name the group name to search for. */ - group (std::string const& name); + group (const std::string& name); /** * Clear search result. The query result is undefined following @@ -880,7 +880,7 @@ namespace sbuild * @param name the group name to search for. */ void - query_name (std::string const& name); + query_name (const std::string& name); /** * Check if the query result is valid. |