Giter VIP home page Giter VIP logo

Comments (3)

dim13 avatar dim13 commented on May 30, 2024

This is actually desired behaviour.

For non-zero-terminated data, trailing zero is implied. See "COBS Syntax and Semantics" in documentation. Corollary there is no way to distinguish between implied and actual trailing zero in actual data while decoding.

Resulting encoded data shall have all zeros eliminated. See "COBS Syntax and Semantics" again. Zero value in encoded data is illegal. See Table 1.

If you need your encoded data to be zero-terminated (as meta-framing), feel free to append it after encoding.

PS: I would love to hear your use-case, and why you think trailing zero must be a part of encoded message.

from cobs.

torbWaterLinked avatar torbWaterLinked commented on May 30, 2024

As a zero-terminated byte array is desired. I do propose that you return an error if it isn't zero terminated. As it stands now adding a zero will change the byte array inputted and a decoding of the encoded byte array won't return the correct byte array. We will change our code to accommodate it, but I still think it's prudent to change it to return an error when the input isn't properly formatted.

from cobs.

pdgendt avatar pdgendt commented on May 30, 2024

Bumped into this issue after spending a lot of time... IMO encoding shouldn't care about what is passed (NULL-terminated or not), and Decode should produce the output as was passed to Encode.

I've created my own version: https://github.com/pdgendt/cobs

from cobs.

Related Issues (1)

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.