示例#1
0
bool CssmDbAttributeData::operator <(const CssmDbAttributeData &other) const
{
	if (info() < other.info()) return true;
	if (other.info() < info()) return false;

	uint32 minSize = min(size(), other.size());
	for (uint32 ix = 0; ix < minSize; ++ix)
	{
		if (at<const CssmData &>(ix) < other.at<const CssmData &>(ix))
			return true;
		if (other.at<const CssmData &>(ix) < at<const CssmData &>(ix))
			return false;
	}

	return size() < other.size();
}
示例#2
0
void CssmDbAttributeData::copyValues(const CssmDbAttributeData &source, Allocator &alloc)
{
	assert(size() == 0);	// must start out empty

	// we're too lazy to arrange for exception safety here
	CssmData *vector = alloc.alloc<CssmData>(source.size());
	for (uint32 n = 0; n < source.size(); n++)
		vector[n] = CssmAutoData(alloc, source[n]).release();

	// atomic set results
	info().format(source.info().format());
	NumberOfValues = source.size();
	values() = vector;
}