char* resultStr; char* specStr = spec.ToNewCString(); if (!specStr) { return NS_ERROR_OUT_OF_MEMORY;
nsresult rv; NS_ASSERTION(baseURI, "It doesn't make sense to not supply a base URI");  if (spec == nsnull) return baseURI->GetSpec(result);  static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv);  PRUint32 startPos, endPos; rv = serv->ExtractScheme(spec, &startPos, &endPos, nsnull); if (NS_SUCCEEDED(rv)) {  *result = nsCRT::strdup(spec); return (*result == nsnull) ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
NS_MakeAbsoluteURI(const nsString& spec, nsIURI* baseURI, nsString& result){    char* resultStr;    char* specStr = spec.ToNewCString();    if (!specStr) {        return NS_ERROR_OUT_OF_MEMORY;    }    nsresult rv = NS_MakeAbsoluteURI(specStr, baseURI, &resultStr);    nsAllocator::Free(specStr);    if (NS_FAILED(rv)) return rv;    result = resultStr;    nsAllocator::Free(resultStr);    return rv;}