landing patch for bug 239716 "inout wstring methods are difficult to implement with nsEmbedString" patch by marco@gnome.org r=darin sr=dbaron

git-svn-id: svn://10.0.0.236/trunk@155191 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
darin%meer.net
2004-04-20 00:21:34 +00:00
parent 8247538bfd
commit 0fc79f3a16
7 changed files with 124 additions and 28 deletions

View File

@@ -51,6 +51,7 @@ static PRBool test_basic_1()
const char *ptr;
PRUint32 len;
char *clone;
NS_CStringGetData(s, &ptr);
if (ptr == nsnull || *ptr != '\0')
@@ -72,6 +73,14 @@ static PRBool test_basic_1()
return PR_FALSE;
}
clone = NS_CStringCloneData(s);
if (ptr == nsnull || strcmp(ptr, kAsciiData) != 0)
{
NS_ERROR("unexpected result");
return PR_FALSE;
}
nsMemory::Free(clone);
nsCStringContainer temp;
NS_CStringContainerInit(temp);
NS_CStringCopy(temp, s);
@@ -101,6 +110,7 @@ static PRBool test_basic_2()
const PRUnichar *ptr;
PRUint32 len;
PRUnichar *clone;
NS_StringGetData(s, &ptr);
if (ptr == nsnull || *ptr != '\0')
@@ -122,6 +132,14 @@ static PRBool test_basic_2()
return PR_FALSE;
}
clone = NS_StringCloneData(s);
if (ptr == nsnull || nsCRT::strcmp(ptr, kUnicodeData) != 0)
{
NS_ERROR("unexpected result");
return PR_FALSE;
}
nsMemory::Free(clone);
nsStringContainer temp;
NS_StringContainerInit(temp);
NS_StringCopy(temp, s);