[PATCH] Silence the compiler in 64 bit architectures.

0 views
Skip to first unread message

vja...@igalia.com

unread,
Sep 19, 2009, 8:01:06 AM9/19/09
to msn-...@googlegroups.com, Víctor Manuel Jáquez Leal
From: Víctor Manuel Jáquez Leal <vja...@igalia.com>

---
cvr/pn_msnobj.c | 4 ++--
cvr/pn_peer_msg.c | 4 ++--
io/pn_http_server.c | 8 ++++----
io/pn_node.c | 6 +++---
io/pn_ssl_conn.c | 2 +-
pn_oim.c | 16 ++++++++--------
6 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/cvr/pn_msnobj.c b/cvr/pn_msnobj.c
index 6025caa..1ca03c9 100644
--- a/cvr/pn_msnobj.c
+++ b/cvr/pn_msnobj.c
@@ -160,7 +160,7 @@ pn_msnobj_new_from_image(struct pn_buffer *image,
obj->size = image->len;

/* Compute the SHA1C field. */
- buf = g_strdup_printf("Creator%sSize%dType%dLocation%sFriendly%sSHA1D%s",
+ buf = g_strdup_printf("Creator%sSize%" G_GSIZE_FORMAT "Type%dLocation%sFriendly%sSHA1D%s",
obj->creator,
obj->size,
obj->type,
@@ -210,7 +210,7 @@ pn_msnobj_to_string(const struct pn_msnobj *obj)

sha1c = obj->sha1c;

- str = g_strdup_printf("<msnobj Creator=\"%s\" Size=\"%d\" Type=\"%d\" "
+ str = g_strdup_printf("<msnobj Creator=\"%s\" Size=\"%" G_GSIZE_FORMAT "\" Type=\"%d\" "
"Location=\"%s\" Friendly=\"%s\" SHA1D=\"%s\""
"%s%s%s/>",
obj->creator,
diff --git a/cvr/pn_peer_msg.c b/cvr/pn_peer_msg.c
index 9c93bb6..92bcff0 100644
--- a/cvr/pn_peer_msg.c
+++ b/cvr/pn_peer_msg.c
@@ -198,7 +198,7 @@ sip_new(struct pn_peer_call *call,
char *end;
end = strchr(body, '\r');
if (end)
- pn_info("send sip: %.*s", end - body, body);
+ pn_info("send sip: %.*s", (gint) (end - body), body);
}

body_len = strlen(body);
@@ -801,7 +801,7 @@ pn_sip_recv(struct pn_peer_link *link,
char *end;
end = strchr(body, '\r');
if (end)
- pn_info("recv sip: %.*s", end - body, body);
+ pn_info("recv sip: %.*s", (gint) (end - body), body);
}

if (strncmp(body, "INVITE", strlen("INVITE")) == 0) {
diff --git a/io/pn_http_server.c b/io/pn_http_server.c
index 55d6524..4011880 100644
--- a/io/pn_http_server.c
+++ b/io/pn_http_server.c
@@ -328,7 +328,7 @@ http_poll (gpointer data)

if (status == G_IO_STATUS_NORMAL)
{
- pn_log ("bytes_written=%d", bytes_written);
+ pn_log ("bytes_written=%" G_GSIZE_FORMAT, bytes_written);
http_conn->waiting_response = TRUE;
}
}
@@ -728,14 +728,14 @@ read_impl (PnNode *conn,
status = pn_stream_read (conn->stream, buf, MIN (http_conn->content_length, count), &bytes_read, &tmp_error);

pn_log ("status=%d", status);
- pn_log ("bytes_read=%d", bytes_read);
+ pn_log ("bytes_read=%" G_GSIZE_FORMAT, bytes_read);

if (ret_bytes_read)
*ret_bytes_read = bytes_read;

http_conn->content_length -= bytes_read;

- pn_log ("con_len=%d,read=%d", http_conn->content_length, bytes_read);
+ pn_log ("con_len=%d,read=%" G_GSIZE_FORMAT, http_conn->content_length, bytes_read);

if (http_conn->content_length == 0)
http_conn->parser_state = 0;
@@ -859,7 +859,7 @@ foo_write (PnNode *conn,

if (status == G_IO_STATUS_NORMAL)
{
- pn_log ("bytes_written=%d", bytes_written);
+ pn_log ("bytes_written=%" G_GSIZE_FORMAT, bytes_written);
http_conn->waiting_response = TRUE;
if (http_conn->cur)
g_object_unref (http_conn->cur);
diff --git a/io/pn_node.c b/io/pn_node.c
index 4cfe3df..36da21e 100644
--- a/io/pn_node.c
+++ b/io/pn_node.c
@@ -537,7 +537,7 @@ write_impl (PnNode *conn,

status = pn_stream_write_full (conn->stream, buf, count, &bytes_written, &tmp_error);

- pn_log ("bytes_written=%d", bytes_written);
+ pn_log ("bytes_written=%" G_GSIZE_FORMAT, bytes_written);

if (status == G_IO_STATUS_NORMAL)
{
@@ -545,7 +545,7 @@ write_impl (PnNode *conn,
{
/* This shouldn't happen, right? */
/* It doesn't seem to happen, but keep checking for now. */
- pn_error ("write check: %d < %d", bytes_written, count);
+ pn_error ("write check: %" G_GSIZE_FORMAT " < %" G_GSIZE_FORMAT, bytes_written, count);
}
}
else
@@ -600,7 +600,7 @@ read_impl (PnNode *conn,
status, status_to_str (status));
}

- pn_log ("bytes_read=%d", bytes_read);
+ pn_log ("bytes_read=%" G_GSIZE_FORMAT, bytes_read);

if (ret_bytes_read)
*ret_bytes_read = bytes_read;
diff --git a/io/pn_ssl_conn.c b/io/pn_ssl_conn.c
index fb981e2..5c3f974 100644
--- a/io/pn_ssl_conn.c
+++ b/io/pn_ssl_conn.c
@@ -325,7 +325,7 @@ write_impl (PnNode *conn,
if (bytes_written < count)
{
/* This shouldn't happen, right? */
- pn_error ("write check: %d < %d", bytes_written, count);
+ pn_error ("write check: %d < %" G_GSIZE_FORMAT, bytes_written, count);
}
}
else
diff --git a/pn_oim.c b/pn_oim.c
index 75c092e..6ffcd7d 100644
--- a/pn_oim.c
+++ b/pn_oim.c
@@ -206,7 +206,7 @@ send_receive_request (PnNode *conn,
{
gsize len;
pn_node_write (conn, header, strlen (header), &len, NULL);
- pn_debug ("write_len=%d", len);
+ pn_debug ("write_len=%" G_GSIZE_FORMAT, len);
}

g_free (header);
@@ -268,7 +268,7 @@ send_delete_request (PnNode *conn,
{
gsize len;
pn_node_write (conn, header, strlen (header), &len, NULL);
- pn_debug ("write_len=%d", len);
+ pn_debug ("write_len=%" G_GSIZE_FORMAT, len);
}

g_free (header);
@@ -387,7 +387,7 @@ send_send_request (PnNode *conn,
{
gsize len;
pn_node_write (conn, header, strlen (header), &len, NULL);
- pn_debug ("write_len=%d", len);
+ pn_debug ("write_len=%" G_GSIZE_FORMAT, len);
}

g_free (header);
@@ -482,7 +482,7 @@ send_auth_request (PnNode *conn,
{
gsize len;
pn_node_write (conn, header, strlen (header), &len, NULL);
- pn_debug ("write_len=%d", len);
+ pn_debug ("write_len=%" G_GSIZE_FORMAT, len);
}

g_free (header);
@@ -555,7 +555,7 @@ process_body_receive (OimRequest *oim_request,
gchar *cur;
guint32 date = 0;

- pn_debug("body=[%.*s]", length, body);
+ pn_debug("body=[%.*s]", (guint) length, body);

/** @todo find a way to parse the date in win32 */
#ifndef G_OS_WIN32
@@ -600,7 +600,7 @@ process_body_delete (OimRequest *oim_request,
char *body,
gsize length)
{
- pn_debug("body=[%.*s]", length, body);
+ pn_debug("body=[%.*s]", (guint) length, body);

if (strstr (body, "Schema validation error"))
pn_error ("deleting oim=[%s]: schema validation error", oim_request->message_id);
@@ -613,7 +613,7 @@ process_body_send (OimRequest *oim_request,
{
gchar *cur;

- pn_debug("body=[%.*s]", length, body);
+ pn_debug("body=[%.*s]", (guint) length, body);

cur = strstr (body, "<LockKeyChallenge ");
if (cur)
@@ -675,7 +675,7 @@ process_body_auth (OimRequest *oim_request,
{
gchar *cur;

- pn_debug ("body=[%.*s]", length, body);
+ pn_debug ("body=[%.*s]", (guint) length, body);

cur = strstr (body, "<wsse:BinarySecurityToken Id=\"PPToken1\">");
if (cur)
--
1.6.3.3

Felipe Contreras

unread,
Oct 24, 2009, 2:44:24 PM10/24/09
to vja...@igalia.com, msn-...@googlegroups.com
2009/9/19 <vja...@igalia.com>:

>
> From: Víctor Manuel Jáquez Leal <vja...@igalia.com>

How about using '%zu' instead of '%s' G_GSIZE_FORMAT?

Note that C99 is preferred over GLib.

The rest of the patch is ok.

--
Felipe Contreras

Felipe Contreras

unread,
Oct 25, 2009, 3:11:32 PM10/25/09
to Víctor M. Jáquez L., msn-...@googlegroups.com
2009/10/25 Víctor M. Jáquez L. <vja...@igalia.com>:

> On Sat, Oct 24, 2009 at 09:44:24PM +0300, Felipe Contreras wrote:
>> >
>> > From: Víctor Manuel Jáquez Leal <vja...@igalia.com>
>>
>> How about using '%zu' instead of '%s' G_GSIZE_FORMAT?
>>
>> Note that C99 is preferred over GLib.
>>
>> The rest of the patch is ok.
>
> Done.

Applied and pushed. Thanks :)

--
Felipe Contreras

Felipe Contreras

unread,
Oct 25, 2009, 3:24:43 PM10/25/09
to Víctor M. Jáquez L., msn-...@googlegroups.com
2009/10/25 Felipe Contreras <felipe.c...@gmail.com>:

Er, actually clang complained about using 'guint' as the field width,
and it turns out the standard says it should be 'int', so I made
another commit to fix that.

--
Felipe Contreras

Víctor M. Jáquez L.

unread,
Oct 25, 2009, 3:06:03 PM10/25/09
to Felipe Contreras, msn-...@googlegroups.com
On Sat, Oct 24, 2009 at 09:44:24PM +0300, Felipe Contreras wrote:
> >
> > From: Víctor Manuel Jáquez Leal <vja...@igalia.com>
>
> How about using '%zu' instead of '%s' G_GSIZE_FORMAT?
>
> Note that C99 is preferred over GLib.
>
> The rest of the patch is ok.

Done.

vmjl
0001-Silence-the-compiler-in-64-bit-architectures.patch

Felipe Contreras

unread,
Oct 25, 2009, 3:31:19 PM10/25/09
to msn-...@googlegroups.com, Felipe Contreras, Devid Antonio Filoni, Víctor Manuel Jáquez Leal
And a few other cleanups.

Signed-off-by: Felipe Contreras <felipe.c...@gmail.com>
---
cvr/pn_peer_msg.c | 4 ++--
pn_oim.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/cvr/pn_peer_msg.c b/cvr/pn_peer_msg.c
index 92bcff0..31bfb9a 100644


--- a/cvr/pn_peer_msg.c
+++ b/cvr/pn_peer_msg.c
@@ -198,7 +198,7 @@ sip_new(struct pn_peer_call *call,
char *end;
end = strchr(body, '\r');
if (end)

- pn_info("send sip: %.*s", (gint) (end - body), body);
+ pn_info("send sip: %.*s", (int) (end - body), body);


}

body_len = strlen(body);
@@ -801,7 +801,7 @@ pn_sip_recv(struct pn_peer_link *link,
char *end;
end = strchr(body, '\r');
if (end)

- pn_info("recv sip: %.*s", (gint) (end - body), body);
+ pn_info("recv sip: %.*s", (int) (end - body), body);


}

if (strncmp(body, "INVITE", strlen("INVITE")) == 0) {

diff --git a/pn_oim.c b/pn_oim.c
index 7bde4fd..6faaabe 100644
--- a/pn_oim.c
+++ b/pn_oim.c


@@ -555,7 +555,7 @@ process_body_receive (OimRequest *oim_request,
gchar *cur;
guint32 date = 0;

- pn_debug("body=[%.*s]", (guint) length, body);
+ pn_debug("body=[%.*s]", (int) length, body);



/** @todo find a way to parse the date in win32 */
#ifndef G_OS_WIN32
@@ -600,7 +600,7 @@ process_body_delete (OimRequest *oim_request,
char *body,
gsize length)
{

- pn_debug("body=[%.*s]", (guint) length, body);
+ pn_debug("body=[%.*s]", (int) length, body);



if (strstr (body, "Schema validation error"))
pn_error ("deleting oim=[%s]: schema validation error", oim_request->message_id);
@@ -613,7 +613,7 @@ process_body_send (OimRequest *oim_request,
{
gchar *cur;

- pn_debug("body=[%.*s]", (guint) length, body);
+ pn_debug("body=[%.*s]", (int) length, body);



cur = strstr (body, "<LockKeyChallenge ");
if (cur)
@@ -675,7 +675,7 @@ process_body_auth (OimRequest *oim_request,
{
gchar *cur;

- pn_debug ("body=[%.*s]", (guint) length, body);
+ pn_debug ("body=[%.*s]", (int) length, body);



cur = strstr (body, "<wsse:BinarySecurityToken Id=\"PPToken1\">");
if (cur)
--

1.6.5.1

Felipe Contreras

unread,
Oct 25, 2009, 3:53:13 PM10/25/09
to Víctor M. Jáquez L., msn-...@googlegroups.com, Devid Antonio Filoni
2009/10/25 Víctor M. Jáquez L. <vja...@igalia.com>:
> On Sun, Oct 25, 2009 at 09:31:19PM +0200, Felipe Contreras wrote:
>> And a few other cleanups.
>
> Ack. My compiler didn't complain either with the int patch.

My compiler (gcc) didn't complain either, I decided to try clang for
mere curiosity :)

Anyway, both patches pushed.

--
Felipe Contreras

Víctor M. Jáquez L.

unread,
Oct 25, 2009, 3:37:01 PM10/25/09
to Felipe Contreras, msn-...@googlegroups.com, Devid Antonio Filoni
On Sun, Oct 25, 2009 at 09:31:19PM +0200, Felipe Contreras wrote:
> And a few other cleanups.

Ack. My compiler didn't complain either with the int patch.

Thanks.

vmjl

Víctor M. Jáquez L.

unread,
Oct 25, 2009, 3:32:03 PM10/25/09
to Felipe Contreras, msn-...@googlegroups.com
Oops.. but my compiler didn't complain at all. Did you already push it?

vmjl
Reply all
Reply to author
Forward
0 new messages