Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try fixing deprecation warning on libjson 1.8.4 while using Json::Reader #8

Conversation

rodolfobandeira
Copy link
Owner

@rodolfobandeira rodolfobandeira commented Oct 2, 2018

Scenario: MacOS and libjson installed via homebrew.

./compile.sh
Starting compilation
Done

./main AMZN
[1]    45387 segmentation fault  ./main AMZN

brew list --versions jsoncpp

jsoncpp 1.8.4

There is no deprecation warnings on my Linux. This is the version running there:

dpkg -s libjsoncpp-dev | grep Version
Version: 1.7.4-3

@rodolfobandeira rodolfobandeira added the help wanted Extra attention is needed label Oct 2, 2018
@mpherg
Copy link
Collaborator

mpherg commented Oct 2, 2018

I'll pull this down and give it a go.

Json::parseFromStream(jsonReader, httpData, &jsonData, &errs);
std::stringstream ss;
ss.str(*httpData);
ss >> jsonData;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rodolfobandeira this is the magic -- JsonCpp has implemented the extraction operator to pull from a stream directly into a Json::Value object, so no need for magical builder and stream parsing logic.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mpherg perfect shot! I just compiled here and both versions 1.7* and 1.8* works. You're killing! I'm gonna merge it and take a look on your other PRs. Thank you very much!

@mpherg
Copy link
Collaborator

mpherg commented Oct 3, 2018

This should be fixed now. Verified on MacOS, Ubuntu 16.04, Ubuntu 18.04, and CentOS 7.

@mpherg
Copy link
Collaborator

mpherg commented Oct 3, 2018

I also ran this through Valgrind to ensure there aren't any memory problems with this implementation. It did find one thing, but it is a known (fixed) issue with nullSingleton in JsonCpp.

@rodolfobandeira
Copy link
Owner Author

close #10

@rodolfobandeira rodolfobandeira merged commit 058da8c into master Oct 3, 2018
@rodolfobandeira rodolfobandeira deleted the fix-deprecation-warning-for-json_reader-on-libjson-1_8_4 branch October 3, 2018 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants