Bug 1519636 - Initial reformat of C/C++ code with clang-format version 12.0.0. r=sylvestre

clang-format version 12.0.0 (taskcluster-KEgO7qdgQ8uaewA6NkRnRA)

Differential Revision: https://phabricator.services.mozilla.com/D114211
This commit is contained in:
Andi-Bogdan Postelnicu 2021-05-10 07:15:07 +00:00
Родитель a1f2f7329d
Коммит eab549fd19
37 изменённых файлов: 229 добавлений и 189 удалений

Просмотреть файл

@ -250,8 +250,8 @@ Maybe<int> LauncherMain(int& argc, wchar_t* argv[],
// Make sure that the launcher process itself has image load policies set
if (IsWin10AnniversaryUpdateOrLater()) {
static const StaticDynamicallyLinkedFunctionPtr<decltype(
&SetProcessMitigationPolicy)>
static const StaticDynamicallyLinkedFunctionPtr<
decltype(&SetProcessMitigationPolicy)>
pSetProcessMitigationPolicy(L"kernel32.dll",
"SetProcessMitigationPolicy");
if (pSetProcessMitigationPolicy) {

Просмотреть файл

@ -450,15 +450,16 @@ struct FullObjectStoreMetadata {
typedef nsTHashMap<nsUint64HashKey, SafeRefPtr<FullObjectStoreMetadata>>
ObjectStoreTable;
static_assert(
std::is_same_v<IndexOrObjectStoreId,
std::remove_cv_t<std::remove_reference_t<
decltype(std::declval<const ObjectStoreGetParams&>()
.objectStoreId())>>>);
static_assert(
std::is_same_v<
IndexOrObjectStoreId,
std::remove_cv_t<std::remove_reference_t<decltype(
std::declval<const ObjectStoreGetParams&>().objectStoreId())>>>);
static_assert(std::is_same_v<
IndexOrObjectStoreId,
std::remove_cv_t<std::remove_reference_t<decltype(
std::declval<const IndexGetParams&>().objectStoreId())>>>);
std::remove_cv_t<std::remove_reference_t<
decltype(std::declval<const IndexGetParams&>().objectStoreId())>>>);
struct FullDatabaseMetadata final : AtomicSafeRefCounted<FullDatabaseMetadata> {
DatabaseMetadata mCommonMetadata;
@ -20691,8 +20692,8 @@ CursorOpBaseHelperBase<CursorType>::PopulateResponseFromStatement(
// inconsistent state.
if (aInitializeResponse) {
mOp.mResponse = std::remove_reference_t<decltype(
populateResponseHelper.GetTypedResponse(&mOp.mResponse))>();
mOp.mResponse = std::remove_reference_t<
decltype(populateResponseHelper.GetTypedResponse(&mOp.mResponse))>();
}
auto& responses = populateResponseHelper.GetTypedResponse(&mOp.mResponse);

Просмотреть файл

@ -37,10 +37,12 @@ class MediaBlockCacheBase {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaBlockCacheBase)
static_assert(MediaCacheStream::BLOCK_SIZE <
static_cast<std::remove_const<decltype(
MediaCacheStream::BLOCK_SIZE)>::type>(INT32_MAX),
"MediaCacheStream::BLOCK_SIZE should fit in 31 bits");
static_assert(
MediaCacheStream::BLOCK_SIZE <
static_cast<
std::remove_const<decltype(MediaCacheStream::BLOCK_SIZE)>::type>(
INT32_MAX),
"MediaCacheStream::BLOCK_SIZE should fit in 31 bits");
static const int32_t BLOCK_SIZE = MediaCacheStream::BLOCK_SIZE;
protected:

Просмотреть файл

@ -112,13 +112,13 @@ FFmpegLibWrapper::LinkResult FFmpegLibWrapper::Link() {
#func))) { \
} \
} else { \
func = (decltype(func)) nullptr; \
func = (decltype(func))nullptr; \
}
#define AV_FUNC_OPTION(func, ver) \
AV_FUNC_OPTION_SILENT(func, ver) \
if ((ver)&version && (func) == (decltype(func)) nullptr) { \
FFMPEG_LOG("Couldn't load function " #func); \
#define AV_FUNC_OPTION(func, ver) \
AV_FUNC_OPTION_SILENT(func, ver) \
if ((ver)&version && (func) == (decltype(func))nullptr) { \
FFMPEG_LOG("Couldn't load function " #func); \
}
#define AV_FUNC(func, ver) \
@ -179,7 +179,7 @@ FFmpegLibWrapper::LinkResult FFmpegLibWrapper::Link() {
#ifdef MOZ_WAYLAND
# define VA_FUNC_OPTION_SILENT(func) \
if (!(func = (decltype(func))PR_FindSymbol(mVALib, #func))) { \
func = (decltype(func)) nullptr; \
func = (decltype(func))nullptr; \
}
// mVALib is optional and may not be present.

Просмотреть файл

@ -85,10 +85,10 @@ template <typename T, CheckingSupport = T::SupportsChecking::value>
class CheckedUnsafePtrBase;
template <typename T, typename U, typename S = std::nullptr_t>
using EnableIfCompatible =
std::enable_if_t<std::is_base_of<T, std::remove_reference_t<decltype(
*std::declval<U>())>>::value,
S>;
using EnableIfCompatible = std::enable_if_t<
std::is_base_of<
T, std::remove_reference_t<decltype(*std::declval<U>())>>::value,
S>;
template <typename T>
class CheckedUnsafePtrBase<T, CheckingSupport::Enabled>

Просмотреть файл

@ -24,19 +24,17 @@ static HMODULE gWinWebAuthnModule = 0;
static decltype(WebAuthNIsUserVerifyingPlatformAuthenticatorAvailable)*
gWinWebauthnIsUVPAA = nullptr;
static decltype(
WebAuthNAuthenticatorMakeCredential)* gWinWebauthnMakeCredential = nullptr;
static decltype(
WebAuthNFreeCredentialAttestation)* gWinWebauthnFreeCredentialAttestation =
nullptr;
static decltype(WebAuthNAuthenticatorMakeCredential)*
gWinWebauthnMakeCredential = nullptr;
static decltype(WebAuthNFreeCredentialAttestation)*
gWinWebauthnFreeCredentialAttestation = nullptr;
static decltype(WebAuthNAuthenticatorGetAssertion)* gWinWebauthnGetAssertion =
nullptr;
static decltype(WebAuthNFreeAssertion)* gWinWebauthnFreeAssertion = nullptr;
static decltype(WebAuthNGetCancellationId)* gWinWebauthnGetCancellationId =
nullptr;
static decltype(
WebAuthNCancelCurrentOperation)* gWinWebauthnCancelCurrentOperation =
nullptr;
static decltype(WebAuthNCancelCurrentOperation)*
gWinWebauthnCancelCurrentOperation = nullptr;
static decltype(WebAuthNGetErrorName)* gWinWebauthnGetErrorName = nullptr;
static decltype(WebAuthNGetApiVersionNumber)* gWinWebauthnGetApiVersionNumber =
nullptr;
@ -57,8 +55,8 @@ WinWebAuthnManager::WinWebAuthnManager() {
gWinWebAuthnModule = LoadLibrarySystem32(L"webauthn.dll");
if (gWinWebAuthnModule) {
gWinWebauthnIsUVPAA = reinterpret_cast<decltype(
WebAuthNIsUserVerifyingPlatformAuthenticatorAvailable)*>(
gWinWebauthnIsUVPAA = reinterpret_cast<
decltype(WebAuthNIsUserVerifyingPlatformAuthenticatorAvailable)*>(
GetProcAddress(
gWinWebAuthnModule,
"WebAuthNIsUserVerifyingPlatformAuthenticatorAvailable"));

Просмотреть файл

@ -993,8 +993,9 @@ already_AddRefed<Promise> ServiceWorkerGlobalScope::SkipWaiting(
}
if (ServiceWorkerParentInterceptEnabled()) {
using MozPromiseType = decltype(
mWorkerPrivate->SetServiceWorkerSkipWaitingFlag())::element_type;
using MozPromiseType =
decltype(mWorkerPrivate
->SetServiceWorkerSkipWaitingFlag())::element_type;
auto holder = MakeRefPtr<DOMMozPromiseRequestHolder<MozPromiseType>>(this);
mWorkerPrivate->SetServiceWorkerSkipWaitingFlag()

Просмотреть файл

@ -352,13 +352,15 @@ bool OSVRSession::InitState(mozilla::gfx::VRSystemState& aSystemState) {
state.eightCC = GFX_VR_EIGHTCC('O', 'S', 'V', 'R', ' ', ' ', ' ', ' ');
state.isConnected = true;
state.isMounted = false;
state.capabilityFlags = (VRDisplayCapabilityFlags)(
(int)VRDisplayCapabilityFlags::Cap_None |
(int)VRDisplayCapabilityFlags::Cap_Orientation |
(int)VRDisplayCapabilityFlags::Cap_Position |
(int)VRDisplayCapabilityFlags::Cap_External |
(int)VRDisplayCapabilityFlags::Cap_Present |
(int)VRDisplayCapabilityFlags::Cap_ImmersiveVR);
state.capabilityFlags =
(VRDisplayCapabilityFlags)((int)VRDisplayCapabilityFlags::Cap_None |
(int)
VRDisplayCapabilityFlags::Cap_Orientation |
(int)VRDisplayCapabilityFlags::Cap_Position |
(int)VRDisplayCapabilityFlags::Cap_External |
(int)VRDisplayCapabilityFlags::Cap_Present |
(int)
VRDisplayCapabilityFlags::Cap_ImmersiveVR);
state.blendMode = VRDisplayBlendMode::Opaque;
state.reportsDroppedFrames = false;
@ -412,9 +414,10 @@ bool OSVRSession::InitState(mozilla::gfx::VRSystemState& aSystemState) {
// default to an identity quaternion
VRHMDSensorState& sensorState = aSystemState.sensorState;
sensorState.flags = (VRDisplayCapabilityFlags)(
(int)VRDisplayCapabilityFlags::Cap_Orientation |
(int)VRDisplayCapabilityFlags::Cap_Position);
sensorState.flags =
(VRDisplayCapabilityFlags)((int)
VRDisplayCapabilityFlags::Cap_Orientation |
(int)VRDisplayCapabilityFlags::Cap_Position);
sensorState.pose.orientation[3] = 1.0f; // Default to an identity quaternion
return true;

Просмотреть файл

@ -1064,9 +1064,10 @@ bool OculusSession::InitState(VRSystemState& aSystemState) {
UpdateEyeParameters(aSystemState);
VRHMDSensorState& sensorState = aSystemState.sensorState;
sensorState.flags = (VRDisplayCapabilityFlags)(
(int)VRDisplayCapabilityFlags::Cap_Orientation |
(int)VRDisplayCapabilityFlags::Cap_Position);
sensorState.flags =
(VRDisplayCapabilityFlags)((int)
VRDisplayCapabilityFlags::Cap_Orientation |
(int)VRDisplayCapabilityFlags::Cap_Position);
sensorState.pose.orientation[3] = 1.0f; // Default to an identity quaternion
return true;

Просмотреть файл

@ -713,14 +713,17 @@ bool OpenVRSession::InitState(VRSystemState& aSystemState) {
state.isConnected =
mVRSystem->IsTrackedDeviceConnected(::vr::k_unTrackedDeviceIndex_Hmd);
state.isMounted = false;
state.capabilityFlags = (VRDisplayCapabilityFlags)(
(int)VRDisplayCapabilityFlags::Cap_None |
(int)VRDisplayCapabilityFlags::Cap_Orientation |
(int)VRDisplayCapabilityFlags::Cap_Position |
(int)VRDisplayCapabilityFlags::Cap_External |
(int)VRDisplayCapabilityFlags::Cap_Present |
(int)VRDisplayCapabilityFlags::Cap_StageParameters |
(int)VRDisplayCapabilityFlags::Cap_ImmersiveVR);
state.capabilityFlags =
(VRDisplayCapabilityFlags)((int)VRDisplayCapabilityFlags::Cap_None |
(int)
VRDisplayCapabilityFlags::Cap_Orientation |
(int)VRDisplayCapabilityFlags::Cap_Position |
(int)VRDisplayCapabilityFlags::Cap_External |
(int)VRDisplayCapabilityFlags::Cap_Present |
(int)VRDisplayCapabilityFlags::
Cap_StageParameters |
(int)
VRDisplayCapabilityFlags::Cap_ImmersiveVR);
state.blendMode = VRDisplayBlendMode::Opaque;
state.reportsDroppedFrames = true;
@ -729,9 +732,10 @@ bool OpenVRSession::InitState(VRSystemState& aSystemState) {
::vr::k_unTrackedDeviceIndex_Hmd, ::vr::Prop_ContainsProximitySensor_Bool,
&err);
if (err == ::vr::TrackedProp_Success && bHasProximitySensor) {
state.capabilityFlags = (VRDisplayCapabilityFlags)(
(int)state.capabilityFlags |
(int)VRDisplayCapabilityFlags::Cap_MountDetection);
state.capabilityFlags =
(VRDisplayCapabilityFlags)((int)state.capabilityFlags |
(int)VRDisplayCapabilityFlags::
Cap_MountDetection);
}
uint32_t w, h;
@ -747,9 +751,10 @@ bool OpenVRSession::InitState(VRSystemState& aSystemState) {
UpdateEyeParameters(aSystemState);
VRHMDSensorState& sensorState = aSystemState.sensorState;
sensorState.flags = (VRDisplayCapabilityFlags)(
(int)VRDisplayCapabilityFlags::Cap_Orientation |
(int)VRDisplayCapabilityFlags::Cap_Position);
sensorState.flags =
(VRDisplayCapabilityFlags)((int)
VRDisplayCapabilityFlags::Cap_Orientation |
(int)VRDisplayCapabilityFlags::Cap_Position);
sensorState.pose.orientation[3] = 1.0f; // Default to an identity quaternion
return true;
@ -878,9 +883,10 @@ void OpenVRSession::UpdateHeadsetPose(VRSystemState& aState) {
gfx::Quaternion rot;
rot.SetFromRotationMatrix(m);
aState.sensorState.flags = (VRDisplayCapabilityFlags)(
(int)aState.sensorState.flags |
(int)VRDisplayCapabilityFlags::Cap_Orientation);
aState.sensorState.flags =
(VRDisplayCapabilityFlags)((int)aState.sensorState.flags |
(int)VRDisplayCapabilityFlags::
Cap_Orientation);
aState.sensorState.pose.orientation[0] = rot.x;
aState.sensorState.pose.orientation[1] = rot.y;
aState.sensorState.pose.orientation[2] = rot.z;

Просмотреть файл

@ -135,8 +135,8 @@ void AgileReference::AssignInternal(IUnknown* aObject) {
* If that API is not available, we fall back to using the Global Interface
* Table.
*/
static const StaticDynamicallyLinkedFunctionPtr<decltype(
&::RoGetAgileReference)>
static const StaticDynamicallyLinkedFunctionPtr<
decltype(&::RoGetAgileReference)>
pRoGetAgileReference(L"ole32.dll", "RoGetAgileReference");
MOZ_ASSERT(aObject);

Просмотреть файл

@ -33,8 +33,8 @@ struct InvokeMemberFunction {
mozilla::Tuple<std::decay_t<Args>...> args;
template <class This, size_t... Indices>
auto matchInternal(This* obj, std::index_sequence<Indices...>) -> decltype(
((*obj).*(MemberFunction<This>::get()))(mozilla::Get<Indices>(args)...)) {
auto matchInternal(This* obj, std::index_sequence<Indices...>) -> decltype((
(*obj).*(MemberFunction<This>::get()))(mozilla::Get<Indices>(args)...)) {
return ((*obj).*
(MemberFunction<This>::get()))(mozilla::Get<Indices>(args)...);
}

Просмотреть файл

@ -323,8 +323,9 @@ static nscolor ExtractColor(const ComputedStyle& aStyle,
#define STYLE_FIELD(struct_, field_) aField == &struct_::field_ ||
#define STYLE_STRUCT(name_, fields_) \
template <> \
nscolor ComputedStyle::GetVisitedDependentColor(decltype( \
nsStyle##name_::MOZ_ARG_1 fields_) nsStyle##name_::*aField) const { \
nscolor ComputedStyle::GetVisitedDependentColor( \
decltype(nsStyle##name_::MOZ_ARG_1 fields_) nsStyle##name_::*aField) \
const { \
MOZ_ASSERT(MOZ_FOR_EACH(STYLE_FIELD, (nsStyle##name_, ), fields_) false, \
"Getting visited-dependent color for a field in nsStyle" #name_ \
" which is not listed in nsCSSVisitedDependentPropList.h"); \

Просмотреть файл

@ -717,7 +717,7 @@
# define MOZ_STATIC_CLASS __attribute__((annotate("moz_global_class")))
# define MOZ_STATIC_LOCAL_CLASS \
__attribute__((annotate("moz_static_local_class"))) \
__attribute__((annotate("moz_trivial_dtor")))
__attribute__((annotate("moz_trivial_dtor")))
# define MOZ_STACK_CLASS __attribute__((annotate("moz_stack_class")))
# define MOZ_NONHEAP_CLASS __attribute__((annotate("moz_nonheap_class")))
# define MOZ_HEAP_CLASS __attribute__((annotate("moz_heap_class")))
@ -757,8 +757,8 @@
# define MOZ_NO_DANGLING_ON_TEMPORARIES \
__attribute__((annotate("moz_no_dangling_on_temporaries")))
# define MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS \
__attribute__( \
(annotate("moz_inherit_type_annotations_from_template_args")))
__attribute__(( \
annotate("moz_inherit_type_annotations_from_template_args")))
# define MOZ_NON_AUTOABLE __attribute__((annotate("moz_non_autoable")))
# define MOZ_INIT_OUTSIDE_CTOR
# define MOZ_IS_CLASS_INIT
@ -781,7 +781,7 @@
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \
__attribute__((annotate("moz_heap_allocator"))) \
_Pragma("clang diagnostic pop")
_Pragma("clang diagnostic pop")
# else
# define MOZ_HEAP_ALLOCATOR __attribute__((annotate("moz_heap_allocator")))
# endif

Просмотреть файл

@ -100,11 +100,12 @@ struct outparam_as_reference<T*> {
template <typename R, template <typename> typename RArg, typename Func,
typename... Args>
using to_result_retval_t = decltype(
std::declval<Func&>()(std::declval<Args&&>()...,
std::declval<typename RArg<decltype(
ResultRefAsParam(std::declval<R&>()))>::type>()),
Result<R, nsresult>(Err(NS_ERROR_FAILURE)));
using to_result_retval_t =
decltype(std::declval<Func&>()(
std::declval<Args&&>()...,
std::declval<typename RArg<decltype(ResultRefAsParam(
std::declval<R&>()))>::type>()),
Result<R, nsresult>(Err(NS_ERROR_FAILURE)));
// There are two ToResultInvokeSelector overloads, which cover the cases of a) a
// pointer-typed output parameter, and b) a reference-typed output parameter,

Просмотреть файл

@ -256,9 +256,9 @@ struct VariantImplementation<Tag, N, T, Ts...> {
static decltype(auto) match(Matcher&& aMatcher, ConcreteVariant&& aV) {
if (aV.template is<N>()) {
if constexpr (std::is_invocable_v<Matcher, Tag,
decltype(
std::forward<ConcreteVariant>(aV)
.template as<N>())>) {
decltype(std::forward<ConcreteVariant>(
aV)
.template as<N>())>) {
return std::forward<Matcher>(aMatcher)(
Tag(N), std::forward<ConcreteVariant>(aV).template as<N>());
} else {
@ -284,9 +284,9 @@ struct VariantImplementation<Tag, N, T, Ts...> {
static decltype(auto) matchN(ConcreteVariant&& aV, Mi&& aMi, Ms&&... aMs) {
if (aV.template is<N>()) {
if constexpr (std::is_invocable_v<Mi, Tag,
decltype(
std::forward<ConcreteVariant>(aV)
.template as<N>())>) {
decltype(std::forward<ConcreteVariant>(
aV)
.template as<N>())>) {
static_assert(
std::is_same_v<
decltype(std::forward<Mi>(aMi)(

Просмотреть файл

@ -923,11 +923,10 @@ struct ProfileBufferEntryReader::Deserializer<BlocksRingBuffer> {
writer.WriteFromReader(aER, end - start);
MOZ_ASSERT(writer.RemainingBytes() == 0);
// Finally copy stats.
aBuffer.mMaybeUnderlyingBuffer->mPushedBlockCount = aER.ReadObject<decltype(
aBuffer.mMaybeUnderlyingBuffer->mPushedBlockCount)>();
aBuffer.mMaybeUnderlyingBuffer->mClearedBlockCount =
aER.ReadObject<decltype(
aBuffer.mMaybeUnderlyingBuffer->mClearedBlockCount)>();
aBuffer.mMaybeUnderlyingBuffer->mPushedBlockCount = aER.ReadObject<
decltype(aBuffer.mMaybeUnderlyingBuffer->mPushedBlockCount)>();
aBuffer.mMaybeUnderlyingBuffer->mClearedBlockCount = aER.ReadObject<
decltype(aBuffer.mMaybeUnderlyingBuffer->mClearedBlockCount)>();
}
// We cannot output a BlocksRingBuffer object (not copyable), use `ReadInto()`

Просмотреть файл

@ -53,8 +53,8 @@ struct CertContextDeleter {
struct CATAdminContextDeleter {
typedef HCATADMIN pointer;
void operator()(pointer aCtx) {
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype(
&::CryptCATAdminReleaseContext)>
static const mozilla::StaticDynamicallyLinkedFunctionPtr<
decltype(&::CryptCATAdminReleaseContext)>
pCryptCATAdminReleaseContext(L"wintrust.dll",
"CryptCATAdminReleaseContext");
@ -207,8 +207,8 @@ bool SignedBinary::VerifySignature(const wchar_t* aFilePath) {
// Windows 7 also exports the CryptCATAdminAcquireContext2 API, but it does
// *not* sign its binaries with SHA-256, so we use the old API in that case.
if (mozilla::IsWin8OrLater()) {
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype(
&::CryptCATAdminAcquireContext2)>
static const mozilla::StaticDynamicallyLinkedFunctionPtr<
decltype(&::CryptCATAdminAcquireContext2)>
pCryptCATAdminAcquireContext2(L"wintrust.dll",
"CryptCATAdminAcquireContext2");
if (!pCryptCATAdminAcquireContext2) {
@ -225,8 +225,8 @@ bool SignedBinary::VerifySignature(const wchar_t* aFilePath) {
return false;
}
} else {
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype(
&::CryptCATAdminAcquireContext)>
static const mozilla::StaticDynamicallyLinkedFunctionPtr<
decltype(&::CryptCATAdminAcquireContext)>
pCryptCATAdminAcquireContext(L"wintrust.dll",
"CryptCATAdminAcquireContext");
@ -252,8 +252,8 @@ bool SignedBinary::VerifySignature(const wchar_t* aFilePath) {
DWORD hashLen = 0;
mozilla::UniquePtr<BYTE[]> hashBuf;
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype(
&::CryptCATAdminCalcHashFromFileHandle2)>
static const mozilla::StaticDynamicallyLinkedFunctionPtr<
decltype(&::CryptCATAdminCalcHashFromFileHandle2)>
pCryptCATAdminCalcHashFromFileHandle2(
L"wintrust.dll", "CryptCATAdminCalcHashFromFileHandle2");
if (pCryptCATAdminCalcHashFromFileHandle2) {
@ -270,8 +270,8 @@ bool SignedBinary::VerifySignature(const wchar_t* aFilePath) {
return false;
}
} else {
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype(
&::CryptCATAdminCalcHashFromFileHandle)>
static const mozilla::StaticDynamicallyLinkedFunctionPtr<
decltype(&::CryptCATAdminCalcHashFromFileHandle)>
pCryptCATAdminCalcHashFromFileHandle(
L"wintrust.dll", "CryptCATAdminCalcHashFromFileHandle");
@ -295,16 +295,16 @@ bool SignedBinary::VerifySignature(const wchar_t* aFilePath) {
// Now that we've hashed the file, query the catalog system to see if any
// catalogs reference a binary with our hash.
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype(
&::CryptCATAdminEnumCatalogFromHash)>
static const mozilla::StaticDynamicallyLinkedFunctionPtr<
decltype(&::CryptCATAdminEnumCatalogFromHash)>
pCryptCATAdminEnumCatalogFromHash(L"wintrust.dll",
"CryptCATAdminEnumCatalogFromHash");
if (!pCryptCATAdminEnumCatalogFromHash) {
return false;
}
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype(
&::CryptCATAdminReleaseCatalogContext)>
static const mozilla::StaticDynamicallyLinkedFunctionPtr<
decltype(&::CryptCATAdminReleaseCatalogContext)>
pCryptCATAdminReleaseCatalogContext(L"wintrust.dll",
"CryptCATAdminReleaseCatalogContext");
if (!pCryptCATAdminReleaseCatalogContext) {
@ -326,8 +326,8 @@ bool SignedBinary::VerifySignature(const wchar_t* aFilePath) {
// We found a catalog! Now query for the path to the catalog file.
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype(
&::CryptCATCatalogInfoFromContext)>
static const mozilla::StaticDynamicallyLinkedFunctionPtr<
decltype(&::CryptCATCatalogInfoFromContext)>
pCryptCATCatalogInfoFromContext(L"wintrust.dll",
"CryptCATCatalogInfoFromContext");
if (!pCryptCATCatalogInfoFromContext) {

Просмотреть файл

@ -70,8 +70,8 @@ typedef NTSTATUS(NTAPI* LdrLoadDll_func)(PWCHAR filePath, PULONG flags,
static WindowsDllInterceptor::FuncHookType<LdrLoadDll_func> stub_LdrLoadDll;
#ifdef _M_AMD64
typedef decltype(
RtlInstallFunctionTableCallback)* RtlInstallFunctionTableCallback_func;
typedef decltype(RtlInstallFunctionTableCallback)*
RtlInstallFunctionTableCallback_func;
static WindowsDllInterceptor::FuncHookType<RtlInstallFunctionTableCallback_func>
stub_RtlInstallFunctionTableCallback;

Просмотреть файл

@ -47,8 +47,8 @@ void FallbackLoaderAPI::NotifyEndDllLoad(void* aContext, NTSTATUS aLoadNtStatus,
nt::AllocatedUnicodeString FallbackLoaderAPI::GetSectionName(
void* aSectionAddr) {
static const StaticDynamicallyLinkedFunctionPtr<decltype(
&::NtQueryVirtualMemory)>
static const StaticDynamicallyLinkedFunctionPtr<
decltype(&::NtQueryVirtualMemory)>
pNtQueryVirtualMemory(L"ntdll.dll", "NtQueryVirtualMemory");
MOZ_ASSERT(pNtQueryVirtualMemory);

Просмотреть файл

@ -38,8 +38,8 @@ NTSTATUS NTAPI NtMapViewOfSection(
NTSTATUS NTAPI NtUnmapViewOfSection(HANDLE aProcess, PVOID aBaseAddress);
static DWORD GetWin32ErrorCode(NTSTATUS aNtStatus) {
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype(
&RtlNtStatusToDosError)>
static const mozilla::StaticDynamicallyLinkedFunctionPtr<
decltype(&RtlNtStatusToDosError)>
pRtlNtStatusToDosError(L"ntdll.dll", "RtlNtStatusToDosError");
MOZ_ASSERT(!!pRtlNtStatusToDosError);
@ -107,8 +107,8 @@ MFBT_API bool UnmapRemoteViewOfFile(HANDLE aProcess, PVOID aBaseAddress) {
return !!pUnmapViewOfFile2(aProcess, aBaseAddress, 0);
}
static const StaticDynamicallyLinkedFunctionPtr<decltype(
&NtUnmapViewOfSection)>
static const StaticDynamicallyLinkedFunctionPtr<
decltype(&NtUnmapViewOfSection)>
pNtUnmapViewOfSection(L"ntdll.dll", "NtUnmapViewOfSection");
MOZ_ASSERT(!!pNtUnmapViewOfSection);

Просмотреть файл

@ -19,8 +19,8 @@ namespace mozilla {
static decltype(&::GetProcessMitigationPolicy)
FetchGetProcessMitigationPolicyFunc() {
static const StaticDynamicallyLinkedFunctionPtr<decltype(
&::GetProcessMitigationPolicy)>
static const StaticDynamicallyLinkedFunctionPtr<
decltype(&::GetProcessMitigationPolicy)>
pGetProcessMitigationPolicy(L"kernel32.dll",
"GetProcessMitigationPolicy");
return pGetProcessMitigationPolicy;

Просмотреть файл

@ -543,8 +543,8 @@ class MOZ_TRIVIAL_CTOR_DTOR MMPolicyInProcess
auto reserveWithinRangeFn =
[](HANDLE aProcess, uint32_t aSize, const uint8_t* aRangeMin,
const uint8_t* aRangeMaxExcl) -> Maybe<PVOID> {
static const StaticDynamicallyLinkedFunctionPtr<decltype(
&::VirtualAlloc2)>
static const StaticDynamicallyLinkedFunctionPtr<
decltype(&::VirtualAlloc2)>
pVirtualAlloc2(L"kernelbase.dll", "VirtualAlloc2");
if (!pVirtualAlloc2) {
return Nothing();
@ -880,8 +880,8 @@ class MMPolicyOutOfProcess : public MMPolicyBase {
[mapping = mMapping](HANDLE aProcess, uint32_t aSize,
const uint8_t* aRangeMin,
const uint8_t* aRangeMaxExcl) -> Maybe<PVOID> {
static const StaticDynamicallyLinkedFunctionPtr<decltype(
&::MapViewOfFile3)>
static const StaticDynamicallyLinkedFunctionPtr<
decltype(&::MapViewOfFile3)>
pMapViewOfFile3(L"kernelbase.dll", "MapViewOfFile3");
if (!pMapViewOfFile3) {
return Nothing();

Просмотреть файл

@ -16,8 +16,8 @@ using std::wstring;
extern "C" __declspec(dllexport) int ReturnResult() { return 2; }
static mozilla::CrossProcessDllInterceptor::FuncHookType<decltype(
&ReturnResult)>
static mozilla::CrossProcessDllInterceptor::FuncHookType<
decltype(&ReturnResult)>
gOrigReturnResult;
static int ReturnResultHook() {

Просмотреть файл

@ -69,8 +69,8 @@ extern "C" int wmain(int argc, wchar_t* argv[]) {
return 1;
}
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype(
&::GetSystemMetrics)>
static const mozilla::StaticDynamicallyLinkedFunctionPtr<
decltype(&::GetSystemMetrics)>
pRealGetSystemMetrics(L"user32.dll", "GetSystemMetrics");
if (!pRealGetSystemMetrics) {
PRINT_FAIL("Failed resolving real GetSystemMetrics pointer");

Просмотреть файл

@ -100,20 +100,25 @@ nsresult WinWifiScanner::GetAccessPointsFromWLAN(
InterfaceScanCallbackData cbData(interface_list->dwNumberOfItems);
DWORD wlanNotifySource;
if (ERROR_SUCCESS != (*mWlanLibrary->GetWlanRegisterNotificationPtr())(
mWlanLibrary->GetWLANHandle(),
WLAN_NOTIFICATION_SOURCE_ACM, TRUE,
(WLAN_NOTIFICATION_CALLBACK)OnScanComplete, &cbData,
NULL, &wlanNotifySource)) {
if (ERROR_SUCCESS !=
(*mWlanLibrary
->GetWlanRegisterNotificationPtr())(mWlanLibrary->GetWLANHandle(),
WLAN_NOTIFICATION_SOURCE_ACM,
TRUE,
(WLAN_NOTIFICATION_CALLBACK)
OnScanComplete,
&cbData, NULL,
&wlanNotifySource)) {
return NS_ERROR_FAILURE;
}
// Go through the list of interfaces and call `WlanScan` on each
for (unsigned int i = 0; i < interface_list->dwNumberOfItems; ++i) {
if (ERROR_SUCCESS != (*mWlanLibrary->GetWlanScanPtr())(
mWlanLibrary->GetWLANHandle(),
&interface_list->InterfaceInfo[i].InterfaceGuid,
NULL, NULL, NULL)) {
if (ERROR_SUCCESS !=
(*mWlanLibrary->GetWlanScanPtr())(mWlanLibrary->GetWLANHandle(),
&interface_list->InterfaceInfo[i]
.InterfaceGuid,
NULL, NULL, NULL)) {
cbData.OnInterfaceScanComplete();
}
}
@ -133,14 +138,17 @@ nsresult WinWifiScanner::GetAccessPointsFromWLAN(
// Go through the list of interfaces and get the data for each.
for (uint32_t i = 0; i < interface_list->dwNumberOfItems; ++i) {
WLAN_BSS_LIST* bss_list;
if (ERROR_SUCCESS != (*mWlanLibrary->GetWlanGetNetworkBssListPtr())(
mWlanLibrary->GetWLANHandle(),
&interface_list->InterfaceInfo[i].InterfaceGuid,
nullptr, // Use all SSIDs.
DOT11_BSS_TYPE_UNUSED,
false, // bSecurityEnabled - unused
nullptr, // reserved
&bss_list)) {
if (ERROR_SUCCESS !=
(*mWlanLibrary
->GetWlanGetNetworkBssListPtr())(mWlanLibrary->GetWLANHandle(),
&interface_list->InterfaceInfo[i]
.InterfaceGuid,
nullptr, // Use all SSIDs.
DOT11_BSS_TYPE_UNUSED,
false, // bSecurityEnabled -
// unused
nullptr, // reserved
&bss_list)) {
continue;
}

Просмотреть файл

@ -56,8 +56,8 @@ static void SetQueryKeyInt64(const nsCString& aValue,
Int64QuerySetter setter);
// options setters
typedef decltype(
&nsINavHistoryQueryOptions::SetExpandQueries) BoolOptionsSetter;
typedef decltype(&nsINavHistoryQueryOptions::SetExpandQueries)
BoolOptionsSetter;
typedef decltype(&nsINavHistoryQueryOptions::SetMaxResults) Uint32OptionsSetter;
typedef decltype(&nsINavHistoryQueryOptions::SetResultType) Uint16OptionsSetter;
static void SetOptionsKeyBool(const nsCString& aValue,

Просмотреть файл

@ -248,8 +248,9 @@ static int BuildImportTable(PMEMORYMODULE module) {
if (directory->Size > 0) {
PIMAGE_IMPORT_DESCRIPTOR importDesc =
(PIMAGE_IMPORT_DESCRIPTOR)(codeBase + directory->VirtualAddress);
PIMAGE_IMPORT_DESCRIPTOR importEnd = (PIMAGE_IMPORT_DESCRIPTOR)(
codeBase + directory->VirtualAddress + directory->Size);
PIMAGE_IMPORT_DESCRIPTOR importEnd =
(PIMAGE_IMPORT_DESCRIPTOR)(codeBase + directory->VirtualAddress +
directory->Size);
for (; importDesc < importEnd && importDesc->Name; importDesc++) {
POINTER_TYPE* thunkRef;

Просмотреть файл

@ -313,8 +313,8 @@ void TryInitGnome() {
_gnome_program_init_fn gnome_program_init =
(_gnome_program_init_fn)(dlsym(gnomeLib, "gnome_program_init"));
_libgnomeui_module_info_get_fn libgnomeui_module_info_get =
(_libgnomeui_module_info_get_fn)(
dlsym(gnomeuiLib, "libgnomeui_module_info_get"));
(_libgnomeui_module_info_get_fn)(dlsym(gnomeuiLib,
"libgnomeui_module_info_get"));
if (gnome_program_init && libgnomeui_module_info_get) {
gnome_program_init("crashreporter", "1.0", libgnomeui_module_info_get(),

Просмотреть файл

@ -58,8 +58,8 @@ typedef struct _FILE_ID_INFO {
#if defined(_X86_)
# define SAFECALL_URLMON_FUNC(FuncName, ...) \
do { \
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype( \
&::FuncName)> \
static const mozilla::StaticDynamicallyLinkedFunctionPtr< \
decltype(&::FuncName)> \
func(L"urlmon.dll", #FuncName); \
hr = \
func ? func(__VA_ARGS__) : HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND); \
@ -186,8 +186,8 @@ class WindowsError final {
}
static DWORD NtStatusToWin32Error(NTSTATUS aNtStatus) {
static const StaticDynamicallyLinkedFunctionPtr<decltype(
&RtlNtStatusToDosError)>
static const StaticDynamicallyLinkedFunctionPtr<
decltype(&RtlNtStatusToDosError)>
pRtlNtStatusToDosError(L"ntdll.dll", "RtlNtStatusToDosError");
MOZ_ASSERT(!!pRtlNtStatusToDosError);

Просмотреть файл

@ -107,9 +107,10 @@ AsyncColorChooser::Run() {
mozilla::AutoRestore<AsyncColorChooser*> restoreColorChooser(gColorChooser);
gColorChooser = this;
AutoDestroyTmpWindow adtw((HWND)(
mParentWidget.get() ? mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW)
: nullptr));
AutoDestroyTmpWindow adtw(
(HWND)(mParentWidget.get()
? mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW)
: nullptr));
CHOOSECOLOR options;
options.lStructSize = sizeof(options);

Просмотреть файл

@ -158,9 +158,10 @@ bool nsFilePicker::ShowFolderPicker(const nsString& aInitialDir) {
}
}
AutoDestroyTmpWindow adtw((HWND)(
mParentWidget.get() ? mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW)
: nullptr));
AutoDestroyTmpWindow adtw(
(HWND)(mParentWidget.get()
? mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW)
: nullptr));
// display
mozilla::BackgroundHangMonitor().NotifyWait();
@ -320,9 +321,10 @@ bool nsFilePicker::ShowFilePicker(const nsString& aInitialDir) {
// display
{
AutoDestroyTmpWindow adtw((HWND)(
mParentWidget.get() ? mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW)
: nullptr));
AutoDestroyTmpWindow adtw(
(HWND)(mParentWidget.get()
? mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW)
: nullptr));
AutoWidgetPickerState awps(mParentWidget);
mozilla::BackgroundHangMonitor().NotifyWait();

Просмотреть файл

@ -959,8 +959,8 @@ nsresult nsSystemInfo::Init() {
}
# endif // __MINGW32__
mozilla::DynamicallyLinkedFunctionPtr<decltype(
&IsUserCetAvailableInEnvironment)>
mozilla::DynamicallyLinkedFunctionPtr<
decltype(&IsUserCetAvailableInEnvironment)>
isUserCetAvailable(L"api-ms-win-core-sysinfo-l1-2-6.dll",
"IsUserCetAvailableInEnvironment");
bool hasUserCET = isUserCetAvailable &&

Просмотреть файл

@ -228,51 +228,64 @@ class MasterList {
if (aOp & mozilla::IOInterposeObserver::OpCreateOrOpen) {
VectorRemove(newLists->mCreateObservers, aObserver);
if (newLists->mCreateObservers.empty()) {
mObservedOperations = (mozilla::IOInterposeObserver::Operation)(
mObservedOperations &
~mozilla::IOInterposeObserver::OpCreateOrOpen);
mObservedOperations =
(mozilla::IOInterposeObserver::
Operation)(mObservedOperations &
~mozilla::IOInterposeObserver::OpCreateOrOpen);
}
}
if (aOp & mozilla::IOInterposeObserver::OpRead) {
VectorRemove(newLists->mReadObservers, aObserver);
if (newLists->mReadObservers.empty()) {
mObservedOperations = (mozilla::IOInterposeObserver::Operation)(
mObservedOperations & ~mozilla::IOInterposeObserver::OpRead);
mObservedOperations =
(mozilla::IOInterposeObserver::
Operation)(mObservedOperations &
~mozilla::IOInterposeObserver::OpRead);
}
}
if (aOp & mozilla::IOInterposeObserver::OpWrite) {
VectorRemove(newLists->mWriteObservers, aObserver);
if (newLists->mWriteObservers.empty()) {
mObservedOperations = (mozilla::IOInterposeObserver::Operation)(
mObservedOperations & ~mozilla::IOInterposeObserver::OpWrite);
mObservedOperations =
(mozilla::IOInterposeObserver::
Operation)(mObservedOperations &
~mozilla::IOInterposeObserver::OpWrite);
}
}
if (aOp & mozilla::IOInterposeObserver::OpFSync) {
VectorRemove(newLists->mFSyncObservers, aObserver);
if (newLists->mFSyncObservers.empty()) {
mObservedOperations = (mozilla::IOInterposeObserver::Operation)(
mObservedOperations & ~mozilla::IOInterposeObserver::OpFSync);
mObservedOperations =
(mozilla::IOInterposeObserver::
Operation)(mObservedOperations &
~mozilla::IOInterposeObserver::OpFSync);
}
}
if (aOp & mozilla::IOInterposeObserver::OpStat) {
VectorRemove(newLists->mStatObservers, aObserver);
if (newLists->mStatObservers.empty()) {
mObservedOperations = (mozilla::IOInterposeObserver::Operation)(
mObservedOperations & ~mozilla::IOInterposeObserver::OpStat);
mObservedOperations =
(mozilla::IOInterposeObserver::
Operation)(mObservedOperations &
~mozilla::IOInterposeObserver::OpStat);
}
}
if (aOp & mozilla::IOInterposeObserver::OpClose) {
VectorRemove(newLists->mCloseObservers, aObserver);
if (newLists->mCloseObservers.empty()) {
mObservedOperations = (mozilla::IOInterposeObserver::Operation)(
mObservedOperations & ~mozilla::IOInterposeObserver::OpClose);
mObservedOperations =
(mozilla::IOInterposeObserver::
Operation)(mObservedOperations &
~mozilla::IOInterposeObserver::OpClose);
}
}
if (aOp & mozilla::IOInterposeObserver::OpNextStage) {
VectorRemove(newLists->mStageObservers, aObserver);
if (newLists->mStageObservers.empty()) {
mObservedOperations = (mozilla::IOInterposeObserver::Operation)(
mObservedOperations & ~mozilla::IOInterposeObserver::OpNextStage);
mObservedOperations =
(mozilla::IOInterposeObserver::
Operation)(mObservedOperations &
~mozilla::IOInterposeObserver::OpNextStage);
}
}
mObserverLists = newLists;

Просмотреть файл

@ -870,11 +870,11 @@ TEST(TArray, RemoveLastElements_One)
ASSERT_EQ((nsTArray<int>{1, 2, 3}), array);
}
static_assert(std::is_copy_assignable<decltype(
MakeBackInserter(std::declval<nsTArray<int>&>()))>::value,
static_assert(std::is_copy_assignable<decltype(MakeBackInserter(
std::declval<nsTArray<int>&>()))>::value,
"output iteraror must be copy-assignable");
static_assert(std::is_copy_constructible<decltype(
MakeBackInserter(std::declval<nsTArray<int>&>()))>::value,
static_assert(std::is_copy_constructible<decltype(MakeBackInserter(
std::declval<nsTArray<int>&>()))>::value,
"output iterator must be copy-constructible");
TEST(TArray, MakeBackInserter)

Просмотреть файл

@ -1004,8 +1004,8 @@ class MozPromise : public MozPromiseBase {
}
template <typename... Ts>
auto Then(Ts&&... aArgs) -> decltype(
std::declval<PromiseType>().Then(std::forward<Ts>(aArgs)...)) {
auto Then(Ts&&... aArgs) -> decltype(std::declval<PromiseType>().Then(
std::forward<Ts>(aArgs)...)) {
return static_cast<RefPtr<PromiseType>>(*this)->Then(
std::forward<Ts>(aArgs)...);
}

Просмотреть файл

@ -637,8 +637,9 @@ already_AddRefed<mozilla::CancelableRunnable> NS_NewCancelableRunnableFunction(
const char* aName, Function&& aFunc) {
class FuncCancelableRunnable final : public mozilla::CancelableRunnable {
public:
static_assert(std::is_void_v<decltype(
std::declval<std::remove_reference_t<Function>>()())>);
static_assert(
std::is_void_v<
decltype(std::declval<std::remove_reference_t<Function>>()())>);
NS_INLINE_DECL_REFCOUNTING_INHERITED(FuncCancelableRunnable,
CancelableRunnable)
@ -1111,8 +1112,9 @@ struct ParameterStorage
};
template <class T>
static auto HasSetDeadlineTest(int) -> SFINAE1True<decltype(
std::declval<T>().SetDeadline(std::declval<mozilla::TimeStamp>()))>;
static auto HasSetDeadlineTest(int)
-> SFINAE1True<decltype(std::declval<T>().SetDeadline(
std::declval<mozilla::TimeStamp>()))>;
template <class T>
static auto HasSetDeadlineTest(long) -> std::false_type;