diff options
author | Johannes Schickel | 2009-07-14 18:14:20 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-07-14 18:14:20 +0000 |
commit | 3f1563c8196da151f46f110d8a4ed1b7bffb36f0 (patch) | |
tree | d95aaaebd73a91f6dd66a0835f7842182cdadc53 /graphics/font.cpp | |
parent | aa50dd61e9e698e4106ac0d0ad49cf05ec9b5e19 (diff) | |
download | scummvm-rg350-3f1563c8196da151f46f110d8a4ed1b7bffb36f0.tar.gz scummvm-rg350-3f1563c8196da151f46f110d8a4ed1b7bffb36f0.tar.bz2 scummvm-rg350-3f1563c8196da151f46f110d8a4ed1b7bffb36f0.zip |
Got rid of ioFailed in font code, also added another check for err() when loading bdf fonts from text files.
svn-id: r42486
Diffstat (limited to 'graphics/font.cpp')
-rw-r--r-- | graphics/font.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/graphics/font.cpp b/graphics/font.cpp index 1c958f3c3c..e0c9fdecf4 100644 --- a/graphics/font.cpp +++ b/graphics/font.cpp @@ -572,8 +572,10 @@ bitmap_t bdf_hexval(unsigned char *buf) { NewFont *NewFont::loadFont(Common::SeekableReadStream &stream) { NewFontData *data = bdf_read_font(stream); - if (!data) + if (!data || stream.err()) { + free_font(data); return 0; + } FontDesc desc; desc.name = data->name; @@ -673,7 +675,7 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) { data->defaultchar = stream.readUint16BE(); data->bits_size = stream.readUint32BE(); - data->bits = (bitmap_t*)malloc(sizeof(bitmap_t)*data->bits_size); + data->bits = (bitmap_t *)malloc(sizeof(bitmap_t) * data->bits_size); if (!data->bits) { free(data); return 0; @@ -685,7 +687,7 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) { bool hasOffsetTable = (stream.readByte() != 0); if (hasOffsetTable) { - data->offset = (unsigned long*)malloc(sizeof(unsigned long)*data->size); + data->offset = (unsigned long *)malloc(sizeof(unsigned long) * data->size); if (!data->offset) { free(data->bits); free(data); @@ -699,7 +701,7 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) { bool hasWidthTable = (stream.readByte() != 0); if (hasWidthTable) { - data->width = (unsigned char*)malloc(sizeof(unsigned char)*data->size); + data->width = (unsigned char *)malloc(sizeof(unsigned char) * data->size); if (!data->width) { free(data->bits); free(data->offset); @@ -714,7 +716,7 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) { bool hasBBXTable = (stream.readByte() != 0); if (hasBBXTable) { - data->bbx = (BBX *)malloc(sizeof(BBX)*data->size); + data->bbx = (BBX *)malloc(sizeof(BBX) * data->size); if (!data->bbx) { free(data->bits); free(data->offset); @@ -750,7 +752,7 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) { desc.bits_size = data->bits_size; font = new NewFont(desc, data); - if (!font || stream.ioFailed()) { + if (!font || stream.err()) { free(data->bits); free(data->offset); free(data->width); |