*/
-
+
#include <stdio.h>
#include <stdbool.h>
#include <malloc.h>
{
return MM_ERROR_COMMON_INVALID_PERMISSION;
}
-
+
if (mmf_attribute_validate_int(item, val))
{
int ret = 0;
else if (item->value_spec.type == MMF_VALUE_SPEC_INT_ARRAY)
return MM_ERROR_COMMON_OUT_OF_ARRAY;
else
- return MM_ERROR_COMMON_INVALID_ARGUMENT;
+ return MM_ERROR_COMMON_INVALID_ARGUMENT;
}
{
return MM_ERROR_COMMON_INVALID_PERMISSION;
}
-
+
if (mmf_attribute_validate_double(item, val))
{
int ret = 0;
else if (item->value_spec.type == MMF_VALUE_SPEC_DOUBLE_ARRAY)
return MM_ERROR_COMMON_OUT_OF_ARRAY;
else
- return MM_ERROR_COMMON_INVALID_ARGUMENT;
+ return MM_ERROR_COMMON_INVALID_ARGUMENT;
}
return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ MM_ATTRS_WRITE_LOCK(attrs);
if (mmf_attribute_check_flags(item, MM_ATTRS_FLAG_WRITABLE))
{
int ret = 0;
ret = mmf_attribute_set_string(item, string, size);
+ MM_ATTRS_WRITE_UNLOCK(attrs);
+
if (ret == 0)
return MM_ERROR_NONE;
else
return MM_ERROR_COMMON_INVALID_ARGUMENT;
}
+ MM_ATTRS_WRITE_UNLOCK(attrs);
+
return MM_ERROR_COMMON_INVALID_PERMISSION;
}
mmf_attrs_t *attrs = (mmf_attrs_t *) h;
return_val_if_fail(attrs && idx >= 0 && idx < attrs->count && sval, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ MM_ATTRS_WRITE_LOCK(attrs);
+
if (!(attrs->items[idx].flags & MM_ATTRS_FLAG_READABLE)) {
- mmf_debug(MMF_DEBUG_LOG, "Access denied.\n");
+ //mmf_debug(MMF_DEBUG_LOG, "Access denied.\n");
+ MM_ATTRS_WRITE_UNLOCK(attrs);
return MM_ERROR_COMMON_INVALID_PERMISSION;
}
*sval = mmf_value_get_string(&attrs->items[idx].value,size);
+
+ MM_ATTRS_WRITE_UNLOCK(attrs);
+
return MM_ERROR_NONE;
}
return_val_if_fail(attrs && idx >= 0 && idx < attrs->count && data, MM_ERROR_COMMON_INVALID_ARGUMENT);
if (!(attrs->items[idx].flags & MM_ATTRS_FLAG_READABLE)) {
- mmf_debug(MMF_DEBUG_LOG, "Access denied.\n");
+ //mmf_debug(MMF_DEBUG_LOG, "Access denied.\n");
return MM_ERROR_COMMON_INVALID_PERMISSION;
}
*data=mmf_value_get_data(&attrs->items[idx].value,size);
string = NULL;
size = 0;
}
-
+
return mm_attrs_set_string(attrs, idx, string, size);
}
return -1;
if (err_attr_name)
*err_attr_name = strdup(name);
- if (ret == MM_ERROR_COMMON_OUT_OF_ARRAY) //to avoid confusing
+ if (ret == MM_ERROR_COMMON_OUT_OF_ARRAY) { //to avoid confusing
+ //mmf_debug(MMF_DEBUG_ERROR, "result of mm_attrs_get_index is MM_ERROR_COMMON_OUT_OF_ARRAY so return(ret = %x, name:%s)",ret, name);
return MM_ERROR_COMMON_ATTR_NOT_EXIST;
- else
+ } else {
+ //mmf_debug(MMF_DEBUG_ERROR, "result of mm_attrs_get_index is %x so return(name:%s)",ret, name);
return ret;
+ }
}
//type check
case MM_ATTRS_TYPE_INT:
{
int val = va_arg ((var_args), int);
- mmf_debug(MMF_DEBUG_LOG, "(%s: %d)\n", name, val);
+// mmf_debug(MMF_DEBUG_LOG, "(%s: %d)\n", name, val);
ret = mm_attrs_set_int(attrs, idx, val);
break;
}
case MM_ATTRS_TYPE_DOUBLE:
{
double val = va_arg ((var_args), double);
- mmf_debug(MMF_DEBUG_LOG, "(%s: %f)\n", name, val);
+// mmf_debug(MMF_DEBUG_LOG, "(%s: %f)\n", name, val);
ret = mm_attrs_set_double(attrs, idx, val);
break;
}
{
char * val = va_arg ((var_args), char*);
int size = va_arg ((var_args), int);
- mmf_debug(MMF_DEBUG_LOG, "(%s: \'%s\', size: %d)\n", name, val, size);
+// mmf_debug(MMF_DEBUG_LOG, "(%s: \'%s\', size: %d)\n", name, val, size);
ret = mm_attrs_set_string(attrs, idx, (const char*)val, size);
break;
}
{
void * val = va_arg ((var_args), void*);
int size = va_arg ((var_args), int);
- mmf_debug(MMF_DEBUG_LOG, "(%s: %p, size: %d)\n", name, val, size);
+// mmf_debug(MMF_DEBUG_LOG, "(%s: %p, size: %d)\n", name, val, size);
ret = mm_attrs_set_data(attrs, idx, val, size);
break;
}
case MM_ATTRS_TYPE_INVALID:
default:
- mmf_debug(MMF_DEBUG_ERROR, "This function doesn't support attribute type(%d, name:%s)\n", attr_type, name);
- if (err_attr_name)
- *err_attr_name = strdup(name);
- ret = MM_ERROR_COMMON_INVALID_ARGUMENT;
+ //mmf_debug(MMF_DEBUG_ERROR, "This function doesn't support attribute type(%d, name:%s)\n", attr_type, name);
+ return MM_ERROR_COMMON_INVALID_ARGUMENT;
+ break;
}
if (ret != MM_ERROR_NONE)
{
if (err_attr_name)
*err_attr_name = strdup(name);
- mmf_debug(MMF_DEBUG_ERROR, "Setting failure.(name:%s)\n", name);
+ //mmf_debug(MMF_DEBUG_ERROR, "Setting failure.(name:%s)\n", name);
return ret;
}
name = va_arg (var_args, char*);
}
- if (mmf_attrs_commit_err(attrs, err_attr_name) == -1)
+ if (mmf_attrs_commit_err(attrs, err_attr_name) == -1) {
+ //mmf_debug(MMF_DEBUG_ERROR, "result of mmf_attrs_commit_err is -1 (name:%s)", name);
return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+ }
else
return MM_ERROR_NONE;
case MM_ATTRS_TYPE_INVALID:
default:
// mmf_debug(MMF_DEBUG_ERROR, "This function doesn't support attribute type(%d, name:%s)\n", attr_type, name);
- if (err_attr_name)
- *err_attr_name = strdup(name);
+ //if (err_attr_name)
+ // *err_attr_name = strdup(name);
ret = MM_ERROR_COMMON_INVALID_ARGUMENT;
}
{
if (err_attr_name)
*err_attr_name = strdup(name);
- mmf_debug(MMF_DEBUG_ERROR, "Setting failure.(name:%s)\n", name);
+ //mmf_debug(MMF_DEBUG_ERROR, "Setting failure.(name:%s)\n", name);
return ret;
}
info->double_range.dval = attrs->items[idx].value_spec.spec.double_spec.range.dval;
break;
case MM_ATTRS_VALID_TYPE_NONE:
- mmf_debug(MMF_DEBUG_LOG, "Valid type none.\n");
+ //mmf_debug(MMF_DEBUG_LOG, "Valid type none.\n");
break;
case MM_ATTRS_VALID_TYPE_INVALID:
default:
return_val_if_fail(h, MM_ERROR_COMMON_INVALID_ARGUMENT);
return_val_if_fail(info, MM_ERROR_COMMON_INVALID_ARGUMENT);
- mmf_debug(MMF_DEBUG_LOG, "(attr_name:%s)\n", attr_name);
+ //mmf_debug(MMF_DEBUG_LOG, "(attr_name:%s)\n", attr_name);
mm_attrs_get_index(h, attr_name, &idx);