[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Devel] Compiler error in bdflib.c
From: |
Detlef Würkner |
Subject: |
Re: [Devel] Compiler error in bdflib.c |
Date: |
Wed, 29 May 2002 19:47:32 +0200 |
address@hidden (Erik Strik) wrote:
> The variable ps is not declared in the routine _bdf_parse_glyphs.
> Can somebody fix this.
The following patch fixes
- the too large stack problem of my compiler
- the "ps not declared" problem
- the problem that the BDF driver could crash here with an input file
of 4 bytes in length (this depends on which modules are used, if
the BDF driver was the only font driver it could be reproduced).
----8<----
--- freetype2-current/src/bdf/bdflib.c.ori Wed May 29 08:45:54 2002
+++ freetype2-current/src/bdf/bdflib.c Wed May 29 17:10:01 2002
@@ -643,8 +643,8 @@
unsigned long lineno;
int n, res, done, refill, bytes, hold;
char *ls, *le, *pp, *pe, *hp;
- /* XXX: Use a dynamic buffer */
- char buf[65536L];
+ char *buf = 0;
+ FT_Memory memory = stream->memory;
FT_Error error = BDF_Err_Ok;
@@ -654,6 +654,9 @@
goto Exit;
}
+ if ( FT_NEW_ARRAY( buf, 65536L ) )
+ goto Exit;
+
cb = callback;
lineno = 1;
buf[0] = 0;
@@ -732,6 +735,7 @@
*lno = lineno;
Exit:
+ FT_FREE( buf );
return error;
}
@@ -1740,10 +1744,6 @@
/* the scalable width from the device width. */
FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG9, lineno ));
- ps = (double)font->point_size;
- rx = (double)font->resolution_x;
- dw = (double)glyph->dwidth;
-
glyph->swidth = (unsigned short)FT_MulDiv(
glyph->dwidth, 72000L,
(FT_Long)( font->point_size *
@@ -2294,7 +2294,8 @@
}
/* Free up the list used during the parsing. */
- FT_FREE( p.list.field );
+ if ( memory != NULL )
+ FT_FREE( p.list.field );
if ( p.font != 0 )
{
@@ -2310,6 +2311,8 @@
p.font->comments[p.font->comments_len] = 0;
}
}
+ else if ( error == BDF_Err_Ok )
+ error = BDF_Err_Invalid_File_Format;
*font = p.font;
----8<----
However, I still have BDF font files here that let the driver crash.
And the charmap support seems to be yet incomplete.
Ciao, Detlef
--
_ // address@hidden
\X/ Detlef Wuerkner, Langgoens/Germany