Hello.
Just 3 small fixes to get our warning count down. The tempget one
should actually save us against wrong reads.
Also a small DSO fix reported and confirmed in IRC.
Please review and apply.
regards
Stefan Schmidt
>From 2bfa5810d01c4e39fd0f8c84eed45812e39adb8a Mon Sep 17 00:00:00 2001
From: Stefan Schmidt
Date: Wed, 18 Apr 2012 16:12:50 +0100
Subject: [PATCH 1/4] ecore_imf_xim: Rename variable to avoid shadowing
index is already used in string.h, avoid it here.
src/modules/immodules/xim/ecore_imf_xim.c:116: warning: declaration of 'index' shadows a global declaration
/usr/include/string.h:487: warning: shadowed declaration is here
---
ecore/src/modules/immodules/xim/ecore_imf_xim.c |6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ecore/src/modules/immodules/xim/ecore_imf_xim.c b/ecore/src/modules/immodules/xim/ecore_imf_xim.c
index 01a3576..103df66 100644
--- a/ecore/src/modules/immodules/xim/ecore_imf_xim.c
+++ b/ecore/src/modules/immodules/xim/ecore_imf_xim.c
@@ -113,14 +113,14 @@ static void xim_destroy_callback(XIM xim,
static unsigned int
utf8_offset_to_index(const char *str, int offset)
{
- int index = 0;
+ int idx = 0;
int i;
for (i = 0; i < offset; i++)
{
-eina_unicode_utf8_get_next(str, &index);
+eina_unicode_utf8_get_next(str, &idx);
}
- return index;
+ return idx;
}
#endif
--
1.7.10
>From 11ed418500dcbd2b107fd95fce8e194fbe41b8c2 Mon Sep 17 00:00:00 2001
From: Stefan Schmidt
Date: Wed, 18 Apr 2012 16:21:12 +0100
Subject: [PATCH 2/4] ecore_test_ecore: Mark unused parameter and remove
unused variable
Buildbot should be a bit happier with these annotations now. :)
---
ecore/src/tests/ecore_test_ecore.c |9 -
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/ecore/src/tests/ecore_test_ecore.c b/ecore/src/tests/ecore_test_ecore.c
index 3649196..a37b00d 100644
--- a/ecore/src/tests/ecore_test_ecore.c
+++ b/ecore/src/tests/ecore_test_ecore.c
@@ -156,13 +156,13 @@ START_TEST(ecore_test_ecore_main_loop_timer)
}
END_TEST
-static Eina_Bool _timer3(void *data)
+static Eina_Bool _timer3(void *data __UNUSED__)
{
/* timer 3, do nothing */
return EINA_FALSE;
}
-static Eina_Bool _timer2(void *data)
+static Eina_Bool _timer2(void *data __UNUSED__)
{
/* timer 2, quit inner mainloop */
ecore_main_loop_quit();
@@ -287,7 +287,7 @@ START_TEST(ecore_test_ecore_main_loop_event)
END_TEST
static Eina_Bool
-_timer_quit_recursive(void *data)
+_timer_quit_recursive(void *data __UNUSED__)
{
INF(" _timer_quit_recursive: begin");
ecore_main_loop_quit(); /* quits inner main loop */
@@ -296,9 +296,8 @@ _timer_quit_recursive(void *data)
}
static Eina_Bool
-_event_recursive_cb(void *data, int type, void *event)
+_event_recursive_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
- Ecore_Event *e;
static int guard = 0;
/* If we enter this callback more than once, it's wrong! */
--
1.7.10
>From ae615c9fc65bc6c17a18e1a9b4b9e8697cc77c47 Mon Sep 17 00:00:00 2001
From: Stefan Schmidt
Date: Wed, 18 Apr 2012 16:54:13 +0100
Subject: [PATCH 3/4] tempget: Check return values from fgets()
Without this checking we might operate on wrong data read in. Better check.
---
e/src/modules/temperature/tempget.c | 24 ++--
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/e/src/modules/temperature/tempget.c b/e/src/modules/temperature/tempget.c
index 28d3be2..a253dda 100644
--- a/e/src/modules/temperature/tempget.c
+++ b/e/src/modules/temperature/tempget.c
@@ -401,7 +401,9 @@ check(void)
{
char dummy[4096];
- fgets(buf, sizeof(buf), f);
+ if (fgets(buf, sizeof(buf), f) == NULL)
+ goto error;
+
buf[sizeof(buf) - 1] = 0;
if (sscanf(buf, "%s %s %i", dummy, dummy, &temp) == 3)
ret = 1;
@@ -417,7 +419,9 @@ check(void)
f = fopen(sensor_path, "rb");
if (f)
{
- fgets(buf, sizeof(buf), f);
+ if (fgets(buf, sizeof(buf), f) == NULL)
+ goto error;
+
fclose(f);
buf[sizeof(buf) - 1] = 0;
if (sscanf(buf, "%i", &temp) == 1)
@@ -434,7 +438,9 @@ check(void)
f = fopen(sensor_path, "r");
if (f)
{
- fgets(buf, sizeof(buf), f);
+ if (fgets(buf, sizeof(buf), f) == NULL)
+ goto error;
+
buf[sizeof(buf) - 1] = 0;
/* actually read the temp */
@@ -453,7 +459,9 @@ check(void)
f = fopen(sensor_path, "r");
if (f)
{
- fgets(buf, sizeof(buf), f);
+ if (fgets(buf, sizeof(buf), f) == NULL)
+ goto error;
+
buf[sizeof(buf) - 1] = 0;
/* actually read the temp */
@@ -474,7 +482,9 @@ check(void)
{
char *p, *q;
- fgets(buf, sizeof(buf), f);
+ if (fgets(buf, sizeof(buf), f) == NULL)
+ goto error;
+
buf[sizeof(buf) - 1] = 0;
fclose(f);
p = strchr(buf, ':');
@@