From: hj kim Date: Mon, 25 May 2020 07:16:35 +0000 (+0900) Subject: Bug fix of getting number of picture in tag X-Git-Tag: accepted/tizen/unified/20200605.020426~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8400780f013a7fe0b00dfccd88b680a0a1420f36;p=platform%2Fcore%2Fapi%2Fmetadata-editor.git Bug fix of getting number of picture in tag if there is no tag, number should be "0". Change-Id: I6b048dac7ad51a1eba273de62593c0851fcbcf70 --- diff --git a/src/metadata_editor.cpp b/src/metadata_editor.cpp index 99bc7d4..95ce276 100755 --- a/src/metadata_editor.cpp +++ b/src/metadata_editor.cpp @@ -238,9 +238,9 @@ static int __ID3_setFrameByName(ID3v2::Tag *tag2, const char *frameID, const cha static int __ID3_getNumberOfPictures(ID3v2::Tag *tag2, char **value) { - metadata_editor_retvm_if(!tag2, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag does not exist. Can not process further"); + metadata_editor_retvm_if(!value, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid value"); - *value = g_strdup_printf("%u", tag2->frameListMap()["APIC"].size()); + *value = g_strdup_printf("%u", tag2 ? tag2->frameListMap()["APIC"].size() : 0); return METADATA_EDITOR_ERROR_NONE; } @@ -407,9 +407,12 @@ static int __MP4_updateIntegerItem(MP4::Tag *tag, const char *itemname, const ch static int __MP4_getNumberOfPictures(MP4::Tag *tag, char **value) { - metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist"); + metadata_editor_retvm_if(!value, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid value"); - *value = g_strdup_printf("%u", tag->contains("covr") ? tag->item("covr").toCoverArtList().size() : 0); + if (tag && tag->contains("covr")) + *value = g_strdup_printf("%u", tag->item("covr").toCoverArtList().size()); + else + *value = g_strdup_printf("0"); return METADATA_EDITOR_ERROR_NONE; } @@ -720,7 +723,7 @@ static int __metadata_editor_get_mp4_metadata(metadata_editor_s *metadata, metad default: metadata_editor_error("Invalid attribute [%d]", attribute); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; -} + } } #if 0