diff options
author | Robin Barker <RMBarker@cpan.org> | 2002-07-09 21:03:40 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-07-09 18:49:20 +0000 |
commit | f13a2bc0291ac6766d77bda1b46c5921237360c9 (patch) | |
tree | d80d7cb46018abbba9cadc5dac332e371d3ab22d /ext/Data | |
parent | b31b80f9d91ded188b47dd78c18a0a1effe2584d (diff) | |
download | perl-f13a2bc0291ac6766d77bda1b46c5921237360c9.tar.gz |
5.8.0-RC1 on SunOS 4!
Message-Id: <200207091903.UAA09531@tempest.npl.co.uk>
(the sprintf() spot in Dumper.xs fixed)
p4raw-id: //depot/perl@17450
Diffstat (limited to 'ext/Data')
-rw-r--r-- | ext/Data/Dumper/Dumper.xs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/Data/Dumper/Dumper.xs b/ext/Data/Dumper/Dumper.xs index a129c3fe02..63b0f79f86 100644 --- a/ext/Data/Dumper/Dumper.xs +++ b/ext/Data/Dumper/Dumper.xs @@ -152,7 +152,16 @@ esc_q_utf8(pTHX_ SV* sv, register char *src, register STRLEN slen) else if (k < 0x80) *r++ = (char)k; else { - r += sprintf(r, "\\x{%"UVxf"}", k); + /* The return value of sprintf() is unportable. + * In modern systems it returns (int) the number of characters, + * but in older systems it might return (char*) the original + * buffer, or it might even be (void). The easiest portable + * thing to do is probably use sprintf() in void context and + * 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); + r += strlen(r); } } *r++ = '"'; |