diff --git a/ChangeLog b/ChangeLog index 3930bc5f0..aa3af0532 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-02-22 Werner Lemberg + + * src/pshinter/pshrec.c: Simplify. + (ps_hints_open, ps_hints_stem): Remove switch statement. + 2015-02-22 Werner Lemberg [sfnt] Signedness fixes. diff --git a/src/pshinter/pshrec.c b/src/pshinter/pshrec.c index eb7987ce4..05ba981e5 100644 --- a/src/pshinter/pshrec.c +++ b/src/pshinter/pshrec.c @@ -811,24 +811,11 @@ ps_hints_open( PS_Hints hints, PS_Hint_Type hint_type ) { - switch ( hint_type ) - { - case PS_HINT_TYPE_1: - case PS_HINT_TYPE_2: - hints->error = FT_Err_Ok; - hints->hint_type = hint_type; - - ps_dimension_init( &hints->dimension[0] ); - ps_dimension_init( &hints->dimension[1] ); - break; + hints->error = FT_Err_Ok; + hints->hint_type = hint_type; - default: - hints->error = FT_THROW( Invalid_Argument ); - hints->hint_type = hint_type; - - FT_TRACE0(( "ps_hints_open: invalid charstring type\n" )); - break; - } + ps_dimension_init( &hints->dimension[0] ); + ps_dimension_init( &hints->dimension[1] ); } @@ -839,50 +826,42 @@ FT_Int count, FT_Long* stems ) { - if ( !hints->error ) - { - /* limit "dimension" to 0..1 */ - if ( dimension > 1 ) - { - FT_TRACE0(( "ps_hints_stem: invalid dimension (%d) used\n", - dimension )); - dimension = ( dimension != 0 ); - } + PS_Dimension dim; - /* record the stems in the current hints/masks table */ - switch ( hints->hint_type ) - { - case PS_HINT_TYPE_1: /* Type 1 "hstem" or "vstem" operator */ - case PS_HINT_TYPE_2: /* Type 2 "hstem" or "vstem" operator */ - { - PS_Dimension dim = &hints->dimension[dimension]; + if ( hints->error ) + return; - for ( ; count > 0; count--, stems += 2 ) - { - FT_Error error; - FT_Memory memory = hints->memory; + /* limit "dimension" to 0..1 */ + if ( dimension > 1 ) + { + FT_TRACE0(( "ps_hints_stem: invalid dimension (%d) used\n", + dimension )); + dimension = ( dimension != 0 ); + } + /* record the stems in the current hints/masks table */ + /* (Type 1 & 2's `hstem' or `vstem' operators) */ + dim = &hints->dimension[dimension]; - error = ps_dimension_add_t1stem( - dim, (FT_Int)stems[0], (FT_Int)stems[1], - memory, NULL ); - if ( error ) - { - FT_ERROR(( "ps_hints_stem: could not add stem" - " (%d,%d) to hints table\n", stems[0], stems[1] )); + for ( ; count > 0; count--, stems += 2 ) + { + FT_Error error; + FT_Memory memory = hints->memory; - hints->error = error; - return; - } - } - break; - } - default: - FT_TRACE0(( "ps_hints_stem: called with invalid hint type (%d)\n", - hints->hint_type )); - break; + error = ps_dimension_add_t1stem( dim, + (FT_Int)stems[0], + (FT_Int)stems[1], + memory, + NULL ); + if ( error ) + { + FT_ERROR(( "ps_hints_stem: could not add stem" + " (%d,%d) to hints table\n", stems[0], stems[1] )); + + hints->error = error; + return; } } }