//
#include "MetaRecord.h"
+#include <Security/trackingallocator.h>
MetaRecord::MetaRecord(CSSM_DB_RECORDTYPE inRecordType) :
mRecordType(inRecordType)
const CSSM_DB_SCHEMA_ATTRIBUTE_INFO *inAttributeInfo) :
mRecordType(inRelationID)
{
- // XXX Is there any particular reason not to allow this?
-#if 0
- if (inNumberOfAttributes == 0 || inAttributeInfo == NULL)
- CssmError::throwMe(CSSMERR_DL_UNSUPPORTED_NUM_ATTRIBUTES);
-#endif
-
try {
for (uint32 anIndex = 0; anIndex < inNumberOfAttributes; anIndex++)
{
void
MetaRecord::setRecordAttributeInfo(const CSSM_DB_RECORD_ATTRIBUTE_INFO &inInfo)
{
- // XXX Is there any particular reason not to allow this?
-#if 0
- if (inInfo.NumberOfAttributes == 0 || inInfo.AttributeInfo == NULL)
- CssmError::throwMe(CSSMERR_DL_UNSUPPORTED_NUM_ATTRIBUTES);
-#endif
-
for (uint32 anIndex = 0; anIndex < inInfo.NumberOfAttributes; anIndex++)
{
switch (inInfo.AttributeInfo[anIndex].AttributeNameFormat)
// Return the index (0 though NumAttributes - 1) of the attribute
// represented by inAttributeInfo
+
+#ifndef NDEBUG
+#define LOG_NAME_AS_STRING_FAIL
+#endif
uint32
MetaRecord::attributeIndex(const CSSM_DB_ATTRIBUTE_INFO &inAttributeInfo) const
{
case CSSM_DB_ATTRIBUTE_NAME_AS_STRING:
{
string aName(inAttributeInfo.Label.AttributeName);
+ assert(aName.size() < 500); // MDS leak debug
NameStringMap::const_iterator it = mNameStringMap.find(aName);
- if (it == mNameStringMap.end())
+ if (it == mNameStringMap.end()) {
+ #ifdef LOG_NAME_AS_STRING_FAIL
+ printf("NAME_AS_STRING failure; attrName %s\n",
+ inAttributeInfo.Label.AttributeName);
+ for(it = mNameStringMap.begin();
+ it != mNameStringMap.end();
+ it++) {
+ printf("name %s val %lu\n", it->first.c_str(), it->second);
+ }
+ #endif
CssmError::throwMe(CSSMERR_DL_INVALID_FIELD_NAME);
+ }
anIndex = it->second;
break;
}