fix several compile warnings (-Wreorder, unused parameter)

This commit is contained in:
John McQuah 2023-06-08 07:04:48 -04:00
parent 7dc024e103
commit 3a53676253
11 changed files with 32 additions and 45 deletions

View File

@ -127,6 +127,7 @@ private:
string m_pkgaddArgs;
string m_pkgrmArgs;
string m_filter;
string m_sortArgs;
string m_commandName;
string m_unknownOption;
string m_installRoot;
@ -139,7 +140,6 @@ private:
int m_verbose;
string m_sortArgs;
list<string> m_otherArgs;
list< pair<char*, ConfigArgType> > m_configData;

View File

@ -658,9 +658,6 @@ bool InstallTransaction::calcDependencies( )
}
/*
* getPkgDest assumes that you're in the build directory already
*/
string InstallTransaction::getPkgmkSetting(const string& setting)
{
string value = "";
@ -696,7 +693,7 @@ string InstallTransaction::getPkgmkSettingFromFile(const string& setting, const
if (p) {
fgets(line, 256, p);
value = StringHelper::stripWhiteSpace(line);
fclose(p);
pclose(p);
}
}

View File

@ -121,21 +121,20 @@ private:
// packages< pair<name, hasReadme> > installed by this transaction
list< pair<string, InstallInfo> > m_installedPackages;
// packages which were requested to be installed which where already
// packages requested to be installed, but already present
list<string> m_alreadyInstalledPackages;
// packages which are required by the transaction, but ignored by
// the user
// packages required by the transaction, but ignored by the user
list<string> m_ignoredPackages;
list<string> m_depNameList;
vector<string> m_depList;
vector<string> treeWalk;
// packages requested to be installed not found in the ports tree
// packages requested to be installed, but not found in the ports tree
list< pair<string, string> > m_missingPackages;
// packages where build/installed failed
// packages where build/install failed
list< pair<string, InstallInfo> > m_installErrors;
/// prt-get itself

View File

@ -124,7 +124,7 @@ const string& Package::maintainer() const
}
/*! \return whether or not this package has a readme file */
const bool Package::hasReadme() const
bool Package::hasReadme() const
{
load();
return m_data->hasReadme;
@ -137,12 +137,12 @@ string Package::versionReleaseString() const
return m_data->versionReleaseString;
}
const bool Package::hasPreInstall() const
bool Package::hasPreInstall() const
{
return m_data->hasPreInstall;
}
const bool Package::hasPostInstall() const
bool Package::hasPostInstall() const
{
return m_data->hasPostInstall;
}
@ -345,11 +345,9 @@ void Package::expandShellCommands(std::string& input,
pos = 0;
while ((pos = input.find(startTag[i], pos)) != string::npos) {
if (unameBuf.release) {
input = replaceAll(input,
startTag[i] + "uname -r" + endTag[i],
unameBuf.release);
}
input = replaceAll(input,
startTag[i] + "uname -r" + endTag[i],
unameBuf.release);
dpos = input.find(startTag[i] + "date");
if (dpos != string::npos) {

View File

@ -52,9 +52,9 @@ public:
const std::string& url() const;
const std::string& optionals() const;
const std::string& maintainer() const;
const bool hasReadme() const;
const bool hasPreInstall() const;
const bool hasPostInstall() const;
bool hasReadme() const;
bool hasPreInstall() const;
bool hasPostInstall() const;
std::string versionReleaseString() const;

View File

@ -68,9 +68,9 @@ int Process::execute()
int status = 0;
if ( m_fdlog > 0 ) {
status = execLog(argc, argv);
status = execLog(argv);
} else {
status = exec(argc, argv);
status = exec(argv);
}
delete [] argv;
@ -78,7 +78,7 @@ int Process::execute()
}
int Process::execLog(const int argc, char** argv)
int Process::execLog(char** argv)
{
int status = 0;
int fdpipe[2];
@ -123,7 +123,7 @@ int Process::execLog(const int argc, char** argv)
}
int Process::exec(const int argc, char** argv)
int Process::exec(char** argv)
{
int status = 0;
pid_t pid = fork();

View File

@ -32,8 +32,8 @@ public:
private:
int exec(const int argc, char** argv);
int execLog(const int argc, char** argv);
int exec(char** argv);
int execLog(char** argv);
int execShell(const char* shell);
int execShellLog(const char* shell);

View File

@ -554,9 +554,6 @@ void PrtGet::listInstalled() {
void PrtGet::install( bool dependencies ) {
assertMinArgCount(1);
const list<string>& args = m_parser->otherArgs();
list<string>::const_iterator it = args.begin();
initRepo();
if (dependencies) {
@ -634,7 +631,7 @@ void PrtGet::executeTransaction( InstallTransaction& transaction ) {
cout << m_appName <<
": can't create lock file for the log file. " <<
"\nMaybe there's another instance of prt-get using the same " <<
"file." << "\nIf this is a stale not, please remove " << endl;
"file." << "\nIf this is a stale note, please remove " << endl;
failed = true;
break;
default:
@ -1342,7 +1339,7 @@ void PrtGet::current() {
}
}
SignalHandler::HandlerResult PrtGet::handleSignal( int signal )
SignalHandler::HandlerResult PrtGet::handleSignal()
{
// TODO: second argument could also be true:
// TODO: kill installtransaction
@ -1561,10 +1558,7 @@ void PrtGet::cat() {
string arg = *it;
const Package* p = m_repo->getPackage( arg );
if ( p ) {
string fileName = "Pkgfile";
if (++it != m_parser->otherArgs().end()) {
fileName = *it;
}
string fileName = (++it != m_parser->otherArgs().end()) ? *it : "Pkgfile";
string file = p->path() + "/" + p->name() + "/" + fileName;
if (!printFile(file)) {
cerr << "File '" << fileName << "' not found" << endl;
@ -1598,11 +1592,8 @@ void PrtGet::remove() {
list<string>::const_iterator it = args.begin();
for ( ; it != args.end(); ++it ) {
if (m_pkgDB->isInstalled(*it)) {
// TODO: prettify
string args = "";
if (m_parser->installRoot() != "") {
args = "-r " + m_parser->installRoot() + " ";
}
string args = (m_parser->installRoot() == "") ? "" :
"-r " + m_parser->installRoot() + " ";
args += (m_parser->pkgrmArgs() + " " + *it);
Process proc(command, args);
@ -1696,6 +1687,8 @@ void PrtGet::printDepTree() {
return;
} else if (reverse) {
depTreeHeader = "Packages that depend on " + p->name();
} else {
depTreeHeader = "Packages needed by " + p->name();
}
if ( !m_followSoftdeps ) {
@ -1928,7 +1921,7 @@ void PrtGet::dumpConfig() {
cout.setf( ios::left, ios::adjustfield );
cout.width( 20 );
cout.fill( ' ' );
cout << "Pkgmk settings: " << m_config->logFilePattern() << endl;
cout << "Pkgmk settings: " << endl;
cout.setf( ios::left, ios::adjustfield );
cout.width( 20 );
cout.fill( ' ' );

View File

@ -87,7 +87,7 @@ public:
int returnValue() const;
SignalHandler::HandlerResult handleSignal( int signal );
SignalHandler::HandlerResult handleSignal();
protected:

View File

@ -36,7 +36,7 @@ void SignalDispatcher::dispatch( int signalNumber )
map<int, SignalHandler*>::iterator it =
SignalDispatcher::instance()->m_signalHandlers.find( signalNumber );
if ( it != SignalDispatcher::instance()->m_signalHandlers.end() ) {
it->second->handleSignal( signalNumber );
it->second->handleSignal();
} else {
cerr << "prt-get: caught signal " << signalNumber << endl;
}

View File

@ -28,7 +28,7 @@ public:
EXIT, /*!< signal handled, exit now */
CONTINUE /*!< signal handled, don't exit */
};
virtual HandlerResult handleSignal( int signalNumber ) = 0;
virtual HandlerResult handleSignal() = 0;
};
/*!