[ros-diffs] [tretiakov] 25919: Andrey Janzen (virus126): echo %date% on windows >=XP return '24.02.2007', not 'Sut 24.02.2007' fix & implement dynamic buffer

tretiakov at svn.reactos.org tretiakov at svn.reactos.org
Wed Feb 28 14:17:35 CET 2007


Author: tretiakov
Date: Wed Feb 28 16:17:34 2007
New Revision: 25919

URL: http://svn.reactos.org/svn/reactos?rev=25919&view=rev
Log:
Andrey Janzen (virus126):
echo %date% on windows >=XP return '24.02.2007', not 'Sut 24.02.2007'
fix & implement dynamic buffer


Modified:
    trunk/reactos/base/shell/cmd/cmd.c

Modified: trunk/reactos/base/shell/cmd/cmd.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.c?rev=25919&r1=25918&r2=25919&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/cmd.c (original)
+++ trunk/reactos/base/shell/cmd/cmd.c Wed Feb 28 16:17:34 2007
@@ -1178,18 +1178,12 @@
 	/* %DATE% */
 	else if (_tcsicmp(varName,_T("date")) ==0)
 	{
-		LPTSTR tmp;
-
-		if ( !GrowIfNecessary ( MAX_PATH, &ret, &retlen ) )
+
+		if ( !GrowIfNecessary ( GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, NULL, 0), &ret, &retlen ) )
 			return NULL;
-		size = GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("ddd"), ret, retlen );
-		/* TODO FIXME - test whether GetDateFormat() can return a value indicating the buffer wasn't big enough */
-		if ( !size )
-			return NULL;
-		tmp = ret + _tcslen(ret);
-		*tmp++ = _T(' ');
-		size = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, tmp, retlen-(tmp-ret));
-		/* TODO FIXME - test whether GetDateFormat() can return a value indicating the buffer wasn't big enough */
+
+		size = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, ret, retlen);
+
 		if ( !size )
 			return NULL;
 		return ret;




More information about the Ros-diffs mailing list