Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1137be1a authored by Glenn Kasten's avatar Glenn Kasten
Browse files

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
parent 5dd4754f
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -72,10 +72,8 @@ static void android_media_ToneGenerator_release(JNIEnv *env, jobject thiz) {

    env->SetIntField(thiz, fields.context, 0);

    if (lpToneGen) {
    delete lpToneGen;
}
}

static void android_media_ToneGenerator_native_setup(JNIEnv *env, jobject thiz,
        jint streamType, jint volume) {
+4 −3
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -559,7 +559,7 @@ public:
        if (status != NO_ERROR) {
            return status;
        }
        if (numEffects) {
        if (numEffects != NULL) {
            *numEffects = (uint32_t)reply.readInt32();
        }
        return NO_ERROR;
+3 −5
Original line number Diff line number Diff line
@@ -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;
    }
    mMutex.lock();
    mTid = -1;
    mCondition.signal();
Loading