From: Ralph Corderoy Date: Fri, 25 Aug 2017 21:36:01 +0000 (+0100) Subject: Print pointers in debug with C99's `%p' rather than `0x%x'. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/e605596f06f250775f89ddfe3f7f2c8fcfda1c4e?hp=07916b2ff52cb94f26d6e09867c086d0da3c6433 Print pointers in debug with C99's `%p' rather than `0x%x'. The `%x' needed a double cast, the `%p' needs just a single to void pointer. The output can differ, e.g. `0x0' v. perhaps implementation-defined `(nil)'. --- diff --git a/uip/mhlistsbr.c b/uip/mhlistsbr.c index 48a5a794..968229c6 100644 --- a/uip/mhlistsbr.c +++ b/uip/mhlistsbr.c @@ -269,9 +269,8 @@ list_debug (CT ct) get_param_value(pm, '?')); /* print internal flags for type/subtype */ - fprintf (stderr, " type %#x subtype %#x params 0x%x\n", - ct->c_type, ct->c_subtype, - (unsigned int)(unsigned long) ct->c_ctparams); + fprintf(stderr, " type %#x subtype %#x params %p\n", + ct->c_type, ct->c_subtype, (void *)ct->c_ctparams); fprintf (stderr, " showproc \"%s\"\n", FENDNULL(ct->c_showproc)); fprintf (stderr, " termproc \"%s\"\n", FENDNULL(ct->c_termproc)); @@ -282,8 +281,8 @@ list_debug (CT ct) fprintf (stderr, " %s:%s", ENCODING_FIELD, ct->c_celine); /* print internal flags for transfer encoding */ - fprintf (stderr, " transfer encoding %#x params 0x%x\n", - ct->c_encoding, (unsigned int)(unsigned long) &ct->c_cefile); + fprintf(stderr, " transfer encoding %#x params %p\n", + ct->c_encoding, (void *)&ct->c_cefile); /* print Content-ID */ if (ct->c_id) diff --git a/uip/mhlsbr.c b/uip/mhlsbr.c index 00e1ef26..550af614 100644 --- a/uip/mhlsbr.c +++ b/uip/mhlsbr.c @@ -666,9 +666,8 @@ mhl_format (char *file, int length, int width) fprintf (stderr, "c1: name=\"%s\" text=\"%s\" ovtxt=\"%s\"\n", c1->c_name, c1->c_text, c1->c_ovtxt); - fprintf (stderr, "\tnfs=0x%x fmt=0x%x\n", - (unsigned int)(unsigned long) c1->c_nfs, - (unsigned int)(unsigned long) c1->c_fmt); + fprintf(stderr, "\tnfs=%p fmt=%p\n", + (void *)c1->c_nfs, (void *)c1->c_fmt); fprintf (stderr, "\toffset=%d ovoff=%d width=%d cwidth=%d length=%d\n", c1->c_offset, c1->c_ovoff, c1->c_width, c1->c_cwidth, c1->c_length);