decoder->Reset(); unsigned char	smallBuf[2]; smallBuf[0] = 0xFF; smallBuf[1] = 0xFD; context->AppendBytes( (const char *)&smallBuf, 2L); if(((PRUint32) (srcLength + 1)) > aLength) srcLength = aLength; else srcLength++; aBuffer += srcLength; aLength -= srcLength;
InternetSearchDataSourceCallback::OnDataAvailable(nsIChannel* channel, nsISupports *ctxt,				nsIInputStream *aIStream, PRUint32 sourceOffset, PRUint32 aLength){	nsresult	rv = NS_OK;	if (aLength > 0)	{		nsAutoString	line;		if (mLine)		{			line += mLine;			nsCRT::free(mLine);			mLine = nsnull;		}		char	buffer[257];		while (aLength > 0)		{			PRUint32	count=0, numBytes = (aLength > sizeof(buffer)-1 ? sizeof(buffer)-1 : aLength);			if (NS_FAILED(rv = aIStream->Read(buffer, numBytes, &count)) || count == 0)			{#ifdef	DEBUG							printf("Search datasource read failure.\n");#endif				break;			}			if (numBytes != count)			{#ifdef	DEBUG				printf("Search datasource read # of bytes failure.\n");#endif				break;			}			buffer[count] = '\0';			line += buffer;			aLength -= count;		}		mLine = line.ToNewCString();	}	return(rv);}