[tarantool-patches] [PATCH v2 2/8] decimal: fix encoding numbers with positive exponent.

Konstantin Osipov kostja at tarantool.org
Thu Aug 15 01:21:10 MSK 2019


* Serge Petrenko <sergepetrenko at tarantool.org> [19/08/13 12:03]:
> Similar code is already used in
> mp_encode_extl/mp_decode_extl()
> (yes, it was also introduced by me, but it passed the review):
> 
> (the type of ’type’ is int8_t)
>          data = mp_store_u8(data, type);
>>          *type = mp_load_u8(data);

The problem with this approach is that you lost sign in your
storage representation. Imagine this data format is read by a code
which is different from the one you wrote, and relies on msgpack
format specifiers alone. It will honestly believe that the value
is always positive.

Basically, you should follow MsgPack guidelines for choosing
format specifiers.


-- 
Konstantin Osipov, Moscow, Russia



More information about the Tarantool-patches mailing list