Hi all,

I'm working on a protocol plugin and I would like to marshall a response 
directly into a TSIOBuffer. AFAICT the right way to do this is roughly:

        TSIOBuffer buffer;
        TSIOBufferBlock blk;
        char * ptr;
        size_t avail;
        size_t total;

        blk = TSIOBufferStart(buffer);
        do {
                ptr = TSIOBufferBlockWriteStart(blk, &avail);
                // (1) marshall up to avail into ptr
                …
                total += avail;
                blk = TSIOBufferBlockNext(blk);
        } while (!finished);

        // make the written data visible
        TSIOBufferProduce(buffer, total);

AFAICT, TSIOBufferProduce() assumes that all the intermediate buffer blocks are 
completely filled. This means that if the space available at (1) is some 
inconvenient size, then I might have to handle splitting a uint32_t across the 
buffer block boundary.

Is there a way to set the buffer block's end pointer so that I can build a 
buffer containing partially filled blocks?

thanks,
James

Reply via email to