зеркало из https://github.com/mozilla/pjs.git
Convert to module from component
This commit is contained in:
Родитель
419ce4a77b
Коммит
446f6c551c
|
@ -42,10 +42,10 @@ CPPSRCS = \
|
|||
nsUnicodeEncodeHelper.cpp \
|
||||
nsUNIXCharset.cpp \
|
||||
nsCharsetAliasImp.cpp \
|
||||
nsUConvDll.cpp \
|
||||
nsURLProperties.cpp \
|
||||
nsMappingCache.cpp \
|
||||
nsCharsetMenu.cpp \
|
||||
nsUConvModule.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORT_RESOURCE = \
|
||||
|
|
|
@ -28,28 +28,28 @@ DLLNAME = uconv
|
|||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
|
||||
CPPSRCS = \
|
||||
nsTextToSubURI.cpp \
|
||||
nsTextToSubURI.cpp \
|
||||
nsCharsetConverterManager.cpp \
|
||||
nsUnicodeDecodeUtil.cpp \
|
||||
nsUnicodeDecodeHelper.cpp \
|
||||
nsUnicodeEncodeHelper.cpp \
|
||||
nsWinCharset.cpp \
|
||||
nsCharsetAliasImp.cpp \
|
||||
nsUConvDll.cpp \
|
||||
nsUConvModule.cpp \
|
||||
nsMappingCache.cpp \
|
||||
nsURLProperties.cpp \
|
||||
nsCharsetMenu.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsTextToSubURI.obj \
|
||||
.\$(OBJDIR)\nsTextToSubURI.obj \
|
||||
.\$(OBJDIR)\nsCharsetConverterManager.obj \
|
||||
.\$(OBJDIR)\nsUnicodeDecodeUtil.obj \
|
||||
.\$(OBJDIR)\nsUnicodeDecodeHelper.obj \
|
||||
.\$(OBJDIR)\nsUnicodeEncodeHelper.obj \
|
||||
.\$(OBJDIR)\nsWinCharset.obj \
|
||||
.\$(OBJDIR)\nsCharsetAliasImp.obj \
|
||||
.\$(OBJDIR)\nsUConvDll.obj \
|
||||
.\$(OBJDIR)\nsUConvModule.obj \
|
||||
.\$(OBJDIR)\nsMappingCache.obj \
|
||||
.\$(OBJDIR)\nsURLProperties.obj \
|
||||
.\$(OBJDIR)\nsCharsetMenu.obj \
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
|
||||
#include "nsICharsetAlias.h"
|
||||
#include "nsCharsetAliasFactory.h"
|
||||
#include "pratom.h"
|
||||
|
||||
// for NS_IMPL_IDS only
|
||||
|
@ -133,64 +132,30 @@ NS_IMETHODIMP nsCharsetAlias2::Equals(const char* aCharset1, const char* aCharse
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//==============================================================
|
||||
class nsCharsetAliasFactory : public nsIFactory {
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
nsCharsetAliasFactory() {
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
virtual ~nsCharsetAliasFactory() {
|
||||
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( nsCharsetAliasFactory , kIFactoryIID);
|
||||
|
||||
NS_IMETHODIMP nsCharsetAliasFactory::CreateInstance(
|
||||
nsISupports* aDelegate, const nsIID &aIID, void** aResult)
|
||||
NS_IMETHODIMP
|
||||
NS_NewCharsetAlias(nsISupports* aOuter,
|
||||
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 nsCharsetAlias2();
|
||||
|
||||
|
||||
if(NULL == inst) {
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsCharsetAlias2* inst = new nsCharsetAlias2();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res =inst->QueryInterface(aIID, aResult);
|
||||
if(NS_FAILED(res)) {
|
||||
delete inst;
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
NS_IMETHODIMP nsCharsetAliasFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if(aLock)
|
||||
PR_AtomicIncrement( &g_LockCount );
|
||||
else
|
||||
PR_AtomicDecrement( &g_LockCount );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//==============================================================
|
||||
nsIFactory* NEW_CHARSETALIASFACTORY()
|
||||
{
|
||||
return new nsCharsetAliasFactory();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "nsICharsetConverterInfo.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsCharsetConverterManager.h"
|
||||
#include "nsUConvDll.h"
|
||||
|
||||
// just for CIDs
|
||||
|
@ -498,45 +497,22 @@ NS_IMETHODIMP nsCharsetConverterManager::GetCharsetNames(
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsManagerFactory [implementation]
|
||||
|
||||
NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
NS_IMPL_ISUPPORTS(nsManagerFactory, kIFactoryIID);
|
||||
|
||||
nsManagerFactory::nsManagerFactory()
|
||||
NS_IMETHODIMP
|
||||
NS_NewCharsetConverterManager(nsISupports* aOuter, const nsIID& aIID,
|
||||
void** aResult)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsManagerFactory::~nsManagerFactory()
|
||||
{
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsIFactory [implementation]
|
||||
|
||||
NS_IMETHODIMP nsManagerFactory::CreateInstance(nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
||||
if (aDelegate != NULL) return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsICharsetConverterManager * t = nsCharsetConverterManager::GetInstance();
|
||||
if (t == NULL) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult res = t->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) delete t;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsManagerFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if (aLock) PR_AtomicIncrement(&g_LockCount);
|
||||
else PR_AtomicDecrement(&g_LockCount);
|
||||
|
||||
return NS_OK;
|
||||
if (!aResult) {
|
||||
return NS_ERROR_INVALID_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsICharsetConverterManager* inst = nsCharsetConverterManager::GetInstance();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return inst->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
|
|
@ -557,45 +557,29 @@ NS_IMETHODIMP nsCharsetMenu::DoCommand(nsISupportsArray* aSources,
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Class nsCharsetMenuFactory [implementation]
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsCharsetMenuFactory, nsCOMTypeInfo<nsIFactory>::GetIID());
|
||||
|
||||
nsCharsetMenuFactory::nsCharsetMenuFactory()
|
||||
NS_IMETHODIMP
|
||||
NS_NewCharsetMenu(nsISupports* aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsCharsetMenuFactory::~nsCharsetMenuFactory()
|
||||
{
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Interface nsIFactory [implementation]
|
||||
|
||||
NS_IMETHODIMP nsCharsetMenuFactory::CreateInstance(nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
||||
if (aDelegate != NULL) return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsCharsetMenu * t = new nsCharsetMenu;
|
||||
if (t == NULL) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult res = t->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) delete t;
|
||||
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsCharsetMenu* inst = new nsCharsetMenu();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCharsetMenuFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if (aLock) PR_AtomicIncrement(&g_LockCount);
|
||||
else PR_AtomicDecrement(&g_LockCount);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -30,37 +30,4 @@
|
|||
|
||||
#define NS_CHARSETMENU_PID "charset-menu"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Class nsCharsetMenuFactory [declaration]
|
||||
|
||||
/**
|
||||
* Factory class for the nsCharsetMenu objects.
|
||||
*
|
||||
* @created 17/Sep/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsCharsetMenuFactory : public nsIFactory
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsCharsetMenuFactory();
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsCharsetMenuFactory();
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Interface nsIFactory [declaration]
|
||||
|
||||
NS_IMETHOD CreateInstance(nsISupports *aDelegate, const nsIID &aIID,
|
||||
void **aResult);
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
};
|
||||
|
||||
#endif /* nsCharsetMenu_h___ */
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
#include "nsIPlatformCharset.h"
|
||||
#include "nsPlatformCharsetFactory.h"
|
||||
#include "pratom.h"
|
||||
#include "nsURLProperties.h"
|
||||
#include <Script.h>
|
||||
|
@ -127,57 +126,29 @@ nsMacCharset::GetDefaultCharsetForLocale(const PRUnichar* localeName, PRUnichar*
|
|||
return rv;
|
||||
}
|
||||
|
||||
class nsMacCharsetFactory : public nsIFactory {
|
||||
NS_DECL_ISUPPORTS
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
nsMacCharsetFactory() {
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
virtual ~nsMacCharsetFactory() {
|
||||
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( nsMacCharsetFactory , kIFactoryIID);
|
||||
|
||||
NS_IMETHODIMP nsMacCharsetFactory::CreateInstance(
|
||||
nsISupports* aDelegate, const nsIID &aIID, void** aResult)
|
||||
NS_IMETHODIMP
|
||||
NS_NewPlatformCharset(nsISupports* aOuter,
|
||||
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 nsMacCharset();
|
||||
if(NULL == inst) {
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsMacCharset* inst = new nsMacCharset();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res =inst->QueryInterface(aIID, aResult);
|
||||
if(NS_FAILED(res)) {
|
||||
delete inst;
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
NS_IMETHODIMP nsMacCharsetFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if(aLock)
|
||||
PR_AtomicIncrement( &g_LockCount );
|
||||
else
|
||||
PR_AtomicDecrement( &g_LockCount );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIFactory* NEW_PLATFORMCHARSETFACTORY()
|
||||
{
|
||||
return new nsMacCharsetFactory();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
*/
|
||||
|
||||
#include "nsIPlatformCharset.h"
|
||||
#include "nsPlatformCharsetFactory.h"
|
||||
#include "nsUConvDll.h"
|
||||
#include "pratom.h"
|
||||
#include <unidef.h>
|
||||
|
@ -77,55 +76,29 @@ nsOS2Charset::GetCharset(nsPlatformCharsetSel selector, nsString& oResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
class nsOS2CharsetFactory : public nsIFactory {
|
||||
NS_DECL_ISUPPORTS
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
nsOS2CharsetFactory() {
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
virtual ~nsOS2CharsetFactory() {
|
||||
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( nsOS2CharsetFactory , kIFactoryIID);
|
||||
|
||||
NS_IMETHODIMP nsOS2CharsetFactory::CreateInstance(
|
||||
nsISupports* aDelegate, const nsIID &aIID, void** aResult)
|
||||
NS_IMETHODIMP
|
||||
NS_NewPlatformCharset(nsISupports* aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if( !aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if( aDelegate)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
*aResult = NULL;
|
||||
nsISupports *inst = new nsOS2Charset;
|
||||
if( !inst)
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsOS2Charset* inst = new nsOS2Charset();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult res =inst->QueryInterface(aIID, aResult);
|
||||
if(NS_FAILED(res))
|
||||
delete inst;
|
||||
|
||||
}
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
NS_IMETHODIMP nsOS2CharsetFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if(aLock)
|
||||
PR_AtomicIncrement( &g_LockCount );
|
||||
else
|
||||
PR_AtomicDecrement( &g_LockCount );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIFactory* NEW_PLATFORMCHARSETFACTORY()
|
||||
{
|
||||
return new nsOS2CharsetFactory();
|
||||
}
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsTextToSubURI.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
|
@ -95,63 +93,30 @@ 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)
|
||||
NS_IMETHODIMP
|
||||
NS_NewTextToSubURI(nsISupports* aOuter,
|
||||
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) {
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsTextToSubURI* inst = new nsTextToSubURI();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res =inst->QueryInterface(aIID, aResult);
|
||||
if(NS_FAILED(res)) {
|
||||
delete inst;
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -20,9 +20,39 @@
|
|||
#ifndef nsUConvDll_h___
|
||||
#define nsUConvDll_h___
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
extern "C" PRInt32 g_InstanceCount;
|
||||
extern "C" PRInt32 g_LockCount;
|
||||
|
||||
// Factory methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_NewCharsetConverterManager(nsISupports* aOuter, const nsIID& aIID,
|
||||
void** aResult);
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_NewUnicodeDecodeHelper(nsISupports* aOuter, const nsIID& aIID,
|
||||
void** aResult);
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_NewUnicodeEncodeHelper(nsISupports* aOuter, const nsIID& aIID,
|
||||
void** aResult);
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_NewPlatformCharset(nsISupports* aOuter, const nsIID& aIID,
|
||||
void** aResult);
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_NewCharsetAlias(nsISupports* aOuter, const nsIID& aIID,
|
||||
void** aResult);
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_NewCharsetMenu(nsISupports* aOuter, const nsIID& aIID,
|
||||
void** aResult);
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_NewTextToSubURI(nsISupports* aOuter, const nsIID& aIID,
|
||||
void** aResult);
|
||||
|
||||
#endif /* nsUConvDll_h___ */
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include <locale.h>
|
||||
#include "nsIPlatformCharset.h"
|
||||
#include "nsPlatformCharsetFactory.h"
|
||||
#include "pratom.h"
|
||||
#include "nsURLProperties.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
@ -138,57 +137,29 @@ nsUNIXCharset::GetDefaultCharsetForLocale(const PRUnichar* localeName, PRUnichar
|
|||
|
||||
}
|
||||
|
||||
class nsUNIXCharsetFactory : public nsIFactory {
|
||||
NS_DECL_ISUPPORTS
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
nsUNIXCharsetFactory() {
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
virtual ~nsUNIXCharsetFactory() {
|
||||
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( nsUNIXCharsetFactory , kIFactoryIID);
|
||||
|
||||
NS_IMETHODIMP nsUNIXCharsetFactory::CreateInstance(
|
||||
nsISupports* aDelegate, const nsIID &aIID, void** aResult)
|
||||
NS_IMETHODIMP
|
||||
NS_NewPlatformCharset(nsISupports* aOuter,
|
||||
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 nsUNIXCharset();
|
||||
if(NULL == inst) {
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsUNIXCharset* inst = new nsUNIXCharset();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res =inst->QueryInterface(aIID, aResult);
|
||||
if(NS_FAILED(res)) {
|
||||
delete inst;
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
NS_IMETHODIMP nsUNIXCharsetFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if(aLock)
|
||||
PR_AtomicIncrement( &g_LockCount );
|
||||
else
|
||||
PR_AtomicDecrement( &g_LockCount );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIFactory* NEW_PLATFORMCHARSETFACTORY()
|
||||
{
|
||||
return new nsUNIXCharsetFactory();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "nsIMappingCache.h"
|
||||
#include "nsMappingCache.h"
|
||||
#include "nsIUnicodeDecodeHelper.h"
|
||||
#include "nsUnicodeDecodeHelper.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -258,45 +257,28 @@ NS_IMETHODIMP nsUnicodeDecodeHelper::CreateFastTable(
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsDecodeHelperFactory [implementation]
|
||||
|
||||
NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
NS_IMPL_ISUPPORTS(nsDecodeHelperFactory, kIFactoryIID);
|
||||
|
||||
nsDecodeHelperFactory::nsDecodeHelperFactory()
|
||||
NS_IMETHODIMP
|
||||
NS_NewUnicodeDecodeHelper(nsISupports* aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsDecodeHelperFactory::~nsDecodeHelperFactory()
|
||||
{
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsIFactory [implementation]
|
||||
|
||||
NS_IMETHODIMP nsDecodeHelperFactory::CreateInstance(nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
||||
if (aDelegate != NULL) return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsIUnicodeDecodeHelper * t = new nsUnicodeDecodeHelper;
|
||||
if (t == NULL) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult res = t->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) delete t;
|
||||
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsUnicodeDecodeHelper* inst = new nsUnicodeDecodeHelper();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDecodeHelperFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if (aLock) PR_AtomicIncrement(&g_LockCount);
|
||||
else PR_AtomicDecrement(&g_LockCount);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "unicpriv.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsIUnicodeEncodeHelper.h"
|
||||
#include "nsUnicodeEncodeHelper.h"
|
||||
#include "nsUConvDll.h"
|
||||
#include "nsIMappingCache.h"
|
||||
#include "nsMappingCache.h"
|
||||
|
@ -195,46 +194,30 @@ NS_IMETHODIMP nsUnicodeEncodeHelper::FillInfo(PRUint32 *aInfo, PRInt32 aTableCou
|
|||
uFillInfo((uTable*) aMappingTable[i], aInfo);
|
||||
return NS_OK;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsEncodeHelperFactory [implementation]
|
||||
|
||||
NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
NS_IMPL_ISUPPORTS(nsEncodeHelperFactory, kIFactoryIID);
|
||||
|
||||
nsEncodeHelperFactory::nsEncodeHelperFactory()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsEncodeHelperFactory::~nsEncodeHelperFactory()
|
||||
{
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsIFactory [implementation]
|
||||
|
||||
NS_IMETHODIMP nsEncodeHelperFactory::CreateInstance(nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
NS_IMETHODIMP
|
||||
NS_NewUnicodeEncodeHelper(nsISupports* aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
||||
if (aDelegate != NULL) return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsIUnicodeEncodeHelper * t = new nsUnicodeEncodeHelper;
|
||||
if (t == NULL) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult res = t->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) delete t;
|
||||
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsUnicodeEncodeHelper* inst = new nsUnicodeEncodeHelper();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEncodeHelperFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if (aLock) PR_AtomicIncrement(&g_LockCount);
|
||||
else PR_AtomicDecrement(&g_LockCount);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "pratom.h"
|
||||
#include <windows.h>
|
||||
#include "nsUConvDll.h"
|
||||
#include "nsPlatformCharsetFactory.h"
|
||||
#include "nsIWin32Locale.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsLocaleCID.h"
|
||||
|
@ -121,57 +120,29 @@ nsWinCharset::GetDefaultCharsetForLocale(const PRUnichar* localeName, PRUnichar*
|
|||
return result;
|
||||
}
|
||||
|
||||
class nsWinCharsetFactory : public nsIFactory {
|
||||
NS_DECL_ISUPPORTS
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
nsWinCharsetFactory() {
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
virtual ~nsWinCharsetFactory() {
|
||||
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( nsWinCharsetFactory , kIFactoryIID);
|
||||
|
||||
NS_IMETHODIMP nsWinCharsetFactory::CreateInstance(
|
||||
nsISupports* aDelegate, const nsIID &aIID, void** aResult)
|
||||
NS_IMETHODIMP
|
||||
NS_NewPlatformCharset(nsISupports* aOuter,
|
||||
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 nsWinCharset();
|
||||
if(NULL == inst) {
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsWinCharset* inst = new nsWinCharset();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res =inst->QueryInterface(aIID, aResult);
|
||||
if(NS_FAILED(res)) {
|
||||
delete inst;
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
NS_IMETHODIMP nsWinCharsetFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if(aLock)
|
||||
PR_AtomicIncrement( &g_LockCount );
|
||||
else
|
||||
PR_AtomicDecrement( &g_LockCount );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIFactory* NEW_PLATFORMCHARSETFACTORY()
|
||||
{
|
||||
return new nsWinCharsetFactory();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "nsIMappingCache.h"
|
||||
#include "nsMappingCache.h"
|
||||
#include "nsIUnicodeDecodeHelper.h"
|
||||
#include "nsUnicodeDecodeHelper.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -258,45 +257,28 @@ NS_IMETHODIMP nsUnicodeDecodeHelper::CreateFastTable(
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsDecodeHelperFactory [implementation]
|
||||
|
||||
NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
NS_IMPL_ISUPPORTS(nsDecodeHelperFactory, kIFactoryIID);
|
||||
|
||||
nsDecodeHelperFactory::nsDecodeHelperFactory()
|
||||
NS_IMETHODIMP
|
||||
NS_NewUnicodeDecodeHelper(nsISupports* aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsDecodeHelperFactory::~nsDecodeHelperFactory()
|
||||
{
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsIFactory [implementation]
|
||||
|
||||
NS_IMETHODIMP nsDecodeHelperFactory::CreateInstance(nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
||||
if (aDelegate != NULL) return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsIUnicodeDecodeHelper * t = new nsUnicodeDecodeHelper;
|
||||
if (t == NULL) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult res = t->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) delete t;
|
||||
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsUnicodeDecodeHelper* inst = new nsUnicodeDecodeHelper();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDecodeHelperFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if (aLock) PR_AtomicIncrement(&g_LockCount);
|
||||
else PR_AtomicDecrement(&g_LockCount);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "unicpriv.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsIUnicodeEncodeHelper.h"
|
||||
#include "nsUnicodeEncodeHelper.h"
|
||||
#include "nsUConvDll.h"
|
||||
#include "nsIMappingCache.h"
|
||||
#include "nsMappingCache.h"
|
||||
|
@ -195,46 +194,30 @@ NS_IMETHODIMP nsUnicodeEncodeHelper::FillInfo(PRUint32 *aInfo, PRInt32 aTableCou
|
|||
uFillInfo((uTable*) aMappingTable[i], aInfo);
|
||||
return NS_OK;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsEncodeHelperFactory [implementation]
|
||||
|
||||
NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
NS_IMPL_ISUPPORTS(nsEncodeHelperFactory, kIFactoryIID);
|
||||
|
||||
nsEncodeHelperFactory::nsEncodeHelperFactory()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsEncodeHelperFactory::~nsEncodeHelperFactory()
|
||||
{
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsIFactory [implementation]
|
||||
|
||||
NS_IMETHODIMP nsEncodeHelperFactory::CreateInstance(nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
NS_IMETHODIMP
|
||||
NS_NewUnicodeEncodeHelper(nsISupports* aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) return NS_ERROR_NULL_POINTER;
|
||||
if (aDelegate != NULL) return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsIUnicodeEncodeHelper * t = new nsUnicodeEncodeHelper;
|
||||
if (t == NULL) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult res = t->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) delete t;
|
||||
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aOuter) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsUnicodeEncodeHelper* inst = new nsUnicodeEncodeHelper();
|
||||
if (!inst) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(res)) {
|
||||
*aResult = nsnull;
|
||||
delete inst;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEncodeHelperFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if (aLock) PR_AtomicIncrement(&g_LockCount);
|
||||
else PR_AtomicDecrement(&g_LockCount);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче