Loading media/mtp/Android.mk +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading media/mtp/MtpDataPacket.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -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); Loading media/mtp/MtpDevice.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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 { Loading @@ -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) { Loading media/mtp/MtpPacket.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -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)) { Loading media/mtp/MtpProperty.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading
media/mtp/Android.mk +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading
media/mtp/MtpDataPacket.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -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); Loading
media/mtp/MtpDevice.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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 { Loading @@ -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) { Loading
media/mtp/MtpPacket.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -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)) { Loading
media/mtp/MtpProperty.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -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