Skip to content

Commit

Permalink
Merge pull request #12 from svenvc/master
Browse files Browse the repository at this point in the history
Update zinc: fix edge case in ZnUTF8Encoder>>#ensureAtBeginOfCodePointOnStream:
  • Loading branch information
svenvc committed Jan 16, 2024
2 parents d0c2983 + 0ad0a6d commit 6895413
Show file tree
Hide file tree
Showing 20 changed files with 101 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*Zinc-Character-Encoding-Core
rawStream
"Answer the innermost stream wrapped by the receiver, e.g. a raw binary file stream,
socket stream, or regular Read/WriteStream.
Since this the base stream, answer ourself."

^ self
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*Zinc-Character-Encoding-Core
wrappedStream
"Answer the stream that the receiver wraps.
Since this the base stream, answer nil"

^ nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "SocketStream"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*Zinc-Character-Encoding-Core
rawStream
"Answer the innermost stream wrapped by the receiver, e.g. a raw binary file stream,
socket stream, or regular Read/WriteStream.
Since this the base stream, answer ourself."

^ self
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*Zinc-Character-Encoding-Core
wrappedStream
"Answer the stream that the receiver wraps.
Since this the base stream, answer nil"

^ nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "Stream"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
accessing
rawStream
"Answer the innermost stream wrapped by the receiver, e.g. a raw binary file stream,
socket stream, or regular Read/WriteStream.
Defer to the wrappedStream."

^ self wrappedStream rawStream
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
accessing
rawStream
"Answer the innermost stream wrapped by the receiver, e.g. a raw binary file stream,
socket stream, or regular Read/WriteStream.
Defer to the wrappedStream."

^ self wrappedStream rawStream
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
initialize-release
rawStream
"Answer the innermost stream wrapped by the receiver, e.g. a raw binary file stream,
socket stream, or regular Read/WriteStream.
Defer to the wrappedStream."

^ self wrappedStream rawStream
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
initialize-release
wrappedStream

^ stream
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
accessing
rawStream
"Answer the innermost stream wrapped by the receiver, e.g. a raw binary file stream,
socket stream, or regular Read/WriteStream.
Defer to the wrappedStream."

^ self wrappedStream rawStream
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
accessing
rawStream
"Answer the innermost stream wrapped by the receiver, e.g. a raw binary file stream,
socket stream, or regular Read/WriteStream.
Defer to the wrappedStream."

^ self wrappedStream rawStream
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
accessing
rawStream
"Answer the innermost stream wrapped by the receiver, e.g. a raw binary file stream,
socket stream, or regular Read/WriteStream.
Defer to the wrappedStream."

^ self wrappedStream rawStream
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ ensureAtBeginOfCodePointOnStream: stream
if not move further backwards. This is necessary when a position in the binary stream is set,
not knowing if that position is on a proper encoded character boundary."

"If we are at end-of-stream, we can't be in the middle of an encoded codepoint
(unless that codepoint is incomplete and thus invalid, which we won't worry about)"
stream atEnd ifTrue: [ ^ self ].
"Back up until we are not longer on a continuation byte but on a leading byte"

[ (stream peek bitAnd: 2r11000000) == 2r10000000 ] whileTrue: [ stream back ]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SystemOrganization addCategory: #'Zinc-Character-Encoding-Core'!
self packageOrganizer ensurePackage: #'Zinc-Character-Encoding-Core' withTags: #()!
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ testUTF8ReadStreamPositioning
stream position: 5.
self assert: stream next equals: $v.
stream position: 6.
self assert: stream next equals: $e
self assert: stream next equals: $e.
stream position: 7.
self assert: stream atEnd.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SystemOrganization addCategory: #'Zinc-Character-Encoding-Tests'!
self packageOrganizer ensurePackage: #'Zinc-Character-Encoding-Tests' withTags: #()!
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
accessing
rawStream
"Answer the innermost stream wrapped by the receiver, e.g. a raw binary file stream,
socket stream, or regular Read/WriteStream.
Defer to the wrappedStream."

^ self wrappedStream rawStream
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
accessing
rawStream
"Answer the innermost stream wrapped by the receiver, e.g. a raw binary file stream,
socket stream, or regular Read/WriteStream.
Defer to the wrappedStream."

^ self wrappedStream rawStream
9 changes: 1 addition & 8 deletions repository/Zinc-HTTP.package/monticello.meta/categories.st
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
SystemOrganization addCategory: #'Zinc-HTTP'!
SystemOrganization addCategory: #'Zinc-HTTP-Client-Server'!
SystemOrganization addCategory: #'Zinc-HTTP-Core'!
SystemOrganization addCategory: #'Zinc-HTTP-Exceptions'!
SystemOrganization addCategory: #'Zinc-HTTP-Logging'!
SystemOrganization addCategory: #'Zinc-HTTP-Streaming'!
SystemOrganization addCategory: #'Zinc-HTTP-Support'!
SystemOrganization addCategory: #'Zinc-HTTP-Variables'!
self packageOrganizer ensurePackage: #'Zinc-HTTP' withTags: #(#'Client-Server' #Core #Exceptions #Logging #Streaming #Support #Variables)!

0 comments on commit 6895413

Please sign in to comment.