Yep, thanks Thiago.  That is the situation where we use err = err | vs
err = err ||, since that is the only error code we are capable of
recovering from.


On Fri, 2015-10-23 at 10:47 -0700, Thiago Macieira wrote:
> On Friday 23 October 2015 17:41:12 Keane, Erich wrote:
> > The err = err | <cbor function> is only used in a few places where
> > knowing the error afterwards is important, for most situations, the
> > error code is pretty meaningless since there is nothing we can do about
> > it.
> 
> To be clear: there's only one error code that is important here and that's 
> the 
> "buffer is too short" when encoding the data. TinyCBOR has that in a special 
> bit that no other error code will set, so it's guaranteed to work. 
> 
> Moreover, you *can* continue streaming data after you got such an error and 
> TinyCBOR will then simply count how many bytes it needs, instead of encoding. 
> At the end, you can allocate the buffer of the size that TinyCBOR says it 
> should be and encoding should work (provided you have the same data, of 
> course).
> 

Reply via email to