} else { rv = NS_ERROR_FAILURE;
InternetSearchDataSource::ReadFileContents(nsILocalFile *localFile, nsString& sourceContents){	nsresult			rv = NS_ERROR_FAILURE;	PRInt64				contentsLen, total = 0;	char				*contents;        NS_ENSURE_ARG_POINTER(localFile);        sourceContents.Truncate();        rv = localFile->GetFileSize(&contentsLen);        if (NS_FAILED(rv)) return rv;        if (contentsLen > 0)        {                contents = new char [contentsLen + 1];                if (contents)                {                        nsCOMPtr<nsIInputStream> inputStream;                        rv = NS_NewLocalFileInputStream(getter_AddRefs(inputStream), localFile);                        if (NS_FAILED(rv)) {                        	delete [] contents;                        	return rv;                        }                        PRUint32 howMany;                        while (total < contentsLen) {                                rv = inputStream->Read(contents+total,                                                        PRUint32(contentsLen),                                                       &howMany);                                if (NS_FAILED(rv)) {                                        delete [] contents;                                        return rv;                                }                                total += howMany;                        }                        if (total == contentsLen)		        {				contents[contentsLen] = '\0';				sourceContents.AssignWithConversion(contents, contentsLen);				rv = NS_OK;		        }	        	delete [] contents;	        	contents = nsnull;		}	}	return(rv);}