Don't shadow "schema" with local variables of the same name
This fixes a warning from gcc (-Wshadow).
This commit is contained in:
parent
b10710d960
commit
1519c845c2
@ -145,8 +145,8 @@ public:
|
|||||||
void insert(const json_uri &uri, const std::shared_ptr<schema> &s)
|
void insert(const json_uri &uri, const std::shared_ptr<schema> &s)
|
||||||
{
|
{
|
||||||
auto &file = get_or_create_file(uri.location());
|
auto &file = get_or_create_file(uri.location());
|
||||||
auto schema = file.schemas.lower_bound(uri.fragment());
|
auto sch = file.schemas.lower_bound(uri.fragment());
|
||||||
if (schema != file.schemas.end() && !(file.schemas.key_comp()(uri.fragment(), schema->first))) {
|
if (sch != file.schemas.end() && !(file.schemas.key_comp()(uri.fragment(), sch->first))) {
|
||||||
throw std::invalid_argument("schema with " + uri.to_string() + " already inserted");
|
throw std::invalid_argument("schema with " + uri.to_string() + " already inserted");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -185,9 +185,9 @@ public:
|
|||||||
auto &file = get_or_create_file(uri.location());
|
auto &file = get_or_create_file(uri.location());
|
||||||
|
|
||||||
// existing schema
|
// existing schema
|
||||||
auto schema = file.schemas.find(uri.fragment());
|
auto sch = file.schemas.find(uri.fragment());
|
||||||
if (schema != file.schemas.end())
|
if (sch != file.schemas.end())
|
||||||
return schema->second;
|
return sch->second;
|
||||||
|
|
||||||
// referencing an unknown keyword, turn it into schema
|
// referencing an unknown keyword, turn it into schema
|
||||||
//
|
//
|
||||||
@ -216,10 +216,10 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_root_schema(json schema)
|
void set_root_schema(json sch)
|
||||||
{
|
{
|
||||||
files_.clear();
|
files_.clear();
|
||||||
root_ = schema::make(schema, this, {}, {{"#"}});
|
root_ = schema::make(sch, this, {}, {{"#"}});
|
||||||
|
|
||||||
// load all files which have not yet been loaded
|
// load all files which have not yet been loaded
|
||||||
do {
|
do {
|
||||||
@ -233,11 +233,11 @@ public:
|
|||||||
for (auto &loc : locations) {
|
for (auto &loc : locations) {
|
||||||
if (files_[loc].schemas.size() == 0) { // nothing has been loaded for this file
|
if (files_[loc].schemas.size() == 0) { // nothing has been loaded for this file
|
||||||
if (loader_) {
|
if (loader_) {
|
||||||
json sch;
|
json loaded_schema;
|
||||||
|
|
||||||
loader_(loc, sch);
|
loader_(loc, loaded_schema);
|
||||||
|
|
||||||
schema::make(sch, this, {}, {{loc}});
|
schema::make(loaded_schema, this, {}, {{loc}});
|
||||||
new_schema_loaded = true;
|
new_schema_loaded = true;
|
||||||
} else {
|
} else {
|
||||||
throw std::invalid_argument("external schema reference '" + loc + "' needs loading, but no loader callback given");
|
throw std::invalid_argument("external schema reference '" + loc + "' needs loading, but no loader callback given");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user