Hi Bertrand,
On 6 May 2011 11:41, Aygon, Bertrand <bertrand.aygon(a)intel.com> wrote:
Hi,
I have switched my dev environment to Ubuntu 11.04, and so I am using GCC
4.5.2.
Building oFono returns 2 erros due to uninit var. One is a false negative,
so I have fix it with the ‘magic define’, and will send the patch soon (VPN
is dead so I cannot send it).
But for the second one, I am not sure it’s a false negative, so I would like
to have the thought of the mailing list, and even better the author or guys
who has some knowledge on this part of the code.
That one is a bug. I remember it caught my eye at some point but
later I forgot about it. This is more or less how I'd try to fix it:
--- a/src/sim.c
+++ b/src/sim.c
@@ -947,10 +947,8 @@ static void sim_get_image(struct ofono_sim *sim,
unsigned char id,
image = sim_fs_get_cached_image(sim->simfs, id);
- if (image != NULL) {
+ if (image != NULL)
sim_get_image_cb(sim, id, image, FALSE);
- goto watch;
- }
if (sim->efimg_length <= (id * 9)) {
sim_get_image_cb(sim, id, NULL, FALSE);
@@ -963,13 +961,10 @@ static void sim_get_image(struct ofono_sim *sim,
unsigned char id,
iidf_offset = efimg[5] << 8 | efimg[6];
iidf_len = efimg[7] << 8 | efimg[8];
- /* read the image data */
- ofono_sim_read_bytes(sim->context, iidf_id, iidf_offset, iidf_len,
- sim_iidf_read_cb, sim);
-
-watch:
- if (sim->efimg_length <= id * 9)
- return;
+ if (image == NULL)
+ /* read the image data */
+ ofono_sim_read_bytes(sim->context, iidf_id, iidf_offset,
+ iidf_len, sim_iidf_read_cb, sim);
if (sim->iidf_watch_ids[id] > 0)
return;
Best regards