else if (aClass.Equals(kTXTToHTMLConvCID)) { if (!mTXTToHTMLConvFactory) {     rv = NS_NewGenericFactory(getter_AddRefs(mTXTToHTMLConvFactory), CreateNewTXTToHTMLConvFactory); } fact = mTXTToHTMLConvFactory; }
nsConvModule::GetClassObject(nsIComponentManager *aCompMgr,                               const nsCID& aClass,                               const nsIID& aIID,                               void** r_classObj){    nsresult rv;    // Defensive programming: Initialize *r_classObj in case of error below    if (!r_classObj) {        return NS_ERROR_INVALID_POINTER;    }    *r_classObj = NULL;    // Do one-time-only initialization if necessary    if (!mInitialized) {        rv = Initialize();        if (NS_FAILED(rv)) {            // Initialization failed! yikes!            return rv;        }    }    // Choose the appropriate factory, based on the desired instance    // class type (aClass).    nsCOMPtr<nsIGenericFactory> fact;    if (aClass.Equals(kFTPDirListingConverterCID)) {        if (!mFTPDirListingConvFactory) {            // Create and save away the factory object for creating            // new instances of FTPDirListingConv. This way if we are called            // again for the factory, we won't need to create a new            // one.            rv = NS_NewGenericFactory(getter_AddRefs(mFTPDirListingConvFactory),                                      CreateNewFTPDirListingConv);        }        fact = mFTPDirListingConvFactory;    }    else if (aClass.Equals(kMultiMixedConverterCID)) {        if (!mMultiMixedConvFactory) {            // Create and save away the factory object for creating            // new instances of MultiMixedConv. This way if we are called            // again for the factory, we won't need to create a new            // one.            rv = NS_NewGenericFactory(getter_AddRefs(mMultiMixedConvFactory),                                      CreateNewMultiMixedConvFactory);        }        fact = mMultiMixedConvFactory;    }    else {        rv = NS_ERROR_FACTORY_NOT_REGISTERED;#ifdef DEBUG        char* cs = aClass.ToString();        printf("+++ nsConvModule: unable to create factory for %s\n", cs);        nsCRT::free(cs);#endif    }    if (fact) {        rv = fact->QueryInterface(aIID, r_classObj);    }    return rv;}