mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 205262 warning nsSampleWordBreaker::Next was hidden by nsSemanticUnitScanner::Next
r=smontagu sr=dbaron
This commit is contained in:
parent
30ad7506e5
commit
4ae837ad81
@ -62,11 +62,11 @@ public:
|
||||
PRUint32 aOffset,
|
||||
PRUint32 *oWordBegin,
|
||||
PRUint32 *oWordEnd) = 0;
|
||||
NS_IMETHOD Next( const PRUnichar* aText, PRUint32 aLen, PRUint32 aPos,
|
||||
PRUint32* oNext, PRBool *oNeedMoreText) = 0;
|
||||
NS_IMETHOD NextWord(const PRUnichar* aText, PRUint32 aLen, PRUint32 aPos,
|
||||
PRUint32* oNext, PRBool *oNeedMoreText) = 0;
|
||||
|
||||
NS_IMETHOD Prev( const PRUnichar* aText, PRUint32 aLen, PRUint32 aPos,
|
||||
PRUint32* oPrev, PRBool *oNeedMoreText) = 0;
|
||||
NS_IMETHOD PrevWord(const PRUnichar* aText, PRUint32 aLen, PRUint32 aPos,
|
||||
PRUint32* oPrev, PRBool *oNeedMoreText) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -170,7 +170,7 @@ nsresult nsSampleWordBreaker::FindWord(
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsSampleWordBreaker::Next(
|
||||
nsresult nsSampleWordBreaker::NextWord(
|
||||
const PRUnichar* aText, PRUint32 aLen, PRUint32 aPos,
|
||||
PRUint32* oNext, PRBool *oNeedMoreText)
|
||||
{
|
||||
@ -194,7 +194,7 @@ nsresult nsSampleWordBreaker::Next(
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsSampleWordBreaker::Prev( const PRUnichar* aText, PRUint32 aLen, PRUint32 aPos,
|
||||
nsresult nsSampleWordBreaker::PrevWord(const PRUnichar* aText, PRUint32 aLen, PRUint32 aPos,
|
||||
PRUint32* oPrev, PRBool *oNeedMoreText)
|
||||
{
|
||||
PRInt8 c1, c2;
|
||||
|
@ -68,18 +68,14 @@ public:
|
||||
PRUint32 *oWordBegin,
|
||||
PRUint32 *oWordEnd);
|
||||
|
||||
NS_IMETHOD Next( const PRUnichar* aText, PRUint32 aLen, PRUint32 aPos,
|
||||
PRUint32* oNext, PRBool *oNeedMoreText);
|
||||
NS_IMETHOD NextWord(const PRUnichar* aText, PRUint32 aLen, PRUint32 aPos,
|
||||
PRUint32* oNext, PRBool *oNeedMoreText);
|
||||
|
||||
NS_IMETHOD Prev( const PRUnichar* aText, PRUint32 aLen, PRUint32 aPos,
|
||||
PRUint32* oPrev, PRBool *oNeedMoreText);
|
||||
NS_IMETHOD PrevWord(const PRUnichar* aText, PRUint32 aLen, PRUint32 aPos,
|
||||
PRUint32* oPrev, PRBool *oNeedMoreText);
|
||||
|
||||
protected:
|
||||
PRUint8 GetClass(PRUnichar aChar);
|
||||
PRUint32 Next(const PRUnichar* aText, PRUint32 aLen, PRUint32 aPos);
|
||||
PRUint32 Prev(const PRUnichar* aText, PRUint32 aLen, PRUint32 aPos);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsSampleWordBreaker_h__ */
|
||||
|
@ -75,8 +75,8 @@ NS_IMETHODIMP nsSemanticUnitScanner::Next(const PRUnichar *text, PRInt32 length,
|
||||
|
||||
PRUint8 char_class = nsSampleWordBreaker::GetClass(text[pos]);
|
||||
|
||||
// if we are in chinese mode, return on han letter at a time
|
||||
// we should not do this if we are in Japanese or Korena mode
|
||||
// if we are in chinese mode, return one han letter at a time
|
||||
// we should not do this if we are in Japanese or Korean mode
|
||||
if (kWbClassHanLetter == char_class) {
|
||||
*begin = pos;
|
||||
*end = pos+1;
|
||||
@ -87,33 +87,26 @@ NS_IMETHODIMP nsSemanticUnitScanner::Next(const PRUnichar *text, PRInt32 length,
|
||||
PRUint32 next;
|
||||
PRBool needMoreText;
|
||||
// find the next "word"
|
||||
nsresult res = nsSampleWordBreaker::Next(text, (PRUint32) length, (PRUint32) pos,
|
||||
nsresult res = NextWord(text, (PRUint32) length, (PRUint32) pos,
|
||||
&next, &needMoreText);
|
||||
|
||||
NS_ASSERTION(NS_SUCCEEDED(res), "nsSampleWordBreaker::Next failed");
|
||||
if(NS_FAILED(res))
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
// if we don't have enough text to make decision, return
|
||||
if (needMoreText) {
|
||||
if (isLastBuffer) {
|
||||
*begin = pos;
|
||||
*end = length;
|
||||
*_retval = PR_TRUE;
|
||||
return NS_OK;
|
||||
} else {
|
||||
*begin = pos;
|
||||
*end = pos;
|
||||
*_retval = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
*begin = pos;
|
||||
*end = isLastBuffer ? length : pos;
|
||||
*_retval = isLastBuffer;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// if what we got is space or punct, look at the next break
|
||||
if ( (char_class == kWbClassSpace) || (char_class == kWbClassPunct) ) {
|
||||
// if the next "word" is not letters,
|
||||
// call itself recursively with the new pos
|
||||
return Next(text, length, next, isLastBuffer, begin, end, _retval);
|
||||
if ((char_class == kWbClassSpace) || (char_class == kWbClassPunct)) {
|
||||
// if the next "word" is not letters,
|
||||
// call itself recursively with the new pos
|
||||
return Next(text, length, next, isLastBuffer, begin, end, _retval);
|
||||
}
|
||||
|
||||
// for the rest, return
|
||||
|
@ -172,9 +172,9 @@ PRBool TestASCIIWB(nsIWordBreaker *lb,
|
||||
PRBool done;
|
||||
PRUint32 curr =0;
|
||||
|
||||
for(i = 0, lb->Next(eng1.get(), eng1.Length(), curr, &curr, &done);
|
||||
for(i = 0, lb->NextWord(eng1.get(), eng1.Length(), curr, &curr, &done);
|
||||
(! done ) && (i < 256);
|
||||
lb->Next(eng1.get(), eng1.Length(), curr, &curr, &done), i++)
|
||||
lb->NextWord(eng1.get(), eng1.Length(), curr, &curr, &done), i++)
|
||||
{
|
||||
res [i] = curr;
|
||||
}
|
||||
@ -438,19 +438,19 @@ void SamplePrintWordWithBreak()
|
||||
|
||||
PRUint32 cur = 0;
|
||||
PRBool done;
|
||||
res = wbk->Next(fragText.get(), fragText.Length(), cur, &cur, &done);
|
||||
res = wbk->NextWord(fragText.get(), fragText.Length(), cur, &cur, &done);
|
||||
PRUint32 start = 0;
|
||||
for(PRUint32 j = 0; ! done ; j++)
|
||||
{
|
||||
tmp.SetLength(0);
|
||||
tmp.Truncate();
|
||||
fragText.Mid(tmp, start, cur - start);
|
||||
result.Append(tmp);
|
||||
result.Append(NS_LITERAL_STRING("^"));
|
||||
start = cur;
|
||||
wbk->Next(fragText.get(), fragText.Length(), cur, &cur, &done);
|
||||
wbk->NextWord(fragText.get(), fragText.Length(), cur, &cur, &done);
|
||||
}
|
||||
|
||||
tmp.SetLength(0);
|
||||
tmp.Truncate();
|
||||
fragText.Mid(tmp, start, fragText.Length() - start);
|
||||
result.Append(tmp);
|
||||
|
||||
|
@ -575,7 +575,7 @@ nsTextTransformer::ScanNormalUnicodeText_F(PRBool aForLineBreak,
|
||||
mLineBreaker->Next(cp0, fragLen, offset, &next, &tryNextFrag);
|
||||
}
|
||||
else {
|
||||
mWordBreaker->Next(cp0, fragLen, offset, &next, &tryNextFrag);
|
||||
mWordBreaker->NextWord(cp0, fragLen, offset, &next, &tryNextFrag);
|
||||
}
|
||||
numChars = (PRInt32) (next - (PRUint32) offset) + 1;
|
||||
|
||||
@ -1231,7 +1231,7 @@ nsTextTransformer::ScanNormalUnicodeText_B(PRBool aForLineBreak,
|
||||
mLineBreaker->Prev(cp0, offset, offset, &prev, &tryPrevFrag);
|
||||
}
|
||||
else {
|
||||
mWordBreaker->Prev(cp0, offset, offset, &prev, &tryPrevFrag);
|
||||
mWordBreaker->PrevWord(cp0, offset, offset, &prev, &tryPrevFrag);
|
||||
}
|
||||
numChars = (PRInt32) ((PRUint32) offset - prev) + 1;
|
||||
|
||||
|
@ -575,7 +575,7 @@ nsTextTransformer::ScanNormalUnicodeText_F(PRBool aForLineBreak,
|
||||
mLineBreaker->Next(cp0, fragLen, offset, &next, &tryNextFrag);
|
||||
}
|
||||
else {
|
||||
mWordBreaker->Next(cp0, fragLen, offset, &next, &tryNextFrag);
|
||||
mWordBreaker->NextWord(cp0, fragLen, offset, &next, &tryNextFrag);
|
||||
}
|
||||
numChars = (PRInt32) (next - (PRUint32) offset) + 1;
|
||||
|
||||
@ -1231,7 +1231,7 @@ nsTextTransformer::ScanNormalUnicodeText_B(PRBool aForLineBreak,
|
||||
mLineBreaker->Prev(cp0, offset, offset, &prev, &tryPrevFrag);
|
||||
}
|
||||
else {
|
||||
mWordBreaker->Prev(cp0, offset, offset, &prev, &tryPrevFrag);
|
||||
mWordBreaker->PrevWord(cp0, offset, offset, &prev, &tryPrevFrag);
|
||||
}
|
||||
numChars = (PRInt32) ((PRUint32) offset - prev) + 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user