[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master 09223ef92: [pcf] Delay encoding allocation and avoid
From: |
Werner Lemberg |
Subject: |
[freetype2] master 09223ef92: [pcf] Delay encoding allocation and avoid its zeroing. |
Date: |
Wed, 26 Jan 2022 11:27:27 -0500 (EST) |
branch: master
commit 09223ef92925ec3ce76670fd09c0d4e03fb18b26
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
[pcf] Delay encoding allocation and avoid its zeroing.
* src/pcf/pcfread.c (pcf_get_encodings): Refactor and use FT_QNEW_ARRAY.
---
src/pcf/pcfread.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
index e60a0a514..f167bcb8a 100644
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -1034,16 +1034,6 @@ THE SOFTWARE.
enc->lastRow > 0xFF )
return FT_THROW( Invalid_Table );
- nencoding = (FT_ULong)( enc->lastCol - enc->firstCol + 1 ) *
- (FT_ULong)( enc->lastRow - enc->firstRow + 1 );
-
- if ( FT_NEW_ARRAY( enc->offset, nencoding ) )
- goto Bail;
-
- error = FT_Stream_EnterFrame( stream, 2 * nencoding );
- if ( error )
- goto Exit;
-
FT_TRACE5(( "\n" ));
defaultCharRow = enc->defaultChar >> 8;
@@ -1064,6 +1054,13 @@ THE SOFTWARE.
defaultCharCol = enc->firstCol;
}
+ nencoding = (FT_ULong)( enc->lastCol - enc->firstCol + 1 ) *
+ (FT_ULong)( enc->lastRow - enc->firstRow + 1 );
+
+ error = FT_Stream_EnterFrame( stream, 2 * nencoding );
+ if ( error )
+ goto Bail;
+
/*
* FreeType mandates that glyph index 0 is the `undefined glyph', which
* PCF calls the `default character'. However, FreeType needs glyph
@@ -1109,6 +1106,9 @@ THE SOFTWARE.
/* copy metrics of default character to index 0 */
face->metrics[0] = face->metrics[defaultCharEncodingOffset];
+ if ( FT_QNEW_ARRAY( enc->offset, nencoding ) )
+ goto Bail;
+
/* now loop over all values */
offset = enc->offset;
for ( i = enc->firstRow; i <= enc->lastRow; i++ )
@@ -1131,11 +1131,6 @@ THE SOFTWARE.
}
FT_Stream_ExitFrame( stream );
- return error;
-
- Exit:
- FT_FREE( enc->offset );
-
Bail:
return error;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master 09223ef92: [pcf] Delay encoding allocation and avoid its zeroing.,
Werner Lemberg <=