From 932ab17c9afea0bc454f4e72b5e8f4e199de4a16 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 7 Feb 2022 12:54:16 +0100 Subject: [PATCH] [libcalamares] Avoid parameter name 'stdin' --- src/libcalamares/PythonJobApi.cpp | 42 +++++++++++++++---------------- src/libcalamares/PythonJobApi.h | 16 ++++++------ 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/libcalamares/PythonJobApi.cpp b/src/libcalamares/PythonJobApi.cpp index 19fa5a0ee..c95edfb63 100644 --- a/src/libcalamares/PythonJobApi.cpp +++ b/src/libcalamares/PythonJobApi.cpp @@ -61,12 +61,12 @@ bp_list_to_qstringlist( const bp::list& args ) } static inline CalamaresUtils::ProcessResult -target_env_command( const QStringList& args, const std::string& stdin, int timeout ) +target_env_command( const QStringList& args, const std::string& input, int timeout ) { // Since Python doesn't give us the type system for distinguishing // seconds from other integral types, massage to seconds here. return CalamaresUtils::System::instance()->targetEnvCommand( - args, QString(), QString::fromStdString( stdin ), std::chrono::seconds( timeout ) ); + args, QString(), QString::fromStdString( input ), std::chrono::seconds( timeout ) ); } namespace CalamaresPython @@ -85,31 +85,31 @@ mount( const std::string& device_path, } int -target_env_call( const std::string& command, const std::string& stdin, int timeout ) +target_env_call( const std::string& command, const std::string& input, int timeout ) { - return target_env_command( QStringList { QString::fromStdString( command ) }, stdin, timeout ).first; + return target_env_command( QStringList { QString::fromStdString( command ) }, input, timeout ).first; } int -target_env_call( const bp::list& args, const std::string& stdin, int timeout ) +target_env_call( const bp::list& args, const std::string& input, int timeout ) { - return target_env_command( bp_list_to_qstringlist( args ), stdin, timeout ).first; + return target_env_command( bp_list_to_qstringlist( args ), input, timeout ).first; } int -check_target_env_call( const std::string& command, const std::string& stdin, int timeout ) +check_target_env_call( const std::string& command, const std::string& input, int timeout ) { - auto ec = target_env_command( QStringList { QString::fromStdString( command ) }, stdin, timeout ); + auto ec = target_env_command( QStringList { QString::fromStdString( command ) }, input, timeout ); return handle_check_target_env_call_error( ec, QString::fromStdString( command ) ); } int -check_target_env_call( const bp::list& args, const std::string& stdin, int timeout ) +check_target_env_call( const bp::list& args, const std::string& input, int timeout ) { - auto ec = target_env_command( bp_list_to_qstringlist( args ), stdin, timeout ); + auto ec = target_env_command( bp_list_to_qstringlist( args ), input, timeout ); if ( !ec.first ) { return ec.first; @@ -121,19 +121,19 @@ check_target_env_call( const bp::list& args, const std::string& stdin, int timeo std::string -check_target_env_output( const std::string& command, const std::string& stdin, int timeout ) +check_target_env_output( const std::string& command, const std::string& input, int timeout ) { - auto ec = target_env_command( QStringList { QString::fromStdString( command ) }, stdin, timeout ); + auto ec = target_env_command( QStringList { QString::fromStdString( command ) }, input, timeout ); handle_check_target_env_call_error( ec, QString::fromStdString( command ) ); return ec.second.toStdString(); } std::string -check_target_env_output( const bp::list& args, const std::string& stdin, int timeout ) +check_target_env_output( const bp::list& args, const std::string& input, int timeout ) { QStringList list = bp_list_to_qstringlist( args ); - auto ec = target_env_command( list, stdin, timeout ); + auto ec = target_env_command( list, input, timeout ); handle_check_target_env_call_error( ec, list.join( ' ' ) ); return ec.second.toStdString(); } @@ -201,7 +201,7 @@ static inline int _process_output( Calamares::Utils::RunLocation location, const boost::python::list& args, const boost::python::object& callback, - const std::string& stdin, + const std::string& input, int timeout ) { Calamares::Utils::Runner r( bp_list_to_qstringlist( args ) ); @@ -222,9 +222,9 @@ _process_output( Calamares::Utils::RunLocation location, } r.enableOutputProcessing(); } - if ( !stdin.empty() ) + if ( !input.empty() ) { - r.setInput( QString::fromStdString( stdin ) ); + r.setInput( QString::fromStdString( input ) ); } if ( timeout > 0 ) { @@ -243,19 +243,19 @@ _process_output( Calamares::Utils::RunLocation location, int target_env_process_output( const boost::python::list& args, const boost::python::object& callback, - const std::string& stdin, + const std::string& input, int timeout ) { - return _process_output( Calamares::Utils::RunLocation::RunInTarget, args, callback, stdin, timeout ); + return _process_output( Calamares::Utils::RunLocation::RunInTarget, args, callback, input, timeout ); } int host_env_process_output( const boost::python::list& args, const boost::python::object& callback, - const std::string& stdin, + const std::string& input, int timeout ) { - return _process_output( Calamares::Utils::RunLocation::RunInHost, args, callback, stdin, timeout ); + return _process_output( Calamares::Utils::RunLocation::RunInHost, args, callback, input, timeout ); } diff --git a/src/libcalamares/PythonJobApi.h b/src/libcalamares/PythonJobApi.h index 62346ceda..e61609460 100644 --- a/src/libcalamares/PythonJobApi.h +++ b/src/libcalamares/PythonJobApi.h @@ -28,28 +28,28 @@ int mount( const std::string& device_path, const std::string& filesystem_name = std::string(), const std::string& options = std::string() ); -int target_env_call( const std::string& command, const std::string& stdin = std::string(), int timeout = 0 ); +int target_env_call( const std::string& command, const std::string& input = std::string(), int timeout = 0 ); -int target_env_call( const boost::python::list& args, const std::string& stdin = std::string(), int timeout = 0 ); +int target_env_call( const boost::python::list& args, const std::string& input = std::string(), int timeout = 0 ); -int check_target_env_call( const std::string& command, const std::string& stdin = std::string(), int timeout = 0 ); +int check_target_env_call( const std::string& command, const std::string& input = std::string(), int timeout = 0 ); -int check_target_env_call( const boost::python::list& args, const std::string& stdin = std::string(), int timeout = 0 ); +int check_target_env_call( const boost::python::list& args, const std::string& input = std::string(), int timeout = 0 ); std::string -check_target_env_output( const std::string& command, const std::string& stdin = std::string(), int timeout = 0 ); +check_target_env_output( const std::string& command, const std::string& input = std::string(), int timeout = 0 ); std::string -check_target_env_output( const boost::python::list& args, const std::string& stdin = std::string(), int timeout = 0 ); +check_target_env_output( const boost::python::list& args, const std::string& input = std::string(), int timeout = 0 ); int target_env_process_output( const boost::python::list& args, const boost::python::object& callback = boost::python::object(), - const std::string& stdin = std::string(), + const std::string& input = std::string(), int timeout = 0 ); int host_env_process_output( const boost::python::list& args, const boost::python::object& callback = boost::python::object(), - const std::string& stdin = std::string(), + const std::string& input = std::string(), int timeout = 0 ); std::string obscure( const std::string& string );