*****************************************************************************/
static gint __phonebook_compare_index(gconstpointer a, gconstpointer b)
{
- guint index1 = GPOINTER_TO_UINT(a);
- guint index2 = GPOINTER_TO_UINT(b);
+ guint index1 = (guint)a;
+ guint index2 = (guint)b;
return index1 - index2;
}
enum tel_phonebook_ton result;
dbg("number_plan : 0x%04x", number_plan);
- if (number_plan & IMC_NUM_PLAN_INTERNATIONAL) {
+ if (number_plan & IMC_NUM_PLAN_INTERNATIONAL)
result = PB_TON_INTERNATIONAL;
- }
- else {
+ else
result = PB_TON_UNKNOWN;
- }
+
dbg("result : %d", result);
return result;
* Check if 'index' is already available (UPDATE operation).
*/
while (list) {
- if (GPOINTER_TO_UINT(list->data) == req_index) {
+ if ((guint)list->data == req_index) {
/*
* index 'present', no need to update
*/
case PB_TYPE_FDN:
private_info->used_index_fdn = g_slist_insert_sorted(
private_info->used_index_fdn,
- GUINT_TO_POINTER(req_index),
+ (gpointer)req_index,
__phonebook_compare_index);
/* Update Phonebook list valid */
case PB_TYPE_ADN:
private_info->used_index_adn = g_slist_insert_sorted(
private_info->used_index_adn,
- GUINT_TO_POINTER(req_index),
+ (gpointer)req_index,
__phonebook_compare_index);
/* Update Phonebook list valid */
case PB_TYPE_SDN:
private_info->used_index_sdn = g_slist_insert_sorted(
private_info->used_index_sdn,
- GUINT_TO_POINTER(req_index),
+ (gpointer)req_index,
__phonebook_compare_index);
/* Update Phonebook list valid */
case PB_TYPE_USIM:
private_info->used_index_usim = g_slist_insert_sorted(
private_info->used_index_usim,
- GUINT_TO_POINTER(req_index),
+ (gpointer)req_index,
__phonebook_compare_index);
/* Update Phonebook list valid */
}
/* Use first used_index in case req_index is not used */
- *used_index = GPOINTER_TO_UINT(g_slist_nth_data(list, VAL_ZERO));
+ *used_index = (guint)g_slist_nth_data(list, VAL_ZERO);
while (list) {
- if (GPOINTER_TO_UINT(list->data) == req_index) {
+ if ((guint)list->data == req_index) {
/*
* req_index is equal to one of used_index
*/
if (resp && resp->success > VAL_ZERO) {
const char *line;
char *temp = NULL;
+ char *ptr = NULL;
GSList *tokens = NULL;
char *pb_type = NULL;
goto EXIT;
}
- line = (const char*)resp->lines->data;
+ line = (const char *)resp->lines->data;
tokens = tcore_at_tok_new(line);
if (g_slist_length(tokens) < VAL_ONE) {
warn("Invalid notification - 'number' of tokens: [%d]",
goto EXIT;
}
- temp = (char*)g_slist_nth_data(tokens, VAL_ZERO);
- pb_type = strtok(temp, "(,)");
+ temp = (char *)g_slist_nth_data(tokens, VAL_ZERO);
+ pb_type = strtok_r(temp, "(,)", &ptr);
+
while (pb_type != NULL) {
temp = tcore_at_tok_extract(pb_type);
dbg("pbtype %s", temp);
if (VAL_ZERO == g_strcmp0(temp, "FD")) {
dbg("SIM fixed-dialing Phonebook");
noti_data.support_list.b_fdn = TRUE;
- }
- else if (VAL_ZERO == g_strcmp0(temp, "SN")) {
+ } else if (VAL_ZERO == g_strcmp0(temp, "SN")) {
dbg("Service Dialing Number");
noti_data.support_list.b_sdn = TRUE;
- }
- else if (VAL_ZERO == g_strcmp0(temp, "SM")) {
+ } else if (VAL_ZERO == g_strcmp0(temp, "SM")) {
CoreObject *co_sim = NULL;
enum tel_sim_type sim_type = SIM_TYPE_UNKNOWN;
if (sim_type == SIM_TYPE_USIM) { /* 3G SIM */
noti_data.support_list.b_usim = TRUE;
dbg("3G SIM - USIM Phonebook");
- }
- else { /* 2G SIM */
+ } else { /* 2G SIM */
noti_data.support_list.b_adn = TRUE;
dbg("2G SIM - ADN Phonebook");
}
- }
- else if (VAL_ZERO == g_strcmp0(temp, "LD")) {
+ } else if (VAL_ZERO == g_strcmp0(temp, "LD")) {
dbg("SIM/UICC - last-dialling-phonebook");
- }
- else if (VAL_ZERO == g_strcmp0(temp, "ON")) {
+ } else if (VAL_ZERO == g_strcmp0(temp, "ON")) {
dbg("SIM (or MT) own numbers (MSISDNs) list");
- }
- else if (VAL_ZERO == g_strcmp0(temp, "BL")) {
+ } else if (VAL_ZERO == g_strcmp0(temp, "BL")) {
dbg("Blacklist phonebook");
- }
- else if (VAL_ZERO == g_strcmp0(temp, "EC")) {
+ } else if (VAL_ZERO == g_strcmp0(temp, "EC")) {
dbg("SIM emergency-call-codes phonebook");
- }
- else if (VAL_ZERO == g_strcmp0(temp, "AP")) {
+ } else if (VAL_ZERO == g_strcmp0(temp, "AP")) {
dbg("Selected application phonebook");
- }
- else if (VAL_ZERO == g_strcmp0(temp, "BN")) {
+ } else if (VAL_ZERO == g_strcmp0(temp, "BN")) {
dbg("SIM barred-dialling-number");
}
- pb_type = strtok (NULL, "(,)");
+ pb_type = strtok_r(NULL, "(,)", &ptr);
+
g_free(temp);
}
/* Update states */
tcore_phonebook_set_support_list(co_phonebook, ¬i_data.support_list);
tcore_phonebook_set_status(co_phonebook, noti_data.b_init);
- }
- else {
+ } else {
dbg("RESPONSE NOK");
/* Update state */
if (temp) {
/* Insert used_index in PrivateInfo sorted in ascending */
*list = g_slist_insert_sorted(*list,
- GUINT_TO_POINTER(atoi(temp)),
+ (gpointer)atoi(temp),
__phonebook_compare_index);
}
tcore_at_tok_free(tokens);
dbg("pb_type: [%d], used_index Length: [%d]",
req_pb_type, g_slist_length(*list));
}
- }
- else {
+ } else {
err("Response NOK");
}
}
CoreObject *co = tcore_pending_ref_core_object(p);
enum tel_phonebook_type pb_type;
- GSList *tokens=NULL;
+ GSList *tokens = NULL;
char *temp = NULL;
dbg("RESPONSE OK");
/* Cache 'used' index list */
__phonebook_get_used_index(co, pb_type, resp_get_count.total_count);
}
- }
- else {
+ } else {
dbg("RESPONSE NOK");
}
EXIT:
/* Cache 'used' index list */
__phonebook_get_used_index(co, pb_type, resp_get_info.index_max);
}
- }
- else {
+ } else {
dbg("RESPONSE NOK");
}
* +CPBR: <index>,<number>,<type>,<text>[,<hidden>][,<group>]
* [,<adnumber>][,<adtype>][,<secondtext>][,<email>]]
*/
- line = (const char*)resp->lines->data;
+ line = (const char *)resp->lines->data;
tokens = tcore_at_tok_new(line);
if (g_slist_length(tokens) < VAL_ONE) {
err("invalid message");
if (name) {
g_strlcpy((char *)resp_read_record.name,
(const gchar *)name, PHONEBOOK_NAME_BYTE_MAX+1);
- resp_read_record.name_len = strlen((const char*)resp_read_record.name);
+ resp_read_record.name_len = strlen((const char *)resp_read_record.name);
resp_read_record.dcs = PB_TEXT_ASCII;
g_free(name);
}
if (__phonebook_get_index_list_by_type(co,
req_data->phonebook_type, &list) == TRUE) {
while (list) {
- if (GPOINTER_TO_UINT(list->data) == resp_read_record.index) {
+ if ((guint)list->data == resp_read_record.index) {
if ((list = g_slist_next(list)) != NULL) {
/* If exist, set next_index */
- resp_read_record.next_index = GPOINTER_TO_UINT(list->data);
+ resp_read_record.next_index = (guint)list->data;
dbg("next_index is [%u]", resp_read_record.next_index);
} else {
/* read_record.index is the end of used_index */
/* Fetch <hidden> */
temp = g_slist_nth_data(tokens, VAL_FOUR);
- if (temp) {
+ if (temp)
dbg("Phonebook entry is hidden");
- }
/* Fetch <adnumber> */
temp = g_slist_nth_data(tokens, VAL_SIX);
if (sne) {
g_strlcpy((char *)resp_read_record.sne,
(const gchar *)sne, PHONEBOOK_NAME_BYTE_MAX+1);
- resp_read_record.sne_len = strlen((const char*)resp_read_record.sne);
+ resp_read_record.sne_len = strlen((const char *)resp_read_record.sne);
resp_read_record.sne_dcs = PB_TEXT_ASCII;
g_free(sne);
}
if (email) {
g_strlcpy((char *)resp_read_record.email1,
(const gchar *)email, PHONEBOOK_EMAIL_BYTE_MAX+1);
- resp_read_record.email1_len = strlen((const char*)resp_read_record.email1);
+ resp_read_record.email1_len = strlen((const char *)resp_read_record.email1);
g_free(email);
}
EXIT:
/* Free resources */
tcore_at_tok_free(tokens);
- }
- else {
+ } else {
dbg("RESPONSE NOK");
}
*/
__phonebook_update_index_list_by_type(co,
req_data->phonebook_type, req_data->index);
- }
- else {
+ } else {
dbg("RESPONSE NOK");
resp_update_record.result = PB_FAIL;
}
tcore_user_request_send_response(ur,
TRESP_PHONEBOOK_UPDATERECORD,
sizeof(struct tresp_phonebook_update_record), &resp_update_record);
- }
- else {
+ } else {
err("ur is NULL");
}
if (__phonebook_get_index_list_by_type(co,
req_data->phonebook_type, &list) != TRUE) {
err("used_index list is NOT valid");
- }
- else {
- const guint del_index = GPOINTER_TO_UINT(req_data->index);
- list = g_slist_remove(list, (gconstpointer)GUINT_TO_POINTER(del_index));
+ } else {
+ const int del_index = (const int)req_data->index;
+ list = g_slist_remove(list, (gconstpointer)del_index);
dbg("Remove index: [%u] list: [0x%x]", req_data->index, list);
}
- }
- else {
+ } else {
dbg("RESPONSE NOK");
resp_delete_record.result = PB_FAIL;
}
- if (ur) {
+ if (ur)
tcore_user_request_send_response(ur,
TRESP_PHONEBOOK_DELETERECORD,
sizeof(struct tresp_phonebook_delete_record), &resp_delete_record);
- }
- else {
+ else
err("ur is NULL");
- }
dbg("Exit");
}
* <type> Type of address octet in integer format
* <text> String type field of maximum length <tlength>
* <hidden> Indicates if the entry is hidden or not – only available,
- * if a UICC with an active USIM application is present
+ * if a UICC with an active USIM application is present
* 0 Phonebook entry not hidden
* 1 Phonebook entry hidden
* <group> String type field of maximum length <glength>
at_cmd = g_strdup_printf("%s+CPBW=%u,\"%s\",%d,\"%s\",,\"%s\",,\"%s\",\"%s\"",
set_pb_cmd, req_data->index,
req_data->number,
- ((PB_TON_INTERNATIONAL == req_data->ton) ? IMC_TON_INTERNATIONAL: IMC_TON_UNKNOWN),
+ ((PB_TON_INTERNATIONAL == req_data->ton) ? IMC_TON_INTERNATIONAL : IMC_TON_UNKNOWN),
req_data->name, req_data->anr1,
req_data->sne, req_data->email1);
} else {
dbg("Entry");
/* Set operations */
- tcore_phonebook_set_ops(co_phonebook, &phonebook_ops);
+ tcore_phonebook_set_ops(co_phonebook, &phonebook_ops, TCORE_OPS_TYPE_CP);
/* Set PrivateInfo */
private_info = g_malloc0(sizeof(PrivateInfo));