*****************************************************************************/
static gint __phonebook_compare_index(gconstpointer a, gconstpointer b)
{
- guint index1 = (guint)a;
- guint index2 = (guint)b;
+ guint index1 = GPOINTER_TO_UINT(a);
+ guint index2 = GPOINTER_TO_UINT(b);
return index1 - index2;
}
* Check if 'index' is already available (UPDATE operation).
*/
while (list) {
- if ((guint)list->data == req_index) {
+ if (GPOINTER_TO_UINT(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,
- (gpointer)req_index,
+ GUINT_TO_POINTER(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,
- (gpointer)req_index,
+ GUINT_TO_POINTER(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,
- (gpointer)req_index,
+ GUINT_TO_POINTER(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,
- (gpointer)req_index,
+ GUINT_TO_POINTER(req_index),
__phonebook_compare_index);
/* Update Phonebook list valid */
}
/* Use first used_index in case req_index is not used */
- *used_index = (guint)g_slist_nth_data(list, VAL_ZERO);
+ *used_index = GPOINTER_TO_UINT(g_slist_nth_data(list, VAL_ZERO));
while (list) {
- if ((guint)list->data == req_index) {
+ if (GPOINTER_TO_UINT(list->data) == req_index) {
/*
* req_index is equal to one of used_index
*/
if (temp) {
/* Insert used_index in PrivateInfo sorted in ascending */
*list = g_slist_insert_sorted(*list,
- (gpointer)atoi(temp),
+ GUINT_TO_POINTER(atoi(temp)),
__phonebook_compare_index);
}
tcore_at_tok_free(tokens);
if (__phonebook_get_index_list_by_type(co,
req_data->phonebook_type, &list) == TRUE) {
while (list) {
- if ((guint)list->data == resp_read_record.index) {
+ if (GPOINTER_TO_UINT(list->data) == resp_read_record.index) {
if ((list = g_slist_next(list)) != NULL) {
/* If exist, set next_index */
- resp_read_record.next_index = (guint)list->data;
+ resp_read_record.next_index = GPOINTER_TO_UINT(list->data);
dbg("next_index is [%u]", resp_read_record.next_index);
} else {
/* read_record.index is the end of used_index */
err("used_index list is NOT valid");
}
else {
- const int del_index = (const int)req_data->index;
- list = g_slist_remove(list, (gconstpointer)del_index);
+ const guint del_index = GPOINTER_TO_UINT(req_data->index);
+ list = g_slist_remove(list, (gconstpointer)GUINT_TO_POINTER(del_index));
dbg("Remove index: [%u] list: [0x%x]", req_data->index, list);
}
}