nsresult rv; static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv); if (NS_FAILED(rv)) return rv;  rv = serv->NewURI(spec, baseURI, result);
char* specStr = spec.ToNewUTF8String(); if (specStr == nsnull) return NS_ERROR_OUT_OF_MEMORY; nsresult rv = NS_NewURI(result, specStr, baseURI); nsAllocator::Free(specStr);
NS_NewURI(nsIURI* *result, const char* spec, nsIURI* baseURI = nsnull){    nsresult rv;    static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);    NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv);    if (NS_FAILED(rv)) return rv;        rv = serv->NewURI(spec, baseURI, result);    return rv;}