[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.
This commit is contained in:
Alexei Podtelezhnikov 2017-10-15 14:19:13 -04:00
parent 6bea49e026
commit ccb0f7998d
3 changed files with 18 additions and 14 deletions

View File

@ -1,3 +1,12 @@
2017-10-15 Alexei Podtelezhnikov <apodtele@gmail.com>
[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 <apodtele@gmail.com>
[base] Netpbm image tracing.

View File

@ -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
}

View File

@ -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 */