Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Remove uint64_t format specifier warnings #216

Merged
merged 1 commit into from

2 participants

@blutack

There are format build warnings present with GCC 4.8.1 on Linux.

src/core/global.c: In function ‘nn_global_submit_counter’:
src/core/global.c:904:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
             s->socket_name, name, value);
             ^
src/core/global.c:919:17: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 8 has type ‘uint64_t’ [-Wformat=]
                 timebuf, value);
                 ^
src/core/global.c:923:17: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 8 has type ‘uint64_t’ [-Wformat=]
                 timebuf, value);
                 ^

This patch explicitly casts 'value' to match the format specifier, and results in a clean build.

@blutack blutack Remove unit64_t format specifier warnings
Explicitly cast to long long unsigned int to remove build warnings.
2be1dfd
@tailhook
Owner

Patch seems ok. Can you state that the patch is submitted under MIT license?

@tailhook
Owner

Also what name should I add to the AUTHORS file?

@blutack

I hereby state that this patch is submitted under the MIT license.
If it's worth adding to AUTHORS for such a trivial fix, could you pop it under Gareth Roberts, blutack at gmail please?

@tailhook tailhook merged commit a3eecd8 into nanomsg:master
@tailhook
Owner

Applied. Thanks!

@blutack

You're welcome. Nanomsg is fantastic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 13, 2014
  1. @blutack

    Remove unit64_t format specifier warnings

    blutack authored
    Explicitly cast to long long unsigned int to remove build warnings.
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/core/global.c
View
6 src/core/global.c
@@ -901,7 +901,7 @@ static void nn_global_submit_counter (int i, struct nn_sock *s,
if(self.print_statistics) {
fprintf(stderr, "nanomsg: socket.%s: %s: %llu\n",
- s->socket_name, name, value);
+ s->socket_name, name, (long long unsigned int)value);
}
if (self.statistics_socket >= 0) {
@@ -916,11 +916,11 @@ static void nn_global_submit_counter (int i, struct nn_sock *s,
if(*s->socket_name) {
len = sprintf (buf, "ESTP:%s:%s:socket.%s:%s: %sZ 10 %llu:c",
self.hostname, self.appname, s->socket_name, name,
- timebuf, value);
+ timebuf, (long long unsigned int)value);
} else {
len = sprintf (buf, "ESTP:%s:%s:socket.%d:%s: %sZ 10 %llu:c",
self.hostname, self.appname, i, name,
- timebuf, value);
+ timebuf, (long long unsigned int)value);
}
nn_assert (len < (int)sizeof(buf));
(void) nn_send (self.statistics_socket, buf, len, NN_DONTWAIT);
Something went wrong with that request. Please try again.