From de8b85b643ac08d69696ad078846424b69ae651f Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Fri, 27 Mar 2015 23:30:10 +0100 Subject: Fix next round of warning types This change fixes the following warnings: 1) Assignment in a condition should be wrapped in () 2) Priority of && / || should be indicated by parentheses. 3) Unknown #pragma optimize ifdefed out for non MSVC 4) Unused functions deleted or put under #ifdef 5) Extra tokens warning disabling moved to the CMakeLists.txt in the src/inc 6) Self assignment of a member or local variable 7) Assigning ~0 to a bitfield member that was just 8 bit wide It also fixes a bug in the STRESS_LOGxx macro invocation in exceptionhandling.cpp and stackwalk.cpp related to recent adding the DBG_ADDR macro usage. This macro expanded a single parameter into two expressions to extract high / low 32 bits separately. But the STRESS_LOGxx parameters are passed to the StressLog::LogMsg method as follows: (void*)(size_t)(data1) That means that the expanded pair x, y would be inserted as data 1 and that leads to ignoring the x due to the comma operator. --- src/binder/applicationcontext.cpp | 86 +----------------------------------- src/binder/assemblybinder.cpp | 63 +------------------------- src/binder/textualidentityparser.cpp | 13 ------ src/binder/variables.cpp | 2 + 4 files changed, 5 insertions(+), 159 deletions(-) (limited to 'src/binder') diff --git a/src/binder/applicationcontext.cpp b/src/binder/applicationcontext.cpp index 8aadd409c0..d560a1d3d1 100644 --- a/src/binder/applicationcontext.cpp +++ b/src/binder/applicationcontext.cpp @@ -32,88 +32,6 @@ namespace BINDER_SPACE { - namespace - { - void CopyIntoBuffer(/* in */ SBuffer *pPropertyValue, - /* in */ LPVOID pvValue, - /* in */ DWORD cbValue) - { - _ASSERTE(pPropertyValue != NULL); - - BYTE *pRawBuffer = pPropertyValue->OpenRawBuffer(cbValue); - - memcpy(pRawBuffer, pvValue, cbValue); - pPropertyValue->CloseRawBuffer(); - } - - const void *GetRawBuffer(SBuffer *pPropertyValue) - { - _ASSERTE(pPropertyValue != NULL); - - // SBuffer provides const void *() operator - const void *pPropertyRawBuffer = *pPropertyValue; - - _ASSERTE(pPropertyRawBuffer != NULL); - _ASSERTE(pPropertyRawBuffer != pPropertyValue); - - return pPropertyRawBuffer; - } - - HRESULT CheckRequiredBufferSize(/* in */ SBuffer *pPropertyValue, - /* in */ LPVOID pvValue, - /* in, out */ LPDWORD pcbValue) - { - _ASSERTE(pPropertyValue != NULL); - - HRESULT hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - DWORD cbPropertySize = static_cast(pPropertyValue->GetSize()); - - if (pcbValue == NULL) - { - hr = E_INVALIDARG; - } - else if ((cbPropertySize <= *pcbValue) && (pvValue != NULL)) - { - *pcbValue = cbPropertySize; - hr = S_OK; - } - else - { - *pcbValue = cbPropertySize; - } - - return hr; - } - - HRESULT CopyTextPropertyIntoBuffer(/* in */ SBuffer *pPropertyValue, - /* out */ LPWSTR wzPropertyBuffer, - /* in, out */ DWORD *pdwPropertyBufferSize) - { - HRESULT hr = S_OK; - void *pvValue = static_cast(wzPropertyBuffer); - DWORD cbValue = *pdwPropertyBufferSize * sizeof(WCHAR); - - if ((hr = CheckRequiredBufferSize(pPropertyValue, pvValue, &cbValue)) == S_OK) - { - memcpy(pvValue, GetRawBuffer(pPropertyValue), cbValue); - } - - // Adjust byte size to character count - _ASSERTE(cbValue % sizeof(WCHAR) == 0); - *pdwPropertyBufferSize = cbValue / sizeof(WCHAR); - - return hr; - } - - BOOL EndsWithPathSeparator(/* in */ PathString &path) - { - SString winDirSeparor(SString::Literal, W("\\")); - SString unixDirSeparor(SString::Literal, W("/")); - - return (path.EndsWith(winDirSeparor) || path.EndsWith(unixDirSeparor)); - } - }; - STDMETHODIMP ApplicationContext::QueryInterface(REFIID riid, void **ppv) { @@ -407,8 +325,8 @@ namespace BINDER_SPACE // we encounter a native image. Since we don't touch IL in the presence of // native images, we replace the IL entry with the NI. // - if (pExistingEntry->m_wszILFileName != nullptr && !isNativeImage || - pExistingEntry->m_wszNIFileName != nullptr && isNativeImage) + if ((pExistingEntry->m_wszILFileName != nullptr && !isNativeImage) || + (pExistingEntry->m_wszNIFileName != nullptr && isNativeImage)) { BINDER_LOG_STRING(W("ApplicationContext::SetupBindingPaths: Skipping TPA entry because of already existing IL/NI entry for short name "), fileName.GetUnicode()); continue; diff --git a/src/binder/assemblybinder.cpp b/src/binder/assemblybinder.cpp index 308e1229df..89a3c0fb3f 100644 --- a/src/binder/assemblybinder.cpp +++ b/src/binder/assemblybinder.cpp @@ -469,66 +469,6 @@ namespace BINDER_SPACE Exit: return hr; } - - // Host assembly "equivalence" relation - HRESULT IsValidHostAssembly(AssemblyName *pProposedAssemblyName, - AssemblyName *pRequestedAssemblyName, - VersionMatchMode versionMatchMode, - BOOL fRequireHigherSV, - BOOL *pFIsValidHostAssembly) - { - HRESULT hr = S_OK; - - AssemblyVersion *pProposedVersion = pProposedAssemblyName->GetVersion(); - AssemblyVersion *pRequestedVersion = pRequestedAssemblyName->GetVersion(); - - if (pProposedVersion->IsEqualFeatureVersion(pRequestedVersion)) - { - if (fRequireHigherSV) - { - *pFIsValidHostAssembly = - pProposedVersion->IsLargerServiceVersion(pRequestedVersion); - } - else if (versionMatchMode == kVersionExact) - { - *pFIsValidHostAssembly = - pProposedVersion->IsEqualServiceVersion(pRequestedVersion); - } - else - { - *pFIsValidHostAssembly = - (pProposedVersion->IsLargerServiceVersion(pRequestedVersion) || - pProposedVersion->IsEqualServiceVersion(pRequestedVersion)); - } - } - else if ((versionMatchMode == kVersionFeatureRollForward) && - (pProposedVersion->IsLargerFeatureVersion(pRequestedVersion))) - { - *pFIsValidHostAssembly = TRUE; - } - else - { - *pFIsValidHostAssembly = FALSE; - } - - return hr; - } - - inline DWORD BindingStoreEnumToDWORD(INT32 kBindingStore) - { - switch (kBindingStore) - { - case 0: - return kBindingStoreGAC; - case 1: - return kBindingStoreManifest; - case 2: - return kBindingStoreHost; - default: - _ASSERTE(0); - return 0; - } - } }; /* static */ @@ -700,8 +640,7 @@ namespace BINDER_SPACE #ifdef FEATURE_VERSIONING_LOG hr = LogBindResult(pApplicationContext, hr, &bindResult); #else // FEATURE_VERSIONING_LOG - // Shut up GCC - hr = hr; + ; #endif // FEATURE_VERSIONING_LOG #ifndef CROSSGEN_COMPILE diff --git a/src/binder/textualidentityparser.cpp b/src/binder/textualidentityparser.cpp index e1ca4a53f5..2162629d93 100644 --- a/src/binder/textualidentityparser.cpp +++ b/src/binder/textualidentityparser.cpp @@ -189,19 +189,6 @@ namespace BINDER_SPACE return NULL; } - BOOL ValidateAndConvertContentType( - SString & ssContentType, - AssemblyContentType * pkContentType) - { - if (EqualsCaseInsensitive(ssContentType, W("WindowsRuntime"))) - { - *pkContentType = AssemblyContentType_WindowsRuntime; - return TRUE; - } - - return FALSE; - } - LPCWSTR ContentTypeToString(AssemblyContentType kContentType) { _ASSERTE(kContentType != AssemblyContentType_Default); diff --git a/src/binder/variables.cpp b/src/binder/variables.cpp index c2915244fc..b2c56550e1 100644 --- a/src/binder/variables.cpp +++ b/src/binder/variables.cpp @@ -19,6 +19,7 @@ namespace BINDER_SPACE { +#ifdef FEATURE_VERSIONING_LOG namespace { HRESULT CheckFileExistence(LPCWSTR pwzFile, LPDWORD pdwAttrib) @@ -51,6 +52,7 @@ namespace BINDER_SPACE return hr; } }; +#endif // FEATURE_VERSIONING_LOG Variables *g_BinderVariables = NULL; -- cgit v1.2.3