From 5e01afb66e047b3dc7638b56428b00718bea3702 Mon Sep 17 00:00:00 2001 From: "mkaply%us.ibm.com" Date: Wed, 19 Nov 2003 19:35:09 +0000 Subject: [PATCH] #214152 r=pedemonte, sr=blizzard (platform specific), a=mkaply adjust unicode return buffer lengths to work around OS/2 bug --- xpcom/io/nsNativeCharsetUtils.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xpcom/io/nsNativeCharsetUtils.cpp b/xpcom/io/nsNativeCharsetUtils.cpp index 2586988611b..85be26134e2 100644 --- a/xpcom/io/nsNativeCharsetUtils.cpp +++ b/xpcom/io/nsNativeCharsetUtils.cpp @@ -1008,8 +1008,8 @@ NS_CopyNativeToUnicode(const nsACString &input, nsAString &output) char *inputStr = (char*)flat.get(); size_t inputLen = flat.Length() + 1; // include null char - // assume worst case allocation - size_t resultLen = CCHMAXPATH; + // resultLen must be >= inputLen or the unicode conversion will fail + size_t resultLen = inputLen; output.Truncate(); output.SetLength(resultLen); @@ -1047,8 +1047,8 @@ NS_CopyUnicodeToNative(const nsAString &input, nsACString &output) UniChar *inputStr = (UniChar*)flat.get(); size_t inputLen = flat.Length() + 1; // include null char - // assume worst case allocation - size_t resultLen = CCHMAXPATH; + // resultLen must be >= inputLen or the unicode conversion will fail + size_t resultLen = inputLen; output.Truncate(); output.SetLength(resultLen);