From: Marcus Holland-Moritz Date: Sat, 27 Dec 2003 17:39:20 +0000 (+0100) Subject: Remove Win32 compiler warnings X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=028f8eaac9a8e1c5eecaca563e816ed1d443dc17;p=p5sagit%2Fp5-mst-13.2.git Remove Win32 compiler warnings From: "Marcus Holland-Moritz" Message-ID: <018901c3cc97$fa976660$d500a8c0@R2D2> p4raw-id: //depot/perl@21971 --- diff --git a/ext/XS/APItest/APItest.xs b/ext/XS/APItest/APItest.xs index 2575348..02a1694 100644 --- a/ext/XS/APItest/APItest.xs +++ b/ext/XS/APItest/APItest.xs @@ -5,6 +5,8 @@ MODULE = XS::APItest:Hash PACKAGE = XS::APItest::Hash +#define UTF8KLEN(sv, len) (SvUTF8(sv) ? -(I32)len : (I32)len) + bool exists(hash, key_sv) PREINIT: @@ -15,7 +17,7 @@ exists(hash, key_sv) SV *key_sv CODE: key = SvPV(key_sv, len); - RETVAL = hv_exists(hash, key, SvUTF8(key_sv) ? -len : len); + RETVAL = hv_exists(hash, key, UTF8KLEN(key_sv, len)); OUTPUT: RETVAL @@ -30,8 +32,7 @@ delete(hash, key_sv) CODE: key = SvPV(key_sv, len); /* It's already mortal, so need to increase reference count. */ - RETVAL = SvREFCNT_inc(hv_delete(hash, key, - SvUTF8(key_sv) ? -len : len, 0)); + RETVAL = SvREFCNT_inc(hv_delete(hash, key, UTF8KLEN(key_sv, len), 0)); OUTPUT: RETVAL @@ -73,7 +74,7 @@ store(hash, key_sv, value) CODE: key = SvPV(key_sv, len); copy = newSV(0); - result = hv_store(hash, key, SvUTF8(key_sv) ? -len : len, copy, 0); + result = hv_store(hash, key, UTF8KLEN(key_sv, len), copy, 0); SvSetMagicSV(copy, value); if (!result) { SvREFCNT_dec(copy); @@ -97,7 +98,7 @@ fetch(hash, key_sv) SV *key_sv CODE: key = SvPV(key_sv, len); - result = hv_fetch(hash, key, SvUTF8(key_sv) ? -len : len, 0); + result = hv_fetch(hash, key, UTF8KLEN(key_sv, len), 0); if (!result) { XSRETURN_EMPTY; } diff --git a/ext/threads/shared/shared.xs b/ext/threads/shared/shared.xs index 4e564c5..72b7285 100644 --- a/ext/threads/shared/shared.xs +++ b/ext/threads/shared/shared.xs @@ -441,7 +441,7 @@ Perl_sharedsv_cond_timedwait(perl_cond *cond, perl_mutex *mut, double abs) cond->waiters++; MUTEX_UNLOCK(mut); /* See comments in win32/win32thread.h COND_WAIT vis-a-vis race */ - switch (WaitForSingleObject(cond->sem, abs)) { + switch (WaitForSingleObject(cond->sem, (DWORD)abs)) { case WAIT_OBJECT_0: got_it = 1; break; case WAIT_TIMEOUT: break; default: diff --git a/sv.c b/sv.c index 9376345..ed31344 100644 --- a/sv.c +++ b/sv.c @@ -8547,7 +8547,7 @@ F0convert(NV nv, char *endbuf, STRLEN *len) nv = -nv; if (nv < UV_MAX) { nv += 0.5; - uv = nv; + uv = (UV)nv; if (uv & 1 && uv == nv) uv--; /* Round to even */ do { @@ -8641,7 +8641,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV pp = pat + 2; while (*pp >= '0' && *pp <= '9') digits = 10 * digits + (*pp++ - '0'); - if (pp - pat == patlen - 1) { + if (pp - pat == (int)patlen - 1) { NV nv; if (args)