You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use json-c in one project which one of the compiler flags is -Wcast-qual. I use the macro json_object_object_foreach and I get the following error when compiling
error: cast from 'const void *' to 'struct json_object *' drops const qualifier [-Werror,-Wcast-qual]
json_object_object_foreach(body_json, key, val)
^
/usr/include/json-c/json_object.h:320:31: note: expanded from macro 'json_object_object_foreach'
val = (struct json_object*)entry ## key->v; \
^
Now, removing the const qualifier from the value in lh_entry fixes the issue, but I am not familiar with the json-c code base and I don't think that might be the proper solution.
The text was updated successfully, but these errors were encountered:
To better distinguish between entry->k and entry->v being const within linkhash, but non-const outside, add lh_entry_v() and lh_entry_k() accessors.
Make lh_entry->k const.
I use
json-c
in one project which one of the compiler flags is -Wcast-qual. I use the macrojson_object_object_foreach
and I get the following error when compilingThis happens because the value, in the
lh_entry
, is set as const but in the macrojson_object_object_foreach
the value is type casted as non-const.Now, removing the
const
qualifier from the value inlh_entry
fixes the issue, but I am not familiar with thejson-c
code base and I don't think that might be the proper solution.The text was updated successfully, but these errors were encountered: