summaryrefslogtreecommitdiff
path: root/ext/PerlIO-encoding
Commit message (Collapse)AuthorAgeFilesLines
* Remove all "configured without perlio" test SKIPs from ext/PerlIO-*Nicholas Clark2021-09-162-9/+2
| | | | Also fix one skip that should have been for B, not PerlIO.
* encoding.xs - silence unused var warningsYves Orton2021-02-121-1/+0
| | | | | in 370c6ab2e9608a94096854c61d976ccf65bb2c13 logic to set PerlIO::encoding::fallback in encoding.xs was removed, but this var was missed in the cleanup.
* PerlIO-encoding - add parens to silence build warningsYves Orton2021-02-122-2/+2
|
* Force disable LEAVE_SRC in $PerlIO::encoding::fallbackLeon Timmermans2021-01-301-1/+12
| | | | | | Setting $PerlIO::encoding::fallback to any value containing LEAVE_SRC will result in an infinite loop of the first buffer of input. This is never desirable.
* Omit setting of $PerlIO::encoding::fallback from xsLeon Timmermans2021-01-301-13/+1
| | | | It's also set from encoding.pm, doing it double serves no purpose
* Disallow coderef in $PerlIO::encoding::fallbackLeon Timmermans2021-01-301-0/+2
| | | | | | | | Encode allows one to pass a coderef instead of a set of flags to handle. This however doesn't allow one to pass STOP_AT_PARTIAL, which means it has always been buggy on buffer boundaries. With my new automatic STOP_AT_PARTIAL passing this would result in an unpredictable value. Instead we now disallow it in PerlIO::encoding.
* Enforce STOP_AT_PARTIAL in $PerlIO::encoding::fallbackLeon Timmermans2021-01-302-3/+17
| | | | | | | | | | | | PerlIO::encoding has a $fallback variable that allows one to set the behavior on a encoding/decoding error, for example to make it throw an exception on error. What is not documented (actually the example in the documentation is even missing this) is that PerlIO::encoding needs the (equally undocumented) Encode::STOP_AT_PARTIAL flag to be set, otherwise a multi-byte character spanning buffer boundaries will be interpreted as two invalid byte sequences. I could have fixed the documentation, but instead I fixed the code to always pass this flag to Encode, simplifying the use and making the current documentation correct again.
* PerlIO-encoding/t/encoding.t: improve test skipDavid Mitchell2019-07-111-5/+2
| | | | | | | | | One test is skipped if $PERL_DESTRUCT_LEVEL is set and its a DEBUGGING build, as it produces a spurious "Unbalanced string table" warning. However, this warning is emitted on non-DEBUGGING builds too: It's just that until a couple of weeks ago, $PERL_DESTRUCT_LEVEL wasn't honoured on non-DEBUGGING builds, so this was never spotted.
* Fix "it it" typosDagfinn Ilmari Mannsåker2019-07-042-2/+2
| | | | And regen affected files
* bump $PerlIO::encoding::VERSIONTony Cook2019-02-251-1/+1
|
* (perl #131683) enable warnings for the block that tests for warningsTony Cook2019-02-251-0/+1
|
* PerlIO::encoding: Use Encode::ONLY_PRAGMA_WARNINGS in fallback by defaultPali2019-02-251-1/+1
| | | | | This would enable to respect utf8 warnings enabled/disabled by pramga warnings when processing filehandle with :encoding layer.
* don't clobber file bytes in :encoding layerZefram2018-02-163-35/+22
| | | | | | | | | | | The PerlIO::encoding layer, when used on input, was creating an SvLEN==0 scalar pointing into the byte buffer, to pass to the ->decode method of the encoding object. Since the method mutates this scalar, for some encodings this led to mutating the byte buffer, and depending on where it came from that might be something visible elsewhere that should not be mutated. Remove the code for the SvLEN==0 scalar, instead always using the alternate code that would copy the bytes into a separate buffer owned by the scalar. Fixes [perl #132833].
* Switch most open() calls to three-argument form.John Lightsey2016-12-232-8/+8
| | | | | | | | | | Switch from two-argument form. Filehandle cloning is still done with the two argument form for backward compatibility. Committer: Get all porting tests to pass. Increment some $VERSIONs. Run: ./perl -Ilib regen/mk_invlists.pl; ./perl -Ilib regen/regcharclass.pl For: RT #130122
* ext/PerlIO-encoding: use SvPVCLEAR()Yves Orton2016-10-191-1/+1
|
* Change sv_setpvn(…, "…", …) to sv_setpvs(…, "…")Dagfinn Ilmari Mannsåker2016-09-212-2/+2
| | | | | The dual-life dists affected use Devel::PPPort, so can safely use sv_setpvs() even though it wasn't added until Perl v5.10.0.
* PerlIO-encoding/t/fallback.t: test for warningDavid Mitchell2016-06-211-7/+14
| | | | | | | The previous commit fixed a typo that had been present since this test script was created: WARN_ON_ERR misspelt as WARN_ON_ERROR. This means that one of the tests is now (correctly) issuing a warning. Rather than that spilling out onto STDERR, capture it and test it instead.
* Fix Encode constant name usage: WARN_ON_ERROR --> WARN_ON_ERRSalvador Fandino2016-06-211-1/+1
|
* PerlIO::encoding: explicitly cast char * to STDCHAR *Lukas Mai2016-01-312-3/+3
| | | | | This should avoid the "pointer targets in assignment differ in signedness" warning that pops up in some configurations.
* XS staticing in ext and distDaniel Dragan2015-10-262-12/+12
| | | | | | | None of these symbols are exported on Win32 (listed in Makefile.PL with EUMM's FUNCLIST), so they shouldn't be exported on Linux. Making them static saves space in the SOs by removing symbol name strings, and removing runtime plt/got indirection.
* Properly duplicate PerlIO::encoding objectsVincent Pit2015-10-083-3/+59
| | | | | | | | | | | | | | | | | | | | | PerlIO::encoding objects are usually initialized by calling Perl methods, essentially from the pushed() and getarg() callbacks. During cloning, the PerlIO API will by default call these methods to initialize the duplicate struct when the PerlIOBase parent struct is itself duplicated. This does not behave so well because the perl interpreter is not ready to call methods at this point, for the stacks are not set up yet. The proper way to duplicate the PerlIO::encoding object is to call sv_dup() on its members from the dup() PerlIO callback. So the only catch is to make the getarg() and pushed() calls implied by the duplication of the underlying PerlIOBase object aware that they are called during cloning, and make them wait that the control flow returns to the dup() callback. Fortunately, getarg() knows since its param argument is then non-null, and its return value is passed immediately to pushed(), so it is enough to tag this returned value with a custom magic so that pushed() can see it is being called during cloning. This fixes [RT #31923].
* ext/PerlIO-encoding/t/encoding.t: Skip on EBCDICKarl Williamson2015-03-141-0/+4
| | | | encoding doesn't current work.
* PerlIO-encoding/t/nolooping.t: Skip on EBCDIC platformKarl Williamson2015-03-141-4/+5
|
* PerlIO-encoding/t/encoding.t: Generalize for non-ASCII platformKarl Williamson2015-03-051-7/+4
|
* const a PERLIO vtable in PerlIO::encodingDaniel Dragan2015-01-052-3/+3
| | | | | This makes PerlIO::encoding's shared library free of any perl caused RW static data.
* PerlIO::encoding:fallback.t: properly skip testsKarl Williamson2014-12-111-1/+2
| | | | | My moving the 'use Test::More' outside of the BEGIN block, I don't get the 'duplicate leader seen' error.
* PerlIO::encoding:fallback.t: White-space onlyKarl Williamson2014-11-261-1/+1
|
* PerlIO::encoding:fallback.t: Don't use undefined subKarl Williamson2014-11-261-1/+4
| | | | skip_all isn't defined under Test::More.
* Increase $PerlIO::encoding::VERSION to 0.20Father Chrysostomos2014-11-021-1/+1
|
* Record errno value in IO handlesFather Chrysostomos2014-11-021-0/+3
|
* bump $VERSION for PerlIO-encoding, PerlIO-mmap, PerlIO-scalar, OS2-ProcessTony Cook2014-06-121-1/+1
|
* Change newSVpvn("…", …) to newSVpvs("…")Dagfinn Ilmari Mannsåker2014-06-121-1/+1
| | | | | The dual-life dists affected use Devel::PPPort, so can safely use newSVpvs() even though it wasn't added until Perl v5.8.9.
* Purge sfio support, which has been broken for a decade.Nicholas Clark2013-12-272-2/+2
| | | | | | | | | | | The last Perl release that built with -Dusesfio was v5.8.0, and even that failed many regression tests. Every subsequent release fails to build, and in the decade that has passed we have had no bug reports about this. So it's safe to delete all the code. The Configure related code will be purged in a subsequent commit. 2 references to sfio intentionally remain in fakesdio.h and nostdio.h, as these appear to be for using its stdio API-compatibility layer.
* No need to wrap calls to Perl_load_module() in ENTER/LEAVENicholas Clark2013-11-221-2/+0
| | | | | | As of commit 53a7735b62aee146 (May 2007) Perl_vload_module() wraps its call to Perl_utilize() with ENTER/LEAVE, so there's no longer a need for callers of Perl_load_module() to also wrap with ENTER/LEAVE.
* Perl_load_module() no longer moves the current stack, so no need to save it.Nicholas Clark2013-11-221-3/+1
|
* Remove redundant SPAGAIN & PUTBACK after PUSHSTACKi().Nicholas Clark2013-11-222-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PUSHSTACKi() calls SWITCHSTACK(), which sets PL_stack_sp and sp like this: sp = PL_stack_sp = PL_stack_base + AvFILLp(t) Hence after PUSHSTACKi() both are identical, so use of SPAGAIN or PUTBACK to assign one to the other is redundant. The use of SPAGAIN in encoding.xs and via.xs was added with commit 24f59afc531955e5 (April 2002) which added the use of PUSHSTACKi(). It feels like cargo-cult. The use of PUTBACK in Perl_amagic_call() predates the introduction of nested stacks and PUSHSTACKi() in commit e336de0d01f30cc4 (April 1998). It dates from perl 5.000, but it's not clear that it was ever needed, as the code in question looked like this, and nothing could have moved the stack between the dSP and PUTBACK: dSP; BINOP myop; SV* res; Zero(&myop, 1, BINOP); myop.op_last = (OP *) &myop; myop.op_next = Nullop; myop.op_flags = OPf_KNOW|OPf_STACKED; ENTER; SAVESPTR(op); op = (OP *) &myop; PUTBACK; The PUTBACK and SPAGAIN in Perl_require_pv() were added by commit d3acc0f7e5197310 (June 1998) which also added the PUSHSTACKi(). They have both been redundant since they were added.
* Remove some IGNORABLE files from ext/ and lib/Steve Hay2013-10-181-4/+0
| | | | | | | | | | | There is surely no point in having any of these modules' MANIFEST files in the core distribution, but other IGNORABLE files should generally stay in ext/ and lib/ in case they ever get dual-lived (and likewise for modules in dist/, which are already dual-lived and some of which include even MANIFEST files, presumably used to roll CPAN releases from). However, XS-APItest's README file and DBM_Filter's Changes file offer nothing useful, so remove them.
* encoding.t: Skip 2 tests under debuggingFather Chrysostomos2012-12-041-0/+10
|
* Make PerlIO::encoding handle cowsFather Chrysostomos2012-10-152-1/+32
| | | | | | | | | | Commits 667763bdbf and e9a8753af fixed bugs involving buffer realloca- tions during encode and decode. But what was not taken into account was that the COW flags could still be left on even when buffer real- ocations were accounted for. This could result in SvPV_set and SvLEN_set(sv,0) being called on an SV with the COW flags still on, so SvPVX would be treated as a key inside a shared_he, resulting in assertion failures.
* Make PerlIO::encoding even more resilient to moving buffersFather Chrysostomos2012-10-152-6/+13
| | | | | | | | | | | | Commit 667763bdbf was not good enough. If the buffer passed to an encode method is reallocated, it may be smaller than the size (bufsiz) stored inside the encoding layer. So we need to extend the buffer in that case and make sure the buffer pointer is not pointing to freed memory. The test as modified by this commit causes malloc errors on stderr when I try it without the encoding.xs changes.
* Increase $PerlIO::encoding::VERSION to 0.16Father Chrysostomos2012-10-051-1/+1
|
* Make PerlIO::encoding more resilient to buffer changesFather Chrysostomos2012-10-052-1/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I was trying to figure out why Encode’s perlio.t was sometimes failing under PERL_OLD_COPY_ON_WRITE (depending on the number of comments in the source code, or metereological conditions). I noticed that PerlIO::encoding assumes that the buffer passed to the encode method will come back SvPOKp. (It accesses SvCUR without checking any flags.) That means it can come back as a typeglob, reference, or undefined, and PerlIO::encoding won’t care. This can result in crashes. Assign- ing $_[1] = *foo inside an encode method is not a smart thing to do, but it shouldn’t crash. PerlIO::encoding was also assuming that SvPVX would not change between calls to encode. It is very easy to reallocate it. This means the internal buffer used by the encoding layer (which is owned by the SV buffer passed to the encode method) can be freed and still subse- quently written too, which is not good. This commit makes PerlIO::encoding force stringification of the value returned. If it does not match its internal buffer pointers, it resets them based on the buffer SV. This probably makes Encode pass its tests under PERL_OLD_COPY_ON_WRITE, but I have yet to confirm it. Encoding mod- ules are expected to write to the buffer ($_[1] = '') in certain cases. If COW is enabled, that would cause the buffer’s SvPVX to point to the same string as the rhs, which would explain why the lack of accounting for SvPVX changes caused test failures under PERL_OLD_COPY_ON_WRITE.
* Bump the version of PerlIO::encoding following 1c2e8ccaafb0b2b1.Nicholas Clark2011-05-201-1/+1
| | | | 1c2e8ccaafb0b2b1 fixed a typo in a comment in the XS code.
* [perl #90306] Fix simple typosMarcel Grünauer2011-05-191-2/+2
|
* Convert ext/PerlIO-encoding/t/encoding.t to Test::More.Nicholas Clark2010-12-171-75/+35
|
* Version bumps for modules changed by a6d37805ca8a9ba8 ($Id$ removal).Nicholas Clark2010-12-161-1/+1
|
* Remove "dead" RCS $Id$ tags from files that we own.Nicholas Clark2010-12-161-4/+0
| | | | | All files have been modified more recently than their tag, rendering information in the tag redundant.
* fix various compiler warnings from XS codeZefram2010-12-111-0/+2
| | | | | | | | | | | Trivial changes to fix warnings of types * unclear precedence * assignment as conditional * signed/unsigned mixing * unused parameter/variable * value computed not used * wrong argument type for a printf format * variable may be used uninitialised (due to unhandled switch case)
* Convert modules in ext/ to pass minimal arguments to XSLoader::load().Nicholas Clark2010-10-141-3/+3
|
* Convert Fcntl and PerlIO::encoding's tests to Test::More.Nicholas Clark2010-06-301-3/+1
| | | | Remove one vestigial mention of MacOS.