aboutsummaryrefslogtreecommitdiffstats
path: root/win/rfb_win32/SDisplay.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2023-01-10 19:26:48 +0100
committerPierre Ossman <ossman@cendio.se>2023-02-04 14:03:13 +0100
commit741300728a889b4ccaec35bd57efb072018c860c (patch)
tree1531c90303a6379a89966946c7e341fafb8ec18f /win/rfb_win32/SDisplay.cxx
parent77f0a61ec8f1488d6042b1370444bb2612604292 (diff)
downloadtigervnc-741300728a889b4ccaec35bd57efb072018c860c.tar.gz
tigervnc-741300728a889b4ccaec35bd57efb072018c860c.zip
Use StringParameters directly
We don't need to make extra copies of the string in most cases, so let's simplify the code and access the string directly when we can.
Diffstat (limited to 'win/rfb_win32/SDisplay.cxx')
-rw-r--r--win/rfb_win32/SDisplay.cxx16
1 files changed, 7 insertions, 9 deletions
diff --git a/win/rfb_win32/SDisplay.cxx b/win/rfb_win32/SDisplay.cxx
index 02ef548d..110edcb0 100644
--- a/win/rfb_win32/SDisplay.cxx
+++ b/win/rfb_win32/SDisplay.cxx
@@ -120,13 +120,12 @@ void SDisplay::stop()
// If we successfully start()ed then perform the DisconnectAction
if (core) {
CurrentUserToken cut;
- CharArray action(disconnectAction.getData());
- if (stricmp(action.buf, "Logoff") == 0) {
+ if (stricmp(disconnectAction, "Logoff") == 0) {
if (!cut.h)
vlog.info("ignoring DisconnectAction=Logoff - no current user");
else
ExitWindowsEx(EWX_LOGOFF, 0);
- } else if (stricmp(action.buf, "Lock") == 0) {
+ } else if (stricmp(disconnectAction, "Lock") == 0) {
if (!cut.h) {
vlog.info("ignoring DisconnectAction=Lock - no current user");
} else {
@@ -448,10 +447,9 @@ SDisplay::recreatePixelBuffer(bool force) {
// Opening the whole display with CreateDC doesn't work on multi-monitor
// systems for some reason.
DeviceContext* new_device = 0;
- CharArray deviceName(displayDevice.getData());
- if (deviceName.buf[0]) {
- vlog.info("Attaching to device %s", deviceName.buf);
- new_device = new DeviceDC(deviceName.buf);
+ if (strlen(displayDevice) > 0) {
+ vlog.info("Attaching to device %s", (const char*)displayDevice);
+ new_device = new DeviceDC(displayDevice);
}
if (!new_device) {
vlog.info("Attaching to virtual desktop");
@@ -460,8 +458,8 @@ SDisplay::recreatePixelBuffer(bool force) {
// Get the coordinates of the specified dispay device
Rect newScreenRect;
- if (deviceName.buf[0]) {
- MonitorInfo info(deviceName.buf);
+ if (strlen(displayDevice) > 0) {
+ MonitorInfo info(displayDevice);
newScreenRect = Rect(info.rcMonitor.left, info.rcMonitor.top,
info.rcMonitor.right, info.rcMonitor.bottom);
} else {