Change up strcasecmp/strncasecmp to be more C++y

This commit is contained in:
iikorni
2026-08-30 16:40:12 -05:00
parent 7a697986c6
commit da2a9a8fbc
32 changed files with 351 additions and 790 deletions
+19 -19
View File
@@ -232,13 +232,13 @@ static void CD_f (void)
command = command::argv (1)->c_str();
if (q_strcasecmp(command, "on") == 0)
if (std::is_eq(common::strcasecmp(command, "on")))
{
enabled = true;
return;
}
if (q_strcasecmp(command, "off") == 0)
if (std::is_eq(common::strcasecmp(command, "off")))
{
if (playing)
CDAudio_Stop();
@@ -246,7 +246,7 @@ static void CD_f (void)
return;
}
if (q_strcasecmp(command, "reset") == 0)
if (std::is_eq(common::strcasecmp(command, "reset")))
{
enabled = true;
if (playing)
@@ -257,7 +257,7 @@ static void CD_f (void)
return;
}
if (q_strcasecmp(command, "remap") == 0)
if (std::is_eq(common::strcasecmp(command, "remap")))
{
ret = command::argc() - 2;
if (ret <= 0)
@@ -282,7 +282,7 @@ static void CD_f (void)
}
}
if (q_strcasecmp(command, "play") == 0)
if (std::is_eq(common::strcasecmp(command, "play")))
{
n = atoi(command::argv (2)->c_str());
if (n == 0)
@@ -291,31 +291,31 @@ static void CD_f (void)
return;
}
if (q_strcasecmp(command, "loop") == 0)
if (std::is_eq(common::strcasecmp(command, "loop")))
{
CDAudio_Play((byte)atoi(command::argv (2)->c_str()), true);
return;
}
if (q_strcasecmp(command, "stop") == 0)
if (std::is_eq(common::strcasecmp(command, "stop")))
{
CDAudio_Stop();
return;
}
if (q_strcasecmp(command, "pause") == 0)
if (std::is_eq(common::strcasecmp(command, "pause")))
{
CDAudio_Pause();
return;
}
if (q_strcasecmp(command, "resume") == 0)
if (std::is_eq(common::strcasecmp(command, "resume")))
{
CDAudio_Resume();
return;
}
if (q_strcasecmp(command, "eject") == 0)
if (std::is_eq(common::strcasecmp(command, "eject")))
{
if (playing)
CDAudio_Stop();
@@ -324,7 +324,7 @@ static void CD_f (void)
return;
}
if (q_strcasecmp(command, "info") == 0)
if (std::is_eq(common::strcasecmp(command, "info")))
{
int current_min, current_sec, current_frame;
int length_min, length_sec, length_frame;
@@ -351,7 +351,7 @@ static void CD_f (void)
return;
}
if (q_strcasecmp(command, "next") == 0)
if (std::is_eq(common::strcasecmp(command, "next")))
{
if (playTrack == cd_handle->numtracks)
playTrack = get_first_audiotrk() - 1;
@@ -359,7 +359,7 @@ static void CD_f (void)
return;
}
if (q_strcasecmp(command, "prev") == 0)
if (std::is_eq(common::strcasecmp(command, "prev")))
{
if (playTrack == get_first_audiotrk())
playTrack = cd_handle->numtracks + 1;
@@ -486,10 +486,10 @@ static void export_cddev_arg (void)
* not needed for windows due to the way SDL_cdrom works. */
#if !defined(_WIN32)
auto i = common::check_param("-cddev");
if (i.has_value() && i.value() < com_argc - 1 && com_argv[i.value()+1][0] != '\0')
if (i.has_value() && i.value() < common::_argv.size() - 1 && common::_argv[i.value()+1][0] != '\0')
{
static char arg[64];
q_snprintf(arg, sizeof(arg), "SDL_CDROM=%s", com_argv[i.value()+1]);
q_snprintf(arg, sizeof(arg), "SDL_CDROM=%s", common::_argv[i.value()+1].c_str());
putenv(arg);
}
#endif
@@ -497,7 +497,7 @@ static void export_cddev_arg (void)
int CDAudio_Init(void)
{
if (safemode || common::check_param("-nocdaudio").has_value())
if (common::safe_mode || common::check_param("-nocdaudio").has_value())
return -1;
export_cddev_arg();
@@ -515,9 +515,9 @@ int CDAudio_Init(void)
if (sdl_num_drives < 1)
return -1;
if (const auto dev = common::check_param("-cddev"); dev.has_value() && dev.value() < com_argc - 1)
if (const auto dev = common::check_param("-cddev"); dev.has_value() && dev.value() < common::_argv.size() - 1)
{
const char *userdev = get_cddev_arg(com_argv[dev.value()+1]);
const char *userdev = get_cddev_arg(common::_argv[dev.value()+1].c_str());
if (!userdev)
{
console::info("Invalid argument to -cddev\n");
@@ -525,7 +525,7 @@ int CDAudio_Init(void)
}
for (auto i = 0; i < sdl_num_drives; i++)
{
if (!q_strcasecmp(SDL_CDName(i), userdev))
if (std::is_eq(common::strcasecmp(SDL_CDName(i), userdev)))
{
cd_dev = i;
break;