mirror of
https://github.com/json-c/json-c.git
synced 2026-03-26 00:19:07 +08:00
Issue #236: Add -Wcast-qual and fix casts to retain constness.
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.
This commit is contained in:
@@ -105,7 +105,7 @@ json_object_iter_next(struct json_object_iterator* iter)
|
||||
JASSERT(NULL != iter);
|
||||
JASSERT(kObjectEndIterValue != iter->opaque_);
|
||||
|
||||
iter->opaque_ = ((struct lh_entry *)iter->opaque_)->next;
|
||||
iter->opaque_ = ((const struct lh_entry *)iter->opaque_)->next;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ json_object_iter_peek_name(const struct json_object_iterator* iter)
|
||||
JASSERT(NULL != iter);
|
||||
JASSERT(kObjectEndIterValue != iter->opaque_);
|
||||
|
||||
return (const char*)(((struct lh_entry *)iter->opaque_)->k);
|
||||
return (const char*)(((const struct lh_entry *)iter->opaque_)->k);
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ json_object_iter_peek_value(const struct json_object_iterator* iter)
|
||||
JASSERT(NULL != iter);
|
||||
JASSERT(kObjectEndIterValue != iter->opaque_);
|
||||
|
||||
return (struct json_object*)(((struct lh_entry *)iter->opaque_)->v);
|
||||
return (struct json_object*)lh_entry_v((const struct lh_entry *)iter->opaque_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user