You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/09/12 23:38:54 UTC

svn commit: r280428 - /directory/asn1/trunk/ber-new/src/java/main/org/apache/asn1new/util/StringUtils.java

Author: elecharny
Date: Mon Sep 12 14:38:49 2005
New Revision: 280428

URL: http://svn.apache.org/viewcvs?rev=280428&view=rev
Log:
Fixed a bug in the funcion which counts the number of chars.

Modified:
    directory/asn1/trunk/ber-new/src/java/main/org/apache/asn1new/util/StringUtils.java

Modified: directory/asn1/trunk/ber-new/src/java/main/org/apache/asn1new/util/StringUtils.java
URL: http://svn.apache.org/viewcvs/directory/asn1/trunk/ber-new/src/java/main/org/apache/asn1new/util/StringUtils.java?rev=280428&r1=280427&r2=280428&view=diff
==============================================================================
--- directory/asn1/trunk/ber-new/src/java/main/org/apache/asn1new/util/StringUtils.java (original)
+++ directory/asn1/trunk/ber-new/src/java/main/org/apache/asn1new/util/StringUtils.java Mon Sep 12 14:38:49 2005
@@ -163,26 +163,26 @@
      */
     public static int countBytesPerChar(byte[] bytes, int pos)
     {
-        if ((bytes[0] & UTF8_MULTI_BYTES_MASK) == 0)
+        if ((bytes[pos] & UTF8_MULTI_BYTES_MASK) == 0)
         {
             return 1;
-        } else if ((bytes[0] & UTF8_TWO_BYTES_MASK) == UTF8_TWO_BYTES)
+        } else if ((bytes[pos] & UTF8_TWO_BYTES_MASK) == UTF8_TWO_BYTES)
     	{
             return 2;
     	}
-    	else if ((bytes[0] & UTF8_THREE_BYTES_MASK) == UTF8_THREE_BYTES)
+    	else if ((bytes[pos] & UTF8_THREE_BYTES_MASK) == UTF8_THREE_BYTES)
     	{
     	    return 3;
     	}
-    	else if ((bytes[0] & UTF8_FOUR_BYTES_MASK) == UTF8_FOUR_BYTES)
+    	else if ((bytes[pos] & UTF8_FOUR_BYTES_MASK) == UTF8_FOUR_BYTES)
     	{
     	    return 4;
     	}
-    	else if ((bytes[0] & UTF8_FIVE_BYTES_MASK) == UTF8_FIVE_BYTES)
+    	else if ((bytes[pos] & UTF8_FIVE_BYTES_MASK) == UTF8_FIVE_BYTES)
     	{
     	    return 5;
     	}
-    	else if ((bytes[0] & UTF8_SIX_BYTES_MASK) == UTF8_SIX_BYTES)
+    	else if ((bytes[pos] & UTF8_SIX_BYTES_MASK) == UTF8_SIX_BYTES)
     	{
     	    return 6;
         }