mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
DSPTool: Use std::string == instead of strcmp
Less C-like and conveniently fixes a build issue caused by strcmp not being declared for some reason. Converting to std::string is safe because the argument count is checked every time so the char* cannot be a nullptr.
This commit is contained in:
parent
9ea3e833ba
commit
eb9009e5c0
@ -352,6 +352,11 @@ static bool PerformAssembly(const std::string& input_name, const std::string& ou
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool IsHelpFlag(const std::string& argument)
|
||||||
|
{
|
||||||
|
return argument == "--help" || argument == "-?";
|
||||||
|
}
|
||||||
|
|
||||||
// Usage:
|
// Usage:
|
||||||
// Disassemble a file:
|
// Disassemble a file:
|
||||||
// dsptool -d -o asdf.txt asdf.bin
|
// dsptool -d -o asdf.txt asdf.bin
|
||||||
@ -365,7 +370,7 @@ static bool PerformAssembly(const std::string& input_name, const std::string& ou
|
|||||||
// dsptool -p dsp_dump0.bin
|
// dsptool -p dsp_dump0.bin
|
||||||
int main(int argc, const char* argv[])
|
int main(int argc, const char* argv[])
|
||||||
{
|
{
|
||||||
if (argc == 1 || (argc == 2 && (!strcmp(argv[1], "--help") || (!strcmp(argv[1], "-?")))))
|
if (argc == 1 || (argc == 2 && IsHelpFlag(argv[1])))
|
||||||
{
|
{
|
||||||
printf("USAGE: DSPTool [-?] [--help] [-f] [-d] [-m] [-p <FILE>] [-o <FILE>] [-h <FILE>] <DSP "
|
printf("USAGE: DSPTool [-?] [--help] [-f] [-d] [-m] [-p <FILE>] [-o <FILE>] [-h <FILE>] <DSP "
|
||||||
"ASSEMBLER FILE>\n");
|
"ASSEMBLER FILE>\n");
|
||||||
@ -393,33 +398,34 @@ int main(int argc, const char* argv[])
|
|||||||
print_results = false, print_results_prodhack = false, print_results_srhack = false;
|
print_results = false, print_results_prodhack = false, print_results_srhack = false;
|
||||||
for (int i = 1; i < argc; i++)
|
for (int i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
if (!strcmp(argv[i], "-d"))
|
const std::string argument = argv[i];
|
||||||
|
if (argument == "-d")
|
||||||
disassemble = true;
|
disassemble = true;
|
||||||
else if (!strcmp(argv[i], "-o"))
|
else if (argument == "-o")
|
||||||
output_name = argv[++i];
|
output_name = argv[++i];
|
||||||
else if (!strcmp(argv[i], "-h"))
|
else if (argument == "-h")
|
||||||
output_header_name = argv[++i];
|
output_header_name = argv[++i];
|
||||||
else if (!strcmp(argv[i], "-c"))
|
else if (argument == "-c")
|
||||||
compare = true;
|
compare = true;
|
||||||
else if (!strcmp(argv[i], "-s"))
|
else if (argument == "-s")
|
||||||
outputSize = true;
|
outputSize = true;
|
||||||
else if (!strcmp(argv[i], "-m"))
|
else if (argument == "-m")
|
||||||
multiple = true;
|
multiple = true;
|
||||||
else if (!strcmp(argv[i], "-f"))
|
else if (argument == "-f")
|
||||||
force = true;
|
force = true;
|
||||||
else if (!strcmp(argv[i], "-p"))
|
else if (argument == "-p")
|
||||||
print_results = true;
|
print_results = true;
|
||||||
else if (!strcmp(argv[i], "-ps"))
|
else if (argument == "-ps")
|
||||||
{
|
{
|
||||||
print_results = true;
|
print_results = true;
|
||||||
print_results_srhack = true;
|
print_results_srhack = true;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "-pm"))
|
else if (argument == "-pm")
|
||||||
{
|
{
|
||||||
print_results = true;
|
print_results = true;
|
||||||
print_results_prodhack = true;
|
print_results_prodhack = true;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "-psm"))
|
else if (argument == "-psm")
|
||||||
{
|
{
|
||||||
print_results = true;
|
print_results = true;
|
||||||
print_results_srhack = true;
|
print_results_srhack = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user