* local directory is at bonzini@gnu.org--2004b/smalltalk--devo--2.2--patch-608 * comparing to bonzini@gnu.org--2004b/smalltalk--devo--2.2--patch-608 M ./packages/iconv/Sets.st M ./packages/iconv/iconvtests.st * modified files --- orig/packages/iconv/Sets.st +++ mod/packages/iconv/Sets.st @@ -1061,15 +1061,13 @@ Iconv is skipped altogether and only Sma readPos := self bufferSize - (bytesLeft at: 1). recodedEnd := self bufferSize - (bytesLeft at: 2). recodedPos := 1. - fine - ifFalse: - [InvalidSequenceError signal. - ^false]. - self atEndOfInput ifFalse: [^true]. - readPos > readEnd - ifTrue: [readBuffer := nil] - ifFalse: [IncompleteSequenceError signal]. - ^false + fine ifFalse: [InvalidSequenceError signal. ^true]. + self atEndOfInput ifFalse: [^false]. + + "At end of input, check whether the last character was complete." + readBuffer := nil. + readPos <= readEnd ifTrue: [IncompleteSequenceError signal. ^true]. + ^recodedEnd = 0 ] ] --- orig/packages/iconv/iconvtests.st +++ mod/packages/iconv/iconvtests.st @@ -115,7 +115,8 @@ TestCase subclass: IconvTest [ str := #[239 191 190] asString. self assert: (str asUnicodeString: 'UTF-8') first = $<16rFFFE>. str := #[208 184] asString. - self assert: (str asUnicodeString: 'UTF-8') first = $<16r0438> + self assert: (str asUnicodeString: 'UTF-8') first = $<16r0438>. + self assert: ('' asUnicodeString: 'UTF-8') isEmpty ] testByteArrayAsUnicodeStringColon [ @@ -127,7 +128,8 @@ TestCase subclass: IconvTest [ str := #[239 191 190]. self assert: (str asUnicodeString: 'UTF-8') first = $<16rFFFE>. str := #[208 184]. - self assert: (str asUnicodeString: 'UTF-8') first = $<16r0438> + self assert: (str asUnicodeString: 'UTF-8') first = $<16r0438>. + self assert: (#[] asUnicodeString: 'UTF-8') isEmpty ] testFromUTF7 [