Compare commits

...

2 Commits

Author SHA1 Message Date
yhirose e61a8bcec7 Release v0.33.1 2026-02-21 08:55:06 -05:00
yhirose 33dbe00cce Fix compiple problem with C++11 compiler 2026-02-21 08:52:50 -05:00
+14 -5
View File
@@ -8,8 +8,8 @@
#ifndef CPPHTTPLIB_HTTPLIB_H
#define CPPHTTPLIB_HTTPLIB_H
#define CPPHTTPLIB_VERSION "0.33.0"
#define CPPHTTPLIB_VERSION_NUM "0x002100"
#define CPPHTTPLIB_VERSION "0.33.1"
#define CPPHTTPLIB_VERSION_NUM "0x002101"
/*
* Platform compatibility check
@@ -7951,10 +7951,19 @@ make_multipart_content_provider(const UploadFormDataItems &items,
}
segs.push_back({owned.back().data(), owned.back().size()});
return [owned = std::move(owned), segs = std::move(segs)](
size_t offset, size_t length, DataSink &sink) -> bool {
struct MultipartState {
std::vector<std::string> owned;
std::vector<MultipartSegment> segs;
};
auto state = std::make_shared<MultipartState>();
state->owned = std::move(owned);
// `segs` holds raw pointers into owned strings; std::string move preserves
// the data pointer, so these pointers remain valid after the move above.
state->segs = std::move(segs);
return [state](size_t offset, size_t length, DataSink &sink) -> bool {
size_t pos = 0;
for (const auto &seg : segs) {
for (const auto &seg : state->segs) {
// Loop invariant: pos <= offset (proven by advancing pos only when
// offset - pos >= seg.size, i.e., the segment doesn't contain offset)
if (seg.size > 0 && offset - pos < seg.size) {