MODULE = XS::APItest:Hash PACKAGE = XS::APItest::Hash
+#define UTF8KLEN(sv, len) (SvUTF8(sv) ? -(I32)len : (I32)len)
+
bool
exists(hash, key_sv)
PREINIT:
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
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
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);
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;
}
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:
nv = -nv;
if (nv < UV_MAX) {
nv += 0.5;
- uv = nv;
+ uv = (UV)nv;
if (uv & 1 && uv == nv)
uv--; /* Round to even */
do {
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)