In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/b66f3475d343bb78e55b4ba343433044f5966b6b?hp=df8c7dee25da69fc88678b8949166e08fb686037>
- Log ----------------------------------------------------------------- commit b66f3475d343bb78e55b4ba343433044f5966b6b Author: Leon Timmermans <faw...@gmail.com> Date: Wed Aug 28 15:06:29 2013 +0200 Fix PerlIO_get_cnt and friends These functions worked with ints instead of SSize_t, ----------------------------------------------------------------------- Summary of changes: embed.fnc | 8 ++++---- perlio.c | 9 +++++---- perlio.h | 8 ++++---- pod/perlapio.pod | 10 +++++----- pp_sys.c | 2 +- proto.h | 8 ++++---- sv.c | 30 +++++++++++++++--------------- 7 files changed, 38 insertions(+), 37 deletions(-) diff --git a/embed.fnc b/embed.fnc index 4940ae4..592b11a 100644 --- a/embed.fnc +++ b/embed.fnc @@ -2343,9 +2343,9 @@ Ap |int |PerlIO_eof |NULLOK PerlIO *f Ap |int |PerlIO_error |NULLOK PerlIO *f Ap |int |PerlIO_flush |NULLOK PerlIO *f Ap |void |PerlIO_clearerr |NULLOK PerlIO *f -Ap |void |PerlIO_set_cnt |NULLOK PerlIO *f|int cnt +Ap |void |PerlIO_set_cnt |NULLOK PerlIO *f|SSize_t cnt Ap |void |PerlIO_set_ptrcnt |NULLOK PerlIO *f|NULLOK STDCHAR *ptr \ - |int cnt + |SSize_t cnt Ap |void |PerlIO_setlinebuf |NULLOK PerlIO *f Ap |SSize_t|PerlIO_read |NULLOK PerlIO *f|NN void *vbuf \ |Size_t count @@ -2358,8 +2358,8 @@ Ap |int |PerlIO_seek |NULLOK PerlIO *f|Off_t offset|int whence Ap |STDCHAR *|PerlIO_get_base |NULLOK PerlIO *f Ap |STDCHAR *|PerlIO_get_ptr |NULLOK PerlIO *f -ApR |int |PerlIO_get_bufsiz |NULLOK PerlIO *f -ApR |int |PerlIO_get_cnt |NULLOK PerlIO *f +ApR |SSize_t |PerlIO_get_bufsiz |NULLOK PerlIO *f +ApR |SSize_t |PerlIO_get_cnt |NULLOK PerlIO *f ApR |PerlIO *|PerlIO_stdin ApR |PerlIO *|PerlIO_stdout diff --git a/perlio.c b/perlio.c index 7e6ceae..7de7085 100644 --- a/perlio.c +++ b/perlio.c @@ -1877,9 +1877,10 @@ Perl_PerlIO_get_base(pTHX_ PerlIO *f) Perl_PerlIO_or_fail(f, Get_base, NULL, (aTHX_ f)); } -int +SSize_t Perl_PerlIO_get_bufsiz(pTHX_ PerlIO *f) { + /* Note that Get_bufsiz returns a Size_t */ Perl_PerlIO_or_fail(f, Get_bufsiz, -1, (aTHX_ f)); } @@ -1889,20 +1890,20 @@ Perl_PerlIO_get_ptr(pTHX_ PerlIO *f) Perl_PerlIO_or_fail(f, Get_ptr, NULL, (aTHX_ f)); } -int +SSize_t Perl_PerlIO_get_cnt(pTHX_ PerlIO *f) { Perl_PerlIO_or_fail(f, Get_cnt, -1, (aTHX_ f)); } void -Perl_PerlIO_set_cnt(pTHX_ PerlIO *f, int cnt) +Perl_PerlIO_set_cnt(pTHX_ PerlIO *f, SSize_t cnt) { Perl_PerlIO_or_fail_void(f, Set_ptrcnt, (aTHX_ f, NULL, cnt)); } void -Perl_PerlIO_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR * ptr, int cnt) +Perl_PerlIO_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR * ptr, SSize_t cnt) { Perl_PerlIO_or_fail_void(f, Set_ptrcnt, (aTHX_ f, ptr, cnt)); } diff --git a/perlio.h b/perlio.h index 7b5adbd..69f0476 100644 --- a/perlio.h +++ b/perlio.h @@ -313,19 +313,19 @@ PERL_EXPORT_C int PerlIO_canset_cnt(PerlIO *); PERL_EXPORT_C STDCHAR *PerlIO_get_ptr(PerlIO *); #endif #ifndef PerlIO_get_cnt -PERL_EXPORT_C int PerlIO_get_cnt(PerlIO *); +PERL_EXPORT_C SSize_t PerlIO_get_cnt(PerlIO *); #endif #ifndef PerlIO_set_cnt -PERL_EXPORT_C void PerlIO_set_cnt(PerlIO *, int); +PERL_EXPORT_C void PerlIO_set_cnt(PerlIO *, SSize_t); #endif #ifndef PerlIO_set_ptrcnt -PERL_EXPORT_C void PerlIO_set_ptrcnt(PerlIO *, STDCHAR *, int); +PERL_EXPORT_C void PerlIO_set_ptrcnt(PerlIO *, STDCHAR *, SSize_t); #endif #ifndef PerlIO_get_base PERL_EXPORT_C STDCHAR *PerlIO_get_base(PerlIO *); #endif #ifndef PerlIO_get_bufsiz -PERL_EXPORT_C int PerlIO_get_bufsiz(PerlIO *); +PERL_EXPORT_C SSize_t PerlIO_get_bufsiz(PerlIO *); #endif #ifndef PerlIO_tmpfile PERL_EXPORT_C PerlIO *PerlIO_tmpfile(void); diff --git a/pod/perlapio.pod b/pod/perlapio.pod index bb7115f..e130ed8 100644 --- a/pod/perlapio.pod +++ b/pod/perlapio.pod @@ -19,7 +19,7 @@ perlapio - perl's IO abstraction interface. int PerlIO_stdoutf(const char *fmt,...) int PerlIO_puts(PerlIO *f,const char *string); int PerlIO_putc(PerlIO *f,int ch); - int PerlIO_write(PerlIO *f,const void *buf,size_t numbytes); + SSize_t PerlIO_write(PerlIO *f,const void *buf,size_t numbytes); int PerlIO_printf(PerlIO *f, const char *fmt,...); int PerlIO_vprintf(PerlIO *f, const char *fmt, va_list args); int PerlIO_flush(PerlIO *f); @@ -30,7 +30,7 @@ perlapio - perl's IO abstraction interface. int PerlIO_getc(PerlIO *d); int PerlIO_ungetc(PerlIO *f,int ch); - int PerlIO_read(PerlIO *f, void *buf, size_t numbytes); + SSize_t PerlIO_read(PerlIO *f, void *buf, size_t numbytes); int PerlIO_fileno(PerlIO *f); @@ -45,16 +45,16 @@ perlapio - perl's IO abstraction interface. int PerlIO_fast_gets(PerlIO *f); int PerlIO_has_cntptr(PerlIO *f); - int PerlIO_get_cnt(PerlIO *f); + SSize_t PerlIO_get_cnt(PerlIO *f); char *PerlIO_get_ptr(PerlIO *f); - void PerlIO_set_ptrcnt(PerlIO *f, char *ptr, int count); + void PerlIO_set_ptrcnt(PerlIO *f, char *ptr, SSize_t count); int PerlIO_canset_cnt(PerlIO *f); /* deprecated */ void PerlIO_set_cnt(PerlIO *f, int count); /* deprecated */ int PerlIO_has_base(PerlIO *f); char *PerlIO_get_base(PerlIO *f); - int PerlIO_get_bufsiz(PerlIO *f); + SSize_t PerlIO_get_bufsiz(PerlIO *f); PerlIO *PerlIO_importFILE(FILE *stdio, const char *mode); FILE *PerlIO_exportFILE(PerlIO *f, int flags); diff --git a/pp_sys.c b/pp_sys.c index d87299f..a5d44ff 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -3288,7 +3288,7 @@ PP(pp_fttext) { dVAR; I32 i; - I32 len; + SSize_t len; I32 odd = 0; STDCHAR tbuf[512]; STDCHAR *s; diff --git a/proto.h b/proto.h index 388fa64..060f864 100644 --- a/proto.h +++ b/proto.h @@ -7855,10 +7855,10 @@ PERL_CALLCONV int Perl_PerlIO_fileno(pTHX_ PerlIO *f); PERL_CALLCONV int Perl_PerlIO_fill(pTHX_ PerlIO *f); PERL_CALLCONV int Perl_PerlIO_flush(pTHX_ PerlIO *f); PERL_CALLCONV STDCHAR * Perl_PerlIO_get_base(pTHX_ PerlIO *f); -PERL_CALLCONV int Perl_PerlIO_get_bufsiz(pTHX_ PerlIO *f) +PERL_CALLCONV SSize_t Perl_PerlIO_get_bufsiz(pTHX_ PerlIO *f) __attribute__warn_unused_result__; -PERL_CALLCONV int Perl_PerlIO_get_cnt(pTHX_ PerlIO *f) +PERL_CALLCONV SSize_t Perl_PerlIO_get_cnt(pTHX_ PerlIO *f) __attribute__warn_unused_result__; PERL_CALLCONV STDCHAR * Perl_PerlIO_get_ptr(pTHX_ PerlIO *f); @@ -7868,8 +7868,8 @@ PERL_CALLCONV SSize_t Perl_PerlIO_read(pTHX_ PerlIO *f, void *vbuf, Size_t count assert(vbuf) PERL_CALLCONV int Perl_PerlIO_seek(pTHX_ PerlIO *f, Off_t offset, int whence); -PERL_CALLCONV void Perl_PerlIO_set_cnt(pTHX_ PerlIO *f, int cnt); -PERL_CALLCONV void Perl_PerlIO_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR *ptr, int cnt); +PERL_CALLCONV void Perl_PerlIO_set_cnt(pTHX_ PerlIO *f, SSize_t cnt); +PERL_CALLCONV void Perl_PerlIO_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR *ptr, SSize_t cnt); PERL_CALLCONV void Perl_PerlIO_setlinebuf(pTHX_ PerlIO *f); PERL_CALLCONV PerlIO * Perl_PerlIO_stderr(pTHX) __attribute__warn_unused_result__; diff --git a/sv.c b/sv.c index d6f3338..804f8e9 100644 --- a/sv.c +++ b/sv.c @@ -7944,9 +7944,9 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO *const fp, I32 append) STRLEN rslen; STDCHAR rslast; STDCHAR *bp; - I32 cnt; - I32 i = 0; - I32 rspara = 0; + SSize_t cnt; + int i = 0; + int rspara = 0; PERL_ARGS_ASSERT_SV_GETS; @@ -8091,8 +8091,8 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO *const fp, I32 append) DEBUG_P(PerlIO_printf(Perl_debug_log, "Screamer: entering, ptr=%"UVuf", cnt=%ld\n",PTR2UV(ptr),(long)cnt)); DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: entering: PerlIO * thinks ptr=%"UVuf", cnt=%ld, base=%"UVuf"\n", - PTR2UV(PerlIO_get_ptr(fp)), (long)PerlIO_get_cnt(fp), + "Screamer: entering: PerlIO * thinks ptr=%"UVuf", cnt=%z, base=%"UVuf"\n", + PTR2UV(PerlIO_get_ptr(fp)), PerlIO_get_cnt(fp), PTR2UV(PerlIO_has_base(fp) ? PerlIO_get_base(fp) : 0))); for (;;) { screamer: @@ -8126,13 +8126,13 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO *const fp, I32 append) cannot_be_shortbuffered: DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: going to getc, ptr=%"UVuf", cnt=%ld\n", - PTR2UV(ptr),(long)cnt)); + "Screamer: going to getc, ptr=%"UVuf", cnt=%z\n", + PTR2UV(ptr),cnt)); PerlIO_set_ptrcnt(fp, (STDCHAR*)ptr, cnt); /* deregisterize cnt and ptr */ DEBUG_Pv(PerlIO_printf(Perl_debug_log, - "Screamer: pre: FILE * thinks ptr=%"UVuf", cnt=%ld, base=%"UVuf"\n", - PTR2UV(PerlIO_get_ptr(fp)), (long)PerlIO_get_cnt(fp), + "Screamer: pre: FILE * thinks ptr=%"UVuf", cnt=%z, base=%"UVuf"\n", + PTR2UV(PerlIO_get_ptr(fp)), PerlIO_get_cnt(fp), PTR2UV(PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0))); /* This used to call 'filbuf' in stdio form, but as that behaves like @@ -8141,14 +8141,14 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO *const fp, I32 append) i = PerlIO_getc(fp); /* get more characters */ DEBUG_Pv(PerlIO_printf(Perl_debug_log, - "Screamer: post: FILE * thinks ptr=%"UVuf", cnt=%ld, base=%"UVuf"\n", - PTR2UV(PerlIO_get_ptr(fp)), (long)PerlIO_get_cnt(fp), + "Screamer: post: FILE * thinks ptr=%"UVuf", cnt=%z, base=%"UVuf"\n", + PTR2UV(PerlIO_get_ptr(fp)), PerlIO_get_cnt(fp), PTR2UV(PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0))); cnt = PerlIO_get_cnt(fp); ptr = (STDCHAR*)PerlIO_get_ptr(fp); /* reregisterize cnt and ptr */ DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: after getc, ptr=%"UVuf", cnt=%ld\n",PTR2UV(ptr),(long)cnt)); + "Screamer: after getc, ptr=%"UVuf", cnt=%z\n",PTR2UV(ptr),cnt)); if (i == EOF) /* all done for ever? */ goto thats_really_all_folks; @@ -8172,11 +8172,11 @@ thats_really_all_folks: if (shortbuffered) cnt += shortbuffered; DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: quitting, ptr=%"UVuf", cnt=%ld\n",PTR2UV(ptr),(long)cnt)); + "Screamer: quitting, ptr=%"UVuf", cnt=%z\n",PTR2UV(ptr),cnt)); PerlIO_set_ptrcnt(fp, (STDCHAR*)ptr, cnt); /* put these back or we're in trouble */ DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: end: FILE * thinks ptr=%"UVuf", cnt=%ld, base=%"UVuf"\n", - PTR2UV(PerlIO_get_ptr(fp)), (long)PerlIO_get_cnt(fp), + "Screamer: end: FILE * thinks ptr=%"UVuf", cnt=%z, base=%"UVuf"\n", + PTR2UV(PerlIO_get_ptr(fp)), PerlIO_get_cnt(fp), PTR2UV(PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0))); *bp = '\0'; SvCUR_set(sv, bp - (STDCHAR*)SvPVX_const(sv)); /* set length */ -- Perl5 Master Repository