зеркало из https://github.com/mozilla/gecko-dev.git
fixed PDT+ bug27954; r=buster;a=jar; precheckins ok
This commit is contained in:
Родитель
a51ec724d9
Коммит
3ed534b000
|
@ -383,10 +383,14 @@ nsCString& nsCString::StripWhitespace() {
|
|||
*/
|
||||
nsCString& nsCString::ReplaceChar(PRUnichar aOldChar, PRUnichar aNewChar) {
|
||||
PRUint32 theIndex=0;
|
||||
for(theIndex=0;theIndex<mLength;theIndex++){
|
||||
if(mStr[theIndex]==(char)aOldChar) {
|
||||
mStr[theIndex]=(char)aNewChar;
|
||||
}//if
|
||||
|
||||
if((aOldChar<256) && (aNewChar<256)){
|
||||
//only execute this if oldchar and newchar are within legal ascii range
|
||||
for(theIndex=0;theIndex<mLength;theIndex++){
|
||||
if(mStr[theIndex]==(char)aOldChar) {
|
||||
mStr[theIndex]=(char)aNewChar;
|
||||
}//if
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -399,7 +403,9 @@ nsCString& nsCString::ReplaceChar(PRUnichar aOldChar, PRUnichar aNewChar) {
|
|||
* @return *this
|
||||
*/
|
||||
nsCString& nsCString::ReplaceChar(const char* aSet, PRUnichar aNewChar){
|
||||
if(aSet){
|
||||
if(aSet && (aNewChar<256)){
|
||||
//only execute this if newchar is valid ascii, and aset isn't null.
|
||||
|
||||
PRInt32 theIndex=FindCharInSet(aSet,0);
|
||||
while(kNotFound<theIndex) {
|
||||
mStr[theIndex]=(char)aNewChar;
|
||||
|
@ -589,7 +595,7 @@ nsCString* nsCString::ToNewString() const {
|
|||
* @return ptr to new ascii string
|
||||
*/
|
||||
char* nsCString::ToNewCString() const {
|
||||
nsCString temp(mStr);
|
||||
nsCString temp(*this);
|
||||
temp.SetCapacity(8);
|
||||
char* result=temp.mStr;
|
||||
temp.mStr=0;
|
||||
|
@ -603,7 +609,7 @@ char* nsCString::ToNewCString() const {
|
|||
* @return ptr to new ascii string
|
||||
*/
|
||||
PRUnichar* nsCString::ToNewUnicode() const {
|
||||
nsString temp(mStr);
|
||||
nsString temp(mStr,mLength);
|
||||
temp.SetCapacity(8);
|
||||
PRUnichar* result=temp.mUStr;
|
||||
temp.mStr=0;
|
||||
|
|
|
@ -245,7 +245,7 @@ CopyChars gCopyChars[2][2]={
|
|||
/**
|
||||
* This methods cans the given buffer for the given char
|
||||
*
|
||||
* @update gess 3/25/98
|
||||
* @update gess 02/17/00
|
||||
* @param aDest is the buffer to be searched
|
||||
* @param aDestLength is the size (in char-units, not bytes) of the buffer
|
||||
* @param anOffset is the start pos to begin searching
|
||||
|
@ -262,8 +262,11 @@ inline PRInt32 FindChar1(const char* aDest,PRUint32 aDestLength,PRInt32 anOffset
|
|||
if(aCount<0)
|
||||
aCount = (PRInt32)aDestLength;
|
||||
|
||||
if((0<aDestLength) && ((PRUint32)anOffset<aDestLength)) {
|
||||
|
||||
if((aChar<256) && (0<aDestLength) && ((PRUint32)anOffset<aDestLength)) {
|
||||
|
||||
//We'll only search if the given aChar is within the normal ascii a range,
|
||||
//(Since this string is definitely within the ascii range).
|
||||
|
||||
if(0<aCount) {
|
||||
|
||||
const char* left= aDest+anOffset;
|
||||
|
@ -353,7 +356,7 @@ inline PRInt32 FindChar2(const char* aDest,PRUint32 aDestLength,PRInt32 anOffset
|
|||
/**
|
||||
* This methods cans the given buffer (in reverse) for the given char
|
||||
*
|
||||
* @update gess 3/25/98
|
||||
* @update gess 02/17/00
|
||||
* @param aDest is the buffer to be searched
|
||||
* @param aDestLength is the size (in char-units, not bytes) of the buffer
|
||||
* @param anOffset is the start pos to begin searching
|
||||
|
@ -371,7 +374,10 @@ inline PRInt32 RFindChar1(const char* aDest,PRUint32 aDestLength,PRInt32 anOffse
|
|||
if(aCount<0)
|
||||
aCount = aDestLength;
|
||||
|
||||
if((0<aDestLength) && ((PRUint32)anOffset<aDestLength)) {
|
||||
if((aChar<256) && (0<aDestLength) && ((PRUint32)anOffset<aDestLength)) {
|
||||
|
||||
//We'll only search if the given aChar is within the normal ascii a range,
|
||||
//(Since this string is definitely within the ascii range).
|
||||
|
||||
if(0<aCount) {
|
||||
|
||||
|
|
|
@ -383,10 +383,14 @@ nsCString& nsCString::StripWhitespace() {
|
|||
*/
|
||||
nsCString& nsCString::ReplaceChar(PRUnichar aOldChar, PRUnichar aNewChar) {
|
||||
PRUint32 theIndex=0;
|
||||
for(theIndex=0;theIndex<mLength;theIndex++){
|
||||
if(mStr[theIndex]==(char)aOldChar) {
|
||||
mStr[theIndex]=(char)aNewChar;
|
||||
}//if
|
||||
|
||||
if((aOldChar<256) && (aNewChar<256)){
|
||||
//only execute this if oldchar and newchar are within legal ascii range
|
||||
for(theIndex=0;theIndex<mLength;theIndex++){
|
||||
if(mStr[theIndex]==(char)aOldChar) {
|
||||
mStr[theIndex]=(char)aNewChar;
|
||||
}//if
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -399,7 +403,9 @@ nsCString& nsCString::ReplaceChar(PRUnichar aOldChar, PRUnichar aNewChar) {
|
|||
* @return *this
|
||||
*/
|
||||
nsCString& nsCString::ReplaceChar(const char* aSet, PRUnichar aNewChar){
|
||||
if(aSet){
|
||||
if(aSet && (aNewChar<256)){
|
||||
//only execute this if newchar is valid ascii, and aset isn't null.
|
||||
|
||||
PRInt32 theIndex=FindCharInSet(aSet,0);
|
||||
while(kNotFound<theIndex) {
|
||||
mStr[theIndex]=(char)aNewChar;
|
||||
|
@ -589,7 +595,7 @@ nsCString* nsCString::ToNewString() const {
|
|||
* @return ptr to new ascii string
|
||||
*/
|
||||
char* nsCString::ToNewCString() const {
|
||||
nsCString temp(mStr);
|
||||
nsCString temp(*this);
|
||||
temp.SetCapacity(8);
|
||||
char* result=temp.mStr;
|
||||
temp.mStr=0;
|
||||
|
@ -603,7 +609,7 @@ char* nsCString::ToNewCString() const {
|
|||
* @return ptr to new ascii string
|
||||
*/
|
||||
PRUnichar* nsCString::ToNewUnicode() const {
|
||||
nsString temp(mStr);
|
||||
nsString temp(mStr,mLength);
|
||||
temp.SetCapacity(8);
|
||||
PRUnichar* result=temp.mUStr;
|
||||
temp.mStr=0;
|
||||
|
|
|
@ -383,10 +383,14 @@ nsCString& nsCString::StripWhitespace() {
|
|||
*/
|
||||
nsCString& nsCString::ReplaceChar(PRUnichar aOldChar, PRUnichar aNewChar) {
|
||||
PRUint32 theIndex=0;
|
||||
for(theIndex=0;theIndex<mLength;theIndex++){
|
||||
if(mStr[theIndex]==(char)aOldChar) {
|
||||
mStr[theIndex]=(char)aNewChar;
|
||||
}//if
|
||||
|
||||
if((aOldChar<256) && (aNewChar<256)){
|
||||
//only execute this if oldchar and newchar are within legal ascii range
|
||||
for(theIndex=0;theIndex<mLength;theIndex++){
|
||||
if(mStr[theIndex]==(char)aOldChar) {
|
||||
mStr[theIndex]=(char)aNewChar;
|
||||
}//if
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -399,7 +403,9 @@ nsCString& nsCString::ReplaceChar(PRUnichar aOldChar, PRUnichar aNewChar) {
|
|||
* @return *this
|
||||
*/
|
||||
nsCString& nsCString::ReplaceChar(const char* aSet, PRUnichar aNewChar){
|
||||
if(aSet){
|
||||
if(aSet && (aNewChar<256)){
|
||||
//only execute this if newchar is valid ascii, and aset isn't null.
|
||||
|
||||
PRInt32 theIndex=FindCharInSet(aSet,0);
|
||||
while(kNotFound<theIndex) {
|
||||
mStr[theIndex]=(char)aNewChar;
|
||||
|
@ -589,7 +595,7 @@ nsCString* nsCString::ToNewString() const {
|
|||
* @return ptr to new ascii string
|
||||
*/
|
||||
char* nsCString::ToNewCString() const {
|
||||
nsCString temp(mStr);
|
||||
nsCString temp(*this);
|
||||
temp.SetCapacity(8);
|
||||
char* result=temp.mStr;
|
||||
temp.mStr=0;
|
||||
|
@ -603,7 +609,7 @@ char* nsCString::ToNewCString() const {
|
|||
* @return ptr to new ascii string
|
||||
*/
|
||||
PRUnichar* nsCString::ToNewUnicode() const {
|
||||
nsString temp(mStr);
|
||||
nsString temp(mStr,mLength);
|
||||
temp.SetCapacity(8);
|
||||
PRUnichar* result=temp.mUStr;
|
||||
temp.mStr=0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче