diff options
author | Max Horn | 2004-08-01 10:02:41 +0000 |
---|---|---|
committer | Max Horn | 2004-08-01 10:02:41 +0000 |
commit | 4ef4583523df87d0db73aed58b5d0a4145affa2e (patch) | |
tree | f29ef61cd6d2edad5f33a9f29dcd70f41a146fa7 /saga/font.cpp | |
parent | 69cf6a070a927ef17932f6d4303460ed5e867668 (diff) | |
download | scummvm-rg350-4ef4583523df87d0db73aed58b5d0a4145affa2e.tar.gz scummvm-rg350-4ef4583523df87d0db73aed58b5d0a4145affa2e.tar.bz2 scummvm-rg350-4ef4583523df87d0db73aed58b5d0a4145affa2e.zip |
Oh the beauty of stack based objects: they free themselves automatically, so you don't leak them all the time (fixed 10e6 object leaks :-)
svn-id: r14417
Diffstat (limited to 'saga/font.cpp')
-rw-r--r-- | saga/font.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/saga/font.cpp b/saga/font.cpp index 42936fd3c0..02e1a81973 100644 --- a/saga/font.cpp +++ b/saga/font.cpp @@ -118,7 +118,7 @@ int FONT_Load(uint32 font_rn, int font_id) { FontModule.err_str = "Invalid font length."; } - MemoryReadStream *readS = new MemoryReadStream(fontres_p, fontres_len); + MemoryReadStream readS(fontres_p, fontres_len); // Create new font structure font = (R_FONT *)malloc(sizeof *font); @@ -128,9 +128,9 @@ int FONT_Load(uint32 font_rn, int font_id) { } // Read font header - fh.c_height = readS->readUint16LE(); - fh.c_width = readS->readUint16LE(); - fh.row_length = readS->readUint16LE(); + fh.c_height = readS.readUint16LE(); + fh.c_width = readS.readUint16LE(); + fh.row_length = readS.readUint16LE(); debug(1, "FONT_Load(): Reading font resource..."); @@ -152,23 +152,23 @@ int FONT_Load(uint32 font_rn, int font_id) { normal_font->hdr.row_length = fh.row_length; for (c = 0; c < R_FONT_CHARCOUNT; c++) { - normal_font->fce[c].index = readS->readUint16LE(); + normal_font->fce[c].index = readS.readUint16LE(); } for (c = 0; c < R_FONT_CHARCOUNT; c++) { - nbits = normal_font->fce[c].width = readS->readByte(); + nbits = normal_font->fce[c].width = readS.readByte(); normal_font->fce[c].byte_width = GetByteLen(nbits); } for (c = 0; c < R_FONT_CHARCOUNT; c++) { - normal_font->fce[c].flag = readS->readByte(); + normal_font->fce[c].flag = readS.readByte(); } for (c = 0; c < R_FONT_CHARCOUNT; c++) { - normal_font->fce[c].tracking = readS->readByte(); + normal_font->fce[c].tracking = readS.readByte(); } - if (readS->pos() != R_FONT_DESCSIZE) { + if (readS.pos() != R_FONT_DESCSIZE) { warning("Invalid font resource size."); return R_FAILURE; } |