lib: Fix compile warnings with zlog_hexdump

When using zlog_hexdump tell the compiler that we don't expect
to actually change the memory.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2016-05-25 19:14:36 -04:00
parent c8ae3ce8b6
commit a9b5cbe55a
2 changed files with 5 additions and 5 deletions

View File

@ -992,7 +992,7 @@ proto_redistnum(int afi, const char *s)
}
void
zlog_hexdump (void *mem, unsigned int len) {
zlog_hexdump (const void *mem, unsigned int len) {
unsigned long i = 0;
unsigned int j = 0;
unsigned int columns = 8;
@ -1007,7 +1007,7 @@ zlog_hexdump (void *mem, unsigned int len) {
/* print hex data */
if (i < len)
s += sprintf(s, "%02x ", 0xFF & ((char*)mem)[i]);
s += sprintf(s, "%02x ", 0xFF & ((const char*)mem)[i]);
/* end of block, just aligning for ASCII dump */
else
@ -1021,8 +1021,8 @@ zlog_hexdump (void *mem, unsigned int len) {
if (j >= len) /* end of block, not really printing */
s += sprintf(s, " ");
else if(isprint((int)((char*)mem)[j])) /* printable char */
s += sprintf(s, "%c", 0xFF & ((char*)mem)[j]);
else if(isprint((int)((const char *)mem)[j])) /* printable char */
s += sprintf(s, "%c", 0xFF & ((const char *)mem)[j]);
else /* other char */
s += sprintf(s, ".");

View File

@ -176,7 +176,7 @@ extern void zlog_backtrace_sigsafe(int priority, void *program_counter);
extern size_t quagga_timestamp(int timestamp_precision /* # subsecond digits */,
char *buf, size_t buflen);
extern void zlog_hexdump(void *mem, unsigned int len);
extern void zlog_hexdump(const void *mem, unsigned int len);
/* structure useful for avoiding repeated rendering of the same timestamp */
struct timestamp_control {