smsutil: Make code flow easier to understand

This commit is contained in:
Denis Kenzior 2010-06-21 12:03:14 -05:00
parent a8bd87cda9
commit cbc27e06b3
1 changed files with 57 additions and 56 deletions

View File

@ -2652,8 +2652,8 @@ gboolean status_report_assembly_report(struct status_report_assembly *assembly,
{
unsigned int offset = status_report->status_report.mr / 32;
unsigned int bit = 1 << (status_report->status_report.mr % 32);
struct id_table_node *node = NULL;
GHashTable *id_table;
struct id_table_node *node;
unsigned int *key;
gpointer value;
GHashTableIter iter;
@ -2672,8 +2672,15 @@ gboolean status_report_assembly_report(struct status_report_assembly *assembly,
while (g_hash_table_iter_next(&iter, (gpointer)&key, &value)) {
node = value;
if (!(node->mrs[offset] & bit))
continue;
if (node->mrs[offset] & bit)
break;
node = NULL;
}
/* Unable to find a message reference belonging to this address */
if (node == NULL)
return FALSE;
/* Mr belongs to this node. */
node->mrs[offset] ^= bit;
@ -2689,8 +2696,7 @@ gboolean status_report_assembly_report(struct status_report_assembly *assembly,
}
/* Mr is not delivered. */
if (status_report->status_report.st !=
SMS_ST_COMPLETED_RECEIVED) {
if (status_report->status_report.st != SMS_ST_COMPLETED_RECEIVED) {
/*
* First mr which is not delivered. Update ofono history
* and mark the whole message as undeliverable. Upcoming
@ -2730,11 +2736,6 @@ gboolean status_report_assembly_report(struct status_report_assembly *assembly,
}
}
/* ERROR, mr not found. */
*msg_delivered = FALSE;
return FALSE;
}
void status_report_assembly_add_fragment(
struct status_report_assembly *assembly,
unsigned int msg_id,