Author: cwittich
Date: Sat Feb 2 13:38:37 2008
New Revision: 32083
URL:
http://svn.reactos.org/svn/reactos?rev=32083&view=rev
Log:
don't overwrite terminating \0 char
some code cleanup
Modified:
trunk/reactos/base/shell/cmd/cmd.c
trunk/reactos/base/shell/cmd/misc.c
Modified: trunk/reactos/base/shell/cmd/cmd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.c?rev=3…
==============================================================================
--- trunk/reactos/base/shell/cmd/cmd.c (original)
+++ trunk/reactos/base/shell/cmd/cmd.c Sat Feb 2 13:38:37 2008
@@ -1465,7 +1465,7 @@
}
}
- if (_istcntrl (*ip))
+ if (*ip != _T('\0') && (_istcntrl (*ip)))
*ip = _T(' ');
*cp++ = *ip++;
Modified: trunk/reactos/base/shell/cmd/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/misc.c?rev=…
==============================================================================
--- trunk/reactos/base/shell/cmd/misc.c (original)
+++ trunk/reactos/base/shell/cmd/misc.c Sat Feb 2 13:38:37 2008
@@ -454,13 +454,12 @@
LPSTR lpString;
CHAR ch;
DWORD dwRead;
- INT len;
+ INT len = 0;
#ifdef _UNICODE
lpString = cmd_alloc(nBufferLength);
#else
lpString = lpBuffer;
#endif
- len = 0;
while ((--nBufferLength > 0) &&
ReadFile(hFile, &ch, 1, &dwRead, NULL) && dwRead)
{
@@ -482,7 +481,7 @@
lpString[len++] = _T('\0');
#ifdef _UNICODE
- MultiByteToWideChar(CP_ACP, 0, lpString, len, lpBuffer, len);
+ MultiByteToWideChar(CP_ACP, 0, lpString, -1, lpBuffer, len);
cmd_free(lpString);
#endif
return TRUE;