Skip to content

Commit

Permalink
silence MSVC warnings for NATIVE_UTF8_TO_I8/I8_TO_NATIVE_UTF8
Browse files Browse the repository at this point in the history
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 1a3756d/#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
  • Loading branch information
bulk88 authored and khwilliamson committed Aug 14, 2016
1 parent 7301378 commit 1d4ea28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utf8.h
Expand Up @@ -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)))
Expand Down

0 comments on commit 1d4ea28

Please sign in to comment.