Commit 15b60127 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰

[3400] Coding style fixes, better error message.

parent dcd45b54
...@@ -619,7 +619,7 @@ Element::fromJSON(std::istream& in, bool preproc) throw(JSONError) { ...@@ -619,7 +619,7 @@ Element::fromJSON(std::istream& in, bool preproc) throw(JSONError) {
preprocess(in, filtered); preprocess(in, filtered);
} }
ElementPtr value = fromJSON(preproc?filtered:in, "<istream>", line, pos); ElementPtr value = fromJSON(preproc ? filtered : in, "<istream>", line, pos);
return (value); return (value);
} }
...@@ -633,7 +633,7 @@ Element::fromJSON(std::istream& in, const std::string& file_name, bool preproc) ...@@ -633,7 +633,7 @@ Element::fromJSON(std::istream& in, const std::string& file_name, bool preproc)
if (preproc) { if (preproc) {
preprocess(in, filtered); preprocess(in, filtered);
} }
return (fromJSON(preproc?filtered:in, file_name, line, pos)); return (fromJSON(preproc ? filtered : in, file_name, line, pos));
} }
ElementPtr ElementPtr
...@@ -720,7 +720,7 @@ Element::fromJSON(const std::string& in, bool preproc) { ...@@ -720,7 +720,7 @@ Element::fromJSON(const std::string& in, bool preproc) {
if (preproc) { if (preproc) {
preprocess(ss, filtered); preprocess(ss, filtered);
} }
ElementPtr result(fromJSON(preproc?filtered:ss, "<string>", line, pos)); ElementPtr result(fromJSON(preproc ? filtered : ss, "<string>", line, pos));
skipChars(ss, WHITESPACE, line, pos); skipChars(ss, WHITESPACE, line, pos);
// ss must now be at end // ss must now be at end
if (ss.peek() != EOF) { if (ss.peek() != EOF) {
...@@ -735,8 +735,9 @@ Element::fromJSONFile(const std::string& file_name, ...@@ -735,8 +735,9 @@ Element::fromJSONFile(const std::string& file_name,
std::ifstream infile(file_name.c_str(), std::ios::in | std::ios::binary); std::ifstream infile(file_name.c_str(), std::ios::in | std::ios::binary);
if (!infile.is_open()) if (!infile.is_open())
{ {
const char* error = strerror(errno);
isc_throw(InvalidOperation, "Failed to read file " << file_name isc_throw(InvalidOperation, "Failed to read file " << file_name
<< ",error:" << errno); << ",error:" << error);
} }
return (fromJSON(infile, file_name, preproc)); return (fromJSON(infile, file_name, preproc));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment