Skip Menu |

This queue is for tickets about the IO-Unread CPAN distribution.

Report information
The Basics
Id: 57775
Status: resolved
Priority: 0/
Queue: IO-Unread

People
Owner: Nobody in particular
Requestors: IKEGAMI [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Three problems manifesting with ActivePerl+MSVC
Attached is a patch that fixes the following three issues: 1. IO::Unread incorrectly assumes SSize_t is ssize_t. This prevents IO::Unread from compiling in certain environments. Fixed by switching the type of unread's return value to IV. 2. IO::Unread uses parts of Perl outside of its public interface. This prevents IO::Unread from linking in certain environments. Fixed by copying the private parts of Perl used into Unread.xs. 3. IO::Unread causes the declaration of a variable that's never used. This causes IO::Unread to issue a compiler warning in certain environments. Fixed by declaring the return type of the check_fh as void.
Subject: Unread.xs.diff
--- orig/Unread.xs 2010-05-22 23:50:48.000000000 -0700 +++ new/Unread.xs 2010-05-22 23:50:54.000000000 -0700 @@ -15,6 +15,22 @@ # endif #endif +static void +report_evil_output_fh(pTHX_ const GV *gv, const IO *io) +{ + if (ckWARN(WARN_IO)) { + const char * const name = gv && isGV(gv) ? GvENAME(gv) : NULL; + if (name && *name) + Perl_warner(aTHX_ packWARN(WARN_IO), + "Filehandle %s opened only for output", + name); + else + Perl_warner(aTHX_ packWARN(WARN_IO), + "Filehandle opened only for output"); + } +} + + MODULE = IO::Unread PACKAGE = IO::Unread PROTOTYPES: ENABLE @@ -26,7 +42,7 @@ newCONSTSUB(NULL, "IO::Unread::HAVE_PERLIO_LAYERS", &PL_sv_no); #endif -SV * +void _check_fh (SV *rv) CODE: { @@ -36,14 +52,13 @@ if(!io) XSRETURN_UNDEF; if (IoTYPE(io) == IoTYPE_WRONLY) { - if (ckWARN(WARN_IO)) - Perl_report_evil_fh(aTHX_ gv, io, OP_phoney_OUTPUT_ONLY); + report_evil_output_fh(aTHX_ gv, io); XSRETURN_NO; } XSRETURN_YES; } -ssize_t +IV _PerlIO_unread (PerlIO *io, SV *str) PROTOTYPE: *$ CODE:
Thank you for the report (and sorry for taking a while to respond). I've just uploaded 1.05 which should fix these problems (I didn't use exactly your patch, for various reasons). Ben