Changes necessary for fixes to bug 18843. Better handling of string implementations without an underlying buffer handle. r/sr=scc@mozilla.org

git-svn-id: svn://10.0.0.236/trunk@95227 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
vidur%netscape.com
2001-05-17 05:53:16 +00:00
parent ae967ed36e
commit 0d991aa43f
4 changed files with 68 additions and 8 deletions

View File

@@ -114,3 +114,33 @@ nsAFlatCString::GetWritableFragment( nsWritableFragment<char>& aFragment, nsFrag
return 0;
}
}
PRUint32
nsAFlatString::Length() const
{
const nsBufferHandle<PRUnichar>* handle = GetBufferHandle();
return PRUint32(handle ? handle->DataLength() : 0);
}
PRUint32
nsAFlatCString::Length() const
{
const nsBufferHandle<char>* handle = GetBufferHandle();
return PRUint32(handle ? handle->DataLength() : 0);
}
const PRUnichar*
nsAFlatString::get() const
{
const nsBufferHandle<PRUnichar>* handle = GetBufferHandle();
NS_ASSERTION(handle, "handle is null!");
return handle ? handle->DataStart() : 0;
}
const char*
nsAFlatCString::get() const
{
const nsBufferHandle<char>* handle = GetBufferHandle();
NS_ASSERTION(handle, "handle is null!");
return handle ? handle->DataStart() : 0;
}