本文整理汇总了C++中mozilla::PodEqual方法的典型用法代码示例。如果您正苦于以下问题:C++ mozilla::PodEqual方法的具体用法?C++ mozilla::PodEqual怎么用?C++ mozilla::PodEqual使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mozilla
的用法示例。
在下文中一共展示了mozilla::PodEqual方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PodEqual
/* static */ bool
InefficientNonFlatteningStringHashPolicy::match(const JSString *const &k, const Lookup &l)
{
// We can't use js::EqualStrings, because that flattens our strings.
if (k->length() != l->length())
return false;
const jschar *c1;
ScopedJSFreePtr<jschar> ownedChars1;
if (k->hasPureChars()) {
c1 = k->pureChars();
} else {
if (!k->copyNonPureChars(/* tcx */ nullptr, ownedChars1))
MOZ_CRASH("oom");
c1 = ownedChars1;
}
const jschar *c2;
ScopedJSFreePtr<jschar> ownedChars2;
if (l->hasPureChars()) {
c2 = l->pureChars();
} else {
if (!l->copyNonPureChars(/* tcx */ nullptr, ownedChars2))
MOZ_CRASH("oom");
c2 = ownedChars2;
}
return PodEqual(c1, c2, k->length());
}
示例2: PodEqual
/* static */ bool
IteratorHashPolicy::match(PropertyIteratorObject* obj, const Lookup& lookup)
{
NativeIterator* ni = obj->getNativeIterator();
if (ni->guard_key != lookup.key || ni->guard_length != lookup.numGuards)
return false;
return PodEqual(reinterpret_cast<ReceiverGuard*>(ni->guard_array), lookup.guards,
ni->guard_length);
}
示例3: if
static void
finalize_str(const JSStringFinalizer* fin, char16_t* chars)
{
if (chars && PodEqual(const_cast<const char16_t*>(chars), arr, arrlen)) {
if (fin == &finalizer1) {
++finalized1;
} else if (fin == &finalizer2) {
++finalized2;
}
}
}
示例4: ReportOutOfMemory
static bool
VersionCheck(XDRState<mode>* xdr)
{
JS::BuildIdCharVector buildId;
if (!xdr->cx()->buildIdOp() || !xdr->cx()->buildIdOp()(&buildId)) {
JS_ReportErrorNumber(xdr->cx(), GetErrorMessage, nullptr, JSMSG_BUILD_ID_NOT_AVAILABLE);
return false;
}
MOZ_ASSERT(!buildId.empty());
uint32_t buildIdLength;
if (mode == XDR_ENCODE)
buildIdLength = buildId.length();
if (!xdr->codeUint32(&buildIdLength))
return false;
if (mode == XDR_DECODE && buildIdLength != buildId.length()) {
JS_ReportErrorNumber(xdr->cx(), GetErrorMessage, nullptr, JSMSG_BAD_BUILD_ID);
return false;
}
if (mode == XDR_ENCODE) {
if (!xdr->codeBytes(buildId.begin(), buildIdLength))
return false;
} else {
JS::BuildIdCharVector decodedBuildId;
// buildIdLength is already checked against the length of current
// buildId.
if (!decodedBuildId.resize(buildIdLength)) {
ReportOutOfMemory(xdr->cx());
return false;
}
if (!xdr->codeBytes(decodedBuildId.begin(), buildIdLength))
return false;
if (!PodEqual(decodedBuildId.begin(), buildId.begin(), buildIdLength)) {
// We do not provide binary compatibility with older scripts.
JS_ReportErrorNumber(xdr->cx(), GetErrorMessage, nullptr, JSMSG_BAD_BUILD_ID);
return false;
}
}
return true;
}