mirror of https://github.com/mgba-emu/mgba.git
Util: Fix some warnings
This commit is contained in:
parent
543ffac706
commit
1119d773e1
|
@ -129,6 +129,9 @@ bool _BPSApplyPatch(struct Patch* patch, void* in, size_t inSize, void* out, siz
|
||||||
if (_decodeLength(patch->vf) != outSize) {
|
if (_decodeLength(patch->vf) != outSize) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (inSize > SSIZE_MAX || outSize > SSIZE_MAX) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
size_t metadataLength = _decodeLength(patch->vf);
|
size_t metadataLength = _decodeLength(patch->vf);
|
||||||
patch->vf->seek(patch->vf, metadataLength, SEEK_CUR); // Skip metadata
|
patch->vf->seek(patch->vf, metadataLength, SEEK_CUR); // Skip metadata
|
||||||
size_t writeLocation = 0;
|
size_t writeLocation = 0;
|
||||||
|
@ -153,7 +156,7 @@ bool _BPSApplyPatch(struct Patch* patch, void* in, size_t inSize, void* out, siz
|
||||||
break;
|
break;
|
||||||
case 0x1:
|
case 0x1:
|
||||||
// TargetRead
|
// TargetRead
|
||||||
if (patch->vf->read(patch->vf, &writeBuffer[writeLocation], length) != length) {
|
if (patch->vf->read(patch->vf, &writeBuffer[writeLocation], length) != (ssize_t) length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
outputChecksum = updateCrc32(outputChecksum, &writeBuffer[writeLocation], length);
|
outputChecksum = updateCrc32(outputChecksum, &writeBuffer[writeLocation], length);
|
||||||
|
@ -167,7 +170,7 @@ bool _BPSApplyPatch(struct Patch* patch, void* in, size_t inSize, void* out, siz
|
||||||
} else {
|
} else {
|
||||||
readSourceLocation += readOffset >> 1;
|
readSourceLocation += readOffset >> 1;
|
||||||
}
|
}
|
||||||
if (readSourceLocation < 0 || readSourceLocation > inSize) {
|
if (readSourceLocation < 0 || readSourceLocation > (ssize_t) inSize) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
memmove(&writeBuffer[writeLocation], &readBuffer[readSourceLocation], length);
|
memmove(&writeBuffer[writeLocation], &readBuffer[readSourceLocation], length);
|
||||||
|
@ -183,7 +186,7 @@ bool _BPSApplyPatch(struct Patch* patch, void* in, size_t inSize, void* out, siz
|
||||||
} else {
|
} else {
|
||||||
readTargetLocation += readOffset >> 1;
|
readTargetLocation += readOffset >> 1;
|
||||||
}
|
}
|
||||||
if (readTargetLocation < 0 || readTargetLocation > outSize) {
|
if (readTargetLocation < 0 || readTargetLocation > (ssize_t) outSize) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (i = 0; i < length; ++i) {
|
for (i = 0; i < length; ++i) {
|
||||||
|
|
Loading…
Reference in New Issue