[Scummvm-git-logs] scummvm master -> c18a3e28e2c1764b08088a0a1a7f5ec54a2db23a

sev- sev at scummvm.org
Mon Jan 9 09:44:10 CET 2017


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:
eab2e06169 COMMON: Enhanced debug channel checks.
c18a3e28e2 DIRECTOR: Lingo: Debug Lingo parsing only with debugchannel explicitely set


Commit: eab2e06169d2d6447f24f04ef04f1adc342c8aac
    https://github.com/scummvm/scummvm/commit/eab2e06169d2d6447f24f04ef04f1adc342c8aac
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-09T09:22:35+01:00

Commit Message:
COMMON: Enhanced debug channel checks.

Now it is possible to enforce checking by specifying level -1,
that is, debug level 11 will not turn it on.

Changed paths:
    common/debug-channels.h
    common/debug.cpp
    common/debug.h


diff --git a/common/debug-channels.h b/common/debug-channels.h
index 1414a10..0fb8006 100644
--- a/common/debug-channels.h
+++ b/common/debug-channels.h
@@ -117,7 +117,7 @@ public:
 	/**
 	 * Test whether the given debug channel is enabled.
 	 */
-	bool isDebugChannelEnabled(uint32 channel);
+	bool isDebugChannelEnabled(uint32 channel, bool enforce = false);
 
 private:
 	typedef HashMap<String, DebugChannel, IgnoreCase_Hash, IgnoreCase_EqualTo> DebugChannelMap;
diff --git a/common/debug.cpp b/common/debug.cpp
index c61fc63..5db8990 100644
--- a/common/debug.cpp
+++ b/common/debug.cpp
@@ -110,9 +110,9 @@ void DebugManager::disableAllDebugChannels() {
 		disableDebugChannel(i->_value.name);
 }
 
-bool DebugManager::isDebugChannelEnabled(uint32 channel) {
+bool DebugManager::isDebugChannelEnabled(uint32 channel, bool enforce) {
 	// Debug level 11 turns on all special debug level messages
-	if (gDebugLevel == 11)
+	if (gDebugLevel == 11 && enforce == false)
 		return true;
 	else
 		return (gDebugChannelsEnabled & channel) != 0;
@@ -125,8 +125,8 @@ bool debugLevelSet(int level) {
 }
 
 bool debugChannelSet(int level, uint32 debugChannels) {
-	if (gDebugLevel != 11)
-		if (level > gDebugLevel || !(DebugMan.isDebugChannelEnabled(debugChannels)))
+	if (gDebugLevel != 11 || level == -1)
+		if ((level != -1 && level > gDebugLevel) || !(DebugMan.isDebugChannelEnabled(debugChannels, level == -1)))
 			return false;
 
 	return true;
diff --git a/common/debug.h b/common/debug.h
index 883a0bf..5ec37f2 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -117,6 +117,7 @@ bool debugLevelSet(int level);
 /**
  * Returns true if the debug level and channel are active
  *
+ * @param level debug level to check against. If set to -1, only channel check is active
  * @see enableDebugChannel
  */
 bool debugChannelSet(int level, uint32 debugChannels);


Commit: c18a3e28e2c1764b08088a0a1a7f5ec54a2db23a
    https://github.com/scummvm/scummvm/commit/c18a3e28e2c1764b08088a0a1a7f5ec54a2db23a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-09T09:24:18+01:00

Commit Message:
DIRECTOR: Lingo: Debug Lingo parsing only with debugchannel explicitely set

Changed paths:
    engines/director/lingo/lingo-lex.cpp
    engines/director/lingo/lingo-lex.l


diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 5197d00..77ca20a 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -2391,7 +2391,7 @@ namespace Director {
 int Lingo::parse(const char *code) {
 	YY_BUFFER_STATE bp;
 
-	if (debugChannelSet(10, kDebugLingoCompile))
+	if (debugChannelSet(-1, kDebugLingoCompile))
 		yydebug = 1;
 	else
 		yydebug = 0;
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 882e06d..294cc66 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -231,7 +231,7 @@ namespace Director {
 int Lingo::parse(const char *code) {
 	YY_BUFFER_STATE bp;
 
-	if (debugChannelSet(10, kDebugLingoCompile))
+	if (debugChannelSet(-1, kDebugLingoCompile))
 		yydebug = 1;
 	else
 		yydebug = 0;





More information about the Scummvm-git-logs mailing list