Remove local variables that shadowed global

This commit is contained in:
Chris Thrasher 2022-03-02 19:36:28 -07:00 committed by Lukas Dürrenberger
parent d1ff823d9d
commit f320fc0db4

View File

@ -137,8 +137,7 @@ bool SoundFileWriterWav::writeHeader(unsigned int sampleRate, unsigned int chann
m_file.write(mainChunkId, sizeof(mainChunkId)); m_file.write(mainChunkId, sizeof(mainChunkId));
// Write the main chunk header // Write the main chunk header
Uint32 mainChunkSize = 0; // placeholder, will be written later encode(m_file, static_cast<Uint32>(0)); // 0 is a placeholder, will be written later
encode(m_file, mainChunkSize);
char mainChunkFormat[4] = {'W', 'A', 'V', 'E'}; char mainChunkFormat[4] = {'W', 'A', 'V', 'E'};
m_file.write(mainChunkFormat, sizeof(mainChunkFormat)); m_file.write(mainChunkFormat, sizeof(mainChunkFormat));
@ -182,12 +181,10 @@ void SoundFileWriterWav::close()
// Update the main chunk size and data sub-chunk size // Update the main chunk size and data sub-chunk size
Uint32 fileSize = static_cast<Uint32>(m_file.tellp()); Uint32 fileSize = static_cast<Uint32>(m_file.tellp());
Uint32 mainChunkSize = fileSize - 8; // 8 bytes RIFF header
Uint32 dataChunkSize = fileSize - 44; // 44 bytes RIFF + WAVE headers
m_file.seekp(4); m_file.seekp(4);
encode(m_file, mainChunkSize); encode(m_file, fileSize - 8); // 8 bytes RIFF header
m_file.seekp(40); m_file.seekp(40);
encode(m_file, dataChunkSize); encode(m_file, fileSize - 44); // 44 bytes RIFF + WAVE headers
m_file.close(); m_file.close();
} }