Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5884)

Unified Diff: chrome/browser/media_galleries/linux/mtp_device_task_helper.cc

Issue 255513004: MTPFileStreamReader::Read should return 0 instead of error on read-from-eof. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media_galleries/linux/mtp_device_task_helper.cc
diff --git a/chrome/browser/media_galleries/linux/mtp_device_task_helper.cc b/chrome/browser/media_galleries/linux/mtp_device_task_helper.cc
index d51cb6f5ad569587d8715f2e7d3d09d828e52f66..be0f0c04029b5bd08b0759881cd4d73a3e1884ea 100644
--- a/chrome/browser/media_galleries/linux/mtp_device_task_helper.cc
+++ b/chrome/browser/media_galleries/linux/mtp_device_task_helper.cc
@@ -214,9 +214,15 @@ void MTPDeviceTaskHelper::OnGetFileInfoToReadBytes(
return HandleDeviceError(request.error_callback,
base::File::FILE_ERROR_NOT_A_FILE);
} else if (file_info.size < 0 || file_info.size > kuint32max ||
- request.offset >= file_info.size) {
+ request.offset > file_info.size) {
return HandleDeviceError(request.error_callback,
base::File::FILE_ERROR_FAILED);
+ } else if (request.offset == file_info.size) {
+ content::BrowserThread::PostTask(content::BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(request.success_callback,
+ file_info, 0u));
+ return;
}
uint32 bytes_to_read = std::min(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698