Git Product home page Git Product logo

Comments (7)

yfakariya avatar yfakariya commented on July 18, 2024

Thank you for your feedback.

I don't know C++ implementation very well, and there are some possibilities to fail deserialization.
Would you upload serialized binary ("test.test") file?
Or, would you tell me the result of following?

FileStream fs = new FileStream("E:\\test.test", FileMode.Open, FileAccess.Read);
byte[] buf = new byte[fs.Length];
fs.Read(buf, 0, buf.Length);
Console.WriteLine(BitConverter.ToString(buf));

from msgpack-cli.

sebjf avatar sebjf commented on July 18, 2024

Hello yfakariya,

Here is the content of test.test extracted exactly as you specified above:

91-9A-0D-0A-0D-0A-0D-0A-0D-0A-0D-0A-0D-0A-0D-0A-0D-0A-0D-0A-0D-0A

(Windows confirms the file is 22 bytes in length)

from msgpack-cli.

yfakariya avatar yfakariya commented on July 18, 2024

Thank you sebjf.

I wonder why C++ serializer puts 0x0D in the stream. It looks like just tiny integer value 13, not any header value.
I think the serialized value should be:
91-9A-0A-0A-0A-0A-0A-0A-0A-0A-0A-0A
(12bytes)

MessagePack CLI's unpacker interprets the C++ generated binary as following:

1 element array
  10 elements array, its values are 13, 10...
Extra 10 bytes(13,10,...)

I believe 0x0D after 0x9A represents integer value 13, so I will ask C++ implementers to why msgpack-c outs such values.
Would you tell me what version msgpack-C do you use?

from msgpack-cli.

sebjf avatar sebjf commented on July 18, 2024

I use 0.5.4, the same one as available here: http://sourceforge.net/projects/msgpack/files/msgpack/cpp/

Thank you for MessagePack - I was very impressed when looking through the CLI source investigating this bug, this project is quite a feat!

from msgpack-cli.

iwadon avatar iwadon commented on July 18, 2024

@sebjf

   myFile.open("E:\\test.test");

This opens a file with text mode. Then 0x0a (LF) is converted to 0x0d 0x0a (CR LF).

You can correct your code:

   myFile.open("E:\\test.test", std::ios_base::binary);

from msgpack-cli.

sebjf avatar sebjf commented on July 18, 2024

Ah. Yes. Thank you iwadon! And sorry about the erronous issue.

from msgpack-cli.

yfakariya avatar yfakariya commented on July 18, 2024

@iwadon Thank you for your great post!

from msgpack-cli.

Related Issues (20)

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.