reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit 11cff4a2af1e820e66876a7acb5691a90f642e92
parent 6db4c0c85272317b0a010c4e1229c6054ae9c690
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Fri, 28 Oct 2016 19:37:08 -0400

remote: limit name size to 4..24 chars

buffer size for about labels is set to 35 now:

```
9 ("About ...") + 24 + 1 ("&") + 1 (null terminator)
```

Diffstat:
Msrc/browser.cpp | 2+-
Msrc/manager.cpp | 2+-
Msrc/remote.cpp | 2+-
Mtest/remote.cpp | 4++--
4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/browser.cpp b/src/browser.cpp @@ -399,7 +399,7 @@ void Browser::fillMenu(Menu &menu) menu.setEnabled(!entry->test(ObsoleteFlag), menu.addAction(AUTO_STR("About this &package"), ACTION_ABOUT_PKG)); - auto_char aboutLabel[32] = {}; + auto_char aboutLabel[35] = {}; const auto_string &name = make_autostring(getValue(RemoteColumn, *entry)); auto_snprintf(aboutLabel, auto_size(aboutLabel), AUTO_STR("&About %s..."), name.c_str()); diff --git a/src/manager.cpp b/src/manager.cpp @@ -192,7 +192,7 @@ bool Manager::fillContextMenu(Menu &menu, const int index) const menu.addSeparator(); - auto_char aboutLabel[32] = {}; + auto_char aboutLabel[35] = {}; const auto_string &name = make_autostring(remote.name()); auto_snprintf(aboutLabel, auto_size(aboutLabel), AUTO_STR("&About %s..."), name.c_str()); diff --git a/src/remote.cpp b/src/remote.cpp @@ -30,7 +30,7 @@ static char DATA_DELIMITER = '|'; static bool validateName(const string &name) { - static const regex validPattern("[^~#%&*{}\\\\:<>?/+|\"]+"); + static const regex validPattern("[^~#%&*{}\\\\:<>?/+|\"]{4,24}"); static const regex invalidPattern("\\.+"); smatch match, invalid; diff --git a/test/remote.cpp b/test/remote.cpp @@ -283,6 +283,6 @@ TEST_CASE("remove two remotes", M) { } TEST_CASE("compare remotes", M) { - REQUIRE(Remote("a", "a") < Remote("b", "a")); - REQUIRE_FALSE(Remote("a", "a") < Remote("a", "b")); + REQUIRE(Remote("aaaa", "aaaa") < Remote("bbbb", "aaaa")); + REQUIRE_FALSE(Remote("aaaa", "aaaa") < Remote("aaaa", "bbbb")); }