/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Macros for adding a blocklist item to the static list. _EXT variants // allow one to specify all available parameters, including those available // only on specific platforms (e.g. desktop environment and driver vendor // for Linux.)
// Whether the mDevices array should be deleted when this structure is // deallocated. False by default. bool mDeleteDevices;
/* A feature from nsIGfxInfo, or a wildcard set of features */
int32_t mFeature; /* Block all features */ static constexpr int32_t allFeatures = -1; /* Block all features not permitted by OnlyAllowFeatureOnKnownConfig */ static constexpr int32_t optionalFeatures = -2;
/* A feature status from nsIGfxInfo */
int32_t mFeatureStatus;
VersionComparisonOp mComparisonOp;
/* versions are assumed to be A.B.C.D packed as 0xAAAABBBBCCCCDDDD */
uint64_t mDriverVersion;
uint64_t mDriverVersionMax; static constexpr uint64_t allDriverVersions = ~(uint64_t(0));
inline uint64_t V(uint32_t a, uint32_t b, uint32_t c, uint32_t d) { #ifdef XP_WIN // We make sure every driver number is padded by 0s, this will allow us the // easiest 'compare as if decimals' approach. See ParseDriverVersion for a // more extensive explanation of this approach. while (b > 0 && b < 1000) {
b *= 10;
} while (c > 0 && c < 1000) {
c *= 10;
} while (d > 0 && d < 1000) {
d *= 10;
} #endif return DriverVersion(a, b, c, d);
}
// All destination string storage needs to have at least 5 bytes available. inlinebool SplitDriverVersion(constchar* aSource, char* aAStr, char* aBStr, char* aCStr, char* aDStr) { // sscanf doesn't do what we want here to we parse this manually. int len = strlen(aSource);
// This "4" is hardcoded in a few places, including once as a 3. char* dest[4] = {aAStr, aBStr, aCStr, aDStr}; unsigned destIdx = 0; unsigned destPos = 0;
for (int i = 0; i < len; i++) { if (destIdx >= 4) { // Invalid format found. Ensure we don't access dest beyond bounds. returnfalse;
}
// This allows us to pad driver version 'substrings' with 0s, this // effectively allows us to treat the version numbers as 'decimals'. This is // a little strange but this method seems to do the right thing for all // different vendor's driver strings. i.e. .98 will become 9800, which is // larger than .978 which would become 9780. inlinevoid PadDriverDecimal(char* aString) { for (int i = 0; i < 4; i++) { if (!aString[i]) { for (int c = i; c < 4; c++) {
aString[c] = '0';
} break;
}
}
aString[4] = 0;
}
#ifndef ANDROID int a, b, c, d; char aStr[8], bStr[8], cStr[8], dStr[8]; /* honestly, why do I even bother */ if (!SplitDriverVersion(NS_LossyConvertUTF16toASCII(aVersion).get(), aStr,
bStr, cStr, dStr)) returnfalse;
a = atoi(aStr);
b = atoi(bStr);
c = atoi(cStr);
d = atoi(dStr);
if (a < 0 || a > 0xffff) returnfalse; if (b < 0 || b > 0xffff) returnfalse; if (c < 0 || c > 0xffff) returnfalse; if (d < 0 || d > 0xffff) returnfalse;
*aNumericVersion = DriverVersion(a, b, c, d); #else // Can't use aVersion.ToInteger() because that's not compiled into our code // unless we have XPCOM_GLUE_AVOID_NSPR disabled.
*aNumericVersion = atoi(NS_LossyConvertUTF16toASCII(aVersion).get()); #endif
MOZ_ASSERT(*aNumericVersion != GfxDriverInfo::allDriverVersions); returntrue;
}
} // namespace widget
} // namespace mozilla
#endif/*__mozilla_widget_GfxDriverInfo_h__ */
¤ Dauer der Verarbeitung: 0.18 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.