Coder Social home page Coder Social logo

cbor-cpp's People

Contributors

gitter-badger avatar jspark311 avatar magjohansson avatar naphaso avatar sylvestre avatar yperbasis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cbor-cpp's Issues

memory issues with the decoder

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).

License needed

We're thinking of using this in a project but need to know the licensing terms.

Wrong decoding of negative numbers and no support for boolean and null values

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/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.