GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — convert between msgpack and json via cJSON library by ygj6 · Pull Request #870 · msgpack/msgpack-c

Conversation

@ygj6

@ygj6 ygj6 commented May 14, 2020

Copy link
Copy Markdown
Collaborator
  • Pack json string to msgpack format data.
    int msgpack_pack_jsonstr(msgpack_packer *pk, const char *jsonstr)

  • Convert msgpack format data to json string.
    int msgpack_object_print_jsonstr(char *buffer, size_t length, const msgpack_object o)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@codecov-io

codecov-io commented May 14, 2020

Copy link
Copy Markdown

Codecov Report

Merging #870 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #870   +/-   ##
=======================================
  Coverage   81.16%   81.16%           
=======================================
  Files          86       86           
  Lines        6419     6419           
=======================================
  Hits         5210     5210           
  Misses       1209     1209           
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ygj6
ygj6 force-pushed the json branch from d303a35 to e78713a Compare May 15, 2020 06:44
@redboltz

redboltz commented May 23, 2020

Copy link
Copy Markdown
Contributor

It seems that you added not only json example for C but also some convenient functions.
I think that they are nice to have.
I'm not familiar with the word "intact". I've checked it using dictionary and understand it.
Do you have any other candidate words for that ?
If "intact" is the best one, I apply it. (I'm not a native English speaker:)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@redboltz

redboltz commented May 23, 2020

Copy link
Copy Markdown
Contributor

I think that msgpack_pack_str_with_body could be a better name. Because msgpack_pack_str is used for packing STR header and msgpack_pack_str_body is used for packing STR body. The newly introduced function is both STR header and body. The name msgpack_pack_str_with_body mean that directly.
What do you think?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ygj6

ygj6 commented May 24, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator Author

I have another idea:

msgpack_pack_str() => msgpack_pack_str_head()
msgpack_pack_str_body() => msgpack_pack_str_body()
msgpack_pack_str_intact() => msgpack_pack_str()/msgpack_pack_str_with_body()/msgpack_pack_str_easy()/...

bin, ext are the same as str.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@redboltz

redboltz commented May 24, 2020

Copy link
Copy Markdown
Contributor

If I design the API from the scratch, the following functions are better as you mentioned.
Personally, I don't like easy it is too subjective word for me ;) .

msgpack_pack_str() => msgpack_pack_str_head()/msgpack_pack_str_header()
msgpack_pack_str_body() => msgpack_pack_str_body()
msgpack_pack_str_intact() => msgpack_pack_str()

However, I want to avoid breaking change because it require code updating to many users.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ygj6

ygj6 commented May 24, 2020

Copy link
Copy Markdown
Collaborator Author

Indeed, msgpack_pack_str() is an old funtion, changing it will cause ABI to be incompatible with previous versions. Maybe we can change it in a major version upgrade in the future.

Now I'll use msgpack_pack_str_with_body().

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ygj6
convert between msgpack and json
403567c
@ygj6
ygj6 force-pushed the json branch from e78713a to 403567c Compare May 24, 2020 09:25
@codecov-commenter

codecov-commenter commented May 24, 2020

Copy link
Copy Markdown

Codecov Report

Merging #870 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #870   +/-   ##
=======================================
  Coverage   81.16%   81.16%           
=======================================
  Files          86       86           
  Lines        6419     6419           
=======================================
  Hits         5210     5210           
  Misses       1209     1209           
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@redboltz

redboltz commented May 24, 2020

Copy link
Copy Markdown
Contributor

Thank you for understanding and updating the code.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@redboltz
redboltz merged commit 766afb9 into msgpack:master May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@ygj6 @codecov-io @redboltz @codecov-commenter
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.