CharArray somevariable = "somestring" ...are not allowed. It seems like MSVC does not correctly check accessibility for temporaries. Chapter 12.2 of ISO/IEC 14882:2003(E): > Even when the creation of the temporary object is avoided (12.8), > all the semantic restrictions must be respected as if the temporary > object was created. [Example: even if the copy constructor is not > called, all the semantic restrictions, such as accessibility > (clause 11), shall be satisfied. ] git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3344 3789f03b-4d11-0410-bbf8-ca57d06f2519tags/v0.0.90
@@ -48,7 +48,7 @@ namespace rfb { | |||
flags |= MB_TOPMOST | MB_SETFOREGROUND; | |||
int len = _tcslen(AppName.buf) + 1; | |||
if (msgType) len += _tcslen(msgType) + 3; | |||
TCharArray title = new TCHAR[len]; | |||
TCharArray title(new TCHAR[len]); | |||
_tcscpy(title.buf, AppName.buf); | |||
if (msgType) { | |||
_tcscat(title.buf, _T(" : ")); |
@@ -57,9 +57,9 @@ void RegConfig::loadRegistryConfig(RegKey& key) { | |||
DWORD i = 0; | |||
try { | |||
while (1) { | |||
TCharArray name = tstrDup(key.getValueName(i++)); | |||
TCharArray name(tstrDup(key.getValueName(i++))); | |||
if (!name.buf) break; | |||
TCharArray value = key.getRepresentation(name.buf); | |||
TCharArray value(key.getRepresentation(name.buf)); | |||
if (!value.buf || !Configuration::setParam(CStr(name.buf), CStr(value.buf))) | |||
vlog.info("unable to process %s", CStr(name.buf)); | |||
} |
@@ -175,7 +175,7 @@ TCHAR* RegKey::getString(const TCHAR* valname, const TCHAR* def) const { | |||
} | |||
void RegKey::getBinary(const TCHAR* valname, void** data, int* length) const { | |||
TCharArray hex = getRepresentation(valname); | |||
TCharArray hex(getRepresentation(valname)); | |||
if (!rdr::HexInStream::hexStrToBin(CStr(hex.buf), (char**)data, length)) | |||
throw rdr::Exception("getBinary failed"); | |||
} | |||
@@ -193,7 +193,7 @@ void RegKey::getBinary(const TCHAR* valname, void** data, int* length, void* def | |||
} | |||
int RegKey::getInt(const TCHAR* valname) const { | |||
TCharArray tmp = getRepresentation(valname); | |||
TCharArray tmp(getRepresentation(valname)); | |||
return _ttoi(tmp.buf); | |||
} | |||
int RegKey::getInt(const TCHAR* valname, int def) const { | |||
@@ -234,7 +234,7 @@ TCHAR* RegKey::getRepresentation(const TCHAR* valname) const { | |||
switch (type) { | |||
case REG_BINARY: | |||
{ | |||
TCharArray hex = rdr::HexOutStream::binToHexStr(data.buf, length); | |||
TCharArray hex(rdr::HexOutStream::binToHexStr(data.buf, length)); | |||
return hex.takeBuf(); | |||
} | |||
case REG_SZ: | |||
@@ -272,7 +272,7 @@ TCHAR* RegKey::getRepresentation(const TCHAR* valname) const { | |||
bool RegKey::isValue(const TCHAR* valname) const { | |||
try { | |||
TCharArray tmp = getRepresentation(valname); | |||
TCharArray tmp(getRepresentation(valname)); | |||
return true; | |||
} catch(rdr::Exception) { | |||
return false; |
@@ -118,7 +118,7 @@ void SDisplay::stop() | |||
// If we successfully start()ed then perform the DisconnectAction | |||
if (core) { | |||
CurrentUserToken cut; | |||
CharArray action = disconnectAction.getData(); | |||
CharArray action(disconnectAction.getData()); | |||
if (stricmp(action.buf, "Logoff") == 0) { | |||
if (!cut.h) | |||
vlog.info("ignoring DisconnectAction=Logoff - no current user"); |
@@ -534,7 +534,7 @@ bool rfb::win32::startService(const TCHAR* name) { | |||
services.openKey(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\RunServices")); | |||
// - Read the command-line from it | |||
TCharArray cmdLine = services.getString(name); | |||
TCharArray cmdLine(services.getString(name)); | |||
// - Start the service | |||
PROCESS_INFORMATION proc_info; |
@@ -63,7 +63,7 @@ const TCHAR* FileVersionInfo::getVerString(const TCHAR* name, DWORD langId) { | |||
langId = langId >> 8; | |||
} | |||
TCharArray langIdStr = rdr::HexOutStream::binToHexStr(langIdBuf, sizeof(langId)); | |||
TCharArray langIdStr(rdr::HexOutStream::binToHexStr(langIdBuf, sizeof(langId))); | |||
TCharArray infoName(_tcslen(_T("StringFileInfo")) + 4 + _tcslen(name) + _tcslen(langIdStr.buf)); | |||
_stprintf(infoName.buf, _T("\\StringFileInfo\\%s\\%s"), langIdStr.buf, name); | |||
@@ -324,7 +324,7 @@ void CConnOptions::writeToFile(const char* filename) { | |||
_T("Storing the password is more convenient but poses a security risk."), | |||
MB_YESNO | MB_DEFBUTTON2 | MB_ICONWARNING) == IDYES) { | |||
ObfuscatedPasswd obfPwd(password); | |||
CharArray obfuscatedHex = rdr::HexOutStream::binToHexStr(obfPwd.buf, obfPwd.length); | |||
CharArray obfuscatedHex(rdr::HexOutStream::binToHexStr(obfPwd.buf, obfPwd.length)); | |||
fprintf(f, "Password=%s\n", obfuscatedHex.buf); | |||
} | |||
} |
@@ -95,7 +95,7 @@ void CConnThread::run() { | |||
try { | |||
if (isConfig) { | |||
// A configuration file name was specified - load it | |||
CharArray filename = hostOrConfig.takeBuf(); | |||
CharArray filename(hostOrConfig.takeBuf()); | |||
options.readFromFile(filename.buf); | |||
} else { | |||
// An actual hostname (and possibly port) was specified |
@@ -48,9 +48,9 @@ namespace rfb { | |||
key.getBinary(_T("Order"), (void**)&order.buf, &length); | |||
for (int i=0; i<length; i++) { | |||
TCharArray keyname = rdr::HexOutStream::binToHexStr(&order.buf[i], 1); | |||
TCharArray keyname(rdr::HexOutStream::binToHexStr(&order.buf[i], 1)); | |||
try { | |||
TCharArray entry = key.getString(keyname.buf); | |||
TCharArray entry(key.getString(keyname.buf)); | |||
mru.push_back(strDup(entry.buf)); | |||
} catch (rdr::Exception) { | |||
} | |||
@@ -79,9 +79,9 @@ namespace rfb { | |||
keycode = 0; | |||
bool found = false; | |||
for (int i=0; i<orderlen; i++) { | |||
TCharArray keyname = rdr::HexOutStream::binToHexStr(&order[i], 1); | |||
TCharArray keyname(rdr::HexOutStream::binToHexStr(&order[i], 1)); | |||
try { | |||
TCharArray hostname = key.getString(keyname.buf); | |||
TCharArray hostname(key.getString(keyname.buf)); | |||
if (stricmp(name, CStr(hostname.buf)) == 0) { | |||
keycode = order[i]; | |||
found = true; | |||
@@ -119,7 +119,7 @@ namespace rfb { | |||
order[i] = order[i-1]; | |||
order[0] = keycode; | |||
TCharArray keyname = rdr::HexOutStream::binToHexStr((char*)&keycode, 1); | |||
TCharArray keyname(rdr::HexOutStream::binToHexStr((char*)&keycode, 1)); | |||
key.setString(keyname.buf, TStr(name)); | |||
key.setBinary(_T("Order"), order, orderlen); | |||
} |