[Scummvm-git-logs] scummvm master -> 34c216353236dafe0f9cba9865de2c240a19c004

sev- sev at scummvm.org
Thu Jun 18 12:40:10 UTC 2020


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

Summary:
6059566777 COMMON: Added scumm_strcasestr()
c18a60521f DIRECTOR: LINGO: Switched preprocessor to scumm_strcasestr()
34c2163532 DIRECTOR: LINGO: More robust detection of menu definition in STXTs


Commit: 6059566777a79032c35f9e9519362c0dddde4611
    https://github.com/scummvm/scummvm/commit/6059566777a79032c35f9e9519362c0dddde4611
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-06-18T14:38:12+02:00

Commit Message:
COMMON: Added scumm_strcasestr()

Changed paths:
    common/str.cpp
    common/str.h


diff --git a/common/str.cpp b/common/str.cpp
index 2ae366bca8..77a50bd768 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -1323,3 +1323,22 @@ char *scumm_strdup(const char *in) {
 	}
 	return out;
 }
+
+//  Portable implementation of strcasestr.
+const char *scumm_strcasestr(const char *s, const char *find) {
+	char c, sc;
+	size_t len;
+
+	if ((c = *find++) != 0) {
+		c = (char)tolower((unsigned char)c);
+		len = strlen(find);
+		do {
+			do {
+				if ((sc = *s++) == 0)
+					return (NULL);
+			} while ((char)tolower((unsigned char)sc) != c);
+		} while (scumm_strnicmp(s, find, len) != 0);
+		s--;
+	}
+	return s;
+}
diff --git a/common/str.h b/common/str.h
index c19b2ef699..bce55fd210 100644
--- a/common/str.h
+++ b/common/str.h
@@ -568,4 +568,6 @@ extern char *scumm_strdup(const char *in);
 extern int scumm_compareDictionary(const char *s1, const char *s2);
 extern const char *scumm_skipArticle(const char *s1);
 
+extern const char *scumm_strcasestr(const char *s, const char *find);
+
 #endif


Commit: c18a60521fe64f3a35ff94a186e87ac6949b960f
    https://github.com/scummvm/scummvm/commit/c18a60521fe64f3a35ff94a186e87ac6949b960f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-06-18T14:38:42+02:00

Commit Message:
DIRECTOR: LINGO: Switched preprocessor to scumm_strcasestr()

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 f8d8a21ba2..0765b9298c 100644
--- a/engines/director/lingo/lingo-preprocessor.cpp
+++ b/engines/director/lingo/lingo-preprocessor.cpp
@@ -423,26 +423,6 @@ Common::String Lingo::codePreprocessor(const char *s, ScriptType type, uint16 id
 	return res;
 }
 
-#ifndef strcasestr
-const char *strcasestr(const char *s, const char *find) {
-	char c, sc;
-	size_t len;
-
-	if ((c = *find++) != 0) {
-		c = (char)tolower((unsigned char)c);
-		len = strlen(find);
-		do {
-			do {
-				if ((sc = *s++) == 0)
-					return (NULL);
-			} while ((char)tolower((unsigned char)sc) != c);
-		} while (scumm_strnicmp(s, find, len) != 0);
-		s--;
-	}
-	return s;
-}
-#endif
-
 // when ID then statement -> when ID then "statement"
 Common::String preprocessWhen(Common::String in, bool *changed) {
 	Common::String res, next;
@@ -450,7 +430,7 @@ Common::String preprocessWhen(Common::String in, bool *changed) {
 	const char *beg = ptr;
 	const char *nextPtr;
 
-	while ((ptr = strcasestr(beg, "when")) != NULL) {
+	while ((ptr = scumm_strcasestr(beg, "when")) != NULL) {
 		if (ptr != findtokstart(in.c_str(), ptr)) { // If we're in the middle of a word
 			res += *beg++;
 			continue;
@@ -522,7 +502,7 @@ Common::String preprocessReturn(Common::String in) {
 	const char *ptr = in.c_str();
 	const char *beg = ptr;
 
-	while ((ptr = strcasestr(beg, "return")) != NULL) {
+	while ((ptr = scumm_strcasestr(beg, "return")) != NULL) {
 		if (ptr != findtokstart(in.c_str(), ptr)) { // If we're in the middle of a word
 			res += *beg++;
 			continue;
@@ -564,7 +544,7 @@ Common::String preprocessPlay(Common::String in) {
 	const char *beg = ptr;
 	const char *nextPtr;
 
-	while ((ptr = strcasestr(beg, "play")) != NULL) {
+	while ((ptr = scumm_strcasestr(beg, "play")) != NULL) {
 		if (ptr != findtokstart(in.c_str(), ptr)) { // If we're in the middle of a word
 			res += *beg++;
 			continue;
@@ -611,7 +591,7 @@ Common::String preprocessSound(Common::String in) {
 	const char *beg = ptr;
 	const char *nextPtr;
 
-	while ((ptr = strcasestr(beg, "sound")) != NULL) {
+	while ((ptr = scumm_strcasestr(beg, "sound")) != NULL) {
 		if (ptr != findtokstart(in.c_str(), ptr)) { // If we're in the middle of a word
 			res += *beg++;
 			continue;


Commit: 34c216353236dafe0f9cba9865de2c240a19c004
    https://github.com/scummvm/scummvm/commit/34c216353236dafe0f9cba9865de2c240a19c004
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-06-18T14:39:31+02:00

Commit Message:
DIRECTOR: LINGO: More robust detection of menu definition in STXTs

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


diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index ee2dd6fba2..988fe821ad 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -276,7 +276,7 @@ ScriptContext *Lingo::addCode(const char *code, int archiveIndex, ScriptType typ
 
 	const char *begin, *end;
 
-	if (!strncmp(code, "menu:", 5)) {
+	if (!strncmp(code, "menu:", 5) || strcasestr(code, "\nmenu:")) {
 		debugC(1, kDebugCompile, "Parsing menu");
 		parseMenu(code);
 




More information about the Scummvm-git-logs mailing list