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

Commit e80b7993 authored by Nicolas Roard's avatar Nicolas Roard
Browse files

Small refactor for reset buffer

Test: in main repository

Change-Id: I4d95899b9f49bc0973c63371b19739b56844aebc
parent 9720fee8
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -49,8 +49,13 @@ public class RemoteComposeBuffer {
        this.mRemoteComposeState = remoteComposeState;
    }

    public void reset() {
        mBuffer.reset();
    /**
     * Reset the internal buffers
     *
     * @param expectedSize provided hint for the main buffer size
     */
    public void reset(int expectedSize) {
        mBuffer.reset(expectedSize);
        mRemoteComposeState.reset();
    }

@@ -288,8 +293,7 @@ public class RemoteComposeBuffer {
    public static void read(InputStream fd, RemoteComposeBuffer buffer) {
        try {
            byte[] bytes = readAllBytes(fd);
            buffer.reset();
            buffer.mBuffer.resize(bytes.length);
            buffer.reset(bytes.length);
            System.arraycopy(bytes, 0, buffer.mBuffer.mBuffer, 0, bytes.length);
            buffer.mBuffer.mSize = bytes.length;
        } catch (Exception e) {
+9 −1
Original line number Diff line number Diff line
@@ -83,10 +83,18 @@ public class WireBuffer {
        mIndex = currentIndex;
    }

    public void reset() {
    /**
     * Reset the internal buffer
     *
     * @param expectedSize provided hint for the buffer size
     */
    public void reset(int expectedSize) {
        mIndex = 0;
        mStartingIndex = 0;
        mSize = 0;
        if (expectedSize > mMaxSize) {
            resize(expectedSize);
        }
    }

    public int size() {
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ public class BitmapData implements Operation {
    int mImageWidth;
    int mImageHeight;
    byte[] mBitmap;
    public static final int MAX_IMAGE_DIMENSION = 6000;
    public static final int MAX_IMAGE_DIMENSION = 8000;

    public static final Companion COMPANION = new Companion();