Loading fastboot/device/fastboot_device.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -139,7 +139,13 @@ bool FastbootDevice::WriteStatus(FastbootResult result, const std::string& messa bool FastbootDevice::HandleData(bool read, std::vector<char>* data) { auto read_write_data_size = read ? this->get_transport()->Read(data->data(), data->size()) : this->get_transport()->Write(data->data(), data->size()); if (read_write_data_size == -1 || static_cast<size_t>(read_write_data_size) != data->size()) { if (read_write_data_size == -1) { LOG(ERROR) << (read ? "read from" : "write to") << " transport failed"; return false; } if (static_cast<size_t>(read_write_data_size) != data->size()) { LOG(ERROR) << (read ? "read" : "write") << " expected " << data->size() << " bytes, got " << read_write_data_size; return false; } return true; Loading fastboot/device/usb_client.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -248,7 +248,12 @@ ClientUsbTransport::ClientUsbTransport() } ssize_t ClientUsbTransport::Read(void* data, size_t len) { if (handle_ == nullptr || len > SSIZE_MAX) { if (handle_ == nullptr) { LOG(ERROR) << "ClientUsbTransport: no handle"; return -1; } if (len > SSIZE_MAX) { LOG(ERROR) << "ClientUsbTransport: maximum length exceeds bounds"; return -1; } char* char_data = static_cast<char*>(data); Loading @@ -258,6 +263,7 @@ ssize_t ClientUsbTransport::Read(void* data, size_t len) { auto bytes_read_now = handle_->read(handle_.get(), char_data, bytes_to_read, true /* allow_partial */); if (bytes_read_now < 0) { PLOG(ERROR) << "ClientUsbTransport: read failed"; return bytes_read_total == 0 ? -1 : bytes_read_total; } bytes_read_total += bytes_read_now; Loading Loading
fastboot/device/fastboot_device.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -139,7 +139,13 @@ bool FastbootDevice::WriteStatus(FastbootResult result, const std::string& messa bool FastbootDevice::HandleData(bool read, std::vector<char>* data) { auto read_write_data_size = read ? this->get_transport()->Read(data->data(), data->size()) : this->get_transport()->Write(data->data(), data->size()); if (read_write_data_size == -1 || static_cast<size_t>(read_write_data_size) != data->size()) { if (read_write_data_size == -1) { LOG(ERROR) << (read ? "read from" : "write to") << " transport failed"; return false; } if (static_cast<size_t>(read_write_data_size) != data->size()) { LOG(ERROR) << (read ? "read" : "write") << " expected " << data->size() << " bytes, got " << read_write_data_size; return false; } return true; Loading
fastboot/device/usb_client.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -248,7 +248,12 @@ ClientUsbTransport::ClientUsbTransport() } ssize_t ClientUsbTransport::Read(void* data, size_t len) { if (handle_ == nullptr || len > SSIZE_MAX) { if (handle_ == nullptr) { LOG(ERROR) << "ClientUsbTransport: no handle"; return -1; } if (len > SSIZE_MAX) { LOG(ERROR) << "ClientUsbTransport: maximum length exceeds bounds"; return -1; } char* char_data = static_cast<char*>(data); Loading @@ -258,6 +263,7 @@ ssize_t ClientUsbTransport::Read(void* data, size_t len) { auto bytes_read_now = handle_->read(handle_.get(), char_data, bytes_to_read, true /* allow_partial */); if (bytes_read_now < 0) { PLOG(ERROR) << "ClientUsbTransport: read failed"; return bytes_read_total == 0 ? -1 : bytes_read_total; } bytes_read_total += bytes_read_now; Loading