Created
August 17, 2010 04:38
-
-
Save clkao/528487 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/perl/FCGI.XL b/perl/FCGI.XL | |
index 5bd85fa..24e9504 100644 | |
--- a/perl/FCGI.XL | |
+++ b/perl/FCGI.XL | |
@@ -38,6 +38,13 @@ __END__ | |
#define INT2PTR(a,b) ((a) (b)) | |
#endif | |
+#define WARN_WC | |
+ | |
+#ifdef WARN_WC | |
+static int wc_warned; | |
+#endif | |
+ | |
+ | |
#ifdef USE_SFIO | |
typedef struct | |
{ | |
@@ -533,6 +540,8 @@ MODULE = FCGI PACKAGE = FCGI::Stream | |
#ifndef USE_SFIO | |
+ | |
+ | |
SV * | |
PRINT(stream, ...) | |
FCGI::Stream stream; | |
@@ -547,8 +556,12 @@ PRINT(stream, ...) | |
for (n = 1; ok && n < items; ++n) { | |
#ifdef DO_UTF8 | |
if (DO_UTF8(ST(n)) && !sv_utf8_downgrade(ST(n), 1)) | |
+#ifdef WARN_WC | |
+ if (!wc_warned++) warn("Wide character in FCGI::Stream::PRINT"); | |
+#else | |
croak("Wide character in FCGI::Stream::PRINT"); | |
#endif | |
+#endif | |
str = (char *)SvPV(ST(n),len); | |
if (FCGX_PutStr(str, len, stream) < 0) | |
ok = FALSE; | |
@@ -577,8 +590,12 @@ WRITE(stream, bufsv, len, ...) | |
offset = (items == 4) ? (int)SvIV(ST(3)) : 0; | |
#ifdef DO_UTF8 | |
if (DO_UTF8(bufsv) && !sv_utf8_downgrade(bufsv, 1)) | |
+#ifdef WARN_WC | |
+ if (!wc_warned++) warn("Wide character in FCGI::Stream::WRITE"); | |
+#else | |
croak("Wide character in FCGI::Stream::WRITE"); | |
#endif | |
+#endif | |
buf = SvPV(bufsv, blen); | |
if (offset < 0) offset += blen; | |
if (len > blen - offset) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment