зеркало из https://github.com/mozilla/pjs.git
wired up nsTextToSubURI to the dll, remove unnecessary reghac2.h
This commit is contained in:
Родитель
eefef9a59e
Коммит
dc3e8363dd
|
@ -21,7 +21,7 @@
|
|||
|
||||
%{C++
|
||||
// {8B042E22-6F87-11d3-B3C8-00805F8A6670}
|
||||
#define NS_TEXTOTSUBURI_CID { 0x8b042e22, 0x6f87, 0x11d3, { 0xb3, 0xc8, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }
|
||||
#define NS_TEXTTOSUBURI_CID { 0x8b042e22, 0x6f87, 0x11d3, { 0xb3, 0xc8, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }
|
||||
#define NS_ITEXTTOSUBURI_PROGID "component://netscape/intl/texttosuburi"
|
||||
%}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsCharsetConverterManager.h"
|
||||
#include "nsUConvDll.h"
|
||||
#include "registryhack1.h"
|
||||
|
||||
// just for CIDs
|
||||
#include "nsIUnicodeDecodeHelper.h"
|
||||
|
@ -120,11 +119,6 @@ private:
|
|||
*/
|
||||
nsresult CreateMapping();
|
||||
|
||||
/**
|
||||
* Creates the Converters list.
|
||||
*/
|
||||
nsresult CreateConvertersList();
|
||||
|
||||
/**
|
||||
* Gathers the necessary informations about each Converter.
|
||||
*/
|
||||
|
@ -314,16 +308,6 @@ done:
|
|||
return res;
|
||||
}
|
||||
|
||||
// XXX Hack! These lists should be obtained from the Repository, in a Component
|
||||
// Category fashion. However, for now this is the place where you should add
|
||||
// new converters. Just increase the array Sizes and place those CIDs in the
|
||||
// slots.
|
||||
nsresult nsCharsetConverterManager::CreateConvertersList()
|
||||
{
|
||||
#include "registryhack2.h"
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsCharsetConverterManager::GatherConvertersInfo()
|
||||
{
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsTextToSubURI.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
|
@ -94,3 +95,63 @@ NS_IMETHODIMP nsTextToSubURI::ConvertAndEscape(
|
|||
|
||||
return rv;
|
||||
}
|
||||
//==============================================================
|
||||
class nsTextToSubURIFactory : public nsIFactory {
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
nsTextToSubURIFactory() {
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
virtual ~nsTextToSubURIFactory() {
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
NS_IMETHOD CreateInstance(nsISupports* aDelegate, const nsIID& aIID, void** aResult);
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------
|
||||
NS_DEFINE_IID( kIFactoryIID, NS_IFACTORY_IID);
|
||||
NS_IMPL_ISUPPORTS( nsTextToSubURIFactory , kIFactoryIID);
|
||||
|
||||
NS_IMETHODIMP nsTextToSubURIFactory::CreateInstance(
|
||||
nsISupports* aDelegate, const nsIID &aIID, void** aResult)
|
||||
{
|
||||
if(NULL == aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if(NULL != aDelegate)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
*aResult = NULL;
|
||||
|
||||
nsISupports *inst = new nsTextToSubURI();
|
||||
|
||||
|
||||
if(NULL == inst) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res =inst->QueryInterface(aIID, aResult);
|
||||
if(NS_FAILED(res)) {
|
||||
delete inst;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
NS_IMETHODIMP nsTextToSubURIFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if(aLock)
|
||||
PR_AtomicIncrement( &g_LockCount );
|
||||
else
|
||||
PR_AtomicDecrement( &g_LockCount );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//==============================================================
|
||||
nsIFactory* NEW_TEXTTOSUBURI_FACTORY()
|
||||
{
|
||||
return new nsTextToSubURIFactory();
|
||||
}
|
||||
|
|
|
@ -29,11 +29,14 @@
|
|||
#include "nsPlatformCharsetFactory.h"
|
||||
#include "nsICharsetAlias.h"
|
||||
#include "nsCharsetAliasFactory.h"
|
||||
#include "nsITextToSubURI.h"
|
||||
#include "nsTextToSubURI.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsUConvDll.h"
|
||||
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
static NS_DEFINE_CID(kTextToSubURICID, NS_TEXTTOSUBURI_CID);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
@ -130,6 +133,16 @@ extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* aServMgr,
|
|||
return res;
|
||||
}
|
||||
|
||||
if (aClass.Equals(kTextToSubURICID)) {
|
||||
nsIFactory *factory = NEW_TEXTTOSUBURI_FACTORY();
|
||||
nsresult res = factory->QueryInterface(kIFactoryIID, (void**) aFactory);
|
||||
if (NS_FAILED(res)) {
|
||||
*aFactory = NULL;
|
||||
delete factory;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
@ -166,6 +179,13 @@ extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* aServMgr, const char *
|
|||
PR_TRUE, PR_TRUE);
|
||||
if(NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;
|
||||
|
||||
rv = compMgr->RegisterComponent(kTextToSubURICID,
|
||||
"Text To Sub URI Helper",
|
||||
NS_ITEXTTOSUBURI_PROGID,
|
||||
path,
|
||||
PR_TRUE, PR_TRUE);
|
||||
if(NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;
|
||||
|
||||
rv = compMgr->RegisterComponent(kCharsetConverterManagerCID,
|
||||
"Charset Conversion Manager",
|
||||
NS_CHARSETCONVERTERMANAGER_PROGID,
|
||||
|
@ -205,6 +225,9 @@ extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* aServMgr, const char
|
|||
rv = compMgr->UnregisterComponent(kCharsetAliasCID, path);
|
||||
if(NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kTextToSubURICID, path);
|
||||
if(NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kCharsetConverterManagerCID, path);
|
||||
if(NS_FAILED(rv)) goto done;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче