Start using string_ends_with

This commit is contained in:
twinaphex 2020-05-22 20:07:21 +02:00
parent 7cbb79277d
commit 9f4b3b0fc6
5 changed files with 23 additions and 26 deletions

View File

@ -851,7 +851,7 @@ void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
if (!path)
continue;
if (!strstr(path, ".lpl"))
if (!string_ends_with(path, ".lpl"))
continue;
{
@ -968,7 +968,7 @@ void ozone_context_destroy_horizontal_list(ozone_handle_t *ozone)
file_list_get_at_offset(ozone->horizontal_list, i,
&path, NULL, NULL, NULL);
if (!path || !strstr(path, ".lpl"))
if (!path || !string_ends_with(path, ".lpl"))
continue;
video_driver_texture_unload(&node->icon);

View File

@ -1839,7 +1839,7 @@ static void stripes_context_destroy_horizontal_list(stripes_handle_t *stripes)
file_list_get_at_offset(stripes->horizontal_list, i,
&path, NULL, NULL, NULL);
if (!path || !strstr(path, ".lpl"))
if (!path || !string_ends_with(path, ".lpl"))
continue;
video_driver_texture_unload(&node->icon);
@ -1937,10 +1937,7 @@ static void stripes_context_reset_horizontal_list(
file_list_get_at_offset(stripes->horizontal_list, i,
&path, NULL, NULL, NULL);
if (!path)
continue;
if (!strstr(path, ".lpl"))
if (!path || !string_ends_with(path, ".lpl"))
continue;
{

View File

@ -2016,7 +2016,7 @@ static void xmb_context_destroy_horizontal_list(xmb_handle_t *xmb)
file_list_get_at_offset(xmb->horizontal_list, i,
&path, NULL, NULL, NULL);
if (!path || !strstr(path, ".lpl"))
if (!path || !string_ends_with(path, ".lpl"))
continue;
video_driver_texture_unload(&node->icon);
@ -2115,7 +2115,7 @@ static void xmb_context_reset_horizontal_list(
if (!path)
continue;
if (!strstr(path, ".lpl"))
if (!string_ends_with(path, ".lpl"))
continue;
{

View File

@ -249,9 +249,9 @@ static bool menu_shader_manager_save_preset_internal(
strlcpy(fullname, basename, sizeof(fullname));
/* Append extension automatically as appropriate. */
if ( !strstr(basename, ".cgp")
&& !strstr(basename, ".glslp")
&& !strstr(basename, ".slangp"))
if ( !string_ends_with(basename, ".cgp")
&& !string_ends_with(basename, ".glslp")
&& !string_ends_with(basename, ".slangp"))
{
const char *preset_ext = video_shader_get_preset_extension(type);
strlcat(fullname, preset_ext, sizeof(fullname));

View File

@ -479,34 +479,34 @@ bool task_push_audio_mixer_load_and_play(
nbio->type = NBIO_TYPE_NONE;
mixer->type = AUDIO_MIXER_TYPE_NONE;
if (strstr(fullpath, ".wav"))
if (string_ends_with(fullpath, ".wav"))
{
mixer->type = AUDIO_MIXER_TYPE_WAV;
nbio->type = NBIO_TYPE_WAV;
t->callback = task_audio_mixer_handle_upload_wav_and_play;
}
else if (strstr(fullpath, ".ogg"))
else if (string_ends_with(fullpath, ".ogg"))
{
mixer->type = AUDIO_MIXER_TYPE_OGG;
nbio->type = NBIO_TYPE_OGG;
t->callback = task_audio_mixer_handle_upload_ogg_and_play;
}
else if (strstr(fullpath, ".mp3"))
else if (string_ends_with(fullpath, ".mp3"))
{
mixer->type = AUDIO_MIXER_TYPE_MP3;
nbio->type = NBIO_TYPE_MP3;
t->callback = task_audio_mixer_handle_upload_mp3_and_play;
}
else if (strstr(fullpath, ".flac"))
else if (string_ends_with(fullpath, ".flac"))
{
mixer->type = AUDIO_MIXER_TYPE_FLAC;
nbio->type = NBIO_TYPE_FLAC;
t->callback = task_audio_mixer_handle_upload_flac_and_play;
}
else if (
strstr(fullpath, ".mod") ||
strstr(fullpath, ".s3m") ||
strstr(fullpath, ".xm"))
string_ends_with(fullpath, ".mod") ||
string_ends_with(fullpath, ".s3m") ||
string_ends_with(fullpath, ".xm"))
{
mixer->type = AUDIO_MIXER_TYPE_MOD;
nbio->type = NBIO_TYPE_MOD;
@ -589,34 +589,34 @@ bool task_push_audio_mixer_load(
nbio->type = NBIO_TYPE_NONE;
mixer->type = AUDIO_MIXER_TYPE_NONE;
if (strstr(fullpath, ".wav"))
if (string_ends_with(fullpath, ".wav"))
{
mixer->type = AUDIO_MIXER_TYPE_WAV;
nbio->type = NBIO_TYPE_WAV;
t->callback = task_audio_mixer_handle_upload_wav;
}
else if (strstr(fullpath, ".ogg"))
else if (string_ends_with(fullpath, ".ogg"))
{
mixer->type = AUDIO_MIXER_TYPE_OGG;
nbio->type = NBIO_TYPE_OGG;
t->callback = task_audio_mixer_handle_upload_ogg;
}
else if (strstr(fullpath, ".mp3"))
else if (string_ends_with(fullpath, ".mp3"))
{
mixer->type = AUDIO_MIXER_TYPE_MP3;
nbio->type = NBIO_TYPE_MP3;
t->callback = task_audio_mixer_handle_upload_mp3;
}
else if (strstr(fullpath, ".flac"))
else if (string_ends_with(fullpath, ".flac"))
{
mixer->type = AUDIO_MIXER_TYPE_FLAC;
nbio->type = NBIO_TYPE_FLAC;
t->callback = task_audio_mixer_handle_upload_flac;
}
else if (
strstr(fullpath, ".mod") ||
strstr(fullpath, ".s3m") ||
strstr(fullpath, ".xm"))
string_ends_with(fullpath, ".mod") ||
string_ends_with(fullpath, ".s3m") ||
string_ends_with(fullpath, ".xm"))
{
mixer->type = AUDIO_MIXER_TYPE_MOD;
nbio->type = NBIO_TYPE_MOD;