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_pkgaddArgs;
string m_pkgrmArgs; string m_pkgrmArgs;
string m_filter; string m_filter;
string m_sortArgs;
string m_commandName; string m_commandName;
string m_unknownOption; string m_unknownOption;
string m_installRoot; string m_installRoot;
@ -139,7 +140,6 @@ private:
int m_verbose; int m_verbose;
string m_sortArgs;
list<string> m_otherArgs; list<string> m_otherArgs;
list< pair<char*, ConfigArgType> > m_configData; 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 InstallTransaction::getPkgmkSetting(const string& setting)
{ {
string value = ""; string value = "";
@ -696,7 +693,7 @@ string InstallTransaction::getPkgmkSettingFromFile(const string& setting, const
if (p) { if (p) {
fgets(line, 256, p); fgets(line, 256, p);
value = StringHelper::stripWhiteSpace(line); value = StringHelper::stripWhiteSpace(line);
fclose(p); pclose(p);
} }
} }

View File

@ -121,21 +121,20 @@ private:
// packages< pair<name, hasReadme> > installed by this transaction // packages< pair<name, hasReadme> > installed by this transaction
list< pair<string, InstallInfo> > m_installedPackages; 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; list<string> m_alreadyInstalledPackages;
// packages which are required by the transaction, but ignored by // packages required by the transaction, but ignored by the user
// the user
list<string> m_ignoredPackages; list<string> m_ignoredPackages;
list<string> m_depNameList; list<string> m_depNameList;
vector<string> m_depList; vector<string> m_depList;
vector<string> treeWalk; 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; list< pair<string, string> > m_missingPackages;
// packages where build/installed failed // packages where build/install failed
list< pair<string, InstallInfo> > m_installErrors; list< pair<string, InstallInfo> > m_installErrors;
/// prt-get itself /// prt-get itself

View File

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

View File

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

View File

@ -68,9 +68,9 @@ int Process::execute()
int status = 0; int status = 0;
if ( m_fdlog > 0 ) { if ( m_fdlog > 0 ) {
status = execLog(argc, argv); status = execLog(argv);
} else { } else {
status = exec(argc, argv); status = exec(argv);
} }
delete [] 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 status = 0;
int fdpipe[2]; 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; int status = 0;
pid_t pid = fork(); pid_t pid = fork();

View File

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

View File

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

View File

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

View File

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

View File

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