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

Commit 48fc6191 authored by Chih-Hung Hsieh's avatar Chih-Hung Hsieh
Browse files

Fix performance-for-range-copy warnings in frameworks/av.

* Use const reference type for loop index variables to avoid unnecessary copy.

Bug: 30413223
Test: build with WITH_TIDY=1
Change-Id: I79969be18569c5bb1ea29ee18ae89a3f9d55ce9c
parent b95106ca
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ Return<void> Omx::allocateNode(
        std::vector<AString> quirkVector;
        if (mParser.getQuirks(name.c_str(), &quirkVector) == OK) {
            uint32_t quirks = 0;
            for (const AString quirk : quirkVector) {
            for (const AString& quirk : quirkVector) {
                if (quirk == "requires-allocate-on-input-ports") {
                    quirks |= kRequiresAllocateBufferOnInputPorts;
                }
+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ status_t OMX::allocateNode(
    std::vector<AString> quirkVector;
    if (mParser.getQuirks(name, &quirkVector) == OK) {
        uint32_t quirks = 0;
        for (const AString quirk : quirkVector) {
        for (const AString& quirk : quirkVector) {
            if (quirk == "requires-allocate-on-input-ports") {
                quirks |= kRequiresAllocateBufferOnInputPorts;
            }
+1 −1
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ binder::Status CameraDeviceClient::submitRequestList(
         */
        SurfaceMap surfaceMap;
        Vector<int32_t> outputStreamIds;
        for (sp<Surface> surface : request.mSurfaceList) {
        for (const sp<Surface>& surface : request.mSurfaceList) {
            if (surface == 0) continue;

            sp<IGraphicBufferProducer> gbp = surface->getIGraphicBufferProducer();
+1 −1
Original line number Diff line number Diff line
@@ -729,7 +729,7 @@ void Camera3OutputStream::onBuffersRemovedLocked(
        const std::vector<sp<GraphicBuffer>>& removedBuffers) {
    sp<Camera3StreamBufferFreedListener> callback = mBufferFreedListener.promote();
    if (callback != nullptr) {
        for (auto gb : removedBuffers) {
        for (const auto& gb : removedBuffers) {
            callback->onBufferFreed(mId, gb->handle);
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -200,7 +200,7 @@ status_t Camera3SharedOutputStream::getEndpointUsage(uint32_t *usage) const {
        // Called before shared buffer queue is constructed.
        *usage = getPresetConsumerUsage();

        for (auto surface : mSurfaces) {
        for (const auto& surface : mSurfaces) {
            if (surface != nullptr) {
                res = getEndpointUsageForSurface(&u, surface);
                *usage |= u;
Loading