From 480be443b782defd6d9acc35beee47a5e37fab6e Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 1 Aug 2022 22:59:58 -0400 Subject: * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Reduce casting. --- src/base/ftobjs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 0f6fd0a96..6d6e0e80a 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -2177,7 +2177,7 @@ FT_Byte* sfnt_data = NULL; FT_Error error; FT_ULong flag_offset; - FT_Long rlen; + FT_ULong rlen; int is_cff; FT_Long face_index_in_resource = 0; @@ -2192,11 +2192,11 @@ if ( error ) goto Exit; - if ( FT_READ_LONG( rlen ) ) + if ( FT_READ_ULONG( rlen ) ) goto Exit; - if ( rlen < 1 ) + if ( !rlen ) return FT_THROW( Cannot_Open_Resource ); - if ( (FT_ULong)rlen > FT_MAC_RFORK_MAX_LEN ) + if ( rlen > FT_MAC_RFORK_MAX_LEN ) return FT_THROW( Invalid_Offset ); error = open_face_PS_from_sfnt_stream( library, @@ -2214,7 +2214,7 @@ if ( FT_QALLOC( sfnt_data, rlen ) ) return error; - error = FT_Stream_Read( stream, (FT_Byte *)sfnt_data, (FT_ULong)rlen ); + error = FT_Stream_Read( stream, (FT_Byte *)sfnt_data, rlen ); if ( error ) { FT_FREE( sfnt_data ); @@ -2224,7 +2224,7 @@ is_cff = rlen > 4 && !ft_memcmp( sfnt_data, "OTTO", 4 ); error = open_face_from_buffer( library, sfnt_data, - (FT_ULong)rlen, + rlen, face_index_in_resource, is_cff ? "cff" : "truetype", aface ); -- cgit v1.2.1