From 92d38f02afa97dade5969c2812c2cb4b8bf2ac88 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Sat, 25 Jul 2026 11:05:12 -0400 Subject: [PATCH] jbig2-from-json: Improve a few diagnostics Fixes a few copy-pastos, makes some diagnostics more detailed, and makes the help text a bit more precise. --- Userland/Utilities/jbig2-from-json.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Userland/Utilities/jbig2-from-json.cpp b/Userland/Utilities/jbig2-from-json.cpp index 839da0c2611..ac3fe071515 100644 --- a/Userland/Utilities/jbig2-from-json.cpp +++ b/Userland/Utilities/jbig2-from-json.cpp @@ -60,8 +60,8 @@ static ErrorOr jbig2_header_from_json(JsonObject con return {}; } - dbgln("key {}", key); - return Error::from_string_literal("unknown key"); + dbgln("global_header key {}", key); + return Error::from_string_literal("unknown global_header key"); })); return header; @@ -688,7 +688,7 @@ static ErrorOr jbi image = move(refined_symbol); return {}; } - return Error::from_string_literal("expected object for \"instance_refines_symbol_to\""); + return Error::from_string_literal("expected object for \"refines_symbol_to\""); } if (key == "refines_using_strips"sv) { @@ -1040,7 +1040,7 @@ static ErrorOr jbig2_text_region_huffman_flags_from_json(JsonObject const& } } // FIXME: Also allow names "standard_table_6", "standard_table_7", "custom" for values 0, 1, 3. - return Error::from_string_literal("expected 0, 1, or 2 for \"huffman_table_selection_for_first_s\""); + return Error::from_string_literal("expected 0, 1, or 3 for \"huffman_table_selection_for_first_s\""); } if (key == "huffman_table_selection_for_subsequent_s"sv) { @@ -1693,7 +1693,7 @@ static ErrorOr jbig2_halftone_region_flags_from_json(JsonObject const& objec flags |= ht_template.value() << 1; return {}; } - return Error::from_string_literal("expected uint for \"gb_template\""); + return Error::from_string_literal("expected uint for \"ht_template\""); } if (key == "enable_skip"sv) { @@ -2579,7 +2579,7 @@ static ErrorOr> jbig2_tables_entries_from_ static ErrorOr jbig2_tables_from_json(Gfx::JBIG2::SegmentHeaderData const& header, Optional object) { if (!object.has_value()) - return Error::from_string_literal("page_information segment should have \"data\" object"); + return Error::from_string_literal("tables segment should have \"data\" object"); Gfx::JBIG2::TablesData data {}; @@ -2927,8 +2927,8 @@ ErrorOr serenity_main(Main::Arguments arguments) StringView out_path; Core::ArgsParser args_parser; args_parser.set_general_help("Creates JBIG2 test files from JSON descriptions."); - args_parser.add_positional_argument(in_path, "Path to input image file", "FILE"); - args_parser.add_option(out_path, "Path to output image file", "output", 'o', "FILE"); + args_parser.add_positional_argument(in_path, "Path to input json file", "FILE"); + args_parser.add_option(out_path, "Path to output jbig2 file", "output", 'o', "FILE"); args_parser.parse(arguments); if (out_path.is_empty()) return Error::from_string_literal("-o is required");