From 756716d8ee1a88298ab9b1e9896cbe9eb786bfae Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 22 Aug 2012 21:13:33 +0530 Subject: [PATCH] ... --- src/calibre/devices/mtp/windows/content_enumeration.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/devices/mtp/windows/content_enumeration.cpp b/src/calibre/devices/mtp/windows/content_enumeration.cpp index b87d7ba01c..e9c6e71c09 100644 --- a/src/calibre/devices/mtp/windows/content_enumeration.cpp +++ b/src/calibre/devices/mtp/windows/content_enumeration.cpp @@ -500,7 +500,7 @@ PyObject* wpd::get_file(IPortableDevice *device, const wchar_t *object_id, PyObj total_read = total_read + bytes_read; if (hr == STG_E_ACCESSDENIED) { PyErr_SetString(PyExc_IOError, "Read access is denied to this object"); break; - } else if (hr == S_OK || hr == S_FALSE) { + } else if (SUCCEEDED(hr)) { if (bytes_read > 0) { res = PyObject_CallMethod(dest, "write", "s#", buf, bytes_read); if (res == NULL) break; @@ -509,7 +509,7 @@ PyObject* wpd::get_file(IPortableDevice *device, const wchar_t *object_id, PyObj } } else { hresult_set_exc("Failed to read file from device", hr); break; } - if (hr == S_FALSE || bytes_read < bufsize) { + if (bytes_read == 0) { ok = TRUE; Py_XDECREF(PyObject_CallMethod(dest, "flush", NULL)); break;