if (!inBuf) inBuf = ToNewCString(aStr);
nsCAutoString encodedBuf; nsresult rv = EncodeVal(nsDependentString(convertedBuf), encodedBuf); nsMemory::Free(convertedBuf); NS_ENSURE_SUCCESS(rv, rv);
nsFSURLEncoded::URLEncode(const nsAString& aStr, nsCString& aEncoded){  char* inBuf = EncodeVal(aStr);  if (!inBuf)    inBuf = ToNewCString(aStr);  NS_ENSURE_TRUE(inBuf, NS_ERROR_OUT_OF_MEMORY);  // convert to CRLF breaks  char* convertedBuf = nsLinebreakConverter::ConvertLineBreaks(inBuf,                           nsLinebreakConverter::eLinebreakAny,                           nsLinebreakConverter::eLinebreakNet);  nsMemory::Free(inBuf);  char* escapedBuf = nsEscape(convertedBuf, url_XPAlphas);  nsMemory::Free(convertedBuf);  aEncoded.Adopt(escapedBuf);  return NS_OK;}