scott@erick.gac.edu (Scott Hess) (02/19/91)
I've got a question about custom NXStreams. Namely, how to do them? I've got one that semi-works - except that the first block is read twice. My simple test program just reads the stream and writes the output to stdout, and I end up with the first block of 16k duplicated. All the other blocks work fine, and end of stream is detected fine. I went in with gdb and verified that my fill_buffer function is really getting called twice for the first block. In that method (it's a read-only, non-seekable stream at this point, so that's really the only important one) I really don't do much - I simply fill the buffer from the position indicated by the stream's (let's call it s) offset (as given by s->offset), filling the buffer with s->buf_size bytes of data. I do not modify any of the stream internals, though my s->info _may_ be modified (I don't use it to influence where I'm reading from, or anything, just as a pointer to the info I'm 'streaming'). The creating function is similarily simple. I use NXStreamCreateFromZone( NX_READONLY, 1, aZone) to create it, zone-malloc my info structure, and set my functions, leaving everything else alone. I've mailed this question to NextAnswers, along with code demoing the problem (which I didn't post with this message so as not to overload the net . . . availiable on request, though - remember, it doesn't work, so don't request it if you can't help). My problem is I've found that this puts a halt to three of the projects I'm working on, as they all need this functionality, and the future of all will be affected by whether I can get it to work or not - unfortunately, in different ways, so even if I started alternate routes for one of them, the others still need it. Usually, I just work on a different project until the answer comes through, but I hesitate to start yet _another_ project . . . So, I'm asking for some faster answers, if anyone's got them. Hey, I'd do it for you . . . Thanks alot, -- scott hess scott@gac.edu Independent NeXT Developer GAC Undergrad <I still speak for nobody> "Tried anarchy, once. Found it had too many constraints . . ." "Buy `Sweat 'n wit '2 Live Crew'`, a new weight loss program by Richard Simmons . . ."