diff --git a/mozilla/string/obsolete/nsStr.cpp b/mozilla/string/obsolete/nsStr.cpp index e099759c818..50b0ca1e1ea 100644 --- a/mozilla/string/obsolete/nsStr.cpp +++ b/mozilla/string/obsolete/nsStr.cpp @@ -438,31 +438,23 @@ void nsStr::CompressSet(nsStr& aDest,const char* aSet,PRUint32 aChar,PRBool aEli PRInt32 nsStr::FindSubstr(const nsStr& aDest,const nsStr& aTarget, PRBool aIgnoreCase,PRUint32 anOffset) { + PRUint32 index=anOffset-1; + PRUint32 theMax=aDest.mLength-aTarget.mLength; if((aDest.mLength>0) && (aTarget.mLength>0) && (anOffset= 0 && GetCharAt(aDest,theBufIndex)==GetCharAt(aTarget,thePatIndex)){ - --theBufIndex; - --thePatIndex; + PRUint32 theNewStartPos=-1; + PRUnichar theFirstTargetChar=GetCharAt(aTarget,0); + PRUnichar theLastTargetChar=GetCharAt(aTarget,aTarget.mLength-1); + PRUint32 theTargetMax=aTarget.mLength; + while(++index<=theMax) { + PRUint32 theSubIndex=-1; + PRBool matches=PR_TRUE; + while((++theSubIndex0) && (aTarget.mLength>0) && (anOffset= 0 && GetCharAt(aDest,theBufIndex)==GetCharAt(aTarget,thePatIndex)){ - --theBufIndex; - --thePatIndex; + PRUint32 theNewStartPos=-1; + PRUnichar theFirstTargetChar=GetCharAt(aTarget,0); + PRUnichar theLastTargetChar=GetCharAt(aTarget,aTarget.mLength-1); + PRUint32 theTargetMax=aTarget.mLength; + while(++index<=theMax) { + PRUint32 theSubIndex=-1; + PRBool matches=PR_TRUE; + while((++theSubIndex0) && (aTarget.mLength>0) && (anOffset= 0 && GetCharAt(aDest,theBufIndex)==GetCharAt(aTarget,thePatIndex)){ - --theBufIndex; - --thePatIndex; + PRUint32 theNewStartPos=-1; + PRUnichar theFirstTargetChar=GetCharAt(aTarget,0); + PRUnichar theLastTargetChar=GetCharAt(aTarget,aTarget.mLength-1); + PRUint32 theTargetMax=aTarget.mLength; + while(++index<=theMax) { + PRUint32 theSubIndex=-1; + PRBool matches=PR_TRUE; + while((++theSubIndex