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-
ca57d06f2519
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(" : "));
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));
}
}
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");
}
}
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 {
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:
bool RegKey::isValue(const TCHAR* valname) const {
try {
- TCharArray tmp = getRepresentation(valname);
+ TCharArray tmp(getRepresentation(valname));
return true;
} catch(rdr::Exception) {
return false;
// 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");
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;
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);
_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);
}
}
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
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) {
}
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;
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);
}