remove 'isReadOnly'. readOnly() of File can replace it 60/232160/3
authorhj kim <backto.kim@samsung.com>
Tue, 28 Apr 2020 23:32:53 +0000 (08:32 +0900)
committerhj kim <backto.kim@samsung.com>
Wed, 6 May 2020 07:26:54 +0000 (07:26 +0000)
Change-Id: I467df758aa84a3cbf47aaefcc27ac79f5370be0a

include/metadata_editor_private.h
src/metadata_editor.cpp

index a266ead..47e2840 100755 (executable)
@@ -88,7 +88,6 @@ extern "C" {
 typedef struct {
        TagLib::File*   file;
        int     filetype;
-       bool    isReadOnly;
 } metadata_editor_s;
 
 #ifdef __cplusplus
index 3858e8b..c2ffd52 100755 (executable)
@@ -66,7 +66,7 @@ static int __check_metadata_set_parameter(metadata_editor_s *metadata)
        ret = __check_metadata_parameter(metadata);
        metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_parameter");
 
-       metadata_editor_retvm_if(metadata->isReadOnly, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File is readonly. Unable to modify");
+       metadata_editor_retvm_if(metadata->file->readOnly(), METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File is readonly. Unable to modify");
 
        return METADATA_EDITOR_ERROR_NONE;
 }
@@ -784,7 +784,6 @@ extern "C" int metadata_editor_create(metadata_editor_h *metadata) {
 
        _metadata->file = NULL;
        _metadata->filetype = METADATA_EDITOR_FORMAT_NOTYPE;                    // Specify file type out of range
-       _metadata->isReadOnly = true;                                           // Handle unexisting file as readonly
 
        // Save the structure in the metadata
        *metadata = (metadata_editor_h)_metadata;
@@ -819,7 +818,6 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char *
 
                _metadata->file = NULL;
                _metadata->filetype = METADATA_EDITOR_FORMAT_NOTYPE;
-               _metadata->isReadOnly = true;
        }
 
        try {
@@ -867,7 +865,6 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char *
 
        _metadata->file = _file;
        _metadata->filetype = media_type;
-       _metadata->isReadOnly = _file->readOnly();
 
        return METADATA_EDITOR_ERROR_NONE;
 }