Author: hbelusca Date: Sun Dec 2 15:30:59 2012 New Revision: 57787
URL: http://svn.reactos.org/svn/reactos?rev=57787&view=rev Log: [NTOSKRNL] - Skip other spaces preceding a command option instead of increasing the reading pointer of a constant (should fix KDSERIAL). - Use a macro for representing length in chars of constant strings instead of putting magic values.
Modified: trunk/reactos/ntoskrnl/kdbg/kdb.c
Modified: trunk/reactos/ntoskrnl/kdbg/kdb.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb.c?rev=577... ============================================================================== --- trunk/reactos/ntoskrnl/kdbg/kdb.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/kdbg/kdb.c [iso-8859-1] Sun Dec 2 15:30:59 2012 @@ -1705,30 +1705,29 @@ KdbpGetCommandLineSettings( PCHAR p1) { - PCHAR p2; - - while (p1 && (p2 = strchr(p1, ' '))) - { - p2 += 2; - - if (!_strnicmp(p2, "KDSERIAL", 8)) - { - p2 += 8; +#define CONST_STR_LEN(x) (sizeof(x)/sizeof(x[0])) + + while (p1 && (p1 = strchr(p1, ' '))) + { + /* Skip other spaces */ + while (*p1 == ' ') ++p1; + + if (!_strnicmp(p1, "KDSERIAL", CONST_STR_LEN("KDSERIAL"))) + { + p1 += CONST_STR_LEN("KDSERIAL"); KdbDebugState |= KD_DEBUG_KDSERIAL; KdpDebugMode.Serial = TRUE; } - else if (!_strnicmp(p2, "KDNOECHO", 8)) - { - p2 += 8; + else if (!_strnicmp(p1, "KDNOECHO", CONST_STR_LEN("KDNOECHO"))) + { + p1 += CONST_STR_LEN("KDNOECHO"); KdbDebugState |= KD_DEBUG_KDNOECHO; } - else if (!_strnicmp(p2, "FIRSTCHANCE", 11)) - { - p2 += 11; + else if (!_strnicmp(p1, "FIRSTCHANCE", CONST_STR_LEN("FIRSTCHANCE"))) + { + p1 += CONST_STR_LEN("FIRSTCHANCE"); KdbpSetEnterCondition(-1, TRUE, KdbEnterAlways); } - - p1 = p2; } }