[Pharo-project] Bug in FileSystem
FSReadStream >> next: count | result | result := ByteArray new: count. handle at: position read: result startingAt: 1 count: count. position := position + 1. ^ result shouldn't be FSReadStream >> next: count | result | result := ByteArray new: count. handle at: position read: result startingAt: 1 count: count. position := position + count. ^ result At least with that (among some extensions) Fuel tests pass with FS :) Cheers -- Mariano http://marianopeck.wordpress.com
sounds like :) Stef On Jan 7, 2012, at 1:10 PM, Mariano Martinez Peck wrote:
FSReadStream >> next: count | result | result := ByteArray new: count. handle at: position read: result startingAt: 1 count: count. position := position + 1. ^ result
shouldn't be
FSReadStream >> next: count | result | result := ByteArray new: count. handle at: position read: result startingAt: 1 count: count. position := position + count. ^ result
At least with that (among some extensions) Fuel tests pass with FS :)
Cheers
-- Mariano http://marianopeck.wordpress.com
On 07.01.2012 13:20, Stéphane Ducasse wrote:
sounds like :)
Stef
On Jan 7, 2012, at 1:10 PM, Mariano Martinez Peck wrote:
FSReadStream>> next: count | result | result := ByteArray new: count. handle at: position read: result startingAt: 1 count: count. position := position + 1. ^ result
shouldn't be
FSReadStream>> next: count | result | result := ByteArray new: count. handle at: position read: result startingAt: 1 count: count. position := position + count. ^ result
At least with that (among some extensions) Fuel tests pass with FS :)
Cheers
-- Mariano http://marianopeck.wordpress.com
Still wrong though, I think... It doesn't handle the case where you try to read past end of stream. next: count ^self nextInto: (ByteArray new: count) would probably be better. Cheers, Henry
On Sat, Jan 7, 2012 at 2:05 PM, Henrik Sperre Johansen < henrik.s.johansen@veloxit.no> wrote:
On 07.01.2012 13:20, Stéphane Ducasse wrote:
sounds like :)
Stef
On Jan 7, 2012, at 1:10 PM, Mariano Martinez Peck wrote:
FSReadStream>> next: count
| result | result := ByteArray new: count. handle at: position read: result startingAt: 1 count: count. position := position + 1. ^ result
shouldn't be
FSReadStream>> next: count | result | result := ByteArray new: count. handle at: position read: result startingAt: 1 count: count. position := position + count. ^ result
At least with that (among some extensions) Fuel tests pass with FS :)
Cheers
-- Mariano http://marianopeck.wordpress.**com <http://marianopeck.wordpress.com>
Still wrong though, I think... It doesn't handle the case where you try to read past end of stream.
next: count ^self nextInto: (ByteArray new: count)
would probably be better.
Indeed.
Cheers, Henry
-- Mariano http://marianopeck.wordpress.com
But what if count makes handle pass over the end of the file? -- Cesar Rabak Em 07/01/2012 10:10, Mariano Martinez Peck < marianopeck@gmail.com > escreveu: FSReadStream >> next: count | result | result := ByteArray new: count. handle at: position read: result startingAt: 1 count: count. position := position + 1. ^ result shouldn't be FSReadStream >> next: count | result | result := ByteArray new: count. handle at: position read: result startingAt: 1 count: count. position := position + count. ^ result At least with that (among some extensions) Fuel tests pass with FS :) Cheers -- Mariano http://marianopeck.wordpress.com
participants (4)
-
csrabak@bol.com.br -
Henrik Sperre Johansen -
Mariano Martinez Peck -
Stéphane Ducasse