From e7b9093f5c64badc5fecb9529f69193f3291efbc Mon Sep 17 00:00:00 2001 From: Rafal Harabien Date: Wed, 7 Mar 2012 13:47:38 +0000 Subject: [PATCH] [FREELDR] - Try to fix release build svn path=/trunk/; revision=56076 --- reactos/boot/freeldr/freeldr/debug.c | 178 +++++++++---------- reactos/boot/freeldr/freeldr/include/debug.h | 4 +- 2 files changed, 89 insertions(+), 93 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/debug.c b/reactos/boot/freeldr/freeldr/debug.c index 260be26fccd..e74d1da2ae7 100644 --- a/reactos/boot/freeldr/freeldr/debug.c +++ b/reactos/boot/freeldr/freeldr/debug.c @@ -255,6 +255,93 @@ DebugDumpBuffer(ULONG Mask, PVOID Buffer, ULONG Length) } } +static BOOLEAN +DbgAddDebugChannel( CHAR* channel, CHAR* level, CHAR op) +{ + int iLevel, iChannel; + + if(channel == NULL || *channel == L'\0' ||strlen(channel) == 0 ) + return FALSE; + + if(level == NULL || *level == L'\0' ||strlen(level) == 0 ) + iLevel = MAX_LEVEL; + else if(strcmp(level, "err") == 0) + iLevel = ERR_LEVEL; + else if(strcmp(level, "fixme") == 0) + iLevel = FIXME_LEVEL; + else if(strcmp(level, "warn") == 0) + iLevel = WARN_LEVEL; + else if (strcmp(level, "trace") == 0) + iLevel = TRACE_LEVEL; + else + return FALSE; + + if(strcmp(channel, "memory") == 0) iChannel = DPRINT_MEMORY; + else if(strcmp(channel, "filesystem") == 0) iChannel = DPRINT_FILESYSTEM; + else if(strcmp(channel, "inifile") == 0) iChannel = DPRINT_INIFILE; + else if(strcmp(channel, "ui") == 0) iChannel = DPRINT_UI; + else if(strcmp(channel, "disk") == 0) iChannel = DPRINT_DISK; + else if(strcmp(channel, "cache") == 0) iChannel = DPRINT_CACHE; + else if(strcmp(channel, "registry") == 0) iChannel = DPRINT_REGISTRY; + else if(strcmp(channel, "linux") == 0) iChannel = DPRINT_LINUX; + else if(strcmp(channel, "hwdetect") == 0) iChannel = DPRINT_HWDETECT; + else if(strcmp(channel, "windows") == 0) iChannel = DPRINT_WINDOWS; + else if(strcmp(channel, "peloader") == 0) iChannel = DPRINT_PELOADER; + else if(strcmp(channel, "scsiport") == 0) iChannel = DPRINT_SCSIPORT; + else if(strcmp(channel, "heap") == 0) iChannel = DPRINT_HEAP; + else if(strcmp(channel, "all") == 0) + { + int i; + + for(i= 0 ; i < DBG_CHANNELS_COUNT; i++) + { + if(op==L'+') + DbgChannels[i] |= iLevel; + else + DbgChannels[i] &= ~iLevel; + } + + return TRUE; + } + + if(op==L'+') + DbgChannels[iChannel] |= iLevel; + else + DbgChannels[iChannel] &= ~iLevel; + + return TRUE; +} + +VOID +DbgParseDebugChannels(PCHAR Value) +{ + CHAR *str, *separator, *c, op; + + str = Value; + + do + { + separator = strchr(str, L','); + if(separator != NULL) + *separator = L'\0'; + + c = strchr(str, L'+'); + if(c == NULL) + c = strchr(str, L'-'); + + if(c != NULL) + { + op = *c; + *c = L'\0'; + c++; + + DbgAddDebugChannel(c, str, op); + } + + str = separator + 1; + } while(separator != NULL); +} + #else ULONG @@ -339,94 +426,3 @@ RtlAssert(IN PVOID FailedAssertion, DbgBreakPoint(); } - - -static BOOLEAN -DbgAddDebugChannel( CHAR* channel, CHAR* level, CHAR op) -{ - int iLevel, iChannel; - - if(channel == NULL || *channel == L'\0' ||strlen(channel) == 0 ) - return FALSE; - - if(level == NULL || *level == L'\0' ||strlen(level) == 0 ) - iLevel = MAX_LEVEL; - else if(strcmp(level, "err") == 0) - iLevel = ERR_LEVEL; - else if(strcmp(level, "fixme") == 0) - iLevel = FIXME_LEVEL; - else if(strcmp(level, "warn") == 0) - iLevel = WARN_LEVEL; - else if (strcmp(level, "trace") == 0) - iLevel = TRACE_LEVEL; - else - return FALSE; - - if(strcmp(channel, "memory") == 0) iChannel = DPRINT_MEMORY; - else if(strcmp(channel, "filesystem") == 0) iChannel = DPRINT_FILESYSTEM; - else if(strcmp(channel, "inifile") == 0) iChannel = DPRINT_INIFILE; - else if(strcmp(channel, "ui") == 0) iChannel = DPRINT_UI; - else if(strcmp(channel, "disk") == 0) iChannel = DPRINT_DISK; - else if(strcmp(channel, "cache") == 0) iChannel = DPRINT_CACHE; - else if(strcmp(channel, "registry") == 0) iChannel = DPRINT_REGISTRY; - else if(strcmp(channel, "linux") == 0) iChannel = DPRINT_LINUX; - else if(strcmp(channel, "hwdetect") == 0) iChannel = DPRINT_HWDETECT; - else if(strcmp(channel, "windows") == 0) iChannel = DPRINT_WINDOWS; - else if(strcmp(channel, "peloader") == 0) iChannel = DPRINT_PELOADER; - else if(strcmp(channel, "scsiport") == 0) iChannel = DPRINT_SCSIPORT; - else if(strcmp(channel, "heap") == 0) iChannel = DPRINT_HEAP; - else if(strcmp(channel, "all") == 0) - { - int i; - - for(i= 0 ; i < DBG_CHANNELS_COUNT; i++) - { - if(op==L'+') - DbgChannels[i] |= iLevel; - else - DbgChannels[i] &= ~iLevel; - } - - return TRUE; - } - - if(op==L'+') - DbgChannels[iChannel] |= iLevel; - else - DbgChannels[iChannel] &= ~iLevel; - - return TRUE; -} - -BOOLEAN -DbgParseDebugChannels(PCHAR Value) -{ - CHAR *str, *separator, *c, op; - - str = Value; - - do - { - separator = strchr(str, L','); - if(separator != NULL) - *separator = L'\0'; - - c = strchr(str, L'+'); - if(c == NULL) - c = strchr(str, L'-'); - - if(c != NULL) - { - op = *c; - *c = L'\0'; - c++; - - DbgAddDebugChannel(c, str, op); - } - - str = separator + 1; - }while(separator != NULL); - - return TRUE; -} - diff --git a/reactos/boot/freeldr/freeldr/include/debug.h b/reactos/boot/freeldr/freeldr/include/debug.h index e51ac5d87fd..16d04cc1780 100644 --- a/reactos/boot/freeldr/freeldr/include/debug.h +++ b/reactos/boot/freeldr/freeldr/include/debug.h @@ -38,14 +38,13 @@ #define DPRINT_HEAP 15 // messages in a bottle #define DBG_CHANNELS_COUNT 16 -BOOLEAN DbgParseDebugChannels(PCHAR Value); - #if DBG && !defined(_M_ARM) VOID DebugInit(VOID); ULONG DbgPrint(const char *Format, ...); VOID DbgPrint2(ULONG Mask, ULONG Level, const char *File, ULONG Line, char *Format, ...); VOID DebugDumpBuffer(ULONG Mask, PVOID Buffer, ULONG Length); + VOID DbgParseDebugChannels(PCHAR Value); #define ERR_LEVEL 0x1 #define FIXME_LEVEL 0x2 @@ -117,6 +116,7 @@ void MEMORY_WRITE_BREAKPOINT4(unsigned long addr); #define DebugInit() #define BugCheck(fmt, ...) #define DbgDumpBuffer(mask, buf, len) + #define DbgParseDebugChannels(val) #endif // DBG