summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangchul Lee <sc11.lee@samsung.com>2020-07-09 17:54:15 +0900
committerSangchul Lee <sc11.lee@samsung.com>2020-07-10 11:55:33 +0900
commit1276211b369adbb2525c7169cd2e4a26632d8674 (patch)
tree540c0f7989b4355c7de1723dd39e90e2b502343a
parent03b339411a0dcec99091e7ad772544b2732e1e38 (diff)
downloadaudio-hal-sc7727-1276211b369adbb2525c7169cd2e4a26632d8674.tar.gz
audio-hal-sc7727-1276211b369adbb2525c7169cd2e4a26632d8674.tar.bz2
audio-hal-sc7727-1276211b369adbb2525c7169cd2e4a26632d8674.zip
Fix build warnings
[Version] 0.1.33 [Issue Type] Build Change-Id: If47e918ba2d7067c1fd777a472fec1a37c517224 Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
-rw-r--r--packaging/audio-hal-sc7727.spec2
-rw-r--r--tizen-audio-volume.c28
2 files changed, 20 insertions, 10 deletions
diff --git a/packaging/audio-hal-sc7727.spec b/packaging/audio-hal-sc7727.spec
index 7a84689..9ba259f 100644
--- a/packaging/audio-hal-sc7727.spec
+++ b/packaging/audio-hal-sc7727.spec
@@ -1,6 +1,6 @@
Name: audio-hal-sc7727
Summary: TIZEN Audio HAL for SC7727
-Version: 0.1.32
+Version: 0.1.33
Release: 0
Group: System/Libraries
License: Apache-2.0
diff --git a/tizen-audio-volume.c b/tizen-audio-volume.c
index 8dd03f1..479a9fb 100644
--- a/tizen-audio-volume.c
+++ b/tizen-audio-volume.c
@@ -187,6 +187,11 @@ static audio_return_t __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 *key, *list_str, *token, *ptr = NULL;
if (access(VOLUME_INI_TEMP_PATH, F_OK) == 0)
dict = iniparser_load(VOLUME_INI_TEMP_PATH);
@@ -199,10 +204,6 @@ static audio_return_t __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);
@@ -212,7 +213,9 @@ static audio_return_t __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) {
@@ -223,6 +226,8 @@ static audio_return_t __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++) {
@@ -242,9 +247,9 @@ static audio_return_t __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;
}
@@ -265,6 +270,7 @@ static audio_return_t __load_radio_volume_table(int** volume_table, int *number_
{
dictionary * dict = NULL;
const char delimiter[] = ", ";
+ const char *tmp_str = NULL;
char* ptr = NULL;
char* token = NULL;
char* list_str = NULL;
@@ -324,7 +330,9 @@ static audio_return_t __load_radio_volume_table(int** volume_table, int *number_
*volume_table = temp_table;
- list_str = iniparser_getstring(dict, RADIO_TUNING_VOLUME_TABLE, NULL);
+ if ((tmp_str = iniparser_getstring(dict, RADIO_TUNING_VOLUME_TABLE, NULL)))
+ list_str = strdup(tmp_str);
+
if (list_str) {
token = strtok_r(list_str, delimiter, &ptr);
while (token) {
@@ -333,6 +341,8 @@ static audio_return_t __load_radio_volume_table(int** volume_table, int *number_
index++;
token = strtok_r(NULL, delimiter, &ptr);
}
+ free(list_str);
+ list_str = NULL;
}
error:
iniparser_freedict(dict);