Hello Hyune

If you get CborErrorOutOfMemory, reallocate your buffer and restart the 
CborEncoder.

On Friday 07 August 2015 05:32:38 ??? wrote:
> Hi Erich, Thiago
>  
> I'm working to enable blockwise-transfer in RI layer.
> In my understanding, currently RI layer allocates memory for payload before
> CBOR encoding. *outPayload = (uint8_t*)OICCalloc(1, MAX_REQUEST_LENGTH);
>     *size = MAX_REQUEST_LENGTH;
> RI always allocate 1024 bytes memory. and re-allocate actual consumed size
> after encoding. By using cbor_encoder_init() function, CborEncoder object
> manage the allocated memory address and then start CBOR encoding. If
> encoder->ptr + len is bigger than encoder->end in the encoding process,
> returns the CborErrorOutOfMemory. but i have a question about this.
> if the maximum size of the payload is not 1024 bytes and there is no size
> restriction, We have no way of knowing the size information before
> encoding. so we cannot allocate memory for payload in advance. accordingly,
> we are unable to create CborEncoder object.
> because we have to call cbor_encoder_init() function by using size
> parameter. I have a problem enabling blockwise-transfer in RI layer because
> of this issue. Can you suggest any solution for this problem?
> I'm not totally understanding RI layer. please tell me if I misunderstood.
> 
> Regards,
> Hyuna Jo
> 
>  

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

Reply via email to