mirror of
https://gitlab.freedesktop.org/uchardet/uchardet.git
synced 2025-12-08 01:36:41 +08:00
Fix minor space issues.
This commit is contained in:
parent
d082704fec
commit
9a74d08b3c
@ -64,7 +64,7 @@ nsUniversalDetector::nsUniversalDetector(PRUint32 aLanguageFilter)
|
||||
mCharSetProbers[i] = nsnull;
|
||||
}
|
||||
|
||||
nsUniversalDetector::~nsUniversalDetector()
|
||||
nsUniversalDetector::~nsUniversalDetector()
|
||||
{
|
||||
for (PRInt32 i = 0; i < NUM_OF_CHARSET_PROBERS; i++)
|
||||
delete mCharSetProbers[i];
|
||||
@ -72,7 +72,7 @@ nsUniversalDetector::~nsUniversalDetector()
|
||||
delete mEscCharSetProber;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
nsUniversalDetector::Reset()
|
||||
{
|
||||
mDone = PR_FALSE;
|
||||
@ -100,7 +100,7 @@ nsUniversalDetector::Reset()
|
||||
|
||||
nsresult nsUniversalDetector::HandleData(const char* aBuf, PRUint32 aLen)
|
||||
{
|
||||
if(mDone)
|
||||
if(mDone)
|
||||
return NS_OK;
|
||||
|
||||
if (aLen > 0)
|
||||
@ -136,12 +136,12 @@ nsresult nsUniversalDetector::HandleData(const char* aBuf, PRUint32 aLen)
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PRUint32 i;
|
||||
for (i = 0; i < aLen; i++)
|
||||
{
|
||||
//other than 0xa0, if every othe character is ascii, the page is ascii
|
||||
if (aBuf[i] & '\x80' && aBuf[i] != '\xA0') //Since many Ascii only page contains NBSP
|
||||
if (aBuf[i] & '\x80' && aBuf[i] != '\xA0') //Since many Ascii only page contains NBSP
|
||||
{
|
||||
//we got a non-ascii byte (high-byte)
|
||||
if (mInputState != eHighbyte)
|
||||
@ -171,7 +171,7 @@ nsresult nsUniversalDetector::HandleData(const char* aBuf, PRUint32 aLen)
|
||||
}
|
||||
if (nsnull == mCharSetProbers[2])
|
||||
{
|
||||
mCharSetProbers[2] = new nsLatin1Prober;
|
||||
mCharSetProbers[2] = new nsLatin1Prober;
|
||||
if (nsnull == mCharSetProbers[2])
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -212,13 +212,13 @@ nsresult nsUniversalDetector::HandleData(const char* aBuf, PRUint32 aLen)
|
||||
if (mCharSetProbers[i])
|
||||
{
|
||||
st = mCharSetProbers[i]->HandleData(aBuf, aLen);
|
||||
if (st == eFoundIt)
|
||||
if (st == eFoundIt)
|
||||
{
|
||||
mDone = PR_TRUE;
|
||||
mDetectedCharset = mCharSetProbers[i]->GetCharSetName();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -234,7 +234,7 @@ void nsUniversalDetector::DataEnd()
|
||||
{
|
||||
if (!mGotData)
|
||||
{
|
||||
// we haven't got any data yet, return immediately
|
||||
// we haven't got any data yet, return immediately
|
||||
// caller program sometimes call DataEnd before anything has been sent to detector
|
||||
return;
|
||||
}
|
||||
@ -245,7 +245,7 @@ void nsUniversalDetector::DataEnd()
|
||||
Report(mDetectedCharset);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch (mInputState)
|
||||
{
|
||||
case eHighbyte:
|
||||
|
||||
@ -86,4 +86,3 @@ protected:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user