/**
- * Validity structure
+ * Validity structure.
*/
typedef struct {
MMAttrsType type;
};
} MMAttrsInfo;
+/**
+ * Value structure.
+ */
+typedef struct {
+ MMAttrsType type;
+ int size;
+ union {
+ int i_val;
+ double d_val;
+ char *s_val;
+ void *p_val;
+ } value;
+} MMAttrsValue;
+
+/**
+ * Construction information structure.
+ */
+typedef struct {
+ char *name;
+ MMAttrsType value_type;
+ int flags;
+ void *default_value;
+} MMAttrsConstructInfo;
+
+/**
+ * Attributes commit callback function type.
+ *
+ * @param index [in] Index of attribute
+ * @param name [in] Name of attribute
+ * @param value [in] Value of attribute
+ * @param user_param [in] User parameter
+ *
+ * @return This callback function should return true on success, or false on failure.
+ * @see mm_attrs_new
+ */
+typedef bool (*mm_attrs_commit_callback) (int index, const char *name, const MMAttrsValue *value, void *user_param);
#if __GNUC__ >= 4
#define __NULL_TERMINATED __attribute__((__sentinel__))
#endif
/**
+ * This function is to create handle of attributes list and register the commit callback.
+ *
+ * @param info [in] Attributes construction information
+ * @param count [in] The number of attributes
+ * @param name [in] Name of the attributes list (optional, this can be NULL)
+ * @param callback [in] Commit callback (optional, this can be NULL)
+ * @param user_param [in] User param of the commit callback (optional, this can be NULL)
+ * @param attrs [out] Handle of attributes list
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
+ * @see mm_attrs_commit_all
+ * @see mm_attrs_commit
+ * @see mm_attrs_free
+ */
+int mm_attrs_new(MMAttrsConstructInfo *info, int count, const char *name,
+ mm_attrs_commit_callback callback, void *user_param, MMHandleType *attrs);
+
+
+/**
+ * This function releases resources and destroy the attributes handle created by mm_attrs_new.
+ *
+ * @param attrs [in] Handle of attributes list
+ * @see mm_attrs_new
+ */
+void mm_attrs_free(MMHandleType attrs);
+
+
+/**
+ * This function is to commit all the attributes.
+ *
+ * @param attrs [in] Handle of attributes list
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
+ * @see mm_attrs_new
+ * @see mm_attrs_commit
+ */
+int mm_attrs_commit_all(MMHandleType attrs);
+
+
+/**
+ * This function is to commit the attribute.
+ *
+ * @param attrs [in] Handle of attributes list
+ * @param index [in] Index of attribute
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
+ * @see mm_attrs_new
+ * @see mm_attrs_commit_all
+ */
+int mm_attrs_commit(MMHandleType attrs, int index);
+
+
+/**
* This function is to set the integer value to the attribute by name.
*
- * @param attrs [in] MMAttrs handle
- * @param attr_name [in] attribute name
- * @param val [in] integer value to set
+ * @param attrs [in] Handle of attributes list
+ * @param attr_name [in] Name of attribute
+ * @param val [in] Integer value to set
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
*/
* This function is to get the name of attribute at the given index.
*
* @param attrs [in] Handle of attributes list
- * @param index [in] Index of the attribute
+ * @param index [in] Index of attribute
* @param name [out] Name of attribute
*
* @return This function returns the name of attribute on success, or NULL
/**
* This function is to set the string to attribute by name.
*
- * @param attrs [in] MMAttrs handle
- * @param attr_name [in] attribute name
- * @param string [in] string value to set
+ * @param attrs [in] MMAttrs handle
+ * @param attr_name [in] Name of attribute
+ * @param string [in] String value to set
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
*/
/**
* This function is to set the data to the attribute by name.
*
- * @param attrs [in] MMAttrs handle
- * @param attr_name [in] attribute name
- * @param data [in] data pointer to set
- * @param size [in] data size to set
+ * @param attrs [in] Handle of attributes list
+ * @param attr_name [in] Name of attribute
+ * @param data [in] Data pointer to set
+ * @param size [in] Data size to set
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
*/
int mm_attrs_set_data_by_name(MMHandleType attrs, const char *attr_name, void *data, int size);
+
/**
* This function is to get the data from the attribute by name.
*
* @param attrs [in] Handle of attributes list
* @param attr_name [in] Name of attribute
- * @param data [out] data pointer to set
+ * @param data [out] Data pointer to set
*
* @return This function returns user defined value on success, or NULL
* on failure
/**
* This function is to retrieve type of attribute.
*
- * @param attrs [in] List of attributes
- * @param index [in] Index of attribute
- * @param attrtype [out] On return contains type of attribute
+ * @param attrs [in] List of attributes
+ * @param index [in] Index of attribute
+ * @param attrtype [out] Type of attribute
*
* @return This function returns MM_ERROR_NONE.
* @see MMAttrsType
/**
* This function is to get flags of attribute with given index.
*
- * @param attrs [in] List of attributes
- * @param index [in] Index of attribute
- * @param flags [out] On return contains flags of attribute.
+ * @param attrs [in] List of attributes
+ * @param index [in] Index of attribute
+ * @param flags [out] Flags of attribute
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
* @see MMAttrsFlag
/**
* This function is to get valid value type of attribute with given index.
*
- * @param attrs [in] List of attributes
- * @param index [in] Index of attribute
- * @param type [out] On return contains valid value type of attribute
+ * @param attrs [in] List of attributes
+ * @param index [in] Index of attribute
+ * @param type [out] Valid value type of attribute
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
* @see MMAttrsType
*/
-int mm_attrs_get_valid_type(MMHandleType attrs, int index, int *type);
+int mm_attrs_get_valid_type(MMHandleType attrs, int index, MMAttrsValidType *type);
/**
* This function is to get valid range of attribute with given index.
*
- * @param attrs [in] List of attributes
- * @param index [in] Index of attribute
- * @param min [out] minimum value of the valid range
- * @param max [out] maximum value of the valid range
+ * @param attrs [in] List of attributes
+ * @param index [in] Index of attribute
+ * @param min [out] Minimum value of the valid range
+ * @param max [out] Maximum value of the valid range
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
*/
/**
* This function is to get valid array of attribute with given index.
*
- * @param attrs [in] list of attributes
- * @param index [in] Index of attribute
- * @param count [out] number of array
- * @param array [out] on return contains valid array of attribute
+ * @param attrs [in] List of attributes
+ * @param index [in] Index of attribute
+ * @param count [out] The number of array
+ * @param array [out] Valid array of attribute
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
*/
/**
* This function is to set integer value to attribute with given index.
*
- * @param attrs [in] List of attributes
- * @param index [in] Index of attribute
- * @param val [in] integer value to set
+ * @param attrs [in] List of attributes
+ * @param index [in] Index of attribute
+ * @param val [in] Integer value to set
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
* @see mm_attrs_get_int
/**
* This function is to get integer value to attribute with given index.
*
- * @param attrs [in] List of attributes
- * @param index [in] Index of attribute
- * @param val [out] On return contains integer value of attribute
+ * @param attrs [in] List of attributes
+ * @param index [in] Index of attribute
+ * @param val [out] Integer value of attribute
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
* @remarks If type of attributes is not an integer type, the value which is returned by this function is meaningless.
*
* @param attrs [in] List of attributes
* @param index [in] Index of attribute
- * @param attrval [out] On return contains double value of attribute on success, or invalid value.
+ * @param attrval [out] Double value of attribute on success, or invalid value
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
* @see mm_attrs_set_double
/**
* This function is to set string to attribute with given index.
*
- * @param attrs [in] List of attributes
- * @param index [in] Index of attribute
- * @param string [in] String to set
- * @param size [in] length of string to set
+ * @param attrs [in] Handle of attributes list
+ * @param index [in] Index of attribute
+ * @param string [in] String to set
+ * @param size [in] Length of string to set
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
* @see mm_attrs_get_string
/**
* This function is to get string to attribute with given index.
*
- * @param attrs [in] List of attributes
- * @param index [in] Index of attribute
- * @param sval [in] Placeholder to output string buffer
- * @param size [in] The field contains number of characters filled in the buffer
+ * @param attrs [in] Handle of attributes list
+ * @param index [in] Index of attribute
+ * @param sval [in] Placeholder to output string buffer
+ * @param size [in] The field contains number of characters filled in the buffer
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
* @remarks Application would be responsible for managing/releasing the string
/**
* This function is to set pointer to attribute with given index.
*
- * @param attrs [in] List of attributes
- * @param index [in] Index of attribute
- * @param data [in] data to set
- * @param size [in] Length of input data
- * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
+ * @param attrs [in] Handle of attributes list
+ * @param index [in] Index of attribute
+ * @param data [in] Data to set
+ * @param size [in] Length of input data
*
+ * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
* @remarks Data type is the reference to memory which is allocated by user. The allocated memory must be freed by user.
* @see mm_attrs_get_data
*/
int mm_attrs_set_data(MMHandleType attrs, int index, void *data, int size);
+
/**
* This function is to get pointer to attribute with given index.
*
- * @param attrs [in] List of attributes
- * @param index [in] Index of attribute
- * @param data [out] Placeholder to output data buffer
- * @param size [out] The field contains number of bytes filled in the buffer
+ * @param attrs [in] Handle of attributes list
+ * @param index [in] Index of attribute
+ * @param data [out] Placeholder to output data buffer
+ * @param size [out] The field contains number of bytes filled in the buffer
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
* @remarks Application would be responsible for managing/releasing data
/**
* A function to get information of the attribute
*
- * @param attrs [in] List of attributes
+ * @param attrs [in] Handle of attributes list
* @param index [in] Index of attribute
* @param info [out] Information of the attribute
*
/**
* This function is to get array of attribute with given name.
*
- * @param attrs [in] List of attributes
+ * @param attrs [in] Handle of attributes list
* @param attr_name [in] Name of attribute
* @param info [out] Information of the attribute
*
*/
int mm_attrs_get_info_by_name(MMHandleType attrs, const char *attr_name, MMAttrsInfo *info);
+
/**
* Sets properties on an object.
*
- * @param attrs [in] List of attributes
- * @param err_attr_name [out] the name of attributes that occurs error. Free this variable after use.
- * @param attribute_name [in] name of the first property to set
- * @param ... [in] value for the first property, followed optionally by more
+ * @param attrs [in] Handle of attributes list
+ * @param err_attr_name [out] Name of attributes that occurs error. Free this variable after use
+ * @param attribute_name [in] Name of the first property to set
+ * @param ... [in] Value for the first property, followed optionally by more
* name/value pairs, followed by %NULL
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
/**
* Gets properties on an object.
*
- * @param attrs [in] List of attributes
- * @param err_attr_name [out] the name of attributes that occurs error. Free this variable after use.
- * @param attribute_name [in] name of the first property to set
- * @param ... [in] value for the first property, followed optionally by more
+ * @param attrs [in] Handle of attributes list
+ * @param err_attr_name [out] Name of attributes that occurs error. Free this variable after use
+ * @param attribute_name [in] Name of the first property to set
+ * @param ... [in] Value for the first property, followed optionally by more
* name/value pairs, followed by %NULL
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
/**
* Sets properties on an object with va_list param.
*
- * @param attrs [in] List of attributes
- * @param err_attr_name [out] the name of attributes that occurs error. Free this variable after use.
- * @param attribute_name [in] name of the first property to set
- * @param var_args [in] variable arguments
+ * @param attrs [in] Handle of attributes list
+ * @param err_attr_name [out] Name of attributes that occurs error. Free this variable after use
+ * @param attribute_name [in] Name of the first property to set
+ * @param var_args [in] Variable arguments
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
* @remarks Multiple setter of attribute
/**
* Gets properties on an object with va_list param.
*
- * @param attrs [in] List of attributes
- * @param err_attr_name [out] the name of attributes that occurs error. Free this variable after use.
- * @param attribute_name [in] name of the first property to set
- * @param var_args [in] variable arguments
+ * @param attrs [in] Handle of attributes list
+ * @param err_attr_name [out] Name of attributes that occurs error. Free this variable after use
+ * @param attribute_name [in] Name of the first property to set
+ * @param var_args [in] Variable arguments
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
* @remarks Multiple setter of attribute
*/
int mm_attrs_get_valist(MMHandleType attrs, char **err_attr_name, const char *attribute_name, va_list var_args);
+
+/**
+ * This function is to set the valid attribute type.
+ *
+ * @param attrs [in] Handle of attributes list
+ * @param index [in] Index of attribute
+ * @param type [in] Type of attribute
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_set_valid_type(MMHandleType attrs, int index, MMAttrsValidType type);
+
+
+/**
+ * This function is to set the valid integer range to the attribute.
+ *
+ * @param attrs [in] Handle of attributes list
+ * @param index [in] Index of attribute
+ * @param min [in] Minimum value of the valid range
+ * @param max [in] Maximum value of the valid range
+ * @param dval [in] Default value
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_set_valid_range(MMHandleType attrs, int index, int min, int max, int dval);
+
+
+/**
+ * This function is to set the valid integer array to the attribute.
+ *
+ * @param attrs [in] Handle of attributes list
+ * @param index [in] Index of attribute
+ * @param array [in] Array contains integer values to set
+ * @param count [in] The number of items in array
+ * @param dval [in] Default value
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_set_valid_array(MMHandleType attrs, int index, const int *array, int count, int dval);
+
+
+/**
+ * This function is to set the valid double range to the attribute.
+ *
+ * @param attrs [in] Handle of attributes list
+ * @param index [in] Index of attribute
+ * @param min [in] Minimum value of the valid range
+ * @param max [in] Maximum value of the valid range
+ * @param dval [in] Default value
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_set_valid_double_range(MMHandleType attrs, int index, double min, double max, double dval);
+
+
+/**
+ * This function is to set the valid double array to the attribute.
+ *
+ * @param attrs [in] Handle of attributes list
+ * @param index [in] Index of attribute
+ * @param array [in] Array contains double values to set
+ * @param count [in] The number of items in array
+ * @param dval [in] Default value
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_set_valid_double_array(MMHandleType attrs, int index, const double *array, int count, double dval);
+
+
+/**
+ * This function is to check whether the attribute is modified
+ *
+ * @param attrs [in] Handle of attributes list
+ * @param index [in] Index of attribute
+ * @param modified [out] Modified or not (true = modified, false = not modified)
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_is_modified(MMHandleType attrs, int index, bool *modified);
+
+
+/**
+ * This function is to set the attribute to modified
+ *
+ * @param attrs [in] Handle of attributes list
+ * @param index [in] Index of attribute
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_set_modified(MMHandleType attrs, int index);
+
+
+/**
+ * This function is to set the attribute to read-only
+ *
+ * @param attrs [in] Handle of attributes list
+ * @param index [in] Index of attribute
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_set_readonly(MMHandleType attrs, int index);
+
+
+/**
+ * This function is to set the attribute to disabled
+ *
+ * @param attrs [in] Handle of attributes list
+ * @param index [in] Index of attribute
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_set_disabled(MMHandleType attrs, int index);
+
+
+
/**
* @}
*/
void *default_value;
};
-int mmf_value_init(mmf_value_t *value, int type);
+int mmf_value_init(mmf_value_t *v, int type);
int mmf_value_copy(mmf_value_t *dest, const mmf_value_t *src);
int mmf_attribute_set_data(mmf_attribute_t *item, void *data, int size);
-/* --- Create, Destroy and Initialize MmfAttrs --- */
-
MMHandleType mmf_attrs_new(int count);
+int mmf_attrs_init(MMHandleType h, mmf_attrs_construct_info_t *info, int count);
+
+int mmf_attrs_commit_err(MMHandleType h, char **err_attr_name);
+
+/* Functions that will be moved to mm_attrs.h */
+
MMHandleType mmf_attrs_new_from_data(const char *name,
mmf_attrs_construct_info_t *info,
int count,
mmf_attrs_commit_func_t commit_func,
void *commit_param);
-void mmf_attrs_free(MMHandleType attrs);
-
-int mmf_attrs_init(MMHandleType h, mmf_attrs_construct_info_t *info, int count);
+void mmf_attrs_free(MMHandleType h);
int mmf_attrs_commit(MMHandleType h);
-int mmf_attrs_commit_err(MMHandleType h, char **err_attr_name);
-
int mmf_attrs_set_valid_type(MMHandleType h, int idx, int v_type);
int mmf_attrs_set_valid_range(MMHandleType h, int idx, int min, int max, int dval);
/*
MM_ERROR_COMMON_CLASS
*/
-#define MM_ERROR_COMMON_INVALID_ARGUMENT (MM_ERROR_COMMON_CLASS | 1) /**< Invalid argument */
-#define MM_ERROR_COMMON_NO_FREE_SPACE (MM_ERROR_COMMON_CLASS | 2) /**< Out of storage */
-#define MM_ERROR_COMMON_OUT_OF_MEMORY (MM_ERROR_COMMON_CLASS | 3) /**< Out of memory */
-#define MM_ERROR_COMMON_UNKNOWN (MM_ERROR_COMMON_CLASS | 4) /**< Unknown error */
-#define MM_ERROR_COMMON_INVALID_ATTRTYPE (MM_ERROR_COMMON_CLASS | 5) /**< Invalid argument */
-#define MM_ERROR_COMMON_INVALID_PERMISSION (MM_ERROR_COMMON_CLASS | 6) /**< Invalid permission */
-#define MM_ERROR_COMMON_OUT_OF_ARRAY (MM_ERROR_COMMON_CLASS | 7) /**< Out of array */
-#define MM_ERROR_COMMON_OUT_OF_RANGE (MM_ERROR_COMMON_CLASS | 8) /**< Out of value range*/
-#define MM_ERROR_COMMON_ATTR_NOT_EXIST (MM_ERROR_COMMON_CLASS | 9) /**< Attribute doesn't exist. */
+#define MM_ERROR_COMMON_INVALID_ARGUMENT (MM_ERROR_COMMON_CLASS | 0x01) /**< Invalid argument */
+#define MM_ERROR_COMMON_NO_FREE_SPACE (MM_ERROR_COMMON_CLASS | 0x02) /**< Out of storage */
+#define MM_ERROR_COMMON_OUT_OF_MEMORY (MM_ERROR_COMMON_CLASS | 0x03) /**< Out of memory */
+#define MM_ERROR_COMMON_UNKNOWN (MM_ERROR_COMMON_CLASS | 0x04) /**< Unknown error */
+#define MM_ERROR_COMMON_INVALID_ATTRTYPE (MM_ERROR_COMMON_CLASS | 0x05) /**< Invalid argument */
+#define MM_ERROR_COMMON_INVALID_PERMISSION (MM_ERROR_COMMON_CLASS | 0x06) /**< Invalid permission */
+#define MM_ERROR_COMMON_OUT_OF_ARRAY (MM_ERROR_COMMON_CLASS | 0x07) /**< Out of array */
+#define MM_ERROR_COMMON_OUT_OF_RANGE (MM_ERROR_COMMON_CLASS | 0x08) /**< Out of value range*/
+#define MM_ERROR_COMMON_ATTR_NOT_EXIST (MM_ERROR_COMMON_CLASS | 0x09) /**< Attribute doesn't exist. */
+#define MM_ERROR_COMMON_INTERNAL (MM_ERROR_COMMON_CLASS | 0x0a) /**< Internal errors */
/*
* MM_ERROR_SOUND_CLASS
*
*/
-
-
#include <stdio.h>
#include <stdbool.h>
#include <malloc.h>
#include "mm_attrs_private.h"
#include "mm_error.h"
+int mm_attrs_new(MMAttrsConstructInfo *info, int count, const char *name,
+ mm_attrs_commit_callback callback, void *user_param, MMHandleType *attrs)
+{
+ MMHandleType _attrs;
+
+ return_val_if_fail(attrs, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
+ _attrs = mmf_attrs_new_from_data(name, (mmf_attrs_construct_info_t *) info, count, (mmf_attrs_commit_func_t) callback, user_param);
+ if (!_attrs)
+ return MM_ERROR_COMMON_INTERNAL;
+
+ *attrs = _attrs;
+
+ return MM_ERROR_NONE;
+}
+
+
+void mm_attrs_free(MMHandleType attrs)
+{
+ mmf_attrs_free(attrs);
+}
+
+
+int mm_attrs_commit_all(MMHandleType attrs)
+{
+ return mmf_attrs_commit(attrs);
+}
+
+int mm_attrs_commit(MMHandleType attrs, int index)
+{
+ mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+ mmf_attribute_t *item;
+
+ return_val_if_fail(attrs, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ return_val_if_fail(index >= 0, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
+ item = &h->items[index];
+
+ MM_ATTR_ITEM_WRITE_LOCK(item);
+
+ mmf_attribute_commit(item);
+
+ MM_ATTR_ITEM_WRITE_UNLOCK(item);
+
+ return MM_ERROR_NONE;
+}
+
int mm_attrs_get_type(MMHandleType attrs, int index, MMAttrsType *attrtype)
{
mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+
return_val_if_fail(h && index >= 0 && index < h->count && attrtype, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
*attrtype = h->items[index].value.type;
return MM_ERROR_NONE;
}
int mm_attrs_get_flags(MMHandleType attrs, int index, int *flags)
{
mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+
return_val_if_fail(h && index >= 0 && index < h->count && flags, MM_ERROR_COMMON_INVALID_ARGUMENT);
*flags = h->items[index].flags;
}
-int mm_attrs_get_valid_type(MMHandleType attrs, int index, int *type)
+int mm_attrs_get_valid_type(MMHandleType attrs, int index, MMAttrsValidType *type)
{
mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+
return_val_if_fail(h && index >= 0 && index < h->count && type, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
*type = h->items[index].value_spec.type;
return MM_ERROR_NONE;
}
int mm_attrs_get_valid_range(MMHandleType attrs, int index, int *min, int *max)
{
mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+
return_val_if_fail(h && index >= 0 && index < h->count && min && max, MM_ERROR_COMMON_INVALID_ARGUMENT);
if (min) {
int mm_attrs_get_valid_array(MMHandleType attrs, int index, int *count, int **array)
{
mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+
if (count)
*count = 0;
+
return_val_if_fail(h && count && index >= 0 && index < h->count && array, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
if (count)
*count = h->items[index].value_spec.spec.int_spec.array.count;
*array = h->items[index].value_spec.spec.int_spec.array.array;
int mm_attrs_get_size(MMHandleType attrs, int *size)
{
mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+
return_val_if_fail(h && size, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
*size = h->count;
return MM_ERROR_NONE;
}
int mm_attrs_get_name(MMHandleType attrs, int index, char **name)
{
mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+
return_val_if_fail(h && index >= 0 && index < h->count && name, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
*name = h->items[index].name;
return MM_ERROR_NONE;
}
int mm_attrs_set_int(MMHandleType attrs, int index, int val)
{
mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+ mmf_attribute_t *item;
+
return_val_if_fail(h && index >= 0 && index < h->count, MM_ERROR_COMMON_INVALID_ARGUMENT);
- mmf_attribute_t *item = &h->items[index];
+ item = &h->items[index];
return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT);
if (!mmf_attribute_check_flags(item, MM_ATTRS_FLAG_WRITABLE)) {
int mm_attrs_get_int(MMHandleType attrs, int index, int *val)
{
mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+ mmf_attribute_t *item;
+
return_val_if_fail(h && index >= 0 && index < h->count && val, MM_ERROR_COMMON_INVALID_ARGUMENT);
- mmf_attribute_t *item = &h->items[index];
+
+ item = &h->items[index];
return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT);
if (mmf_attribute_check_flags(item, MM_ATTRS_FLAG_READABLE)) {
int mm_attrs_set_double(MMHandleType attrs, int index, double val)
{
mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+ mmf_attribute_t *item;
+
return_val_if_fail(h && index >= 0 && index < h->count, MM_ERROR_COMMON_INVALID_ARGUMENT);
- mmf_attribute_t *item = &h->items[index];
+ item = &h->items[index];
return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT);
if (!mmf_attribute_check_flags(item, MM_ATTRS_FLAG_WRITABLE))
int mm_attrs_get_double(MMHandleType attrs, int index, double *val)
{
mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+ mmf_attribute_t *item;
+
return_val_if_fail(h && index >= 0 && index < h->count && val, MM_ERROR_COMMON_INVALID_ARGUMENT);
- mmf_attribute_t *item = &h->items[index];
+
+ item = &h->items[index];
return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT);
if (mmf_attribute_check_flags(item, MM_ATTRS_FLAG_READABLE)) {
int mm_attrs_set_string(MMHandleType attrs, int index, const char *string, int size)
{
mmf_attrs_t *h = (mmf_attrs_t *) attrs;
- return_val_if_fail(h && index >= 0 && index < h->count, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ mmf_attribute_t *item;
- mmf_attribute_t *item = &h->items[index];
+ return_val_if_fail(h && index >= 0 && index < h->count, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ item = &h->items[index];
return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT);
MM_ATTR_ITEM_WRITE_LOCK(item);
int mm_attrs_get_string(MMHandleType attrs, int index, char **sval, int *size)
{
mmf_attrs_t *h = (mmf_attrs_t *) attrs;
- mmf_attribute_t *item = NULL;
+ mmf_attribute_t *item;
+
return_val_if_fail(h && index >= 0 && index < h->count && sval, MM_ERROR_COMMON_INVALID_ARGUMENT);
item = &h->items[index];
int mm_attrs_set_data(MMHandleType attrs, int index, void *data, int size)
{
mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+ mmf_attribute_t *item;
+
return_val_if_fail(h && index >= 0 && index < h->count, MM_ERROR_COMMON_INVALID_ARGUMENT);
- mmf_attribute_t *item = &h->items[index];
+ item = &h->items[index];
return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT);
if (mmf_attribute_check_flags(item, MM_ATTRS_FLAG_WRITABLE)) {
int mm_attrs_get_data(MMHandleType attrs, int index, void **data, int *size)
{
mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+
return_val_if_fail(h && index >= 0 && index < h->count && data, MM_ERROR_COMMON_INVALID_ARGUMENT);
if (!(h->items[index].flags & MM_ATTRS_FLAG_READABLE)) {
int mm_attrs_set_int_by_name(MMHandleType attrs, const char *name, int val)
{
- return_val_if_fail(attrs && name, -1);
int index = 0;
+
+ return_val_if_fail(attrs && name, -1);
+
mm_attrs_get_index(attrs, name, &index);
if (index >= 0) {
return mm_attrs_set_int(attrs, index, val);
int mm_attrs_get_int_by_name(MMHandleType attrs, const char *name, int *val)
{
int index = -1;
+
return_val_if_fail(attrs && name && val, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
mm_attrs_get_index(attrs, name, &index);
if (index >= 0) {
return mm_attrs_get_int(attrs, index, val);
int mm_attrs_set_string_by_name(MMHandleType attrs, const char *name, const char *string)
{
- return_val_if_fail(attrs && name, -1);
-
int size;
int index = 0;
+
+ return_val_if_fail(attrs && name, -1);
+
mm_attrs_get_index(attrs, name, &index);
if (index >= 0) {
if (string) {
{
int index = -1;
int len = 0;
+
return_val_if_fail(attrs && name && string, MM_ERROR_COMMON_INVALID_ARGUMENT);
mm_attrs_get_index(attrs, name, &index);
int mm_attrs_set_data_by_name(MMHandleType attrs, const char *name, void *data, int size)
{
- return_val_if_fail(attrs && name, -1);
int index = 0;
- mm_attrs_get_index(attrs, name, &index);
+ return_val_if_fail(attrs && name, -1);
+
+ mm_attrs_get_index(attrs, name, &index);
if (index >= 0) {
return mm_attrs_set_data(attrs, index, data, size);
}
int mm_attrs_set_double_by_name(MMHandleType attrs, const char *name, double val)
{
int index = -1;
+
return_val_if_fail(attrs && name, MM_ERROR_COMMON_INVALID_ARGUMENT);
mm_attrs_get_index(attrs, name, &index);
int mm_attrs_get_double_by_name(MMHandleType attrs, const char *name, double *val)
{
int index = -1;
+
return_val_if_fail(attrs && name && val, MM_ERROR_COMMON_INVALID_ARGUMENT);
mm_attrs_get_index(attrs, name, &index);
return ret;
}
+
+
+int mm_attrs_set_valid_type(MMHandleType attrs, int index, MMAttrsValidType type)
+{
+ return_val_if_fail(type > MM_ATTRS_VALID_TYPE_INVALID, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ return_val_if_fail(type <= MM_ATTRS_VALID_TYPE_DOUBLE_RANGE, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
+ return mmf_attrs_set_valid_type(attrs, index, (int)type);
+}
+
+
+int mm_attrs_set_valid_range(MMHandleType attrs, int index, int min, int max, int dval)
+{
+ return mmf_attrs_set_valid_range(attrs, index, min, max, dval);
+}
+
+
+int mm_attrs_set_valid_array(MMHandleType attrs, int index, const int *array, int count, int dval)
+{
+ return mmf_attrs_set_valid_array(attrs, index, array, count, dval);
+}
+
+
+int mm_attrs_set_valid_double_range(MMHandleType attrs, int index, double min, double max, double dval)
+{
+ return mmf_attrs_set_valid_double_range(attrs, index, min, max, dval);
+}
+
+
+int mm_attrs_set_valid_double_array(MMHandleType attrs, int index, const double *array, int count, double dval)
+{
+ return mmf_attrs_set_valid_double_array(attrs, index, array, count, dval);
+}
+
+
+int mm_attrs_is_modified(MMHandleType attrs, int index, bool *modified)
+{
+ mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+ mmf_attribute_t *item;
+
+ return_val_if_fail(attrs, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ return_val_if_fail(index >= 0, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
+ item = &h->items[index];
+
+ MM_ATTR_ITEM_WRITE_LOCK(item);
+
+ *modified = mmf_attribute_is_modified(item);
+
+ MM_ATTR_ITEM_WRITE_UNLOCK(item);
+
+ return MM_ERROR_NONE;
+}
+
+
+int mm_attrs_set_modified(MMHandleType attrs, int index)
+{
+ mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+ mmf_attribute_t *item;
+
+ return_val_if_fail(attrs, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ return_val_if_fail(index >= 0, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
+ item = &h->items[index];
+
+ MM_ATTR_ITEM_WRITE_LOCK(item);
+
+ mmf_attribute_set_modified(item);
+
+ MM_ATTR_ITEM_WRITE_UNLOCK(item);
+
+ return MM_ERROR_NONE;
+}
+
+
+int mm_attrs_set_readonly(MMHandleType attrs, int index)
+{
+ mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+ mmf_attribute_t *item;
+
+ return_val_if_fail(attrs, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ return_val_if_fail(index >= 0, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
+ item = &h->items[index];
+
+ MM_ATTR_ITEM_WRITE_LOCK(item);
+
+ mmf_attribute_set_readonly(item);
+
+ MM_ATTR_ITEM_WRITE_UNLOCK(item);
+
+ return MM_ERROR_NONE;
+}
+
+
+int mm_attrs_set_disabled(MMHandleType attrs, int index)
+{
+ mmf_attrs_t *h = (mmf_attrs_t *) attrs;
+ mmf_attribute_t *item;
+
+ return_val_if_fail(attrs, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ return_val_if_fail(index >= 0, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
+ item = &h->items[index];
+
+ MM_ATTR_ITEM_WRITE_LOCK(item);
+
+ mmf_attribute_set_disabled(item);
+
+ MM_ATTR_ITEM_WRITE_UNLOCK(item);
+
+ return MM_ERROR_NONE;
+}
#include "mm_debug.h"
#include "mm_attrs_private.h"
-int mmf_value_init(mmf_value_t *value, int type)
+int mmf_value_init(mmf_value_t *v, int type)
{
- return_val_if_fail(value, -1);
+ return_val_if_fail(v, -1);
return_val_if_fail(MMF_IS_VALUE_TYPE(type), -1);
- memset(value, 0, sizeof(*value));
- value->type = type;
+
+ memset(v, 0, sizeof(*v));
+ v->type = type;
return 0;
}
int mmf_value_copy(mmf_value_t *dest, const mmf_value_t *src)
{
return_val_if_fail(dest && src && src->type == dest->type, -1);
+
switch (src->type) {
case MM_ATTRS_TYPE_INT:
dest->value.i_val = src->value.i_val;
int mmf_value_set_int(mmf_value_t *v, int ival)
{
return_val_if_fail(v && v->type == MMF_VALUE_TYPE_INT, -1);
+
v->value.i_val = ival;
return 0;
}
int mmf_value_get_int(const mmf_value_t *v)
{
return_val_if_fail(v && v->type == MMF_VALUE_TYPE_INT, -1);
+
return v->value.i_val;
}
int mmf_value_set_double(mmf_value_t *v, double dval)
{
return_val_if_fail(v && v->type == MMF_VALUE_TYPE_DOUBLE, -1);
+
v->value.d_val = dval;
return 0;
}
double mmf_value_get_double(mmf_value_t *v)
{
return_val_if_fail(v->type == MMF_VALUE_TYPE_DOUBLE, -1);
+
return v->value.d_val;
}
int mmf_value_set_string(mmf_value_t *v, const char *sval, int size)
{
return_val_if_fail(v && v->type == MMF_VALUE_TYPE_STRING, -1);
+
if (v->value.s_val != NULL) {
free(v->value.s_val);
v->value.s_val = NULL;
char* mmf_value_get_string(const mmf_value_t *v, int *size)
{
return_val_if_fail(v && v->type == MMF_VALUE_TYPE_STRING, NULL);
+
*size = v->size;
return v->value.s_val;
}
int mmf_value_set_data(mmf_value_t *v, void *data, int size)
{
return_val_if_fail(v && v->type == MMF_VALUE_TYPE_DATA, -1);
+
v->value.p_val = data;
v->size = size;
return 0;
void* mmf_value_get_data(const mmf_value_t *v, int *size)
{
return_val_if_fail(v && v->type == MMF_VALUE_TYPE_DATA, NULL);
+
*size = v->size;
return v->value.p_val;
}
-void mmf_value_dump(const mmf_value_t *value)
+void mmf_value_dump(const mmf_value_t *v)
{
- return_if_fail(value);
- switch (value->type) {
+ return_if_fail(v);
+
+ switch (v->type) {
case MMF_VALUE_TYPE_INT:
- //mmf_debug(MMF_DEBUG_LOG, "value[int]: %d\n", value->value.i_val);
+ //mmf_debug(MMF_DEBUG_LOG, "value[int]: %d\n", v->value.i_val);
break;
case MMF_VALUE_TYPE_DOUBLE:
- //mmf_debug(MMF_DEBUG_LOG, "value[double]: %f\n", value->value.d_val);
+ //mmf_debug(MMF_DEBUG_LOG, "value[double]: %f\n", v->value.d_val);
break;
case MMF_VALUE_TYPE_STRING:
- //mmf_debug(MMF_DEBUG_LOG, "value[string]: %s\n", value->value.s_val);
+ //mmf_debug(MMF_DEBUG_LOG, "value[string]: %s\n", v->value.s_val);
break;
case MMF_VALUE_TYPE_DATA:
- //mmf_debug(MMF_DEBUG_LOG, "value[data]: %p\n", value->value.p_val);
+ //mmf_debug(MMF_DEBUG_LOG, "value[data]: %p\n", v->value.p_val);
break;
default:
//mmf_debug(MMF_DEBUG_LOG, "value invalid!!\n");
}
}
-int mmf_value_clear(mmf_value_t *value)
+int mmf_value_clear(mmf_value_t *v)
{
- return_val_if_fail(value, -1);
- if (value->type == MMF_VALUE_TYPE_STRING) {
- if (value->value.s_val) {
- free(value->value.s_val);
- value->value.s_val = NULL;
- value->size = 0;
+ return_val_if_fail(v, -1);
+
+ if (v->type == MMF_VALUE_TYPE_STRING) {
+ if (v->value.s_val) {
+ free(v->value.s_val);
+ v->value.s_val = NULL;
+ v->size = 0;
}
}
return 0;
int mmf_value_spec_init(mmf_value_spec_t *vs, int vs_type)
{
return_val_if_fail(vs, -1);
+
memset(vs, 0, sizeof(*vs));
vs->type = vs_type;
return 0;
int mmf_value_spec_clear(mmf_value_spec_t *vs)
{
return_val_if_fail(vs, -1);
+
switch (vs->type) {
case MMF_VALUE_SPEC_INT_ARRAY:
if (vs->spec.int_spec.array.array) {
bool mmf_attribute_check_flags(mmf_attribute_t *item, int flags)
{
return_val_if_fail(item, false);
+
return item->flags & flags;
}
bool mmf_attribute_validate_int(mmf_attribute_t *item, int val)
{
- return_val_if_fail(item, false);
- return_val_if_fail(item->value.type == MMF_VALUE_TYPE_INT, false);
-
bool valid = true;
int i = 0;
+ return_val_if_fail(item, false);
+ return_val_if_fail(item->value.type == MMF_VALUE_TYPE_INT, false);
+
switch (item->value_spec.type) {
case MMF_VALUE_SPEC_INT_RANGE:
if (val < item->value_spec.spec.int_spec.range.min ||
bool mmf_attribute_validate_double(mmf_attribute_t *item, double val)
{
- return_val_if_fail(item, false);
- return_val_if_fail(item->value.type == MMF_VALUE_TYPE_DOUBLE, false);
-
bool valid = true;
int i = 0;
+ return_val_if_fail(item, false);
+ return_val_if_fail(item->value.type == MMF_VALUE_TYPE_DOUBLE, false);
+
switch (item->value_spec.type) {
case MMF_VALUE_SPEC_DOUBLE_RANGE:
if (val < item->value_spec.spec.double_spec.range.min ||
void mmf_attribute_clear(mmf_attribute_t *item)
{
assert(item);
+
if (item->name) {
free(item->name);
item->name = NULL;
bool mmf_attribute_is_modified(mmf_attribute_t *item)
{
return_val_if_fail(item, false);
+
return (item->flags & MM_ATTRS_FLAG_MODIFIED);
}
void mmf_attribute_set_modified(mmf_attribute_t *item)
{
return_if_fail(item);
+
if (!(item->flags & MM_ATTRS_FLAG_MODIFIED)) {
mmf_value_copy(&item->tmpval, &item->value);
item->flags |= MM_ATTRS_FLAG_MODIFIED;
void mmf_attribute_set_readonly(mmf_attribute_t *item)
{
return_if_fail(item);
+
if (item->flags & MM_ATTRS_FLAG_WRITABLE)
item->flags -= MM_ATTRS_FLAG_WRITABLE;
}
void mmf_attribute_set_disabled(mmf_attribute_t *item)
{
return_if_fail(item);
+
if (item->flags & MM_ATTRS_FLAG_WRITABLE)
item->flags -= MM_ATTRS_FLAG_WRITABLE;
if (item->flags & MM_ATTRS_FLAG_READABLE)
void mmf_attribute_commit(mmf_attribute_t *item)
{
return_if_fail(item);
+
if (item->flags & MM_ATTRS_FLAG_MODIFIED) {
mmf_value_copy(&item->value, &item->tmpval);
mmf_value_clear(&item->tmpval);
int mmf_attribute_set_int(mmf_attribute_t *item, int val)
{
return_val_if_fail(item, -1);
+
if (mmf_value_set_int(&item->tmpval, val) == 0) {
item->flags |= MM_ATTRS_FLAG_MODIFIED;
return 0;
int mmf_attribute_set_double(mmf_attribute_t *item, double val)
{
return_val_if_fail(item, -1);
+
if (mmf_value_set_double(&item->tmpval, val) == 0) {
item->flags |= MM_ATTRS_FLAG_MODIFIED;
return 0;
MMHandleType mmf_attrs_new(int count)
{
- return_val_if_fail(count > 0, 0);
mmf_attrs_t *attrs;
- attrs = (mmf_attrs_t *) malloc(sizeof(mmf_attrs_t));
+ return_val_if_fail(count > 0, 0);
+
+ attrs = (mmf_attrs_t *) malloc(sizeof(mmf_attrs_t));
if (attrs == NULL) {
debug_error("malloc failed");
return 0;
mmf_attrs_commit_func_t commit_func,
void *commit_param)
{
- return_val_if_fail(info && count > 0, 0);
MMHandleType h;
mmf_attrs_t *attrs;
+ return_val_if_fail(info && count > 0, NULL);
+
h = mmf_attrs_new(count);
if (!h) {
- return 0;
+ return NULL;
}
mmf_attrs_init(h, info, count);
attrs = (mmf_attrs_t *) h;
void mmf_attrs_free(MMHandleType h)
{
- return_if_fail(h);
mmf_attrs_t *attrs = (mmf_attrs_t *) h;
- if (attrs) {
- if (attrs->name) {
- free(attrs->name);
- attrs->name = NULL;
- }
- if (attrs->items) {
- int i;
- for (i = 0; i < attrs->count; i++) {
- mmf_attribute_clear(&attrs->items[i]);
- }
- free(attrs->items);
- attrs->items = NULL;
+
+ return_if_fail(h);
+
+ if (attrs->name) {
+ free(attrs->name);
+ attrs->name = NULL;
+ }
+
+ if (attrs->items) {
+ int i;
+ for (i = 0; i < attrs->count; i++) {
+ mmf_attribute_clear(&attrs->items[i]);
}
- free(attrs);
+ free(attrs->items);
+ attrs->items = NULL;
}
+
+ free(attrs);
}
int mmf_attrs_init(MMHandleType h, mmf_attrs_construct_info_t *info, int count)
{
- return_val_if_fail(h && info && count > 0, -1);
mmf_attrs_t *attrs = (mmf_attrs_t *) h;
mmf_attribute_t *item = NULL;
int i;
int size = 0;
+ return_val_if_fail(h && info && count > 0, -1);
+
for (i = 0; i < count; i++) {
item = &attrs->items[i];
int mmf_attrs_commit(MMHandleType h)
{
- return_val_if_fail(h, -1);
-
mmf_attrs_t *attrs = (mmf_attrs_t *)h;
mmf_attribute_t *item = NULL;
int i;
int ret = 0;
+ return_val_if_fail(h, -1);
+
for (i = 0; i < attrs->count; ++i) {
item = &attrs->items[i];
int mmf_attrs_set_valid_type(MMHandleType h, int idx, int v_type)
{
+ mmf_attrs_t *attrs = (mmf_attrs_t *) h;
+
return_val_if_fail(h, -1);
return_val_if_fail(idx >= 0, -1);
- mmf_attrs_t *attrs = (mmf_attrs_t *) h;
+
return mmf_value_spec_init(&attrs->items[idx].value_spec, v_type);
}
int mmf_attrs_set_valid_range(MMHandleType h, int idx, int min, int max, int dval)
{
+ mmf_attrs_t *attrs = (mmf_attrs_t *) h;
+
return_val_if_fail(h, -1);
return_val_if_fail(idx >= 0, -1);
- mmf_attrs_t *attrs = (mmf_attrs_t *) h;
+
mmf_value_spec_clear(&attrs->items[idx].value_spec);
assert(attrs->items[idx].value_spec.type == MMF_VALUE_SPEC_INT_RANGE);
return mmf_value_spec_set_int_range(&attrs->items[idx].value_spec, min, max, dval);
int mmf_attrs_set_valid_array(MMHandleType h, int idx, const int *array, int count, int dval)
{
+ mmf_attrs_t *attrs = (mmf_attrs_t *) h;
+
return_val_if_fail(h, -1);
return_val_if_fail(idx >= 0, -1);
- mmf_attrs_t *attrs = (mmf_attrs_t *) h;
+
mmf_value_spec_clear(&attrs->items[idx].value_spec);
assert(attrs->items[idx].value_spec.type == MMF_VALUE_SPEC_INT_ARRAY);
return mmf_value_spec_set_int_array(&attrs->items[idx].value_spec, array, count, dval);
int mmf_attrs_set_valid_double_range(MMHandleType h, int idx, double min, double max, double dval)
{
+ mmf_attrs_t *attrs = (mmf_attrs_t *) h;
+
return_val_if_fail(h, -1);
return_val_if_fail(idx >= 0, -1);
- mmf_attrs_t *attrs = (mmf_attrs_t *) h;
+
mmf_value_spec_clear(&attrs->items[idx].value_spec);
assert(attrs->items[idx].value_spec.type == MMF_VALUE_SPEC_DOUBLE_RANGE);
return mmf_value_spec_set_double_range(&attrs->items[idx].value_spec, min, max, dval);
int mmf_attrs_set_valid_double_array(MMHandleType h, int idx, const double *array, int count, double dval)
{
+ mmf_attrs_t *attrs = (mmf_attrs_t *) h;
+
return_val_if_fail(h, -1);
return_val_if_fail(idx >= 0, -1);
- mmf_attrs_t *attrs = (mmf_attrs_t *) h;
+
mmf_value_spec_clear(&attrs->items[idx].value_spec);
assert(attrs->items[idx].value_spec.type == MMF_VALUE_SPEC_DOUBLE_ARRAY);
return mmf_value_spec_set_double_array(&attrs->items[idx].value_spec, array, count, dval);
Name: libmm-common
Summary: Multimedia Framework Common Lib
-Version: 0.2.115
+Version: 0.2.116
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0