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

Commit 6b6f4313 authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "Fix string copy termination" into pi-dev

parents 0c4ef750 7e820c5c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include <pthread.h>
#include <stdio.h>
#include <string.h>
#include <audio_utils/string.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))

@@ -117,7 +118,7 @@ BufLogStream::BufLogStream(unsigned int id,
    mByteCount = 0l;
    mPaused = false;
    if (tag != NULL) {
        strncpy(mTag, tag, BUFLOGSTREAM_MAX_TAGSIZE);
        (void)audio_utils_strlcpy(mTag, tag);
    } else {
        mTag[0] = 0;
    }
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ LOCAL_C_INCLUDES := \
    frameworks/av/services/audiopolicy/common/include \
    frameworks/av/services/audiopolicy \
    frameworks/av/services/audiopolicy/utilities \
    system/media/audio_utils/include \

ifeq ($(USE_XML_AUDIO_POLICY_CONF), 1)

+3 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#define LOG_TAG "APM::Devices"
//#define LOG_NDEBUG 0

#include <audio_utils/string.h>
#include "DeviceDescriptor.h"
#include "TypeConverter.h"
#include "AudioGain.h"
@@ -247,7 +248,7 @@ void DeviceDescriptor::toAudioPortConfig(struct audio_port_config *dstConfig,
    // ALOG_ASSERT(mModule != NULL);
    dstConfig->ext.device.hw_module =
            mModule != 0 ? mModule->getHandle() : AUDIO_MODULE_HANDLE_NONE;
    strncpy(dstConfig->ext.device.address, mAddress.string(), AUDIO_DEVICE_MAX_ADDRESS_LEN);
    (void)audio_utils_strlcpy_zerofill(dstConfig->ext.device.address, mAddress.string());
}

void DeviceDescriptor::toAudioPort(struct audio_port *port) const
@@ -258,7 +259,7 @@ void DeviceDescriptor::toAudioPort(struct audio_port *port) const
    toAudioPortConfig(&port->active_config);
    port->ext.device.type = mDeviceType;
    port->ext.device.hw_module = mModule->getHandle();
    strncpy(port->ext.device.address, mAddress.string(), AUDIO_DEVICE_MAX_ADDRESS_LEN);
    (void)audio_utils_strlcpy_zerofill(port->ext.device.address, mAddress.string());
}

void DeviceDescriptor::importAudioPort(const sp<AudioPort>& port, bool force) {