From 2359ce88fdacf85518c0db5dd20e39fb039bdd4a Mon Sep 17 00:00:00 2001 From: Sangchul Lee Date: Mon, 29 Oct 2018 15:02:17 +0900 Subject: [PATCH] [0.2.114] mm_attrs: Fix header file description and argument name Change-Id: I5b2bde6711afa77fb1dd40ef67eaf493d254a6b9 Signed-off-by: Sangchul Lee --- include/mm_attrs.h | 155 ++++++++++++++---------- mm_attrs.c | 286 ++++++++++++++++++++++---------------------- packaging/libmm-common.spec | 2 +- 3 files changed, 238 insertions(+), 205 deletions(-) diff --git a/include/mm_attrs.h b/include/mm_attrs.h index 3af9996..9a09c6c 100644 --- a/include/mm_attrs.h +++ b/include/mm_attrs.h @@ -146,9 +146,11 @@ typedef struct { /** * 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 + * * @return This function returns MM_ERROR_NONE on success, or negative value with error code. */ int mm_attrs_set_int_by_name(MMHandleType attrs, const char *attr_name, int val); @@ -156,8 +158,10 @@ int mm_attrs_set_int_by_name(MMHandleType attrs, const char *attr_name, int val) /** * This function is to get the number of attribute in the MMAttrs. + * * @param attrs [in] Handle of attributes list * @param size [out] Number of attributes + * * @return This function returns the number of attributes in the attribute list. */ int mm_attrs_get_size(MMHandleType attrs, int *size); @@ -165,9 +169,11 @@ int mm_attrs_get_size(MMHandleType attrs, int *size); /** * 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 name [out] Name of attribute + * * @return This function returns the name of attribute on success, or NULL * on failure. */ @@ -176,9 +182,11 @@ int mm_attrs_get_name(MMHandleType attrs, int index, char **name); /** * This function is to get the index of attribute at the given name. + * * @param attrs [in] Handle of attributes list * @param attr_name [in] Name of attribute * @param index [out] Index of attribute + * * @return This function returns the index of the attribute on success, * or negative value on failure. */ @@ -187,9 +195,11 @@ int mm_attrs_get_index(MMHandleType attrs, const char *attr_name, int *index); /** * This function is to get the integer value from the attribute by name. + * * @param attrs [in] Handle of attributes list * @param attr_name [in] Name of attribute * @param val [out] Value of attribute + * * @return This function returns attribute value */ int mm_attrs_get_int_by_name(MMHandleType attrs, const char *attr_name, int *val); @@ -197,9 +207,11 @@ int mm_attrs_get_int_by_name(MMHandleType attrs, const char *attr_name, int *val /** * 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 + * * @return This function returns MM_ERROR_NONE on success, or negative value with error code. */ int mm_attrs_set_string_by_name(MMHandleType attrs, const char *attr_name, const char *string); @@ -207,9 +219,11 @@ int mm_attrs_set_string_by_name(MMHandleType attrs, const char *attr_name, const /** * This function is to get the string from the attribute by name. + * * @param attrs [in] Handle of attributes list * @param attr_name [in] Name of attribute * @param val [out] Value of attribute + * * @return This function returns the string value of attribute on success, * or NULL on failure */ @@ -218,19 +232,23 @@ int mm_attrs_get_string_by_name(MMHandleType attrs, const char *attr_name, char /** * 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 + * * @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 + * * @return This function returns user defined value on success, or NULL * on failure */ @@ -239,57 +257,67 @@ int mm_attrs_get_data_by_name(MMHandleType attrs, const char *attr_name, void ** /** * This function is to retrieve type of attribute. + * * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @param index [in] Index of attribute * @param attrtype [out] On return contains type of attribute + * * @return This function returns MM_ERROR_NONE. * @see MMAttrsType */ -int mm_attrs_get_type(MMHandleType attrs, int id, MMAttrsType *attrtype); +int mm_attrs_get_type(MMHandleType attrs, int index, MMAttrsType *attrtype); /** - * This function is to get flags of attribute with given id. + * This function is to get flags of attribute with given index. + * * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @param index [in] Index of attribute * @param flags [out] On return contains flags of attribute. + * * @return This function returns MM_ERROR_NONE on success, or negative value with error code. * @see MMAttrsFlag */ -int mm_attrs_get_flags(MMHandleType attrs, int id, int *flags); +int mm_attrs_get_flags(MMHandleType attrs, int index, int *flags); /** - * This function is to get valid value type of attribute with given id. + * This function is to get valid value type of attribute with given index. + * * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @param index [in] Index of attribute * @param type [out] On return contains 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 id, int *type); +int mm_attrs_get_valid_type(MMHandleType attrs, int index, int *type); /** - * This function is to get valid range of attribute with given id. + * This function is to get valid range of attribute with given index. + * * @param attrs [in] List of attributes - * @param id [in] ID of attribute - * @param min [out] minimum value of the valid range. - * @param max [out] maximum value of the valid range. + * @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. */ -int mm_attrs_get_valid_range(MMHandleType attrs, int id, int *min, int *max); +int mm_attrs_get_valid_range(MMHandleType attrs, int index, int *min, int *max); /** - * This function is to get valid array of attribute with given id. + * This function is to get valid array of attribute with given index. + * * @param attrs [in] list of attributes - * @param id [in] ID of attribute + * @param index [in] Index of attribute * @param count [out] number of array * @param array [out] on return contains valid array of attribute + * * @return This function returns MM_ERROR_NONE on success, or negative value with error code. */ -int mm_attrs_get_valid_array(MMHandleType attrs, int id, int *count, int **array); +int mm_attrs_get_valid_array(MMHandleType attrs, int index, int *count, int **array); /** @@ -315,39 +343,43 @@ int mm_attrs_get_valid_double_array(MMHandleType h, int idx, int *count, double /** - * This function is to set integer value to attribute with given id. + * This function is to set integer value to attribute with given index. + * * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @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 */ -int mm_attrs_set_int(MMHandleType attrs, int id, int val); +int mm_attrs_set_int(MMHandleType attrs, int index, int val); /** - * This function is to get integer value to attribute with given id. + * This function is to get integer value to attribute with given index. + * * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @param index [in] Index of attribute * @param val [out] On return contains 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. * @see mm_attrs_get_int */ -int mm_attrs_get_int(MMHandleType attrs, int id, int *val); +int mm_attrs_get_int(MMHandleType attrs, int index, int *val); /** - * This function is to set double value to attribute with given id. + * This function is to set double value to attribute with given index. * * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @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_double */ -int mm_attrs_set_double(MMHandleType attrs, int id, double val); +int mm_attrs_set_double(MMHandleType attrs, int index, double val); /** @@ -363,15 +395,16 @@ int mm_attrs_set_double_by_name(MMHandleType attrs, const char *attr_name, doubl /** - * This function is to get double value to attribute with given id. + * This function is to get double value to attribute with given index. * * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @param index [in] Index of attribute * @param attrval [out] On return contains 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 */ -int mm_attrs_get_double(MMHandleType attrs, int id, double *attrval); +int mm_attrs_get_double(MMHandleType attrs, int index, double *attrval); /** @@ -387,89 +420,89 @@ int mm_attrs_get_double_by_name(MMHandleType attrs, const char *attr_name, doubl /** - * This function is to set string to attribute with given id. + * This function is to set string to attribute with given index. + * * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @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 */ -int mm_attrs_set_string(MMHandleType attrs, int id, const char *string, int size); +int mm_attrs_set_string(MMHandleType attrs, int index, const char *string, int size); /** - * This function is to get string to attribute with given id. + * This function is to get string to attribute with given index. + * * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @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 * @see mm_attrs_set_string */ -int mm_attrs_get_string(MMHandleType attrs, int id, char **sval, int *size); +int mm_attrs_get_string(MMHandleType attrs, int index, char **sval, int *size); /** - * This function is to set pointer to attribute with given id. + * This function is to set pointer to attribute with given index. + * * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @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 id, void *data, int size); +int mm_attrs_set_data(MMHandleType attrs, int index, void *data, int size); /** - * This function is to get pointer to attribute with given id. + * This function is to get pointer to attribute with given index. + * * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @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 * @see mm_attrs_set_data */ -int mm_attrs_get_data(MMHandleType attrs, int id, void **data, int *size); +int mm_attrs_get_data(MMHandleType attrs, int index, void **data, int *size); /** * A function to get information of the attribute * * @param attrs [in] List of attributes - * @param id [in] ID of attribute - * @param array [out] Contains the array of attribute on success, - * or NULL pointer on failure. - * @param count [out] Count of array + * @param index [in] Index of attribute + * @param info [out] Information of the attribute * * @return This function returns MM_ERROR_NONE on success, or negative value with error code. - * @remarks Application would be responsible for managing/releasing the array - * @see mm_attrs_set_info */ -int mm_attrs_get_info(MMHandleType h, int idx, MMAttrsInfo *info); +int mm_attrs_get_info(MMHandleType attrs, int index, MMAttrsInfo *info); /** - * This function is to get array of attribute with given id. + * This function is to get array of attribute with given name. * * @param attrs [in] List of attributes - * @param id [in] ID of attribute - * @param array [out] Contains the array of attribute on success, - * or NULL pointer on failure. - * @param count [out] Count of array + * @param attr_name [in] Name of attribute + * @param info [out] Information of the attribute * * @return This function returns MM_ERROR_NONE on success, or negative value with error code. - * @remarks Application would be responsible for managing/releasing the array - * @see mm_attrs_set_array */ -int mm_attrs_get_info_by_name(MMHandleType h, const char *attr_name, MMAttrsInfo *info); +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 @@ -480,12 +513,12 @@ int mm_attrs_get_info_by_name(MMHandleType h, const char *attr_name, MMAttrsInfo * @remarks Multiple setter of attribute * @see mm_attrs_set_int, mm_attrs_set_string, ... */ -int mm_attrs_multiple_set(MMHandleType handle, char **err_attr_name, const char *attribute_name, ...) __NULL_TERMINATED; +int mm_attrs_multiple_set(MMHandleType attrs, char **err_attr_name, const char *attribute_name, ...) __NULL_TERMINATED; /** * 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 @@ -496,12 +529,12 @@ int mm_attrs_multiple_set(MMHandleType handle, char **err_attr_name, const char * @remarks Multiple setter of attribute * @see mm_attrs_set_int, mm_attrs_set_string, ... */ -int mm_attrs_multiple_get(MMHandleType handle, char **err_attr_name, const char *attribute_name, ...) __NULL_TERMINATED; +int mm_attrs_multiple_get(MMHandleType attrs, char **err_attr_name, const char *attribute_name, ...) __NULL_TERMINATED; /** * 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 @@ -516,7 +549,7 @@ int mm_attrs_set_valist(MMHandleType attrs, char **err_attr_name, const char *at /** * 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 diff --git a/mm_attrs.c b/mm_attrs.c index ffc55a0..f78dcc4 100644 --- a/mm_attrs.c +++ b/mm_attrs.c @@ -31,89 +31,89 @@ #include "mm_attrs_private.h" #include "mm_error.h" -int mm_attrs_get_type(MMHandleType h, int idx, MMAttrsType *attrtype) +int mm_attrs_get_type(MMHandleType attrs, int index, MMAttrsType *attrtype) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; - return_val_if_fail(h && idx >= 0 && idx < attrs->count && attrtype, MM_ERROR_COMMON_INVALID_ARGUMENT); - *attrtype = attrs->items[idx].value.type; + 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 h, int idx, int *flags) +int mm_attrs_get_flags(MMHandleType attrs, int index, int *flags) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; - return_val_if_fail(attrs && idx >= 0 && idx < attrs->count && flags, MM_ERROR_COMMON_INVALID_ARGUMENT); + 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 = attrs->items[idx].flags; + *flags = h->items[index].flags; return MM_ERROR_NONE; } -int mm_attrs_get_valid_type(MMHandleType h, int idx, int *type) +int mm_attrs_get_valid_type(MMHandleType attrs, int index, int *type) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; - return_val_if_fail(attrs && idx >= 0 && idx < attrs->count && type, MM_ERROR_COMMON_INVALID_ARGUMENT); - *type = attrs->items[idx].value_spec.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 h, int idx, int *min, int *max) +int mm_attrs_get_valid_range(MMHandleType attrs, int index, int *min, int *max) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; - return_val_if_fail(attrs && idx >= 0 && idx < attrs->count && min && max, MM_ERROR_COMMON_INVALID_ARGUMENT); + 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) { - *min = attrs->items[idx].value_spec.spec.int_spec.range.min; + *min = h->items[index].value_spec.spec.int_spec.range.min; } if (max) { - *max = attrs->items[idx].value_spec.spec.int_spec.range.max; + *max = h->items[index].value_spec.spec.int_spec.range.max; } return MM_ERROR_NONE; } -int mm_attrs_get_valid_array(MMHandleType h, int idx, int *count, int **array) +int mm_attrs_get_valid_array(MMHandleType attrs, int index, int *count, int **array) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; + mmf_attrs_t *h = (mmf_attrs_t *) attrs; if (count) *count = 0; - return_val_if_fail(attrs && count && idx >= 0 && idx < attrs->count && array, MM_ERROR_COMMON_INVALID_ARGUMENT); + return_val_if_fail(h && count && index >= 0 && index < h->count && array, MM_ERROR_COMMON_INVALID_ARGUMENT); if (count) - *count = attrs->items[idx].value_spec.spec.int_spec.array.count; - *array = attrs->items[idx].value_spec.spec.int_spec.array.array; + *count = h->items[index].value_spec.spec.int_spec.array.count; + *array = h->items[index].value_spec.spec.int_spec.array.array; return MM_ERROR_NONE; } -int mm_attrs_get_size(MMHandleType h, int *size) +int mm_attrs_get_size(MMHandleType attrs, int *size) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; + mmf_attrs_t *h = (mmf_attrs_t *) attrs; return_val_if_fail(h && size, MM_ERROR_COMMON_INVALID_ARGUMENT); - *size = attrs->count; + *size = h->count; return MM_ERROR_NONE; } -int mm_attrs_get_name(MMHandleType h, int idx, char **name) +int mm_attrs_get_name(MMHandleType attrs, int index, char **name) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; - return_val_if_fail(attrs && idx >= 0 && idx < attrs->count && name, MM_ERROR_COMMON_INVALID_ARGUMENT); - *name = attrs->items[idx].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_get_index(MMHandleType h, const char *attrname, int *index) +int mm_attrs_get_index(MMHandleType attrs, const char *attrname, int *index) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; + mmf_attrs_t *h = (mmf_attrs_t *) attrs; int i; return_val_if_fail(h && attrname && index, MM_ERROR_COMMON_INVALID_ARGUMENT); - for (i = 0; i < attrs->count; i++) { - if (0 == strcmp(attrs->items[i].name, attrname)) { + for (i = 0; i < h->count; i++) { + if (0 == strcmp(h->items[i].name, attrname)) { *index = i; return MM_ERROR_NONE; } @@ -125,12 +125,12 @@ int mm_attrs_get_index(MMHandleType h, const char *attrname, int *index) } -int mm_attrs_set_int(MMHandleType h, int idx, int val) +int mm_attrs_set_int(MMHandleType attrs, int index, int val) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; - return_val_if_fail(attrs && idx >= 0 && idx < attrs->count, MM_ERROR_COMMON_INVALID_ARGUMENT); + 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 = &attrs->items[idx]; + mmf_attribute_t *item = &h->items[index]; return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT); if (!mmf_attribute_check_flags(item, MM_ATTRS_FLAG_WRITABLE)) { @@ -156,15 +156,15 @@ int mm_attrs_set_int(MMHandleType h, int idx, int val) } -int mm_attrs_get_int(MMHandleType h, int idx, int *val) +int mm_attrs_get_int(MMHandleType attrs, int index, int *val) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; - return_val_if_fail(attrs && idx >= 0 && idx < attrs->count && val, MM_ERROR_COMMON_INVALID_ARGUMENT); - mmf_attribute_t *item = &attrs->items[idx]; + mmf_attrs_t *h = (mmf_attrs_t *) attrs; + return_val_if_fail(h && index >= 0 && index < h->count && val, MM_ERROR_COMMON_INVALID_ARGUMENT); + mmf_attribute_t *item = &h->items[index]; return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT); if (mmf_attribute_check_flags(item, MM_ATTRS_FLAG_READABLE)) { - *val = mmf_value_get_int(&attrs->items[idx].value); + *val = mmf_value_get_int(&h->items[index].value); return MM_ERROR_NONE; } @@ -172,12 +172,12 @@ int mm_attrs_get_int(MMHandleType h, int idx, int *val) } -int mm_attrs_set_double(MMHandleType h, int idx, double val) +int mm_attrs_set_double(MMHandleType attrs, int index, double val) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; - return_val_if_fail(attrs && idx >= 0 && idx < attrs->count, MM_ERROR_COMMON_INVALID_ARGUMENT); + 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 = &attrs->items[idx]; + mmf_attribute_t *item = &h->items[index]; return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT); if (!mmf_attribute_check_flags(item, MM_ATTRS_FLAG_WRITABLE)) @@ -202,15 +202,15 @@ int mm_attrs_set_double(MMHandleType h, int idx, double val) } -int mm_attrs_get_double(MMHandleType h, int idx, double *val) +int mm_attrs_get_double(MMHandleType attrs, int index, double *val) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; - return_val_if_fail(attrs && idx >= 0 && idx < attrs->count && val, MM_ERROR_COMMON_INVALID_ARGUMENT); - mmf_attribute_t *item = &attrs->items[idx]; + mmf_attrs_t *h = (mmf_attrs_t *) attrs; + return_val_if_fail(h && index >= 0 && index < h->count && val, MM_ERROR_COMMON_INVALID_ARGUMENT); + mmf_attribute_t *item = &h->items[index]; return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT); if (mmf_attribute_check_flags(item, MM_ATTRS_FLAG_READABLE)) { - *val = mmf_value_get_double(&attrs->items[idx].value); + *val = mmf_value_get_double(&h->items[index].value); return MM_ERROR_NONE; } @@ -218,12 +218,12 @@ int mm_attrs_get_double(MMHandleType h, int idx, double *val) } -int mm_attrs_set_string(MMHandleType h, int idx, const char *string, int size) +int mm_attrs_set_string(MMHandleType attrs, int index, const char *string, int size) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; - return_val_if_fail(attrs && idx >= 0 && idx < attrs->count, MM_ERROR_COMMON_INVALID_ARGUMENT); + 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 = &attrs->items[idx]; + mmf_attribute_t *item = &h->items[index]; return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT); @@ -247,13 +247,13 @@ int mm_attrs_set_string(MMHandleType h, int idx, const char *string, int size) } -int mm_attrs_get_string(MMHandleType h, int idx, char **sval, int *size) +int mm_attrs_get_string(MMHandleType attrs, int index, char **sval, int *size) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; + mmf_attrs_t *h = (mmf_attrs_t *) attrs; mmf_attribute_t *item = NULL; - return_val_if_fail(attrs && idx >= 0 && idx < attrs->count && sval, MM_ERROR_COMMON_INVALID_ARGUMENT); + return_val_if_fail(h && index >= 0 && index < h->count && sval, MM_ERROR_COMMON_INVALID_ARGUMENT); - item = &attrs->items[idx]; + item = &h->items[index]; MM_ATTR_ITEM_WRITE_LOCK(item); @@ -271,12 +271,12 @@ int mm_attrs_get_string(MMHandleType h, int idx, char **sval, int *size) } -int mm_attrs_set_data(MMHandleType h, int idx, void *data, int size) +int mm_attrs_set_data(MMHandleType attrs, int index, void *data, int size) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; - return_val_if_fail(attrs && idx >= 0 && idx < attrs->count, MM_ERROR_COMMON_INVALID_ARGUMENT); + 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 = &attrs->items[idx]; + mmf_attribute_t *item = &h->items[index]; return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT); if (mmf_attribute_check_flags(item, MM_ATTRS_FLAG_WRITABLE)) { @@ -293,16 +293,16 @@ int mm_attrs_set_data(MMHandleType h, int idx, void *data, int size) } -int mm_attrs_get_data(MMHandleType h, int idx, void **data, int *size) +int mm_attrs_get_data(MMHandleType attrs, int index, void **data, int *size) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; - return_val_if_fail(attrs && idx >= 0 && idx < attrs->count && data, MM_ERROR_COMMON_INVALID_ARGUMENT); + 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 (!(attrs->items[idx].flags & MM_ATTRS_FLAG_READABLE)) { + if (!(h->items[index].flags & MM_ATTRS_FLAG_READABLE)) { //mmf_debug(MMF_DEBUG_LOG, "Access denied.\n"); return MM_ERROR_COMMON_INVALID_PERMISSION; } - *data = mmf_value_get_data(&attrs->items[idx].value, size); + *data = mmf_value_get_data(&h->items[index].value, size); return MM_ERROR_NONE; } @@ -310,10 +310,10 @@ int mm_attrs_get_data(MMHandleType h, int idx, void **data, int *size) int mm_attrs_set_int_by_name(MMHandleType attrs, const char *name, int val) { return_val_if_fail(attrs && name, -1); - int idx = 0; - mm_attrs_get_index(attrs, name, &idx); - if (idx >= 0) { - return mm_attrs_set_int(attrs, idx, val); + int index = 0; + mm_attrs_get_index(attrs, name, &index); + if (index >= 0) { + return mm_attrs_set_int(attrs, index, val); } return -1; } @@ -321,11 +321,11 @@ int mm_attrs_set_int_by_name(MMHandleType attrs, const char *name, int val) int mm_attrs_get_int_by_name(MMHandleType attrs, const char *name, int *val) { - int idx = -1; + int index = -1; return_val_if_fail(attrs && name && val, MM_ERROR_COMMON_INVALID_ARGUMENT); - mm_attrs_get_index(attrs, name, &idx); - if (idx >= 0) { - return mm_attrs_get_int(attrs, idx, val); + mm_attrs_get_index(attrs, name, &index); + if (index >= 0) { + return mm_attrs_get_int(attrs, index, val); } return MM_ERROR_COMMON_INVALID_ATTRTYPE; } @@ -336,9 +336,9 @@ int mm_attrs_set_string_by_name(MMHandleType attrs, const char *name, const char return_val_if_fail(attrs && name, -1); int size; - int idx = 0; - mm_attrs_get_index(attrs, name, &idx); - if (idx >= 0) { + int index = 0; + mm_attrs_get_index(attrs, name, &index); + if (index >= 0) { if (string) { size = strlen(string); } else { @@ -346,7 +346,7 @@ int mm_attrs_set_string_by_name(MMHandleType attrs, const char *name, const char size = 0; } - return mm_attrs_set_string(attrs, idx, string, size); + return mm_attrs_set_string(attrs, index, string, size); } return -1; } @@ -354,13 +354,13 @@ int mm_attrs_set_string_by_name(MMHandleType attrs, const char *name, const char int mm_attrs_get_string_by_name(MMHandleType attrs, const char *name, char **string) { - int idx = -1; + int index = -1; int len = 0; return_val_if_fail(attrs && name && string, MM_ERROR_COMMON_INVALID_ARGUMENT); - mm_attrs_get_index(attrs, name, &idx); - if (idx >= 0) { - return mm_attrs_get_string(attrs, idx, string, &len); + mm_attrs_get_index(attrs, name, &index); + if (index >= 0) { + return mm_attrs_get_string(attrs, index, string, &len); } return MM_ERROR_COMMON_INVALID_ATTRTYPE; } @@ -369,11 +369,11 @@ int mm_attrs_get_string_by_name(MMHandleType attrs, const char *name, char **str int mm_attrs_set_data_by_name(MMHandleType attrs, const char *name, void *data, int size) { return_val_if_fail(attrs && name, -1); - int idx = 0; - mm_attrs_get_index(attrs, name, &idx); + int index = 0; + mm_attrs_get_index(attrs, name, &index); - if (idx >= 0) { - return mm_attrs_set_data(attrs, idx, data, size); + if (index >= 0) { + return mm_attrs_set_data(attrs, index, data, size); } return -1; } @@ -381,14 +381,14 @@ int mm_attrs_set_data_by_name(MMHandleType attrs, const char *name, void *data, int mm_attrs_get_data_by_name(MMHandleType attrs, const char *name, void **data) { - int idx = -1; + int index = -1; int len = 0; return_val_if_fail(attrs && name, MM_ERROR_COMMON_INVALID_ARGUMENT); - mm_attrs_get_index(attrs, name, &idx); - if (idx >= 0) { - return mm_attrs_get_data(attrs, idx, data, &len); + mm_attrs_get_index(attrs, name, &index); + if (index >= 0) { + return mm_attrs_get_data(attrs, index, data, &len); } return MM_ERROR_COMMON_INVALID_ATTRTYPE; } @@ -396,12 +396,12 @@ int mm_attrs_get_data_by_name(MMHandleType attrs, const char *name, void **data) int mm_attrs_set_double_by_name(MMHandleType attrs, const char *name, double val) { - int idx = -1; + int index = -1; return_val_if_fail(attrs && name, MM_ERROR_COMMON_INVALID_ARGUMENT); - mm_attrs_get_index(attrs, name, &idx); - if (idx >= 0) { - return mm_attrs_set_double(attrs, idx, val); + mm_attrs_get_index(attrs, name, &index); + if (index >= 0) { + return mm_attrs_set_double(attrs, index, val); } return MM_ERROR_COMMON_INVALID_ATTRTYPE; } @@ -409,12 +409,12 @@ int mm_attrs_set_double_by_name(MMHandleType attrs, const char *name, double val int mm_attrs_get_double_by_name(MMHandleType attrs, const char *name, double *val) { - int idx = -1; + int index = -1; return_val_if_fail(attrs && name && val, MM_ERROR_COMMON_INVALID_ARGUMENT); - mm_attrs_get_index(attrs, name, &idx); - if (idx >= 0) { - *val = mm_attrs_get_double(attrs, idx, val); + mm_attrs_get_index(attrs, name, &index); + if (index >= 0) { + *val = mm_attrs_get_double(attrs, index, val); return 0; } return MM_ERROR_COMMON_INVALID_ATTRTYPE; @@ -435,11 +435,11 @@ int mm_attrs_set_valist(MMHandleType attrs, char **err_attr_name, const char *at name = attribute_name; while (name) { - int idx = -1; + int index = -1; MMAttrsType attr_type = MM_ATTRS_TYPE_INVALID; //name check - if ((ret = mm_attrs_get_index(attrs, name, &idx)) != MM_ERROR_NONE) { + if ((ret = mm_attrs_get_index(attrs, name, &index)) != MM_ERROR_NONE) { if (err_attr_name) *err_attr_name = strdup(name); @@ -454,7 +454,7 @@ int mm_attrs_set_valist(MMHandleType attrs, char **err_attr_name, const char *at } //type check - if ((ret = mm_attrs_get_type(attrs, idx, &attr_type)) != MM_ERROR_NONE) + if ((ret = mm_attrs_get_type(attrs, index, &attr_type)) != MM_ERROR_NONE) return ret; //cast and set @@ -463,14 +463,14 @@ int mm_attrs_set_valist(MMHandleType attrs, char **err_attr_name, const char *at { int val = va_arg((var_args), int); // mmf_debug(MMF_DEBUG_LOG, "(%s: %d)\n", name, val); - ret = mm_attrs_set_int(attrs, idx, val); + ret = mm_attrs_set_int(attrs, index, val); break; } case MM_ATTRS_TYPE_DOUBLE: { double val = va_arg((var_args), double); // mmf_debug(MMF_DEBUG_LOG, "(%s: %f)\n", name, val); - ret = mm_attrs_set_double(attrs, idx, val); + ret = mm_attrs_set_double(attrs, index, val); break; } case MM_ATTRS_TYPE_STRING: @@ -478,7 +478,7 @@ int mm_attrs_set_valist(MMHandleType attrs, char **err_attr_name, const char *at 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); - ret = mm_attrs_set_string(attrs, idx, (const char*)val, size); + ret = mm_attrs_set_string(attrs, index, (const char*)val, size); break; } case MM_ATTRS_TYPE_DATA: @@ -486,7 +486,7 @@ int mm_attrs_set_valist(MMHandleType attrs, char **err_attr_name, const char *at 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); - ret = mm_attrs_set_data(attrs, idx, val, size); + ret = mm_attrs_set_data(attrs, index, val, size); break; } case MM_ATTRS_TYPE_INVALID: @@ -532,11 +532,11 @@ int mm_attrs_get_valist(MMHandleType attrs, char **err_attr_name, const char *at name = attribute_name; while (name) { - int idx = -1; + int index = -1; MMAttrsType attr_type = MM_ATTRS_TYPE_INVALID; //name check - if ((ret = mm_attrs_get_index(attrs, name, &idx)) != MM_ERROR_NONE) { + if ((ret = mm_attrs_get_index(attrs, name, &index)) != MM_ERROR_NONE) { if (err_attr_name) *err_attr_name = strdup(name); @@ -547,7 +547,7 @@ int mm_attrs_get_valist(MMHandleType attrs, char **err_attr_name, const char *at } //type check - if ((ret = mm_attrs_get_type(attrs, idx, &attr_type)) != MM_ERROR_NONE) + if ((ret = mm_attrs_get_type(attrs, index, &attr_type)) != MM_ERROR_NONE) return ret; //cast and set @@ -556,14 +556,14 @@ int mm_attrs_get_valist(MMHandleType attrs, char **err_attr_name, const char *at { int * val = va_arg((var_args), int*); // mmf_debug(MMF_DEBUG_LOG, "(%s: %p)\n", name, val); - ret = mm_attrs_get_int(attrs, idx, val); + ret = mm_attrs_get_int(attrs, index, val); break; } case MM_ATTRS_TYPE_DOUBLE: { double * val = va_arg((var_args), double*); // mmf_debug(MMF_DEBUG_LOG, "(%s: %p)\n", name, val); - ret = mm_attrs_get_double(attrs, idx, val); + ret = mm_attrs_get_double(attrs, index, val); break; } case MM_ATTRS_TYPE_STRING: @@ -571,7 +571,7 @@ int mm_attrs_get_valist(MMHandleType attrs, char **err_attr_name, const char *at char ** val = va_arg((var_args), char**); int * size = va_arg((var_args), int*); // mmf_debug(MMF_DEBUG_LOG, "(%s: %p, size: %p)\n", name, val, size); - ret = mm_attrs_get_string(attrs, idx, (char**)val, size); + ret = mm_attrs_get_string(attrs, index, (char**)val, size); break; } case MM_ATTRS_TYPE_DATA: @@ -579,7 +579,7 @@ int mm_attrs_get_valist(MMHandleType attrs, char **err_attr_name, const char *at void ** val = va_arg((var_args), void**); int * size = va_arg((var_args), int*); // mmf_debug(MMF_DEBUG_LOG, "(%s: %p, size: %p)\n", name, val, size); - ret = mm_attrs_get_data(attrs, idx, val, size); + ret = mm_attrs_get_data(attrs, index, val, size); break; } case MM_ATTRS_TYPE_INVALID: @@ -606,7 +606,7 @@ int mm_attrs_get_valist(MMHandleType attrs, char **err_attr_name, const char *at } -int mm_attrs_multiple_set(MMHandleType handle, char **err_attr_name, const char *attribute_name, ...) +int mm_attrs_multiple_set(MMHandleType attrs, char **err_attr_name, const char *attribute_name, ...) { va_list var_args; int ret = MM_ERROR_NONE; @@ -614,14 +614,14 @@ int mm_attrs_multiple_set(MMHandleType handle, char **err_attr_name, const char return_val_if_fail(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT); va_start(var_args, attribute_name); - ret = mm_attrs_set_valist(handle, err_attr_name, attribute_name, var_args); + ret = mm_attrs_set_valist(attrs, err_attr_name, attribute_name, var_args); va_end(var_args); return ret; } -int mm_attrs_multiple_get(MMHandleType handle, char **err_attr_name, const char *attribute_name, ...) +int mm_attrs_multiple_get(MMHandleType attrs, char **err_attr_name, const char *attribute_name, ...) { va_list var_args; int ret = MM_ERROR_NONE; @@ -629,47 +629,47 @@ int mm_attrs_multiple_get(MMHandleType handle, char **err_attr_name, const char return_val_if_fail(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT); va_start(var_args, attribute_name); - ret = mm_attrs_get_valist(handle, err_attr_name, attribute_name, var_args); + ret = mm_attrs_get_valist(attrs, err_attr_name, attribute_name, var_args); va_end(var_args); return ret; } -int mm_attrs_get_info(MMHandleType h, int idx, MMAttrsInfo *info) +int mm_attrs_get_info(MMHandleType attrs, int index, MMAttrsInfo *info) { - mmf_attrs_t *attrs = (mmf_attrs_t *) h; + mmf_attrs_t *h = (mmf_attrs_t *) attrs; - return_val_if_fail(h, MM_ERROR_COMMON_INVALID_ARGUMENT); + return_val_if_fail(attrs, MM_ERROR_COMMON_INVALID_ARGUMENT); return_val_if_fail(info, MM_ERROR_COMMON_INVALID_ARGUMENT); - return_val_if_fail(0 <= idx && idx < attrs->count, MM_ERROR_COMMON_INVALID_ARGUMENT); + return_val_if_fail(0 <= index && index < h->count, MM_ERROR_COMMON_INVALID_ARGUMENT); memset(info, 0x00, sizeof(MMAttrsInfo)); - info->type = attrs->items[idx].value.type; - info->flag = attrs->items[idx].flags; - info->validity_type = attrs->items[idx].value_spec.type; + info->type = h->items[index].value.type; + info->flag = h->items[index].flags; + info->validity_type = h->items[index].value_spec.type; switch (info->validity_type) { case MM_ATTRS_VALID_TYPE_INT_ARRAY: - info->int_array.array = attrs->items[idx].value_spec.spec.int_spec.array.array; - info->int_array.count = attrs->items[idx].value_spec.spec.int_spec.array.count; - info->int_array.dval = attrs->items[idx].value_spec.spec.int_spec.array.dval; + info->int_array.array = h->items[index].value_spec.spec.int_spec.array.array; + info->int_array.count = h->items[index].value_spec.spec.int_spec.array.count; + info->int_array.dval = h->items[index].value_spec.spec.int_spec.array.dval; break; case MM_ATTRS_VALID_TYPE_INT_RANGE: - info->int_range.min = attrs->items[idx].value_spec.spec.int_spec.range.min; - info->int_range.max = attrs->items[idx].value_spec.spec.int_spec.range.max; - info->int_range.dval = attrs->items[idx].value_spec.spec.int_spec.range.dval; + info->int_range.min = h->items[index].value_spec.spec.int_spec.range.min; + info->int_range.max = h->items[index].value_spec.spec.int_spec.range.max; + info->int_range.dval = h->items[index].value_spec.spec.int_spec.range.dval; break; case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY: - info->double_array.array = attrs->items[idx].value_spec.spec.double_spec.array.array; - info->double_array.count = attrs->items[idx].value_spec.spec.double_spec.array.count; - info->double_array.dval = attrs->items[idx].value_spec.spec.double_spec.array.dval; + info->double_array.array = h->items[index].value_spec.spec.double_spec.array.array; + info->double_array.count = h->items[index].value_spec.spec.double_spec.array.count; + info->double_array.dval = h->items[index].value_spec.spec.double_spec.array.dval; break; case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE: - info->double_range.min = attrs->items[idx].value_spec.spec.double_spec.range.min; - info->double_range.max = attrs->items[idx].value_spec.spec.double_spec.range.max; - info->double_range.dval = attrs->items[idx].value_spec.spec.double_spec.range.dval; + info->double_range.min = h->items[index].value_spec.spec.double_spec.range.min; + info->double_range.max = h->items[index].value_spec.spec.double_spec.range.max; + info->double_range.dval = h->items[index].value_spec.spec.double_spec.range.dval; break; case MM_ATTRS_VALID_TYPE_NONE: //mmf_debug(MMF_DEBUG_LOG, "Valid type none.\n"); @@ -683,21 +683,21 @@ int mm_attrs_get_info(MMHandleType h, int idx, MMAttrsInfo *info) } -int mm_attrs_get_info_by_name(MMHandleType h, const char *attr_name, MMAttrsInfo *info) +int mm_attrs_get_info_by_name(MMHandleType attrs, const char *attr_name, MMAttrsInfo *info) { - int idx = -1; + int index = -1; int ret = MM_ERROR_NONE; - return_val_if_fail(h, MM_ERROR_COMMON_INVALID_ARGUMENT); + return_val_if_fail(attrs, 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); - mm_attrs_get_index(h, attr_name, &idx); + mm_attrs_get_index(attrs, attr_name, &index); - return_val_if_fail(idx >= 0, MM_ERROR_COMMON_INVALID_ARGUMENT); + return_val_if_fail(index >= 0, MM_ERROR_COMMON_INVALID_ARGUMENT); - ret = mm_attrs_get_info(h, idx, info); + ret = mm_attrs_get_info(attrs, index, info); return ret; } diff --git a/packaging/libmm-common.spec b/packaging/libmm-common.spec index 050169a..54534d4 100644 --- a/packaging/libmm-common.spec +++ b/packaging/libmm-common.spec @@ -1,6 +1,6 @@ Name: libmm-common Summary: Multimedia Framework Common Lib -Version: 0.2.113 +Version: 0.2.114 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4