naphaso / cbor-cpp Goto Github PK
View Code? Open in Web Editor NEWCBOR C++ serialization library
CBOR C++ serialization library
This is CBOR byte stream I've used to test different types and values. I found problems with negative integer values < -16 and also not supported types boolean and null. For the latters there is awaiting pull request.
B4 63 70 31 36 10 63 75 6E 69 76 E9 80 9A E8 A8
8A E9 80 A3 E6 8E A5 E5 9F A0 20 28 43 4F 4D 31
29 62 6E 31 20 65 61 73 63 69 69 65 68 65 6C 6C
6F 63 6E 69 6C F6 69 65 6D 70 74 79 5F 61 72 72
80 66 70 36 35 35 33 35 19 FF FF 63 62 69 6E 43
31 32 55 63 6E 32 47 3A 7F FF FF FF 62 70 31 01
66 6E 36 35 35 33 35 39 FF FE 63 6E 31 36 2F 64
7A 65 72 6F 00 63 61 72 72 83 01 02 03 63 6F 62
6A A1 63 66 6F 6F 63 62 61 72 66 62 66 61 6C 73
65 F4 64 70 32 35 35 18 FF 63 70 32 47 1A 80 00
00 00 64 6E 32 35 35 38 FE 65 62 74 72 75 65 F5
It's easy to test what should be decoded on site http://cbor.me/
Trying to compile your library under Visual Studio - I was forced to change your log.h to use just plain __FUNCTION__
macro instead of __PRETTY_FUNCTION__
.
Search on MSDN revealed this: https://social.msdn.microsoft.com/Forums/vstudio/en-US/02c69018-a182-48b3-94d1-250252aa00a7/prettyfunction?forum=vclanguage
data
Could you add a license to this project to clarify where it can be used?
We're thinking of using this in a project but need to know the licensing terms.
There are some memory issues in decoder.run() according to valgrind/memcheck. I looked at the decoder source and spotted two new unsigned char[_currentLength] statements (for string and bytes) that are not freed. The char array for std::string copies the data twice which would not be necessary (e.g. add a _in->get_string(str,_currentLength), for a byte array it is probably best freed after calling listener.on_bytes(), returning a const pointer within cbor_input memory may be a bit dangerous.
I tested "delete data" after calling the listener callback in decoder.cpp (i.e. after _listener->on_bytes and _listener->on_string), and this resolved the memory leak for both cases.
Reducing copying of input data may bring the CBOR-cpp performance closer to BSONcxx (some early performance tests show about 9% speed difference for the same JSON data { "postcode":10000, "temperature":27, "relhumidity":35 } received over zeromq and averaging the temperature of 100000 messages like in the zeromq weather service example).
There's missing put_byte in void encoder::write_type_value(int major_type, unsigned long long value), so int64 output is incorrect.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.