[Scummvm-git-logs] scummvm master -> 3446edb01a2c1c8d2d40d0db99363c6cc6d4be0b

sev- sev at scummvm.org
Fri Jun 12 19:54:06 UTC 2020


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7d2063166b DIRECTOR: LINGO: Improve preprocessor token detection
3446edb01a AUDIO: Added override keywords


Commit: 7d2063166b13eb2329806d732a6cd4d054460bb0
    https://github.com/scummvm/scummvm/commit/7d2063166b13eb2329806d732a6cd4d054460bb0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-06-12T21:52:24+02:00

Commit Message:
DIRECTOR: LINGO: Improve preprocessor token detection

Changed paths:
    engines/director/lingo/lingo-preprocessor.cpp


diff --git a/engines/director/lingo/lingo-preprocessor.cpp b/engines/director/lingo/lingo-preprocessor.cpp
index ec1ceab8e1..94f1d64d64 100644
--- a/engines/director/lingo/lingo-preprocessor.cpp
+++ b/engines/director/lingo/lingo-preprocessor.cpp
@@ -83,6 +83,34 @@ static Common::String prevtok(const char *s, const char *lineStart, const char *
 	return res;
 }
 
+static const char *findtokstart(const char *start, const char *token) {
+	// First, determine, if we sit inside of a string
+	//
+	// Since we do not have escaping characters, simple count is enough
+	int numquotes = 0;
+	const char *ptr = start;
+
+	while (*ptr && ptr <= token) {
+		if (*ptr == '"')
+			numquotes++;
+		ptr++;
+	}
+
+	// We're inside of quote. Scan backwards
+	if (numquotes % 2) {
+		while (*ptr != '"')
+			ptr--;
+
+		return ptr;
+	}
+
+	// If we're in the middle of a word
+	while (ptr > start && Common::isAlnum(*(ptr - 1)))
+		ptr--;
+
+	return ptr;
+}
+
 Common::String Lingo::codePreprocessor(const char *s, ScriptType type, uint16 id, bool simple) {
 	Common::String res;
 
@@ -406,7 +434,7 @@ Common::String preprocessWhen(Common::String in, bool *changed) {
 	const char *nextPtr;
 
 	while ((ptr = strcasestr(beg, "when")) != NULL) {
-		if (ptr > in.c_str() && Common::isAlnum(*(ptr - 1))) { // If we're in the middle of a word
+		if (ptr != findtokstart(in.c_str(), ptr)) { // If we're in the middle of a word
 			res += *beg++;
 			continue;
 		}
@@ -478,6 +506,11 @@ Common::String preprocessReturn(Common::String in) {
 	const char *beg = ptr;
 
 	while ((ptr = strcasestr(beg, "return")) != NULL) {
+		if (ptr != findtokstart(in.c_str(), ptr)) { // If we're in the middle of a word
+			res += *beg++;
+			continue;
+		}
+
 		res += Common::String(beg, ptr);
 
 		if (ptr == beg)
@@ -515,7 +548,7 @@ Common::String preprocessPlay(Common::String in) {
 	const char *nextPtr;
 
 	while ((ptr = strcasestr(beg, "play")) != NULL) {
-		if (ptr > in.c_str() && Common::isAlnum(*(ptr - 1))) { // If we're in the middle of a word
+		if (ptr != findtokstart(in.c_str(), ptr)) { // If we're in the middle of a word
 			res += *beg++;
 			continue;
 		}
@@ -562,7 +595,7 @@ Common::String preprocessSound(Common::String in) {
 	const char *nextPtr;
 
 	while ((ptr = strcasestr(beg, "sound")) != NULL) {
-		if (ptr > in.c_str() && Common::isAlnum(*(ptr - 1))) { // If we're in the middle of a word
+		if (ptr != findtokstart(in.c_str(), ptr)) { // If we're in the middle of a word
 			res += *beg++;
 			continue;
 		}


Commit: 3446edb01a2c1c8d2d40d0db99363c6cc6d4be0b
    https://github.com/scummvm/scummvm/commit/3446edb01a2c1c8d2d40d0db99363c6cc6d4be0b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-06-12T21:53:49+02:00

Commit Message:
AUDIO: Added override keywords

Changed paths:
    audio/midiparser_xmidi.cpp


diff --git a/audio/midiparser_xmidi.cpp b/audio/midiparser_xmidi.cpp
index 3e6f1c6fff..2782919fcf 100644
--- a/audio/midiparser_xmidi.cpp
+++ b/audio/midiparser_xmidi.cpp
@@ -86,9 +86,9 @@ protected:
 	 */
 	uint32 read4low(byte *&data);
 
-	void parseNextEvent(EventInfo &info);
+	void parseNextEvent(EventInfo &info) override;
 
-	virtual void resetTracking() {
+	virtual void resetTracking() override {
 		MidiParser::resetTracking();
 		_loopCount = -1;
 	}
@@ -112,7 +112,7 @@ public:
 	}
 	~MidiParser_XMIDI() { }
 
-	bool loadMusic(byte *data, uint32 size);
+	bool loadMusic(byte *data, uint32 size) override;
 	bool hasJumpIndex(uint8 index) override;
 	bool jumpToIndex(uint8 index, bool stopNotes) override;
 };




More information about the Scummvm-git-logs mailing list