OSDN Git Service

Fix build warnings
authorGlenn Kasten <gkasten@google.com>
Mon, 28 Jul 2014 23:34:45 +0000 (16:34 -0700)
committerGlenn Kasten <gkasten@google.com>
Tue, 29 Jul 2014 22:45:38 +0000 (15:45 -0700)
Change-Id: Ife5e40264f43fb3ccb40830228701003fe106bf5

services/audioflinger/AudioMixerOps.h
services/audioflinger/AudioResamplerDyn.cpp
services/audioflinger/AudioResamplerFirProcess.h
services/audioflinger/tests/resampler_tests.cpp
services/audioflinger/tests/test-mixer.cpp
services/audioflinger/tests/test_utils.h

index 49131f6..f7376a8 100644 (file)
@@ -184,7 +184,7 @@ inline int16_t MixMul<int16_t, float, float>(float value, float volume) {
 template <typename TO, typename TI>
 inline void MixAccum(TO *auxaccum, TI value) {
     if (!is_same<TO, TI>::value) {
-        LOG_ALWAYS_FATAL("MixAccum type not properly specialized: %d %d\n",
+        LOG_ALWAYS_FATAL("MixAccum type not properly specialized: %zu %zu\n",
                 sizeof(TO), sizeof(TI));
     }
     *auxaccum += value;
index e201ff8..159ab70 100644 (file)
@@ -82,17 +82,17 @@ template<typename TC, typename TI, typename TO>
 void AudioResamplerDyn<TC, TI, TO>::InBuffer::resize(int CHANNELS, int halfNumCoefs)
 {
     // calculate desired state size
-    int stateCount = halfNumCoefs * CHANNELS * 2 * kStateSizeMultipleOfFilterLength;
+    size_t stateCount = halfNumCoefs * CHANNELS * 2 * kStateSizeMultipleOfFilterLength;
 
     // check if buffer needs resizing
     if (mState
             && stateCount == mStateCount
-            && mRingFull-mState == mStateCount-halfNumCoefs*CHANNELS) {
+            && mRingFull-mState == (ssize_t) (mStateCount-halfNumCoefs*CHANNELS)) {
         return;
     }
 
     // create new buffer
-    TI* state;
+    TI* state = NULL;
     (void)posix_memalign(reinterpret_cast<void**>(&state), 32, stateCount*sizeof(*state));
     memset(state, 0, stateCount*sizeof(*state));
 
@@ -213,7 +213,7 @@ template<typename TC, typename TI, typename TO>
 void AudioResamplerDyn<TC, TI, TO>::createKaiserFir(Constants &c,
         double stopBandAtten, int inSampleRate, int outSampleRate, double tbwCheat)
 {
-    TC* buf;
+    TC* buf = NULL;
     static const double atten = 0.9998;   // to avoid ripple overflow
     double fcr;
     double tbw = firKaiserTbw(c.mHalfNumCoefs, stopBandAtten);
index d130013..efc8055 100644 (file)
@@ -177,7 +177,7 @@ struct InterpNull {
 template <int CHANNELS, int STRIDE, typename TFUNC, typename TC, typename TI, typename TO, typename TINTERP>
 static inline
 void ProcessBase(TO* const out,
-        int count,
+        size_t count,
         const TC* coefsP,
         const TC* coefsN,
         const TI* sP,
index 169ce02..d6217ba 100644 (file)
@@ -60,7 +60,7 @@ void buffercmp(const void *reference, const void *test,
         int check = memcmp((const char*)reference + i * outputFrameSize,
                 (const char*)test + i * outputFrameSize, outputFrameSize);
         if (check) {
-            ALOGE("Failure at frame %d", i);
+            ALOGE("Failure at frame %zu", i);
             ASSERT_EQ(check, 0); /* fails */
         }
     }
index 5a00f40..9a4fad6 100644 (file)
@@ -62,7 +62,7 @@ static int writeFile(const char *filename, const void *buffer,
     info.samplerate = sampleRate;
     info.channels = channels;
     info.format = SF_FORMAT_WAV | (isBufferFloat ? SF_FORMAT_FLOAT : SF_FORMAT_PCM_16);
-    printf("saving file:%s  channels:%d  samplerate:%d  frames:%d\n",
+    printf("saving file:%s  channels:%u  samplerate:%u  frames:%zu\n",
             filename, info.channels, info.samplerate, frames);
     SNDFILE *sf = sf_open(filename, SFM_WRITE, &info);
     if (sf == NULL) {
index e446216..3d51cdc 100644 (file)
@@ -120,7 +120,7 @@ public:
         }
         if (!mInputIncr.empty()) {
             size_t provided = mInputIncr[mNextIdx++];
-            ALOGV("getNextBuffer() mValue[%d]=%u not %u",
+            ALOGV("getNextBuffer() mValue[%zu]=%zu not %zu",
                     mNextIdx-1, provided, buffer->frameCount);
             if (provided < buffer->frameCount) {
                 buffer->frameCount = provided;
@@ -129,8 +129,8 @@ public:
                 mNextIdx = 0;
             }
         }
-        ALOGV("getNextBuffer() requested %u frames out of %u frames available"
-                " and returned %u frames\n",
+        ALOGV("getNextBuffer() requested %zu frames out of %zu frames available"
+                " and returned %zu frames",
                 requestedFrames, mNumFrames - mNextFrame, buffer->frameCount);
         mUnrel = buffer->frameCount;
         if (buffer->frameCount > 0) {
@@ -145,14 +145,14 @@ public:
     virtual void releaseBuffer(Buffer* buffer)
     {
         if (buffer->frameCount > mUnrel) {
-            ALOGE("releaseBuffer() released %u frames but only %u available "
-                    "to release\n", buffer->frameCount, mUnrel);
+            ALOGE("releaseBuffer() released %zu frames but only %zu available "
+                    "to release", buffer->frameCount, mUnrel);
             mNextFrame += mUnrel;
             mUnrel = 0;
         } else {
 
-            ALOGV("releaseBuffer() released %u frames out of %u frames available "
-                    "to release\n", buffer->frameCount, mUnrel);
+            ALOGV("releaseBuffer() released %zu frames out of %zu frames available "
+                    "to release", buffer->frameCount, mUnrel);
             mNextFrame += buffer->frameCount;
             mUnrel -= buffer->frameCount;
         }