From c42c9cac8c289acc7af256e4578b116cbb576054 Mon Sep 17 00:00:00 2001 From: darylm503 Date: Fri, 5 Oct 2012 22:00:43 +0000 Subject: StdLib: Fix several problems where characters were not being correctly converted between wide and MBCS. Add utility functions for determining character length of strings. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: daryl.mcdaniel@intel.com Reviewed-by: erik.c.bjorge@intel.com Reviewed-by: lee.g.rosenbaum@intel.com StdLib/LibC/ Locale/multibyte_Utf8.c Improve comments. Define implementation-specific MBCS utility functions, as declared in . Enhance functionality of EncodeUtf8() and improve error handling. Set correct conversion state in wcrtomb(). Bug fixes in wcsrtombs(). Make wctob() properly MBCS compliant. Main/Main.c Remove code obsoleted by new wcsrtombs() implementation. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13785 6f19259b-4bc3-4df7-8a09-765794883524 --- StdLib/LibC/Main/Main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'StdLib/LibC/Main') diff --git a/StdLib/LibC/Main/Main.c b/StdLib/LibC/Main/Main.c index 523965fa43..9afffff7c6 100644 --- a/StdLib/LibC/Main/Main.c +++ b/StdLib/LibC/Main/Main.c @@ -113,10 +113,9 @@ DEBUG_CODE_END(); for(count = 0; count < Argc; ++count) { nArgv[count] = string; AVsz = wcstombs(string, Argv[count], nArgvSize); - string[AVsz] = 0; /* NULL terminate the argument */ DEBUG((DEBUG_INFO, "Cvt[%d] %d \"%s\" --> \"%a\"\n", (INT32)count, (INT32)AVsz, Argv[count], nArgv[count])); - string += AVsz + 1; - nArgvSize -= AVsz + 1; + string += AVsz; + nArgvSize -= AVsz; if(nArgvSize < 0) { Print(L"ABORTING: Internal Argv[%d] conversion error.\n", count); exit(EXIT_FAILURE); -- cgit v1.2.3