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

Commit b3be0064 authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Fix compiler warning in media/mtp.

BUG=27152673

Change-Id: I0a5a7f2005bd76acf4d09353305b66af3fd29e4b
parent 78229d88
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ LOCAL_SRC_FILES:= \

LOCAL_MODULE:= libmtp

LOCAL_CFLAGS := -DMTP_DEVICE -DMTP_HOST
LOCAL_CFLAGS := -DMTP_DEVICE -DMTP_HOST -Wall -Wextra -Werror

LOCAL_SHARED_LIBRARIES := libutils libcutils liblog libusbhost libbinder

+1 −1
Original line number Diff line number Diff line
@@ -456,7 +456,7 @@ int MtpDataPacket::read(struct usb_request *request) {
        // look at the length field to see if the data spans multiple packets
        uint32_t totalLength = MtpPacket::getUInt32(MTP_CONTAINER_LENGTH_OFFSET);
        allocate(totalLength);
        while (totalLength > length) {
        while (totalLength > static_cast<uint32_t>(length)) {
            request->buffer = mBuffer + length;
            request->buffer_length = totalLength - length;
            int ret = transfer(request);
+5 −2
Original line number Diff line number Diff line
@@ -505,6 +505,7 @@ bool MtpDevice::sendObject(MtpObjectHandle handle, int size, int srcFD) {
    int remaining = size;
    mRequest.reset();
    mRequest.setParameter(1, handle);
    bool error = false;
    if (sendRequest(MTP_OPERATION_SEND_OBJECT)) {
        // send data header
        writeDataHeader(MTP_OPERATION_SEND_OBJECT, remaining);
@@ -514,7 +515,9 @@ bool MtpDevice::sendObject(MtpObjectHandle handle, int size, int srcFD) {
        while (remaining > 0) {
            int count = read(srcFD, buffer, sizeof(buffer));
            if (count > 0) {
                int written = mData.write(mRequestOut, buffer, count);
                if (mData.write(mRequestOut, buffer, count) < 0) {
                    error = true;
                }
                // FIXME check error
                remaining -= count;
            } else {
@@ -523,7 +526,7 @@ bool MtpDevice::sendObject(MtpObjectHandle handle, int size, int srcFD) {
        }
    }
    MtpResponseCode ret = readResponse();
    return (remaining == 0 && ret == MTP_RESPONSE_OK);
    return (remaining == 0 && ret == MTP_RESPONSE_OK && !error);
}

bool MtpDevice::deleteObject(MtpObjectHandle handle) {
+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ void MtpPacket::dump() {
    char buffer[500];
    char* bufptr = buffer;

    for (int i = 0; i < mPacketSize; i++) {
    for (size_t i = 0; i < mPacketSize; i++) {
        sprintf(bufptr, "%02X ", mBuffer[i]);
        bufptr += strlen(bufptr);
        if (i % DUMP_BYTES_PER_ROW == (DUMP_BYTES_PER_ROW - 1)) {
+1 −1
Original line number Diff line number Diff line
@@ -544,7 +544,7 @@ MtpPropertyValue* MtpProperty::readArrayValues(MtpDataPacket& packet, uint32_t&
    MtpPropertyValue* result = new MtpPropertyValue[length];
    for (uint32_t i = 0; i < length; i++)
        if (!readValue(packet, result[i])) {
            delete result;
            delete [] result;
            return NULL;
        }
    return result;
Loading