if (aInstancePtr == nsnull) return NS_ERROR_NULL_POINTER; if (aIID.Equals(NS_GET_IID(nsIInputStream))) { nsIInputStream* in = GetInputStream(); NS_ADDREF(in); *aInstancePtr = in; return NS_OK; } if (aIID.Equals(NS_GET_IID(nsIOutputStream))) { nsIOutputStream* out = GetOutputStream(); NS_ADDREF(out); *aInstancePtr = out; return NS_OK; } if (aIID.Equals(NS_GET_IID(nsIPipe)) || aIID.Equals(NS_GET_IID(nsISupports))) { *aInstancePtr = this; NS_ADDREF_THIS(); return NS_OK; } return NS_NOINTERFACE;
if (aIID.Equals(NS_GET_IID(nsISearchableInputStream))) { nsISearchableInputStream* in = NS_STATIC_CAST(nsISearchableInputStream *, this); NS_ADDREF(in); *aInstancePtr = in; return NS_OK; } else return GET_INPUTSTREAM_PIPE(this)->QueryInterface(aIID, aInstancePtr);
nsPipe::QueryInterface(const nsIID& aIID, void** aInstancePtr){    if (aInstancePtr == nsnull)        return NS_ERROR_NULL_POINTER;    if (aIID.Equals(NS_GET_IID(nsIInputStream))) {        nsIInputStream* in = GetInputStream();        NS_ADDREF(in);        *aInstancePtr = in;        return NS_OK;    }    if (aIID.Equals(NS_GET_IID(nsIOutputStream))) {        nsIOutputStream* out = GetOutputStream();        NS_ADDREF(out);        *aInstancePtr = out;        return NS_OK;    }    if (aIID.Equals(NS_GET_IID(nsIPipe)) ||        aIID.Equals(NS_GET_IID(nsISupports))) {        *aInstancePtr = this;        NS_ADDREF_THIS();        return NS_OK;    }    return NS_NOINTERFACE;}