From 1d4ea287e9a924ad1eaef98145b6d6c3b6219e80 Mon Sep 17 00:00:00 2001 From: Daniel Dragan Date: Sun, 14 Aug 2016 11:01:00 -0400 Subject: [PATCH] silence MSVC warnings for NATIVE_UTF8_TO_I8/I8_TO_NATIVE_UTF8 The result of I8_TO_NATIVE_UTF8 has to be U8 casted for the MSVC specific PERL_SMALL_MACRO_BUFFER option just like it is for newer CCs that dont have a small CPP buffer. Commit 1a3756de64/#127426 did add U8 casts to NATIVE_TO_LATIN1/LATIN1_TO_NATIVE but missed NATIVE_UTF8_TO_I8/I8_TO_NATIVE_UTF8. This commit fixes that. One example of the C4244 warning is VC6 thinks 0xFF & (0xFE << 6) in UTF_START_MARK could be bigger than 0xff (a char), fixes ..\inline.h(247) : warning C4244: '=' : conversion from 'long ' to 'unsigned char ', possible loss of data Also fixes ..\utf8.c(146) : warning C4244: '=' : conversion from 'UV' to 'U8', possible loss of data and alot more warnings in utf8.c --- utf8.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utf8.h b/utf8.h index bc5b8c9f2e24..ee2d97e5438c 100644 --- a/utf8.h +++ b/utf8.h @@ -156,8 +156,8 @@ END_EXTERN_C * rarely do we need to distinguish them. The term "NATIVE_UTF8" applies to * whichever one is applicable on the current platform */ #ifdef PERL_SMALL_MACRO_BUFFER -#define NATIVE_UTF8_TO_I8(ch) (ch) -#define I8_TO_NATIVE_UTF8(ch) (ch) +#define NATIVE_UTF8_TO_I8(ch) ((U8) (ch)) +#define I8_TO_NATIVE_UTF8(ch) ((U8) (ch)) #else #define NATIVE_UTF8_TO_I8(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) (ch))) #define I8_TO_NATIVE_UTF8(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) (ch)))