diff options
author | Denis Kenzior <denkenz@gmail.com> | 2009-07-14 12:49:12 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-07-14 15:45:06 -0500 |
commit | 864e09481ccb0ccb42ef4fd4147b328b3b486a67 (patch) | |
tree | 940091145de34c312667f70f3d761ece334b8356 | |
parent | a8eedf13261923e1403d59ba746a70b39f135db7 (diff) | |
download | ofono-864e09481ccb0ccb42ef4fd4147b328b3b486a67.tar.bz2 |
Get rid of some div by zero errors
-rw-r--r-- | src/network.c | 8 | ||||
-rw-r--r-- | src/sim.c | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/network.c b/src/network.c index 186b5eec..657c9e80 100644 --- a/src/network.c +++ b/src/network.c @@ -1116,7 +1116,7 @@ static void sim_opl_read_cb(struct ofono_modem *modem, int ok, int record_length, void *userdata) { struct network_registration_data *netreg = modem->network_registration; - int total = length / record_length; + int total; if (!ok) return; @@ -1131,6 +1131,8 @@ static void sim_opl_read_cb(struct ofono_modem *modem, int ok, if (!netreg->eons) return; + total = length / record_length; + sim_eons_add_pnn_record(netreg->eons, record, data, record_length); if (record == total) @@ -1144,7 +1146,7 @@ static void sim_pnn_read_cb(struct ofono_modem *modem, int ok, int record_length, void *userdata) { struct network_registration_data *netreg = modem->network_registration; - int total = length / record_length; + int total; if (!ok) return; @@ -1158,6 +1160,8 @@ static void sim_pnn_read_cb(struct ofono_modem *modem, int ok, if (!netreg->eons) netreg->eons = sim_eons_new(total); + total = length / record_length; + sim_eons_add_pnn_record(netreg->eons, record, data, record_length); /* If PNN is not present then OPL is not useful, don't @@ -192,7 +192,7 @@ static void sim_msisdn_read_cb(struct ofono_modem *modem, int ok, int record_length, void *userdata) { struct sim_manager_data *sim = modem->sim_manager; - int total = length / record_length; + int total; struct ofono_phone_number *ph; int number_len; int ton_npi; @@ -206,6 +206,8 @@ static void sim_msisdn_read_cb(struct ofono_modem *modem, int ok, if (length < 14 || record_length < 14 || length < record_length) return; + total = length / record_length; + /* Skip Alpha-Identifier field */ data += record_length - 14; |