Author: markt
Date: Mon Jan 15 22:20:19 2018
New Revision: 1821200
URL: http://svn.apache.org/viewvc?rev=1821200&view=rev
Log:
Reduce diff between ByteChunk and CharChunk
No functional change
Modified:
tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java
tomcat/trunk/java/org/apache/tomcat/util/buf/CharChunk.java
Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java?rev=1821200&r1=1821199&r2=1821200&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java Mon Jan 15
22:20:19 2018
@@ -626,17 +626,18 @@ public final class ByteChunk extends Abs
* Compares the message bytes to the specified String object.
*
* @param s the String to compare
- * @return true if the comparison succeeded, false otherwise
+ * @return <code>true</code> if the comparison succeeded,
<code>false</code>
+ * otherwise
*/
public boolean equalsIgnoreCase(String s) {
byte[] b = buff;
- int blen = end - start;
- if (b == null || blen != s.length()) {
+ int len = end - start;
+ if (b == null || len != s.length()) {
return false;
}
- int boff = start;
- for (int i = 0; i < blen; i++) {
- if (Ascii.toLower(b[boff++]) != Ascii.toLower(s.charAt(i))) {
+ int off = start;
+ for (int i = 0; i < len; i++) {
+ if (Ascii.toLower(b[off++]) != Ascii.toLower(s.charAt(i))) {
return false;
}
}
@@ -656,7 +657,7 @@ public final class ByteChunk extends Abs
}
int len = end - start;
- if (len2 != len || b1 == null || b2 == null) {
+ if (len != len2 || b1 == null || b2 == null) {
return false;
}
Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/CharChunk.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/CharChunk.java?rev=1821200&r1=1821199&r2=1821200&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/CharChunk.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/CharChunk.java Mon Jan 15
22:20:19 2018
@@ -500,11 +500,13 @@ public final class CharChunk extends Abs
return true;
}
- if (b1 == null || b2 == null || end - start != len2) {
+ int len = end - start;
+ if (len != len2 || b1 == null || b2 == null) {
return false;
}
+
int off1 = start;
- int len = end - start;
+
while (len-- > 0) {
if (b1[off1++] != b2[off2++]) {
return false;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]