From: hj kim Date: Tue, 2 Jun 2020 08:30:23 +0000 (+0900) Subject: Update test code X-Git-Tag: submit/tizen/20200611.013522~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df1f569c5ecf9799bdd44e8843f2731b3209d05f;p=platform%2Fcore%2Fapi%2Fmetadata-editor.git Update test code Change-Id: I4bdd697f47887f3c7848e3ba4fdfdd17e25da1c4 --- diff --git a/test/metadata_editor_test.c b/test/metadata_editor_test.c index efc780d..6321a4e 100755 --- a/test/metadata_editor_test.c +++ b/test/metadata_editor_test.c @@ -225,7 +225,7 @@ static bool __get_tag_info(metadata_editor_h metadata) static bool __write_tag_info(metadata_editor_h metadata) { - char input_data[400]; + char input_data[400] = {0, }; printf("\n==========================================="); printf("\nPlease, type in the following tag data: "); @@ -367,25 +367,32 @@ static bool __add_picture(metadata_editor_h metadata) static bool __delete_pictures(metadata_editor_h metadata) { int ret = METADATA_EDITOR_ERROR_NONE; - uint num, i; - char *picture_index = NULL; + char *picture_num = NULL; + int num = 0; + int i = 0; - ret = metadata_editor_get_metadata(metadata, METADATA_EDITOR_ATTR_PICTURE_NUM, &picture_index); - if (ret != METADATA_EDITOR_ERROR_NONE) + ret = metadata_editor_get_metadata(metadata, METADATA_EDITOR_ATTR_PICTURE_NUM, &picture_num); + if (ret != METADATA_EDITOR_ERROR_NONE) { printf("fail to metadata_editor_get_metadata[%d]\n", ret); + return false; + } - printf("The number of pictures is [%s]\n", picture_index); + printf("The number of pictures is [%s]\n", picture_num); - if (picture_index) { - num = atoi(picture_index); - printf("Number of pictures: %u\n", num); + num = atoi(picture_num); + free(picture_num); - for (i = 0; i < num; ++i) { - metadata_editor_remove_picture(metadata, 0); - /*__printRetValue("metadata_editor_remove_picture(...)", ret); */ - } - } else + if (num == 0) { printf("There are no pictures to delete\n"); + return true; + } + + for (i = 0; i < num; ++i) { + ret = metadata_editor_remove_picture(metadata, 0); + if (ret != METADATA_EDITOR_ERROR_NONE) + printf("fail to metadata_editor_remove_picture[%d]\n", ret); + } + return true; }