diff --git a/src/util/patch-ips.c b/src/util/patch-ips.c index 6d6d53be9..0249f9ce9 100644 --- a/src/util/patch-ips.c +++ b/src/util/patch-ips.c @@ -9,7 +9,7 @@ #include "util/vfs.h" static size_t _IPSOutputSize(struct Patch* patch, size_t inSize); -static bool _IPSApplyPatch(struct Patch* patch, void* in, size_t inSize, void* out, size_t outSize); +static bool _IPSApplyPatch(struct Patch* patch, const void* in, size_t inSize, void* out, size_t outSize); bool loadPatchIPS(struct Patch* patch) { patch->vf->seek(patch->vf, 0, SEEK_SET); @@ -43,7 +43,7 @@ size_t _IPSOutputSize(struct Patch* patch, size_t inSize) { return 16 * 1024 * 1024; // IPS patches can grow up to 16MiB, but not beyond } -bool _IPSApplyPatch(struct Patch* patch, void* in, size_t inSize, void* out, size_t outSize) { +bool _IPSApplyPatch(struct Patch* patch, const void* in, size_t inSize, void* out, size_t outSize) { if (patch->vf->seek(patch->vf, 5, SEEK_SET) != 5) { return false; } diff --git a/src/util/patch-ups.c b/src/util/patch-ups.c index f51d4cc0a..80573387a 100644 --- a/src/util/patch-ups.c +++ b/src/util/patch-ups.c @@ -17,8 +17,8 @@ enum { static size_t _UPSOutputSize(struct Patch* patch, size_t inSize); -static bool _UPSApplyPatch(struct Patch* patch, void* in, size_t inSize, void* out, size_t outSize); -static bool _BPSApplyPatch(struct Patch* patch, void* in, size_t inSize, void* out, size_t outSize); +static bool _UPSApplyPatch(struct Patch* patch, const void* in, size_t inSize, void* out, size_t outSize); +static bool _BPSApplyPatch(struct Patch* patch, const void* in, size_t inSize, void* out, size_t outSize); static size_t _decodeLength(struct VFile* vf); @@ -64,7 +64,7 @@ size_t _UPSOutputSize(struct Patch* patch, size_t inSize) { return _decodeLength(patch->vf); } -bool _UPSApplyPatch(struct Patch* patch, void* in, size_t inSize, void* out, size_t outSize) { +bool _UPSApplyPatch(struct Patch* patch, const void* in, size_t inSize, void* out, size_t outSize) { // TODO: Input checksum size_t filesize = patch->vf->size(patch->vf); @@ -109,7 +109,7 @@ bool _UPSApplyPatch(struct Patch* patch, void* in, size_t inSize, void* out, siz return true; } -bool _BPSApplyPatch(struct Patch* patch, void* in, size_t inSize, void* out, size_t outSize) { +bool _BPSApplyPatch(struct Patch* patch, const void* in, size_t inSize, void* out, size_t outSize) { patch->vf->seek(patch->vf, IN_CHECKSUM, SEEK_END); uint32_t expectedInChecksum; uint32_t expectedOutChecksum; @@ -139,7 +139,7 @@ bool _BPSApplyPatch(struct Patch* patch, void* in, size_t inSize, void* out, siz ssize_t readTargetLocation = 0; size_t readOffset; uint8_t* writeBuffer = out; - uint8_t* readBuffer = in; + const uint8_t* readBuffer = in; while (patch->vf->seek(patch->vf, 0, SEEK_CUR) < filesize + IN_CHECKSUM) { size_t command = _decodeLength(patch->vf); size_t length = (command >> 2) + 1; diff --git a/src/util/patch.h b/src/util/patch.h index 74acaea4e..f84d859df 100644 --- a/src/util/patch.h +++ b/src/util/patch.h @@ -14,7 +14,7 @@ struct Patch { struct VFile* vf; size_t (*outputSize)(struct Patch* patch, size_t inSize); - bool (*applyPatch)(struct Patch* patch, void* in, size_t inSize, void* out, size_t outSize); + bool (*applyPatch)(struct Patch* patch, const void* in, size_t inSize, void* out, size_t outSize); }; bool loadPatch(struct VFile* vf, struct Patch* patch);