]> source.dussan.org Git - tigervnc.git/commitdiff
MinGW tweak: Constructs such as:
authorPeter Åstrand <astrand@cendio.se>
Tue, 9 Dec 2008 14:57:53 +0000 (14:57 +0000)
committerPeter Åstrand <astrand@cendio.se>
Tue, 9 Dec 2008 14:57:53 +0000 (14:57 +0000)
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

win/rfb_win32/MsgBox.h
win/rfb_win32/RegConfig.cxx
win/rfb_win32/Registry.cxx
win/rfb_win32/SDisplay.cxx
win/rfb_win32/Service.cxx
win/rfb_win32/Win32Util.cxx
win/vncviewer/CConnOptions.cxx
win/vncviewer/CConnThread.cxx
win/vncviewer/MRU.h

index 59571395cb4e9a204e64ecd20ec485dc89d796f0..918a909f881c522beaeb48b786d51730b1b2d2d8 100644 (file)
@@ -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(" : "));
index dd1c3b0604152f9970bf7eeae3cdbd3b04b5efcd..ff944518d4855dd6743858c25e43a575969224fc 100644 (file)
@@ -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));
     }
index 1a828edf36d09b4a7b6462962f51e66e7e4e7553..4f073f470ce8d503397e17d29c1cfaf979079df7 100644 (file)
@@ -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;
index 0af50649054781663fd4ec59e201050e94e1b41f..f14b49f11e113aa6eab3244868a739e44d37afbf 100644 (file)
@@ -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");
index 2b11a22d65d13c97926aabca7d14a4432d08bd63..a24b651c18ec73190517d132f2c25ad1f6ef0502 100644 (file)
@@ -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;
index 2e17100c779eaaf728d074fd5eee43d9b5a01b5d..5c283dfafa915795e3e2edafbe619e937273e788 100644 (file)
@@ -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);
 
index ea0941e5b09f931a857d67feb533da017f02f2cc..6069e95268c5c3c3e1019e323d127bf0d14ea6c7 100644 (file)
@@ -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);
       }
     }
index cfd269522f3c0c353ceed79fd8552f4a8fb6640d..0767ffcd1d7de048d8d3dfc47c4158df7e087a64 100644 (file)
@@ -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
index ae703b3a1469d7f1de5bb48b62e83538b3c3bb9d..fd9bf71c4a877782dbc33b8de041c59e278b99d0 100644 (file)
@@ -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);
       }