| 3748 | |
| 3749 | template <typename T> |
| 3750 | inline bool |
| 3751 | write_content_without_length(Stream &strm, |
| 3752 | const ContentProvider &content_provider, |
| 3753 | const T &is_shutting_down) { |
| 3754 | size_t offset = 0; |
| 3755 | auto data_available = true; |
| 3756 | auto ok = true; |
| 3757 | DataSink data_sink; |
| 3758 | |
| 3759 | data_sink.write = [&](const char *d, size_t l) -> bool { |
| 3760 | if (ok) { |
| 3761 | offset += l; |
| 3762 | if (!strm.is_writable() || !write_data(strm, d, l)) { ok = false; } |
| 3763 | } |
| 3764 | return ok; |
| 3765 | }; |
| 3766 | |
| 3767 | data_sink.done = [&](void) { data_available = false; }; |
| 3768 | |
| 3769 | while (data_available && !is_shutting_down()) { |
| 3770 | if (!strm.is_writable()) { |
| 3771 | return false; |
| 3772 | } else if (!content_provider(offset, 0, data_sink)) { |
| 3773 | return false; |
| 3774 | } else if (!ok) { |
| 3775 | return false; |
| 3776 | } |
| 3777 | } |
| 3778 | return true; |
| 3779 | } |
| 3780 | |
| 3781 | template <typename T, typename U> |
| 3782 | inline bool |
no test coverage detected