From 19dbf9e000122281fcd174528111f318956e1942 Mon Sep 17 00:00:00 2001 From: Sven Van Caekenberghe Date: Thu, 28 Sep 2023 16:41:45 +0200 Subject: [PATCH] Add guard to skip: to report negative count --- .../ZnBufferedReadStream.class/instance/skip..st | 1 + .../ZnBufferedReadWriteStream.class/instance/skip..st | 2 +- .../ZnCharacterReadWriteStream.class/instance/skip..st | 2 +- .../ZnEncodedReadStream.class/instance/skip..st | 1 + .../ZnChunkedReadStream.class/instance/skip..st | 1 + .../ZnLimitedReadStream.class/instance/skip..st | 1 + 6 files changed, 6 insertions(+), 2 deletions(-) diff --git a/repository/Zinc-Character-Encoding-Core.package/ZnBufferedReadStream.class/instance/skip..st b/repository/Zinc-Character-Encoding-Core.package/ZnBufferedReadStream.class/instance/skip..st index 95573506..dc234020 100644 --- a/repository/Zinc-Character-Encoding-Core.package/ZnBufferedReadStream.class/instance/skip..st +++ b/repository/Zinc-Character-Encoding-Core.package/ZnBufferedReadStream.class/instance/skip..st @@ -3,4 +3,5 @@ skip: count "Skip over count elements. This could be further optimzed." + count < 0 ifTrue: [ self error: 'cannot skip backwards' ]. count timesRepeat: [ self next ] \ No newline at end of file diff --git a/repository/Zinc-Character-Encoding-Core.package/ZnBufferedReadWriteStream.class/instance/skip..st b/repository/Zinc-Character-Encoding-Core.package/ZnBufferedReadWriteStream.class/instance/skip..st index 10848a7a..1c1271a3 100644 --- a/repository/Zinc-Character-Encoding-Core.package/ZnBufferedReadWriteStream.class/instance/skip..st +++ b/repository/Zinc-Character-Encoding-Core.package/ZnBufferedReadWriteStream.class/instance/skip..st @@ -1,5 +1,5 @@ accessing skip: anInteger - + anInteger < 0 ifTrue: [ self error: 'cannot skip backwards' ]. self readingActionDo: [ readStream skip: anInteger ] \ No newline at end of file diff --git a/repository/Zinc-Character-Encoding-Core.package/ZnCharacterReadWriteStream.class/instance/skip..st b/repository/Zinc-Character-Encoding-Core.package/ZnCharacterReadWriteStream.class/instance/skip..st index b1ec24be..3ca03ec2 100644 --- a/repository/Zinc-Character-Encoding-Core.package/ZnCharacterReadWriteStream.class/instance/skip..st +++ b/repository/Zinc-Character-Encoding-Core.package/ZnCharacterReadWriteStream.class/instance/skip..st @@ -1,4 +1,4 @@ accessing skip: anInteger - + anInteger < 0 ifTrue: [ self error: 'cannot skip backwards' ]. readStream skip: anInteger \ No newline at end of file diff --git a/repository/Zinc-Character-Encoding-Core.package/ZnEncodedReadStream.class/instance/skip..st b/repository/Zinc-Character-Encoding-Core.package/ZnEncodedReadStream.class/instance/skip..st index 352fb623..2d1aa4aa 100644 --- a/repository/Zinc-Character-Encoding-Core.package/ZnEncodedReadStream.class/instance/skip..st +++ b/repository/Zinc-Character-Encoding-Core.package/ZnEncodedReadStream.class/instance/skip..st @@ -1,3 +1,4 @@ accessing skip: count + count < 0 ifTrue: [ self error: 'cannot skip backwards' ]. count timesRepeat: [ self next ] \ No newline at end of file diff --git a/repository/Zinc-HTTP.package/ZnChunkedReadStream.class/instance/skip..st b/repository/Zinc-HTTP.package/ZnChunkedReadStream.class/instance/skip..st index 352fb623..2d1aa4aa 100644 --- a/repository/Zinc-HTTP.package/ZnChunkedReadStream.class/instance/skip..st +++ b/repository/Zinc-HTTP.package/ZnChunkedReadStream.class/instance/skip..st @@ -1,3 +1,4 @@ accessing skip: count + count < 0 ifTrue: [ self error: 'cannot skip backwards' ]. count timesRepeat: [ self next ] \ No newline at end of file diff --git a/repository/Zinc-HTTP.package/ZnLimitedReadStream.class/instance/skip..st b/repository/Zinc-HTTP.package/ZnLimitedReadStream.class/instance/skip..st index 352fb623..2d1aa4aa 100644 --- a/repository/Zinc-HTTP.package/ZnLimitedReadStream.class/instance/skip..st +++ b/repository/Zinc-HTTP.package/ZnLimitedReadStream.class/instance/skip..st @@ -1,3 +1,4 @@ accessing skip: count + count < 0 ifTrue: [ self error: 'cannot skip backwards' ]. count timesRepeat: [ self next ] \ No newline at end of file