From 66a98861d0fbb7cba742b63bf97268a2a619c5e0 Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Sat, 10 Aug 2024 15:51:34 +0200 Subject: Some small updates here and there --- flake.lock | 22 +++++++++++----------- flake.nix | 1 + lib/libtmi8/src/kv1_parser.cpp | 2 +- src/augmentkv6/main.cpp | 4 ++-- src/bundleparquet/spliturl.cpp | 10 ---------- src/querykv1/main.cpp | 4 ++-- src/recvkv6/main.cpp | 28 +++++++++++++++------------- 7 files changed, 32 insertions(+), 39 deletions(-) diff --git a/flake.lock b/flake.lock index 3b8b6fe..d8339b6 100644 --- a/flake.lock +++ b/flake.lock @@ -5,12 +5,12 @@ "systems": "systems" }, "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", - "revCount": 88, + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "revCount": 92, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/numtide/flake-utils/0.1.88%2Brev-4022d587cbbfd70fe950c1e2083a02621806a725/018c340d-3287-7c66-818b-f2f646a808e3/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/numtide/flake-utils/0.1.92%2Brev-b1d9ab70662946ef0850d488da1c9019f3a9752a/018e2ca5-e5a2-7f80-9261-445a8cecd4d7/source.tar.gz" }, "original": { "type": "tarball", @@ -28,7 +28,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-ST9E5LANnA7IV5cY0fbk+MSukaOczxnkXV1/IH7ps4U=", + "narHash": "sha256-G6OEDWGxSLDOcc5lNcYFyqRPaTu3GCdfiI3bT+40bo0=", "path": "./lib/libtmi8", "type": "path" }, @@ -39,12 +39,12 @@ }, "nixpkgs": { "locked": { - "lastModified": 1702346276, - "narHash": "sha256-eAQgwIWApFQ40ipeOjVSoK4TEHVd6nbSd9fApiHIw5A=", - "rev": "cf28ee258fd5f9a52de6b9865cdb93a1f96d09b7", - "revCount": 553141, + "lastModified": 1722519197, + "narHash": "sha256-VEdJmVU2eLFtLqCjTYJd1J7+Go8idAcZoT11IewFiRg=", + "rev": "05405724efa137a0b899cce5ab4dde463b4fd30b", + "revCount": 633655, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOs/nixpkgs/0.2311.553141%2Brev-cf28ee258fd5f9a52de6b9865cdb93a1f96d09b7/018c652c-2ff2-777b-bade-dae9c2abe1e1/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/NixOs/nixpkgs/0.2405.633655%2Brev-05405724efa137a0b899cce5ab4dde463b4fd30b/0191155c-b6ad-7876-8d08-9db8408432d0/source.tar.gz" }, "original": { "type": "tarball", diff --git a/flake.nix b/flake.nix index df5fffb..22ca0e6 100644 --- a/flake.nix +++ b/flake.nix @@ -130,6 +130,7 @@ devShells.default = pkgs.mkShell { inputsFrom = [ oeuf-bundleparquet oeuf-querykv1 oeuf-recvkv6 ]; + buildInputs = with pkgs; [ xercesc xsd ]; }; formatter = pkgs.nixpkgs-fmt; diff --git a/lib/libtmi8/src/kv1_parser.cpp b/lib/libtmi8/src/kv1_parser.cpp index 78a45a6..3ea9137 100644 --- a/lib/libtmi8/src/kv1_parser.cpp +++ b/lib/libtmi8/src/kv1_parser.cpp @@ -374,7 +374,7 @@ static std::optional parseDateTime(std::string_view sr size_t tzd_off = time_off + 9; // For clarity, TZD stands for Time Zone Designator. It often takes the form // of Z (Zulu, UTC+00:00) or as an offset from UTC in hours and minutes, - // formatted as +|-HH:MM (e.g. +01:00, -12:00). + // formatted as ±HH:MM (e.g. +01:00, -12:00). if (time_off + 8 >= src.size()) ERROR("bad format, not enough space for hh:mm:ss"); diff --git a/src/augmentkv6/main.cpp b/src/augmentkv6/main.cpp index 303721f..ae8405a 100644 --- a/src/augmentkv6/main.cpp +++ b/src/augmentkv6/main.cpp @@ -90,10 +90,10 @@ bool parse(Kv1Records &into) { parser.parse(); bool ok = true; - if (!parser.gerrors.empty()) { + if (!parser.global_errors.empty()) { ok = false; fputs("Parser reported errors:\n", stderr); - for (const auto &error : parser.gerrors) + for (const auto &error : parser.global_errors) fprintf(stderr, "- %s\n", error.c_str()); } if (!parser.warns.empty()) { diff --git a/src/bundleparquet/spliturl.cpp b/src/bundleparquet/spliturl.cpp index 91f897d..2b35d4c 100644 --- a/src/bundleparquet/spliturl.cpp +++ b/src/bundleparquet/spliturl.cpp @@ -122,16 +122,6 @@ std::optional splitUrl(const std::string &url, std::string *error) { schemehost = curl_url_dup(parsed); - // CURL BUG WORKAROUND: CURLUPART_ZONEID is NOT copied by curl_url_dup! - // ^ fixed in CURL 8.3.0 after https://curl.se/mail/lib-2023-07/0047.html - rc = curl_url_get(parsed, CURLUPART_ZONEID, &zoneid, 0); - if (rc == CURLUE_OK) { - rc = curl_url_set(schemehost, CURLUPART_ZONEID, zoneid, 0); - if (rc != CURLUE_OK) { - errs << "Could not copy zone ID to duplicated URL: " << curl_url_strerror(rc); - goto Exit; - } - } rc = curl_url_set(schemehost, CURLUPART_PORT, nullptr, 0); if (rc != CURLUE_OK) { errs << "Could not unset port in duplicated URL: " << curl_url_strerror(rc); diff --git a/src/querykv1/main.cpp b/src/querykv1/main.cpp index 9580328..11437f4 100644 --- a/src/querykv1/main.cpp +++ b/src/querykv1/main.cpp @@ -90,10 +90,10 @@ bool parse(const char *path, Kv1Records &into) { parser.parse(); bool ok = true; - if (!parser.gerrors.empty()) { + if (!parser.global_errors.empty()) { ok = false; fputs("Parser reported errors:\n", stderr); - for (const auto &error : parser.gerrors) + for (const auto &error : parser.global_errors) fprintf(stderr, "- %s\n", error.c_str()); } if (!parser.warns.empty()) { diff --git a/src/recvkv6/main.cpp b/src/recvkv6/main.cpp index 3a3338b..e8b0ba3 100644 --- a/src/recvkv6/main.cpp +++ b/src/recvkv6/main.cpp @@ -922,20 +922,22 @@ struct Kv6Parser { std::optional parse(const rapidxml::xml_document<> &doc) { std::optional msg; - for (const rapidxml::xml_node<> *node = doc.first_node(); node; node = node->next_sibling()) { - ifTmi8Element(*node, nullptr /* nss */, [&](std::string_view name, const Xmlns *nss) { - if (name == "VV_TM_PUSH") { - if (msg) { - error("Duplicated VV_TM_PUSH"); - return; - } - msg = parseVvTmPush(*node, nss); - if (!msg) { - error("Invalid VV_TM_PUSH"); + withXmlnss(doc.first_attribute(), nullptr /* nss */, [&](const Xmlns *nss) { + for (const rapidxml::xml_node<> *node = doc.first_node(); node; node = node->next_sibling()) { + ifTmi8Element(*node, nss, [&](std::string_view name, const Xmlns *node_nss) { + if (name == "VV_TM_PUSH") { + if (msg) { + error("Duplicated VV_TM_PUSH"); + return; + } + msg = parseVvTmPush(*node, node_nss); + if (!msg) { + error("Invalid VV_TM_PUSH"); + } } - } - }); - } + }); + } + }); if (!msg) error("Expected to find VV_TM_PUSH"); return msg; -- cgit v1.2.3