From: Gurusamy Sarathy Date: Sun, 21 Apr 2002 22:32:29 +0000 (+0000) Subject: squelch some more type mismatch warnings X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=91f3b821ca3eaa8b7d74bb338729ba51b7b68a90;p=p5sagit%2Fp5-mst-13.2.git squelch some more type mismatch warnings SvREFCNT_dec(x ? y : z) did not typecast the right thing due to missing parens in macro definition p4raw-id: //depot/perl@16055 --- diff --git a/dump.c b/dump.c index 969fac5..b9bf099 100644 --- a/dump.c +++ b/dump.c @@ -75,8 +75,8 @@ Perl_dump_sub(pTHX_ GV *gv) gv_fullname3(sv, gv, Nullch); Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nSUB %s = ", SvPVX(sv)); if (CvXSUB(GvCV(gv))) - Perl_dump_indent(aTHX_ 0, Perl_debug_log, "(xsub 0x%lx %d)\n", - (long)CvXSUB(GvCV(gv)), + Perl_dump_indent(aTHX_ 0, Perl_debug_log, "(xsub 0x%"UVxf" %d)\n", + PTR2UV(CvXSUB(GvCV(gv))), (int)CvXSUBANY(GvCV(gv)).any_i32); else if (CvROOT(GvCV(gv))) op_dump(CvROOT(GvCV(gv))); diff --git a/ext/Cwd/Cwd.xs b/ext/Cwd/Cwd.xs index 667a1e2..f53f6ee 100644 --- a/ext/Cwd/Cwd.xs +++ b/ext/Cwd/Cwd.xs @@ -73,8 +73,7 @@ bsd_realpath(path, resolved) dTHX; return Perl_rmsexpand(aTHX_ (char*)path, resolved, NULL, 0); #else - struct stat sb; - int n, rootd, serrno; + int rootd, serrno; char *p, *q, wbuf[MAXPATHLEN]; int symlinks = 0; @@ -124,9 +123,12 @@ loop: p = resolved; #if defined(HAS_LSTAT) && defined(HAS_READLINK) && defined(HAS_SYMLINK) + { + struct stat sb; /* Deal with the last component. */ if (lstat(p, &sb) == 0) { if (S_ISLNK(sb.st_mode)) { + int n; if (++symlinks > MAXSYMLINKS) { errno = ELOOP; goto err1; @@ -143,6 +145,7 @@ loop: p = ""; } } + } #endif /* diff --git a/ext/Data/Dumper/Dumper.xs b/ext/Data/Dumper/Dumper.xs index 62f3099..19037a8 100644 --- a/ext/Data/Dumper/Dumper.xs +++ b/ext/Data/Dumper/Dumper.xs @@ -580,7 +580,7 @@ DD_dump(pTHX_ SV *val, char *name, STRLEN namelen, SV *retval, HV *seenhv, STRLEN keylen; bool do_utf8 = FALSE; - if ((sortkeys && !(keys && i <= av_len(keys))) || + if ((sortkeys && !(keys && (I32)i <= av_len(keys))) || !(entry = hv_iternext((HV *)ival))) break; diff --git a/ext/File/Glob/bsd_glob.c b/ext/File/Glob/bsd_glob.c index d0d4a91..46b52aa 100644 --- a/ext/File/Glob/bsd_glob.c +++ b/ext/File/Glob/bsd_glob.c @@ -506,7 +506,6 @@ globexp2(const Char *ptr, const Char *pattern, static const Char * globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob) { - struct passwd *pwd; char *h; const Char *p; Char *b, *eb; @@ -534,6 +533,7 @@ globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob) */ if ((h = getenv("HOME")) == NULL) { #ifdef HAS_PASSWD + struct passwd *pwd; if ((pwd = getpwuid(getuid())) == NULL) return pattern; else @@ -547,6 +547,7 @@ globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob) * Expand a ~user */ #ifdef HAS_PASSWD + struct passwd *pwd; if ((pwd = getpwnam((char*) patbuf)) == NULL) return pattern; else diff --git a/ext/IO/IO.xs b/ext/IO/IO.xs index dc810d6..7edbf2c 100644 --- a/ext/IO/IO.xs +++ b/ext/IO/IO.xs @@ -64,12 +64,12 @@ not_here(char *s) static int io_blocking(pTHX_ InputStream f, int block) { +#if defined(HAS_FCNTL) int RETVAL; if(!f) { errno = EBADF; return -1; } -#if defined(HAS_FCNTL) RETVAL = fcntl(PerlIO_fileno(f), F_GETFL, 0); if (RETVAL >= 0) { int mode = RETVAL; @@ -145,7 +145,7 @@ io_blocking(pTHX_ InputStream f, int block) } return RETVAL; #else - return -1; + return -1; #endif } diff --git a/ext/IO/poll.c b/ext/IO/poll.c index 024c52f..a09c247 100644 --- a/ext/IO/poll.c +++ b/ext/IO/poll.c @@ -58,7 +58,7 @@ again: FD_ZERO(&wfd); FD_ZERO(&efd); - for(i = 0 ; i < nfds ; i++) { + for(i = 0 ; i < (int)nfds ; i++) { int events = fds[i].events; int fd = fds[i].fd; @@ -105,7 +105,7 @@ again: count = 0; - for(i = 0 ; i < nfds ; i++) { + for(i = 0 ; i < (int)nfds ; i++) { int revents = (fds[i].events & POLL_EVENTS_MASK); int fd = fds[i].fd; diff --git a/ext/PerlIO/Scalar/Scalar.xs b/ext/PerlIO/Scalar/Scalar.xs index 86c54fa..c904394 100644 --- a/ext/PerlIO/Scalar/Scalar.xs +++ b/ext/PerlIO/Scalar/Scalar.xs @@ -90,9 +90,9 @@ PerlIOScalar_seek(pTHX_ PerlIO *f, Off_t offset, int whence) s->posn = offset + SvCUR(s->var); break; } - if (s->posn > SvCUR(s->var)) + if ((STRLEN)s->posn > SvCUR(s->var)) { - (void) SvGROW(s->var,s->posn); + (void) SvGROW(s->var,(STRLEN)s->posn); } return 0; } @@ -141,7 +141,7 @@ PerlIOScalar_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count) s->posn += count; } Move(vbuf,dst+offset,count,char); - if (s->posn > SvCUR(sv)) + if ((STRLEN)s->posn > SvCUR(sv)) SvCUR_set(sv,s->posn); SvPOK_on(s->var); return count; @@ -190,7 +190,7 @@ PerlIOScalar_get_cnt(pTHX_ PerlIO *f) if (PerlIOBase(f)->flags & PERLIO_F_CANREAD) { PerlIOScalar *s = PerlIOSelf(f,PerlIOScalar); - if (SvCUR(s->var) > s->posn) + if (SvCUR(s->var) > (STRLEN)s->posn) return SvCUR(s->var) - s->posn; else return 0; diff --git a/ext/PerlIO/encoding/encoding.xs b/ext/PerlIO/encoding/encoding.xs index ea15e56..23de989 100644 --- a/ext/PerlIO/encoding/encoding.xs +++ b/ext/PerlIO/encoding/encoding.xs @@ -237,7 +237,7 @@ PerlIOEncode_fill(pTHX_ PerlIO * f) if (SvLEN(e->dataSV) && SvPVX(e->dataSV)) { Safefree(SvPVX(e->dataSV)); } - if (use > e->base.bufsiz) { + if (use > (SSize_t)e->base.bufsiz) { use = e->base.bufsiz; } SvPVX(e->dataSV) = (char *) ptr; diff --git a/pp.c b/pp.c index 3b3d76d..a2433d9 100644 --- a/pp.c +++ b/pp.c @@ -1185,7 +1185,7 @@ PP(pp_divide) } /* 2s complement assumption */ if (result <= (UV)IV_MIN) - SETi( -result ); + SETi( -(IV)result ); else { /* It's exact but too negative for IV. */ SETn( -(NV)result ); diff --git a/regexec.c b/regexec.c index de3caaf..05839f0 100644 --- a/regexec.c +++ b/regexec.c @@ -3070,10 +3070,10 @@ S_regmatch(pTHX_ regnode *prog) DEBUG_r( PerlIO_printf(Perl_debug_log, - "%*s %ld out of %ld..%ld cc=%lx\n", + "%*s %ld out of %ld..%ld cc=%"UVxf"\n", REPORT_CODE_OFF+PL_regindent*2, "", (long)n, (long)cc->min, - (long)cc->max, (long)cc) + (long)cc->max, (UV)cc) ); /* If degenerate scan matches "", assume scan done. */ diff --git a/sv.h b/sv.h index 92dec20..6f95c46 100644 --- a/sv.h +++ b/sv.h @@ -174,7 +174,7 @@ perform the upgrade if necessary. See C. # endif #endif -#define SvREFCNT_dec(sv) sv_free((SV*)sv) +#define SvREFCNT_dec(sv) sv_free((SV*)(sv)) #define SVTYPEMASK 0xff #define SvTYPE(sv) ((sv)->sv_flags & SVTYPEMASK)