From c38a6c0ed2e07ad5ccab0f9eeadbe61316803ab8 Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Mon, 29 Jul 2013 17:05:42 -0400
Subject: [PATCH] * #26842: audio: remove superfluous typedefs

---
 daemon/src/audio/audiorecord.cpp     | 22 +++++++++++-----------
 daemon/src/audio/audiorecord.h       |  2 +-
 daemon/src/audio/sound/audiofile.cpp | 16 ++++++++--------
 daemon/src/sfl_types.h               |  2 --
 4 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/daemon/src/audio/audiorecord.cpp b/daemon/src/audio/audiorecord.cpp
index f1ec33d38c..11d3ec2f2c 100644
--- a/daemon/src/audio/audiorecord.cpp
+++ b/daemon/src/audio/audiorecord.cpp
@@ -44,18 +44,18 @@
 
 struct wavhdr {
     char riff[4];           // "RIFF"
-    SINT32 file_size;       // in bytes
+    int32_t file_size;       // in bytes
     char wave[4];           // "WAVE"
     char fmt[4];            // "fmt "
-    SINT32 chunk_size;      // in bytes (16 for PCM)
-    SINT16 format_tag;      // 1=PCM, 2=ADPCM, 3=IEEE float, 6=A-Law, 7=Mu-Law
-    SINT16 num_chans;       // 1=mono, 2=stereo
-    SINT32 sample_rate;
-    SINT32 bytes_per_sec;
-    SINT16 bytes_per_samp;  // 2=16-bit mono, 4=16-bit stereo
-    SINT16 bits_per_samp;
+    int32_t chunk_size;      // in bytes (16 for PCM)
+    int16_t format_tag;      // 1=PCM, 2=ADPCM, 3=IEEE float, 6=A-Law, 7=Mu-Law
+    int16_t num_chans;       // 1=mono, 2=stereo
+    int32_t sample_rate;
+    int32_t bytes_per_sec;
+    int16_t bytes_per_samp;  // 2=16-bit mono, 4=16-bit stereo
+    int16_t bits_per_samp;
     char data[4];           // "data"
-    SINT32 data_length;     // in bytes
+    int32_t data_length;     // in bytes
 };
 
 namespace {
@@ -388,7 +388,7 @@ void AudioRecord::closeWavFile()
 
     DEBUG("Close wave file");
 
-    SINT32 bytes = byteCounter_ * channels_;
+    int32_t bytes = byteCounter_ * channels_;
 
     // jump to data length
     if (fseek(fileHandle_, 40, SEEK_SET) != 0)
@@ -397,7 +397,7 @@ void AudioRecord::closeWavFile()
     if (ferror(fileHandle_))
         WARN("Can't reach offset 40 while closing");
 
-    fwrite(&bytes, sizeof(SINT32), 1, fileHandle_);
+    fwrite(&bytes, sizeof(int32_t), 1, fileHandle_);
 
     if (ferror(fileHandle_))
         WARN("Can't write bytes for data length ");
diff --git a/daemon/src/audio/audiorecord.h b/daemon/src/audio/audiorecord.h
index 3fb91948e8..45df4aeac7 100644
--- a/daemon/src/audio/audiorecord.h
+++ b/daemon/src/audio/audiorecord.h
@@ -145,7 +145,7 @@ class AudioRecord {
         /**
          * Number of channels
          */
-        SINT16 channels_;
+        int16_t channels_;
 
         /**
          * Number of byte recorded
diff --git a/daemon/src/audio/sound/audiofile.cpp b/daemon/src/audio/sound/audiofile.cpp
index 5256b82182..c440cfbf30 100644
--- a/daemon/src/audio/sound/audiofile.cpp
+++ b/daemon/src/audio/sound/audiofile.cpp
@@ -134,7 +134,7 @@ WaveFile::WaveFile(const std::string &fileName, unsigned int sampleRate) : Audio
     if (maxIteration == 0)
         throw AudioFileException("Could not find \"fmt \" chunk");
 
-    SINT32 chunkSize; // fmt chunk size
+    int32_t chunkSize; // fmt chunk size
     fileStream.read(reinterpret_cast<char *>(&chunkSize), sizeof chunkSize); // Read fmt chunk size.
     unsigned short formatTag; // data compression tag
     fileStream.read(reinterpret_cast<char *>(&formatTag), sizeof formatTag);
@@ -143,24 +143,24 @@ WaveFile::WaveFile(const std::string &fileName, unsigned int sampleRate) : Audio
         throw AudioFileException("File contains an unsupported data format type");
 
     // Get number of channels from the header.
-    SINT16 chan;
+    int16_t chan;
     fileStream.read(reinterpret_cast<char *>(&chan), sizeof chan);
 
     if (chan > 2)
         throw AudioFileException("WaveFile: unsupported number of channels");
 
     // Get file sample rate from the header.
-    SINT32 fileRate;
+    int32_t fileRate;
     fileStream.read(reinterpret_cast<char *>(&fileRate), sizeof fileRate);
 
-    SINT32 avgb;
+    int32_t avgb;
     fileStream.read(reinterpret_cast<char *>(&avgb), sizeof avgb);
 
-    SINT16 blockal;
+    int16_t blockal;
     fileStream.read(reinterpret_cast<char *>(&blockal), sizeof blockal);
 
     // Determine the data type
-    SINT16 dt;
+    int16_t dt;
     fileStream.read(reinterpret_cast<char *>(&dt), sizeof dt);
 
     if (dt != 8 && dt != 16 && dt != 32)
@@ -174,11 +174,11 @@ WaveFile::WaveFile(const std::string &fileName, unsigned int sampleRate) : Audio
         fileStream.read(data, sizeof data / sizeof *data);
 
     // Samplerate converter initialized with 88200 sample long
-    const int rate = static_cast<SINT32>(sampleRate_);
+    const int rate = static_cast<int32_t>(sampleRate_);
     SamplerateConverter converter(std::max(fileRate, rate));
 
     // Get length of data from the header.
-    SINT32 bytes;
+    int32_t bytes;
     fileStream.read(reinterpret_cast<char *>(&bytes), sizeof bytes);
 
     // sample frames, should not be longer than a minute
diff --git a/daemon/src/sfl_types.h b/daemon/src/sfl_types.h
index bbd167447f..f8a9617398 100644
--- a/daemon/src/sfl_types.h
+++ b/daemon/src/sfl_types.h
@@ -36,8 +36,6 @@
 
 typedef int16_t SFLDataFormat;
 #define SFL_DATA_FORMAT_MAX SHRT_MAX
-typedef int16_t SINT16;
-typedef int32_t SINT32;
 
 static const size_t SIZEBUF = 400000; /** About 12 sec of buffering at 8000 Hz*/
 
-- 
GitLab