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

json_object_object_get is deprecated with libjson >= 0.10 #72

Closed
devZer0 opened this issue Dec 23, 2014 · 7 comments
Closed

json_object_object_get is deprecated with libjson >= 0.10 #72

devZer0 opened this issue Dec 23, 2014 · 7 comments

Comments

@devZer0
Copy link

devZer0 commented Dec 23, 2014

i´m getting several of these compile warnings (below). it seems, with more recent json libs one should now use json_object_object_get_ex() instead

according to the json changelog, this was introduced with 0.10

https://github.com/json-c/json-c/blob/master/ChangeLog:

0.10
Add json_object_object_get_ex(), a NULL-safe get object method, to be able
to distinguish between a key not present and the value being NULL.

since libjson 0.10 release is dated 2,5yrs back, i´d curious if it`s a problem to change this and bump vzlogger libjson requirement from 0.9 to 0.10

api/MySmartGrid.cpp: In member function ‘void vz::api::MySmartGrid::api_parse_exception(char*, size_t)’:
api/MySmartGrid.cpp:335:34: warning: ‘json_object* json_object_object_get(json_object*, const char*)’ is deprecated (declared at /usr/include/json/json_object.h:217) [-Wdeprecated-declarations]
   struct json_object *json_obj = json_object_object_get(json_obj_in, "exception");
                  ^
api/MySmartGrid.cpp:335:81: warning: ‘json_object* json_object_object_get(json_object*, const char*)’ is deprecated (declared at /usr/include/json/json_object.h:217) [-Wdeprecated-declarations]
   struct json_object *json_obj = json_object_object_get(json_obj_in, "exception");
                                         ^
api/MySmartGrid.cpp:339:32: warning: ‘json_object* json_object_object_get(json_object*, const char*)’ is deprecated (declared at /usr/include/json/json_object.h:217) [-Wdeprecated-declarations]
     json_object_get_string(json_object_object_get(json_obj,  "type")),
                ^
api/MySmartGrid.cpp:339:72: warning: ‘json_object* json_object_object_get(json_object*, const char*)’ is deprecated (declared at /usr/include/json/json_object.h:217) [-Wdeprecated-declarations]
     json_object_get_string(json_object_object_get(json_obj,  "type")),
                                    ^
api/MySmartGrid.cpp:340:32: warning: ‘json_object* json_object_object_get(json_object*, const char*)’ is deprecated (declared at /usr/include/json/json_object.h:217) [-Wdeprecated-declarations]
     json_object_get_string(json_object_object_get(json_obj,  "message"))
                ^
api/MySmartGrid.cpp:340:75: warning: ‘json_object* json_object_object_get(json_object*, const char*)’ is deprecated (declared at /usr/include/json/json_object.h:217) [-Wdeprecated-declarations]
     json_object_get_string(json_object_object_get(json_obj,  "message"))
                                       ^
api/MySmartGrid.cpp:343:15: warning: ‘json_object* json_object_object_get(json_object*, const char*)’ is deprecated (declared at /usr/include/json/json_object.h:217) [-Wdeprecated-declarations]
    json_obj = json_object_object_get(json_obj_in, "response");
           ^
api/MySmartGrid.cpp:343:61: warning: ‘json_object* json_object_object_get(json_object*, const char*)’ is deprecated (declared at /usr/include/json/json_object.h:217) [-Wdeprecated-declarations]
    json_obj = json_object_object_get(json_obj_in, "response");
                                 ^

linux-xlde:~/vzlogger/vzlogger # rpm -q --list libjson-devel-0.10-3.6.1.i586
/usr/include/json
/usr/include/json/arraylist.h
/usr/include/json/bits.h
/usr/include/json/debug.h
/usr/include/json/json.h
/usr/include/json/json_config.h
/usr/include/json/json_inttypes.h
/usr/include/json/json_object.h
/usr/include/json/json_object_iterator.h
/usr/include/json/json_object_private.h
/usr/include/json/json_tokener.h
/usr/include/json/json_util.h
/usr/include/json/linkhash.h
/usr/include/json/printbuf.h
/usr/include/json/random_seed.h
/usr/lib/libjson.so
/usr/lib/pkgconfig/json.pc
@andig
Copy link
Contributor

andig commented Dec 23, 2014

These are the method signatures:

http://json-c.github.io/json-c/json-c-0.12/doc/html/json__object_8h.html#a1345aaf3ee46e9b6185355b733ec362d

extern struct json_object( 
    *   json_object_object_getstruct json_object *obj, 
    const char *key 
)

vs

http://json-c.github.io/json-c/json-c-0.12/doc/html/json__object_8h.html#af3f38b3395b1af8e9d3ac73818c3a936

json_bool json_object_object_get_ex     (   
    struct json_object *    obj,
    const char *    key,
    struct json_object **   value 
)   

@mbehr1
Copy link
Contributor

mbehr1 commented Dec 28, 2014

I prepare a fix but does anybody know which packages to use? libjson0-dev seems to be the old 0.9 version.

@devZer0
Copy link
Author

devZer0 commented Dec 28, 2014

libjson0-dev on what distro?

root@wheezy:~/libsml# dpkg --list |grep libjson
ii libjson0:i386 0.10-1.2 i386 JSON manipulation library - shared library
ii libjson0-dev:i386 0.10-1.2 i386 JSON manipulation library - development files

@mbehr1
Copy link
Contributor

mbehr1 commented Dec 28, 2014

On the travis-ci distros (no idea what it is). There it installs libjson2-dev and if I change it to „libjson-c-dev“ the build fails at the „apt-get install…“ step.

Am 28.12.2014 um 19:52 schrieb devZer0 notifications@github.com:

libjson0-dev on what distro?

root@wheezy:~/libsml# dpkg --list |grep libjson
ii libjson0:i386 0.10-1.2 i386 JSON manipulation library - shared library
ii libjson0-dev:i386 0.10-1.2 i386 JSON manipulation library - development files


Reply to this email directly or view it on GitHub #72 (comment).

Gruß

Matthias Behr

@devZer0
Copy link
Author

devZer0 commented Dec 28, 2014

that integration-tool seems to be using ubuntu 12.04 lts - http://docs.travis-ci.com/user/installing-dependencies/

@mbehr1
Copy link
Contributor

mbehr1 commented Dec 28, 2014

see #82

@andig
Copy link
Contributor

andig commented Dec 29, 2014

reminder: need to update http://wiki.volkszaehler.org/software/controller/vzlogger/installation_cpp-version prerequisites

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants