From 3c61823309bdb1db3ff9bd3331c833b925eed6d7 Mon Sep 17 00:00:00 2001 From: hj kim Date: Mon, 13 May 2019 11:43:42 +0900 Subject: [PATCH] Change strcasecmp() to g_ascii_strcasecmp() because strcasecmp is locale sensitive. Change-Id: Iff51728241d047f0af6f4dc2addbeecd5f573899 --- formats/ffmpeg/mm_file_format_ffmpeg.c | 32 +++++++++++++------------- utils/mm_file_util_mime.c | 2 +- utils/mm_file_util_tag.c | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/formats/ffmpeg/mm_file_format_ffmpeg.c b/formats/ffmpeg/mm_file_format_ffmpeg.c index 06d6939..9ad513c 100755 --- a/formats/ffmpeg/mm_file_format_ffmpeg.c +++ b/formats/ffmpeg/mm_file_format_ffmpeg.c @@ -618,51 +618,51 @@ int mmfile_format_read_tag_ffmpg(MMFileFormatContext *formatContext) AVDictionaryEntry *tag = NULL; while ((tag = av_dict_get(metainfo, "", tag, AV_DICT_IGNORE_SUFFIX))) { if (tag->key != NULL) { - if (!strcasecmp(tag->key, "title")) { + if (!g_ascii_strcasecmp(tag->key, "title")) { if (formatContext->title) free(formatContext->title); formatContext->title = mmfile_strdup(tag->value); - } else if (!strcasecmp(tag->key, "artist")) { + } else if (!g_ascii_strcasecmp(tag->key, "artist")) { if (formatContext->artist) free(formatContext->artist); formatContext->artist = mmfile_strdup(tag->value); - } else if (!strcasecmp(tag->key, "composer")) { + } else if (!g_ascii_strcasecmp(tag->key, "composer")) { if (formatContext->composer) free(formatContext->composer); formatContext->composer = mmfile_strdup(tag->value); - } else if (!strcasecmp(tag->key, "album")) { + } else if (!g_ascii_strcasecmp(tag->key, "album")) { if (formatContext->album) free(formatContext->album); formatContext->album = mmfile_strdup(tag->value); - } else if (!strcasecmp(tag->key, "album_artist")) { + } else if (!g_ascii_strcasecmp(tag->key, "album_artist")) { if (formatContext->album_artist) free(formatContext->album_artist); formatContext->album_artist = mmfile_strdup(tag->value); - } else if (!strcasecmp(tag->key, "copyright")) { + } else if (!g_ascii_strcasecmp(tag->key, "copyright")) { if (formatContext->copyright) free(formatContext->copyright); formatContext->copyright = mmfile_strdup(tag->value); - } else if (!strcasecmp(tag->key, "comment")) { + } else if (!g_ascii_strcasecmp(tag->key, "comment")) { if (formatContext->comment) free(formatContext->comment); formatContext->comment = mmfile_strdup(tag->value); - } else if (!strcasecmp(tag->key, "description")) { + } else if (!g_ascii_strcasecmp(tag->key, "description")) { if (formatContext->description) free(formatContext->description); formatContext->description = mmfile_strdup(tag->value); - } else if (!strcasecmp(tag->key, "genre")) { + } else if (!g_ascii_strcasecmp(tag->key, "genre")) { if (formatContext->genre) free(formatContext->genre); formatContext->genre = mmfile_strdup(tag->value); - } else if (!strcasecmp(tag->key, "date")) { + } else if (!g_ascii_strcasecmp(tag->key, "date")) { if (formatContext->year) free(formatContext->year); formatContext->year = mmfile_strdup(tag->value); - } else if (!strcasecmp(tag->key, "creation_time")) { + } else if (!g_ascii_strcasecmp(tag->key, "creation_time")) { if (formatContext->recDate) free(formatContext->recDate); formatContext->recDate = mmfile_strdup(tag->value); - } else if ((!strcasecmp(tag->key, "track")) || (!strcasecmp(tag->key, "tracknumber"))) { + } else if ((!g_ascii_strcasecmp(tag->key, "track")) || (!g_ascii_strcasecmp(tag->key, "tracknumber"))) { if (formatContext->tagTrackNum) free(formatContext->tagTrackNum); formatContext->tagTrackNum = mmfile_strdup(tag->value); - } else if (!strcasecmp(tag->key, "lyrics")) { + } else if (!g_ascii_strcasecmp(tag->key, "lyrics")) { if (formatContext->unsyncLyrics) free(formatContext->unsyncLyrics); formatContext->unsyncLyrics = mmfile_strdup(tag->value); - } else if (!strcasecmp(tag->key, "rotate")) { /*can be "90", "180", "270" */ + } else if (!g_ascii_strcasecmp(tag->key, "rotate")) { /*can be "90", "180", "270" */ if (formatContext->rotate) free(formatContext->rotate); formatContext->rotate = mmfile_strdup(tag->value); - } else if (!strcasecmp(tag->key, "spherical-video")) { + } else if (!g_ascii_strcasecmp(tag->key, "spherical-video")) { ParseSpatialVideoMetadataFromXMLString(tag->value, formatContext); - } else if (!strcasecmp(tag->key, "metadata_block_picture")) { + } else if (!g_ascii_strcasecmp(tag->key, "metadata_block_picture")) { gsize len = 0; guchar *meta_data = NULL; diff --git a/utils/mm_file_util_mime.c b/utils/mm_file_util_mime.c index 7295d47..f4834df 100755 --- a/utils/mm_file_util_mime.c +++ b/utils/mm_file_util_mime.c @@ -140,7 +140,7 @@ int mmfile_util_get_ffmpeg_format(const char *mime, char *ffmpegFormat) } for (i = 0; i < table_size; i++) { - if (!strcasecmp(MMFILE_FFMPEG_MIME_TABLE[i].mimetype, mime)) { + if (!g_ascii_strcasecmp(MMFILE_FFMPEG_MIME_TABLE[i].mimetype, mime)) { break; } } diff --git a/utils/mm_file_util_tag.c b/utils/mm_file_util_tag.c index e84d511..ab94ba8 100755 --- a/utils/mm_file_util_tag.c +++ b/utils/mm_file_util_tag.c @@ -3325,7 +3325,7 @@ bool mm_file_id3tag_parse_v223(AvFileContentInfo *pInfo, unsigned char *buffer) debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)\n", tmp, textEncodingType, realCpyFrameNum); if (textEncodingType == AV_ID3V2_ISO_8859) { - if (lang_info != NULL && !strcasecmp(lang_info, "KOR")) { + if (lang_info != NULL && !g_ascii_strcasecmp(lang_info, "KOR")) { char_set = strdup("EUC-KR"); } else { char_set = mmfile_get_charset((const char *)&pExtContent[tmp]); -- 2.34.1