]> diplodocus.org Git - nmh/commitdiff
Print pointers in debug with C99's `%p' rather than `0x%x'.
authorRalph Corderoy <ralph@inputplus.co.uk>
Fri, 25 Aug 2017 21:36:01 +0000 (22:36 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sat, 26 Aug 2017 07:36:01 +0000 (08:36 +0100)
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)'.

uip/mhlistsbr.c
uip/mhlsbr.c

index 48a5a7941bdb264db03207e30b5a0f2612efa960..968229c6641e5f14fcdd8c717b7630ec9daffc46 100644 (file)
@@ -269,9 +269,8 @@ list_debug (CT ct)
                 get_param_value(pm, '?'));
 
     /* print internal flags for type/subtype */
                 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));
 
     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, "  %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)
 
     /* print Content-ID */
     if (ct->c_id)
index 00e1ef265d8b175331028b5fe16a664fdc600c38..550af6144af2e0c53dc6e1c9584b213ffda64810 100644 (file)
@@ -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, "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);
            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);