Browse Source

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.
tags/v1.13.90
Pierre Ossman 1 year ago
parent
commit
fd243a8d3a

+ 2
- 2
common/network/TcpSocket.cxx View 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");


+ 1
- 1
common/rfb/CSecurityRSAAES.cxx View 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\". "

+ 44
- 45
common/rfb/CSecurityTLS.cxx View 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",

+ 2
- 2
common/rfb/LogWriter.cxx View 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;

+ 1
- 1
common/rfb/SSecurityPlain.cxx View 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] == "*")

+ 1
- 1
common/rfb/Security.cxx View 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)

+ 3
- 3
common/rfb/util.cxx View 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;

+ 3
- 3
common/rfb/util.h View 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


+ 1
- 1
win/rfb_win32/Service.cxx View 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];

+ 1
- 1
win/rfb_win32/Win32Util.cxx View 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;

+ 1
- 1
win/vncconfig/Connections.h View 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());

+ 2
- 2
win/vncconfig/Legacy.cxx View 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, ".");

+ 1
- 1
win/winvnc/VNCServerService.cxx View 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;

+ 3
- 3
win/winvnc/winvnc.cxx View 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");

Loading…
Cancel
Save