Skip to content

Commit

Permalink
Use %p as specifier of (void *) pointers
Browse files Browse the repository at this point in the history
Thanks to Richard Kettlewell for the suggestion of fix.
  • Loading branch information
Julien-Elie committed Dec 9, 2023
1 parent bb5fcb4 commit 4d14fca
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 27 deletions.
4 changes: 2 additions & 2 deletions innd/icd.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ ICDwriteactive(void)
{
#ifdef HAVE_MMAP
if (inn_msync_page(ICDactpointer, ICDactsize, MS_ASYNC) < 0) {
syslog(L_FATAL, "%s msync failed %s 0x%lx %d %m", LogName, ICDactpath,
(unsigned long) ICDactpointer, ICDactsize);
syslog(L_FATAL, "%s msync failed %s 0x%p %d %m", LogName, ICDactpath,
(void *) ICDactpointer, ICDactsize);
exit(1);
}
#else /* !HAVE_MMAP */
Expand Down
7 changes: 4 additions & 3 deletions innfeed/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ newBuffer(size_t size)
gBufferList = nb;

#if defined(INNFEED_DEBUG)
d_printf(1, "Creating a DELETABLE buffer %p\n", nb);
d_printf(1, "Creating a DELETABLE buffer %p\n", (void *) nb);
#endif

return nb;
Expand Down Expand Up @@ -120,7 +120,7 @@ newBufferByCharP(const char *ptr, size_t size, size_t dataSize)

bufferCount++;
#if defined(INNFEED_DEBUG)
d_printf(1, "Creating a NON-DELETABLE buffer %p\n", nb);
d_printf(1, "Creating a NON-DELETABLE buffer %p\n", (void *) nb);
#endif

return nb;
Expand All @@ -133,7 +133,8 @@ delBuffer(Buffer buff)
if (buff != NULL && --(buff->refCount) == 0) {
#if defined(INNFEED_DEBUG)
d_printf(1, "Freeing a %s buffer (%p)\n",
(buff->deletable ? "DELETABLE" : "NON-DELETABLE"), buff);
(buff->deletable ? "DELETABLE" : "NON-DELETABLE"),
(void *) buff);
#endif

bufferCount--;
Expand Down
38 changes: 16 additions & 22 deletions nnrpd/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,15 +822,13 @@ bio_dump_cb(BIO *bio, int cmd, const char *argp, int argi, long argl UNUSED,
return (ret);

if (cmd == (BIO_CB_READ | BIO_CB_RETURN)) {
syslog(L_NOTICE, "read from %08lX [%08lX] (%d bytes => %ld (0x%lX))",
(unsigned long) bio, (unsigned long) argp, argi, ret,
(unsigned long) ret);
syslog(L_NOTICE, "read from %p [%p] (%d bytes => %ld (0x%lX))",
(void *) bio, (void *) argp, argi, ret, (unsigned long) ret);
tls_dump(argp, (int) ret);
return (ret);
} else if (cmd == (BIO_CB_WRITE | BIO_CB_RETURN)) {
syslog(L_NOTICE, "write to %08lX [%08lX] (%d bytes => %ld (0x%lX))",
(unsigned long) bio, (unsigned long) argp, argi, ret,
(unsigned long) ret);
syslog(L_NOTICE, "write to %p [%p] (%d bytes => %ld (0x%lX))",
(void *) bio, (void *) argp, argi, ret, (unsigned long) ret);
tls_dump(argp, (int) ret);
}
return (ret);
Expand All @@ -845,29 +843,25 @@ bio_dump_cb(BIO *bio, int cmd, const char *argp, size_t len, int argi UNUSED,

if (cmd == (BIO_CB_READ | BIO_CB_RETURN)) {
if (ret > 0 && processed != NULL) {
syslog(
L_NOTICE, "read from %08lX [%08lX] (%lu bytes => %lu (0x%lX))",
(unsigned long) bio, (unsigned long) argp, (unsigned long) len,
(unsigned long) *processed, (unsigned long) *processed);
syslog(L_NOTICE, "read from %p [%p] (%lu bytes => %lu (0x%lX))",
(void *) bio, (void *) argp, (unsigned long) len,
(unsigned long) *processed, (unsigned long) *processed);
tls_dump(argp, (int) *processed);
} else {
syslog(L_NOTICE,
"read from %08lX [%08lX] (%lu bytes => %d (0x%lX))",
(unsigned long) bio, (unsigned long) argp,
(unsigned long) len, ret, (unsigned long) ret);
syslog(L_NOTICE, "read from %p [%p] (%lu bytes => %d (0x%lX))",
(void *) bio, (void *) argp, (unsigned long) len, ret,
(unsigned long) ret);
}
} else if (cmd == (BIO_CB_WRITE | BIO_CB_RETURN)) {
if (ret > 0 && processed != NULL) {
syslog(
L_NOTICE, "write to %08lX [%08lX] (%lu bytes => %lu (0x%lX))",
(unsigned long) bio, (unsigned long) argp, (unsigned long) len,
(unsigned long) *processed, (unsigned long) *processed);
syslog(L_NOTICE, "write to %p [%p] (%lu bytes => %lu (0x%lX))",
(void *) bio, (void *) argp, (unsigned long) len,
(unsigned long) *processed, (unsigned long) *processed);
tls_dump(argp, (int) *processed);
} else {
syslog(L_NOTICE,
"write to %08lX [%08lX] (%lu bytes => %d (0x%lX))",
(unsigned long) bio, (unsigned long) argp,
(unsigned long) len, ret, (unsigned long) ret);
syslog(L_NOTICE, "write to %p [%p] (%lu bytes => %d (0x%lX))",
(void *) bio, (void *) argp, (unsigned long) len, ret,
(unsigned long) ret);
}
}
return (ret);
Expand Down

0 comments on commit 4d14fca

Please sign in to comment.