From df1f569c5ecf9799bdd44e8843f2731b3209d05f Mon Sep 17 00:00:00 2001 From: hj kim Date: Tue, 2 Jun 2020 17:30:23 +0900 Subject: [PATCH] Update test code Change-Id: I4bdd697f47887f3c7848e3ba4fdfdd17e25da1c4 --- test/metadata_editor_test.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) 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; } -- 2.34.1