ref: ccb0f7998da38aeb5cb353a6f9656f9846a397f4
parent: 6bea49e026ce8a103de2b3c232042458b8f309eb
author: Alexei Podtelezhnikov <[email protected]>
date: Sun Oct 15 10:19:13 EDT 2017
[base, cff] Fix MSVC warnings. * src/base/ftobjs.c (FT_New_Library): C4702: unreachable code. (ft_glyphslot_preset_bitmap): C4244: possible loss of data. * src/cff/cffload.c (cff_blend_doBlend): C4244: possible loss of data. Turn `sum' into unsigned.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-10-15 Alexei Podtelezhnikov <[email protected]>
+
+ [base, cff] Fix MSVC warnings.
+
+ * src/base/ftobjs.c (FT_New_Library): C4702: unreachable code.
+ (ft_glyphslot_preset_bitmap): C4244: possible loss of data.
+ * src/cff/cffload.c (cff_blend_doBlend): C4244: possible loss of data.
+ Turn `sum' into unsigned.
+
2017-10-14 Alexei Podtelezhnikov <[email protected]>
[base] Netpbm image tracing.
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -451,7 +451,7 @@
slot->bitmap_left = (FT_Int)x_left;
slot->bitmap_top = (FT_Int)y_top;
- bitmap->pixel_mode = pixel_mode;
+ bitmap->pixel_mode = (unsigned char)pixel_mode;
bitmap->num_grays = 256;
bitmap->width = (unsigned int)width;
bitmap->rows = (unsigned int)height;
@@ -5174,9 +5174,9 @@
#ifdef FT_CONFIG_OPTION_PIC
Fail:
ft_pic_container_destroy( library );
-#endif
FT_FREE( library );
return error;
+#endif
}
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1345,19 +1345,14 @@
for ( i = 0; i < numBlends; i++ )
{
const FT_Int32* weight = &blend->BV[1];
- FT_Int32 sum;
+ FT_UInt32 sum;
/* convert inputs to 16.16 fixed point */
- sum = cff_parse_num( parser, &parser->stack[i + base] ) * 65536;
+ sum = cff_parse_num( parser, &parser->stack[i + base] ) * 0x10000;
for ( j = 1; j < blend->lenBV; j++ )
- sum = ADD_INT32(
- sum,
- FT_MulFix(
- *weight++,
- cff_parse_num( parser,
- &parser->stack[delta++] ) * 65536 ) );
+ sum += cff_parse_num( parser, &parser->stack[delta++] ) * *weight++;
/* point parser stack to new value on blend_stack */
parser->stack[i + base] = subFont->blend_top;
@@ -1367,10 +1362,10 @@
/* opcode in both CFF and CFF2 DICTs. See `cff_parse_num' for */
/* decode of this, which rounds to an integer. */
*subFont->blend_top++ = 255;
- *subFont->blend_top++ = ( (FT_UInt32)sum & 0xFF000000U ) >> 24;
- *subFont->blend_top++ = ( (FT_UInt32)sum & 0x00FF0000U ) >> 16;
- *subFont->blend_top++ = ( (FT_UInt32)sum & 0x0000FF00U ) >> 8;
- *subFont->blend_top++ = (FT_UInt32)sum & 0x000000FFU;
+ *subFont->blend_top++ = (FT_Byte)( sum >> 24 );
+ *subFont->blend_top++ = (FT_Byte)( sum >> 16 );
+ *subFont->blend_top++ = (FT_Byte)( sum >> 8 );
+ *subFont->blend_top++ = (FT_Byte)sum;
}
/* leave only numBlends results on parser stack */