]> source.dussan.org Git - tigervnc.git/commitdiff
Use string literal instead of dynamic buffer
authorPierre Ossman <ossman@cendio.se>
Mon, 23 Jan 2023 19:08:43 +0000 (20:08 +0100)
committerPierre Ossman <ossman@cendio.se>
Sat, 4 Feb 2023 13:03:13 +0000 (14:03 +0100)
These don't need to be changed, so let's just keep it simple with a
constant string literal.

win/winvnc/ControlPanel.cxx
win/winvnc/ListConnInfo.h

index ff4a63a18b1ee9b92854da2f7ec54c3fbdc82468..1b3c40eb97e343956625ee8cdc133dda8ecc6e71 100644 (file)
@@ -88,7 +88,7 @@ void ControlPanel::UpdateListView(ListConnInfo* LCInfo)
 
   ListConn.Copy(LCInfo);
 
-  char* ItemString[2];
+  const char* ItemString[2];
   int i = 0;
 
   for (ListConn.iBegin(); !ListConn.iEnd(); ListConn.iNext()) {
index 6ca5b7c7f7b09c0112ccd1456d408992aa8f59d5..f779cf5d161eb7a06f835ed5d33086fc089c5b9f 100644 (file)
@@ -51,26 +51,26 @@ namespace winvnc {
       si++;
     }
 
-    void addInfo(void* Conn, char* IP, int Status) {
+    void addInfo(void* Conn, const char* IP, int Status) {
       conn.push_back(Conn);
       IP_address.push_back(rfb::strDup(IP));
       status.push_back(Status);
     }
 
-    void iGetCharInfo(char* buf[2]) {
+    void iGetCharInfo(const char* buf[2]) {
       buf[0] = *Ii;
       switch (*si) {
       case 0:
-        buf[1] = rfb::strDup("Full control");
+        buf[1] = "Full control";
         break;
       case 1:
-        buf[1] = rfb::strDup("View only");
+        buf[1] = "View only";
         break;
       case 2:
-        buf[1] = rfb::strDup("Stop updating");
+        buf[1] = "Stop updating";
         break;
       default:
-        buf[1] = rfb::strDup("Unknown");
+        buf[1] = "Unknown";
       }
     }
 
@@ -90,7 +90,7 @@ namespace winvnc {
     }
 
     void iAdd (ListConnInfo* InputList) {
-      char* buf[2];
+      const char* buf[2];
       InputList->iGetCharInfo(buf);
       addInfo(InputList->iGetConn(), buf[0], InputList->iGetStatus());
     }