From: Minje Ahn Date: Tue, 27 Oct 2020 04:11:35 +0000 (+0900) Subject: Merge same logic X-Git-Tag: submit/tizen/20201103.020205~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F16%2F246216%2F3;p=platform%2Fcore%2Fmultimedia%2Flibmm-fileinfo.git Merge same logic Merge AV_ID3TAG_COMMENT and AV_ID3TAG_URL. Change-Id: I5b2f8f9121846f096a4277c6cba8592e2e0b5f6b Signed-off-by: Minje Ahn --- diff --git a/utils/mm_file_util_tag.c b/utils/mm_file_util_tag.c index 050cf28..9617866 100644 --- a/utils/mm_file_util_tag.c +++ b/utils/mm_file_util_tag.c @@ -2901,7 +2901,7 @@ bool mm_file_id3tag_parse_v222(AvFileContentInfo *pInfo, unsigned char *buffer) unsigned char *pExtContent = NULL; unsigned long purelyFramelen = 0; unsigned int encodingOffSet = 0; - int realCpyFrameNum = 0, tmp = 0; + int realCpyFrameNum = 0; int textEncodingType = 0; char **charset_array = NULL; AvID3TagList tag_id = AV_ID3TAG_MAX; @@ -2962,40 +2962,23 @@ bool mm_file_id3tag_parse_v222(AvFileContentInfo *pInfo, unsigned char *buffer) switch (tag_id) { case AV_ID3TAG_COMMENT: - /*skip language data! */ - if (realCpyFrameNum > 4) { - realCpyFrameNum -= 4; - tmp = 4; - - /*pExtContent[tmp+1] value should't have encoding value */ - if (pExtContent[tmp] > 0x20 && (pExtContent[tmp - 1] == 0x00 || pExtContent[tmp - 1] == 0x01)) { - textEncodingType = __id3tag_get_text_encoding_v222(pExtContent, tmp); - pInfo->tagInfo[tag_id].value = mmfile_convert_to_utf8((const char *)pExtContent, realCpyFrameNum, charset_array[textEncodingType]); - } else { - debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: failed to get Comment: tmp(%d), purelyFramelen - encodingOffSet(%lu)", tmp, purelyFramelen - encodingOffSet); - } - } else { - debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: Description info too small to parse realCpyFrameNum(%d)", realCpyFrameNum); - } - break; - + /* fall through */ case AV_ID3TAG_URL: - if (realCpyFrameNum > 4) { - /*skip language data! */ - realCpyFrameNum -= 4; - tmp = 4; + if (realCpyFrameNum <= 4) { + debug_msg(RELEASE, "Too small to parse realCpyFrameNum(%d)", realCpyFrameNum); + break; + } - /*pExtContent[tmp+1] value should't have null value */ - if (pExtContent[tmp] > 0x20 && (pExtContent[tmp - 1] == 0x00 || pExtContent[tmp - 1] == 0x01)) { - textEncodingType = __id3tag_get_text_encoding_v222(pExtContent, tmp); + /*skip language data! */ + realCpyFrameNum -= 4; - pInfo->tagInfo[tag_id].value = mmfile_convert_to_utf8((const char *)pExtContent, realCpyFrameNum, charset_array[textEncodingType]); - } else { - debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: failed to get URL Info tmp(%d), purelyFramelen - encodingOffSet(%lu)", tmp, purelyFramelen - encodingOffSet); - } + if (pExtContent[4] > 0x20 && (pExtContent[3] == 0x00 || pExtContent[3] == 0x01)) { + textEncodingType = __id3tag_get_text_encoding_v222(pExtContent, 4); + pInfo->tagInfo[tag_id].value = mmfile_convert_to_utf8((const char *)pExtContent, realCpyFrameNum, charset_array[textEncodingType]); } else { - debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: URL info too small to parse realCpyFrameNum(%d)", realCpyFrameNum); + debug_msg(RELEASE, "Failed to get tag: purelyFramelen - encodingOffSet(%lu)", purelyFramelen - encodingOffSet); } + break; case AV_ID3TAG_PICTURE: