develooper Front page | perl.perl5.porters | Postings from March 2001

[PATCH perl@9424] printf warning

From:
Robin Barker
Date:
March 29, 2001 04:29
Subject:
[PATCH perl@9424] printf warning
Message ID:
200103291229.NAA03968@tempest.npl.co.uk
Patch to correct printf warning detected with -DCHECK_FORMAT

patch was against perl@9359 but applies cleanly over perl@9424

Robin

--- dump.c.orig	Fri Mar  9 22:09:57 2001
+++ dump.c	Wed Mar 28 18:58:24 2001
@@ -195,7 +195,7 @@
 	unref++;
     }
     else if (DEBUG_R_TEST && SvREFCNT(sv) > 1) {
-	Perl_sv_catpvf(aTHX_ t, "<%u>", SvREFCNT(sv));
+	Perl_sv_catpvf(aTHX_ t, "<%"UVuf">", (UV)SvREFCNT(sv));
     }
 
 
--- toke.c.orig	Sun Mar 25 18:24:54 2001
+++ toke.c	Wed Mar 28 18:58:00 2001
@@ -187,7 +187,8 @@
     SV *report;
     DEBUG_T({
         report = newSVpv(thing, 0);
-        Perl_sv_catpvf(aTHX_ report, ":line %i:%i:", CopLINE(PL_curcop), rv);
+        Perl_sv_catpvf(aTHX_ report, ":line %d:%"IVdf":", CopLINE(PL_curcop),
+		(IV)rv);
 
         if (s - PL_bufptr > 0)
             sv_catpvn(report, PL_bufptr, s - PL_bufptr);
--- ext/Data/Dumper/Dumper.xs.orig	Wed Mar 21 20:25:02 2001
+++ ext/Data/Dumper/Dumper.xs	Wed Mar 28 19:03:23 2001
@@ -128,7 +128,7 @@
 	    r[j++] = '\\';
 	    r[j++] = 'x';
 	    r[j++] = '{';
-	    j += sprintf(r + j, "%x", k);
+	    j += sprintf(r + j, "%"UVxf, k);
 	    r[j++] = '}';
 	    dquote = TRUE;
 	}
--- ext/Encode/Encode.xs.orig	Sun Mar 25 23:23:41 2001
+++ ext/Encode/Encode.xs	Wed Mar 28 19:03:45 2001
@@ -97,7 +97,7 @@
   {
    e->enc = Nullsv;
    errno  = EINVAL;
-   Perl_warner(aTHX_ WARN_IO, "Cannot find encoding \"%_\"", arg);
+   Perl_warner(aTHX_ WARN_IO, "Cannot find encoding \"%"SVf"\"", arg);
    return -1;
   }
  SvREFCNT_inc(e->enc);
--- ext/Storable/Storable.xs.orig	Fri Mar 16 14:08:07 2001
+++ ext/Storable/Storable.xs	Wed Mar 28 19:13:03 2001
@@ -3086,7 +3086,8 @@
 
 	sva = av_fetch(cxt->aclass, idx, FALSE);
 	if (!sva)
-		CROAK(("Class name #%d should have been seen already", idx));
+		CROAK(("Class name #%"IVdf" should have been seen already",
+			(IV)idx));
 
 	class = SvPVX(*sva);	/* We know it's a PV, by construction */
 
@@ -3281,7 +3282,8 @@
 
 		sva = av_fetch(cxt->aclass, idx, FALSE);
 		if (!sva)
-			CROAK(("Class name #%d should have been seen already", idx));
+		    CROAK(("Class name #%"IVdf" should have been seen already", 
+			    (IV)idx));
 
 		class = SvPVX(*sva);	/* We know it's a PV, by construction */
 		TRACEME(("class ID %d => %s", idx, class));
@@ -3382,7 +3384,7 @@
 			tag = ntohl(tag);
 			svh = av_fetch(cxt->aseen, tag, FALSE);
 			if (!svh)
-				CROAK(("Object #%d should have been retrieved already", tag));
+				CROAK(("Object #%"IVdf" should have been retrieved already", (IV)tag));
 			xsv = *svh;
 			ary[i] = SvREFCNT_inc(xsv);
 		}
@@ -4532,7 +4534,7 @@
 			I32 tagn;
 			svh = hv_fetch(cxt->hseen, (char *) &tag, sizeof(tag), FALSE);
 			if (!svh)
-				CROAK(("Old tag 0x%x should have been mapped already", tag));
+				CROAK(("Old tag 0x%"UVxf" should have been mapped already", (UV)tag));
 			tagn = SvIV(*svh);	/* Mapped tag number computed earlier below */
 
 			/*
@@ -4541,7 +4543,7 @@
 
 			svh = av_fetch(cxt->aseen, tagn, FALSE);
 			if (!svh)
-				CROAK(("Object #%d should have been retrieved already", tagn));
+				CROAK(("Object #%"IVdf" should have been retrieved already", (IV)tagn));
 			sv = *svh;
 			TRACEME(("has retrieved #%d at 0x%"UVxf, tagn, PTR2UV(sv)));
 			SvREFCNT_inc(sv);	/* One more reference to this same sv */
@@ -4582,7 +4584,8 @@
 		tag = ntohl(tag);
 		svh = av_fetch(cxt->aseen, tag, FALSE);
 		if (!svh)
-			CROAK(("Object #%d should have been retrieved already", tag));
+		    CROAK(("Object #%"IVdf" should have been retrieved already",
+			    (IV)tag));
 		sv = *svh;
 		TRACEME(("had retrieved #%d at 0x%"UVxf, tag, PTR2UV(sv)));
 		SvREFCNT_inc(sv);	/* One more reference to this same sv */

-- 
Robin Barker                        | Email: Robin.Barker@npl.co.uk
CMSC, Building 10,                  | Phone: +44 (0) 20 8943 7090
National Physical Laboratory,       | Fax:   +44 (0) 20 8977 7091
Teddington, Middlesex, UK. TW11 OLW | WWW:   http://www.npl.co.uk



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About