From 6955f6010fc3d35e66643e7aa1e64a8eb670294c Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Fri, 23 Sep 2016 10:28:17 +0900 Subject: [PATCH 01/16] Fix native api reference warning Change-Id: I712c7e25e48cb0142b15f15df79c7d45e8dcf79d Signed-off-by: Minje Ahn --- include/metadata_editor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/metadata_editor.h b/include/metadata_editor.h index 1502e52..07d6a50 100755 --- a/include/metadata_editor.h +++ b/include/metadata_editor.h @@ -107,7 +107,7 @@ int metadata_editor_get_metadata(metadata_editor_h metadata, metadata_editor_att * * @param [in] metadata The handle to metadata * @param [in] attribute key attribute name to get - * @param [int] value The value of the attribute + * @param [in] value The value of the attribute * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter -- 2.7.4 From 10eca137f487ab21d6aaddc96a8754499d7af1b0 Mon Sep 17 00:00:00 2001 From: Jiyong Min Date: Mon, 9 Jan 2017 09:29:48 +0900 Subject: [PATCH 02/16] fix build error (build fails because of undefined C++11 user-defined literals) Change-Id: If4d3caa4fd73e7881304cd33f68b536addf92549 Signed-off-by: jiyong.min --- include/metadata_editor_private.h | 8 ++++---- packaging/capi-media-metadata-editor.spec | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/metadata_editor_private.h b/include/metadata_editor_private.h index f60994f..48d558b 100755 --- a/include/metadata_editor_private.h +++ b/include/metadata_editor_private.h @@ -61,15 +61,15 @@ extern "C" { #define metadata_editor_debug(fmt, arg...) do { \ - LOGD(""fmt"", ##arg); \ + LOGD("" fmt "", ##arg); \ } while (0) #define metadata_editor_info(fmt, arg...) do { \ - LOGI(""fmt"", ##arg); \ + LOGI("" fmt "", ##arg); \ } while (0) #define metadata_editor_error(fmt, arg...) do { \ - LOGE(""fmt"", ##arg); \ + LOGE("" fmt "", ##arg); \ } while (0) #define metadata_editor_debug_fenter() do { \ @@ -82,7 +82,7 @@ extern "C" { #define metadata_editor_retvm_if(expr, val, fmt, arg...) do { \ if (expr) { \ - LOGE(""fmt"", ##arg); \ + LOGE("" fmt "", ##arg); \ return (val); \ } \ } while (0) diff --git a/packaging/capi-media-metadata-editor.spec b/packaging/capi-media-metadata-editor.spec index 5dc6d23..31ff102 100755 --- a/packaging/capi-media-metadata-editor.spec +++ b/packaging/capi-media-metadata-editor.spec @@ -1,6 +1,6 @@ Name: capi-media-metadata-editor Summary: A metadata editor library in Tizen Native API -Version: 0.1.5 +Version: 0.1.6 Release: 0 Group: Multimedia/API License: Apache-2.0 @@ -31,6 +31,7 @@ A media metadata editor library in Tizen Native API. (Development files included export CFLAGS+=" -Wextra -Wno-array-bounds" export CFLAGS+=" -Wno-ignored-qualifiers -Wno-unused-parameter -Wshadow" export CFLAGS+=" -Wwrite-strings -Wswitch-default" +CXXFLAGS=${CXXFLAGS/-fgnu89-inline/} MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` %cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -- 2.7.4 From f5f048ed492f20455e23387183c0378f40e9b255 Mon Sep 17 00:00:00 2001 From: Haejeong Kim Date: Thu, 23 Mar 2017 14:44:02 +0900 Subject: [PATCH 03/16] Use license macro in spec file Change-Id: I4a6f0c03cb4bd4a1701dbacf369495f0b0f9f361 --- packaging/capi-media-metadata-editor.spec | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packaging/capi-media-metadata-editor.spec b/packaging/capi-media-metadata-editor.spec index 31ff102..3f76b49 100755 --- a/packaging/capi-media-metadata-editor.spec +++ b/packaging/capi-media-metadata-editor.spec @@ -40,8 +40,6 @@ make %{?jobs:-j%jobs} %install rm -rf %{buildroot} %make_install -mkdir -p %{buildroot}/%{_datadir}/license -cp -rf %{_builddir}/%{name}-%{version}/LICENSE.APLv2.0 %{buildroot}/%{_datadir}/license/%{name} %post -p /sbin/ldconfig %postun -p /sbin/ldconfig @@ -49,7 +47,7 @@ cp -rf %{_builddir}/%{name}-%{version}/LICENSE.APLv2.0 %{buildroot}/%{_datadir}/ %files %manifest capi-media-metadata-editor.manifest %{_libdir}/libcapi-media-metadata-editor.so -%{_datadir}/license/%{name} +%license LICENSE.APLv2.0 %files devel %{_includedir}/metadata-editor/*.h -- 2.7.4 From baa085b5d1e9acbb6c6f0a7e9dfed786b3f09ffe Mon Sep 17 00:00:00 2001 From: Haejeong Kim Date: Fri, 16 Jun 2017 11:40:23 +0900 Subject: [PATCH 04/16] [RQ170613-00147] fix invalid format argument types for dlog Change-Id: Ibd62b71f5308218acb3e97c6d69d942a46b8f09d --- packaging/capi-media-metadata-editor.spec | 2 +- src/metadata_editor.cpp | 42 +++++++++++++++---------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/packaging/capi-media-metadata-editor.spec b/packaging/capi-media-metadata-editor.spec index 3f76b49..e69ec87 100755 --- a/packaging/capi-media-metadata-editor.spec +++ b/packaging/capi-media-metadata-editor.spec @@ -1,6 +1,6 @@ Name: capi-media-metadata-editor Summary: A metadata editor library in Tizen Native API -Version: 0.1.6 +Version: 0.1.7 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/metadata_editor.cpp b/src/metadata_editor.cpp index d24c549..fe9cd79 100755 --- a/src/metadata_editor.cpp +++ b/src/metadata_editor.cpp @@ -847,7 +847,7 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char * case METADATA_EDITOR_FORMAT_MP3: { if (_metadata->file) { TagLib::MPEG::File* _file = (TagLib::MPEG::File*)_metadata->file; - metadata_editor_info("file free [%lX]", _metadata->file); + metadata_editor_info("file free [%p]", _metadata->file); delete _file; _metadata->file = NULL; _metadata->filetype = METADATA_EDITOR_FORMAT_NOTYPE; @@ -865,10 +865,10 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char * _metadata->filetype = METADATA_EDITOR_FORMAT_MP3; if (_file->isOpen()) { // Check if the file was opened successfully - metadata_editor_info("The file is successfully opened. Address is %lX\n", _metadata->file); + metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file); _metadata->isOpen = true; } else { // The file does not exist or you have no permission to process it - metadata_editor_error("The file was not found. Pointer address is %lX\n", _metadata->file); + metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file); _metadata->isOpen = false; return METADATA_EDITOR_ERROR_PERMISSION_DENIED; } @@ -886,7 +886,7 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char * case METADATA_EDITOR_FORMAT_MP4: { if (_metadata->file) { TagLib::MP4::File* _file = (TagLib::MP4::File*)_metadata->file; - metadata_editor_info("file free [%lX]", _metadata->file); + metadata_editor_info("file free [%p]", _metadata->file); delete _file; _metadata->file = NULL; _metadata->filetype = METADATA_EDITOR_FORMAT_NOTYPE; @@ -904,10 +904,10 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char * _metadata->filetype = METADATA_EDITOR_FORMAT_MP4; if (_file->isOpen()) { // Check if the file was opened successfully - metadata_editor_info("The file is successfully opened. Address is %lX\n", _metadata->file); + metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file); _metadata->isOpen = true; } else { // The file does not exist or you have no permission to process it - metadata_editor_error("The file was not found. Pointer address is %lX\n", _metadata->file); + metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file); _metadata->isOpen = false; return METADATA_EDITOR_ERROR_FILE_EXISTS; } @@ -932,10 +932,10 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char * _metadata->filetype = METADATA_EDITOR_FORMAT_FLAC; if (_file->isOpen()) { // Check if the file was opened successfully - metadata_editor_info("The file is successfully opened. Address is %lX\n", _metadata->file); + metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file); _metadata->isOpen = true; } else { // The file does not exist or you have no permission to process it - metadata_editor_error("The file was not found. Pointer address is %lX\n", _metadata->file); + metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file); _metadata->isOpen = false; return METADATA_EDITOR_ERROR_FILE_EXISTS; } @@ -959,10 +959,10 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char * _metadata->filetype = METADATA_EDITOR_FORMAT_OGG_VORBIS; if (_file->isOpen()) { // Check if the file was opened successfully - metadata_editor_info("The file is successfully opened. Address is %lX\n", _metadata->file); + metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file); _metadata->isOpen = true; } else { // The file does not exist or you have no permission to process it - metadata_editor_error("The file was not found. Pointer address is %lX\n", _metadata->file); + metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file); _metadata->isOpen = false; return METADATA_EDITOR_ERROR_FILE_EXISTS; } @@ -986,10 +986,10 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char * _metadata->filetype = METADATA_EDITOR_FORMAT_OGG_FLAC; if (_file->isOpen()) { // Check if the file was opened successfully - metadata_editor_info("The file is successfully opened. Address is %lX\n", _metadata->file); + metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file); _metadata->isOpen = true; } else { // The file does not exist or you have no permission to process it - metadata_editor_error("The file was not found. Pointer address is %lX\n", _metadata->file); + metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file); _metadata->isOpen = false; return METADATA_EDITOR_ERROR_FILE_EXISTS; } @@ -1013,10 +1013,10 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char * _metadata->filetype = METADATA_EDITOR_FORMAT_WAV; if (_file->isOpen()) { // Check if the file was opened successfully - metadata_editor_info("The file is successfully opened. Address is %lX\n", _metadata->file); + metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file); _metadata->isOpen = true; } else { // The file does not exist or you have no permission to process it - metadata_editor_error("The file was not found. Pointer address is %lX\n", _metadata->file); + metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file); _metadata->isOpen = false; return METADATA_EDITOR_ERROR_FILE_EXISTS; } @@ -1935,38 +1935,38 @@ extern "C" int metadata_editor_destroy(metadata_editor_h metadata) { case METADATA_EDITOR_FORMAT_MP3: { // Bring the pointer to actual file type TagLib::MPEG::File* _file = (TagLib::MPEG::File*)_metadata->file; - metadata_editor_info("file free [%lX]", _metadata->file); + metadata_editor_info("file free [%p]", _metadata->file); delete _file; break; } case METADATA_EDITOR_FORMAT_MP4: { TagLib::MP4::File* _file = (TagLib::MP4::File*)_metadata->file; - metadata_editor_info("file free [%lX]", _metadata->file); + metadata_editor_info("file free [%p]", _metadata->file); delete _file; break; } #if 0 case METADATA_EDITOR_FORMAT_FLAC: { TagLib::FLAC::File* _file = (TagLib::FLAC::File*)_metadata->file; - metadata_editor_info("file free [%lX]", _metadata->file); + metadata_editor_info("file free [%p]", _metadata->file); delete _file; break; } case METADATA_EDITOR_FORMAT_OGG_VORBIS: { TagLib::Ogg::Vorbis::File* _file = (TagLib::Ogg::Vorbis::File*)_metadata->file; - metadata_editor_info("file free [%lX]", _metadata->file); + metadata_editor_info("file free [%p]", _metadata->file); delete _file; break; } case METADATA_EDITOR_FORMAT_OGG_FLAC: { TagLib::Ogg::FLAC::File* _file = (TagLib::Ogg::FLAC::File*)_metadata->file; - metadata_editor_info("file free [%lX]", _metadata->file); + metadata_editor_info("file free [%p]", _metadata->file); delete _file; break; } case METADATA_EDITOR_FORMAT_WAV: { TagLib::RIFF::WAV::File* _file = (TagLib::RIFF::WAV::File*)_metadata->file; - metadata_editor_info("file free [%lX]", _metadata->file); + metadata_editor_info("file free [%p]", _metadata->file); delete _file; break; } @@ -1976,7 +1976,7 @@ extern "C" int metadata_editor_destroy(metadata_editor_h metadata) { return METADATA_EDITOR_ERROR_INVALID_PARAMETER; } - metadata_editor_info(" with address %lX will be freed\n", metadata); + metadata_editor_info(" with address %p will be freed\n", metadata); delete _metadata; return METADATA_EDITOR_ERROR_NONE; -- 2.7.4 From 06865e71def5aab40367c38b4c758f51850604f5 Mon Sep 17 00:00:00 2001 From: Haejeong Kim Date: Wed, 19 Jul 2017 14:30:57 +0900 Subject: [PATCH 05/16] Just update debugging msg Change-Id: I8390c2bcdb7e1be1980c4bac727d5df83b6d8aba --- src/metadata_editor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/metadata_editor.cpp b/src/metadata_editor.cpp index fe9cd79..846bf94 100755 --- a/src/metadata_editor.cpp +++ b/src/metadata_editor.cpp @@ -702,7 +702,7 @@ int __metadata_editor_get_file_type(const char *path) { char ext[255] = { 0 }; int ret = __metadata_editor_get_file_ext(path, ext, sizeof(ext)); - metadata_editor_retvm_if(ret < 0, METADATA_EDITOR_FORMAT_NOTYPE, "__metadata_editor_get_file_type failed"); + metadata_editor_retvm_if(ret < 0, METADATA_EDITOR_FORMAT_NOTYPE, "__metadata_editor_get_file_ext failed"); if (strcasecmp(ext, "MP3") == 0) return METADATA_EDITOR_FORMAT_MP3; @@ -736,7 +736,7 @@ int __metadata_editor_get_picture_type(const char *path, char **type) { char ext[255] = { 0 }; int ret = __metadata_editor_get_file_ext(path, ext, sizeof(ext)); - metadata_editor_retvm_if(ret < 0, METADATA_EDITOR_ERROR_OPERATION_FAILED, "__metadata_editor_get_file_type failed"); + metadata_editor_retvm_if(ret < 0, METADATA_EDITOR_ERROR_OPERATION_FAILED, "__metadata_editor_get_file_ext failed"); if (strcasecmp(ext, "JPG") == 0 || strcasecmp(ext, "JPEG") == 0) { *type = strndup(type_jpeg, strlen(type_jpeg)); -- 2.7.4 From 7e278a8c510dae9549741c2f25c2c50ff6bb05cd Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Tue, 25 Jul 2017 10:43:21 +0900 Subject: [PATCH 06/16] Fix svace defects Change-Id: I8777be6887041dfcb3d31fc4640a1af8fa6b5590 Signed-off-by: Minje Ahn --- test/metadata_editor_test.c | 50 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/test/metadata_editor_test.c b/test/metadata_editor_test.c index 76ad7e6..1f84eb3 100755 --- a/test/metadata_editor_test.c +++ b/test/metadata_editor_test.c @@ -18,10 +18,12 @@ #include #include #include +#include #include #define SAFE_FREE(src) { if (src) {free(src); src = NULL; } } +#define FILE_NAME_SIZE 30 int dummy; @@ -32,6 +34,32 @@ static bool __write_tag_info(metadata_editor_h metadata); static bool __add_picture(metadata_editor_h metadata); static bool __delete_pictures(metadata_editor_h metadata); + +static int __safe_atoi(char *buffer, int *si) +{ + char *end = NULL; + errno = 0; + if (buffer == NULL || si == NULL) + return METADATA_EDITOR_ERROR_INVALID_PARAMETER; + + const long sl = strtol(buffer, &end, 10); + + if (end == buffer) + return METADATA_EDITOR_ERROR_INVALID_PARAMETER; + if ('\0' != *end) + return METADATA_EDITOR_ERROR_INVALID_PARAMETER; + if ((LONG_MIN == sl || LONG_MAX == sl) && (ERANGE == errno)) + return METADATA_EDITOR_ERROR_INVALID_PARAMETER; + if (sl > INT_MAX) + return METADATA_EDITOR_ERROR_INVALID_PARAMETER; + if (sl < INT_MIN) + return METADATA_EDITOR_ERROR_INVALID_PARAMETER; + + *si = (int)sl; + + return METADATA_EDITOR_ERROR_NONE; +} + void __flush() { int c; @@ -131,19 +159,27 @@ static bool __get_tag_info(metadata_editor_h metadata) #endif if (ret != METADATA_EDITOR_ERROR_NONE) printf("Fail metadata_editor_get_metadata() at line [%d]\n", __LINE__); else if ((ret == METADATA_EDITOR_ERROR_NONE) && picture_index) { - uint num, i; - num = atoi(picture_index); + int num = 0, i; + ret = __safe_atoi(picture_index, &num); + if (ret != METADATA_EDITOR_ERROR_NONE || num < 0) + return true; + printf("Number of pictures: %u\n", num); + for (i = 0; i < num; ++i) { ret = metadata_editor_get_picture(metadata, i, &picture, &picture_size, &picture_type); /*__printRetValue("metadata_editor_get_picture(...)", ret); */ if (ret == METADATA_EDITOR_ERROR_NONE && picture) { printf("Saving picture number %u\n", i); - int size = 30; - char picture_file_name[size]; - snprintf(picture_file_name, size, "outputFile_%u" , i + 1); - if (strncmp(picture_type, "image/jpeg", strlen("image/jpeg")) == 0) strncat(picture_file_name, ".jpg", strlen(".jpg")); - else if (strncmp(picture_type, "image/png", strlen("image/jpeg")) == 0) strncat(picture_file_name, ".png", strlen(".png")); + char picture_file_name[FILE_NAME_SIZE] = {0, }; + + memset(picture_file_name, 0, sizeof(picture_file_name)); + + if (strncmp(picture_type, "image/jpeg", strlen("image/jpeg")) == 0) + snprintf(picture_file_name, FILE_NAME_SIZE, "outputFile_%u.jpg", i + 1); + else if (strncmp(picture_type, "image/png", strlen("image/png")) == 0) + snprintf(picture_file_name, FILE_NAME_SIZE, "outputFile_%u.png", i + 1); + FILE *fout = fopen(picture_file_name, "wb"); if (fout) { fwrite(picture, picture_size, 1, fout); -- 2.7.4 From cdb1cf06ff36b800b82ac989a706e55345e5b3cf Mon Sep 17 00:00:00 2001 From: Haejeong Kim Date: Wed, 6 Sep 2017 10:22:41 +0900 Subject: [PATCH 07/16] Remove \n in dlog msg Change-Id: Ibef41d8fe675c1e9feac348eb6dafbe9b34acc44 --- src/metadata_editor.cpp | 354 ++++++++++++++++++++++++------------------------ 1 file changed, 177 insertions(+), 177 deletions(-) diff --git a/src/metadata_editor.cpp b/src/metadata_editor.cpp index 846bf94..5953d9d 100755 --- a/src/metadata_editor.cpp +++ b/src/metadata_editor.cpp @@ -61,17 +61,17 @@ static int __ID3_getTwixFrameByName(metadata_editor_s* _metadata, TagLib::ID3v1: // Check if the file, given through metadata, exists and is opened correctly *value = NULL; - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); // Check if the frame is empty (nothing to read) or ID3v2 tag does not exist if (!tag2 || tag2->frameListMap()[frameID].isEmpty()) { - metadata_editor_info("The frame %s in ID3v2 tag is empty\n", frameID); + metadata_editor_info("The frame %s in ID3v2 tag is empty", frameID); // Check if the tag ID3v1 is also empty or does not exist if (!tag1 || tag1->isEmpty()) { - metadata_editor_info("The frame %s in ID3v1 tag is empty as well\n", frameID); + metadata_editor_info("The frame %s in ID3v1 tag is empty as well", frameID); return METADATA_EDITOR_ERROR_NONE; } else { // if not - read the frame you need there - metadata_editor_info("Reading data from ID3v1 tag\n"); + metadata_editor_info("Reading data from ID3v1 tag"); TagLib::String str; uint length; @@ -98,9 +98,9 @@ static int __ID3_getTwixFrameByName(metadata_editor_s* _metadata, TagLib::ID3v1: if (found) { bool isUTF = false; if (!str.isLatin1()) isUTF = true; - metadata_editor_info("String is %sUTF\n", (isUTF ? "" : "not ")); + metadata_editor_info("String is %sUTF", (isUTF ? "" : "not ")); length = strlen(str.toCString(isUTF)); - metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n"); + metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string"); *value = strndup(str.toCString(isUTF), length); return METADATA_EDITOR_ERROR_NONE; } @@ -117,7 +117,7 @@ static int __ID3_getTwixFrameByName(metadata_editor_s* _metadata, TagLib::ID3v1: if (found) { length = strlen(buf); - metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n"); + metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string"); *value = strndup(buf, length); return METADATA_EDITOR_ERROR_NONE; } @@ -126,16 +126,16 @@ static int __ID3_getTwixFrameByName(metadata_editor_s* _metadata, TagLib::ID3v1: return METADATA_EDITOR_ERROR_OPERATION_FAILED; } } else { // or frame has data to read - metadata_editor_info("The frame %s exists in ID3v2 tag\n", frameID); + metadata_editor_info("The frame %s exists in ID3v2 tag", frameID); // This string is used to copy the value in the frame TagLib::String str = tag2->frameListMap()[frameID][0]->toString(); bool isUTF = false; if (!str.isLatin1()) isUTF = true; - metadata_editor_info("String is %sUTF\n", (isUTF ? "" : "not ")); + metadata_editor_info("String is %sUTF", (isUTF ? "" : "not ")); uint length = strlen(str.toCString(isUTF)); - metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n"); + metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string"); *value = strndup(str.toCString(isUTF), length); @@ -151,15 +151,15 @@ static int __ID3_setTwixFrameByName(metadata_editor_s* _metadata, TagLib::ID3v1: metadata_editor_retvm_if(frameID == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID PARAMETER"); // Check if the file, given through metadata, exists and is opened correctly - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); - metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); + metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify"); // Check if the valid tag pointer exists metadata_editor_retvm_if(tag2 == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating"); // If the pointer is NULL or c-string is empty - handle as request for deletion if (!value || (*value == '\0')) { - metadata_editor_info("Request for frame %s deletion\n", frameID); + metadata_editor_info("Request for frame %s deletion", frameID); tag2->removeFrames(frameID); if (tag1 && !tag1->isEmpty()) { if (!strcmp(frameID, "TPE1")) @@ -181,7 +181,7 @@ static int __ID3_setTwixFrameByName(metadata_editor_s* _metadata, TagLib::ID3v1: // Check if the frame is empty (must create the frame before writing the data) if (tag2->frameListMap()[frameID].isEmpty()) { - metadata_editor_info("The frame %s does not exist. Creating.\n", frameID); + metadata_editor_info("The frame %s does not exist. Creating", frameID); // This is a common frame type for textural frames except comment frame TagLib::ID3v2::TextIdentificationFrame* fr = new TagLib::ID3v2::TextIdentificationFrame(frameID); metadata_editor_retvm_if(fr == NULL, METADATA_EDITOR_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY"); @@ -190,12 +190,12 @@ static int __ID3_setTwixFrameByName(metadata_editor_s* _metadata, TagLib::ID3v1: fr->setText(TagLib::String(value, TagLib::String::UTF8)); tag2->addFrame(fr); } else { // if not - just modify the data in the existing frame - metadata_editor_info("The frame %s exists. Changing.\n", frameID); + metadata_editor_info("The frame %s exists. Changing", frameID); tag2->frameListMap()[frameID][0]->setText(TagLib::String(value, TagLib::String::UTF8)); } if (tag1 && !tag1->isEmpty()) { // Check if ID3v1 tag exists. Must copy data if yes. - metadata_editor_info("ID3v1 tag also exists. Copying frame\n"); + metadata_editor_info("ID3v1 tag also exists. Copying frame"); if (!strcmp(frameID, "TPE1")) tag1->setArtist(value); else if (!strcmp(frameID, "TALB")) @@ -222,20 +222,20 @@ static int __ID3_getFrameByName(metadata_editor_s* _metadata, TagLib::ID3v2::Tag // Check if the file, given through metadata, exists and is opened correctly *value = NULL; - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); // Check if the frame is empty (nothing to read) or ID3v2 tag does not exist - metadata_editor_retvm_if(!tag2 || tag2->frameListMap()[frameID].isEmpty(), METADATA_EDITOR_ERROR_NONE, "The frame %s does not exist\n", frameID); + metadata_editor_retvm_if(!tag2 || tag2->frameListMap()[frameID].isEmpty(), METADATA_EDITOR_ERROR_NONE, "The frame %s does not exist", frameID); - metadata_editor_info("The frame %s exists\n", frameID); + metadata_editor_info("The frame %s exists", frameID); // This string is used to copy the value in the frame TagLib::String str = tag2->frameListMap()[frameID][0]->toString(); bool isUTF = false; if (!str.isLatin1()) isUTF = true; - metadata_editor_info("String is %sUTF\n", (isUTF ? "" : "not ")); + metadata_editor_info("String is %sUTF", (isUTF ? "" : "not ")); uint length = strlen(str.toCString(isUTF)); - metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n"); + metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string"); *value = strndup(str.toCString(isUTF), length); @@ -249,22 +249,22 @@ static int __ID3_setFrameByName(metadata_editor_s* _metadata, TagLib::ID3v2::Tag metadata_editor_retvm_if(frameID == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID PARAMETER"); // Check if the file, given through metadata, exists and is opened correctly - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); - metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); + metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify"); // Check if the valid tag pointer exist metadata_editor_retvm_if(tag2 == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating"); // If the pointer is NULL or c-string is empty - handle as request for deletion if (!value || (*value == '\0')) { - metadata_editor_info("Request for frame %s deletion\n", frameID); + metadata_editor_info("Request for frame %s deletion", frameID); tag2->removeFrames(frameID); return METADATA_EDITOR_ERROR_NONE; } // Check if the ID3v2 tag exists if (tag2->frameListMap()[frameID].isEmpty()) { - metadata_editor_info("The frame %s does not exist. Creating.\n", frameID); + metadata_editor_info("The frame %s does not exist. Creating", frameID); // This is a common frame type for textural frames except comment frame TagLib::ID3v2::TextIdentificationFrame* fr = new TagLib::ID3v2::TextIdentificationFrame(frameID); metadata_editor_retvm_if(fr == NULL, METADATA_EDITOR_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY"); @@ -273,7 +273,7 @@ static int __ID3_setFrameByName(metadata_editor_s* _metadata, TagLib::ID3v2::Tag fr->setText(TagLib::String(value, TagLib::String::UTF8)); tag2->addFrame(fr); } else { // if not - just modify the data in the existing frame - metadata_editor_info("The frame %s exists. Changing.\n", frameID); + metadata_editor_info("The frame %s exists. Changing", frameID); tag2->frameListMap()[frameID][0]->setText(TagLib::String(value, TagLib::String::UTF8)); } @@ -288,16 +288,16 @@ static int __ID3_getNumberOfPictures(metadata_editor_s* _metadata, TagLib::ID3v2 // Check if the file, given through metadata, exists and is opened correctly *value = NULL; - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); // Check if the valid tag pointer exist metadata_editor_retvm_if(tag2 == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag does not exist. Can not process further"); TagLib::ID3v2::FrameList lst = tag2->frameListMap()["APIC"]; // link to picture frames in tag // Check if the frames exist - metadata_editor_retvm_if(lst.isEmpty(), METADATA_EDITOR_ERROR_NONE, "No pictures in file\n"); + metadata_editor_retvm_if(lst.isEmpty(), METADATA_EDITOR_ERROR_NONE, "No pictures in file"); - metadata_editor_info("APIC frames exist in file\n"); + metadata_editor_info("APIC frames exist in file"); char buf[META_MAX_BUF_LEN] = {0, }; // Convert the number of frames (lst.size()) to c-string snprintf(buf, META_MAX_BUF_LEN, "%u", lst.size()); @@ -314,24 +314,24 @@ static int __ID3_getLyricsFrame(metadata_editor_s* _metadata, TagLib::ID3v2::Tag // Check if the file, given through metadata, exists and is opened correctly *value = NULL; - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); // Check if the valid tag pointer exist metadata_editor_retvm_if(tag2 == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag does not exist. Can not process further"); TagLib::ID3v2::FrameList lst = tag2->frameListMap()["USLT"]; // link to unsynchronized lyric frames in tag // Check if frames exist in file - metadata_editor_retvm_if(lst.isEmpty(), METADATA_EDITOR_ERROR_NONE, "The frame USLT does not exist\n"); + metadata_editor_retvm_if(lst.isEmpty(), METADATA_EDITOR_ERROR_NONE, "The frame USLT does not exist"); - metadata_editor_info("The frame USLT exists\n"); + metadata_editor_info("The frame USLT exists"); TagLib::ID3v2::FrameList::Iterator it = lst.begin(); TagLib::ID3v2::UnsynchronizedLyricsFrame* frame = static_cast(*it); TagLib::String str = frame->text(); bool isUTF = false; if (!str.isLatin1()) isUTF = true; - metadata_editor_info("String is %sUTF\n", (isUTF ? "" : "not ")); + metadata_editor_info("String is %sUTF", (isUTF ? "" : "not ")); uint length = strlen(str.toCString(isUTF)); - metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n"); + metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string"); *value = strndup(str.toCString(isUTF), length); return METADATA_EDITOR_ERROR_NONE; } @@ -343,15 +343,15 @@ static int __ID3_setTwixCommentFrame(metadata_editor_s* _metadata, TagLib::ID3v1 metadata_editor_retvm_if(_metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID PARAMETER"); // Check if the file, given through metadata, exists and is opened correctly - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); - metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); + metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify"); // Check if the valid tag pointer exist metadata_editor_retvm_if(tag2 == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating"); // If the pointer is NULL or c-string is empty - handle as request for deletion if (!value || (*value == '\0')) { - metadata_editor_info("Request for frame COMM deletion\n"); + metadata_editor_info("Request for frame COMM deletion"); tag2->removeFrames("COMM"); if (tag1 && !tag1->isEmpty()) tag1->setComment(""); @@ -359,19 +359,19 @@ static int __ID3_setTwixCommentFrame(metadata_editor_s* _metadata, TagLib::ID3v1 } // If the comment frame is empty - create the frame and add it to the list if (tag2->frameListMap()["COMM"].isEmpty()) { - metadata_editor_info("The frame COMM does not exist. Creating.\n"); + metadata_editor_info("The frame COMM does not exist. Creating"); TagLib::ID3v2::CommentsFrame* fr = new TagLib::ID3v2::CommentsFrame; - metadata_editor_retvm_if(fr == NULL, METADATA_EDITOR_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY\n"); + metadata_editor_retvm_if(fr == NULL, METADATA_EDITOR_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY"); fr->setText(TagLib::String(value, TagLib::String::UTF8)); fr->setTextEncoding(TagLib::String::UTF8); tag2->addFrame(fr); } else { // If the frame already exists - just modify its value - metadata_editor_info("The frame COMM exists. Changing.\n"); + metadata_editor_info("The frame COMM exists. Changing"); tag2->frameListMap()["COMM"][0]->setText(TagLib::String(value, TagLib::String::UTF8)); } if (tag1 && !tag1->isEmpty()) { // Copy the value to ID3v1 tag comment - metadata_editor_info("ID3v1 tag also exists. Copying frame\n"); + metadata_editor_info("ID3v1 tag also exists. Copying frame"); tag1->setComment(value); } @@ -385,8 +385,8 @@ static int __ID3_setLyricsFrame(metadata_editor_s* _metadata, TagLib::ID3v2::Tag metadata_editor_retvm_if(_metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID PARAMETER"); // Check if the file, given through metadata, exists and is opened correctly - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); - metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); + metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify"); // Check if the valid tag pointer exist metadata_editor_retvm_if(tag2 == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating"); @@ -394,14 +394,14 @@ static int __ID3_setLyricsFrame(metadata_editor_s* _metadata, TagLib::ID3v2::Tag TagLib::ID3v2::FrameList lst = tag2->frameListMap()["USLT"]; // link to unsynchronized lyric frames in tag // If the pointer is NULL or c-string is empty - handle as request for deletion if (!value || (*value == '\0')) { - metadata_editor_info("Request for frame USLT deletion\n"); + metadata_editor_info("Request for frame USLT deletion"); tag2->removeFrames("USLT"); return METADATA_EDITOR_ERROR_NONE; } // Check if lyrics frames exist if (lst.isEmpty()) { // No lyrics - create the frame and add it to the ID3v2 tag - metadata_editor_info("The frame USLT does not exist. Creating.\n"); + metadata_editor_info("The frame USLT does not exist. Creating"); TagLib::ID3v2::UnsynchronizedLyricsFrame* frame = new TagLib::ID3v2::UnsynchronizedLyricsFrame; metadata_editor_retvm_if(frame == NULL, METADATA_EDITOR_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY"); @@ -409,7 +409,7 @@ static int __ID3_setLyricsFrame(metadata_editor_s* _metadata, TagLib::ID3v2::Tag frame->setText(TagLib::String(value, TagLib::String::UTF8)); tag2->addFrame(frame); } else { // the lyrics frames exist - change the existing one - metadata_editor_info("USLT frames exist in file. Changing.\n"); + metadata_editor_info("USLT frames exist in file. Changing"); TagLib::ID3v2::FrameList::Iterator it = lst.begin(); TagLib::ID3v2::UnsynchronizedLyricsFrame* frame = static_cast(*it); frame->setTextEncoding(TagLib::String::UTF8); @@ -429,7 +429,7 @@ static int __MP4_getStringItem(metadata_editor_s* _metadata, const char* itemnam // Check if the file, given through metadata, exists and is opened correctly *value = NULL; - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); TagLib::MP4::File* _file = (TagLib::MP4::File*) _metadata->file; TagLib::MP4::Tag* tag = _file->tag(); @@ -443,14 +443,14 @@ static int __MP4_getStringItem(metadata_editor_s* _metadata, const char* itemnam // Check the encoding of the string (1252 or not) bool isUTF = false; if (!str.isLatin1()) isUTF = true; - metadata_editor_info("String is %sUTF\n", (isUTF ? "" : "not ")); + metadata_editor_info("String is %sUTF", (isUTF ? "" : "not ")); // Get the length of the string and check if it is empty or not uint length = strlen(str.toCString(isUTF)); - metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n"); + metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string"); *value = strndup(str.toCString(isUTF), length); return METADATA_EDITOR_ERROR_NONE; } else { // Item was not found - metadata_editor_info("No item <%s> in file\n", itemname); + metadata_editor_info("No item <%s> in file", itemname); return METADATA_EDITOR_ERROR_NONE; } } @@ -465,7 +465,7 @@ static int __MP4_getIntegerItem(metadata_editor_s* _metadata, const char* itemna // Check if the file, given through metadata, exists and is opened correctly *value = NULL; - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); TagLib::MP4::File* _file = (TagLib::MP4::File*) _metadata->file; TagLib::MP4::Tag* tag = _file->tag(); @@ -480,11 +480,11 @@ static int __MP4_getIntegerItem(metadata_editor_s* _metadata, const char* itemna snprintf(buf, META_MAX_BUF_LEN, "%u", num); // Convert int into char[] // Determine the length of created c-string and copy it into the output variable int length = strlen(buf); - metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n"); + metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string"); *value = strndup(buf, length); return METADATA_EDITOR_ERROR_NONE; } else { // Item was not found - metadata_editor_info("No item <%s> in file\n", itemname); + metadata_editor_info("No item <%s> in file", itemname); return METADATA_EDITOR_ERROR_NONE; } } @@ -497,8 +497,8 @@ static int __MP4_updateStringItem(metadata_editor_s* _metadata, const char* item metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail."); // Check if the file, given through metadata, exists and is opened correctly - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); - metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); + metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify"); TagLib::MP4::File* _file = (TagLib::MP4::File*) _metadata->file; TagLib::MP4::Tag* tag = _file->tag(); @@ -508,13 +508,13 @@ static int __MP4_updateStringItem(metadata_editor_s* _metadata, const char* item TagLib::MP4::ItemListMap& itemMap = tag->itemListMap(); // Check if it is a request for deletion if ((value == NULL) || value[0] == '\0') { - metadata_editor_info("Request for deleting of item <%s>\n", itemname); + metadata_editor_info("Request for deleting of item <%s>", itemname); TagLib::MP4::ItemListMap::Iterator it = itemMap.find(itemname); if (it != itemMap.end()) itemMap.erase(it); return METADATA_EDITOR_ERROR_NONE; } - metadata_editor_info("The item <%s> will be added\n", itemname); + metadata_editor_info("The item <%s> will be added", itemname); itemMap[itemname] = TagLib::MP4::Item(TagLib::String(value, TagLib::String::UTF8)); return METADATA_EDITOR_ERROR_NONE; @@ -528,8 +528,8 @@ static int __MP4_updateIntegerItem(metadata_editor_s* _metadata, const char* ite metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail."); // Check if the file, given through metadata, exists and is opened correctly - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); - metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); + metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify"); TagLib::MP4::File* _file = (TagLib::MP4::File*) _metadata->file; TagLib::MP4::Tag* tag = _file->tag(); @@ -539,7 +539,7 @@ static int __MP4_updateIntegerItem(metadata_editor_s* _metadata, const char* ite TagLib::MP4::ItemListMap& itemMap = tag->itemListMap(); // Check if it is a request for deletion if ((value == NULL) || value[0] == '\0') { - metadata_editor_info("Request for deleting of item <%s>\n", itemname); + metadata_editor_info("Request for deleting of item <%s>", itemname); TagLib::MP4::ItemListMap::Iterator it = itemMap.find(itemname); if (it != itemMap.end()) itemMap.erase(it); @@ -547,12 +547,12 @@ static int __MP4_updateIntegerItem(metadata_editor_s* _metadata, const char* ite } // Check if the value is integer string then it can be successfully converted into integer if (isdigit(value[0])) { - metadata_editor_info("The item <%s> will be added\n", itemname); + metadata_editor_info("The item <%s> will be added", itemname); int number = atoi(value); itemMap[itemname] = TagLib::MP4::Item(number); return METADATA_EDITOR_ERROR_NONE; } else { // Notify that string is not a number to process - metadata_editor_error("Error. String does not contain a number\n"); + metadata_editor_error("Error. String does not contain a number"); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; } } @@ -566,26 +566,26 @@ static int __MP4_getNumberOfPictures(metadata_editor_s* _metadata, char** value) // Check if the file, given through metadata, exists and is opened correctly *value = NULL; - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); TagLib::MP4::File* _file = (TagLib::MP4::File*) _metadata->file; TagLib::MP4::Tag* tag = _file->tag(); - metadata_editor_retvm_if(tag == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist\n"); + metadata_editor_retvm_if(tag == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist"); // Get map of items directly from tag and launch a search of specific item TagLib::MP4::ItemListMap& itemMap = tag->itemListMap(); TagLib::MP4::ItemListMap::ConstIterator it = itemMap.find("covr"); if (it != itemMap.end()) { // Item was found uint number = it->second.toCoverArtList().size(); // Get the size of CoverList (i.e. number of pictures in file) - metadata_editor_info("There are %u picture(s) in file\n", number); + metadata_editor_info("There are %u picture(s) in file", number); char buf[META_MAX_BUF_LEN] = {0, }; snprintf(buf, META_MAX_BUF_LEN, "%u", number); // Convert integer value of size to its c-string representation int length = strlen(buf); - metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n"); + metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string"); *value = strndup(buf, length); return METADATA_EDITOR_ERROR_NONE; } else { // Item was not found - metadata_editor_info("No item in file\n"); + metadata_editor_info("No item in file"); return METADATA_EDITOR_ERROR_NONE; } } @@ -599,26 +599,26 @@ static int __xiph_getFieldValue(metadata_editor_s* _metadata, TagLib::Ogg::XiphC // Check if the file, given through metadata, exists and is opened correctly *value = NULL; - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); - metadata_editor_retvm_if(!xtag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); + metadata_editor_retvm_if(!xtag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist"); const TagLib::Ogg::FieldListMap& fieldMap = xtag->fieldListMap(); TagLib::Ogg::FieldListMap::ConstIterator it = fieldMap.find(fieldname); if ((xtag->contains(fieldname)) && (it != fieldMap.end())) { // Field was found - metadata_editor_info("Field %s was found. Extracting\n", fieldname); + metadata_editor_info("Field %s was found. Extracting", fieldname); TagLib::String str = it->second[0]; // Get the first string in xiph field // Check the encoding of the string (1252 or not) bool isUTF = false; if (!str.isLatin1()) isUTF = true; - metadata_editor_info("String is %sUTF\n", (isUTF ? "" : "not ")); + metadata_editor_info("String is %sUTF", (isUTF ? "" : "not ")); // Get the length of the string and check if it is empty or not uint length = strlen(str.toCString(isUTF)); - metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n"); + metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string"); *value = strndup(str.toCString(isUTF), length); return METADATA_EDITOR_ERROR_NONE; } else { // Field was not found - metadata_editor_info("No field %s in Xiph Comment\n", fieldname); + metadata_editor_info("No field %s in Xiph Comment", fieldname); return METADATA_EDITOR_ERROR_NONE; } } @@ -631,17 +631,17 @@ static int __xiph_updateFieldValue(metadata_editor_s* _metadata, TagLib::Ogg::Xi // Check if the file, given through metadata, exists and is opened correctly *value = NULL; - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); - metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n"); - metadata_editor_retvm_if(!xtag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); + metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify"); + metadata_editor_retvm_if(!xtag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist"); // Check if it is a request for deletion if ((value == NULL) || value[0] == '\0') { - metadata_editor_info("Request for deleting of field %s\n", fieldname); + metadata_editor_info("Request for deleting of field %s", fieldname); xtag->removeField(fieldname); return METADATA_EDITOR_ERROR_NONE; } - metadata_editor_info("The field %s will be added\n", fieldname); + metadata_editor_info("The field %s will be added", fieldname); // "true" is used to remove other strings of the same "fieldname" first xtag->addField(fieldname, TagLib::String(value, TagLib::String::UTF8), true); return METADATA_EDITOR_ERROR_NONE; @@ -656,19 +656,19 @@ static int __FLAC_getNumberOfPictures(metadata_editor_s* _metadata, char** value // Check if the file, given through metadata, exists and is opened correctly *value = NULL; - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); TagLib::FLAC::File* _file = (TagLib::FLAC::File*) _metadata->file; if (_file->pictureList().isEmpty()) { - metadata_editor_info("No pictures in FLAC file\n"); + metadata_editor_info("No pictures in FLAC file"); return METADATA_EDITOR_ERROR_NONE; } uint number = _file->pictureList().size(); - metadata_editor_info("There are %u picture(s) in file\n", number); + metadata_editor_info("There are %u picture(s) in file", number); char buf[META_MAX_BUF_LEN] = {0, }; snprintf(buf, META_MAX_BUF_LEN, "%u", number); // Convert integer value of size to its c-string representation uint length = strlen(buf); - metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n"); + metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string"); *value = strndup(buf, length); return METADATA_EDITOR_ERROR_NONE; } @@ -828,7 +828,7 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char * /* check the file exits actually */ exist = open(path, O_RDONLY); if(exist < 0) { - metadata_editor_error("Not exist file\n"); + metadata_editor_error("Not exist file"); if (errno == EACCES || errno == EPERM) { return METADATA_EDITOR_ERROR_PERMISSION_DENIED; } else { @@ -865,19 +865,19 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char * _metadata->filetype = METADATA_EDITOR_FORMAT_MP3; if (_file->isOpen()) { // Check if the file was opened successfully - metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file); + metadata_editor_info("The file is successfully opened. Address is %p", _metadata->file); _metadata->isOpen = true; } else { // The file does not exist or you have no permission to process it - metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file); + metadata_editor_error("The file was not found. Pointer address is %p", _metadata->file); _metadata->isOpen = false; return METADATA_EDITOR_ERROR_PERMISSION_DENIED; } if (_file->readOnly()) { // Check if the file is readonly - metadata_editor_info("File is readonly\n"); + metadata_editor_info("File is readonly"); _metadata->isReadOnly = true; } else { // or not - metadata_editor_info("The file is writable\n"); + metadata_editor_info("The file is writable"); _metadata->isReadOnly = false; } @@ -904,18 +904,18 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char * _metadata->filetype = METADATA_EDITOR_FORMAT_MP4; if (_file->isOpen()) { // Check if the file was opened successfully - metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file); + metadata_editor_info("The file is successfully opened. Address is %p", _metadata->file); _metadata->isOpen = true; } else { // The file does not exist or you have no permission to process it - metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file); + metadata_editor_error("The file was not found. Pointer address is %p", _metadata->file); _metadata->isOpen = false; return METADATA_EDITOR_ERROR_FILE_EXISTS; } if (_file->readOnly()) { // Check if the file is readonly - metadata_editor_info("File is readonly\n"); + metadata_editor_info("File is readonly"); _metadata->isReadOnly = true; } else { // or not - metadata_editor_info("The file is writable\n"); + metadata_editor_info("The file is writable"); _metadata->isReadOnly = false; } return METADATA_EDITOR_ERROR_NONE; @@ -932,18 +932,18 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char * _metadata->filetype = METADATA_EDITOR_FORMAT_FLAC; if (_file->isOpen()) { // Check if the file was opened successfully - metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file); + metadata_editor_info("The file is successfully opened. Address is %p", _metadata->file); _metadata->isOpen = true; } else { // The file does not exist or you have no permission to process it - metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file); + metadata_editor_error("The file was not found. Pointer address is %p", _metadata->file); _metadata->isOpen = false; return METADATA_EDITOR_ERROR_FILE_EXISTS; } if (_file->readOnly()) { // Check if the file is readonly - metadata_editor_info("File is readonly\n"); + metadata_editor_info("File is readonly"); _metadata->isReadOnly = true; } else { // or not - metadata_editor_info("The file is writable\n"); + metadata_editor_info("The file is writable"); _metadata->isReadOnly = false; } return METADATA_EDITOR_ERROR_NONE; @@ -959,18 +959,18 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char * _metadata->filetype = METADATA_EDITOR_FORMAT_OGG_VORBIS; if (_file->isOpen()) { // Check if the file was opened successfully - metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file); + metadata_editor_info("The file is successfully opened. Address is %p", _metadata->file); _metadata->isOpen = true; } else { // The file does not exist or you have no permission to process it - metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file); + metadata_editor_error("The file was not found. Pointer address is %p", _metadata->file); _metadata->isOpen = false; return METADATA_EDITOR_ERROR_FILE_EXISTS; } if (_file->readOnly()) { // Check if the file is readonly - metadata_editor_info("File is readonly\n"); + metadata_editor_info("File is readonly"); _metadata->isReadOnly = true; } else { // or not - metadata_editor_info("The file is writable\n"); + metadata_editor_info("The file is writable"); _metadata->isReadOnly = false; } return METADATA_EDITOR_ERROR_NONE; @@ -986,18 +986,18 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char * _metadata->filetype = METADATA_EDITOR_FORMAT_OGG_FLAC; if (_file->isOpen()) { // Check if the file was opened successfully - metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file); + metadata_editor_info("The file is successfully opened. Address is %p", _metadata->file); _metadata->isOpen = true; } else { // The file does not exist or you have no permission to process it - metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file); + metadata_editor_error("The file was not found. Pointer address is %p", _metadata->file); _metadata->isOpen = false; return METADATA_EDITOR_ERROR_FILE_EXISTS; } if (_file->readOnly()) { // Check if the file is readonly - metadata_editor_info("File is readonly\n"); + metadata_editor_info("File is readonly"); _metadata->isReadOnly = true; } else { // or not - metadata_editor_info("The file is writable\n"); + metadata_editor_info("The file is writable"); _metadata->isReadOnly = false; } return METADATA_EDITOR_ERROR_NONE; @@ -1013,25 +1013,25 @@ extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char * _metadata->filetype = METADATA_EDITOR_FORMAT_WAV; if (_file->isOpen()) { // Check if the file was opened successfully - metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file); + metadata_editor_info("The file is successfully opened. Address is %p", _metadata->file); _metadata->isOpen = true; } else { // The file does not exist or you have no permission to process it - metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file); + metadata_editor_error("The file was not found. Pointer address is %p", _metadata->file); _metadata->isOpen = false; return METADATA_EDITOR_ERROR_FILE_EXISTS; } if (_file->readOnly()) { // Check if the file is readonly - metadata_editor_info("File is readonly\n"); + metadata_editor_info("File is readonly"); _metadata->isReadOnly = true; } else { // or not - metadata_editor_info("The file is writable\n"); + metadata_editor_info("The file is writable"); _metadata->isReadOnly = false; } return METADATA_EDITOR_ERROR_NONE; } #endif default: - metadata_editor_error("Wrong file type\n"); + metadata_editor_error("Wrong file type"); return METADATA_EDITOR_ERROR_NOT_SUPPORTED; } } @@ -1043,11 +1043,11 @@ extern "C" int metadata_editor_get_metadata(metadata_editor_h metadata, metadata metadata_editor_retvm_if(value == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID Value Pointer"); metadata_editor_s *_metadata = (metadata_editor_s*)metadata; - metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail.\n"); + metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail"); // Check if the file, given through metadata, exists and is opened correctly *value = NULL; - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); switch (_metadata->filetype) { // Process the file according to the specified file type case METADATA_EDITOR_FORMAT_MP3: { @@ -1099,7 +1099,7 @@ extern "C" int metadata_editor_get_metadata(metadata_editor_h metadata, metadata TagLib::FLAC::File* _file = (TagLib::FLAC::File*)_metadata->file; TagLib::Ogg::XiphComment* xtag = _file->xiphComment(false); if (!xtag) { // Check if we have a valid tag for processing - metadata_editor_error("Tag does not exist\n"); + metadata_editor_error("Tag does not exist"); *value = NULL; return METADATA_EDITOR_ERROR_OPERATION_FAILED; } @@ -1126,7 +1126,7 @@ extern "C" int metadata_editor_get_metadata(metadata_editor_h metadata, metadata TagLib::Ogg::Vorbis::File* _file = (TagLib::Ogg::Vorbis::File*)_metadata->file; TagLib::Ogg::XiphComment* xtag = _file->tag(); if (!xtag) { // Check if we have a valid tag for processing - metadata_editor_error("Tag does not exist\n"); + metadata_editor_error("Tag does not exist"); *value = NULL; return METADATA_EDITOR_ERROR_OPERATION_FAILED; } @@ -1152,7 +1152,7 @@ extern "C" int metadata_editor_get_metadata(metadata_editor_h metadata, metadata TagLib::Ogg::FLAC::File* _file = (TagLib::Ogg::FLAC::File*)_metadata->file; TagLib::Ogg::XiphComment* xtag = _file->tag(); if (!xtag) { // Check if we have a valid tag for processing - metadata_editor_error("Tag does not exist\n"); + metadata_editor_error("Tag does not exist"); *value = NULL; return METADATA_EDITOR_ERROR_OPERATION_FAILED; } @@ -1179,7 +1179,7 @@ extern "C" int metadata_editor_get_metadata(metadata_editor_h metadata, metadata TagLib::ID3v2::Tag* tag2 = _file->tag(); if (tag2 == NULL) { // Check if we have a valid tag for processing - metadata_editor_error("Error. ID3v2 tag does not exist. Can not proceed metadata extraction\n"); + metadata_editor_error("Error. ID3v2 tag does not exist. Can not proceed metadata extraction"); *value = NULL; return METADATA_EDITOR_ERROR_OPERATION_FAILED; } @@ -1204,7 +1204,7 @@ extern "C" int metadata_editor_get_metadata(metadata_editor_h metadata, metadata } #endif default: - metadata_editor_error("Wrong file type\n"); + metadata_editor_error("Wrong file type"); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; } } @@ -1216,11 +1216,11 @@ extern "C" int metadata_editor_set_metadata(metadata_editor_h metadata, metadata metadata_editor_s* _metadata = (metadata_editor_s*) metadata; - metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail.\n"); + metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail"); // Check if the file, given through metadata, exists and is opened correctly - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); - metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); + metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify"); switch (_metadata->filetype) { // Process the file according to the specified file type case METADATA_EDITOR_FORMAT_MP3: { @@ -1272,7 +1272,7 @@ extern "C" int metadata_editor_set_metadata(metadata_editor_h metadata, metadata TagLib::FLAC::File* _file = (TagLib::FLAC::File*)_metadata->file; TagLib::Ogg::XiphComment* xtag = _file->xiphComment(true); if (!xtag) { // Check if we have a valid tag for processing - metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating\n"); + metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; } switch (attribute) { // Check which one of frame type was given for processing @@ -1297,7 +1297,7 @@ extern "C" int metadata_editor_set_metadata(metadata_editor_h metadata, metadata TagLib::Ogg::Vorbis::File* _file = (TagLib::Ogg::Vorbis::File*)_metadata->file; TagLib::Ogg::XiphComment* xtag = _file->tag(); if (!xtag) { // Check if we have a valid tag for processing - metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating\n"); + metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; } switch (attribute) { // Check which one of frame type was given for processing @@ -1322,7 +1322,7 @@ extern "C" int metadata_editor_set_metadata(metadata_editor_h metadata, metadata TagLib::Ogg::FLAC::File* _file = (TagLib::Ogg::FLAC::File*)_metadata->file; TagLib::Ogg::XiphComment* xtag = _file->tag(); if (!xtag) { // Check if we have a valid tag for processing - metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating\n"); + metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; } switch (attribute) { // Check which one of frame type was given for processing @@ -1348,7 +1348,7 @@ extern "C" int metadata_editor_set_metadata(metadata_editor_h metadata, metadata TagLib::ID3v2::Tag* tag2 = _file->tag(); // Check if the valid tag pointer exist if (tag2 == NULL) { - metadata_editor_error("Error. ID3v2 tag was not created. Can not proceed metadata updating\n"); + metadata_editor_error("Error. ID3v2 tag was not created. Can not proceed metadata updating"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; } @@ -1371,7 +1371,7 @@ extern "C" int metadata_editor_set_metadata(metadata_editor_h metadata, metadata } #endif default: - metadata_editor_error("Wrong file type\n"); + metadata_editor_error("Wrong file type"); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; } } @@ -1379,14 +1379,14 @@ extern "C" int metadata_editor_set_metadata(metadata_editor_h metadata, metadata // *** This function apply all changes done in the tag(s) and update them to file *** // extern "C" int metadata_editor_update_metadata(metadata_editor_h metadata) { // Check if we have a valid argument to work with - metadata_editor_retvm_if(metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID Handle\n"); + metadata_editor_retvm_if(metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID Handle"); metadata_editor_s *_metadata = (metadata_editor_s*)metadata; - metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail.\n"); + metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail"); // Check if the file, given through metadata, exists and is opened correctly - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); - metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); + metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify"); switch (_metadata->filetype) { // Process the file according to the specified file type case METADATA_EDITOR_FORMAT_MP3: { @@ -1445,7 +1445,7 @@ extern "C" int metadata_editor_update_metadata(metadata_editor_h metadata) { } #endif default: - metadata_editor_error("Wrong file type\n"); + metadata_editor_error("Wrong file type"); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; } } @@ -1455,19 +1455,19 @@ extern "C" int metadata_editor_get_picture(metadata_editor_h metadata, int index const char *TYPE_JPEG = "image/jpeg"; const char *TYPE_PNG = "image/png"; // Check if we have valid arguments to work with - metadata_editor_retvm_if(metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID Handle\n"); + metadata_editor_retvm_if(metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID Handle"); metadata_editor_retvm_if(picture == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID PARAMETER"); metadata_editor_retvm_if(size == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID PARAMETER"); metadata_editor_s* _metadata = (metadata_editor_s*) metadata; - metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail.\n"); + metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail"); // Check if the file, given through metadata, exists and is opened correctly *picture = NULL; *size = 0; *mime_type = NULL; - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); switch (_metadata->filetype) { // Process the file according to the specified file type case METADATA_EDITOR_FORMAT_MP3: { @@ -1478,12 +1478,12 @@ extern "C" int metadata_editor_get_picture(metadata_editor_h metadata, int index TagLib::ID3v2::FrameList lst = tag2->frameListMap()["APIC"]; // Check if there are pictures in the tag if (lst.isEmpty()) { - metadata_editor_error("No pictures in file\n"); + metadata_editor_error("No pictures in file"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; } else { // pictures exist in file // Check if index is correct or not if ((index < 0) || (lst.size() <= (uint)index)) { - metadata_editor_error("Index of picture is out of range\n"); + metadata_editor_error("Index of picture is out of range"); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; } else { // everything is correct - begin extraction metadata_editor_info("There are %u pictures in file. Start of picture number %d extraction", lst.size(), index); @@ -1515,7 +1515,7 @@ extern "C" int metadata_editor_get_picture(metadata_editor_h metadata, int index case METADATA_EDITOR_FORMAT_MP4: { TagLib::MP4::File* _file = (TagLib::MP4::File*) _metadata->file; TagLib::MP4::Tag* tag = _file->tag(); - metadata_editor_retvm_if(tag == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist\n"); + metadata_editor_retvm_if(tag == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist"); // Get map of items directly from tag and launch a search of specific item TagLib::MP4::ItemListMap& itemMap = tag->itemListMap(); @@ -1524,7 +1524,7 @@ extern "C" int metadata_editor_get_picture(metadata_editor_h metadata, int index TagLib::MP4::CoverArtList lst = it->second.toCoverArtList(); // Check if the index is in range of CoverArtList Item if ((index < 0) || ((uint)index >= lst.size())) { // it is not - metadata_editor_error("Index of picture is out of range\n"); + metadata_editor_error("Index of picture is out of range"); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; } else { // index is in range int i = 0; @@ -1545,7 +1545,7 @@ extern "C" int metadata_editor_get_picture(metadata_editor_h metadata, int index return METADATA_EDITOR_ERROR_NONE; } } else { // Item was not found - no pictures in file - metadata_editor_error("No item in file. No pictures in file\n"); + metadata_editor_error("No item in file. No pictures in file"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; } } @@ -1554,12 +1554,12 @@ extern "C" int metadata_editor_get_picture(metadata_editor_h metadata, int index TagLib::FLAC::File* _file = (TagLib::FLAC::File*) _metadata->file; TagLib::List lst = _file->pictureList(); if (lst.isEmpty()) { - metadata_editor_error("No pictures in FLAC file\n"); + metadata_editor_error("No pictures in FLAC file"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; } else { // Check if the index is in range of CoverArtList Item if ((index < 0) || ((uint)index >= lst.size())) { // it is not - metadata_editor_error("Index of picture is out of range\n"); + metadata_editor_error("Index of picture is out of range"); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; } else { // index is in range // Consecutive check of all pictures until the desired one is found @@ -1592,18 +1592,18 @@ extern "C" int metadata_editor_get_picture(metadata_editor_h metadata, int index TagLib::RIFF::WAV::File* _file = (TagLib::RIFF::WAV::File*)_metadata->file; // Bring the pointer to actual file type TagLib::ID3v2::Tag* tag2 = _file->tag(); if (!tag2) { - metadata_editor_error("No ID3v2 tag in file\n"); + metadata_editor_error("No ID3v2 tag in file"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; } TagLib::ID3v2::FrameList lst = tag2->frameListMap()["APIC"]; // Check if there are pictures in the tag if (lst.isEmpty()) { - metadata_editor_error("No pictures in file\n"); + metadata_editor_error("No pictures in file"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; } else { // pictures exist in file // Check if index is correct or not if ((index < 0) || (lst.size() <= (uint)index)) { - metadata_editor_error("Index of picture is out of range\n"); + metadata_editor_error("Index of picture is out of range"); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; } else { // everything is correct - begin extraction metadata_editor_info("There are %u pictures in file. Start of picture number %d extraction", lst.size(), index); @@ -1635,7 +1635,7 @@ extern "C" int metadata_editor_get_picture(metadata_editor_h metadata, int index } #endif default: - metadata_editor_error("Wrong file type\n"); + metadata_editor_error("Wrong file type"); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; } } @@ -1652,14 +1652,14 @@ extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const metadata_editor_retvm_if(path == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID PARAMETER"); metadata_editor_s* _metadata = (metadata_editor_s*) metadata; - metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail.\n"); + metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail"); // Check if the file, given through metadata, exists and is opened correctly - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); - metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); + metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify"); ret = __metadata_editor_get_picture_info(path, &picture, &size, &type); - metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); + metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); switch (_metadata->filetype) { // Process the file according to the specified file type case METADATA_EDITOR_FORMAT_MP3: { @@ -1668,17 +1668,17 @@ extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const TagLib::ID3v2::Tag* tag2 = _file->ID3v2Tag(true); // Check if the valid tag pointer exists if (tag2 == NULL) { - metadata_editor_error("Error. ID3v2 tag was not created. Can not proceed metadata updating\n"); + metadata_editor_error("Error. ID3v2 tag was not created. Can not proceed metadata updating"); ret = METADATA_EDITOR_ERROR_OPERATION_FAILED; break; } TagLib::ID3v2::AttachedPictureFrame* pictureFrame = new TagLib::ID3v2::AttachedPictureFrame(); if (pictureFrame == NULL) { - metadata_editor_error("OUT_OF_MEMORY\n"); + metadata_editor_error("OUT_OF_MEMORY"); ret = METADATA_EDITOR_ERROR_OUT_OF_MEMORY; break; } - metadata_editor_info("New APIC frame will be added to the ID3v2 tag\n"); + metadata_editor_info("New APIC frame will be added to the ID3v2 tag"); pictureFrame->setPicture(TagLib::ByteVector((char*)picture, size)); pictureFrame->setType(TagLib::ID3v2::AttachedPictureFrame::FrontCover); pictureFrame->setMimeType(type); @@ -1692,7 +1692,7 @@ extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const TagLib::MP4::File* _file = (TagLib::MP4::File*) _metadata->file; TagLib::MP4::Tag* tag = _file->tag(); if (!tag) { - metadata_editor_error("Tag was not created\n"); + metadata_editor_error("Tag was not created"); ret = METADATA_EDITOR_ERROR_OPERATION_FAILED; break; } @@ -1701,7 +1701,7 @@ extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const TagLib::MP4::ItemListMap& itemMap = tag->itemListMap(); TagLib::MP4::ItemListMap::ConstIterator it = itemMap.find("covr"); if (it != itemMap.end()) { // Item was found - metadata_editor_info("The item exists. Adding picture\n"); + metadata_editor_info("The item exists. Adding picture"); TagLib::MP4::CoverArtList lst = it->second.toCoverArtList(); TagLib::MP4::CoverArt::Format format; if (strncmp(type, "image/jpeg", strlen("image/jpeg")) == 0) @@ -1717,7 +1717,7 @@ extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const ret = METADATA_EDITOR_ERROR_NONE; break; } else { // Item was not found - metadata_editor_info("The item does not exist. Adding picture\n"); + metadata_editor_info("The item does not exist. Adding picture"); TagLib::MP4::CoverArt::Format format; if (strncmp(type, "image/jpeg", strlen("image/jpeg")) == 0) format = TagLib::MP4::CoverArt::JPEG; @@ -1739,7 +1739,7 @@ extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const TagLib::FLAC::File* _file = (TagLib::FLAC::File*) _metadata->file; TagLib::FLAC::Picture* frontCover = new TagLib::FLAC::Picture; if (frontCover == NULL) { - metadata_editor_error("OUT_OF_MEMORY\n"); + metadata_editor_error("OUT_OF_MEMORY"); ret = METADATA_EDITOR_ERROR_OUT_OF_MEMORY; break; } @@ -1747,7 +1747,7 @@ extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const frontCover->setType(TagLib::FLAC::Picture::FrontCover); frontCover->setMimeType(type); - metadata_editor_info("Picture will be added to FLAC file\n"); + metadata_editor_info("Picture will be added to FLAC file"); _file->addPicture(frontCover); ret = METADATA_EDITOR_ERROR_NONE; break; @@ -1758,17 +1758,17 @@ extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const TagLib::ID3v2::Tag* tag2 = _file->tag(); // Check if the valid tag pointer exists if (tag2 == NULL) { - metadata_editor_error("Error. ID3v2 tag was not created. Can not proceed metadata updating\n"); + metadata_editor_error("Error. ID3v2 tag was not created. Can not proceed metadata updating"); ret = METADATA_EDITOR_ERROR_OPERATION_FAILED; break; } TagLib::ID3v2::AttachedPictureFrame* pictureFrame = new TagLib::ID3v2::AttachedPictureFrame(); if (pictureFrame == NULL) { - metadata_editor_error("OUT_OF_MEMORY\n"); + metadata_editor_error("OUT_OF_MEMORY"); ret = METADATA_EDITOR_ERROR_OUT_OF_MEMORY; break; } - metadata_editor_info("New APIC frame will be added to the ID3v2 tag\n"); + metadata_editor_info("New APIC frame will be added to the ID3v2 tag"); pictureFrame->setPicture(TagLib::ByteVector((char*)picture, size)); pictureFrame->setType(TagLib::ID3v2::AttachedPictureFrame::FrontCover); pictureFrame->setMimeType(type); @@ -1778,7 +1778,7 @@ extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const } #endif default: { - metadata_editor_error("Wrong file type\n"); + metadata_editor_error("Wrong file type"); ret = METADATA_EDITOR_ERROR_NOT_SUPPORTED; break; } @@ -1796,11 +1796,11 @@ extern "C" int metadata_editor_remove_picture(metadata_editor_h metadata, int in metadata_editor_retvm_if(metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID handler."); metadata_editor_s* _metadata = (metadata_editor_s*) metadata; - metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail.\n"); + metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail"); // Check if the file, given through metadata, exists and is opened correctly - metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n"); - metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n"); + metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it"); + metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify"); switch (_metadata->filetype) { // Process the file according to the specified file type case METADATA_EDITOR_FORMAT_MP3: { @@ -1812,15 +1812,15 @@ extern "C" int metadata_editor_remove_picture(metadata_editor_h metadata, int in TagLib::ID3v2::FrameList lst = tag2->frameListMap()["APIC"]; // Check if there are pictures in the tag if (lst.isEmpty()) { - metadata_editor_error("No pictures in file\n"); + metadata_editor_error("No pictures in file"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; } else { // pictures exist in file // Check if index is correct or not if ((index < 0) || (lst.size() <= (uint)index)) { - metadata_editor_error("Index of picture is out of range\n"); + metadata_editor_error("Index of picture is out of range"); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; } else { // everything is correct - begin extraction - metadata_editor_info("Removing of picture number %d\n", index); + metadata_editor_info("Removing of picture number %d", index); int i = 0; // Among all frames we must choose that one with specified index. "i" will be counter for (TagLib::ID3v2::FrameList::Iterator it = lst.begin(); it != lst.end(); ++it, ++i) { @@ -1844,10 +1844,10 @@ extern "C" int metadata_editor_remove_picture(metadata_editor_h metadata, int in TagLib::MP4::CoverArtList lst = it->second.toCoverArtList(); // Check if the index is in range of CoverArtList Item if ((index < 0) || ((uint)index >= lst.size())) { // it is not - metadata_editor_error("Index of picture is out of range\n"); + metadata_editor_error("Index of picture is out of range"); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; } else { // index is in range - metadata_editor_info("The picture number %d will be deleted\n", index); + metadata_editor_info("The picture number %d will be deleted", index); int i = 0; for (TagLib::MP4::CoverArtList::Iterator picIt = lst.begin(); picIt != lst.end(); ++picIt, ++i) { if (i != index) continue; @@ -1858,7 +1858,7 @@ extern "C" int metadata_editor_remove_picture(metadata_editor_h metadata, int in return METADATA_EDITOR_ERROR_NONE; } } else { // Item was not found - metadata_editor_error("The item does not exist. Nothing to delete\n"); + metadata_editor_error("The item does not exist. Nothing to delete"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; } } @@ -1867,15 +1867,15 @@ extern "C" int metadata_editor_remove_picture(metadata_editor_h metadata, int in TagLib::FLAC::File* _file = (TagLib::FLAC::File*) _metadata->file; TagLib::List lst = _file->pictureList(); if (lst.isEmpty()) { - metadata_editor_error("No pictures in file. Nothing to delete\n"); + metadata_editor_error("No pictures in file. Nothing to delete"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; } // Check if the index is in range of CoverArtList Item if ((index < 0) || ((uint)index >= lst.size())) { // it is not - metadata_editor_error("Index of picture is out of range\n"); + metadata_editor_error("Index of picture is out of range"); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; } else { // index is in range - metadata_editor_info("The picture number %d will be deleted\n", index); + metadata_editor_info("The picture number %d will be deleted", index); int i = 0; for (TagLib::List::Iterator picIt = lst.begin(); picIt != lst.end(); ++picIt, ++i) { if (i != index) continue; @@ -1891,21 +1891,21 @@ extern "C" int metadata_editor_remove_picture(metadata_editor_h metadata, int in TagLib::ID3v2::Tag* tag2 = _file->tag(); // Check if the valid tag pointer exists if (tag2 == NULL) { - metadata_editor_error("Error. ID3v2 tag does not exist. Can not remove picture\n"); + metadata_editor_error("Error. ID3v2 tag does not exist. Can not remove picture"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; } TagLib::ID3v2::FrameList lst = tag2->frameListMap()["APIC"]; // Check if there are pictures in the tag if (lst.isEmpty()) { - metadata_editor_error("No pictures in file\n"); + metadata_editor_error("No pictures in file"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; } else { // pictures exist in file // Check if index is correct or not if ((index < 0) || (lst.size() <= (uint)index)) { - metadata_editor_error("Index of picture is out of range\n"); + metadata_editor_error("Index of picture is out of range"); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; } else { // everything is correct - begin extraction - metadata_editor_info("Removing of picture number %d\n", index); + metadata_editor_info("Removing of picture number %d", index); int i = 0; // Among all frames we must choose that one with specified index. "i" will be counter for (TagLib::ID3v2::FrameList::Iterator it = lst.begin(); it != lst.end(); ++it, ++i) { @@ -1919,7 +1919,7 @@ extern "C" int metadata_editor_remove_picture(metadata_editor_h metadata, int in } #endif default: - metadata_editor_error("Wrong file type\n"); + metadata_editor_error("Wrong file type"); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; } } @@ -1972,11 +1972,11 @@ extern "C" int metadata_editor_destroy(metadata_editor_h metadata) { } #endif default: - metadata_editor_error("Wrong file type\n"); + metadata_editor_error("Wrong file type"); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; } - metadata_editor_info(" with address %p will be freed\n", metadata); + metadata_editor_info(" with address %p will be freed", metadata); delete _metadata; return METADATA_EDITOR_ERROR_NONE; -- 2.7.4 From 0b7673bf7f1f7ba04e9db43c812b17326eabf13c Mon Sep 17 00:00:00 2001 From: Jiyong Min Date: Tue, 12 Sep 2017 13:25:08 +0900 Subject: [PATCH 08/16] Apply tizen coding rule Change-Id: I808f35cc9231b7fe41b16f3c46d1cee1a6a48148 Signed-off-by: Jiyong Min --- include/metadata_editor_private.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/metadata_editor_private.h b/include/metadata_editor_private.h index 48d558b..4207292 100755 --- a/include/metadata_editor_private.h +++ b/include/metadata_editor_private.h @@ -54,8 +54,7 @@ extern "C" { #endif #define LOG_TAG "CAPI_MEDIA_METADATA_EDITOR" #define META_SAFE_FREE(src) { if (src) {free(src); src = NULL; } } -#define META_MALLOC(src, size) { if (size <= 0) src = NULL; \ - else { src = (char *)malloc(size); if (src) memset(src, 0x0, size); } } +#define META_MALLOC(src, size) { if (size <= 0) { src = NULL; } else { src = (char *)malloc(size); if (src) memset(src, 0x0, size); } } #define META_MAX_BUF_LEN 20 -- 2.7.4 From 7b795050a1ca3bace60959d52d2ce0ea217ff197 Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Fri, 29 Sep 2017 12:06:35 +0900 Subject: [PATCH 09/16] Reinforce coverage Change-Id: I387ff9ec8c67a0cfc8ec787a81d42a80b33a4168 Signed-off-by: Minje Ahn --- src/metadata_editor.cpp | 46 +++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/src/metadata_editor.cpp b/src/metadata_editor.cpp index 5953d9d..7d4004e 100755 --- a/src/metadata_editor.cpp +++ b/src/metadata_editor.cpp @@ -21,6 +21,7 @@ #include #include #include +#include static int __ID3_getTwixFrameByName(metadata_editor_s* _metadata, TagLib::ID3v1::Tag* tag1, TagLib::ID3v2::Tag* tag2, const char* frameID, char** value); static int __ID3_setTwixFrameByName(metadata_editor_s* _metadata, TagLib::ID3v1::Tag* tag1, TagLib::ID3v2::Tag* tag2, const char* frameID, const char* value); @@ -576,13 +577,10 @@ static int __MP4_getNumberOfPictures(metadata_editor_s* _metadata, char** value) TagLib::MP4::ItemListMap& itemMap = tag->itemListMap(); TagLib::MP4::ItemListMap::ConstIterator it = itemMap.find("covr"); if (it != itemMap.end()) { // Item was found - uint number = it->second.toCoverArtList().size(); // Get the size of CoverList (i.e. number of pictures in file) - metadata_editor_info("There are %u picture(s) in file", number); char buf[META_MAX_BUF_LEN] = {0, }; - snprintf(buf, META_MAX_BUF_LEN, "%u", number); // Convert integer value of size to its c-string representation - int length = strlen(buf); - metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string"); - *value = strndup(buf, length); + snprintf(buf, META_MAX_BUF_LEN, "%u", it->second.toCoverArtList().size()); // Convert integer value of size to its c-string representation + if (strlen(buf) > 0) + *value = g_strdup(buf); return METADATA_EDITOR_ERROR_NONE; } else { // Item was not found metadata_editor_info("No item in file"); @@ -1398,14 +1396,11 @@ extern "C" int metadata_editor_update_metadata(metadata_editor_h metadata) { if (!tag1 || tag1->isEmpty()) { // If no ID3v1 tag - prevent its creation if (_file->save(TagLib::MPEG::File::ID3v2 | TagLib::MPEG::File::APE)) return METADATA_EDITOR_ERROR_NONE; - else - return METADATA_EDITOR_ERROR_OPERATION_FAILED; } else { // otherwise - save all tags in file if (_file->save(TagLib::MPEG::File::AllTags)) return METADATA_EDITOR_ERROR_NONE; - else - return METADATA_EDITOR_ERROR_OPERATION_FAILED; } + return METADATA_EDITOR_ERROR_OPERATION_FAILED; } case METADATA_EDITOR_FORMAT_MP4: { TagLib::MP4::File* _file = (TagLib::MP4::File*)_metadata->file; @@ -1811,26 +1806,19 @@ extern "C" int metadata_editor_remove_picture(metadata_editor_h metadata, int in metadata_editor_retvm_if(tag2 == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating"); TagLib::ID3v2::FrameList lst = tag2->frameListMap()["APIC"]; // Check if there are pictures in the tag - if (lst.isEmpty()) { - metadata_editor_error("No pictures in file"); - return METADATA_EDITOR_ERROR_OPERATION_FAILED; - } else { // pictures exist in file - // Check if index is correct or not - if ((index < 0) || (lst.size() <= (uint)index)) { - metadata_editor_error("Index of picture is out of range"); - return METADATA_EDITOR_ERROR_INVALID_PARAMETER; - } else { // everything is correct - begin extraction - metadata_editor_info("Removing of picture number %d", index); - int i = 0; - // Among all frames we must choose that one with specified index. "i" will be counter - for (TagLib::ID3v2::FrameList::Iterator it = lst.begin(); it != lst.end(); ++it, ++i) { - if (i != index) continue; - tag2->removeFrame(*it); - break; - } - return METADATA_EDITOR_ERROR_NONE; - } + metadata_editor_retvm_if(lst.isEmpty(), METADATA_EDITOR_ERROR_OPERATION_FAILED, "No pictures in file"); + + // Check if index is correct or not + metadata_editor_retvm_if((index < 0) || (lst.size() <= (uint)index), METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Index of picture is out of range"); + metadata_editor_info("Removing of picture number %d", index); + int i = 0; + // Among all frames we must choose that one with specified index. "i" will be counter + for (TagLib::ID3v2::FrameList::Iterator it = lst.begin(); it != lst.end(); ++it, ++i) { + if (i != index) continue; + tag2->removeFrame(*it); + break; } + return METADATA_EDITOR_ERROR_NONE; } case METADATA_EDITOR_FORMAT_MP4: { TagLib::MP4::File* _file = (TagLib::MP4::File*) _metadata->file; -- 2.7.4 From 806db55afc0ce5a88950d96e53e30b0ec295207b Mon Sep 17 00:00:00 2001 From: hj kim Date: Wed, 24 Jan 2018 14:17:03 +0900 Subject: [PATCH 10/16] Fix Doxygen mistakes Change-Id: I5338485c225160dc101280459f4dbb01a631c0b1 --- include/metadata_editor.h | 76 +++++++++++++++---------------- include/metadata_editor_private.h | 6 +-- include/metadata_editor_type.h | 19 +++++--- packaging/capi-media-metadata-editor.spec | 2 +- 4 files changed, 54 insertions(+), 49 deletions(-) diff --git a/include/metadata_editor.h b/include/metadata_editor.h index 07d6a50..d012f1a 100755 --- a/include/metadata_editor.h +++ b/include/metadata_editor.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __TIZEN_METADATA_EDITOR_H__ -#define __TIZEN_METADATA_EDITOR_H__ +#ifndef __TIZEN_MULTIMEDIA_METADATA_EDITOR_H__ +#define __TIZEN_MULTIMEDIA_METADATA_EDITOR_H__ #include @@ -36,12 +36,12 @@ extern "C" { /** - * @brief Create metadata + * @brief Creates metadata. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * - * @remarks You must release @a metadata using metadata_editor_destroy(). + * @remarks The @a metadata should be released using metadata_editor_destroy(). * - * @param [in] metadata The handle to metadata + * @param[in] metadata The handle to metadata * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter @@ -52,14 +52,14 @@ int metadata_editor_create(metadata_editor_h *metadata); /** - * @brief Set file path to read or write metadata + * @brief Sets file path to read or write metadata. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remarks In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. * - * @param [in] metadata The handle to metadata - * @param [in] path path to read or write metadata + * @param[in] metadata The handle to metadata + * @param[in] path path to read or write metadata * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter @@ -74,17 +74,17 @@ int metadata_editor_set_path(metadata_editor_h metadata, const char *path); /** - * @brief Get the metadata corresponding to the attribute. + * @brief Gets the metadata corresponding to the attribute. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * - * @remarks You must release @a value using @c free(). \n + * @remarks The @a value should be released using free(). \n * If the attribute value of the metadata is empty, return value is NULL. \n * In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. * - * @param [in] metadata The handle to metadata - * @param [in] attribute key attribute name to get - * @param [out] value The value of the attribute + * @param[in] metadata The handle to metadata + * @param[in] attribute key attribute name to get + * @param[out] value The value of the attribute * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter @@ -98,16 +98,16 @@ int metadata_editor_get_metadata(metadata_editor_h metadata, metadata_editor_att /** - * @brief Set the attribute of the metadata. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @brief Sets the attribute of the metadata. * @details This function set the attribute of the metadata for updating the metadata. \n + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * - * @remarks You must release @a value using @c free(). \n + * @remarks The @a value should be released using free(). \n * You must call metadata_editor_update_metadata() for applying to the metadata of the media file. if not, you will see the existing metadata when you call metadata_editor_get_metadata(). * - * @param [in] metadata The handle to metadata - * @param [in] attribute key attribute name to get - * @param [in] value The value of the attribute + * @param[in] metadata The handle to metadata + * @param[in] attribute key attribute name to get + * @param[in] value The value of the attribute * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter @@ -120,14 +120,14 @@ int metadata_editor_set_metadata(metadata_editor_h metadata, metadata_editor_att /** - * @brief Update the modified metadata - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @brief Updates the modified metadata. * @details This function update the metadata in the media file that is modified by metadata_editor_set_metadata(). + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remarks In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. * - * @param [in] metadata The handle to metadata + * @param[in] metadata The handle to metadata * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter @@ -140,18 +140,18 @@ int metadata_editor_set_metadata(metadata_editor_h metadata, metadata_editor_att int metadata_editor_update_metadata(metadata_editor_h metadata); /** - * @brief Get the picture in the media file + * @brief Gets the picture in the media file. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * - * @remarks You must release @a picture using @c free(). \n + * @remarks The @a picture abd @a mime_type should be released using free(). \n * In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. * - * @param [in] metadata The handle to metadata - * @param [in] index picture order - * @param [out] picture encoded picture - * @param [out] size encoded picture size - * @param [out] mime_type the mime type of picture + * @param[in] metadata The handle to metadata + * @param[in] index picture order + * @param[out] picture encoded picture + * @param[out] size encoded picture size + * @param[out] mime_type the MIME of the picture * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter @@ -164,7 +164,7 @@ int metadata_editor_update_metadata(metadata_editor_h metadata); int metadata_editor_get_picture(metadata_editor_h metadata, int index, void **picture, int *size, char **mime_type); /** - * @brief Append the picture to the media file + * @brief Appends the picture to the media file. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remarks You must call metadata_editor_update_metadata() for applying to the metadata of the media file. if not, you will see the existing metadata when you call metadata_editor_get_metadata(). \n @@ -172,8 +172,8 @@ int metadata_editor_get_picture(metadata_editor_h metadata, int index, void **pi * In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. * - * @param [in] metadata The handle to metadata - * @param [in] picture_path The path of picture for adding to the metadata + * @param[in] metadata The handle to metadata + * @param[in] picture_path The path of picture for adding to the metadata * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter @@ -187,13 +187,13 @@ int metadata_editor_get_picture(metadata_editor_h metadata, int index, void **pi int metadata_editor_append_picture(metadata_editor_h metadata, const char *picture_path); /** - * @brief Remove artwork image from media file + * @brief Removes artwork image from media file. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remarks You must call metadata_editor_update_metadata() for applying to the metadata of the media file. if not, you will see the existing metadata when you call metadata_editor_get_metadata(). \n * - * @param [in] metadata The handle to metadata - * @param [in] index artwork image order + * @param[in] metadata The handle to metadata + * @param[in] index artwork image order * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter @@ -206,10 +206,10 @@ int metadata_editor_append_picture(metadata_editor_h metadata, const char *pictu int metadata_editor_remove_picture(metadata_editor_h metadata, int index); /** - * @brief Destroy metadata + * @brief Destroys metadata. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * - * @param [in] metadata The handle to metadata + * @param[in] metadata The handle to metadata * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter @@ -228,4 +228,4 @@ int metadata_editor_destroy(metadata_editor_h metadata); } #endif /* __cplusplus */ -#endif /* __TIZEN_METADATA_EDITOR_H__ */ +#endif /* __TIZEN_MULTIMEDIA_METADATA_EDITOR_H__ */ diff --git a/include/metadata_editor_private.h b/include/metadata_editor_private.h index 4207292..767fdbb 100755 --- a/include/metadata_editor_private.h +++ b/include/metadata_editor_private.h @@ -15,8 +15,8 @@ */ -#ifndef __TIZEN_METADATA_EDITOR_PRIVATE_H__ -#define __TIZEN_METADATA_EDITOR_PRIVATE_H__ +#ifndef __TIZEN_MULTIMEDIA_METADATA_EDITOR_PRIVATE_H__ +#define __TIZEN_MULTIMEDIA_METADATA_EDITOR_PRIVATE_H__ #include #include @@ -96,4 +96,4 @@ typedef struct { #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /*__TIZEN_METADATA_EDITOR_PRIVATE_H__*/ +#endif /*__TIZEN_MULTIMEDIA_METADATA_EDITOR_PRIVATE_H__*/ diff --git a/include/metadata_editor_type.h b/include/metadata_editor_type.h index d7ab918..f1e55ba 100755 --- a/include/metadata_editor_type.h +++ b/include/metadata_editor_type.h @@ -16,8 +16,8 @@ -#ifndef __TIZEN_METADATA_EDITOR_TYPE_H__ -#define __TIZEN_METADATA_EDITOR_TYPE_H__ +#ifndef __TIZEN_MULTIMEDIA_METADATA_EDITOR_TYPE_H__ +#define __TIZEN_MULTIMEDIA_METADATA_EDITOR_TYPE_H__ #include @@ -31,12 +31,17 @@ extern "C" { * @{ */ -/** @brief Definition for Metadata editor Error Class */ + +/** +* @brief Definition for Metadata editor Error Class. +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* +*/ #define METADATA_EDITOR_ERROR_CLASS TIZEN_ERROR_METADATA_EDITOR /** * @ingroup CAPI_MEDIA_METADATA_EDITOR_MODULE - * @brief The enumerations of media metadata error + * @brief The enumerations of media metadata error. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef enum { @@ -52,7 +57,7 @@ typedef enum { /** * @ingroup CAPI_MEDIA_METADATA_EDITOR_MODULE - * @brief The enumerations of attribute + * @brief The enumerations of attribute. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef enum { @@ -73,7 +78,7 @@ typedef enum { /** * @ingroup CAPI_MEDIA_METADATA_EDITOR_MODULE - * @brief The handle of media metadata + * @brief The handle of media metadata. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef void * metadata_editor_h; @@ -86,4 +91,4 @@ typedef void * metadata_editor_h; } #endif /* __cplusplus */ -#endif /*__TIZEN_METADATA_EDITOR_TYPE_H__*/ +#endif /*__TIZEN_MULTIMEDIA_METADATA_EDITOR_TYPE_H__*/ diff --git a/packaging/capi-media-metadata-editor.spec b/packaging/capi-media-metadata-editor.spec index e69ec87..d55882b 100755 --- a/packaging/capi-media-metadata-editor.spec +++ b/packaging/capi-media-metadata-editor.spec @@ -1,6 +1,6 @@ Name: capi-media-metadata-editor Summary: A metadata editor library in Tizen Native API -Version: 0.1.7 +Version: 0.1.8 Release: 0 Group: Multimedia/API License: Apache-2.0 -- 2.7.4 From 5eeceab6a06be700671c76ea11da4a45e61378d2 Mon Sep 17 00:00:00 2001 From: hj kim Date: Thu, 25 Jan 2018 09:19:30 +0900 Subject: [PATCH 11/16] Fix Doxygen mistakes Change-Id: I2e89f110ab047dd34e1c1ecbd6e6b6b7cb853fad --- include/metadata_editor.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/metadata_editor.h b/include/metadata_editor.h index d012f1a..80d4e4b 100755 --- a/include/metadata_editor.h +++ b/include/metadata_editor.h @@ -191,6 +191,8 @@ int metadata_editor_append_picture(metadata_editor_h metadata, const char *pictu * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remarks You must call metadata_editor_update_metadata() for applying to the metadata of the media file. if not, you will see the existing metadata when you call metadata_editor_get_metadata(). \n + * In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n + * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. * * @param[in] metadata The handle to metadata * @param[in] index artwork image order -- 2.7.4 From 36424e29da432f8cde3f147bd8692ba8f4263b14 Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Mon, 12 Feb 2018 11:31:48 +0900 Subject: [PATCH 12/16] Fix typo Change-Id: I309224042e23271c4ce2142b7f5ec5135219fde5 Signed-off-by: Minje Ahn --- include/metadata_editor.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/metadata_editor.h b/include/metadata_editor.h index 80d4e4b..8e115b5 100755 --- a/include/metadata_editor.h +++ b/include/metadata_editor.h @@ -56,7 +56,7 @@ int metadata_editor_create(metadata_editor_h *metadata); * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remarks In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n - * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. + * For example, if you get the specific path by using storage_get_directory(). you should add privilege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. * * @param[in] metadata The handle to metadata * @param[in] path path to read or write metadata @@ -80,7 +80,7 @@ int metadata_editor_set_path(metadata_editor_h metadata, const char *path); * @remarks The @a value should be released using free(). \n * If the attribute value of the metadata is empty, return value is NULL. \n * In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n - * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. + * For example, if you get the specific path by using storage_get_directory(). you should add privilege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. * * @param[in] metadata The handle to metadata * @param[in] attribute key attribute name to get @@ -125,7 +125,7 @@ int metadata_editor_set_metadata(metadata_editor_h metadata, metadata_editor_att * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remarks In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n - * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. + * For example, if you get the specific path by using storage_get_directory(). you should add privilege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. * * @param[in] metadata The handle to metadata * @return 0 on success, otherwise a negative error value @@ -145,7 +145,7 @@ int metadata_editor_update_metadata(metadata_editor_h metadata); * * @remarks The @a picture abd @a mime_type should be released using free(). \n * In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n - * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. + * For example, if you get the specific path by using storage_get_directory(). you should add privilege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. * * @param[in] metadata The handle to metadata * @param[in] index picture order @@ -170,7 +170,7 @@ int metadata_editor_get_picture(metadata_editor_h metadata, int index, void **pi * @remarks You must call metadata_editor_update_metadata() for applying to the metadata of the media file. if not, you will see the existing metadata when you call metadata_editor_get_metadata(). \n * Image type of the metadata supports jpeg and png. \n * In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n - * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. + * For example, if you get the specific path by using storage_get_directory(). you should add privilege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. * * @param[in] metadata The handle to metadata * @param[in] picture_path The path of picture for adding to the metadata @@ -192,7 +192,7 @@ int metadata_editor_append_picture(metadata_editor_h metadata, const char *pictu * * @remarks You must call metadata_editor_update_metadata() for applying to the metadata of the media file. if not, you will see the existing metadata when you call metadata_editor_get_metadata(). \n * In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n - * For example, if you get the specific path by using storage_get_directory(). you should add previlege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. + * For example, if you get the specific path by using storage_get_directory(). you should add privilege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. * * @param[in] metadata The handle to metadata * @param[in] index artwork image order -- 2.7.4 From 2e4c90aaaf3864e77a0e53e49451b2143abf744a Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Mon, 5 Mar 2018 14:10:07 +0900 Subject: [PATCH 13/16] Fix typo Change-Id: If06f721dc2c9e13f04cd8e4944b43b72d193d6df Signed-off-by: Minje Ahn --- doc/metadata_editor_doc.h | 2 +- include/metadata_editor.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/metadata_editor_doc.h b/doc/metadata_editor_doc.h index 56f1310..ecb4431 100755 --- a/doc/metadata_editor_doc.h +++ b/doc/metadata_editor_doc.h @@ -37,7 +37,7 @@ * \#include * * @section CAPI_MEDIA_METADATA_EDITOR_OVERVIEW Overview - * The @ref CAPI_MEDIA_METADATA_EDITOR_MODULE API allows you to read the metadata from a media file(#metadata_editor_get_metadata()). To edit a metadata(#metadata_editor_set_metadata()), create/destory the handle(#metadata_editor_create()/#metadata_editor_destroy), and append/ remove a picture in the metadata(#metadata_editor_append_picture()/ #metadata_editor_remove_picture()). + * The @ref CAPI_MEDIA_METADATA_EDITOR_MODULE API allows you to read the metadata from a media file(#metadata_editor_get_metadata()). To edit a metadata(#metadata_editor_set_metadata()), create/destroy the handle(#metadata_editor_create()/#metadata_editor_destroy), and append/ remove a picture in the metadata(#metadata_editor_append_picture()/ #metadata_editor_remove_picture()). */ #endif /* __TIZEN_METADATA_EDITOR_DOC_H__ */ diff --git a/include/metadata_editor.h b/include/metadata_editor.h index 8e115b5..01b8cbc 100755 --- a/include/metadata_editor.h +++ b/include/metadata_editor.h @@ -143,7 +143,7 @@ int metadata_editor_update_metadata(metadata_editor_h metadata); * @brief Gets the picture in the media file. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * - * @remarks The @a picture abd @a mime_type should be released using free(). \n + * @remarks The @a picture and @a mime_type should be released using free(). \n * In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n * For example, if you get the specific path by using storage_get_directory(). you should add privilege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage. * -- 2.7.4 From 41d25a71f1c114ef32178235ec4e616233b72cd4 Mon Sep 17 00:00:00 2001 From: hj kim Date: Fri, 23 Mar 2018 09:29:37 +0900 Subject: [PATCH 14/16] Fix Coverity issues Change-Id: I71fb5886972dae84270b701d35eca0176175fb86 --- test/metadata_editor_test.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/metadata_editor_test.c b/test/metadata_editor_test.c index 1f84eb3..6e2bbc6 100755 --- a/test/metadata_editor_test.c +++ b/test/metadata_editor_test.c @@ -366,10 +366,14 @@ 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; - metadata_editor_get_metadata(metadata, METADATA_EDITOR_ATTR_PICTURE_NUM, &picture_index); + ret = metadata_editor_get_metadata(metadata, METADATA_EDITOR_ATTR_PICTURE_NUM, &picture_index); + if (ret != METADATA_EDITOR_ERROR_NONE) + printf("fail to metadata_editor_get_metadata[%d]\n", ret); + printf("The number of pictures is [%s]\n", picture_index); if (picture_index) { -- 2.7.4 From 5216d274a51a3c3abb69d2690267d2bbc11647ab Mon Sep 17 00:00:00 2001 From: hj kim Date: Thu, 21 Jun 2018 14:04:07 +0900 Subject: [PATCH 15/16] Just update api description Change-Id: If122aba54eec100152d2625d008398102a324a5e --- include/metadata_editor.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/metadata_editor.h b/include/metadata_editor.h index 01b8cbc..a4eaddf 100755 --- a/include/metadata_editor.h +++ b/include/metadata_editor.h @@ -45,7 +45,7 @@ extern "C" { * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #METADATA_EDITOR_ERROR_OUT_OF_MEMORY Not enough memory is available + * @retval #METADATA_EDITOR_ERROR_OUT_OF_MEMORY Out of memory * @see metadata_editor_destroy() */ int metadata_editor_create(metadata_editor_h *metadata); @@ -88,7 +88,7 @@ int metadata_editor_set_path(metadata_editor_h metadata, const char *path); * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #METADATA_EDITOR_ERROR_OUT_OF_MEMORY Not enough memory is available + * @retval #METADATA_EDITOR_ERROR_OUT_OF_MEMORY Out of memory * @retval #METADATA_EDITOR_ERROR_PERMISSION_DENIED Permission denied * @retval #METADATA_EDITOR_ERROR_OPERATION_FAILED Internal Operation Fail * @pre Set path to read or write metadata by calling metadata_editor_set_path() @@ -111,7 +111,7 @@ int metadata_editor_get_metadata(metadata_editor_h metadata, metadata_editor_att * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #METADATA_EDITOR_ERROR_OUT_OF_MEMORY Not enough memory is available + * @retval #METADATA_EDITOR_ERROR_OUT_OF_MEMORY Out of memory * @retval #METADATA_EDITOR_ERROR_OPERATION_FAILED Internal Operation Fail * @pre Set path to read or write metadata by calling metadata_editor_set_path() * @see metadata_editor_create(), metadata_editor_update_metadata(), metadata_editor_destroy() @@ -131,7 +131,7 @@ int metadata_editor_set_metadata(metadata_editor_h metadata, metadata_editor_att * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #METADATA_EDITOR_ERROR_OUT_OF_MEMORY Not enough memory is available + * @retval #METADATA_EDITOR_ERROR_OUT_OF_MEMORY Out of memory * @retval #METADATA_EDITOR_ERROR_PERMISSION_DENIED Permission denied * @retval #METADATA_EDITOR_ERROR_OPERATION_FAILED Internal Operation Fail * @pre Set path to read or write metadata by calling metadata_editor_set_path() @@ -155,7 +155,7 @@ int metadata_editor_update_metadata(metadata_editor_h metadata); * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #METADATA_EDITOR_ERROR_OUT_OF_MEMORY Not enough memory is available + * @retval #METADATA_EDITOR_ERROR_OUT_OF_MEMORY Out of memory * @retval #METADATA_EDITOR_ERROR_OPERATION_FAILED Internal Operation Fail * @retval #METADATA_EDITOR_ERROR_PERMISSION_DENIED Permission denied * @pre Set path to read or write metadata by calling metadata_editor_set_path() @@ -177,7 +177,7 @@ int metadata_editor_get_picture(metadata_editor_h metadata, int index, void **pi * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #METADATA_EDITOR_ERROR_OUT_OF_MEMORY Not enough memory is available + * @retval #METADATA_EDITOR_ERROR_OUT_OF_MEMORY Out of memory * @retval #METADATA_EDITOR_ERROR_NOT_SUPPORTED unsupported file type * @retval #METADATA_EDITOR_ERROR_OPERATION_FAILED Internal Operation Fail * @retval #METADATA_EDITOR_ERROR_PERMISSION_DENIED Permission denied @@ -199,7 +199,7 @@ int metadata_editor_append_picture(metadata_editor_h metadata, const char *pictu * @return 0 on success, otherwise a negative error value * @retval #METADATA_EDITOR_ERROR_NONE Successful * @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #METADATA_EDITOR_ERROR_OUT_OF_MEMORY Not enough memory is available + * @retval #METADATA_EDITOR_ERROR_OUT_OF_MEMORY Out of memory * @retval #METADATA_EDITOR_ERROR_OPERATION_FAILED Internal Operation Fail * @retval #METADATA_EDITOR_ERROR_PERMISSION_DENIED Permission denied * @pre Set path to read or write metadata by calling metadata_editor_set_path() -- 2.7.4 From b29ca1c5a3d07abf09deadddf84b0405da9dd502 Mon Sep 17 00:00:00 2001 From: SeokHoon Lee Date: Fri, 14 Sep 2018 16:13:56 +0900 Subject: [PATCH 16/16] Add gcov environment Signed-off-by: SeokHoon Lee Change-Id: Ie6879f3d2a8baef1b61e7f53e6acf2030b4ffaf5 --- packaging/capi-media-metadata-editor.spec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packaging/capi-media-metadata-editor.spec b/packaging/capi-media-metadata-editor.spec index d55882b..a7eed50 100755 --- a/packaging/capi-media-metadata-editor.spec +++ b/packaging/capi-media-metadata-editor.spec @@ -32,6 +32,13 @@ export CFLAGS+=" -Wextra -Wno-array-bounds" export CFLAGS+=" -Wno-ignored-qualifiers -Wno-unused-parameter -Wshadow" export CFLAGS+=" -Wwrite-strings -Wswitch-default" CXXFLAGS=${CXXFLAGS/-fgnu89-inline/} +%if 0%{?gcov:1} +export CFLAGS+=" -fprofile-arcs -ftest-coverage" +export CXXFLAGS+=" -fprofile-arcs -ftest-coverage" +export FFLAGS+=" -fprofile-arcs -ftest-coverage" +export LDFLAGS+=" -lgcov" +%endif + MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` %cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -- 2.7.4