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

Commit bd3577ef authored by Pablo Ceballos's avatar Pablo Ceballos
Browse files

Make sure constructors initialize all members

- Add default constructors to Parcelables that didn't have them and
  make sure all members are initialized by the constructors.
- Add missing fields to BufferItem flatten/unflatten.

Change-Id: I9aa83b326dc3aee757762e63be499dc96a74df91
parent ab708f69
Loading
Loading
Loading
Loading
+10 −11
Original line number Original line Diff line number Diff line
@@ -339,20 +339,19 @@ public:
        void setSurfaceDamage(const Region& damage) { surfaceDamage = damage; }
        void setSurfaceDamage(const Region& damage) { surfaceDamage = damage; }


    private:
    private:
        int64_t timestamp;
        int64_t timestamp{0};
        int isAutoTimestamp;
        int isAutoTimestamp{0};
        android_dataspace dataSpace;
        android_dataspace dataSpace{HAL_DATASPACE_UNKNOWN};
        Rect crop;
        Rect crop;
        int scalingMode;
        int scalingMode{0};
        uint32_t transform;
        uint32_t transform{0};
        uint32_t stickyTransform;
        uint32_t stickyTransform{0};
        sp<Fence> fence;
        sp<Fence> fence;
        Region surfaceDamage;
        Region surfaceDamage;
    };
    };


    // QueueBufferOutput must be a POD structure
    // QueueBufferOutput must be a POD structure
    struct __attribute__ ((__packed__)) QueueBufferOutput {
    struct __attribute__ ((__packed__)) QueueBufferOutput {
        inline QueueBufferOutput() { }
        // outWidth - filled with default width applied to the buffer
        // outWidth - filled with default width applied to the buffer
        // outHeight - filled with default height applied to the buffer
        // outHeight - filled with default height applied to the buffer
        // outTransformHint - filled with default transform applied to the buffer
        // outTransformHint - filled with default transform applied to the buffer
@@ -379,10 +378,10 @@ public:
            nextFrameNumber = inNextFrameNumber;
            nextFrameNumber = inNextFrameNumber;
        }
        }
    private:
    private:
        uint32_t width;
        uint32_t width{0};
        uint32_t height;
        uint32_t height{0};
        uint32_t transformHint;
        uint32_t transformHint{0};
        uint32_t numPendingBuffers;
        uint32_t numPendingBuffers{0};
        uint64_t nextFrameNumber{0};
        uint64_t nextFrameNumber{0};
    };
    };


+4 −4
Original line number Original line Diff line number Diff line
@@ -74,10 +74,10 @@ struct layer_state_t {
    status_t    read(const Parcel& input);
    status_t    read(const Parcel& input);


            struct matrix22_t {
            struct matrix22_t {
                float   dsdx;
                float   dsdx{0};
                float   dtdx;
                float   dtdx{0};
                float   dsdy;
                float   dsdy{0};
                float   dtdy;
                float   dtdy{0};
            };
            };
            sp<IBinder>     surface;
            sp<IBinder>     surface;
            uint32_t        what;
            uint32_t        what;
+11 −11
Original line number Original line Diff line number Diff line
@@ -26,17 +26,17 @@
namespace android {
namespace android {


struct DisplayInfo {
struct DisplayInfo {
    uint32_t w;
    uint32_t w{0};
    uint32_t h;
    uint32_t h{0};
    float xdpi;
    float xdpi{0};
    float ydpi;
    float ydpi{0};
    float fps;
    float fps{0};
    float density;
    float density{0};
    uint8_t orientation;
    uint8_t orientation{0};
    bool secure;
    bool secure{false};
    nsecs_t appVsyncOffset;
    nsecs_t appVsyncOffset{0};
    nsecs_t presentationDeadline;
    nsecs_t presentationDeadline{0};
    int colorTransform;
    int colorTransform{0};
};
};


/* Display orientations as defined in Surface.java and ISurfaceComposer.h. */
/* Display orientations as defined in Surface.java and ISurfaceComposer.h. */
+2 −2
Original line number Original line Diff line number Diff line
@@ -22,8 +22,8 @@
namespace android {
namespace android {


struct DisplayStatInfo {
struct DisplayStatInfo {
    nsecs_t vsyncTime;
    nsecs_t vsyncTime{0};
    nsecs_t vsyncPeriod;
    nsecs_t vsyncPeriod{0};
};
};


}; // namespace android
}; // namespace android
+9 −0
Original line number Original line Diff line number Diff line
@@ -66,6 +66,9 @@ size_t BufferItem::getPodSize() const {
    addAligned(size, mIsDroppable);
    addAligned(size, mIsDroppable);
    addAligned(size, mAcquireCalled);
    addAligned(size, mAcquireCalled);
    addAligned(size, mTransformToDisplayInverse);
    addAligned(size, mTransformToDisplayInverse);
    addAligned(size, mAutoRefresh);
    addAligned(size, mQueuedBuffer);
    addAligned(size, mIsStale);
    return size;
    return size;
}
}


@@ -151,6 +154,9 @@ status_t BufferItem::flatten(
    writeAligned(buffer, size, mIsDroppable);
    writeAligned(buffer, size, mIsDroppable);
    writeAligned(buffer, size, mAcquireCalled);
    writeAligned(buffer, size, mAcquireCalled);
    writeAligned(buffer, size, mTransformToDisplayInverse);
    writeAligned(buffer, size, mTransformToDisplayInverse);
    writeAligned(buffer, size, mAutoRefresh);
    writeAligned(buffer, size, mQueuedBuffer);
    writeAligned(buffer, size, mIsStale);


    return NO_ERROR;
    return NO_ERROR;
}
}
@@ -207,6 +213,9 @@ status_t BufferItem::unflatten(
    readAligned(buffer, size, mIsDroppable);
    readAligned(buffer, size, mIsDroppable);
    readAligned(buffer, size, mAcquireCalled);
    readAligned(buffer, size, mAcquireCalled);
    readAligned(buffer, size, mTransformToDisplayInverse);
    readAligned(buffer, size, mTransformToDisplayInverse);
    readAligned(buffer, size, mAutoRefresh);
    readAligned(buffer, size, mQueuedBuffer);
    readAligned(buffer, size, mIsStale);


    return NO_ERROR;
    return NO_ERROR;
}
}
Loading