summaryrefslogtreecommitdiff
path: root/ext/Data
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2006-07-24 17:30:38 +0000
committerSteve Peters <steve@fisharerojo.org>2006-07-24 17:30:38 +0000
commit258f5789675fecd0938621313c9be14e88da9ad4 (patch)
tree17c715face3ac063a2f665303abdec9b904b211f /ext/Data
parent3a76ca8818b782f5517982af5ac3381a6a3eb189 (diff)
downloadperl-258f5789675fecd0938621313c9be14e88da9ad4.tar.gz
Replace some sprintf()'s in Data::Dumper with my_snprintf()'s
p4raw-id: //depot/perl@28614
Diffstat (limited to 'ext/Data')
-rw-r--r--ext/Data/Dumper/Dumper.xs13
1 files changed, 7 insertions, 6 deletions
diff --git a/ext/Data/Dumper/Dumper.xs b/ext/Data/Dumper/Dumper.xs
index 0c62250c54..85612163fd 100644
--- a/ext/Data/Dumper/Dumper.xs
+++ b/ext/Data/Dumper/Dumper.xs
@@ -2,6 +2,7 @@
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
+#include "ppport.h"
static I32 num_q (const char *s, STRLEN slen);
static I32 esc_q (char *dest, const char *src, STRLEN slen);
@@ -192,7 +193,7 @@ esc_q_utf8(pTHX_ SV* sv, register const char *src, register STRLEN slen)
* then strlen(buffer) for the length. The more proper way
* would of course be to figure out the prototype of sprintf.
* --jhi */
- sprintf(r, "\\x{%"UVxf"}", k);
+ sprintf(r, "\\x{%"UVxf"}", k);
r += strlen(r);
}
}
@@ -296,7 +297,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv,
ival = SvRV(val);
realtype = SvTYPE(ival);
- (void) sprintf(id, "0x%"UVxf, PTR2UV(ival));
+ (void) my_snprintf(id, sizeof(id), "0x%"UVxf, PTR2UV(ival));
idlen = strlen(id);
if (SvOBJECT(ival))
realpack = HvNAME_get(SvSTASH(ival));
@@ -775,7 +776,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv,
STRLEN i;
if (namelen) {
- (void) sprintf(id, "0x%"UVxf, PTR2UV(val));
+ (void) my_snprintf(id, sizeof(id), "0x%"UVxf, PTR2UV(val));
if ((svp = hv_fetch(seenhv, id, (idlen = strlen(id)), FALSE)) &&
(sv = *svp) && SvROK(sv) &&
(seenentry = (AV*)SvRV(sv)))
@@ -804,9 +805,9 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv,
if (DD_is_integer(val)) {
STRLEN len;
if (SvIsUV(val))
- (void) sprintf(tmpbuf, "%"UVuf, SvUV(val));
+ (void) my_snprintf(tmpbuf, sizeof(tmpbuf), "%"UVuf, SvUV(val));
else
- (void) sprintf(tmpbuf, "%"IVdf, SvIV(val));
+ (void) my_snprintf(tmpbuf, sizeof(tmpbuf), "%"IVdf, SvIV(val));
len = strlen(tmpbuf);
if (SvPOK(val)) {
/* Need to check to see if this is a string such as " 0".
@@ -1092,7 +1093,7 @@ Data_Dumper_Dumpxs(href, ...)
STRLEN nchars;
sv_setpvn(name, "$", 1);
sv_catsv(name, varname);
- (void) sprintf(tmpbuf, "%"IVdf, (IV)(i+1));
+ (void) my_snprintf(tmpbuf, sizeof(tmpbuf), "%"IVdf, (IV)(i+1));
nchars = strlen(tmpbuf);
sv_catpvn(name, tmpbuf, nchars);
}