OSDN Git Service

Fix a few clang-tidy warnings
authorGlenn Kasten <gkasten@google.com>
Fri, 18 Nov 2016 23:28:42 +0000 (15:28 -0800)
committerGlenn Kasten <gkasten@google.com>
Fri, 18 Nov 2016 23:29:41 +0000 (15:29 -0800)
Test: still builds
Change-Id: I6583f4f600a24a0784cdda186f77d5cacffc6cc5

audio_utils/include/audio_utils/fifo.h
audio_utils/include/audio_utils/sndfile.h
audio_utils/include/audio_utils/spdif/SPDIFEncoder.h
audio_utils/spdif/SPDIFEncoder.cpp
audio_utils/tests/fifo_tests.cpp

index 3eeff7b..58c4c3f 100644 (file)
@@ -297,7 +297,7 @@ public:
      *
      * \param fifo Associated FIFO.  Passed by reference because it must be non-NULL.
      */
-    audio_utils_fifo_writer(audio_utils_fifo& fifo);
+    explicit audio_utils_fifo_writer(audio_utils_fifo& fifo);
     virtual ~audio_utils_fifo_writer();
 
     /**
@@ -412,7 +412,7 @@ public:
      * \param throttlesWriter Whether this reader throttles the writer.
      *                        At most one reader can specify throttlesWriter == true.
      */
-    audio_utils_fifo_reader(audio_utils_fifo& fifo, bool throttlesWriter = true);
+    explicit audio_utils_fifo_reader(audio_utils_fifo& fifo, bool throttlesWriter = true);
     virtual ~audio_utils_fifo_reader();
 
     /**
index 958b414..6346295 100644 (file)
@@ -67,7 +67,7 @@ void sf_close(SNDFILE *handle);
  * Read interleaved frames
  * \return actual number of frames read
  */
-sf_count_t sf_readf_short(SNDFILE *handle, short *ptr, sf_count_t desired);
+sf_count_t sf_readf_short(SNDFILE *handle, int16_t *ptr, sf_count_t desired);
 sf_count_t sf_readf_float(SNDFILE *handle, float *ptr, sf_count_t desired);
 sf_count_t sf_readf_int(SNDFILE *handle, int *ptr, sf_count_t desired);
 
@@ -75,7 +75,7 @@ sf_count_t sf_readf_int(SNDFILE *handle, int *ptr, sf_count_t desired);
  * Write interleaved frames
  * \return actual number of frames written
  */
-sf_count_t sf_writef_short(SNDFILE *handle, const short *ptr, sf_count_t desired);
+sf_count_t sf_writef_short(SNDFILE *handle, const int16_t *ptr, sf_count_t desired);
 sf_count_t sf_writef_float(SNDFILE *handle, const float *ptr, sf_count_t desired);
 sf_count_t sf_writef_int(SNDFILE *handle, const int *ptr, sf_count_t desired);
 
index 96421ac..3c84d73 100644 (file)
@@ -105,8 +105,8 @@ protected:
     // state variable, true if scanning for start of frame
     bool      mScanning;
 
-    static const unsigned short kSPDIFSync1; // Pa
-    static const unsigned short kSPDIFSync2; // Pb
+    static const uint16_t kSPDIFSync1; // Pa
+    static const uint16_t kSPDIFSync2; // Pb
 };
 
 }  // namespace android
index efcd556..5c62299 100644 (file)
@@ -27,8 +27,8 @@
 namespace android {
 
 // Burst Preamble defined in IEC61937-1
-const unsigned short SPDIFEncoder::kSPDIFSync1 = 0xF872; // Pa
-const unsigned short SPDIFEncoder::kSPDIFSync2 = 0x4E1F; // Pb
+const uint16_t SPDIFEncoder::kSPDIFSync1 = 0xF872; // Pa
+const uint16_t SPDIFEncoder::kSPDIFSync2 = 0x4E1F; // Pb
 
 static int32_t sEndianDetector = 1;
 #define isLittleEndian()  (*((uint8_t *)&sEndianDetector))
index 08c1e08..b015810 100644 (file)
@@ -95,8 +95,8 @@ usage:
         sf_close(sfin);
         return EXIT_FAILURE;
     }
-    size_t frameSize = sizeof(short) * sfinfoin.channels;
-    short *inputBuffer = new short[sfinfoin.frames * sfinfoin.channels];
+    size_t frameSize = sizeof(int16_t) * sfinfoin.channels;
+    int16_t *inputBuffer = new int16_t[sfinfoin.frames * sfinfoin.channels];
     sf_count_t actualRead = sf_readf_short(sfin, inputBuffer, sfinfoin.frames);
     if (actualRead != sfinfoin.frames) {
         fprintf(stderr, "%s: unexpected EOF or error\n", inputFile);
@@ -105,10 +105,10 @@ usage:
     }
     sf_close(sfin);
 
-    short *outputBuffer = new short[sfinfoin.frames * sfinfoin.channels];
+    int16_t *outputBuffer = new int16_t[sfinfoin.frames * sfinfoin.channels];
     size_t framesWritten = 0;
     size_t framesRead = 0;
-    short *fifoBuffer = new short[frameCount * sfinfoin.channels];
+    int16_t *fifoBuffer = new int16_t[frameCount * sfinfoin.channels];
     audio_utils_fifo fifo(frameCount, frameSize, fifoBuffer, readerThrottlesWriter);
     audio_utils_fifo_writer fifoWriter(fifo);
     audio_utils_fifo_reader fifoReader(fifo, readerThrottlesWriter);