mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-12 12:09:15 +00:00
JANITORIAL: Replace new[]/memset with new[]()
Mostly done using the following Ruby script: (Dir.glob('**/*.cpp') + Dir.glob('**/*.h')).each do |file| s = File.read(file, encoding: 'iso8859-1') t = s.gsub(/(([\w_.\[\]]+)\s*=\s*new\s+\S+?\[[^\]]+?\](?!\())([^\{\}]*?)\n\s+memset\(\s*\2\s*,\s*0\s*,[^;]*;/m, '\1()\3') if t != s File.open(file, 'w') { |io| io.write(t) } end end
This commit is contained in:
parent
c8bd7716ea
commit
7a4e5612de
@ -590,9 +590,8 @@ Common::SeekableReadStream *WMACodec::decodeSuperFrame(Common::SeekableReadStrea
|
||||
|
||||
// PCM output data
|
||||
outputDataSize = frameCount * _channels * _frameLen;
|
||||
outputData = new int16[outputDataSize];
|
||||
outputData = new int16[outputDataSize]();
|
||||
|
||||
memset(outputData, 0, outputDataSize * 2);
|
||||
|
||||
// Number of bits data that completes the last superframe's overhang.
|
||||
int bitOffset = bits.getBits(_byteOffsetBits + 3);
|
||||
@ -664,9 +663,8 @@ Common::SeekableReadStream *WMACodec::decodeSuperFrame(Common::SeekableReadStrea
|
||||
|
||||
// PCM output data
|
||||
outputDataSize = _channels * _frameLen;
|
||||
outputData = new int16[outputDataSize];
|
||||
outputData = new int16[outputDataSize]();
|
||||
|
||||
memset(outputData, 0, outputDataSize * 2);
|
||||
|
||||
// Decode the frame
|
||||
if (!decodeFrame(bits, outputData)) {
|
||||
|
@ -1347,8 +1347,7 @@ void ModXmS3mStream::setSequencePos(int pos) {
|
||||
_playCount = new int8 *[_module.sequenceLen];
|
||||
memset(_playCount, 0, _module.sequenceLen * sizeof(int8 *));
|
||||
int len = initPlayCount(_playCount);
|
||||
_playCount[0] = new int8[len];
|
||||
memset(_playCount[0], 0, len * sizeof(int8));
|
||||
_playCount[0] = new int8[len]();
|
||||
initPlayCount(_playCount);
|
||||
|
||||
for (int idx = 0; idx < _module.numChannels; ++idx) {
|
||||
|
@ -218,8 +218,7 @@ bool ModuleModXmS3m::loadMod(Common::SeekableReadStream &st) {
|
||||
|
||||
// load instruments
|
||||
numInstruments = 31;
|
||||
instruments = new Instrument[numInstruments + 1];
|
||||
memset(instruments, 0, sizeof(Instrument) * (numInstruments + 1));
|
||||
instruments = new Instrument[numInstruments + 1]();
|
||||
instruments[0].numSamples = 1;
|
||||
instruments[0].samples = new Sample[1];
|
||||
memset(&instruments[0].samples[0], 0, sizeof(Sample));
|
||||
@ -332,8 +331,7 @@ bool ModuleModXmS3m::loadMod(Common::SeekableReadStream &st) {
|
||||
*/
|
||||
|
||||
int numNotes = patterns[i].numChannels * patterns[i].numRows;
|
||||
patterns[i].notes = new Note[numNotes];
|
||||
memset(patterns[i].notes, 0, numNotes * sizeof(Note));
|
||||
patterns[i].notes = new Note[numNotes]();
|
||||
for (int idx = 0; idx < numNotes; ++idx) {
|
||||
byte first = st.readByte();
|
||||
byte second = st.readByte();
|
||||
@ -451,8 +449,7 @@ bool ModuleModXmS3m::loadXm(Common::SeekableReadStream &st) {
|
||||
// load notes
|
||||
patterns[i].numChannels = numChannels;
|
||||
int numNotes = patterns[i].numRows * numChannels;
|
||||
patterns[i].notes = new Note[numNotes];
|
||||
memset(patterns[i].notes, 0, numNotes * sizeof(Note));
|
||||
patterns[i].notes = new Note[numNotes]();
|
||||
|
||||
if (patDataLength > 0) {
|
||||
for (int j = 0; j < numNotes; ++j) {
|
||||
@ -484,10 +481,8 @@ bool ModuleModXmS3m::loadXm(Common::SeekableReadStream &st) {
|
||||
}
|
||||
|
||||
// load instruments
|
||||
instruments = new Instrument[numInstruments + 1];
|
||||
memset(instruments, 0, (numInstruments + 1) * sizeof(Instrument));
|
||||
instruments[0].samples = new Sample[1];
|
||||
memset(instruments[0].samples, 0, sizeof(Sample));
|
||||
instruments = new Instrument[numInstruments + 1]();
|
||||
instruments[0].samples = new Sample[1]();
|
||||
for (int i = 1; i <= numInstruments; ++i) {
|
||||
st.seek(offset, SEEK_SET);
|
||||
offset += st.readUint32LE();
|
||||
@ -501,8 +496,7 @@ bool ModuleModXmS3m::loadXm(Common::SeekableReadStream &st) {
|
||||
// load sample number
|
||||
int nSamples = st.readUint16LE();
|
||||
ins.numSamples = nSamples > 0 ? nSamples : 1;
|
||||
ins.samples = new Sample[ins.numSamples];
|
||||
memset(ins.samples, 0, ins.numSamples * sizeof(Sample));
|
||||
ins.samples = new Sample[ins.numSamples]();
|
||||
st.readUint32LE(); // skip 4 byte
|
||||
|
||||
// load instrument informations
|
||||
@ -656,16 +650,13 @@ bool ModuleModXmS3m::loadS3m(Common::SeekableReadStream &st) {
|
||||
int moduleDataIndex = st.pos();
|
||||
|
||||
// load instruments
|
||||
instruments = new Instrument[numInstruments + 1];
|
||||
memset(instruments, 0, sizeof(Instrument) * (numInstruments + 1));
|
||||
instruments = new Instrument[numInstruments + 1]();
|
||||
instruments[0].numSamples = 1;
|
||||
instruments[0].samples = new Sample[1];
|
||||
memset(instruments[0].samples, 0, sizeof(Sample));
|
||||
instruments[0].samples = new Sample[1]();
|
||||
for (int i = 1; i <= numInstruments; ++i) {
|
||||
Instrument &instrum = instruments[i];
|
||||
instrum.numSamples = 1;
|
||||
instrum.samples = new Sample[1];
|
||||
memset(instrum.samples, 0, sizeof(Sample));
|
||||
instrum.samples = new Sample[1]();
|
||||
Sample &sample = instrum.samples[0];
|
||||
|
||||
// get instrument offset
|
||||
@ -725,8 +716,7 @@ bool ModuleModXmS3m::loadS3m(Common::SeekableReadStream &st) {
|
||||
}
|
||||
|
||||
// load patterns
|
||||
patterns = new Pattern[numPatterns];
|
||||
memset(patterns, 0, numPatterns * sizeof(Pattern));
|
||||
patterns = new Pattern[numPatterns]();
|
||||
for (int i = 0; i < numPatterns; ++i) {
|
||||
patterns[i].numChannels = numChannels;
|
||||
patterns[i].numRows = 64;
|
||||
@ -737,8 +727,7 @@ bool ModuleModXmS3m::loadS3m(Common::SeekableReadStream &st) {
|
||||
st.seek(patOffset, SEEK_SET);
|
||||
|
||||
// load notes
|
||||
patterns[i].notes = new Note[numChannels * 64];
|
||||
memset(patterns[i].notes, 0, numChannels * 64 * sizeof(Note));
|
||||
patterns[i].notes = new Note[numChannels * 64]();
|
||||
int row = 0;
|
||||
while (row < 64) {
|
||||
byte token = st.readByte();
|
||||
@ -794,8 +783,7 @@ bool ModuleModXmS3m::loadS3m(Common::SeekableReadStream &st) {
|
||||
}
|
||||
|
||||
// load default panning
|
||||
defaultPanning = new byte[numChannels];
|
||||
memset(defaultPanning, 0, numChannels);
|
||||
defaultPanning = new byte[numChannels]();
|
||||
for (int chan = 0; chan < 32; ++chan) {
|
||||
if (channelMap[chan] >= 0) {
|
||||
byte panning = 7;
|
||||
@ -837,8 +825,7 @@ bool ModuleModXmS3m::loadAmf(Common::SeekableReadStream &st) {
|
||||
st.read(sequence, 256); // Always 256 bytes in the file.
|
||||
|
||||
// Read sample headers..
|
||||
instruments = new Instrument[numInstruments + 1];
|
||||
memset(instruments, 0, sizeof(Instrument) * (numInstruments + 1));
|
||||
instruments = new Instrument[numInstruments + 1]();
|
||||
instruments[0].numSamples = 1;
|
||||
instruments[0].samples = new Sample[1];
|
||||
memset(&instruments[0].samples[0], 0, sizeof(Sample));
|
||||
@ -874,16 +861,14 @@ bool ModuleModXmS3m::loadAmf(Common::SeekableReadStream &st) {
|
||||
st.skip((64 - numInstruments) * 37); // 37 == sample header len
|
||||
|
||||
// load patterns
|
||||
patterns = new Pattern[numPatterns];
|
||||
memset(patterns, 0, numPatterns * sizeof(Pattern));
|
||||
patterns = new Pattern[numPatterns]();
|
||||
for (int i = 0; i < numPatterns; ++i) {
|
||||
// Always 8 channels, 64 rows.
|
||||
patterns[i].numChannels = 8;
|
||||
patterns[i].numRows = 64;
|
||||
|
||||
// load notes
|
||||
patterns[i].notes = new Note[8 * 64];
|
||||
memset(patterns[i].notes, 0, 8 * 64 * sizeof(Note));
|
||||
patterns[i].notes = new Note[8 * 64]();
|
||||
for (int row = 0; row < 64; row++) {
|
||||
for (int channel = 0; channel < 8; channel++) {
|
||||
Note &n = patterns[i].notes[row * 8 + channel];
|
||||
|
@ -190,8 +190,7 @@ bool SegaAudioInterfaceInternal::init() {
|
||||
if (!TownsPC98_FmSynth::init())
|
||||
return false;
|
||||
|
||||
_pcmBanks = new int8[0x10000];
|
||||
memset(_pcmBanks, 0, 0x10000);
|
||||
_pcmBanks = new int8[0x10000]();
|
||||
_pcmChan = new SegaPCMChannel*[8];
|
||||
_psgDev = new SegaPSG(7670454 / 72, 16);
|
||||
_pcmDev = new PCMDevice_Base(33300, 16, 8);
|
||||
|
@ -1139,8 +1139,7 @@ int TownsPC98_FmSynth::readBuffer(int16 *buffer, const int numSamples) {
|
||||
}
|
||||
delete[] _renderBuffer;
|
||||
_renderBufferSize = requiredSize;
|
||||
_renderBuffer = new int32[_renderBufferSize];
|
||||
memset(_renderBuffer, 0, sizeof(int32) * _renderBufferSize);
|
||||
_renderBuffer = new int32[_renderBufferSize]();
|
||||
}
|
||||
|
||||
int outSamplesLeft = numSamples >> 1;
|
||||
@ -1320,8 +1319,7 @@ void TownsPC98_FmSynth::generateTables() {
|
||||
}
|
||||
|
||||
delete[] _oprRateshift;
|
||||
_oprRateshift = new uint8[130];
|
||||
memset(_oprRateshift, 0, 130);
|
||||
_oprRateshift = new uint8[130]();
|
||||
dst = (uint8 *)_oprRateshift + 32;
|
||||
for (int i = 11; i; i--) {
|
||||
memset(dst, i, 4);
|
||||
@ -1334,8 +1332,7 @@ void TownsPC98_FmSynth::generateTables() {
|
||||
_oprFrq[i] = (uint32)i << (11 - _rateScale);
|
||||
|
||||
delete[] _oprAttackDecay;
|
||||
_oprAttackDecay = new uint8[152];
|
||||
memset(_oprAttackDecay, 0, 152);
|
||||
_oprAttackDecay = new uint8[152]();
|
||||
for (int i = 0; i < 36; i++)
|
||||
WRITE_BE_UINT32(_oprAttackDecay + (i << 2), _adtStat[i]);
|
||||
|
||||
|
@ -349,10 +349,8 @@ GLESFakePaletteTexture::GLESFakePaletteTexture(GLenum glFormat, GLenum glType,
|
||||
_palettePixelFormat = pixelFormat;
|
||||
_fake_format = Graphics::PixelFormat::createFormatCLUT8();
|
||||
|
||||
_palette = new uint16[256];
|
||||
_palette = new uint16[256]();
|
||||
assert(_palette);
|
||||
|
||||
memset(_palette, 0, 256 * 2);
|
||||
}
|
||||
|
||||
GLESFakePaletteTexture::~GLESFakePaletteTexture() {
|
||||
|
@ -618,8 +618,7 @@ bool PspUnitTests::testFileSystem() {
|
||||
}
|
||||
|
||||
// read the contents
|
||||
char *readBuffer = new char[BufSize + 4];
|
||||
memset(readBuffer, 0, (BufSize + 4));
|
||||
char *readBuffer = new char[BufSize + 4]();
|
||||
index = readBuffer;
|
||||
while (rdStream->read(index, 100) == 100) {
|
||||
index += 100;
|
||||
@ -682,8 +681,7 @@ bool PspUnitTests::testFileSystem() {
|
||||
return false;
|
||||
}
|
||||
|
||||
char *readPhrase = new char[phraseLen + 2];
|
||||
memset(readPhrase, 0, phraseLen + 2);
|
||||
char *readPhrase = new char[phraseLen + 2]();
|
||||
|
||||
if ((ret = rdStream->read(readPhrase, phraseLen) != phraseLen)) {
|
||||
PSP_ERROR("read error on phrase. Got %d instead of %d\n", ret, phraseLen);
|
||||
|
@ -320,8 +320,7 @@ void String::encodeWindows932(const U32String &src) {
|
||||
loadCJKTables();
|
||||
|
||||
if (!reverseTable && windows932ConversionTable) {
|
||||
uint16 *rt = new uint16[0x10000];
|
||||
memset(rt, 0, sizeof(rt[0]) * 0x10000);
|
||||
uint16 *rt = new uint16[0x10000]();
|
||||
for (uint highidx = 0; highidx < 47; highidx++) {
|
||||
uint8 high = 0;
|
||||
if (highidx < 4)
|
||||
@ -390,8 +389,7 @@ void String::encodeWindows949(const U32String &src) {
|
||||
loadCJKTables();
|
||||
|
||||
if (!reverseTable && windows949ConversionTable) {
|
||||
uint16 *rt = new uint16[0x10000];
|
||||
memset(rt, 0, sizeof(rt[0]) * 0x10000);
|
||||
uint16 *rt = new uint16[0x10000]();
|
||||
|
||||
for (uint lowidx = 0; lowidx < 0xb2; lowidx++) {
|
||||
uint8 low = 0;
|
||||
@ -480,8 +478,7 @@ void String::encodeWindows950(const U32String &src, bool transliterate) {
|
||||
loadCJKTables();
|
||||
|
||||
if (!reverseTable && windows950ConversionTable) {
|
||||
uint16 *rt = new uint16[0x10000];
|
||||
memset(rt, 0, sizeof(rt[0]) * 0x10000);
|
||||
uint16 *rt = new uint16[0x10000]();
|
||||
|
||||
for (uint lowidx = 0; lowidx < 157; lowidx++) {
|
||||
uint8 low = 0;
|
||||
|
@ -123,9 +123,8 @@ bool WinResources::loadFromCompressedEXE(const String &fileName) {
|
||||
file.readByte(); // file name character change
|
||||
uint32 unpackedLength = file.readUint32LE();
|
||||
|
||||
byte *window = new byte[0x1000];
|
||||
byte *window = new byte[0x1000]();
|
||||
int pos = 0x1000 - 16;
|
||||
memset(window, 0x20, 0x1000); // Initialize to all spaces
|
||||
|
||||
byte *unpackedData = (byte *)malloc(unpackedLength);
|
||||
assert(unpackedData);
|
||||
|
@ -576,8 +576,7 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, int sla
|
||||
data._rowWords = newBitmapWidth;
|
||||
|
||||
uint bitImageSize = data._rowWords * data._fRectHeight;
|
||||
data._bitImage = new byte[bitImageSize];
|
||||
memset(data._bitImage, 0, bitImageSize * sizeof(byte));
|
||||
data._bitImage = new byte[bitImageSize]();
|
||||
|
||||
int dstPitch = data._rowWords;
|
||||
|
||||
|
@ -83,8 +83,7 @@ void SourceScaler::setSource(const byte *src, uint pitch, int width, int height,
|
||||
|
||||
// Give _oldSrc same pitch
|
||||
int size = (height + padding * 2) * pitch;
|
||||
_oldSrc = new byte[size];
|
||||
memset(_oldSrc, 0, size);
|
||||
_oldSrc = new byte[size]();
|
||||
|
||||
_bufferedOutput.create(_width * _factor, _height * _factor, _format);
|
||||
}
|
||||
|
@ -75,8 +75,7 @@ inline uint16 makeQuickTimeDitherColor(byte r, byte g, byte b) {
|
||||
} // End of anonymous namespace
|
||||
|
||||
byte *Codec::createQuickTimeDitherTable(const byte *palette, uint colorCount) {
|
||||
byte *buf = new byte[0x10000];
|
||||
memset(buf, 0, 0x10000);
|
||||
byte *buf = new byte[0x10000]();
|
||||
|
||||
Common::List<uint16> checkQueue;
|
||||
|
||||
|
@ -155,8 +155,7 @@ void Indeo3Decoder::allocFrames() {
|
||||
_iv_frame[0].the_buf_size = bufsize;
|
||||
_iv_frame[1].the_buf_size = 0;
|
||||
|
||||
_iv_frame[0].the_buf = new byte[bufsize];
|
||||
memset(_iv_frame[0].the_buf, 0, bufsize);
|
||||
_iv_frame[0].the_buf = new byte[bufsize]();
|
||||
_iv_frame[1].the_buf = 0;
|
||||
|
||||
uint32 offs = 0;
|
||||
|
@ -59,16 +59,11 @@ XanDecoder::XanDecoder(int width, int height, int bitsPerPixel) : Codec(),
|
||||
if (width % 2)
|
||||
error("XanDecoder: width must be even, not %d", width);
|
||||
_surface.create(_width, _height, getPixelFormat());
|
||||
_scratchbuf = new uint8[_width * _height + SCRATCH_SPARE];
|
||||
_lumabuf = new uint8[_width * _height];
|
||||
_ybuf = new uint8[_width * _height];
|
||||
_ubuf = new uint8[_width * _height / 2];
|
||||
_vbuf = new uint8[_width * _height / 2];
|
||||
memset(_scratchbuf, 0, _width * _height + SCRATCH_SPARE);
|
||||
memset(_lumabuf, 0, _width * _height);
|
||||
memset(_ybuf, 0, _width * _height);
|
||||
memset(_ubuf, 127, _width * _height / 2);
|
||||
memset(_vbuf, 127, _width * _height / 2);
|
||||
_scratchbuf = new uint8[_width * _height + SCRATCH_SPARE]();
|
||||
_lumabuf = new uint8[_width * _height]();
|
||||
_ybuf = new uint8[_width * _height]();
|
||||
_ubuf = new uint8[_width * _height / 2]();
|
||||
_vbuf = new uint8[_width * _height / 2]();
|
||||
}
|
||||
|
||||
XanDecoder::~XanDecoder() {
|
||||
|
@ -344,9 +344,7 @@ void PICTDecoder::unpackBitsRect(Common::SeekableReadStream &stream, bool withPa
|
||||
|
||||
// Ensure we have enough space in the buffer to hold an entire line's worth of pixels
|
||||
uint32 lineSize = MAX<int>(width * bytesPerPixel + (8 * 2 / packBitsData.pixMap.pixelSize), packBitsData.pixMap.rowBytes);
|
||||
byte *buffer = new byte[lineSize * height];
|
||||
|
||||
memset(buffer, 0, lineSize * height);
|
||||
byte *buffer = new byte[lineSize * height]();
|
||||
|
||||
// Read in amount of data per row
|
||||
for (uint16 i = 0; i < packBitsData.pixMap.bounds.height(); i++) {
|
||||
|
@ -335,8 +335,7 @@ void AVIDecoder::handleStreamHeader(uint32 size) {
|
||||
byte *initialPalette = 0;
|
||||
|
||||
if (bmInfo.bitCount == 8) {
|
||||
initialPalette = new byte[256 * 3];
|
||||
memset(initialPalette, 0, 256 * 3);
|
||||
initialPalette = new byte[256 * 3]();
|
||||
|
||||
byte *palette = initialPalette;
|
||||
for (uint32 i = 0; i < bmInfo.clrUsed; i++) {
|
||||
|
@ -293,23 +293,17 @@ BinkDecoder::BinkVideoTrack::BinkVideoTrack(uint32 width, uint32 height, const G
|
||||
_uvBlockHeight = (height + 15) >> 4;
|
||||
|
||||
// The planes are sized according to the number of blocks
|
||||
_curPlanes[0] = new byte[_yBlockWidth * 8 * _yBlockHeight * 8]; // Y
|
||||
_curPlanes[1] = new byte[_uvBlockWidth * 8 * _uvBlockHeight * 8]; // U, 1/4 resolution
|
||||
_curPlanes[2] = new byte[_uvBlockWidth * 8 * _uvBlockHeight * 8]; // V, 1/4 resolution
|
||||
_curPlanes[0] = new byte[_yBlockWidth * 8 * _yBlockHeight * 8](); // Y
|
||||
_curPlanes[1] = new byte[_uvBlockWidth * 8 * _uvBlockHeight * 8](); // U, 1/4 resolution
|
||||
_curPlanes[2] = new byte[_uvBlockWidth * 8 * _uvBlockHeight * 8](); // V, 1/4 resolution
|
||||
_curPlanes[3] = new byte[_yBlockWidth * 8 * _yBlockHeight * 8]; // A
|
||||
_oldPlanes[0] = new byte[_yBlockWidth * 8 * _yBlockHeight * 8]; // Y
|
||||
_oldPlanes[1] = new byte[_uvBlockWidth * 8 * _uvBlockHeight * 8]; // U, 1/4 resolution
|
||||
_oldPlanes[2] = new byte[_uvBlockWidth * 8 * _uvBlockHeight * 8]; // V, 1/4 resolution
|
||||
_oldPlanes[0] = new byte[_yBlockWidth * 8 * _yBlockHeight * 8](); // Y
|
||||
_oldPlanes[1] = new byte[_uvBlockWidth * 8 * _uvBlockHeight * 8](); // U, 1/4 resolution
|
||||
_oldPlanes[2] = new byte[_uvBlockWidth * 8 * _uvBlockHeight * 8](); // V, 1/4 resolution
|
||||
_oldPlanes[3] = new byte[_yBlockWidth * 8 * _yBlockHeight * 8]; // A
|
||||
|
||||
// Initialize the video with solid green
|
||||
memset(_curPlanes[0], 0, _yBlockWidth * 8 * _yBlockHeight * 8);
|
||||
memset(_curPlanes[1], 0, _uvBlockWidth * 8 * _uvBlockHeight * 8);
|
||||
memset(_curPlanes[2], 0, _uvBlockWidth * 8 * _uvBlockHeight * 8);
|
||||
memset(_curPlanes[3], 255, _yBlockWidth * 8 * _yBlockHeight * 8);
|
||||
memset(_oldPlanes[0], 0, _yBlockWidth * 8 * _yBlockHeight * 8);
|
||||
memset(_oldPlanes[1], 0, _uvBlockWidth * 8 * _uvBlockHeight * 8);
|
||||
memset(_oldPlanes[2], 0, _uvBlockWidth * 8 * _uvBlockHeight * 8);
|
||||
memset(_oldPlanes[3], 255, _yBlockWidth * 8 * _yBlockHeight * 8);
|
||||
|
||||
initBundles();
|
||||
|
@ -742,9 +742,7 @@ bool PreIMDDecoder::loadStream(Common::SeekableReadStream *stream) {
|
||||
_frameCount = _stream->readUint16LE();
|
||||
|
||||
_videoBufferSize = _width * _height;
|
||||
_videoBuffer = new byte[_videoBufferSize];
|
||||
|
||||
memset(_videoBuffer, 0, _videoBufferSize);
|
||||
_videoBuffer = new byte[_videoBufferSize]();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1141,8 +1139,7 @@ bool IMDDecoder::assessVideoProperties() {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
_videoBuffer[i] = new byte[_videoBufferSize];
|
||||
memset(_videoBuffer[i], 0, _videoBufferSize);
|
||||
_videoBuffer[i] = new byte[_videoBufferSize]();
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1958,8 +1955,7 @@ bool VMDDecoder::assessVideoProperties() {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
_videoBuffer[i] = new byte[_videoBufferSize];
|
||||
memset(_videoBuffer[i], 0, _videoBufferSize);
|
||||
_videoBuffer[i] = new byte[_videoBufferSize]();
|
||||
|
||||
_8bppSurface[i].init(_width * _bytesPerPixel, _height, _width * _bytesPerPixel,
|
||||
_videoBuffer[i], Graphics::PixelFormat::createFormatCLUT8());
|
||||
|
@ -107,15 +107,12 @@ DXADecoder::DXAVideoTrack::DXAVideoTrack(Common::SeekableReadStream *stream) {
|
||||
|
||||
_frameSize = _width * _height;
|
||||
_decompBufferSize = _frameSize;
|
||||
_frameBuffer1 = new byte[_frameSize];
|
||||
memset(_frameBuffer1, 0, _frameSize);
|
||||
_frameBuffer2 = new byte[_frameSize];
|
||||
memset(_frameBuffer2, 0, _frameSize);
|
||||
_frameBuffer1 = new byte[_frameSize]();
|
||||
_frameBuffer2 = new byte[_frameSize]();
|
||||
|
||||
_scaledBuffer = 0;
|
||||
if (_scaleMode != S_NONE) {
|
||||
_scaledBuffer = new byte[_frameSize];
|
||||
memset(_scaledBuffer, 0, _frameSize);
|
||||
_scaledBuffer = new byte[_frameSize]();
|
||||
}
|
||||
|
||||
#ifdef DXA_EXPERIMENT_MAXD
|
||||
@ -185,8 +182,7 @@ void DXADecoder::DXAVideoTrack::decodeZlib(byte *data, int size, int totalSize)
|
||||
void DXADecoder::DXAVideoTrack::decode12(int size) {
|
||||
#ifdef USE_ZLIB
|
||||
if (!_decompBuffer) {
|
||||
_decompBuffer = new byte[_decompBufferSize];
|
||||
memset(_decompBuffer, 0, _decompBufferSize);
|
||||
_decompBuffer = new byte[_decompBufferSize]();
|
||||
}
|
||||
|
||||
/* decompress the input data */
|
||||
@ -286,8 +282,7 @@ void DXADecoder::DXAVideoTrack::decode13(int size) {
|
||||
uint8 *codeBuf, *dataBuf, *motBuf, *maskBuf;
|
||||
|
||||
if (!_decompBuffer) {
|
||||
_decompBuffer = new byte[_decompBufferSize];
|
||||
memset(_decompBuffer, 0, _decompBufferSize);
|
||||
_decompBuffer = new byte[_decompBufferSize]();
|
||||
}
|
||||
|
||||
/* decompress the input data */
|
||||
@ -482,8 +477,7 @@ const Graphics::Surface *DXADecoder::DXAVideoTrack::decodeNextFrame() {
|
||||
|
||||
if (!_inBuffer || _inBufferSize < size) {
|
||||
delete[] _inBuffer;
|
||||
_inBuffer = new byte[size];
|
||||
memset(_inBuffer, 0, size);
|
||||
_inBuffer = new byte[size]();
|
||||
_inBufferSize = size;
|
||||
}
|
||||
|
||||
|
@ -91,8 +91,7 @@ FlicDecoder::FlicVideoTrack::FlicVideoTrack(Common::SeekableReadStream *stream,
|
||||
|
||||
_surface = new Graphics::Surface();
|
||||
_surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
|
||||
_palette = new byte[3 * 256];
|
||||
memset(_palette, 0, 3 * 256);
|
||||
_palette = new byte[3 * 256]();
|
||||
_dirtyPalette = false;
|
||||
|
||||
_curFrame = -1;
|
||||
|
@ -184,12 +184,9 @@ HNMDecoder::HNM4VideoTrack::HNM4VideoTrack(uint32 width, uint32 height, uint32 f
|
||||
error("Invalid frameSize: expected %d, got %d", width * height, frameSize);
|
||||
}
|
||||
|
||||
_frameBufferF = new byte[frameSize];
|
||||
memset(_frameBufferF, 0, frameSize);
|
||||
_frameBufferC = new byte[frameSize];
|
||||
memset(_frameBufferC, 0, frameSize);
|
||||
_frameBufferP = new byte[frameSize];
|
||||
memset(_frameBufferP, 0, frameSize);
|
||||
_frameBufferF = new byte[frameSize]();
|
||||
_frameBufferC = new byte[frameSize]();
|
||||
_frameBufferP = new byte[frameSize]();
|
||||
|
||||
// We will use _frameBufferF/C/P as the surface pixels, just init there with nullptr to avoid unintended usage of surface
|
||||
const Graphics::PixelFormat &f = Graphics::PixelFormat::createFormatCLUT8();
|
||||
|
@ -152,8 +152,7 @@ Common::QuickTimeParser::SampleDesc *QuickTimeDecoder::readSampleDesc(Common::Qu
|
||||
// if the depth is 2, 4, or 8 bpp, file is palettized
|
||||
if (colorDepth == 2 || colorDepth == 4 || colorDepth == 8) {
|
||||
// Initialize the palette
|
||||
entry->_palette = new byte[256 * 3];
|
||||
memset(entry->_palette, 0, 256 * 3);
|
||||
entry->_palette = new byte[256 * 3]();
|
||||
|
||||
if (colorGreyscale) {
|
||||
debug(0, "Greyscale palette");
|
||||
|
Loading…
Reference in New Issue
Block a user