brane 2003/01/09 14:54:56
Modified: ces _tbl_simple.c
Log:
Added comments in the _code_ about why the casts added in 1.7 are safe,
as per gstein's eminently sensible suggestion.
Revision Changes Path
1.8 +5 -0 apr-iconv/ces/_tbl_simple.c
Index: _tbl_simple.c
===================================================================
RCS file: /home/cvs/apr-iconv/ces/_tbl_simple.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- _tbl_simple.c 9 Jan 2003 22:10:11 -0000 1.7
+++ _tbl_simple.c 9 Jan 2003 22:54:56 -0000 1.8
@@ -84,6 +84,9 @@
return 1; /* No state reinitialization for table charsets
*/
if (iconv_char32bit(in))
return -1;
+ /* This cast to ucs2_t silences a MSVC argument conversion warning.
+ It's safe because we've just checked that 'in' is a 16-bit
+ (or shorter) character. */
res = ICONV_CCS_CONVERT_FROM_UCS(ccsd, (ucs2_t)in);
if (res == UCS_CHAR_INVALID)
return -1; /* No character in output charset */
@@ -108,6 +111,8 @@
if (*inbytesleft < bytes)
return UCS_CHAR_NONE; /* Not enough bytes in the input buffer
*/
+ /* This cast to ucs2_t silences a MSVC argument conversion warning.
+ It's safe because we're creating s 16-bit char from two bytes. */
if (bytes == 2)
res = ICONV_CCS_CONVERT_TO_UCS(ccsd,
(ucs2_t)((byte << 8) | (* ++(*inbuf))));