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

Commit 698fcc12 authored by Mike Lockwood's avatar Mike Lockwood Committed by Android (Google) Code Review
Browse files

Merge changes I2491a2ce,Ie1c88bd8

* changes:
  MtpCursor: Fix long to int truncation bug
  MtpCursor: Remove some unused variables
parents 42bf092c e11eba3c
Loading
Loading
Loading
Loading
+1 −13
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ public final class MtpCursor extends AbstractWindowedCursor {
    static final String TAG = "MtpCursor";
    static final int NO_COUNT = -1;

    /* constants for mQueryType */
    /* constants for queryType */
    public static final int DEVICE              = 1;
    public static final int DEVICE_ID           = 2;
    public static final int STORAGE             = 3;
@@ -41,27 +41,15 @@ public final class MtpCursor extends AbstractWindowedCursor {
    public static final int STORAGE_CHILDREN    = 7;
    public static final int OBJECT_CHILDREN     = 8;

    private int mQueryType;
    private int mDeviceID;
    private long mStorageID;
    private long mQbjectID;

    /** The names of the columns in the projection */
    private String[] mColumns;

    /** The number of rows in the cursor */
    private int mCount = NO_COUNT;

    private final MtpClient mClient;

    public MtpCursor(MtpClient client, int queryType, int deviceID, long storageID, long objectID,
            String[] projection) {

        mClient = client;
        mQueryType = queryType;
        mDeviceID = deviceID;
        mStorageID = storageID;
        mQbjectID = objectID;
        mColumns = projection;

        HashMap<String, Integer> map;
+1 −2
Original line number Diff line number Diff line
@@ -399,8 +399,7 @@ bool MtpCursor::prepareRow(CursorWindow* window) {
}


bool MtpCursor::putLong(CursorWindow* window, int value, int row, int column) {

bool MtpCursor::putLong(CursorWindow* window, int64_t value, int row, int column) {
    if (!window->putLong(row, column, value)) {
        window->freeLastRow();
        LOGE("Failed allocating space for a long in column %d", column);
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ private:
                        MtpObjectHandle objectID, int row);

    bool        prepareRow(CursorWindow* window);
    bool        putLong(CursorWindow* window, int value, int row, int column);
    bool        putLong(CursorWindow* window, int64_t value, int row, int column);
    bool        putString(CursorWindow* window, const char* text, int row, int column);
    bool        putThumbnail(CursorWindow* window, MtpObjectHandle objectID,
                            MtpObjectFormat format, int row, int column);