[Scummvm-git-logs] scummvm master -> 66d199ba4f0b5c92d186509fcc2a5e3ebd096724
neuromancer
noreply at scummvm.org
Wed Nov 19 14:18:06 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
66d199ba4f FREESCAPE: reimplemented memmem using cross-platform functions
Commit: 66d199ba4f0b5c92d186509fcc2a5e3ebd096724
https://github.com/scummvm/scummvm/commit/66d199ba4f0b5c92d186509fcc2a5e3ebd096724
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-11-19T15:17:51+01:00
Commit Message:
FREESCAPE: reimplemented memmem using cross-platform functions
Changed paths:
engines/freescape/games/driller/atari.cpp
diff --git a/engines/freescape/games/driller/atari.cpp b/engines/freescape/games/driller/atari.cpp
index 01350807543..70628bcc34c 100644
--- a/engines/freescape/games/driller/atari.cpp
+++ b/engines/freescape/games/driller/atari.cpp
@@ -28,6 +28,25 @@
namespace Freescape {
+namespace {
+// A simple implementation of memmem, which is a non-standard GNU extension.
+const void *local_memmem(const void *haystack, size_t haystack_len, const void *needle, size_t needle_len) {
+ if (needle_len == 0) {
+ return haystack;
+ }
+ if (haystack_len < needle_len) {
+ return nullptr;
+ }
+ const char *h = (const char *)haystack;
+ for (size_t i = 0; i <= haystack_len - needle_len; ++i) {
+ if (memcmp(h + i, needle, needle_len) == 0) {
+ return h + i;
+ }
+ }
+ return nullptr;
+}
+} // namespace
+
Common::SeekableReadStream *DrillerEngine::decryptFileAtariVirtualWorlds(const Common::Path &filename) {
Common::File file;
if (!file.open(filename)) {
@@ -42,7 +61,7 @@ Common::SeekableReadStream *DrillerEngine::decryptFileAtariVirtualWorlds(const C
int chunk_size = 0;
while (true) {
- byte *found = nullptr;//(byte *)memmem(data + start, size - start, "CBCP", 4); // FIXME: memmem() is non-standard
+ const byte *found = (const byte *)local_memmem(data + start, size - start, "CBCP", 4);
if (!found) break;
int idx = found - data;
More information about the Scummvm-git-logs
mailing list