From 88913c0139ac6d1dfb356d3048702b7bc8ef4079 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 20 Jun 2011 00:59:48 +0200 Subject: ALL: Remove trailing whitespaces This tries to make our code a bit more compliant with our code formatting conventions. For future use, this is the command I used: git ls-files "*.cpp" "*.h" | xargs sed -i -e 's/[ \t]*$//' --- graphics/fonts/winfont.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'graphics/fonts/winfont.cpp') diff --git a/graphics/fonts/winfont.cpp b/graphics/fonts/winfont.cpp index 0e87769f2f..8b60f8aa6b 100644 --- a/graphics/fonts/winfont.cpp +++ b/graphics/fonts/winfont.cpp @@ -81,7 +81,7 @@ bool WinFont::loadFromFON(const Common::String &fileName, const WinFontDirEntry return true; // Then try loading via the PE code - return loadFromPE(fileName, dirEntry); + return loadFromPE(fileName, dirEntry); } bool WinFont::loadFromNE(const Common::String &fileName, const WinFontDirEntry &dirEntry) { @@ -98,7 +98,7 @@ bool WinFont::loadFromNE(const Common::String &fileName, const WinFontDirEntry & } uint32 fontId = getFontIndex(*fontDirectory, dirEntry); - + delete fontDirectory; // Couldn't match the face name @@ -133,7 +133,7 @@ bool WinFont::loadFromPE(const Common::String &fileName, const WinFontDirEntry & } uint32 fontId = getFontIndex(*fontDirectory, dirEntry); - + delete fontDirectory; // Couldn't match the face name -- cgit v1.2.3 From 7a882600c6778ad7d0bdd357aba92261ae306550 Mon Sep 17 00:00:00 2001 From: Julien Date: Sun, 5 Jun 2011 04:10:39 +0800 Subject: GRAPHICS: Allocate Common::PEResources on the heap in WinFont::loadFromPE() --- graphics/fonts/winfont.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'graphics/fonts/winfont.cpp') diff --git a/graphics/fonts/winfont.cpp b/graphics/fonts/winfont.cpp index 8b60f8aa6b..3bad92236d 100644 --- a/graphics/fonts/winfont.cpp +++ b/graphics/fonts/winfont.cpp @@ -120,15 +120,18 @@ bool WinFont::loadFromNE(const Common::String &fileName, const WinFontDirEntry & } bool WinFont::loadFromPE(const Common::String &fileName, const WinFontDirEntry &dirEntry) { - Common::PEResources exe; + Common::PEResources *exe = new Common::PEResources(); - if (!exe.loadFromEXE(fileName)) + if (!exe->loadFromEXE(fileName)) { + delete exe; return false; + } // Let's pull out the font directory - Common::SeekableReadStream *fontDirectory = exe.getResource(Common::kPEFontDir, Common::String("FONTDIR")); + Common::SeekableReadStream *fontDirectory = exe->getResource(Common::kPEFontDir, Common::String("FONTDIR")); if (!fontDirectory) { warning("No font directory in '%s'", fileName.c_str()); + delete exe; return false; } @@ -139,18 +142,21 @@ bool WinFont::loadFromPE(const Common::String &fileName, const WinFontDirEntry & // Couldn't match the face name if (fontId == 0xffffffff) { warning("Could not find face '%s' in '%s'", dirEntry.faceName.c_str(), fileName.c_str()); + delete exe; return false; } // Actually go get our font now... - Common::SeekableReadStream *fontStream = exe.getResource(Common::kPEFont, fontId); + Common::SeekableReadStream *fontStream = exe->getResource(Common::kPEFont, fontId); if (!fontStream) { warning("Could not find font %d in %s", fontId, fileName.c_str()); + delete exe; return false; } bool ok = loadFromFNT(*fontStream); delete fontStream; + delete exe; return ok; } -- cgit v1.2.3