aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2023-01-23 20:15:28 +0100
committerPierre Ossman <ossman@cendio.se>2023-02-04 14:03:13 +0100
commitfd243a8d3ae8e776fb2af1136feee7f8c083d2da (patch)
tree71cd7b2fcac7d398154afe58a579d87d7fadf9bd
parent3143bfa1545c2aa70781c5c780df7e66f123614f (diff)
downloadtigervnc-fd243a8d3ae8e776fb2af1136feee7f8c083d2da.tar.gz
tigervnc-fd243a8d3ae8e776fb2af1136feee7f8c083d2da.zip
Remove "str" prefix from string helpers
This matches the naming in STL, which is what we are mostly mimicing now that we are using std::string for these functions.
-rw-r--r--common/network/TcpSocket.cxx4
-rw-r--r--common/rfb/CSecurityRSAAES.cxx2
-rw-r--r--common/rfb/CSecurityTLS.cxx89
-rw-r--r--common/rfb/LogWriter.cxx4
-rw-r--r--common/rfb/SSecurityPlain.cxx2
-rw-r--r--common/rfb/Security.cxx2
-rw-r--r--common/rfb/util.cxx6
-rw-r--r--common/rfb/util.h6
-rw-r--r--win/rfb_win32/Service.cxx2
-rw-r--r--win/rfb_win32/Win32Util.cxx2
-rw-r--r--win/vncconfig/Connections.h2
-rw-r--r--win/vncconfig/Legacy.cxx4
-rw-r--r--win/winvnc/VNCServerService.cxx2
-rw-r--r--win/winvnc/winvnc.cxx6
14 files changed, 66 insertions, 67 deletions
diff --git a/common/network/TcpSocket.cxx b/common/network/TcpSocket.cxx
index 87f2e757..462b8a7b 100644
--- a/common/network/TcpSocket.cxx
+++ b/common/network/TcpSocket.cxx
@@ -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");
diff --git a/common/rfb/CSecurityRSAAES.cxx b/common/rfb/CSecurityRSAAES.cxx
index 24d1a9fe..bff088ad 100644
--- a/common/rfb/CSecurityRSAAES.cxx
+++ b/common/rfb/CSecurityRSAAES.cxx
@@ -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\". "
diff --git a/common/rfb/CSecurityTLS.cxx b/common/rfb/CSecurityTLS.cxx
index 92a89193..58794e89 100644
--- a/common/rfb/CSecurityTLS.cxx
+++ b/common/rfb/CSecurityTLS.cxx
@@ -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",
diff --git a/common/rfb/LogWriter.cxx b/common/rfb/LogWriter.cxx
index 398d3872..dc9db9d1 100644
--- a/common/rfb/LogWriter.cxx
+++ b/common/rfb/LogWriter.cxx
@@ -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;
diff --git a/common/rfb/SSecurityPlain.cxx b/common/rfb/SSecurityPlain.cxx
index 8bef8d8c..5124a08e 100644
--- a/common/rfb/SSecurityPlain.cxx
+++ b/common/rfb/SSecurityPlain.cxx
@@ -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] == "*")
diff --git a/common/rfb/Security.cxx b/common/rfb/Security.cxx
index be07bae3..caf6420f 100644
--- a/common/rfb/Security.cxx
+++ b/common/rfb/Security.cxx
@@ -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)
diff --git a/common/rfb/util.cxx b/common/rfb/util.cxx
index 22918cf9..c5c00bbd 100644
--- a/common/rfb/util.cxx
+++ b/common/rfb/util.cxx
@@ -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;
diff --git a/common/rfb/util.h b/common/rfb/util.h
index 1e59de62..34811e3f 100644
--- a/common/rfb/util.h
+++ b/common/rfb/util.h
@@ -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
diff --git a/win/rfb_win32/Service.cxx b/win/rfb_win32/Service.cxx
index 259eb762..62230b07 100644
--- a/win/rfb_win32/Service.cxx
+++ b/win/rfb_win32/Service.cxx
@@ -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];
diff --git a/win/rfb_win32/Win32Util.cxx b/win/rfb_win32/Win32Util.cxx
index 002bf2bd..ed6b70cb 100644
--- a/win/rfb_win32/Win32Util.cxx
+++ b/win/rfb_win32/Win32Util.cxx
@@ -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;
diff --git a/win/vncconfig/Connections.h b/win/vncconfig/Connections.h
index 1cf01777..888fd77b 100644
--- a/win/vncconfig/Connections.h
+++ b/win/vncconfig/Connections.h
@@ -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());
diff --git a/win/vncconfig/Legacy.cxx b/win/vncconfig/Legacy.cxx
index b21bccd7..7703c3a3 100644
--- a/win/vncconfig/Legacy.cxx
+++ b/win/vncconfig/Legacy.cxx
@@ -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, ".");
diff --git a/win/winvnc/VNCServerService.cxx b/win/winvnc/VNCServerService.cxx
index d2a994aa..4754d720 100644
--- a/win/winvnc/VNCServerService.cxx
+++ b/win/winvnc/VNCServerService.cxx
@@ -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;
diff --git a/win/winvnc/winvnc.cxx b/win/winvnc/winvnc.cxx
index 2e705bf0..604df12e 100644
--- a/win/winvnc/winvnc.cxx
+++ b/win/winvnc/winvnc.cxx
@@ -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");