[PATCH 2/2] Trivial warning fixes
Felipe Contreras
felipe.contreras at gmail.com
Wed Apr 9 16:28:26 EDT 2014
proxy.c: In function ‘http_canread’:
proxy.c:972:8: warning: variable ‘minor’ set but not used [-Wunused-but-set-variable]
int minor;
^
stun.c: In function ‘reply_cb’:
stun.c:254:7: warning: ‘in’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if(sinptr->sin_addr.s_addr == in.s_addr) {
^
util.c: In function ‘purple_internal_strftime’:
util.c:531:32: warning: field precision specifier ‘.*’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
purple_get_tzoff_str(tm, FALSE));
^
util.c: In function ‘purple_get_tzoff_str’:
util.c:480:13: warning: ‘off’ may be used uninitialized in this function [-Wmaybe-uninitialized]
min = (off / 60) % 60;
^
util.c:456:7: note: ‘off’ was declared here
long off;
^
Signed-off-by: Felipe Contreras <felipe.contreras at gmail.com>
---
proxy.c | 3 +--
stun.c | 2 +-
util.c | 6 +++---
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/proxy.c b/proxy.c
index e6fb573..2f19439 100644
--- a/proxy.c
+++ b/proxy.c
@@ -969,9 +969,8 @@ http_canread(gpointer data, gint source, PurpleInputCondition cond)
major = strtol(p, &p, 10);
error = (major == 0) || (*p != '.');
if(!error) {
- int minor;
p++;
- minor = strtol(p, &p, 10);
+ strtol(p, &p, 10);
error = (*p != ' ');
if(!error) {
p++;
diff --git a/stun.c b/stun.c
index f1ba920..fb6ab1d 100644
--- a/stun.c
+++ b/stun.c
@@ -167,7 +167,7 @@ static void reply_cb(gpointer data, gint source, PurpleInputCondition cond) {
char buffer[65536];
char *tmp;
int len;
- struct in_addr in;
+ struct in_addr in = { 0, };
struct stun_attrib *attrib;
struct stun_header *hdr;
struct ifconf ifc;
diff --git a/util.c b/util.c
index 9b9dd2b..ed8c09d 100644
--- a/util.c
+++ b/util.c
@@ -453,7 +453,7 @@ purple_mime_decode_field(const char *str)
const char *purple_get_tzoff_str(const struct tm *tm, gboolean iso)
{
static char buf[7];
- long off;
+ long off = 0;
gint8 min;
gint8 hrs;
struct tm new_tm = *tm;
@@ -526,7 +526,7 @@ static size_t purple_internal_strftime(char *s, size_t max, const char *format,
{
char *tmp = g_strdup_printf("%s%.*s%s",
fmt ? fmt : "",
- c - start - 1,
+ (int)(c - start - 1),
start,
purple_get_tzoff_str(tm, FALSE));
g_free(fmt);
@@ -539,7 +539,7 @@ static size_t purple_internal_strftime(char *s, size_t max, const char *format,
{
char *tmp = g_strdup_printf("%s%.*s%s",
fmt ? fmt : "",
- c - start - 1,
+ (int)(c - start - 1),
start,
wpurple_get_timezone_abbreviation(tm));
g_free(fmt);
--
1.9.1+fc1
More information about the Devel
mailing list