GRIM: Don't bother checking if the value returned from new is nulll

It can never be null and will throw an exception if it can't allocate the
memory
This commit is contained in:
Joel Teichroeb 2014-02-04 13:07:17 -08:00
parent e65d98801e
commit dbfd0efab6
3 changed files with 0 additions and 10 deletions

View file

@ -59,15 +59,11 @@ void Font::load(const Common::String &filename, Common::SeekableReadStream *data
// Read character indexes - are the key/value reversed? // Read character indexes - are the key/value reversed?
_charIndex = new uint16[_numChars]; _charIndex = new uint16[_numChars];
if (!_charIndex)
error("Could not load font %s. Out of memory", _filename.c_str());
for (uint i = 0; i < _numChars; ++i) for (uint i = 0; i < _numChars; ++i)
_charIndex[i] = data->readUint16LE(); _charIndex[i] = data->readUint16LE();
// Read character headers // Read character headers
_charHeaders = new CharHeader[_numChars]; _charHeaders = new CharHeader[_numChars];
if (!_charHeaders)
error("Could not load font %s. Out of memory", _filename.c_str());
for (uint i = 0; i < _numChars; ++i) { for (uint i = 0; i < _numChars; ++i) {
_charHeaders[i].offset = data->readUint32LE(); _charHeaders[i].offset = data->readUint32LE();
_charHeaders[i].width = data->readSByte(); _charHeaders[i].width = data->readSByte();
@ -85,8 +81,6 @@ void Font::load(const Common::String &filename, Common::SeekableReadStream *data
} }
// Read font data // Read font data
_fontData = new byte[_dataSize]; _fontData = new byte[_dataSize];
if (!_fontData)
error("Could not load font %s. Out of memory", _filename.c_str());
data->read(_fontData, _dataSize); data->read(_fontData, _dataSize);

View file

@ -1074,8 +1074,6 @@ void GfxOpenGLS::createFont(Font *font) {
uint arraySize = size * size * bpp * charsWide * charsHigh; uint arraySize = size * size * bpp * charsWide * charsHigh;
byte *temp = new byte[arraySize]; byte *temp = new byte[arraySize];
if (!temp)
error("Could not allocate %d bytes", arraySize);
memset(temp, 0, arraySize); memset(temp, 0, arraySize);

View file

@ -257,8 +257,6 @@ bool MsCabinet::Decompressor::decompressFile(byte *&fileBuf, const FileEntry &en
return false; return false;
_fileBuf = new byte[entry.length]; _fileBuf = new byte[entry.length];
if (!_fileBuf)
return false;
buf_tmp = _fileBuf; buf_tmp = _fileBuf;