Skip to content

Commit 2535313

Browse files
committed
Fixing missing .get() for unique_ptr and working around a GCC compiler bug.
1 parent 60f6d80 commit 2535313

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Release/include/cpprest/filestream.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,17 @@ namespace details {
217217
return pplx::create_task(result_tce);
218218
}
219219

220+
// Workaround GCC compiler bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58972
221+
void _invoke_parent_close_read()
222+
{
223+
streambuf_state_manager<_CharType>::_close_read();
224+
}
225+
220226
pplx::task<void> _close_read()
221227
{
222228
return m_readOps.enqueue_operation([this]
223229
{
224-
streambuf_state_manager<_CharType>::_close_read();
230+
_invoke_parent_close_read();
225231

226232
if (this->can_write())
227233
{

Release/src/streams/fileio_win32.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ size_t _write_file_async(_In_ streams::details::_file_info_impl *fInfo, _In_ str
414414
// However, we didn't pass in an address for the number of bytes written, so
415415
// we have to retrieve it using 'GetOverlappedResult,' which may, in turn, fail.
416416
DWORD written = 0;
417-
result = GetOverlappedResult(fInfo->m_handle, pOverlapped, &written, FALSE) ? static_cast<size_t>(written) : static_cast<size_t>(-1);
417+
result = GetOverlappedResult(fInfo->m_handle, pOverlapped.get(), &written, FALSE) ? static_cast<size_t>(written) : static_cast<size_t>(-1);
418418
}
419419

420420
if (result == static_cast<size_t>(-1))
@@ -502,7 +502,7 @@ size_t _read_file_async(_In_ streams::details::_file_info_impl *fInfo, _In_ stre
502502
// However, we didn't pass in an address for the number of bytes written, so
503503
// we have to retrieve it using 'GetOverlappedResult,' which may, in turn, fail.
504504
DWORD read = 0;
505-
result = GetOverlappedResult(fInfo->m_handle, pOverlapped, &read, FALSE) ? static_cast<size_t>(read) : static_cast<size_t>(-1);
505+
result = GetOverlappedResult(fInfo->m_handle, pOverlapped.get(), &read, FALSE) ? static_cast<size_t>(read) : static_cast<size_t>(-1);
506506
}
507507

508508
if (wrResult == FALSE && error == ERROR_HANDLE_EOF)

0 commit comments

Comments
 (0)