Author: faridz
Date: Mon Apr 16 10:34:02 2007
New Revision: 529336
URL: http://svn.apache.org/viewvc?view=rev&rev=529336
Log:
2007-04-16 Farid Zaripov <[EMAIL PROTECTED]>
* locale_stub.cpp (main): Corrected calculation of
the command line length (arglen).
Modified:
incubator/stdcxx/trunk/util/locale_stub.cpp
Modified: incubator/stdcxx/trunk/util/locale_stub.cpp
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/locale_stub.cpp?view=diff&rev=529336&r1=529335&r2=529336
==============================================================================
--- incubator/stdcxx/trunk/util/locale_stub.cpp (original)
+++ incubator/stdcxx/trunk/util/locale_stub.cpp Mon Apr 16 10:34:02 2007
@@ -32,7 +32,7 @@
{
// compute the total length of the command line arguments
std::size_t arglen = 0;
- for (int i = 1; i != argc; ++i)
+ for (int i = 0; i != argc; ++i)
arglen += std::strlen (argv [i]);
// add the length of space separating adjacent pairs
@@ -42,8 +42,11 @@
const char argv_1[] = "--locale-mode";
arglen += sizeof argv_1;
+ const char localedef[] = "localedef";
+ arglen += sizeof localedef;
+
// allocate space for the new command line
- char* const cmdline = new char [arglen + 3];
+ char* const cmdline = new char [arglen];
// replace the basename of argv[0] with "localedef" keeping the
// directory portion, if it's there, followed by the new option
@@ -56,7 +59,7 @@
slash = std::strrchr (cmdline, '\\');
}
- std::strcpy (slash ? slash + 1 : cmdline, "localedef");
+ std::strcpy (slash ? slash + 1 : cmdline, localedef);
std::strcat (cmdline, " ");
std::strcat (cmdline, argv_1);