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

Commit 01a80269 authored by Glenn Kasten's avatar Glenn Kasten Committed by Android (Google) Code Review
Browse files

Merge "Use 0 not NULL for sp<> and wp<>"

parents 35624c17 706b618c
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -809,9 +809,8 @@ status_t AudioFlinger::setParameters(int ioHandle, const String8& keyValuePairs)
            }
        }
    }
    if (thread != NULL) {
        result = thread->setParameters(keyValuePairs);
        return result;
    if (thread != 0) {
        return thread->setParameters(keyValuePairs);
    }
    return BAD_VALUE;
}
@@ -3206,7 +3205,7 @@ void AudioFlinger::DuplicatingThread::updateWaitTime()
    mWaitTimeMs = UINT_MAX;
    for (size_t i = 0; i < mOutputTracks.size(); i++) {
        sp<ThreadBase> strong = mOutputTracks[i]->thread().promote();
        if (strong != NULL) {
        if (strong != 0) {
            uint32_t waitTimeMs = (strong->frameCount() * 2 * 1000) / strong->sampleRate();
            if (waitTimeMs < mWaitTimeMs) {
                mWaitTimeMs = waitTimeMs;
@@ -3329,9 +3328,12 @@ AudioFlinger::ThreadBase::TrackBase::~TrackBase()
        }
    }
    mCblkMemory.clear();            // and free the shared memory
    if (mClient != NULL) {
    if (mClient != 0) {
        // Client destructor must run with AudioFlinger mutex locked
        Mutex::Autolock _l(mClient->audioFlinger()->mLock);
        // If the client's reference count drops to zero, the associated destructor
        // must run with AudioFlinger lock held. Thus the explicit clear() rather than
        // relying on the automatic clear() at end of scope.
        mClient.clear();
    }
}
@@ -3485,7 +3487,7 @@ void AudioFlinger::PlaybackThread::Track::dump(char* buffer, size_t size)
    uint32_t vlr = mCblk->getVolumeLR();
    snprintf(buffer, size, "   %05d %05d %03u %03u 0x%08x %05u   %04u %1d %1d %1d %05u %05u %05u  0x%08x 0x%08x 0x%08x 0x%08x\n",
            mName - AudioMixer::TRACK0,
            (mClient == NULL) ? getpid() : mClient->pid(),
            (mClient == 0) ? getpid() : mClient->pid(),
            mStreamType,
            mFormat,
            mChannelMask,
@@ -3812,7 +3814,7 @@ void AudioFlinger::RecordThread::RecordTrack::stop()
void AudioFlinger::RecordThread::RecordTrack::dump(char* buffer, size_t size)
{
    snprintf(buffer, size, "   %05d %03u 0x%08x %05d   %04u %01d %05u  %08x %08x\n",
            (mClient == NULL) ? getpid() : mClient->pid(),
            (mClient == 0) ? getpid() : mClient->pid(),
            mFormat,
            mChannelMask,
            mSessionId,
@@ -4527,7 +4529,7 @@ sp<AudioFlinger::RecordThread::RecordTrack> AudioFlinger::RecordThread::createR
        track = new RecordTrack(this, client, sampleRate,
                      format, channelMask, frameCount, flags, sessionId);

        if (track->getCblk() == NULL) {
        if (track->getCblk() == 0) {
            lStatus = NO_MEMORY;
            goto Exit;
        }
@@ -7101,7 +7103,7 @@ void AudioFlinger::EffectHandle::dump(char* buffer, size_t size)
    bool locked = mCblk != NULL && tryLock(mCblk->lock);

    snprintf(buffer, size, "\t\t\t%05d %05d    %01u    %01u      %05u  %05u\n",
            (mClient == NULL) ? getpid() : mClient->pid(),
            (mClient == 0) ? getpid() : mClient->pid(),
            mPriority,
            mHasControl,
            !locked,
+9 −9
Original line number Diff line number Diff line
@@ -1362,7 +1362,7 @@ static audio_io_handle_t aps_open_output(void *service,
                                             audio_policy_output_flags_t flags)
{
    sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
    if (af == NULL) {
    if (af == 0) {
        ALOGW("%s: could not get AudioFlinger", __func__);
        return 0;
    }
@@ -1376,7 +1376,7 @@ static audio_io_handle_t aps_open_dup_output(void *service,
                                                 audio_io_handle_t output2)
{
    sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
    if (af == NULL) {
    if (af == 0) {
        ALOGW("%s: could not get AudioFlinger", __func__);
        return 0;
    }
@@ -1386,7 +1386,7 @@ static audio_io_handle_t aps_open_dup_output(void *service,
static int aps_close_output(void *service, audio_io_handle_t output)
{
    sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
    if (af == NULL)
    if (af == 0)
        return PERMISSION_DENIED;

    return af->closeOutput(output);
@@ -1395,7 +1395,7 @@ static int aps_close_output(void *service, audio_io_handle_t output)
static int aps_suspend_output(void *service, audio_io_handle_t output)
{
    sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
    if (af == NULL) {
    if (af == 0) {
        ALOGW("%s: could not get AudioFlinger", __func__);
        return PERMISSION_DENIED;
    }
@@ -1406,7 +1406,7 @@ static int aps_suspend_output(void *service, audio_io_handle_t output)
static int aps_restore_output(void *service, audio_io_handle_t output)
{
    sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
    if (af == NULL) {
    if (af == 0) {
        ALOGW("%s: could not get AudioFlinger", __func__);
        return PERMISSION_DENIED;
    }
@@ -1422,7 +1422,7 @@ static audio_io_handle_t aps_open_input(void *service,
                                            audio_in_acoustics_t acoustics)
{
    sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
    if (af == NULL) {
    if (af == 0) {
        ALOGW("%s: could not get AudioFlinger", __func__);
        return 0;
    }
@@ -1434,7 +1434,7 @@ static audio_io_handle_t aps_open_input(void *service,
static int aps_close_input(void *service, audio_io_handle_t input)
{
    sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
    if (af == NULL)
    if (af == 0)
        return PERMISSION_DENIED;

    return af->closeInput(input);
@@ -1444,7 +1444,7 @@ static int aps_set_stream_output(void *service, audio_stream_type_t stream,
                                     audio_io_handle_t output)
{
    sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
    if (af == NULL)
    if (af == 0)
        return PERMISSION_DENIED;

    return af->setStreamOutput(stream, output);
@@ -1455,7 +1455,7 @@ static int aps_move_effects(void *service, int session,
                                audio_io_handle_t dst_output)
{
    sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
    if (af == NULL)
    if (af == 0)
        return PERMISSION_DENIED;

    return af->moveEffects(session, (int)src_output, (int)dst_output);