summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2016-08-08 11:12:33 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2016-08-08 11:12:33 +0000
commitcbfa92e474c1885c272d3dbcf8f378a83b6b321c (patch)
tree549f114d518db1f6b9ea9bb98318e1400d2966dd
parent92d5f92156804eacbb2a779ce0098f16fe680078 (diff)
downloadVirtualBox-svn-cbfa92e474c1885c272d3dbcf8f378a83b6b321c.tar.gz
Main: warnings
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@63147 cfe28804-0f27-0410-a406-dd0f0b0b656f
-rw-r--r--include/VBox/com/AutoLock.h22
-rw-r--r--include/VBox/com/Guid.h2
-rw-r--r--include/VBox/com/microatl.h52
-rw-r--r--src/VBox/Main/glue/AutoLock.cpp16
-rw-r--r--src/VBox/Main/glue/NativeEventQueue.cpp2
-rw-r--r--src/VBox/Main/idl/apiwrap-server.xsl9
-rw-r--r--src/VBox/Main/include/AutoCaller.h2
-rw-r--r--src/VBox/Main/include/DisplayImpl.h3
-rw-r--r--src/VBox/Main/include/ExtPackManagerImpl.h7
-rw-r--r--src/VBox/Main/include/ObjectState.h3
-rw-r--r--src/VBox/Main/include/ProgressImpl.h3
-rw-r--r--src/VBox/Main/include/VirtualBoxBase.h3
-rw-r--r--src/VBox/Main/src-all/ExtPackManagerImpl.cpp15
-rw-r--r--src/VBox/Main/src-all/VirtualBoxBase.cpp2
-rw-r--r--src/VBox/Main/src-client/ConsoleImpl.cpp3
-rw-r--r--src/VBox/Main/src-client/ConsoleImpl2.cpp17
-rw-r--r--src/VBox/Main/src-client/ConsoleImplTeleporter.cpp4
-rw-r--r--src/VBox/Main/src-client/ConsoleVRDPServer.cpp6
-rw-r--r--src/VBox/Main/src-client/DisplayImpl.cpp2
-rw-r--r--src/VBox/Main/src-client/DisplayImplLegacy.cpp2
-rw-r--r--src/VBox/Main/src-client/GuestSessionImplTasks.cpp2
-rw-r--r--src/VBox/Main/src-client/KeyboardImpl.cpp2
-rw-r--r--src/VBox/Main/src-client/MachineDebuggerImpl.cpp34
-rw-r--r--src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp62
-rw-r--r--src/VBox/Main/src-server/MediumImpl.cpp46
25 files changed, 166 insertions, 155 deletions
diff --git a/include/VBox/com/AutoLock.h b/include/VBox/com/AutoLock.h
index 73d5b8b5ea9..a5e8da6108c 100644
--- a/include/VBox/com/AutoLock.h
+++ b/include/VBox/com/AutoLock.h
@@ -178,6 +178,8 @@ public:
private:
struct Data;
Data *m;
+
+ DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(RWLockHandle); /* Shuts up MSC warning C4625. */
};
/**
@@ -213,6 +215,8 @@ public:
private:
struct Data;
Data *m;
+
+ DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(WriteLockHandle); /* Shuts up MSC warning C4625. */
};
////////////////////////////////////////////////////////////////////////////////
@@ -389,6 +393,9 @@ public:
virtual void callLockImpl(LockHandle &l);
virtual void callUnlockImpl(LockHandle &l);
+
+private:
+ DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(AutoReadLock); /* Shuts up MSC warning C4625. */
};
////////////////////////////////////////////////////////////////////////////////
@@ -427,6 +434,9 @@ protected:
virtual void callLockImpl(LockHandle &l);
virtual void callUnlockImpl(LockHandle &l);
+
+private:
+ DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(AutoWriteLockBase); /* Shuts up MSC warning C4625. */
};
////////////////////////////////////////////////////////////////////////////////
@@ -562,6 +572,9 @@ public:
bool isWriteLockOnCurrentThread() const;
uint32_t writeLockLevel() const;
+
+private:
+ DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(AutoWriteLock); /* Shuts up MSC warning C4625. */
};
////////////////////////////////////////////////////////////////////////////////
@@ -588,6 +601,9 @@ public:
{
cleanup();
}
+
+private:
+ DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(AutoMultiWriteLock2); /* Shuts up MSC warning C4625. */
};
/**
@@ -610,6 +626,9 @@ public:
{
cleanup();
}
+
+private:
+ DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(AutoMultiWriteLock3); /* Shuts up MSC warning C4625. */
};
/**
@@ -634,6 +653,9 @@ public:
{
cleanup();
}
+
+private:
+ DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(AutoMultiWriteLock4); /* Shuts up MSC warning C4625. */
};
} /* namespace util */
diff --git a/include/VBox/com/Guid.h b/include/VBox/com/Guid.h
index 7710923f0bc..c2508b08dc0 100644
--- a/include/VBox/com/Guid.h
+++ b/include/VBox/com/Guid.h
@@ -323,7 +323,7 @@ public:
if (mGuidState == GUID_INVALID)
{
/* What to return in case of wrong Guid */
- return Bstr("00000000-0000-0000-0000-00000000000");
+ return Bstr("00000000-0000-0000-0000-00000000000");
}
RTUTF16 buf[RTUUID_STR_LENGTH];
diff --git a/include/VBox/com/microatl.h b/include/VBox/com/microatl.h
index a837980e3f4..b808f244bb9 100644
--- a/include/VBox/com/microatl.h
+++ b/include/VBox/com/microatl.h
@@ -30,6 +30,10 @@
#include <iprt/critsect.h>
#include <iprt/err.h>
+#include <iprt/win/windows.h>
+
+#include <new>
+
namespace ATL
{
@@ -396,21 +400,13 @@ public:
HRESULT AddTermFunc(PFNATLTERMFUNC pfn, void *pv)
{
- HRESULT hrc = S_OK;
- _ATL_TERMFUNC_ELEM *pNew = NULL;
- try
- {
- pNew = new _ATL_TERMFUNC_ELEM;
- }
- catch (...)
- {
- }
+ _ATL_TERMFUNC_ELEM *pNew = new(std::nothrow) _ATL_TERMFUNC_ELEM;
if (!pNew)
return E_OUTOFMEMORY;
pNew->pfn = pfn;
pNew->pv = pv;
CComCritSectLock<CComCriticalSection> lock(m_csStaticDataInitAndTypeInfo, false);
- hrc = lock.Lock();
+ HRESULT hrc = lock.Lock();
if (SUCCEEDED(hrc))
{
pNew->pNext = m_pTermFuncs;
@@ -644,14 +640,7 @@ public:
AssertReturn(ppv, E_POINTER);
*ppv = NULL;
HRESULT hrc = E_OUTOFMEMORY;
- T *p = NULL;
- try
- {
- p = new T(pv);
- }
- catch (...)
- {
- }
+ T *p = new(std::nothrow) T(pv);
if (p)
{
p->SetVoid(pv);
@@ -745,14 +734,7 @@ public:
*pp = NULL;
HRESULT hrc = E_OUTOFMEMORY;
- CComObjectCached<Base> *p = NULL;
- try
- {
- p = new CComObjectCached<Base>();
- }
- catch (...)
- {
- }
+ CComObjectCached<Base> *p = new(std::nothrow) CComObjectCached<Base>();
if (p)
{
p->SetVoid(NULL);
@@ -1068,14 +1050,7 @@ public:
*pp = NULL;
HRESULT hrc = E_OUTOFMEMORY;
- CComObject<Base> *p = NULL;
- try
- {
- p = new CComObject<Base>();
- }
- catch (...)
- {
- }
+ CComObject<Base> *p = new(std::nothrow) CComObject<Base>();
if (p)
{
p->InternalFinalConstructAddRef();
@@ -1221,14 +1196,7 @@ public:
*pp = NULL;
HRESULT hrc = E_OUTOFMEMORY;
- CComAggObject<Aggregated> *p = NULL;
- try
- {
- p = new CComAggObject<Aggregated>(pUnkOuter);
- }
- catch (...)
- {
- }
+ CComAggObject<Aggregated> *p = new(std::nothrow) CComAggObject<Aggregated>(pUnkOuter);
if (p)
{
p->SetVoid(NULL);
diff --git a/src/VBox/Main/glue/AutoLock.cpp b/src/VBox/Main/glue/AutoLock.cpp
index e1449217a8b..9be79e1d016 100644
--- a/src/VBox/Main/glue/AutoLock.cpp
+++ b/src/VBox/Main/glue/AutoLock.cpp
@@ -126,11 +126,11 @@ void InitAutoLockSystem()
bool AutoLockHoldsLocksInClass(VBoxLockingClass lockClass)
{
#ifdef VBOX_WITH_MAIN_LOCK_VALIDATION
- return RTLockValidatorHoldsLocksInClass(NIL_RTTHREAD,
- g_mapLockValidationClasses[lockClass]);
-#else /* !VBOX_WITH_MAIN_LOCK_VALIDATION */
+ return RTLockValidatorHoldsLocksInClass(NIL_RTTHREAD, g_mapLockValidationClasses[lockClass]);
+#else
+ RT_NOREF(lockClass);
return false;
-#endif /* !VBOX_WITH_MAIN_LOCK_VALIDATION */
+#endif
}
////////////////////////////////////////////////////////////////////////////////
@@ -401,17 +401,15 @@ struct AutoLockBase::Data
AutoLockBase::AutoLockBase(uint32_t cHandles
COMMA_LOCKVAL_SRC_POS_DECL)
{
- m = new Data(cHandles
- COMMA_LOCKVAL_SRC_POS_ARGS);
+ m = new Data(cHandles COMMA_LOCKVAL_SRC_POS_ARGS);
}
AutoLockBase::AutoLockBase(uint32_t cHandles,
LockHandle *pHandle
COMMA_LOCKVAL_SRC_POS_DECL)
{
- Assert(cHandles == 1);
- m = new Data(1
- COMMA_LOCKVAL_SRC_POS_ARGS);
+ Assert(cHandles == 1); NOREF(cHandles);
+ m = new Data(1 COMMA_LOCKVAL_SRC_POS_ARGS);
m->aHandles[0] = pHandle;
}
diff --git a/src/VBox/Main/glue/NativeEventQueue.cpp b/src/VBox/Main/glue/NativeEventQueue.cpp
index 1d381b25a92..8d1d7aad4d4 100644
--- a/src/VBox/Main/glue/NativeEventQueue.cpp
+++ b/src/VBox/Main/glue/NativeEventQueue.cpp
@@ -545,7 +545,7 @@ int NativeEventQueue::processEventQueue(RTMSINTERVAL cMsTimeout)
#else // !VBOX_WITH_XPCOM
if (cMsTimeout == RT_INDEFINITE_WAIT)
{
- BOOL fRet;
+ BOOL fRet = 0; /* Shut up MSC */
MSG Msg;
rc = VINF_SUCCESS;
while ( rc != VERR_INTERRUPTED
diff --git a/src/VBox/Main/idl/apiwrap-server.xsl b/src/VBox/Main/idl/apiwrap-server.xsl
index 85962318e25..f97b4b77ad4 100644
--- a/src/VBox/Main/idl/apiwrap-server.xsl
+++ b/src/VBox/Main/idl/apiwrap-server.xsl
@@ -178,7 +178,13 @@ public:
<xsl:template match="interface" mode="classfooter">
<xsl:param name="addinterfaces"/>
- <xsl:text>};
+ <xsl:text>
+private:
+ DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(</xsl:text>
+ <xsl:value-of select="concat(substring(@name, 2),'Wrap')"/>
+ <xsl:text>); /* Shuts up MSC warning C4625. */
+
+};
</xsl:text>
<xsl:value-of select="concat('#endif // !', substring(@name, 2), 'Wrap_H_', $G_sNewLine)"/>
@@ -1326,6 +1332,7 @@ Returns empty if not needed, non-empty ('yes') if needed. -->
<xsl:if test="$attrbasename = 'MidlDoesNotLikeEmptyInterfaces'">
<xsl:text>
#else /* dummy attribute */
+ NOREF(aMidlDoesNotLikeEmptyInterfaces);
return E_FAIL;
#endif /* dummy attribute */</xsl:text>
</xsl:if>
diff --git a/src/VBox/Main/include/AutoCaller.h b/src/VBox/Main/include/AutoCaller.h
index 4ae6912a069..f5044e9e362 100644
--- a/src/VBox/Main/include/AutoCaller.h
+++ b/src/VBox/Main/include/AutoCaller.h
@@ -246,6 +246,8 @@ public:
AutoCaller::init(aObj, true);
}
+private:
+ DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(AutoLimitedCaller); /* Shuts up MSC warning C4625. */
};
/**
diff --git a/src/VBox/Main/include/DisplayImpl.h b/src/VBox/Main/include/DisplayImpl.h
index 8cd0ce42485..f77b43ad5ce 100644
--- a/src/VBox/Main/include/DisplayImpl.h
+++ b/src/VBox/Main/include/DisplayImpl.h
@@ -503,6 +503,9 @@ private:
VIDEORECCONTEXT *mpVideoRecCtx;
bool maVideoRecEnabled[SchemaDefs::MaxGuestMonitors];
#endif
+
+private:
+ DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(Display); /* Shuts up MSC warning C4625. */
};
/* The legacy VBVA helpers. */
diff --git a/src/VBox/Main/include/ExtPackManagerImpl.h b/src/VBox/Main/include/ExtPackManagerImpl.h
index 4b8273b4ee1..df733a1a8b2 100644
--- a/src/VBox/Main/include/ExtPackManagerImpl.h
+++ b/src/VBox/Main/include/ExtPackManagerImpl.h
@@ -25,6 +25,11 @@
#include "ExtPackManagerWrap.h"
#include <iprt/fs.h>
+
+/** The name of the oracle extension back. */
+#define ORACLE_PUEL_EXTPACK_NAME "Oracle VM VirtualBox Extension Pack"
+
+
#if !defined(VBOX_COM_INPROC)
/**
* An extension pack file.
@@ -203,7 +208,7 @@ public:
void i_callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM);
HRESULT i_checkVrdeExtPack(Utf8Str const *a_pstrExtPack);
int i_getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrVrdeLibrary);
- HRESULT i_getLibraryPathForExtPack(const char *a_pszModuleName, Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrLibrary);
+ HRESULT i_getLibraryPathForExtPack(const char *a_pszModuleName, const char *a_pszExtPack, Utf8Str *a_pstrLibrary);
HRESULT i_getDefaultVrdeExtPack(Utf8Str *a_pstrExtPack);
bool i_isExtPackUsable(const char *a_pszExtPack);
void i_dumpAllToReleaseLog(void);
diff --git a/src/VBox/Main/include/ObjectState.h b/src/VBox/Main/include/ObjectState.h
index b25db6db38f..e9ca1005085 100644
--- a/src/VBox/Main/include/ObjectState.h
+++ b/src/VBox/Main/include/ObjectState.h
@@ -129,6 +129,9 @@ private:
/** Protects access to state related data members */
util::RWLockHandle mStateLock;
+
+private:
+ DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(ObjectState); /* Shuts up MSC warning C4625. */
};
#endif // !____H_OBJECTSTATE
diff --git a/src/VBox/Main/include/ProgressImpl.h b/src/VBox/Main/include/ProgressImpl.h
index 520a4eb40cf..bb6c8163a4d 100644
--- a/src/VBox/Main/include/ProgressImpl.h
+++ b/src/VBox/Main/include/ProgressImpl.h
@@ -216,6 +216,9 @@ private:
RTSEMEVENTMULTI mCompletedSem;
ULONG mWaitersCount;
+
+private:
+ DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(Progress); /* Shuts up MSC warning C4625. */
};
#endif /* ____H_PROGRESSIMPL */
diff --git a/src/VBox/Main/include/VirtualBoxBase.h b/src/VBox/Main/include/VirtualBoxBase.h
index f4418a1ecc9..2dad1a60388 100644
--- a/src/VBox/Main/include/VirtualBoxBase.h
+++ b/src/VBox/Main/include/VirtualBoxBase.h
@@ -806,6 +806,9 @@ private:
/** Slot of this object in the saFactoryStats array */
uint32_t iFactoryStat;
+
+private:
+ DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(VirtualBoxBase); /* Shuts up MSC warning C4625. */
};
/** Structure for counting the currently existing and ever created objects
diff --git a/src/VBox/Main/src-all/ExtPackManagerImpl.cpp b/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
index 177c4f031af..88b0d5eba24 100644
--- a/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
+++ b/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
@@ -1611,8 +1611,8 @@ ExtPack::i_hlpLoadHGCMService(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IConsole)
return pCon->i_hgcmLoadService(pszServiceLibrary, pszServiceName);
#else
NOREF(pHlp); NOREF(pConsole); NOREF(pszServiceLibrary); NOREF(pszServiceName);
-#endif
return VERR_INVALID_STATE;
+#endif
}
/*static*/ DECLCALLBACK(int)
@@ -1636,8 +1636,8 @@ ExtPack::i_hlpLoadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox)
return pVBox->i_loadVDPlugin(pszPluginLibrary);
#else
NOREF(pHlp); NOREF(pVirtualBox);
-#endif
return VERR_INVALID_STATE;
+#endif
}
/*static*/ DECLCALLBACK(int)
@@ -1661,8 +1661,8 @@ ExtPack::i_hlpUnloadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBo
return pVBox->i_unloadVDPlugin(pszPluginLibrary);
#else
NOREF(pHlp); NOREF(pVirtualBox);
-#endif
return VERR_INVALID_STATE;
+#endif
}
/*static*/ DECLCALLBACK(int)
@@ -3040,11 +3040,10 @@ int ExtPackManager::i_getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack,
* @returns S_OK if a path is returned, COM error status and message return if
* not.
* @param a_pszModuleName The library.
- * @param a_pstrExtPack The extension pack.
+ * @param a_pszExtPack The extension pack.
* @param a_pstrVrdeLibrary Where to return the path.
*/
-HRESULT ExtPackManager::i_getLibraryPathForExtPack(const char *a_pszModuleName, Utf8Str const *a_pstrExtPack,
- Utf8Str *a_pstrLibrary)
+HRESULT ExtPackManager::i_getLibraryPathForExtPack(const char *a_pszModuleName, const const *a_pszExtPack, Utf8Str *a_pstrLibrary)
{
AutoCaller autoCaller(this);
HRESULT hrc = autoCaller.rc();
@@ -3052,11 +3051,11 @@ HRESULT ExtPackManager::i_getLibraryPathForExtPack(const char *a_pszModuleName,
{
AutoReadLock autoLock(this COMMA_LOCKVAL_SRC_POS);
- ExtPack *pExtPack = i_findExtPack(a_pstrExtPack->c_str());
+ ExtPack *pExtPack = i_findExtPack(a_pszExtPack);
if (pExtPack)
hrc = pExtPack->i_getLibraryName(a_pszModuleName, a_pstrLibrary);
else
- hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("No extension pack by the name '%s' was found"), a_pstrExtPack->c_str());
+ hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("No extension pack by the name '%s' was found"), a_pszExtPack);
}
return hrc;
diff --git a/src/VBox/Main/src-all/VirtualBoxBase.cpp b/src/VBox/Main/src-all/VirtualBoxBase.cpp
index 9f7f3de11a4..0735bb84859 100644
--- a/src/VBox/Main/src-all/VirtualBoxBase.cpp
+++ b/src/VBox/Main/src-all/VirtualBoxBase.cpp
@@ -252,9 +252,11 @@ HRESULT VirtualBoxBase::handleUnexpectedExceptions(VirtualBoxBase *const aThis,
true /* aLogIt */);
}
+#ifndef _MSC_VER /* (unreachable) */
/* should not get here */
AssertFailed();
return E_FAIL;
+#endif
}
/**
diff --git a/src/VBox/Main/src-client/ConsoleImpl.cpp b/src/VBox/Main/src-client/ConsoleImpl.cpp
index 10a9b9b0a3a..6843459f836 100644
--- a/src/VBox/Main/src-client/ConsoleImpl.cpp
+++ b/src/VBox/Main/src-client/ConsoleImpl.cpp
@@ -10049,9 +10049,10 @@ DECLCALLBACK(int) Console::i_powerDownThread(RTTHREAD Thread, void *pvUser)
that->mControl->EndPoweringDown(S_OK, Bstr().raw());
}
- catch(const std::exception &e)
+ catch (const std::exception &e)
{
AssertMsgFailed(("Exception %s was cought, rc=%Rrc\n", e.what(), rc));
+ NOREF(e);
}
LogFlowFuncLeave();
diff --git a/src/VBox/Main/src-client/ConsoleImpl2.cpp b/src/VBox/Main/src-client/ConsoleImpl2.cpp
index 273baffb463..382371b3541 100644
--- a/src/VBox/Main/src-client/ConsoleImpl2.cpp
+++ b/src/VBox/Main/src-client/ConsoleImpl2.cpp
@@ -2499,7 +2499,8 @@ int Console::i_configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
llBootNics.push_back(nic);
/*
- * The virtual hardware type. PCNet supports two types.
+ * The virtual hardware type. PCNet supports two types, E1000 three,
+ * but VirtIO only one.
*/
switch (adapterType)
{
@@ -2518,6 +2519,9 @@ int Console::i_configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
case NetworkAdapterType_I82545EM:
InsertConfigInteger(pCfg, "AdapterType", 2);
break;
+ case NetworkAdapterType_Virtio:
+ break;
+ case NetworkAdapterType_Null: AssertFailedBreak(); /* Shut up MSC */
}
/*
@@ -2786,6 +2790,7 @@ int Console::i_configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
case AudioCodecType_AD1980:
InsertConfigString(pCfg, "Codec", "AD1980");
break;
+ default: AssertFailedBreak();
}
break;
}
@@ -2904,6 +2909,7 @@ int Console::i_configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
break;
}
#endif
+ default: AssertFailedBreak();
}
#ifdef VBOX_WITH_VRDE_AUDIO
@@ -4361,20 +4367,19 @@ int Console::i_configMedium(PCFGMNODE pLunL0,
uImage--;
# ifdef VBOX_WITH_EXTPACK
- static const Utf8Str strExtPackPuel("Oracle VM VirtualBox Extension Pack");
- static const char *s_pszVDPlugin = "VDPluginCrypt";
- if (mptrExtPackManager->i_isExtPackUsable(strExtPackPuel.c_str()))
+ if (mptrExtPackManager->i_isExtPackUsable(ORACLE_PUEL_EXTPACK_NAME))
{
/* Configure loading the VDPlugin. */
+ static const char s_szVDPlugin[] = "VDPluginCrypt";
PCFGMNODE pCfgPlugins = NULL;
PCFGMNODE pCfgPlugin = NULL;
Utf8Str strPlugin;
- hrc = mptrExtPackManager->i_getLibraryPathForExtPack(s_pszVDPlugin, &strExtPackPuel, &strPlugin);
+ hrc = mptrExtPackManager->i_getLibraryPathForExtPack(s_szVDPlugin, ORACLE_PUEL_EXTPACK_NAME, &strPlugin);
// Don't fail, this is optional!
if (SUCCEEDED(hrc))
{
InsertConfigNode(pCfg, "Plugins", &pCfgPlugins);
- InsertConfigNode(pCfgPlugins, s_pszVDPlugin, &pCfgPlugin);
+ InsertConfigNode(pCfgPlugins, s_szVDPlugin, &pCfgPlugin);
InsertConfigString(pCfgPlugin, "Path", strPlugin.c_str());
}
}
diff --git a/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp b/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp
index 59c8708d33c..df607bed1e4 100644
--- a/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp
+++ b/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp
@@ -1064,8 +1064,8 @@ HRESULT Console::i_teleporterTrg(PUVM pUVM, IMachine *pMachine, Utf8Str *pErrorM
/*
* Create the TCP server.
*/
- int vrc;
- PRTTCPSERVER hServer;
+ int vrc = VINF_SUCCESS; /* Shut up MSC */
+ PRTTCPSERVER hServer = NULL; /* ditto */
if (uPort)
vrc = RTTcpServerCreateEx(pszAddress, uPort, &hServer);
else
diff --git a/src/VBox/Main/src-client/ConsoleVRDPServer.cpp b/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
index 60218ddef73..bb727c2ffb5 100644
--- a/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
+++ b/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
@@ -200,7 +200,7 @@ static void findTopLeftBorder(const uint8_t *pu8AndMask, const uint8_t *pu8XorMa
/*
* Find the top border of the AND mask. First assign to special value.
*/
- uint32_t ySkipAnd = ~0;
+ uint32_t ySkipAnd = UINT32_MAX;
const uint8_t *pu8And = pu8AndMask;
const uint32_t cbAndRow = (width + 7) / 8;
@@ -241,7 +241,7 @@ static void findTopLeftBorder(const uint8_t *pu8AndMask, const uint8_t *pu8XorMa
/*
* Find the left border of the AND mask.
*/
- uint32_t xSkipAnd = ~0;
+ uint32_t xSkipAnd = UINT32_MAX;
/* For all bit columns. */
for (x = 0; x < width && xSkipAnd == ~(uint32_t)0; x++)
@@ -267,7 +267,7 @@ static void findTopLeftBorder(const uint8_t *pu8AndMask, const uint8_t *pu8XorMa
/*
* Find the XOR mask top border.
*/
- uint32_t ySkipXor = ~0;
+ uint32_t ySkipXor = UINT32_MAX;
uint32_t *pu32XorStart = (uint32_t *)pu8XorMask;
diff --git a/src/VBox/Main/src-client/DisplayImpl.cpp b/src/VBox/Main/src-client/DisplayImpl.cpp
index 271908a09b1..814c98a44c1 100644
--- a/src/VBox/Main/src-client/DisplayImpl.cpp
+++ b/src/VBox/Main/src-client/DisplayImpl.cpp
@@ -1525,7 +1525,7 @@ void Display::i_VideoAccelVRDP(bool fEnable)
mfVideoAccelVRDP = true;
/* Supporting all orders. */
- mfu32SupportedOrders = ~0;
+ mfu32SupportedOrders = UINT32_MAX;
i_vbvaSetMemoryFlags(pVideoAccel->pVbvaMemory, pVideoAccel->fVideoAccelEnabled, mfVideoAccelVRDP, mfu32SupportedOrders,
maFramebuffers, mcMonitors);
diff --git a/src/VBox/Main/src-client/DisplayImplLegacy.cpp b/src/VBox/Main/src-client/DisplayImplLegacy.cpp
index c2e904f2db1..1a5c770c871 100644
--- a/src/VBox/Main/src-client/DisplayImplLegacy.cpp
+++ b/src/VBox/Main/src-client/DisplayImplLegacy.cpp
@@ -677,7 +677,7 @@ int Display::i_videoAccelFlush(PPDMIDISPLAYPORT pUpPort)
for (;;)
{
VBVACMDHDR *phdr = NULL;
- uint32_t cbCmd = ~0;
+ uint32_t cbCmd = UINT32_MAX;
/* Fetch the command data. */
if (!i_vbvaFetchCmd(pVideoAccel, &phdr, &cbCmd))
diff --git a/src/VBox/Main/src-client/GuestSessionImplTasks.cpp b/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
index 99b87df6e27..8cf12a87212 100644
--- a/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
+++ b/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
@@ -343,7 +343,7 @@ int SessionTaskCopyTo::Run(void)
/*
* Query information about our destination first.
*/
- int guestRc;
+ int guestRc = VERR_IPE_UNINITIALIZED_STATUS;
if (RT_SUCCESS(rc))
{
GuestFsObjData objData;
diff --git a/src/VBox/Main/src-client/KeyboardImpl.cpp b/src/VBox/Main/src-client/KeyboardImpl.cpp
index 474e0c1240b..47bfda7f067 100644
--- a/src/VBox/Main/src-client/KeyboardImpl.cpp
+++ b/src/VBox/Main/src-client/KeyboardImpl.cpp
@@ -233,7 +233,7 @@ HRESULT Keyboard::putScancodes(const std::vector<LONG> &aScancodes,
*/
HRESULT Keyboard::putCAD()
{
- static std::vector<LONG> cadSequence;
+ std::vector<LONG> cadSequence;
cadSequence.resize(8);
cadSequence[0] = 0x1d; // Ctrl down
diff --git a/src/VBox/Main/src-client/MachineDebuggerImpl.cpp b/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
index 08f774b4af7..dc8849fbf6e 100644
--- a/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
+++ b/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
@@ -84,13 +84,13 @@ HRESULT MachineDebugger::init(Console *aParent)
for (unsigned i = 0; i < RT_ELEMENTS(maiQueuedEmExecPolicyParams); i++)
maiQueuedEmExecPolicyParams[i] = UINT8_MAX;
- mSingleStepQueued = ~0;
- mRecompileUserQueued = ~0;
- mRecompileSupervisorQueued = ~0;
- mPatmEnabledQueued = ~0;
- mCsamEnabledQueued = ~0;
- mLogEnabledQueued = ~0;
- mVirtualTimeRateQueued = ~0;
+ mSingleStepQueued = -1;
+ mRecompileUserQueued = -1;
+ mRecompileSupervisorQueued = -1;
+ mPatmEnabledQueued = -1;
+ mCsamEnabledQueued = -1;
+ mLogEnabledQueued = -1;
+ mVirtualTimeRateQueued = UINT32_MAX;
mFlushMode = false;
/* Confirm a successful initialization */
@@ -1582,10 +1582,10 @@ HRESULT MachineDebugger::getStats(const com::Utf8Str &aPattern, BOOL aWithDescri
void MachineDebugger::i_flushQueuedSettings()
{
mFlushMode = true;
- if (mSingleStepQueued != ~0)
+ if (mSingleStepQueued != -1)
{
COMSETTER(SingleStep)(mSingleStepQueued);
- mSingleStepQueued = ~0;
+ mSingleStepQueued = -1;
}
for (unsigned i = 0; i < EMEXECPOLICY_END; i++)
if (maiQueuedEmExecPolicyParams[i] != UINT8_MAX)
@@ -1593,25 +1593,25 @@ void MachineDebugger::i_flushQueuedSettings()
i_setEmExecPolicyProperty((EMEXECPOLICY)i, RT_BOOL(maiQueuedEmExecPolicyParams[i]));
maiQueuedEmExecPolicyParams[i] = UINT8_MAX;
}
- if (mPatmEnabledQueued != ~0)
+ if (mPatmEnabledQueued != -1)
{
COMSETTER(PATMEnabled)(mPatmEnabledQueued);
- mPatmEnabledQueued = ~0;
+ mPatmEnabledQueued = -1;
}
- if (mCsamEnabledQueued != ~0)
+ if (mCsamEnabledQueued != -1)
{
COMSETTER(CSAMEnabled)(mCsamEnabledQueued);
- mCsamEnabledQueued = ~0;
+ mCsamEnabledQueued = -1;
}
- if (mLogEnabledQueued != ~0)
+ if (mLogEnabledQueued != -1)
{
COMSETTER(LogEnabled)(mLogEnabledQueued);
- mLogEnabledQueued = ~0;
+ mLogEnabledQueued = -1;
}
- if (mVirtualTimeRateQueued != ~(uint32_t)0)
+ if (mVirtualTimeRateQueued != UINT32_MAX)
{
COMSETTER(VirtualTimeRate)(mVirtualTimeRateQueued);
- mVirtualTimeRateQueued = ~0;
+ mVirtualTimeRateQueued = UINT32_MAX;
}
mFlushMode = false;
}
diff --git a/src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp b/src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp
index 7cc7fbc84b5..b5ec80f6bd7 100644
--- a/src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp
+++ b/src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp
@@ -131,49 +131,41 @@ typedef FNVBOXHOSTWEBCAMLIST *PFNVBOXHOSTWEBCAMLIST;
static int loadHostWebcamLibrary(const char *pszPath, RTLDRMOD *phmod, PFNVBOXHOSTWEBCAMLIST *ppfn)
{
- int rc = VINF_SUCCESS;
- RTLDRMOD hmod = NIL_RTLDRMOD;
-
- RTERRINFOSTATIC ErrInfo;
- RTErrInfoInitStatic(&ErrInfo);
+ int rc;
if (RTPathHavePath(pszPath))
- rc = SUPR3HardenedLdrLoadPlugIn(pszPath, &hmod, &ErrInfo.Core);
- else
- rc = VERR_INVALID_PARAMETER;
- if (RT_SUCCESS(rc))
- {
- static const char *pszSymbol = "VBoxHostWebcamList";
- rc = RTLdrGetSymbol(hmod, pszSymbol, (void **)ppfn);
-
- if (RT_FAILURE(rc) && rc != VERR_SYMBOL_NOT_FOUND)
- LogRel(("Resolving symbol '%s': %Rrc\n", pszSymbol, rc));
- }
- else
{
- LogRel(("Loading the library '%s': %Rrc\n", pszPath, rc));
- if (RTErrInfoIsSet(&ErrInfo.Core))
- LogRel((" %s\n", ErrInfo.Core.pszMsg));
-
- hmod = NIL_RTLDRMOD;
- }
-
- if (RT_SUCCESS(rc))
- {
- *phmod = hmod;
+ RTLDRMOD hmod = NIL_RTLDRMOD;
+ RTERRINFOSTATIC ErrInfo;
+ rc = SUPR3HardenedLdrLoadPlugIn(pszPath, &hmod, RTErrInfoInitStatic(&ErrInfo));
+ if (RT_SUCCESS(rc))
+ {
+ static const char s_szSymbol[] = "VBoxHostWebcamList";
+ rc = RTLdrGetSymbol(hmod, s_szSymbol, (void **)ppfn);
+ if (RT_SUCCESS(rc))
+ *phmod = hmod;
+ else
+ {
+ if (rc != VERR_SYMBOL_NOT_FOUND)
+ LogRel(("Resolving symbol '%s': %Rrc\n", s_szSymbol, rc));
+ RTLdrClose(hmod);
+ hmod = NIL_RTLDRMOD;
+ }
+ }
+ else
+ {
+ LogRel(("Loading the library '%s': %Rrc\n", pszPath, rc));
+ if (RTErrInfoIsSet(&ErrInfo.Core))
+ LogRel((" %s\n", ErrInfo.Core.pszMsg));
+ }
}
else
{
- if (hmod != NIL_RTLDRMOD)
- {
- RTLdrClose(hmod);
- hmod = NIL_RTLDRMOD;
- }
+ LogRel(("Loading the library '%s': No path! Refusing to try loading it!\n", pszPath));
+ rc = VERR_INVALID_PARAMETER;
}
-
return rc;
}
-static const Utf8Str strExtPackPuel("Oracle VM VirtualBox Extension Pack");
static HRESULT fillDeviceList(VirtualBox *pVirtualBox, HostVideoInputDeviceList *pList)
{
@@ -182,7 +174,7 @@ static HRESULT fillDeviceList(VirtualBox *pVirtualBox, HostVideoInputDeviceList
#ifdef VBOX_WITH_EXTPACK
ExtPackManager *pExtPackMgr = pVirtualBox->i_getExtPackManager();
- hr = pExtPackMgr->i_getLibraryPathForExtPack("VBoxHostWebcam", &strExtPackPuel, &strLibrary);
+ hr = pExtPackMgr->i_getLibraryPathForExtPack("VBoxHostWebcam", ORACLE_PUEL_EXTPACK_NAME, &strLibrary);
#else
hr = E_NOTIMPL;
#endif
diff --git a/src/VBox/Main/src-server/MediumImpl.cpp b/src/VBox/Main/src-server/MediumImpl.cpp
index c5e823c4efb..3ab3143ef97 100644
--- a/src/VBox/Main/src-server/MediumImpl.cpp
+++ b/src/VBox/Main/src-server/MediumImpl.cpp
@@ -47,6 +47,12 @@
typedef std::list<Guid> GuidList;
+
+#ifdef VBOX_WITH_EXTPACK
+static const char g_szVDPlugin[] = "VDPluginCrypt";
+#endif
+
+
////////////////////////////////////////////////////////////////////////////////
//
// Medium data definition
@@ -3573,14 +3579,12 @@ HRESULT Medium::getEncryptionSettings(com::Utf8Str &aCipher, com::Utf8Str &aPass
throw VBOX_E_NOT_SUPPORTED;
# ifdef VBOX_WITH_EXTPACK
- static const Utf8Str strExtPackPuel("Oracle VM VirtualBox Extension Pack");
- static const char *s_pszVDPlugin = "VDPluginCrypt";
ExtPackManager *pExtPackManager = m->pVirtualBox->i_getExtPackManager();
- if (pExtPackManager->i_isExtPackUsable(strExtPackPuel.c_str()))
+ if (pExtPackManager->i_isExtPackUsable(ORACLE_PUEL_EXTPACK_NAME))
{
/* Load the plugin */
Utf8Str strPlugin;
- rc = pExtPackManager->i_getLibraryPathForExtPack(s_pszVDPlugin, &strExtPackPuel, &strPlugin);
+ rc = pExtPackManager->i_getLibraryPathForExtPack(g_szVDPlugin, ORACLE_PUEL_EXTPACK_NAME, &strPlugin);
if (SUCCEEDED(rc))
{
int vrc = VDPluginLoadFromFilename(strPlugin.c_str());
@@ -3592,12 +3596,12 @@ HRESULT Medium::getEncryptionSettings(com::Utf8Str &aCipher, com::Utf8Str &aPass
else
throw setError(VBOX_E_NOT_SUPPORTED,
tr("Encryption is not supported because the extension pack '%s' is missing the encryption plugin (old extension pack installed?)"),
- strExtPackPuel.c_str());
+ ORACLE_PUEL_EXTPACK_NAME);
}
else
throw setError(VBOX_E_NOT_SUPPORTED,
tr("Encryption is not supported because the extension pack '%s' is missing"),
- strExtPackPuel.c_str());
+ ORACLE_PUEL_EXTPACK_NAME);
PVBOXHDD pDisk = NULL;
int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &pDisk);
@@ -3651,14 +3655,12 @@ HRESULT Medium::checkEncryptionPassword(const com::Utf8Str &aPassword)
tr("The given password must not be empty"));
# ifdef VBOX_WITH_EXTPACK
- static const Utf8Str strExtPackPuel("Oracle VM VirtualBox Extension Pack");
- static const char *s_pszVDPlugin = "VDPluginCrypt";
ExtPackManager *pExtPackManager = m->pVirtualBox->i_getExtPackManager();
- if (pExtPackManager->i_isExtPackUsable(strExtPackPuel.c_str()))
+ if (pExtPackManager->i_isExtPackUsable(ORACLE_PUEL_EXTPACK_NAME))
{
/* Load the plugin */
Utf8Str strPlugin;
- rc = pExtPackManager->i_getLibraryPathForExtPack(s_pszVDPlugin, &strExtPackPuel, &strPlugin);
+ rc = pExtPackManager->i_getLibraryPathForExtPack(g_szVDPlugin, ORACLE_PUEL_EXTPACK_NAME, &strPlugin);
if (SUCCEEDED(rc))
{
int vrc = VDPluginLoadFromFilename(strPlugin.c_str());
@@ -3670,12 +3672,12 @@ HRESULT Medium::checkEncryptionPassword(const com::Utf8Str &aPassword)
else
throw setError(VBOX_E_NOT_SUPPORTED,
tr("Encryption is not supported because the extension pack '%s' is missing the encryption plugin (old extension pack installed?)"),
- strExtPackPuel.c_str());
+ ORACLE_PUEL_EXTPACK_NAME);
}
else
throw setError(VBOX_E_NOT_SUPPORTED,
tr("Encryption is not supported because the extension pack '%s' is missing"),
- strExtPackPuel.c_str());
+ ORACLE_PUEL_EXTPACK_NAME);
PVBOXHDD pDisk = NULL;
int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &pDisk);
@@ -9413,14 +9415,12 @@ HRESULT Medium::i_taskExportHandler(Medium::ExportTask &task)
settings::StringsMap::iterator itKeyId = pBase->m->mapProperties.find("CRYPT/KeyId");
#ifdef VBOX_WITH_EXTPACK
- static const Utf8Str strExtPackPuel("Oracle VM VirtualBox Extension Pack");
- static const char *s_pszVDPlugin = "VDPluginCrypt";
ExtPackManager *pExtPackManager = m->pVirtualBox->i_getExtPackManager();
- if (pExtPackManager->i_isExtPackUsable(strExtPackPuel.c_str()))
+ if (pExtPackManager->i_isExtPackUsable(ORACLE_PUEL_EXTPACK_NAME))
{
/* Load the plugin */
Utf8Str strPlugin;
- rc = pExtPackManager->i_getLibraryPathForExtPack(s_pszVDPlugin, &strExtPackPuel, &strPlugin);
+ rc = pExtPackManager->i_getLibraryPathForExtPack(g_szVDPlugin, ORACLE_PUEL_EXTPACK_NAME, &strPlugin);
if (SUCCEEDED(rc))
{
vrc = VDPluginLoadFromFilename(strPlugin.c_str());
@@ -9432,12 +9432,12 @@ HRESULT Medium::i_taskExportHandler(Medium::ExportTask &task)
else
throw setError(VBOX_E_NOT_SUPPORTED,
tr("Encryption is not supported because the extension pack '%s' is missing the encryption plugin (old extension pack installed?)"),
- strExtPackPuel.c_str());
+ ORACLE_PUEL_EXTPACK_NAME);
}
else
throw setError(VBOX_E_NOT_SUPPORTED,
tr("Encryption is not supported because the extension pack '%s' is missing"),
- strExtPackPuel.c_str());
+ ORACLE_PUEL_EXTPACK_NAME);
#else
throw setError(VBOX_E_NOT_SUPPORTED,
tr("Encryption is not supported because extension pack support is not built in"));
@@ -9895,14 +9895,12 @@ HRESULT Medium::i_taskEncryptHandler(Medium::EncryptTask &task)
try
{
# ifdef VBOX_WITH_EXTPACK
- static const Utf8Str strExtPackPuel("Oracle VM VirtualBox Extension Pack");
- static const char *s_pszVDPlugin = "VDPluginCrypt";
ExtPackManager *pExtPackManager = m->pVirtualBox->i_getExtPackManager();
- if (pExtPackManager->i_isExtPackUsable(strExtPackPuel.c_str()))
+ if (pExtPackManager->i_isExtPackUsable(ORACLE_PUEL_EXTPACK_NAME))
{
/* Load the plugin */
Utf8Str strPlugin;
- rc = pExtPackManager->i_getLibraryPathForExtPack(s_pszVDPlugin, &strExtPackPuel, &strPlugin);
+ rc = pExtPackManager->i_getLibraryPathForExtPack(g_szVDPlugin, ORACLE_PUEL_EXTPACK_NAME, &strPlugin);
if (SUCCEEDED(rc))
{
int vrc = VDPluginLoadFromFilename(strPlugin.c_str());
@@ -9914,12 +9912,12 @@ HRESULT Medium::i_taskEncryptHandler(Medium::EncryptTask &task)
else
throw setError(VBOX_E_NOT_SUPPORTED,
tr("Encryption is not supported because the extension pack '%s' is missing the encryption plugin (old extension pack installed?)"),
- strExtPackPuel.c_str());
+ ORACLE_PUEL_EXTPACK_NAME);
}
else
throw setError(VBOX_E_NOT_SUPPORTED,
tr("Encryption is not supported because the extension pack '%s' is missing"),
- strExtPackPuel.c_str());
+ ORACLE_PUEL_EXTPACK_NAME);
PVBOXHDD pDisk = NULL;
int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &pDisk);