Ticket #198 (closed defect)

Opened 15 years ago

Last modified 15 years ago

file position doesn't get updated correctly for string type

Reported by: steve.erhart@… Owned by: williams
Priority: major Milestone:
Component: williams/packed-binary.plt Keywords:
Cc: Version: (1 1)
Racket Version: 4.2.1

Description

> (define test (open-input-file "testing.mp3"))
> (file-position test (- (file-size "testing.mp3") 128))
(read-packed "3s30s30s30s4s28sBBB" test)
("TAG"
 "AGSeeing the Dark\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
 "GSeeing the Dark\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
 "Seeing the Dark\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
 "eein"
 "eing the Dark\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
 105
 110
 103)

I browsed through your code and I think I found the culprit at line 403. Changing

(set! offset (+ offset size)))

to

(set! offset (+ offset count)))

seemes to do the trick.

(read-packed "3s30s30s30s4s28sBBB" test)
("TAG"
 "Seeing the Dark\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
 "Zoroaster\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
 "Voice of Saturn\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
 "2009"
 "BLAH BLAH BLAH BLAH BLAH BLA"
 0
 1
 9)

Change History

Changed 15 years ago by williams

  • status changed from new to accepted

Changed 15 years ago by williams

  • status changed from accepted to closed

Fixed and released to PLaneT Version 1.2.

Note: See TracTickets for help on using tickets.