Skip to content

Commit

Permalink
samples: net: http_get: Fix format string issue
Browse files Browse the repository at this point in the history
This issue is seen by at least gcc 11.4.0

samples/net/sockets/http_get/src/http_get.c:44:40: warning:
 format ‘%d’ expects argument of type ‘int’, but argument 2
 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
   44 | #define CHECK(r) { if (r < 0) {
      |                          printf("Error: %d\n", r); exit(1); } }
      |                                 ^~~~~~~~~~~~~
samples/net/sockets/http_get/src/http_get.c:44:49: note: format string is
 defined here
   44 | #define CHECK(r) { if (r < 0) {
                                 printf("Error: %d\n", r); exit(1); } }
      |                                         ~^
      |                                          |
      |                                          int
      |                                          %ld

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
  • Loading branch information
jukkar authored and kartben committed Jan 28, 2025
1 parent 2c3294b commit b80a058
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion samples/net/sockets/http_get/src/http_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#define HTTP_PATH "/"

#define SSTRLEN(s) (sizeof(s) - 1)
#define CHECK(r) { if (r < 0) { printf("Error: %d\n", r); exit(1); } }
#define CHECK(r) { if (r < 0) { printf("Error: %d\n", (int)r); exit(1); } }

#define REQUEST "GET " HTTP_PATH " HTTP/1.1\r\nHost: " HTTP_HOST "\r\n\r\n"

Expand Down

0 comments on commit b80a058

Please sign in to comment.