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: ");
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;
}