From: Russell M. <rus...@ya...> - 2005-07-27 13:26:25
|
Christophe Rhodes <cs...@ca...> writes: > Russell McManus <rus...@ya...> writes: > >> Any size other than 512 fails as above. Is this intended behavior? > > I think so. Well, I think you're falling into a trap that's been > (unintentionally) laid for you, lurking for months if not years. > > I would suggest using sb-sys:read-n-bytes on a byte stream, not a > character stream, and converting the octets you get from reading them > into a string using octets-to-string. The SBCL internal machinery is > such that it never calls sb-sys:read-n-bytes on a character stream > directly, I believe, but we don't detect violations -- and before the > implementation of Unicode, this didn't matter because strings and > (unsigned-byte 8) vectors had identical memory layout. > > I don't know if this solves your actual problem, but if you can rework > the I/O layer to use octets, I think that's more likely to work. Thanks for the help. I'm writing an NNTP server. Perhaps I'll try to write a better doc string for the function based on your comments above and send it to the list, to help the next swedish chef who comes along thinking that he can blindly port code from cmucl to sbcl... Should read-n-bytes signal an error condition when given the wrong type of stream? -russ |