Author: kkolinko Date: Thu Nov 17 05:05:17 2011 New Revision: 1203049 URL: http://svn.apache.org/viewvc?rev=1203049&view=rev Log: Small optimization. Use findByte() instead of indexOf(). Implementation is the same, but it is more fair to its arguments. Limit second string scan using results from the first one.
Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java?rev=1203049&r1=1203048&r2=1203049&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java Thu Nov 17 05:05:17 2011 @@ -54,10 +54,10 @@ public final class UDecoder { byte buff[]=mb.getBytes(); int end=mb.getEnd(); - int idx= ByteChunk.indexOf( buff, start, end, '%' ); + int idx= ByteChunk.findByte( buff, start, end, (byte) '%' ); int idx2=-1; if( query ) { - idx2= ByteChunk.indexOf( buff, start, end, '+' ); + idx2= ByteChunk.findByte( buff, start, (idx >= 0 ? idx : end), (byte) '+' ); } if( idx<0 && idx2<0 ) { return; @@ -125,7 +125,7 @@ public final class UDecoder { int idx= CharChunk.indexOf( buff, start, cend, '%' ); int idx2=-1; if( query ) { - idx2= CharChunk.indexOf( buff, start, cend, '+' ); + idx2= CharChunk.indexOf( buff, start, (idx >= 0 ? idx : cend), '+' ); } if( idx<0 && idx2<0 ) { return; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org