tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf CharChunk.java
Date Thu, 01 May 2003 20:50:50 GMT
remm        2003/05/01 13:50:50

  Modified:    util/java/org/apache/tomcat/util/buf CharChunk.java
  Log:
  - I think I forgot something (Costin style) ...
  
  Revision  Changes    Path
  1.7       +19 -0     jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/CharChunk.java
  
  Index: CharChunk.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/CharChunk.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CharChunk.java	14 Jan 2003 18:20:02 -0000	1.6
  +++ CharChunk.java	1 May 2003 20:50:50 -0000	1.7
  @@ -690,6 +690,25 @@
       }
       
   
  +    public int indexOf( String src, int srcOff, int srcLen, int myOff ) {
  +	char first=src.charAt( srcOff );
  +
  +	// Look for first char 
  +	int srcEnd = srcOff + srcLen;
  +        
  +	for( int i=myOff+start; i <= (end - srcLen); i++ ) {
  +	    if( buff[i] != first ) continue;
  +	    // found first char, now look for a match
  +            int myPos=i+1;
  +	    for( int srcPos=srcOff + 1; srcPos< srcEnd; ) {
  +                if( buff[myPos++] != src.charAt( srcPos++ ))
  +		    break;
  +                if( srcPos==srcEnd ) return i-start; // found it
  +	    }
  +	}
  +	return -1;
  +    }
  +
       // -------------------- utils
       private int min(int a, int b) {
   	if (a < b) return a;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message