Open
Conversation
If there is an issue with patching from the diff file, it will output the error to the console. I'm not modifying the diff manually anymore but should still be useful.
Bekenn
requested changes
Feb 9, 2026
dist/wcpatch/src/main.cpp
Outdated
Comment on lines
409
to
412
| std::cerr << "apply_dif: mismatch at offset 0x" << std::hex << offset | ||
| << ": file=0x" << std::setw(2) << std::setfill('0') << file_b | ||
| << " expected=0x" << std::setw(2) << expect_b | ||
| << " replace=0x" << std::setw(2) << repl_b << std::dec << "\n"; |
Owner
There was a problem hiding this comment.
This is complicated enough that I'd rather not use iostreams. I have a formatting facility in stdext that should be able to handle this better; see stdext/format.h. It'll wind up looking like this (untested):
stdext::format(stdext::strerr(), "apply_dif: mismatch at offset 0x${0:X}: file=0x${1:02X} expected=0x${2:02X} replace=0x${3:02X}\n", offset, file_b, expect_b, repl_b);Removed iostream and replaced using stdext::format. Put the std::to_integer directly into the args function argument to minimize copies and tidy up the call.
Bekenn
requested changes
Feb 13, 2026
| #include <stdext/multi.h> | ||
| #include <stdext/string_view.h> | ||
| #include <stdext/unicode.h> | ||
| #include <stdext/format.h> |
Owner
There was a problem hiding this comment.
Move this up after file.h to maintain lexicographic header sort order.
Comment on lines
+409
to
+411
| std::to_integer<unsigned>(value), | ||
| std::to_integer<unsigned>(original_value), | ||
| std::to_integer<unsigned>(replacement_value)); |
Owner
There was a problem hiding this comment.
to_integer isn't actually needed; this can just be a direct cast:
Suggested change
| std::to_integer<unsigned>(value), | |
| std::to_integer<unsigned>(original_value), | |
| std::to_integer<unsigned>(replacement_value)); | |
| uint8_t(value), | |
| uint8_t(original_value), | |
| uint8_t(replacement_value)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If there is an issue with patching from the diff file, it will output the error to the console. I'm not modifying the diff manually anymore but should still be useful.