Update test code 65/235165/6
authorhj kim <backto.kim@samsung.com>
Tue, 2 Jun 2020 08:30:23 +0000 (17:30 +0900)
committerhj kim <backto.kim@samsung.com>
Tue, 9 Jun 2020 00:01:33 +0000 (00:01 +0000)
Change-Id: I4bdd697f47887f3c7848e3ba4fdfdd17e25da1c4

test/metadata_editor_test.c

index efc780d..6321a4e 100755 (executable)
@@ -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;
 }