summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaechul Lee <jcsing.lee@samsung.com>2021-02-04 12:20:16 +0900
committerJaechul Lee <jcsing.lee@samsung.com>2021-02-04 14:53:24 +0900
commit1e3c3f14985f4261a8d1c60f270f9d68fec44752 (patch)
tree4403e54124624f4f14f717630f6f99b50e3f52ff
parent1e1868b1214277308f6a0334ad4f9c2d1882bbca (diff)
downloadaudio-hal-exynos9110-1e3c3f14985f4261a8d1c60f270f9d68fec44752.tar.gz
audio-hal-exynos9110-1e3c3f14985f4261a8d1c60f270f9d68fec44752.tar.bz2
audio-hal-exynos9110-1e3c3f14985f4261a8d1c60f270f9d68fec44752.zip
Fix build warnings
[Version] 0.1.5 [Issue Type] Build Change-Id: I38b43a2098d5f7a946fd006967500549c24e5e91 Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
-rw-r--r--hal-backend-audio.c6
-rw-r--r--packaging/audio-hal-exynos9110.spec2
-rw-r--r--tizen-audio-volume.c25
3 files changed, 21 insertions, 12 deletions
diff --git a/hal-backend-audio.c b/hal-backend-audio.c
index 9d5df23..853dedb 100644
--- a/hal-backend-audio.c
+++ b/hal-backend-audio.c
@@ -60,12 +60,14 @@ static int audio_e9110_init(void **data)
return 0;
}
-static void audio_e9110_exit(void *data)
+static int audio_e9110_exit(void *data)
{
if (!data)
- return;
+ return -EINVAL;
free(data);
+
+ return 0;
}
hal_backend hal_backend_audio_data = {
diff --git a/packaging/audio-hal-exynos9110.spec b/packaging/audio-hal-exynos9110.spec
index 2a9ed2d..c2123b2 100644
--- a/packaging/audio-hal-exynos9110.spec
+++ b/packaging/audio-hal-exynos9110.spec
@@ -1,6 +1,6 @@
Name: audio-hal-exynos9110
Summary: TIZEN Audio HAL for Exynos9110(TW3)
-Version: 0.1.4
+Version: 0.1.5
Release: 0
Group: System/Libraries
License: Apache-2.0
diff --git a/tizen-audio-volume.c b/tizen-audio-volume.c
index 1eaa972..de9bf47 100644
--- a/tizen-audio-volume.c
+++ b/tizen-audio-volume.c
@@ -29,6 +29,7 @@
#include <iniparser.h>
#include "tizen-audio-internal.h"
+#include "tizen-audio-impl.h"
#define VOLUME_INI_DEFAULT_PATH SYSCONFDIR"/multimedia/mmfw_audio_volume.ini" /* SYSCONFDIR is defined at .spec */
#define VOLUME_INI_TEMP_PATH "/opt/system/mmfw_audio_volume.ini"
@@ -181,6 +182,12 @@ static audio_return_e __load_volume_value_table_from_ini(audio_hal_t *ah)
uint32_t vol_type_idx, vol_level_idx, gain_type_idx;
audio_volume_value_table_t *volume_value_table = ah->volume.volume_value_table;
int size = 0;
+ const char delimiter[] = ", ";
+ const char *table_str = "volumes";
+ const char *tmp_str = NULL;
+ const char *gain_str = NULL;
+ char *list_str = NULL, *ptr = NULL;
+ char *key, *token;
if (access(VOLUME_INI_TEMP_PATH, F_OK) == 0)
dict = iniparser_load(VOLUME_INI_TEMP_PATH);
@@ -193,10 +200,6 @@ static audio_return_e __load_volume_value_table_from_ini(audio_hal_t *ah)
}
}
- const char delimiter[] = ", ";
- char *key, *list_str, *token, *ptr = NULL;
- const char *table_str = "volumes";
-
/* Load volume table */
for (vol_type_idx = 0; vol_type_idx < AUDIO_VOLUME_TYPE_MAX; vol_type_idx++) {
const char *vol_type_str = __get_volume_type_string_by_idx(vol_type_idx);
@@ -206,7 +209,9 @@ static audio_return_e __load_volume_value_table_from_ini(audio_hal_t *ah)
key = malloc(size);
if (key) {
snprintf(key, size, "%s:%s", table_str, vol_type_str);
- list_str = iniparser_getstring(dict, key, NULL);
+ if ((tmp_str = iniparser_getstring(dict, key, NULL)))
+ list_str = strdup(tmp_str);
+
if (list_str) {
token = strtok_r(list_str, delimiter, &ptr);
while (token) {
@@ -217,6 +222,8 @@ static audio_return_e __load_volume_value_table_from_ini(audio_hal_t *ah)
volume_value_table->volume[vol_type_idx][ah->volume.volume_level_max[vol_type_idx]++] = vol_value;
token = strtok_r(NULL, delimiter, &ptr);
}
+ free(list_str);
+ list_str = NULL;
} else {
ah->volume.volume_level_max[vol_type_idx] = 1;
for (vol_level_idx = 0; vol_level_idx < AUDIO_VOLUME_LEVEL_MAX; vol_level_idx++) {
@@ -236,9 +243,9 @@ static audio_return_e __load_volume_value_table_from_ini(audio_hal_t *ah)
key = malloc(size);
if (key) {
snprintf(key, size, "%s:gain_%s", table_str, gain_type_str);
- token = iniparser_getstring(dict, key, NULL);
- if (token) {
- volume_value_table->gain[gain_type_idx] = atof(token);
+ gain_str = iniparser_getstring(dict, key, NULL);
+ if (gain_str) {
+ volume_value_table->gain[gain_type_idx] = atof(gain_str);
} else {
volume_value_table->gain[gain_type_idx] = GAIN_VALUE_MAX;
}
@@ -433,4 +440,4 @@ audio_return_e audio_set_volume_ratio(void *audio_handle, audio_stream_info_s *i
_mixer_control_set_value (ah, COMPRESS_VOL_CTRL, (int)(ratio * MAX_VOL_VALUE));
return audio_ret;
-} \ No newline at end of file
+}