Ticket #198 (closed defect)
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
Note: See
TracTickets for help on using
tickets.
