mirror of
https://github.com/biojppm/rapidyaml.git
synced 2026-01-18 21:41:18 +01:00
minor fixes
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
#include <c4/yml/common.hpp>
|
||||
#endif
|
||||
#include <c4/fs/fs.hpp>
|
||||
#include <c4/yml/detail/print.hpp>
|
||||
|
||||
#include <cstdio>
|
||||
#include <chrono>
|
||||
@@ -29,7 +28,6 @@ C4_SUPPRESS_WARNING_GCC("-Wuseless-cast")
|
||||
|
||||
|
||||
bool quiet = false;
|
||||
bool debug_tree = false;
|
||||
bool emit_as_json = false;
|
||||
bool timed_sections = false;
|
||||
bool emit_to_string = false;
|
||||
@@ -95,8 +93,6 @@ csubstr parse_args(int argc, const char *argv[])
|
||||
timed_sections = true;
|
||||
else if(arg == "-s" || arg == "--string")
|
||||
emit_to_string = true;
|
||||
else if(arg == "-d" || arg == "--debug")
|
||||
debug_tree = true;
|
||||
else if(arg == "-j" || arg == "--json")
|
||||
emit_as_json = true;
|
||||
else
|
||||
@@ -214,22 +210,10 @@ void process_file(csubstr file)
|
||||
TS(parse_yml);
|
||||
yml::parse_in_place(file, to_substr(contents), &tree);
|
||||
}
|
||||
if(debug_tree)
|
||||
{
|
||||
TS(debug_tree);
|
||||
yml::print_tree(tree);
|
||||
}
|
||||
if(emit_as_json)
|
||||
{
|
||||
{
|
||||
TS(resolve_refs);
|
||||
tree.resolve();
|
||||
}
|
||||
if(debug_tree)
|
||||
{
|
||||
TS(debug_resolved_tree);
|
||||
yml::print_tree(tree);
|
||||
}
|
||||
TS(resolve_refs);
|
||||
tree.resolve();
|
||||
}
|
||||
if(emit_to_string)
|
||||
{
|
||||
|
||||
@@ -151,8 +151,6 @@ bool Args::parse(Args *args, int argc, const char *argv[])
|
||||
return true;
|
||||
}
|
||||
|
||||
C4_SUPPRESS_WARNING_GCC_CLANG_WITH_PUSH("-Wold-style-cast")
|
||||
|
||||
std::string load_file(csubstr filename)
|
||||
{
|
||||
if(filename == "-") // read from stdin
|
||||
@@ -160,7 +158,7 @@ std::string load_file(csubstr filename)
|
||||
std::string buf;
|
||||
for(int c = std::getchar(); c != EOF; c = std::getchar())
|
||||
{
|
||||
buf.push_back((char)c);
|
||||
buf.push_back(static_cast<char>(c));
|
||||
if(buf.size() == buf.capacity())
|
||||
buf.reserve(2u * (buf.capacity() >= 128u ? buf.capacity() : 128u));
|
||||
}
|
||||
@@ -187,12 +185,10 @@ void report_error(const char* msg, size_t length, Location loc, FILE *f)
|
||||
if(loc.offset)
|
||||
fprintf(f, " (%zuB):", loc.offset);
|
||||
fputc(' ', f);
|
||||
fprintf(f, "%.*s\n", (int)length, msg);
|
||||
fprintf(f, "%.*s\n", static_cast<int>(length), msg);
|
||||
fflush(f);
|
||||
}
|
||||
|
||||
C4_SUPPRESS_WARNING_GCC_CLANG_POP
|
||||
|
||||
Callbacks create_custom_callbacks()
|
||||
{
|
||||
Callbacks callbacks = {};
|
||||
|
||||
Reference in New Issue
Block a user