28412 metaDataLength is wrong in nsCachedNetData::Deserialize. Add routines to build stream from char* and length

git-svn-id: svn://10.0.0.236/trunk@66416 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
davidm%netscape.com
2000-04-19 04:54:53 +00:00
parent 9445a7c86d
commit 782be6b659
2 changed files with 29 additions and 0 deletions

View File

@@ -493,3 +493,25 @@ extern "C" NS_COM nsresult NS_NewCharIOStream(
{
return NS_NewCharOutputStream(aStreamResult, aStringToChange);
}
//----------------------------------------------------------------------------------------
extern "C" NS_COM nsresult NS_NewByteInputStream(
nsISupports** aStreamResult,
const char* aStringToRead,
PRInt32 aLength)
// Factory method to get an nsInputStream from a string. Result will implement all the
// file stream interfaces in nsIFileStream.h
//----------------------------------------------------------------------------------------
{
NS_PRECONDITION(aStreamResult != nsnull, "null ptr");
if (! aStreamResult)
return NS_ERROR_NULL_POINTER;
ConstCharImpl* stream = new ConstCharImpl(aStringToRead, aLength);
if (! stream)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(stream);
*aStreamResult = (nsISupports*)(void*)stream;
return NS_OK;
}