Remove unnecessary and obsolete code. Bug 424916, r+sr=dbaron, a=damons

This commit is contained in:
smontagu@smontagu.org 2008-03-25 13:19:34 -07:00
parent 49b860a42b
commit 2d7e70b9f1
20 changed files with 1 additions and 1353 deletions

View File

@ -51,11 +51,6 @@ nsProbingState nsBig5Prober::HandleData(const char* aBuf, PRUint32 aLen)
for (PRUint32 i = 0; i < aLen; i++)
{
codingState = mCodingSM->NextState(aBuf[i]);
if (codingState == eError)
{
mState = eNotMe;
break;
}
if (codingState == eItsMe)
{
mState = eFoundIt;

View File

@ -57,11 +57,6 @@ nsProbingState nsEUCJPProber::HandleData(const char* aBuf, PRUint32 aLen)
for (PRUint32 i = 0; i < aLen; i++)
{
codingState = mCodingSM->NextState(aBuf[i]);
if (codingState == eError)
{
mState = eNotMe;
break;
}
if (codingState == eItsMe)
{
mState = eFoundIt;

View File

@ -52,11 +52,6 @@ nsProbingState nsEUCKRProber::HandleData(const char* aBuf, PRUint32 aLen)
for (PRUint32 i = 0; i < aLen; i++)
{
codingState = mCodingSM->NextState(aBuf[i]);
if (codingState == eError)
{
mState = eNotMe;
break;
}
if (codingState == eItsMe)
{
mState = eFoundIt;

View File

@ -52,11 +52,6 @@ nsProbingState nsEUCTWProber::HandleData(const char* aBuf, PRUint32 aLen)
for (PRUint32 i = 0; i < aLen; i++)
{
codingState = mCodingSM->NextState(aBuf[i]);
if (codingState == eError)
{
mState = eNotMe;
break;
}
if (codingState == eItsMe)
{
mState = eFoundIt;

View File

@ -74,26 +74,8 @@ nsProbingState nsEscCharSetProber::HandleData(const char* aBuf, PRUint32 aLen)
{
for (j = mActiveSM-1; j>= 0; j--)
{
//byte is feed to all active state machine
codingState = mCodingSM[j]->NextState(aBuf[i]);
if (codingState == eError)
{
//got negative answer for this state machine, make it inactive
mActiveSM--;
if (mActiveSM == 0)
{
mState = eNotMe;
return mState;
}
else if (j != (PRInt32)mActiveSM)
{
nsCodingStateMachine* t;
t = mCodingSM[mActiveSM];
mCodingSM[mActiveSM] = mCodingSM[j];
mCodingSM[j] = t;
}
}
else if (codingState == eItsMe)
if (codingState == eItsMe)
{
mState = eFoundIt;
mDetectedCharset = mCodingSM[j]->GetCodingStateMachine();

View File

@ -57,11 +57,6 @@ nsProbingState nsGB18030Prober::HandleData(const char* aBuf, PRUint32 aLen)
for (PRUint32 i = 0; i < aLen; i++)
{
codingState = mCodingSM->NextState(aBuf[i]);
if (codingState == eError)
{
mState = eNotMe;
break;
}
if (codingState == eItsMe)
{
mState = eFoundIt;

View File

@ -134,16 +134,6 @@ nsProbingState nsMBCSGroupProber::HandleData(const char* aBuf, PRUint32 aLen)
mState = eFoundIt;
return mState;
}
else if (st == eNotMe)
{
mIsActive[i] = PR_FALSE;
mActiveNum--;
if (mActiveNum <= 0)
{
mState = eNotMe;
return mState;
}
}
}
}
}
@ -161,16 +151,6 @@ nsProbingState nsMBCSGroupProber::HandleData(const char* aBuf, PRUint32 aLen)
mState = eFoundIt;
return mState;
}
else if (st == eNotMe)
{
mIsActive[i] = PR_FALSE;
mActiveNum--;
if (mActiveNum <= 0)
{
mState = eNotMe;
return mState;
}
}
}
}
mKeepNext = keepNext;

View File

@ -57,11 +57,6 @@ nsProbingState nsSJISProber::HandleData(const char* aBuf, PRUint32 aLen)
for (PRUint32 i = 0; i < aLen; i++)
{
codingState = mCodingSM->NextState(aBuf[i]);
if (codingState == eError)
{
mState = eNotMe;
break;
}
if (codingState == eItsMe)
{
mState = eFoundIt;

View File

@ -51,11 +51,6 @@ nsProbingState nsUTF8Prober::HandleData(const char* aBuf, PRUint32 aLen)
for (PRUint32 i = 0; i < aLen; i++)
{
codingState = mCodingSM->NextState(aBuf[i]);
if (codingState == eError)
{
mState = eNotMe;
break;
}
if (codingState == eItsMe)
{
mState = eFoundIt;

View File

@ -1,60 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = chardetc
LIBRARY_NAME = chardetc
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
MODULE_NAME = nsCharDetModuleClassic
REQUIRES = xpcom
CPPSRCS = \
nsClassicCharDetDll.cpp \
nsClassicDetectors.cpp \
$(NULL)
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
include $(topsrcdir)/config/rules.mk

View File

@ -1,72 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsICharsetAlias.h"
#include "pratom.h"
#include "nsClassicCharDetDll.h"
#include "nsICharsetDetectionObserver.h"
#include "nsISupports.h"
#include "nsIComponentManager.h"
#include "nsIFactory.h"
#include "nsIServiceManager.h"
#include "nsIGenericFactory.h"
#include "nsCOMPtr.h"
#include "nsICharsetDetector.h"
#include "nsIStringCharsetDetector.h"
#include "nsClassicDetectors.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJACharsetClassicDetector)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJAStringCharsetClassicDetector)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsKOCharsetClassicDetector)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsKOStringCharsetClassicDetector)
static const nsModuleComponentInfo components[] = {
{ "Classic JA Charset Detector", NS_JA_CLASSIC_DETECTOR_CID,
NS_CHARSET_DETECTOR_CONTRACTID_BASE "jaclassic", nsJACharsetClassicDetectorConstructor},
{ "Classic JA String Charset Detector", NS_JA_CLASSIC_DETECTOR_CID,
NS_STRCDETECTOR_CONTRACTID_BASE "jaclassic", nsJAStringCharsetClassicDetectorConstructor},
{ "Classic KO Charset Detector", NS_KO_CLASSIC_DETECTOR_CID,
NS_CHARSET_DETECTOR_CONTRACTID_BASE "koclassic", nsKOCharsetClassicDetectorConstructor},
{ "Classic KO String Charset Detector", NS_KO_CLASSIC_STRING_DETECTOR_CID,
NS_STRCDETECTOR_CONTRACTID_BASE "koclassic", nsKOStringCharsetClassicDetectorConstructor}
};
NS_IMPL_NSGETMODULE(nsCharDetModuleClassic, components)

View File

@ -1,43 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsClassicCharDetDll_h__
#define nsClassicCharDetDll_h__
#include "prtypes.h"
#endif /* nsClassicCharDetDll_h__ */

View File

@ -1,297 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIFactory.h"
#include "nsISupports.h"
#include "nsClassicCharDetDll.h"
#include "pratom.h"
#include "nsICharsetDetector.h"
#include "nsICharsetDetectionObserver.h"
#include "nsIStringCharsetDetector.h"
#include "nsClassicDetectors.h"
//==========================================================
/* values for EUC shift chars */
#define SS2 0x8E /* Single Shift 2 */
#define SS3 0x8F /* Single Shift 3 */
#define IsRoman(c) ((c) < 0x80)
#define IsSJIS2ndByte(c) (((c) > 0x3F) && ((c) < 0xFD))
#define IsLoSJIS2ndByte(c) (((c) > 0x3F) && ((c) < 0xA1))
#define IsHiSJIS2ndByte(c) (((c) > 0xA0) && ((c) < 0xFD))
#define IsEUCJPKana(b1) (((b1) > 0xA0) && ((b1) < 0xE0))
#define IsEUCJPKanji(b1or2) (((b1or2) > 0xA0) && ((b1or2) < 0xFF))
#define YES 1
#define NO 0
#define MAYBE -1
static int
isSJIS(const unsigned char *cp, PRInt32 len)
{
while (len) {
if (IsRoman(*cp)) {
cp++, len--;
} else if (*cp == 0x80) { /* illegal SJIS 1st byte */
return NO;
} else if ((*cp < 0xA0)) { /* byte 1 of 2byte SJIS 1st range */
if (len > 1) {
if (IsSJIS2ndByte(cp[1])) {
if ((*cp != 0x8E && *cp != 0x8F) || (*(cp+1) <= 0xA0))
return YES;
cp += 2, len -= 2; /* valid 2 byte SJIS */
} else {
return NO; /* invalid SJIS 2nd byte */
}
} else
break; /* buffer ended w/1of2 byte SJIS */
} else if (*cp == 0xA0) { /* illegal EUCJP byte */
#if ALLOW_NBSP
cp++, len--; /* allow nbsp */
#endif
} else if (*cp < 0xE0) { /* SJIS half-width kana */
cp++, len--;
} else if (*cp < 0xF0) { /* byte 1 of 2byte SJIS 2nd range */
if (len > 1) {
if (IsSJIS2ndByte(cp[1])) {
cp += 2, len -= 2; /* valid 2 byte SJIS */
} else {
return NO; /* invalid SJIS */
}
} else
break; /* buffer ended w/1of2 byte SJIS */
} else {
return NO; /* invalid SJIS 1st byte */
}
}
return MAYBE; /* No illegal SJIS values found */
}
static int
isEUCJP(const unsigned char *cp, PRInt32 len)
{
while (len) {
if (IsRoman(*cp)) { /* Roman */
cp++, len--;
} else if (*cp == SS2) { /* EUCJP JIS201 half-width kana */
if (len > 1) {
if (IsEUCJPKana(cp[1]))
cp += 2, len -= 2; /* valid half-width kana */
else
return NO; /* invalid 2of3 byte EUC */
} else
break; /* buffer ended w/1of2 byte EUC */
} else if (*cp == SS3) { /* EUCJP JIS212 */
if (len > 1) {
if (IsEUCJPKanji(cp[1])) {
if (len > 2) {
if (IsEUCJPKanji(cp[2]))
cp += 2, len -= 2; /* valid 3 byte EUCJP */
else
return NO; /* invalid 3of3 byte EUCJP */
} else
break; /* buffer ended w/2of3 byte EUCJP */
} else
return NO; /* invalid 2of3 byte EUCJP */
} else
break; /* buffer ended w/1of3 byte EUCJP */
} else if (*cp == 0xA0) { /* illegal EUCJP byte */
#if ALLOW_NBSP
cp++, len--; /* allow nbsp */
#else
return NO;
#endif
} else if (*cp < 0xF0) { /* EUCJP JIS208 (overlaps SJIS) */
if (len > 1) {
if (IsEUCJPKanji(cp[1]))
cp += 2, len -= 2; /* valid 2 byte EUCJP */
else
return NO; /* invalid 2of2 byte EUCJP */
} else
break; /* buffer ended w/1of2 byte EUCJP */
} else if (*cp < 0xFF) { /* EUCJP JIS208 only: */
if (len > 1) {
if (IsEUCJPKanji(cp[1]))
return YES; /* valid 2 byte EUCJP, invalid SJIS */
else
return NO; /* invalid 2of2 byte EUCJP */
} else
break; /* buffer ended w/1of2 byte EUCJP */
} else {
return NO; /* invalid EUCJP 1st byte: 0xFF */
}
}
return MAYBE;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
static nsresult JA_AutoCharsetDetectBuffer(const char* aBuffer, const PRInt32 aLen, char* aCharset)
{
PRBool hasEsc = PR_FALSE;
PRBool asciiOnly = PR_TRUE;
PL_strcpy(aCharset, "ISO-8859-1");
// check 8 bit or ESC
for (int i = 0; i < aLen; i++) {
if ((unsigned char) aBuffer[i] > 127 || aBuffer[i] == 0x1B) {
if (aBuffer[i] == 0x1B) {
hasEsc = PR_TRUE;
break;
}
else {
asciiOnly = PR_FALSE;
}
}
}
if (hasEsc) {
PL_strcpy(aCharset, "ISO-2022-JP");
}
else if (!asciiOnly) {
// use old japanese auto detect code
int euc, sjis;
euc = isEUCJP((unsigned char *) aBuffer, aLen);
sjis = isSJIS((unsigned char *) aBuffer, aLen);
if (YES == euc) {
PL_strcpy(aCharset, "EUC-JP");
}
else if (YES == sjis) {
PL_strcpy(aCharset, "Shift_JIS");
}
else if (MAYBE == euc && NO == sjis) {
PL_strcpy(aCharset, "EUC-JP");
}
else if (MAYBE == sjis && NO == euc) {
PL_strcpy(aCharset, "Shift_JIS");
}
else if (MAYBE == euc && MAYBE == sjis) {
PL_strcpy(aCharset, "EUC-JP");
}
}
return NS_OK;
}
//==========================================================
NS_IMPL_ISUPPORTS1(nsClassicDetector, nsICharsetDetector)
//----------------------------------------------------------
nsClassicDetector::nsClassicDetector(const char* language)
{
mObserver = nsnull;
PL_strcpy(mLanguage, language);
}
//----------------------------------------------------------
nsClassicDetector::~nsClassicDetector()
{
}
//----------------------------------------------------------
NS_IMETHODIMP nsClassicDetector::Init(
nsICharsetDetectionObserver* aObserver)
{
NS_ASSERTION(mObserver == nsnull , "Init twice");
if(nsnull == aObserver)
return NS_ERROR_ILLEGAL_VALUE;
mObserver = aObserver;
return NS_OK;
}
//----------------------------------------------------------
NS_IMETHODIMP nsClassicDetector::DoIt(
const char* aBuf, PRUint32 aLen, PRBool* oDontFeedMe)
{
NS_ASSERTION(mObserver != nsnull , "have not init yet");
if((nsnull == aBuf) || (nsnull == oDontFeedMe))
return NS_ERROR_ILLEGAL_VALUE;
if (!PL_strcasecmp("ja", mLanguage) &&
NS_SUCCEEDED(JA_AutoCharsetDetectBuffer(aBuf, (PRInt32) aLen, mCharset))) {
mObserver->Notify(mCharset, eBestAnswer);
}
else {
mObserver->Notify("", eNoAnswerMatch);
}
*oDontFeedMe = PR_TRUE;
return NS_OK;
}
//----------------------------------------------------------
NS_IMETHODIMP nsClassicDetector::Done()
{
NS_ASSERTION(mObserver != nsnull , "have not init yet");
return NS_OK;
}
//==========================================================
NS_IMPL_ISUPPORTS1(nsClassicStringDetector, nsIStringCharsetDetector)
//----------------------------------------------------------
nsClassicStringDetector::nsClassicStringDetector(const char* language)
{
PL_strcpy(mLanguage, language);
}
//----------------------------------------------------------
nsClassicStringDetector::~nsClassicStringDetector()
{
}
//----------------------------------------------------------
NS_IMETHODIMP nsClassicStringDetector::DoIt(const char* aBuf, PRUint32 aLen,
const char** oCharset,
nsDetectionConfident &oConfident)
{
oConfident = eNoAnswerMatch;
*oCharset = "";
if (!PL_strcasecmp("ja", mLanguage) &&
NS_SUCCEEDED(JA_AutoCharsetDetectBuffer(aBuf, (PRInt32) aLen, mCharset))) {
*oCharset = mCharset;
oConfident = eBestAnswer;
}
return NS_OK;
}

View File

@ -1,123 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsClassicDetectors_h__
#define nsClassicDetectors_h__
#include "nsCOMPtr.h"
#include "nsIFactory.h"
// {1D2394A0-542A-11d3-914D-006008A6EDF6}
#define NS_JA_CLASSIC_DETECTOR_CID \
{ 0x1d2394a0, 0x542a, 0x11d3, { 0x91, 0x4d, 0x0, 0x60, 0x8, 0xa6, 0xed, 0xf6 } }
// {1D2394A1-542A-11d3-914D-006008A6EDF6}
#define NS_JA_CLASSIC_STRING_DETECTOR_CID \
{ 0x1d2394a1, 0x542a, 0x11d3, { 0x91, 0x4d, 0x0, 0x60, 0x8, 0xa6, 0xed, 0xf6 } }
// {1D2394A2-542A-11d3-914D-006008A6EDF6}
#define NS_KO_CLASSIC_DETECTOR_CID \
{ 0x1d2394a2, 0x542a, 0x11d3, { 0x91, 0x4d, 0x0, 0x60, 0x8, 0xa6, 0xed, 0xf6 } }
// {1D2394A3-542A-11d3-914D-006008A6EDF6}
#define NS_KO_CLASSIC_STRING_DETECTOR_CID \
{ 0x1d2394a3, 0x542a, 0x11d3, { 0x91, 0x4d, 0x0, 0x60, 0x8, 0xa6, 0xed, 0xf6 } }
class nsClassicDetector :
public nsICharsetDetector // Implement the interface
{
public:
NS_DECL_ISUPPORTS
nsClassicDetector(const char* language);
virtual ~nsClassicDetector();
NS_IMETHOD Init(nsICharsetDetectionObserver* aObserver);
NS_IMETHOD DoIt(const char* aBuf, PRUint32 aLen, PRBool* oDontFeedMe);
NS_IMETHOD Done();
private:
nsCOMPtr<nsICharsetDetectionObserver> mObserver;
char mCharset[65];
char mLanguage[32];
};
class nsClassicStringDetector :
public nsIStringCharsetDetector // Implement the interface
{
public:
NS_DECL_ISUPPORTS
nsClassicStringDetector(const char* language);
virtual ~nsClassicStringDetector();
NS_IMETHOD DoIt(const char* aBuf, PRUint32 aLen,
const char** oCharset,
nsDetectionConfident &oConfident);
protected:
char mCharset[65];
char mLanguage[32];
};
class nsJACharsetClassicDetector : public nsClassicDetector
{
public:
nsJACharsetClassicDetector()
: nsClassicDetector("ja") {};
};
class nsJAStringCharsetClassicDetector : public nsClassicStringDetector
{
public:
nsJAStringCharsetClassicDetector()
: nsClassicStringDetector("ja") {};
};
class nsKOCharsetClassicDetector : public nsClassicDetector
{
public:
nsKOCharsetClassicDetector()
: nsClassicDetector("ko") {};
};
class nsKOStringCharsetClassicDetector : public nsClassicStringDetector
{
public:
nsKOStringCharsetClassicDetector()
: nsClassicStringDetector("ko") {};
};
#endif /* nsClassicDetectors_h__ */

View File

@ -354,20 +354,6 @@ PRBool nsPSMDetector::HandleData(const char* aBuf, PRUint32 aLen)
Report( mVerifier[mItemIdx[j]]->charset);
mDone = PR_TRUE;
return mDone;
} else if (eError == st)
{
#ifdef DETECTOR_DEBUG
printf("It's NOT %s- byte %d(%x)\n",
mVerifier[mItemIdx[j]]->charset,
i+mDbgLen,
i+mDbgLen);
#endif
mItems--;
if(j < mItems )
{
mItemIdx[j] = mItemIdx[mItems];
mState[j] = mState[mItems];
}
} else {
mState[j++] = st;
}

View File

@ -1,80 +0,0 @@
#!nmake
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH=..\..\..\..
REQUIRES = xpcom \
string \
chardet \
uconv \
$(NULL)
LCFLAGS= $(LCFLAGS) -D__STDC__
DEFINES= -DWIN32_LEAN_AND_MEAN
LIBRARY_NAME= chardetnativeTest
OBJS= \
$(NULL)
CSRCS= \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\nsNativeCharDetDll.obj \
.\$(OBJDIR)\nsNativeDetectors.obj \
$(NULL)
MODULE=chardetnativeTest
MAKE_OBJ_TYPE=DLL
DLLNAME=chardetnativeTest
DLL=.\$(OBJDIR)\$(DLLNAME).dll
WIN_LIBS= ole32.lib
LLIBS= \
$(DIST)\lib\xpcom.lib \
$(LIBNSPR)
include <$(DEPTH)\config\rules.mak>
libs:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
clobber::
rm -f $(DIST)\bin\components\$(DLLNAME).dll

View File

@ -1,150 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsICharsetAlias.h"
#include "pratom.h"
#include "nsNativeCharDetDll.h"
#include "nsISupports.h"
#include "nsIComponentManager.h"
#include "nsIFactory.h"
#include "nsIServiceManager.h"
#include "nsCOMPtr.h"
#include "nsICharsetDetector.h"
#include "nsIStringCharsetDetector.h"
#include "nsNativeDetectors.h"
static NS_DEFINE_CID(kJANativeDetectorCID, NS_JA_NATIVE_DETECTOR_CID);
static NS_DEFINE_CID(kJANativeStringDetectorCID, NS_JA_NATIVE_STRING_DETECTOR_CID);
static NS_DEFINE_CID(kKONativeDetectorCID, NS_KO_NATIVE_DETECTOR_CID);
static NS_DEFINE_CID(kKONativeStringDetectorCID, NS_KO_NATIVE_STRING_DETECTOR_CID);
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_IID(kFactoryIID, NS_IFACTORY_IID);
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* aServMgr,
const nsCID &aClass,
const char *aClassName,
const char *aContractID,
nsIFactory **aFactory)
{
if (aFactory == NULL) {
return NS_ERROR_NULL_POINTER;
}
nsIFactory *factory = nsnull;
if (aClass.Equals(kJANativeDetectorCID)) {
;
//bug#13844 disable this until find out the reason of the freeze
//factory = NEW_JA_NATIVEDETECTOR_FACTORY();
} else if (aClass.Equals(kJANativeStringDetectorCID)) {
factory = NEW_JA_STRING_NATIVEDETECTOR_FACTORY();
} else if (aClass.Equals(kKONativeDetectorCID)) {
;factory = NEW_KO_NATIVEDETECTOR_FACTORY();
} else if (aClass.Equals(kKONativeStringDetectorCID)) {
factory = NEW_KO_STRING_NATIVEDETECTOR_FACTORY();
}
if(nsnull != factory) {
nsresult res = factory->QueryInterface(kFactoryIID, (void **) aFactory);
if (NS_FAILED(res)) {
*aFactory = NULL;
delete factory;
}
return res;
}
return NS_NOINTERFACE;
}
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* aServMgr) {
return PR_FALSE;
}
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* aServMgr, const char *path)
{
nsresult rv;
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIComponentManager> compMgr = do_GetService(kComponentManagerCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = compMgr->RegisterComponent(kJANativeDetectorCID,
"Native JA Charset Detector",
NS_CHARSET_DETECTOR_CONTRACTID_BASE "jams",
path,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(kJANativeStringDetectorCID,
"Native JA String Charset Detector",
NS_STRCDETECTOR_CONTRACTID_BASE "jams",
path,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(kKONativeDetectorCID,
"Native KO Charset Detector",
NS_CHARSET_DETECTOR_CONTRACTID_BASE "koms",
path,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(kKONativeStringDetectorCID,
"Native KO String Charset Detector",
NS_STRCDETECTOR_CONTRACTID_BASE "koms",
path,
PR_TRUE, PR_TRUE);
return rv;
}
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* aServMgr, const char *path)
{
nsresult rv;
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIComponentManager> compMgr = do_GetService(kComponentManagerCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = compMgr->UnregisterComponent(kJANativeDetectorCID, path);
rv = compMgr->UnregisterComponent(kJANativeStringDetectorCID, path);
rv = compMgr->UnregisterComponent(kKONativeDetectorCID, path);
rv = compMgr->UnregisterComponent(kKONativeStringDetectorCID, path);
return rv;
}

View File

@ -1,43 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsNativeCharDetDll_h__
#define nsNativeCharDetDll_h__
#include "prtypes.h"
#endif /* nsNativeCharDetDll_h__ */

View File

@ -1,333 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include <objbase.h>
#include <mlang.h>
#include "nsIFactory.h"
#include "nsISupports.h"
#include "nsNativeCharDetDll.h"
#include "pratom.h"
#include "nsReadableUtils.h"
#include "nsICharsetDetector.h"
#include "nsICharsetDetectionObserver.h"
#include "nsIStringCharsetDetector.h"
//==========================================================
// By using DoConversion to unicode with from codepage set to auto detection,
// we can get input codepage then charset name.
//
static HRESULT DetectCharsetUsingMLang(IMultiLanguage *aMultiLanguage, IMLangConvertCharset *aMLangConvertCharset,
char* charset, nsDetectionConfident& aConfidence, BYTE* inBuf, UINT* inSize)
{
if (NULL == charset) {
return E_FAIL;
}
if (*inSize > 4096) {
return E_FAIL; // Or we could allocate memory on heap
}
aConfidence = eNoAnswerYet;
BYTE outBuf[4096];
UINT outSize = 0;
HRESULT hr = aMLangConvertCharset->DoConversion(inBuf, inSize, outBuf, &outSize);
if (SUCCEEDED(hr)) {
DWORD dwProperty = 0;
UINT sourceCP;
hr = aMLangConvertCharset->GetProperty(&dwProperty);
if (SUCCEEDED(hr)) {
if (dwProperty & MLCONVCHARF_AUTODETECT) {
hr = aMLangConvertCharset->GetSourceCodePage(&sourceCP);
if (SUCCEEDED(hr)) {
MIMECPINFO aCodePageInfo;
hr = aMultiLanguage->GetCodePageInfo(sourceCP, &aCodePageInfo);
if (SUCCEEDED(hr)) {
// convert WCHAR* to char*
nsString aCharset(aCodePageInfo.wszWebCharset);
char *cstr = ToNewCString(aCharset);
PL_strcpy(charset, cstr);
delete [] cstr;
aConfidence = eSureAnswer;
}
}
}
else {
charset[0] = '\0';
aConfidence = eNoAnswerMatch;
}
}
}
return hr;
}
//==========================================================
class nsNativeDetector :
public nsICharsetDetector // Implement the interface
{
public:
NS_DECL_ISUPPORTS
nsNativeDetector(PRUint32 aCodePage);
virtual ~nsNativeDetector();
NS_IMETHOD Init(nsICharsetDetectionObserver* aObserver);
NS_IMETHOD DoIt(const char* aBuf, PRUint32 aLen, PRBool* oDontFeedMe);
NS_IMETHOD Done();
private:
nsICharsetDetectionObserver* mObserver;
IMultiLanguage *mMultiLanguage;
IMLangConvertCharset *mMLangConvertCharset;
PRUint32 mCodePage;
char mCharset[65];
};
NS_IMPL_ISUPPORTS1(nsNativeDetector, nsICharsetDetector)
//----------------------------------------------------------
nsNativeDetector::nsNativeDetector(PRUint32 aCodePage)
{
HRESULT hr = CoInitialize(NULL);
mObserver = nsnull;
mCodePage = aCodePage;
mMultiLanguage = NULL;
mMLangConvertCharset = NULL;
}
//----------------------------------------------------------
nsNativeDetector::~nsNativeDetector()
{
NS_IF_RELEASE(mObserver);
if (NULL != mMultiLanguage)
mMultiLanguage->Release();
if (NULL != mMLangConvertCharset)
mMLangConvertCharset->Release();
CoUninitialize();
}
//----------------------------------------------------------
NS_IMETHODIMP nsNativeDetector::Init(
nsICharsetDetectionObserver* aObserver)
{
NS_ASSERTION(mObserver == nsnull , "Init twice");
if(nsnull == aObserver)
return NS_ERROR_ILLEGAL_VALUE;
mObserver = aObserver;
HRESULT hr = CoCreateInstance(CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
IID_IMultiLanguage, (LPVOID *)&mMultiLanguage);
if (SUCCEEDED(hr)) {
DWORD dwProperty = 0;
hr = mMultiLanguage->CreateConvertCharset(mCodePage, 1200, dwProperty, &mMLangConvertCharset);
}
return SUCCEEDED(hr) ? NS_OK : NS_ERROR_FAILURE;
}
//----------------------------------------------------------
NS_IMETHODIMP nsNativeDetector::DoIt(
const char* aBuf, PRUint32 aLen, PRBool* oDontFeedMe)
{
NS_ASSERTION(mObserver != nsnull , "have not init yet");
if((nsnull == aBuf) || (nsnull == oDontFeedMe))
return NS_ERROR_ILLEGAL_VALUE;
UINT theSize = (UINT) aLen;
nsDetectionConfident aConfidence;
if (SUCCEEDED(DetectCharsetUsingMLang(mMultiLanguage, mMLangConvertCharset,
mCharset, aConfidence, (BYTE *) aBuf, &theSize))) {
if (eNoAnswerMatch != aConfidence) {
mObserver->Notify(mCharset, aConfidence);
}
}
else {
mObserver->Notify("", eNoAnswerMatch);
}
*oDontFeedMe = PR_TRUE;
return NS_OK;
}
//----------------------------------------------------------
NS_IMETHODIMP nsNativeDetector::Done()
{
NS_ASSERTION(mObserver != nsnull , "have not init yet");
return NS_OK;
}
//==========================================================
class nsNativeStringDetector :
public nsIStringCharsetDetector // Implement the interface
{
public:
NS_DECL_ISUPPORTS
nsNativeStringDetector(PRUint32 aCodePage);
virtual ~nsNativeStringDetector();
NS_IMETHOD DoIt(const char* aBuf, PRUint32 aLen,
const char** oCharset,
nsDetectionConfident &oConfident);
protected:
PRUint32 mCodePage;
IMultiLanguage *mMultiLanguage;
char mCharset[65];
};
NS_IMPL_ISUPPORTS1(nsNativeStringDetector, nsIStringCharsetDetector)
//----------------------------------------------------------
nsNativeStringDetector::nsNativeStringDetector(PRUint32 aCodePage)
{
HRESULT hr = CoInitialize(NULL);
mCodePage = aCodePage;
mMultiLanguage = NULL;
}
//----------------------------------------------------------
nsNativeStringDetector::~nsNativeStringDetector()
{
if (NULL != mMultiLanguage)
mMultiLanguage->Release();
CoUninitialize();
}
//----------------------------------------------------------
NS_IMETHODIMP nsNativeStringDetector::DoIt(const char* aBuf, PRUint32 aLen,
const char** oCharset,
nsDetectionConfident &oConfident)
{
HRESULT hr = S_OK;
oConfident = eNoAnswerMatch;
*oCharset = "";
if (NULL == mMultiLanguage) {
hr = CoCreateInstance(CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
IID_IMultiLanguage, (LPVOID *)&mMultiLanguage);
}
if (SUCCEEDED(hr)) {
IMLangConvertCharset *aMLangConvertCharset;
DWORD dwProperty = 0;
hr = mMultiLanguage->CreateConvertCharset(mCodePage, 1200, dwProperty, &aMLangConvertCharset);
if (SUCCEEDED(hr)) {
UINT theSize = (UINT) aLen;
nsDetectionConfident aConfidence;
hr = DetectCharsetUsingMLang(mMultiLanguage, aMLangConvertCharset,
mCharset, aConfidence, (BYTE *) aBuf, &theSize);
if (SUCCEEDED(hr)) {
*oCharset = mCharset;
oConfident = aConfidence;
}
aMLangConvertCharset->Release();
}
}
return SUCCEEDED(hr) ? NS_OK : NS_ERROR_FAILURE;
}
//==========================================================
class nsNativeDetectorFactory : public nsIFactory {
NS_DECL_ISUPPORTS
public:
nsNativeDetectorFactory(PRUint32 aCodePage, PRBool stringBase) {
mCodePage = aCodePage;
mStringBase = stringBase;
}
virtual ~nsNativeDetectorFactory() {
}
NS_IMETHOD CreateInstance(nsISupports* aDelegate, const nsIID& aIID, void** aResult);
NS_IMETHOD LockFactory(PRBool aLock);
private:
PRUint32 mCodePage;
PRBool mStringBase;
};
//--------------------------------------------------------------
NS_IMPL_ISUPPORTS1(nsNativeDetectorFactory, nsIFactory)
NS_IMETHODIMP nsNativeDetectorFactory::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 = nsnull;
if (mStringBase)
inst = (nsISupports *) new nsNativeStringDetector(mCodePage);
else
inst = (nsISupports *) new nsNativeDetector(mCodePage);
if(NULL == inst) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(inst); // Stabilize
nsresult res =inst->QueryInterface(aIID, aResult);
NS_RELEASE(inst); // Destabilize and avoid leaks. Avoid calling delete <interface pointer>
return res;
}
//--------------------------------------------------------------
NS_IMETHODIMP nsNativeDetectorFactory::LockFactory(PRBool aLock)
{
return NS_OK;
}
//==========================================================
nsIFactory* NEW_JA_NATIVEDETECTOR_FACTORY() {
return new nsNativeDetectorFactory(50932, PR_FALSE);
}
nsIFactory* NEW_JA_STRING_NATIVEDETECTOR_FACTORY() {
return new nsNativeDetectorFactory(50932, PR_TRUE);
}
nsIFactory* NEW_KO_NATIVEDETECTOR_FACTORY() {
return new nsNativeDetectorFactory(50949, PR_FALSE);
}
nsIFactory* NEW_KO_STRING_NATIVEDETECTOR_FACTORY() {
return new nsNativeDetectorFactory(50949, PR_TRUE);
}

View File

@ -1,64 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsNativeDetectors_h__
#define nsNativeDetectors_h__
#include "nsIFactory.h"
// {4FE25140-3944-11d3-9142-006008A6EDF6}
#define NS_JA_NATIVE_DETECTOR_CID \
{ 0x4fe25140, 0x3944, 0x11d3, { 0x91, 0x42, 0x0, 0x60, 0x8, 0xa6, 0xed, 0xf6 } };
// {57296530-3644-11d3-9142-006008A6EDF6}
#define NS_JA_NATIVE_STRING_DETECTOR_CID \
{ 0x57296530, 0x3644, 0x11d3, { 0x91, 0x42, 0x0, 0x60, 0x8, 0xa6, 0xed, 0xf6 } }
// {4FE25141-3944-11d3-9142-006008A6EDF6}
#define NS_KO_NATIVE_DETECTOR_CID \
{ 0x4fe25141, 0x3944, 0x11d3, { 0x91, 0x42, 0x0, 0x60, 0x8, 0xa6, 0xed, 0xf6 } };
// {4FE25142-3944-11d3-9142-006008A6EDF6}
#define NS_KO_NATIVE_STRING_DETECTOR_CID \
{ 0x4fe25142, 0x3944, 0x11d3, { 0x91, 0x42, 0x0, 0x60, 0x8, 0xa6, 0xed, 0xf6 } };
nsIFactory* NEW_JA_NATIVEDETECTOR_FACTORY();
nsIFactory* NEW_JA_STRING_NATIVEDETECTOR_FACTORY();
nsIFactory* NEW_KO_NATIVEDETECTOR_FACTORY();
nsIFactory* NEW_KO_STRING_NATIVEDETECTOR_FACTORY();
#endif /* nsNativeDetectors_h__ */