]> source.dussan.org Git - tigervnc.git/commitdiff
Remove "str" prefix from string helpers
authorPierre Ossman <ossman@cendio.se>
Mon, 23 Jan 2023 19:15:28 +0000 (20:15 +0100)
committerPierre Ossman <ossman@cendio.se>
Sat, 4 Feb 2023 13:03:13 +0000 (14:03 +0100)
This matches the naming in STL, which is what we are mostly mimicing now
that we are using std::string for these functions.

14 files changed:
common/network/TcpSocket.cxx
common/rfb/CSecurityRSAAES.cxx
common/rfb/CSecurityTLS.cxx
common/rfb/LogWriter.cxx
common/rfb/SSecurityPlain.cxx
common/rfb/Security.cxx
common/rfb/util.cxx
common/rfb/util.h
win/rfb_win32/Service.cxx
win/rfb_win32/Win32Util.cxx
win/vncconfig/Connections.h
win/vncconfig/Legacy.cxx
win/winvnc/VNCServerService.cxx
win/winvnc/winvnc.cxx

index 87f2e757d495679c53d906ca98b0e194a4e98b05..462b8a7baa343e88b5c8e2b1d035a1f39bf6ff2f 100644 (file)
@@ -507,7 +507,7 @@ void network::createTcpListeners(std::list<SocketListener*> *listeners,
 TcpFilter::TcpFilter(const char* spec) {
   std::vector<std::string> patterns;
 
-  patterns = rfb::strSplit(spec, ',');
+  patterns = rfb::split(spec, ',');
 
   for (size_t i = 0; i < patterns.size(); i++) {
     if (!patterns[i].empty())
@@ -609,7 +609,7 @@ TcpFilter::Pattern TcpFilter::parsePattern(const char* p) {
 
   initSockets();
 
-  parts = rfb::strSplit(&p[1], '/');
+  parts = rfb::split(&p[1], '/');
   if (parts.size() > 2)
     throw Exception("invalid filter specified");
 
index 24d1a9fee8803a703c42bbfb874e7f83f163db8c..bff088ad3f240bfb47b3a529309780cafdfe967d 100644 (file)
@@ -208,7 +208,7 @@ void CSecurityRSAAES::verifyServer()
   sha1_update(&ctx, serverKey.size, serverKeyE);
   sha1_digest(&ctx, sizeof(f), f);
   const char *title = "Server key fingerprint";
-  std::string text = strFormat(
+  std::string text = format(
     "The server has provided the following identifying information:\n"
     "Fingerprint: %02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x\n"
     "Please verify that the information is correct and press \"Yes\". "
index 92a89193a4aa7eecefeb44f5da0f50acda20ffb7..58794e89819a241e3b407f667dd447387d5721b9 100644 (file)
@@ -356,9 +356,9 @@ void CSecurityTLS::checkSession()
   if (gnutls_x509_crt_check_hostname(crt, client->getServerName()) == 0) {
     std::string text;
     vlog.debug("hostname mismatch");
-    text = strFormat("Hostname (%s) does not match the server "
-                     "certificate, do you want to continue?",
-                     client->getServerName());
+    text = format("Hostname (%s) does not match the server "
+                  "certificate, do you want to continue?",
+                  client->getServerName());
     if (!msg->showMsgBox(UserMsgBox::M_YESNO,
                          "Certificate hostname mismatch",
                          text.c_str()))
@@ -434,16 +434,16 @@ void CSecurityTLS::checkSession()
 
     if (status & (GNUTLS_CERT_SIGNER_NOT_FOUND |
                   GNUTLS_CERT_SIGNER_NOT_CA)) {
-      text = strFormat("This certificate has been signed by an "
-                       "unknown authority:\n"
-                       "\n"
-                       "%s\n"
-                       "\n"
-                       "Someone could be trying to impersonate the "
-                       "site and you should not continue.\n"
-                       "\n"
-                       "Do you want to make an exception for this "
-                       "server?", info.data);
+      text = format("This certificate has been signed by an unknown "
+                    "authority:\n"
+                    "\n"
+                    "%s\n"
+                    "\n"
+                    "Someone could be trying to impersonate the site "
+                    "and you should not continue.\n"
+                    "\n"
+                    "Do you want to make an exception for this "
+                    "server?", info.data);
 
       if (!msg->showMsgBox(UserMsgBox::M_YESNO,
                            "Unknown certificate issuer",
@@ -452,15 +452,15 @@ void CSecurityTLS::checkSession()
     }
 
     if (status & GNUTLS_CERT_EXPIRED) {
-      text = strFormat("This certificate has expired:\n"
-                       "\n"
-                       "%s\n"
-                       "\n"
-                       "Someone could be trying to impersonate the "
-                       "site and you should not continue.\n"
-                       "\n"
-                       "Do you want to make an exception for this "
-                       "server?", info.data);
+      text = format("This certificate has expired:\n"
+                    "\n"
+                    "%s\n"
+                    "\n"
+                    "Someone could be trying to impersonate the site "
+                    "and you should not continue.\n"
+                    "\n"
+                    "Do you want to make an exception for this "
+                    "server?", info.data);
 
       if (!msg->showMsgBox(UserMsgBox::M_YESNO,
                            "Expired certificate",
@@ -475,18 +475,17 @@ void CSecurityTLS::checkSession()
 
     if (status & (GNUTLS_CERT_SIGNER_NOT_FOUND |
                   GNUTLS_CERT_SIGNER_NOT_CA)) {
-      text = strFormat("This host is previously known with a "
-                       "different certificate, and the new "
-                       "certificate has been signed by an "
-                       "unknown authority:\n"
-                       "\n"
-                       "%s\n"
-                       "\n"
-                       "Someone could be trying to impersonate the "
-                       "site and you should not continue.\n"
-                       "\n"
-                       "Do you want to make an exception for this "
-                       "server?", info.data);
+      text = format("This host is previously known with a different "
+                    "certificate, and the new certificate has been "
+                    "signed by an unknown authority:\n"
+                    "\n"
+                    "%s\n"
+                    "\n"
+                    "Someone could be trying to impersonate the site "
+                    "and you should not continue.\n"
+                    "\n"
+                    "Do you want to make an exception for this "
+                    "server?", info.data);
 
       if (!msg->showMsgBox(UserMsgBox::M_YESNO,
                            "Unexpected server certificate",
@@ -495,17 +494,17 @@ void CSecurityTLS::checkSession()
     }
 
     if (status & GNUTLS_CERT_EXPIRED) {
-      text = strFormat("This host is previously known with a "
-                       "different certificate, and the new "
-                       "certificate has expired:\n"
-                       "\n"
-                       "%s\n"
-                       "\n"
-                       "Someone could be trying to impersonate the "
-                       "site and you should not continue.\n"
-                       "\n"
-                       "Do you want to make an exception for this "
-                       "server?", info.data);
+      text = format("This host is previously known with a different "
+                    "certificate, and the new certificate has "
+                    "expired:\n"
+                    "\n"
+                    "%s\n"
+                    "\n"
+                    "Someone could be trying to impersonate the site "
+                    "and you should not continue.\n"
+                    "\n"
+                    "Do you want to make an exception for this "
+                    "server?", info.data);
 
       if (!msg->showMsgBox(UserMsgBox::M_YESNO,
                            "Unexpected server certificate",
index 398d387277a761aedd1fda722487283c27109382..dc9db9d1aa19b2147f0e103eeadb906e6fdc2466 100644 (file)
@@ -77,7 +77,7 @@ LogWriter::getLogWriter(const char* name) {
 
 bool LogWriter::setLogParams(const char* params) {
   std::vector<std::string> parts;
-  parts = strSplit(params, ':');
+  parts = split(params, ':');
   if (parts.size() != 3) {
     fprintf(stderr,"failed to parse log params:%s\n",params);
     return false;
@@ -124,7 +124,7 @@ bool LogParameter::setParam(const char* v) {
   LogWriter::setLogParams("*::0");
   StringParameter::setParam(v);
   std::vector<std::string> parts;
-  parts = strSplit(v, ',');
+  parts = split(v, ',');
   for (size_t i = 0; i < parts.size(); i++) {
     if (parts[i].empty())
         continue;
index 8bef8d8ccdbf053703ae03f5b9040b9f3ed0d9cd..5124a08ea4f0fadcdb3aa189012cf3a57269b72d 100644 (file)
@@ -47,7 +47,7 @@ bool PasswordValidator::validUser(const char* username)
 {
   std::vector<std::string> users;
 
-  users = strSplit(plainUsers, ',');
+  users = split(plainUsers, ',');
 
   for (size_t i = 0; i < users.size(); i++) {
     if (users[i] == "*")
index be07bae373ca53c1ac1377e01c3b7a79af8758fa..caf6420f62be2471a3d90a22d032a982ffec99f0 100644 (file)
@@ -207,7 +207,7 @@ std::list<uint32_t> rfb::parseSecTypes(const char* types_)
 {
   std::list<uint32_t> result;
   std::vector<std::string> types;
-  types = strSplit(types_, ',');
+  types = split(types_, ',');
   for (size_t i = 0; i < types.size(); i++) {
     uint32_t typeNum = secTypeNum(types[i].c_str());
     if (typeNum != secTypeInvalid)
index 22918cf9220262c5a91b880cfada768cadf8718c..c5c00bbdaf618d2168e4ca2d22709fb5af610e55 100644 (file)
@@ -32,7 +32,7 @@
 
 namespace rfb {
 
-  std::string strFormat(const char *fmt, ...)
+  std::string format(const char *fmt, ...)
   {
     va_list ap;
     int len;
@@ -59,8 +59,8 @@ namespace rfb {
     return out;
   }
 
-  std::vector<std::string> strSplit(const char* src,
-                                    const char delimiter)
+  std::vector<std::string> split(const char* src,
+                                 const char delimiter)
   {
     std::vector<std::string> out;
     const char *start, *stop;
index 1e59de621baa81809bae0ba3ad8441e0af2f243e..34811e3f962c3266441de17ca7f0602176110e34 100644 (file)
@@ -35,12 +35,12 @@ struct timeval;
 namespace rfb {
 
   // Formats according to printf(), with a dynamic allocation
-  std::string strFormat(const char *fmt, ...)
+  std::string format(const char *fmt, ...)
       __attribute__((__format__ (__printf__, 1, 2)));
 
   // Splits a string with the specified delimiter
-  std::vector<std::string> strSplit(const char* src,
-                                    const char delimiter);
+  std::vector<std::string> split(const char* src,
+                                 const char delimiter);
 
   // Conversion to and from a hex string
 
index 259eb76212ac90f4d05794487cddfcf4dd045510..62230b0739075c22fe3a24c1a6a7857c3f2db7cb 100644 (file)
@@ -323,7 +323,7 @@ bool rfb::win32::registerService(const char* name,
 
   // - Add the supplied extra parameters to the command line
   std::string cmdline;
-  cmdline = strFormat("\"%s\" %s", buffer.buf, defaultcmdline);
+  cmdline = format("\"%s\" %s", buffer.buf, defaultcmdline);
   for (i=0; i<argc; i++) {
     cmdline += " \"";
     cmdline += argv[i];
index 002bf2bd66b5ae139447dc1584a1a6b95ea72fd4..ed6b70cbebb770254d92d6200d720c68cec8f811 100644 (file)
@@ -74,7 +74,7 @@ const char* FileVersionInfo::getVerString(const char* name, DWORD langId) {
 
   std::string langIdStr(binToHex(langIdBuf, sizeof(langId)));
   std::string infoName;
-  infoName = strFormat("\\StringFileInfo\\%s\\%s", langIdStr.c_str(), name);
+  infoName = format("\\StringFileInfo\\%s\\%s", langIdStr.c_str(), name);
 
   // Locate the required version string within the version info
   char* buffer = 0;
index 1cf0177795c1c78fc2039e48d8853e1368fa411e..888fd77bbbda5e1c64b2cc37f82061bb4b3f4e36 100644 (file)
@@ -99,7 +99,7 @@ namespace rfb {
           SendMessage(listBox, LB_DELETESTRING, 0, 0);
 
         std::vector<std::string> hostv;
-        hostv = strSplit(hosts, ',');
+        hostv = split(hosts, ',');
         for (size_t i = 0; i < hostv.size(); i++) {
           if (!hostv[i].empty())
             SendMessage(listBox, LB_ADDSTRING, 0, (LPARAM)hostv[i].c_str());
index b21bccd753119adb8815304f7e96bbad4d793a43..7703c3a32b91bd444ce0b90406e9349421342974 100644 (file)
@@ -69,7 +69,7 @@ void LegacyPage::LoadPrefs()
             try {
               // Split the AuthHosts string into patterns to match
               std::vector<std::string> patterns;
-              patterns = rfb::strSplit(authHosts.c_str(), ':');
+              patterns = rfb::split(authHosts.c_str(), ':');
               for (size_t i = 0; i < patterns.size(); i++) {
                 if (!patterns[i].empty()) {
                   int bits = 0;
@@ -79,7 +79,7 @@ void LegacyPage::LoadPrefs()
 
                   // Split the pattern into IP address parts and process
                   std::vector<std::string> parts;
-                  parts = rfb::strSplit(&patterns[i][1], '.');
+                  parts = rfb::split(&patterns[i][1], '.');
                   for (size_t j = 0; j < parts.size(); j++) {
                     if (bits)
                       strcat(pattern, ".");
index d2a994aa2a7093a41a4631dc65c7df81a3493183..4754d7203f025d244140d6cffe97251c3a1fb932 100644 (file)
@@ -109,7 +109,7 @@ HANDLE LaunchProcessWin(DWORD /*dwSessionId*/)
     {
         ModuleFileName filename;
         std::string cmdLine;
-        cmdLine = strFormat("\"%s\" -noconsole -service_run", filename.buf);
+        cmdLine = format("\"%s\" -noconsole -service_run", filename.buf);
         STARTUPINFO si;
         ZeroMemory(&si, sizeof si);
         si.cb = sizeof si;
index 2e705bf0b22f52e2cdc523ebc1bea9753f9516cc..604df12e2d903d30979baf196547bdb0d70f5174 100644 (file)
@@ -154,9 +154,9 @@ static void processParams(int argc, char** argv) {
         runServer = false;
         std::string result;
         DWORD state = rfb::win32::getServiceState(VNCServerService::Name);
-        result = strFormat("The %s Service is in the %s state.",
-                           VNCServerService::Name,
-                           rfb::win32::serviceStateName(state));
+        result = format("The %s Service is in the %s state.",
+                        VNCServerService::Name,
+                        rfb::win32::serviceStateName(state));
         MsgBoxOrLog(result.c_str());
       } else if (strcasecmp(argv[i], "-service") == 0) {
         printf("Run in service mode\n");