[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: buffer\datum questions
From: |
Olya |
Subject: |
Re: buffer\datum questions |
Date: |
Thu, 02 Aug 2012 16:20:49 +0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 |
02.08.2012 15:10, Nikos Mavrogiannopoulos пишет:
>> Or it's the length value against which the remainder will be checked?
>> Are there similar functions for 16 bits? 8 bits? etc.
>
> No. But we can make this more general if you need it.
That would be great. How about:
_gnutls_buffer_pop_prefix (gnutls_buffer_st * buf, size_t * data_size, int
check,
uint8_t pfx_len = 32);
Or should we use "bool check" to make it more obvious?
>>>> 2) Do I have to pre-allocate memory for the datum, copy my data to datum,
>>>> call
>>>> _replace() and deallocate datum? Could you give simple example of
>>>> _replace() usage?
>>> The replace, will copy the datum you provide (already allocated) to the
>>> buffer.
>> So the expected call sequence is:
>> _gnutls_set_datum (&dat, data, data_size);
>
> Use set_datum() only if you want to copy(duplicate) the data you have
> into the datum. Otherwise just assign the values (datum->data,
> datum->size) to the needed one.
If I'm trying to use datum->data I've got to drop const qualifier from "const
void *
data" parameter. Right now I'm not sure if I should copy data or not.
thanks,
Olga.