From 1879574b9fee67b208f68365fd9ca23feb265ab8 Mon Sep 17 00:00:00 2001 From: "rickg%netscape.com" Date: Sat, 29 May 1999 09:28:56 +0000 Subject: [PATCH] using brute-force search for now git-svn-id: svn://10.0.0.236/trunk@33236 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/string/obsolete/nsStr.cpp | 38 ++++++++++--------------- mozilla/xpcom/ds/nsStr.cpp | 38 ++++++++++--------------- mozilla/xpcom/string/obsolete/nsStr.cpp | 38 ++++++++++--------------- 3 files changed, 45 insertions(+), 69 deletions(-) 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