[Scummvm-cvs-logs] CVS: scummvm/base main.cpp,1.100,1.101

Eugene Sandulenko sev at users.sourceforge.net
Sat Jan 28 18:45:03 CET 2006


Update of /cvsroot/scummvm/scummvm/base
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6569/base

Modified Files:
	main.cpp 
Log Message:
Added new debugN() function which doesn't append newline.


Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/main.cpp,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -d -r1.100 -r1.101
--- main.cpp	25 Jan 2006 20:53:25 -0000	1.100
+++ main.cpp	29 Jan 2006 02:44:29 -0000	1.101
@@ -489,13 +489,15 @@
 END_OF_MAIN();
 #endif
 
-static void debugHelper(char *buf) {
+static void debugHelper(char *buf, bool caret = true) {
 #ifndef _WIN32_WCE
-	printf("%s\n", buf);
+	if (caret)
+		printf("%s\n", buf);
 #endif
 
 #if defined( USE_WINDBG )
-	strcat(buf, "\n");
+	if (caret)
+		strcat(buf, "\n");
 #if defined( _WIN32_WCE )
 	TCHAR buf_unicode[1024];
 	MultiByteToWideChar(CP_ACP, 0, buf, strlen(buf) + 1, buf_unicode, sizeof(buf_unicode));
@@ -522,6 +524,20 @@
 	debugHelper(buf);
 }
 
+void CDECL debugN(int level, const char *s, ...) {
+	char buf[STRINGBUFLEN];
+	va_list va;
+
+	if (level > gDebugLevel)
+		return;
+
+	va_start(va, s);
+	vsnprintf(buf, STRINGBUFLEN, s, va);
+	va_end(va);
+
+	debugHelper(buf, false);
+}
+
 void CDECL debug(const char *s, ...) {
 	char buf[STRINGBUFLEN];
 	va_list va;





More information about the Scummvm-git-logs mailing list