[Pharo-project] Issue 3663 in pharo: XMLWriter and MultiByteFileStream

pharo at googlecode.com pharo at googlecode.com
Sun Feb 6 11:58:54 CET 2011


Comment #1 on issue 3663 by stephane... at gmail.com: XMLWriter and  
MultiByteFileStream
http://code.google.com/p/pharo/issues/detail?id=3663

Name: Multilingual-ul.135
Author: ul
Time: 31 January 2011, 2:40:43.278 am
UUID: 8cec33f7-5ea5-1c45-974d-a335275f1192
Ancestors: Multilingual-ul.134

Fixed an indexing mistake.

=============== Diff against Multilingual-ul.133 ===============

Item was added:
+ ----- Method: MultiByteBinaryOrTextStream>>basicNext:putAll:startingAt:  
(in category 'private basic') -----
+ basicNext: anInteger putAll: aCollection startingAt: startIndex
+
+       ^super next: anInteger putAll: aCollection startingAt: startIndex!

Item was added:
+ ----- Method: MultiByteBinaryOrTextStream>>next:putAll:startingAt: (in  
category 'public') -----
+ next: anInteger putAll: aCollection startingAt: startIndex
+
+       (self isBinary or: [ aCollection class == ByteArray ]) ifTrue: [
+               ^super next: anInteger putAll: aCollection startingAt:  
startIndex ].
+       ^self converter next: anInteger putAll: aCollection startingAt:  
startIndex toStream: self
+ !

Item was added:
+ ----- Method: MultiByteFileStream>>basicNext:putAll:startingAt: (in  
category 'private basic') -----
+ basicNext: anInteger putAll: aCollection startingAt: startIndex
+
+       ^super next: anInteger putAll: aCollection startingAt: startIndex!

Item was added:
+ ----- Method: MultiByteFileStream>>next:putAll:startingAt: (in  
category 'public') -----
+ next: anInteger putAll: aCollection startingAt: startIndex
+
+       (self isBinary or: [ aCollection class == ByteArray ]) ifTrue: [
+               ^super next: anInteger putAll: aCollection startingAt:  
startIndex ].
+       ^converter next: anInteger putAll: aCollection startingAt:  
startIndex toStream: self!

Item was changed:
  ----- Method: MultiByteFileStream>>nextPutAll: (in category 'public') -----
  nextPutAll: aCollection

        (self isBinary or: [aCollection class == ByteArray]) ifTrue: [
                ^ super nextPutAll: aCollection.
        ].
+       ^converter nextPutAll: aCollection toStream: self!
-       converter nextPutAll: aCollection toStream: self.
-       ^aCollection!

Item was added:
+ ----- Method: TextConverter>>next:putAll:startingAt:toStream: (in  
category 'conversion') -----
+ next: anInteger putAll: aString startingAt: startIndex toStream: aStream
+       "Handle fast conversion if ByteString"
+
+       | lastIndex nextIndex |
+       aString class == ByteString ifFalse: [
+               startIndex to: startIndex + anInteger - 1 do: [ :index |
+                       self nextPut: (aString at: index) toStream: aStream  
].
+               ^aString ].
+       aStream isBinary ifTrue: [
+               aStream basicNext: anInteger putAll: aString startingAt:  
startIndex.
+               ^aString ].
+       lastIndex := startIndex.
+       [ (nextIndex := ByteString
+               findFirstInString: aString
+               inSet: latin1Map
+               startingAt: lastIndex) = 0 or: [ nextIndex > anInteger ] ]  
whileFalse: [
+                       aStream
+                               basicNext: nextIndex - lastIndex putAll:  
aString startingAt: lastIndex;
+                               basicNextPutAll: (latin1Encodings at:  
(aString byteAt: nextIndex) + 1).
+                       lastIndex := nextIndex + 1 ].
+       aStream basicNext: anInteger - lastIndex + startIndex putAll:  
aString startingAt: lastIndex.
+       ^aString!

Item was changed:
  ----- Method: TextConverter>>nextPutAll:toStream: (in  
category 'conversion') -----
  nextPutAll: aString toStream: aStream
        "Handle fast conversion if ByteString"

+       ^self next: aString size putAll: aString startingAt: 1 toStream:  
aStream!
-       | lastIndex nextIndex |
-       aString class == ByteString ifFalse: [
-               aString do: [:char | self nextPut: char toStream: aStream].
-               ^self].
-
-       aStream isBinary ifTrue: [
-               aStream basicNextPutAll: aString.
-               ^self].
-       lastIndex := 1.
-       [nextIndex := ByteString findFirstInString: aString inSet:  
latin1Map startingAt: lastIndex.
-       nextIndex = 0] whileFalse:
-               [aStream next: nextIndex-lastIndex putAll: aString  
startingAt: lastIndex.
-               aStream basicNextPutAll: (latin1Encodings at: (aString  
byteAt: nextIndex)+1).
-               lastIndex := nextIndex + 1].
-       aStream next: aString size-lastIndex+1 putAll: aString startingAt:  
lastIndex.
-       ^self
- !






More information about the Pharo-project mailing list