aboutsummaryrefslogtreecommitdiffstats
path: root/win/vncconfig
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2023-01-15 14:01:28 +0100
committerPierre Ossman <ossman@cendio.se>2023-02-04 14:03:13 +0100
commite6c5b29f12780303299506fe04f089bc98b80c91 (patch)
tree90c0ca35d030065f6f8d169a213dc3c4d923f3b6 /win/vncconfig
parent15a393912673e2ae65b9b3a28f9b82f967c49f98 (diff)
downloadtigervnc-e6c5b29f12780303299506fe04f089bc98b80c91.tar.gz
tigervnc-e6c5b29f12780303299506fe04f089bc98b80c91.zip
Use std::vector for temporary char arrays
It's more standard and familiar than our custom CharArray type, and it still gives us automatic freeing of the buffer. We could probably have used std::unique_ptr instead, but we are currently targeting older compilers where C++11 isn't standard yet.
Diffstat (limited to 'win/vncconfig')
-rw-r--r--win/vncconfig/Connections.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/win/vncconfig/Connections.h b/win/vncconfig/Connections.h
index 492525f3..1f974454 100644
--- a/win/vncconfig/Connections.h
+++ b/win/vncconfig/Connections.h
@@ -167,13 +167,13 @@ namespace rfb {
{
HWND listBox = GetDlgItem(handle, IDC_HOSTS);
int item = SendMessage(listBox, LB_GETCURSEL, 0, 0);
- CharArray pattern(SendMessage(listBox, LB_GETTEXTLEN, item, 0)+1);
- SendMessage(listBox, LB_GETTEXT, item, (LPARAM)pattern.buf);
+ std::vector<char> pattern(SendMessage(listBox, LB_GETTEXTLEN, item, 0)+1);
+ SendMessage(listBox, LB_GETTEXT, item, (LPARAM)pattern.data());
- if (hostDialog.showDialog(pattern.buf)) {
+ if (hostDialog.showDialog(pattern.data())) {
const char* newPat = hostDialog.getPattern();
if (newPat) {
- item = SendMessage(listBox, LB_FINDSTRINGEXACT, item, (LPARAM)pattern.buf);
+ item = SendMessage(listBox, LB_FINDSTRINGEXACT, item, (LPARAM)pattern.data());
if (item != LB_ERR) {
SendMessage(listBox, LB_DELETESTRING, item, 0);
SendMessage(listBox, LB_INSERTSTRING, item, (LPARAM)newPat);
@@ -189,10 +189,10 @@ namespace rfb {
{
HWND listBox = GetDlgItem(handle, IDC_HOSTS);
int item = SendMessage(listBox, LB_GETCURSEL, 0, 0);
- CharArray pattern(SendMessage(listBox, LB_GETTEXTLEN, item, 0)+1);
- SendMessage(listBox, LB_GETTEXT, item, (LPARAM)pattern.buf);
+ std::vector<char> pattern(SendMessage(listBox, LB_GETTEXTLEN, item, 0)+1);
+ SendMessage(listBox, LB_GETTEXT, item, (LPARAM)pattern.data());
SendMessage(listBox, LB_DELETESTRING, item, 0);
- SendMessage(listBox, LB_INSERTSTRING, item-1, (LPARAM)pattern.buf);
+ SendMessage(listBox, LB_INSERTSTRING, item-1, (LPARAM)pattern.data());
SendMessage(listBox, LB_SETCURSEL, item-1, 0);
onCommand(IDC_HOSTS, EN_CHANGE);
}
@@ -202,10 +202,10 @@ namespace rfb {
{
HWND listBox = GetDlgItem(handle, IDC_HOSTS);
int item = SendMessage(listBox, LB_GETCURSEL, 0, 0);
- CharArray pattern(SendMessage(listBox, LB_GETTEXTLEN, item, 0)+1);
- SendMessage(listBox, LB_GETTEXT, item, (LPARAM)pattern.buf);
+ std::vector<char> pattern(SendMessage(listBox, LB_GETTEXTLEN, item, 0)+1);
+ SendMessage(listBox, LB_GETTEXT, item, (LPARAM)pattern.data());
SendMessage(listBox, LB_DELETESTRING, item, 0);
- SendMessage(listBox, LB_INSERTSTRING, item+1, (LPARAM)pattern.buf);
+ SendMessage(listBox, LB_INSERTSTRING, item+1, (LPARAM)pattern.data());
SendMessage(listBox, LB_SETCURSEL, item+1, 0);
onCommand(IDC_HOSTS, EN_CHANGE);
}