> - buffer_put_string(&msg, blob, blen); > - buffer_put_string(&msg, data, datalen); > + buffer_put_binary(&msg, blob, blen); > + buffer_put_binary(&msg, data, datalen); wouldn't it be easier to treat all buffer_put_string as binary and do conversion only in buffer_put_cstring ?