From f320fc0db48cc5d3bb8971e2951b1c475bc0649f Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Wed, 2 Mar 2022 19:36:28 -0700 Subject: [PATCH] Remove local variables that shadowed global --- src/SFML/Audio/SoundFileWriterWav.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/SFML/Audio/SoundFileWriterWav.cpp b/src/SFML/Audio/SoundFileWriterWav.cpp index 65275024b..2df02f767 100644 --- a/src/SFML/Audio/SoundFileWriterWav.cpp +++ b/src/SFML/Audio/SoundFileWriterWav.cpp @@ -137,8 +137,7 @@ bool SoundFileWriterWav::writeHeader(unsigned int sampleRate, unsigned int chann m_file.write(mainChunkId, sizeof(mainChunkId)); // Write the main chunk header - Uint32 mainChunkSize = 0; // placeholder, will be written later - encode(m_file, mainChunkSize); + encode(m_file, static_cast(0)); // 0 is a placeholder, will be written later char mainChunkFormat[4] = {'W', 'A', 'V', 'E'}; m_file.write(mainChunkFormat, sizeof(mainChunkFormat)); @@ -182,12 +181,10 @@ void SoundFileWriterWav::close() // Update the main chunk size and data sub-chunk size Uint32 fileSize = static_cast(m_file.tellp()); - Uint32 mainChunkSize = fileSize - 8; // 8 bytes RIFF header - Uint32 dataChunkSize = fileSize - 44; // 44 bytes RIFF + WAVE headers m_file.seekp(4); - encode(m_file, mainChunkSize); + encode(m_file, fileSize - 8); // 8 bytes RIFF header m_file.seekp(40); - encode(m_file, dataChunkSize); + encode(m_file, fileSize - 44); // 44 bytes RIFF + WAVE headers m_file.close(); }