Hi!
On Pon Feb 19 18:07:15 2018, RANDIR wrote:
Show quoted text> hile building this module under 64-bit version of MS VS2017, I get the
> following build warnings:
>
> Encode.xs(491): warning C4244: '=': conversion from 'IV' to 'int',
> possible loss of data
> Encode.xs(692): warning C4244: '=': conversion from 'IV' to 'int',
> possible loss of data
> Encode.xs(752): warning C4244: '=': conversion from 'IV' to 'int',
> possible loss of data
> Encode.xs(863): warning C4244: '=': conversion from 'IV' to 'int',
> possible loss of data
> Encode.xs(898): warning C4244: '=': conversion from 'IV' to 'int',
> possible loss of data
> Encode.xs(929): warning C4244: '=': conversion from 'IV' to 'int',
> possible loss of data
See patch in the attachment, can you verify that it fixes these problems?
Show quoted text> Encode.xs(1010): warning C4267: '=': conversion from 'size_t' to
> 'I32', possible loss of data
> Encode.xs(1077): warning C4244: '=': conversion from '__int64' to
> 'I32', possible loss of data
> Encode.xs(1081): warning C4267: '=': conversion from 'size_t' to
> 'I32', possible loss of data
Those warnings come from _bytes_to_utf8 and _utf8_to_bytes functions. I think that those functions should be rather removed as they are undocumented, marked as unimplemented, private (as they starts with underscore) and currently not used by Encode. Therefore I would not spend time for investigation of those warnings.
Show quoted text> Encode.xs(1144): warning C4267: 'function': conversion from 'size_t'
> to 'U32', possible loss of data
Code looks to be OK, seems to be bug in compiler. So report it to the compiler bug tracker.
From b032849f6b55fa267d089f8930f695b43ad32c42 Mon Sep 17 00:00:00 2001
From: Pali <pali@cpan.org>
Date: Mon, 5 Mar 2018 22:57:40 +0100
Subject: [PATCH] Set correct type for check variable
Value assigned to check variable comes from SvIV() therefore it should be
of IV type. Fixes following compile warnings on 64bit MS VS2017:
Encode.xs(491): warning C4244: '=': conversion from 'IV' to 'int', possible loss of data
Encode.xs(692): warning C4244: '=': conversion from 'IV' to 'int', possible loss of data
Encode.xs(752): warning C4244: '=': conversion from 'IV' to 'int', possible loss of data
Encode.xs(863): warning C4244: '=': conversion from 'IV' to 'int', possible loss of data
Encode.xs(898): warning C4244: '=': conversion from 'IV' to 'int', possible loss of data
Encode.xs(929): warning C4244: '=': conversion from 'IV' to 'int', possible loss of data
---
Encode.xs | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/Encode.xs b/Encode.xs
index bc4a77d..68d1ccb 100644
--- a/Encode.xs
+++ b/Encode.xs
@@ -164,7 +164,7 @@ do_bytes_fallback_cb(pTHX_ U8 *s, STRLEN slen, SV *fallback_cb)
static SV *
encode_method(pTHX_ const encode_t * enc, const encpage_t * dir, SV * src, U8 * s, STRLEN slen,
- int check, STRLEN * offset, SV * term, int * retcode,
+ IV check, STRLEN * offset, SV * term, int * retcode,
SV *fallback_cb)
{
STRLEN tlen = slen;
@@ -472,7 +472,7 @@ process_utf8(pTHX_ SV* dst, U8* s, U8* e, SV *check_sv,
UV uv;
STRLEN ulen;
SV *fallback_cb;
- int check;
+ IV check;
U8 *d;
STRLEN dlen;
char esc[UTF8_MAXLEN * 6 + 1];
@@ -683,7 +683,7 @@ PREINIT:
U8 *e;
SV *dst;
bool renewed = 0;
- int check;
+ IV check;
bool modify;
dSP;
INIT:
@@ -744,7 +744,7 @@ PREINIT:
U8 *s;
U8 *e;
SV *dst;
- int check;
+ IV check;
bool modify;
INIT:
SvGETMAGIC(src);
@@ -848,7 +848,7 @@ SV * off
SV * term
SV * check_sv
PREINIT:
- int check;
+ IV check;
SV *fallback_cb;
bool modify;
encode_t *enc;
@@ -886,7 +886,7 @@ SV * obj
SV * src
SV * check_sv
PREINIT:
- int check;
+ IV check;
SV *fallback_cb;
bool modify;
encode_t *enc;
@@ -917,7 +917,7 @@ SV * obj
SV * src
SV * check_sv
PREINIT:
- int check;
+ IV check;
SV *fallback_cb;
bool modify;
encode_t *enc;
--
2.11.0