From 2e07902d769191c8b9e563b36ca2243ac11f500f Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Fri, 12 Mar 2021 16:54:26 -0800 Subject: [PATCH 1/3] [glass] NTField2D: Fix name lookup (#3233) This was causing incorrect detection of duplicate names. --- glass/src/libnt/native/cpp/NTField2D.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glass/src/libnt/native/cpp/NTField2D.cpp b/glass/src/libnt/native/cpp/NTField2D.cpp index 47fcf2fb23..073aff9b8f 100644 --- a/glass/src/libnt/native/cpp/NTField2D.cpp +++ b/glass/src/libnt/native/cpp/NTField2D.cpp @@ -213,11 +213,11 @@ void NTField2DModel::Update() { if (name.empty() || name[0] == '.') { continue; } - auto it = std::lower_bound(m_groups.begin(), m_groups.end(), name, + auto it = std::lower_bound(m_groups.begin(), m_groups.end(), event.name, [](const auto& e, wpi::StringRef name) { return e->GetName() < name; }); - bool match = (it != m_groups.end() && (*it)->GetName() == name); + bool match = (it != m_groups.end() && (*it)->GetName() == event.name); if (event.flags & NT_NOTIFY_DELETE) { if (match) { m_groups.erase(it); From 1032c9b91771d2cbd8c1cea9aef6eff4454fb100 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Tue, 16 Mar 2021 22:04:55 -0700 Subject: [PATCH 2/3] [wpiutil] Unbreak wpi::Format on Windows (#3242) This function relies on the behavior of snprintf returning an error value when the buffer is too small. By default, _snprintf_s aborts on Windows instead of returning an error value. This caused Glass to fail when trying to print a large NT value to a string. --- wpiutil/src/main/native/include/wpi/Format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wpiutil/src/main/native/include/wpi/Format.h b/wpiutil/src/main/native/include/wpi/Format.h index cb8b26b809..ac4886a110 100644 --- a/wpiutil/src/main/native/include/wpi/Format.h +++ b/wpiutil/src/main/native/include/wpi/Format.h @@ -95,7 +95,7 @@ class format_object final : public format_object_base { int snprint_tuple(char *Buffer, unsigned BufferSize, std::index_sequence) const { #ifdef _MSC_VER - return _snprintf_s(Buffer, BufferSize, BufferSize, Fmt, std::get(Vals)...); + return _snprintf(Buffer, BufferSize, Fmt, std::get(Vals)...); #else #ifdef __GNUC__ #pragma GCC diagnostic push From c3a8bdc2404ae0b39275cc4144689b6c860b0944 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Fri, 19 Mar 2021 08:59:14 -0700 Subject: [PATCH 3/3] [build] Fix clang-tidy action (#3246) Manually install python3.8, as actions/setup-python now needs Ubuntu 20.04. --- .github/workflows/lint-format.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index f496f3abac..366bfab343 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -36,12 +36,8 @@ jobs: git fetch --prune --unshallow git checkout -b pr git branch -f main origin/main - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 - name: Install clang-format and clang-tidy - run: sudo apt-get update -q && sudo apt-get install -y clang-format-10 clang-tidy-10 + run: sudo apt-get update -q && sudo apt-get install -y clang-format-10 clang-tidy-10 python3.8 - name: Install wpiformat run: pip3 install wpiformat - name: Create compile_commands.json