mirror of
https://github.com/etlegacy/Update-Installer.git
synced 2024-11-23 04:01:59 +00:00
Fix warnings about conversion from string literal to char*
UpdaterOptions::parse() will probably not have a need to modify its arguments but for consistency with the declaration of main() it takes a char*, so strdup() the strings.
This commit is contained in:
parent
4c574bde87
commit
91f402afa2
1 changed files with 11 additions and 6 deletions
|
@ -7,12 +7,12 @@ void TestUpdaterOptions::testOldFormatArgs()
|
||||||
{
|
{
|
||||||
const int argc = 6;
|
const int argc = 6;
|
||||||
char* argv[argc];
|
char* argv[argc];
|
||||||
argv[0] = "updater";
|
argv[0] = strdup("updater");
|
||||||
argv[1] = "CurrentDir=/path/to/app";
|
argv[1] = strdup("CurrentDir=/path/to/app");
|
||||||
argv[2] = "TempDir=/tmp/updater";
|
argv[2] = strdup("TempDir=/tmp/updater");
|
||||||
argv[3] = "UpdateScriptFileName=/tmp/updater/file_list.xml";
|
argv[3] = strdup("UpdateScriptFileName=/tmp/updater/file_list.xml");
|
||||||
argv[4] = "AppFileName=/path/to/app/theapp";
|
argv[4] = strdup("AppFileName=/path/to/app/theapp");
|
||||||
argv[5] = "PID=123456";
|
argv[5] = strdup("PID=123456");
|
||||||
|
|
||||||
UpdaterOptions options;
|
UpdaterOptions options;
|
||||||
options.parse(argc,argv);
|
options.parse(argc,argv);
|
||||||
|
@ -22,6 +22,11 @@ void TestUpdaterOptions::testOldFormatArgs()
|
||||||
TEST_COMPARE(options.packageDir,"/tmp/updater");
|
TEST_COMPARE(options.packageDir,"/tmp/updater");
|
||||||
TEST_COMPARE(options.scriptPath,"/tmp/updater/file_list.xml");
|
TEST_COMPARE(options.scriptPath,"/tmp/updater/file_list.xml");
|
||||||
TEST_COMPARE(options.waitPid,123456);
|
TEST_COMPARE(options.waitPid,123456);
|
||||||
|
|
||||||
|
for (int i=0; i < argc; i++)
|
||||||
|
{
|
||||||
|
free(argv[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int,char**)
|
int main(int,char**)
|
||||||
|
|
Loading…
Reference in a new issue