[kaffe] CVS kaffe (guilhem): java/text/AttributedStringIterator.java

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Sat Feb 28 05:18:03 2004


PatchSet 4469 
Date: 2004/02/28 13:15:27
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
        * java/text/AttributedStringIterator.java
        (getAllAttributesKey): Return only keys concerned
        by the current iterator.
        (getAttributes): Use strict inequality for
        end_index.

Members: 
	ChangeLog:1.2049->1.2050 
	libraries/javalib/java/text/AttributedStringIterator.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2049 kaffe/ChangeLog:1.2050
--- kaffe/ChangeLog:1.2049	Fri Feb 27 18:12:51 2004
+++ kaffe/ChangeLog	Sat Feb 28 13:15:27 2004
@@ -1,3 +1,11 @@
+2004-02-28    Guilhem Lavaux <guilhem@kaffe.org>
+
+	* java/text/AttributedStringIterator.java
+	(getAllAttributesKey): Return only keys concerned
+	by the current iterator.
+	(getAttributes): Use strict inequality for
+	end_index. 
+
 2004-02-27  Dalibor Topic <robilad@kaffe.org>
 
         * kaffe/kaffevm/verify.c
Index: kaffe/libraries/javalib/java/text/AttributedStringIterator.java
diff -u kaffe/libraries/javalib/java/text/AttributedStringIterator.java:1.1 kaffe/libraries/javalib/java/text/AttributedStringIterator.java:1.2
--- kaffe/libraries/javalib/java/text/AttributedStringIterator.java:1.1	Mon Nov 11 12:01:53 2002
+++ kaffe/libraries/javalib/java/text/AttributedStringIterator.java	Sat Feb 28 13:15:28 2004
@@ -179,8 +179,12 @@
   if (attribs == null)
     return(s);
 
-  for (int i = 0; i < attribs.length; i++)
+    for (int i = 0; i < attribs.length; i++)
     {
+      if (attribs[i].begin_index > getEndIndex()
+	  || attribs[i].end_index <= getBeginIndex())
+	continue;
+
       Set key_set = attribs[i].attribs.keySet();
       Iterator iter = key_set.iterator();
       while (iter.hasNext())
@@ -327,7 +331,7 @@
           // Check for attribute match and range match
           if (obj.equals(attrib))
             if ((ci.getIndex() >= attribs[i].begin_index) &&
-                (ci.getIndex() <= attribs[i].end_index))
+                (ci.getIndex() < attribs[i].end_index))
               return(attribs[i].attribs.get(obj));
         }
     }
@@ -351,7 +355,7 @@
   for (int i = 0; i < attribs.length; i++)
     {
        if ((ci.getIndex() >= attribs[i].begin_index) &&
-           (ci.getIndex() <= attribs[i].end_index))
+           (ci.getIndex() < attribs[i].end_index))
          m.putAll(attribs[i].attribs);
     }