if (mPos >= mLen) { *aReadCount = 0; return (nsresult)-1;
NS_ASSERTION(mUnicharDataLength >= mUnicharDataOffset, "unsigned madness"); PRUint32 rv = mUnicharDataLength - mUnicharDataOffset; nsresult errorCode; if (0 == rv) {  rv = Fill(&errorCode); if (rv <= 0) { *aReadCount = 0; return errorCode; }
nsresult StringUnicharInputStream::Read(PRUnichar* aBuf,                                        PRUint32 aOffset,                                        PRUint32 aCount,                                        PRUint32 *aReadCount){  if (mPos >= mLen) {    *aReadCount = 0;    return (nsresult)-1;  }  const PRUnichar* us = mString->GetUnicode();  NS_ASSERTION(mLen >= mPos, "unsigned madness");  PRUint32 amount = mLen - mPos;  if (amount > aCount) {    amount = aCount;  }  nsCRT::memcpy(aBuf, us + mPos, sizeof(PRUnichar) * amount);  mPos += amount;  *aReadCount = amount;  return NS_OK;}