/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
/* Get a first item */
iter = g_slist_nth(g_client_list, 0);
- int i = 1;
+ int i = 1;
while (NULL != iter) {
/*Get handle data from list*/
data = iter->data;
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[%dth] uid(%d), state(%d)", i, data->uid, data->state);
-
+
/*Get next item*/
iter = g_slist_next(iter);
i++;
/* Get handle data from list */
data = iter->data;
- if (uid == data->uid)
+ if (uid == data->uid)
return iter;
-
+
iter = g_slist_next(iter);
}
}
/*Check uid is duplicated*/
GSList *tmp = NULL;
tmp = __client_get_item(uid);
-
+
if (NULL != tmp) {
SLOG(LOG_WARN, TAG_STTD, "[Client Data] Client uid is already registered");
return STTD_ERROR_INVALID_PARAMETER;
/* Add item to global list */
g_client_list = g_slist_append(g_client_list, info);
-
+
if (NULL == g_client_list) {
SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] Fail to add new client");
- return -1;
+
+ free(info);
+ info = NULL;
+
+ return STTD_ERROR_OPERATION_FAILED;
}
#ifdef CLIENT_DATA_DEBUG
client_show_list();
-#endif
+#endif
return 0;
}
#ifdef CLIENT_DATA_DEBUG
client_show_list();
-#endif
+#endif
return 0;
}
if (NULL != hnd->start_beep) {
free(hnd->start_beep);
}
-
+
if (NULL != filename) {
hnd->start_beep = strdup(filename);
SLOG(LOG_DEBUG, TAG_STTD, "[Client Data] Start sound file : %s", hnd->start_beep);
if (NULL != hnd->stop_beep) {
free(hnd->stop_beep);
}
-
+
if (NULL != filename) {
hnd->stop_beep = strdup(filename);
SLOG(LOG_DEBUG, TAG_STTD, "[Client Data] Stop sound file : %s", hnd->stop_beep);
/* Get handle data from list */
data = iter->data;
- if (APP_STATE_RECORDING == data->state)
+ if (APP_STATE_RECORDING == data->state)
return data->uid;
iter = g_slist_next(iter);
/* Get handle data from list */
data = iter->data;
- if (APP_STATE_PROCESSING == data->state)
+ if (APP_STATE_PROCESSING == data->state)
return data->uid;
iter = g_slist_next(iter);
{
if (NULL == uids || NULL == uid_count)
return -1;
-
+
int count = g_slist_length(g_client_list);
if (0 == count)
int i = 0;
iter = g_slist_nth(g_client_list, 0);
- for (i = 0;i < count;i++) {
+ while (NULL != iter) {
+ if (NULL == iter->data) {
+ count--;
+ iter = g_slist_next(iter);
+ continue;
+ }
+
data = iter->data;
tmp[i] = data->uid;
iter = g_slist_next(iter);
+
+ i++;
}
*uids = tmp;
tmp = __client_get_item(uid);
if (NULL == tmp) {
- SECURE_SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] uid(%d) is NOT valid", uid);
+ SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] uid(%d) is NOT valid", uid);
return STTD_ERROR_INVALID_PARAMETER;
}
tmp = __client_get_item(uid);
if (NULL == tmp) {
- SECURE_SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] uid(%d) is NOT valid", uid);
+ SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] uid(%d) is NOT valid", uid);
return STTD_ERROR_INVALID_PARAMETER;
}
hnd = tmp->data;
return hnd->app_agreed;
-}
\ No newline at end of file
+}