Skip to content

Fix copy construction of some classes - #362

Merged
gennaroprota merged 2 commits into
developfrom
fix/xml-escape-preserves-state-across-copy
Jul 31, 2026
Merged

Fix copy construction of some classes#362
gennaroprota merged 2 commits into
developfrom
fix/xml-escape-preserves-state-across-copy

Conversation

@gennaroprota

@gennaroprota gennaroprota commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

This removes a few erroneous copy constructors which were introduced as workarounds for the now outdated Intel 7.1.

Closes #229.

`xml_escape` and `xml_unescape` had a hand-written copy constructor,
added long ago as an Intel 7.1 workaround, that reconstructed the
`escape<>` / `unescape<>` base from `rhs.base_reference()` alone. That
runs the base's one-argument constructor and resets its in-progress
state (`m_full`, `m_bnext`, `m_bend`, `m_current_value`), so a copy
taken in the middle of an escape sequence forgot where it was and
restarted the sequence.

This removes the hand-written copy constructors and use the
compiler-generated ones, which copy the full base state. Intel 7.1 (from
2003) is long gone from the supported toolchains. `xml_unescape` had the
identical defect on the read side and is fixed the same way.

Closes #229.
Same defect class as the `xml_escape` / `xml_unescape` fix in the
previous commit: a hand-written copy constructor, written for Intel 7.1,
that silently dropped part of the iterator's state.

The bug is not reachable through the archive save/load paths, which
drive the base64 pipeline with a single iterator instance, but these
iterators are public and meant to be composed, and `std::copy` and
buffered adaptors (as in issue #229) copy an iterator in mid stream.
Remove both hand-written copy constructors and use the compiler-
generated ones, which copy the full state.

Refs #229.
@gennaroprota
gennaroprota force-pushed the fix/xml-escape-preserves-state-across-copy branch from 57b3a62 to be367b7 Compare July 30, 2026 14:49
@gennaroprota gennaroprota changed the title Fix/xml escape preserves state across copy Fix copy construction of some classes Jul 31, 2026
@gennaroprota
gennaroprota added this pull request to the merge queue Jul 31, 2026
Merged via the queue into develop with commit 17412ac Jul 31, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

xml_woarchive << std::string("...\"...") generates malformed output

1 participant