// *** This function is used to allocate the metadata_editor_s in memory *** //
// *** The structure metadata_editor_s contains all information about the file *** //
extern "C" int metadata_editor_create(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 PARAMETER");
+ metadata_editor_retvm_if(metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid metadata");
metadata_editor_s *_metadata = new metadata_editor_s; // Allocate a structure for handler
metadata_editor_retvm_if(_metadata == NULL, METADATA_EDITOR_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
// *** This function is used to open the file. It creates the instance that is responsible for connection with file *** //
extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char *path) {
// Check if we have valid arguments to work with
- metadata_editor_retvm_if(metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID Handle");
- metadata_editor_retvm_if(path == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID Handle");
+ metadata_editor_retvm_if(!metadata, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid metadata");
+ metadata_editor_retvm_if(!path, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid path");
int exist;
int size = 0;
char *type = NULL;
- metadata_editor_retvm_if(path == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID PARAMETER");
-
metadata_editor_s* _metadata = (metadata_editor_s*) metadata;
ret = __check_metadata_set_parameter(_metadata);
metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret);
+ metadata_editor_retvm_if(!path, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid path");
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");
// *** This function is used to free memory that was allocated with metadata_editor_create(...) and metadata_editor_set_path(...) functions *** //
extern "C" int metadata_editor_destroy(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 PARAMETER");
-
metadata_editor_s *_metadata = (metadata_editor_s*)metadata;
+ metadata_editor_retvm_if(!_metadata, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid metadata");
switch (_metadata->filetype) {
case METADATA_EDITOR_FORMAT_MP3: {