Commit Graph

6 Commits

Author SHA1 Message Date
Dan Klishch
5ed7cd6e32 Everywhere: Use east const in more places
These changes are compatible with clang-format 16 and will be mandatory
when we eventually bump clang-format version. So, since there are no
real downsides, let's commit them now.
2024-04-19 06:31:19 -04:00
Shannon Booth
4bce61e508 patch+LibDiff: Add support for applying patches with preprocessor macro 2024-03-03 08:56:00 +01:00
Shannon Booth
ee643b6417 LibDiff: Prevent negative underflow calculating suffix and prefix fuzz
In the situation where the amount of content preceeding the hunk was
greater than the max context of the hunk there would be an unsigned
underflow, as the logic was assuming signed arithmitic.

This underflow would result in the patch not applying, as patch would
assume the massive calculated fuzz would result in the patch matching
against any file.
2024-03-03 08:56:00 +01:00
Shannon Booth
df6a627323 LibDiff: Reject patches adding files when a file already exists
We should still add an informational message about when this happens
before we even get here - but we still shouldn't be able to locate a
place to apply a hunk as it ends up producing unexpected results where
the patch is prepended to the existing file.
2024-02-21 14:11:49 +01:00
Shannon Booth
2b46e6f664 Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2023-07-15 16:21:29 +02:00
Shannon Booth
828d791a4f LibDiff: Add Diff::apply_patch
Given a set of lines from the file we are patching, and a patch itself,
this function will try and locate where in the file to apply that patch,
and write the result of patching that file (if successful) to the output
stream.
2023-07-13 10:29:30 +01:00