From c161da64987b034d3b410518a0c174d74958b938 Mon Sep 17 00:00:00 2001 From: Steve Hay Date: Tue, 25 Feb 2014 08:59:07 +0000 Subject: [PATCH] Silence some VC++ compiler warnings gv.c(1455) : warning C4146: unary minus operator applied to unsigned type, result still unsigned gv.c(1586) : warning C4146: unary minus operator applied to unsigned type, result still unsigned gv.c(2122) : warning C4146: unary minus operator applied to unsigned type, result still unsigned toke.c(12423) : warning C4244: '=' : conversion from 'I32' to 'char', possible loss of data win32.c(3017) : warning C4022: 'SetHandleInformation' : pointer mismatch for actual parameter 1 win32.c(2971) : warning C4101: 'old_h' : unreferenced local variable win32.c(2967) : warning C4101: 'oldfd' : unreferenced local variable --- gv.c | 6 +++--- toke.c | 2 +- win32/win32.c | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/gv.c b/gv.c index bda30b1..42cd69c 100644 --- a/gv.c +++ b/gv.c @@ -1452,7 +1452,7 @@ S_parse_gv_stash_name(pTHX_ HV **stash, GV **gv, const char **name, tmpbuf[(*len)++] = ':'; key = tmpbuf; } - gvp = (GV**)hv_fetch(*stash, key, is_utf8 ? -(*len) : *len, add); + gvp = (GV**)hv_fetch(*stash, key, is_utf8 ? -((I32)*len) : (I32)*len, add); *gv = gvp ? *gvp : NULL; if (*gv && *gv != (const GV *)&PL_sv_undef) { if (SvTYPE(*gv) != SVt_PVGV) @@ -1583,7 +1583,7 @@ S_find_default_stash(pTHX_ HV **stash, const char *name, STRLEN len, !(len == 1 && sv_type == SVt_PV && (*name == 'a' || *name == 'b')) ) { - GV**gvp = (GV**)hv_fetch(*stash,name,is_utf8 ? -len : len,0); + GV**gvp = (GV**)hv_fetch(*stash,name,is_utf8 ? -(I32)len : (I32)len,0); if (!gvp || *gvp == (const GV *)&PL_sv_undef || SvTYPE(*gvp) != SVt_PVGV) { @@ -2119,7 +2119,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, } /* By this point we should have a stash and a name */ - gvp = (GV**)hv_fetch(stash,name,is_utf8 ? -len : len,add); + gvp = (GV**)hv_fetch(stash,name,is_utf8 ? -(I32)len : (I32)len,add); if (!gvp || *gvp == (const GV *)&PL_sv_undef) { if (addmg) gv = (GV *)newSV(0); else return NULL; diff --git a/toke.c b/toke.c index 88524b4..3d992f6 100644 --- a/toke.c +++ b/toke.c @@ -12420,7 +12420,7 @@ S_parse_opt_lexvar(pTHX) return NULL; s = PL_bufptr; d = PL_tokenbuf + 1; - PL_tokenbuf[0] = sigil; + PL_tokenbuf[0] = (char)sigil; parse_ident(&s, &d, PL_tokenbuf + sizeof(PL_tokenbuf) - 1, 0, cBOOL(UTF)); PL_bufptr = s; if (d == PL_tokenbuf+1) diff --git a/win32/win32.c b/win32/win32.c index 2396cc5..eb3d428 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2964,11 +2964,10 @@ win32_popen(const char *command, const char *mode) int p[2]; int handles[3]; int parent, child; - int stdfd, oldfd; + int stdfd; int ourmode; int childpid; DWORD nhandle; - HANDLE old_h; int lock_held = 0; /* establish which ends read and write */ @@ -3014,7 +3013,7 @@ win32_popen(const char *command, const char *mode) handles[2] = -1; /* CreateProcess() requires inheritable handles */ - if (!SetHandleInformation(_get_osfhandle(p[child]), HANDLE_FLAG_INHERIT, + if (!SetHandleInformation((HANDLE)_get_osfhandle(p[child]), HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) { goto cleanup; } -- 2.7.4