diff options
author | 2012-02-08 17:47:58 -0800 | |
---|---|---|
committer | 2012-02-10 13:48:44 -0800 | |
commit | 1137be1a686fdfc9f02c3aca7c33f28006df4742 (patch) | |
tree | 3a9e31c77f1b3d31e70c5de2e01d5cfb50918df0 | |
parent | 5dd4754f58e5e99f893749ab3bb3eda1de4cfbe7 (diff) |
Follow raw pointer and sp<> conventions
Unconditional delete for raw pointers.
Use "if (sp != 0)" not "if (sp.get() != 0)" or "if (sp != NULL)".
Use "if (raw != NULL)" not "if (raw)".
Change-Id: I531a8da7c37149261ed2f34b862ec4896a4b785b
-rw-r--r-- | core/jni/android_media_ToneGenerator.cpp | 4 | ||||
-rw-r--r-- | media/jni/soundpool/SoundPool.cpp | 7 | ||||
-rw-r--r-- | media/jni/soundpool/SoundPool.h | 2 | ||||
-rw-r--r-- | media/libmedia/IAudioFlinger.cpp | 2 | ||||
-rw-r--r-- | media/libmedia/JetPlayer.cpp | 8 | ||||
-rw-r--r-- | media/libmedia/ToneGenerator.cpp | 2 | ||||
-rw-r--r-- | services/audioflinger/AudioPolicyService.cpp | 4 |
7 files changed, 13 insertions, 16 deletions
diff --git a/core/jni/android_media_ToneGenerator.cpp b/core/jni/android_media_ToneGenerator.cpp index aabb77803a76..0a337fae781e 100644 --- a/core/jni/android_media_ToneGenerator.cpp +++ b/core/jni/android_media_ToneGenerator.cpp @@ -72,9 +72,7 @@ static void android_media_ToneGenerator_release(JNIEnv *env, jobject thiz) { env->SetIntField(thiz, fields.context, 0); - if (lpToneGen) { - delete lpToneGen; - } + delete lpToneGen; } static void android_media_ToneGenerator_native_setup(JNIEnv *env, jobject thiz, diff --git a/media/jni/soundpool/SoundPool.cpp b/media/jni/soundpool/SoundPool.cpp index 0d51def5a254..df4fbb55bc7e 100644 --- a/media/jni/soundpool/SoundPool.cpp +++ b/media/jni/soundpool/SoundPool.cpp @@ -840,7 +840,7 @@ void SoundChannel::autoResume() void SoundChannel::setRate(float rate) { Mutex::Autolock lock(&mLock); - if (mAudioTrack != 0 && mSample.get() != 0) { + if (mAudioTrack != NULL && mSample != 0) { uint32_t sampleRate = uint32_t(float(mSample->sampleRate()) * rate + 0.5); mAudioTrack->setSampleRate(sampleRate); mRate = rate; @@ -852,7 +852,8 @@ void SoundChannel::setVolume_l(float leftVolume, float rightVolume) { mLeftVolume = leftVolume; mRightVolume = rightVolume; - if (mAudioTrack != 0) mAudioTrack->setVolume(leftVolume, rightVolume); + if (mAudioTrack != NULL) + mAudioTrack->setVolume(leftVolume, rightVolume); } void SoundChannel::setVolume(float leftVolume, float rightVolume) @@ -864,7 +865,7 @@ void SoundChannel::setVolume(float leftVolume, float rightVolume) void SoundChannel::setLoop(int loop) { Mutex::Autolock lock(&mLock); - if (mAudioTrack != 0 && mSample.get() != 0) { + if (mAudioTrack != NULL && mSample != 0) { uint32_t loopEnd = mSample->size()/mNumChannels/ ((mSample->format() == AUDIO_FORMAT_PCM_16_BIT) ? sizeof(int16_t) : sizeof(uint8_t)); mAudioTrack->setLoop(0, loopEnd, loop); diff --git a/media/jni/soundpool/SoundPool.h b/media/jni/soundpool/SoundPool.h index 6b11c289e69d..002b04558d48 100644 --- a/media/jni/soundpool/SoundPool.h +++ b/media/jni/soundpool/SoundPool.h @@ -116,7 +116,7 @@ protected: class SoundChannel : public SoundEvent { public: enum state { IDLE, RESUMING, STOPPING, PAUSED, PLAYING }; - SoundChannel() : mAudioTrack(0), mState(IDLE), mNumChannels(1), + SoundChannel() : mAudioTrack(NULL), mState(IDLE), mNumChannels(1), mPos(0), mToggle(0), mAutoPaused(false) {} ~SoundChannel(); void init(SoundPool* soundPool); diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp index c3252e75e921..4507e5db7683 100644 --- a/media/libmedia/IAudioFlinger.cpp +++ b/media/libmedia/IAudioFlinger.cpp @@ -559,7 +559,7 @@ public: if (status != NO_ERROR) { return status; } - if (numEffects) { + if (numEffects != NULL) { *numEffects = (uint32_t)reply.readInt32(); } return NO_ERROR; diff --git a/media/libmedia/JetPlayer.cpp b/media/libmedia/JetPlayer.cpp index 8456db567778..6cb5b8247130 100644 --- a/media/libmedia/JetPlayer.cpp +++ b/media/libmedia/JetPlayer.cpp @@ -246,14 +246,12 @@ int JetPlayer::render() { }//while (1) threadExit: - if (mAudioTrack) { + if (mAudioTrack != NULL) { mAudioTrack->stop(); mAudioTrack->flush(); } - if (mAudioBuffer) { - delete [] mAudioBuffer; - mAudioBuffer = NULL; - } + delete [] mAudioBuffer; + mAudioBuffer = NULL; mMutex.lock(); mTid = -1; mCondition.signal(); diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp index dfa41c443eb7..6cb10aa4e3ad 100644 --- a/media/libmedia/ToneGenerator.cpp +++ b/media/libmedia/ToneGenerator.cpp @@ -1045,7 +1045,7 @@ bool ToneGenerator::initAudioTrack() { initAudioTrack_exit: // Cleanup - if (mpAudioTrack) { + if (mpAudioTrack != NULL) { ALOGV("Delete Track I: %p", mpAudioTrack); delete mpAudioTrack; mpAudioTrack = NULL; diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp index af464b2b0cca..f8b430ea8f52 100644 --- a/services/audioflinger/AudioPolicyService.cpp +++ b/services/audioflinger/AudioPolicyService.cpp @@ -588,10 +588,10 @@ status_t AudioPolicyService::dump(int fd, const Vector<String16>& args) } dumpInternals(fd); - if (mAudioCommandThread != NULL) { + if (mAudioCommandThread != 0) { mAudioCommandThread->dump(fd); } - if (mTonePlaybackThread != NULL) { + if (mTonePlaybackThread != 0) { mTonePlaybackThread->dump(fd); } |