ensure that shifted property ids are correctly "masked" to 16-bit integers

This commit is contained in:
Wolfgang Sourdeau
2012-10-10 08:42:44 -04:00
parent b56bc29237
commit ad2b5fe413
3 changed files with 29 additions and 24 deletions
+5 -1
View File
@@ -104,11 +104,15 @@ static Class NSArrayK;
{
BOOL listedProperties[65536];
NSUInteger count;
uint16_t propId;
memset (listedProperties, NO, 65536 * sizeof (BOOL));
[super getAvailableProperties: propertiesP inMemCtx: memCtx];
for (count = 0; count < (*propertiesP)->cValues; count++)
listedProperties[(*propertiesP)->aulPropTag[count] >> 16] = YES;
{
propId = ((*propertiesP)->aulPropTag[count] >> 16) & 0xffff;
listedProperties[propId] = YES;
}
[MAPIStoreAppointmentWrapper fillAvailableProperties: *propertiesP
withExclusions: listedProperties];
+17 -16
View File
@@ -209,7 +209,7 @@ static Class NSExceptionK, MAPIStoreFolderK;
BOOL canGetProperty;
NSUInteger count, max;
propValue = (propTag & 0xffff0000) >> 16;
propValue = (propTag >> 16) & 0xffff;
canGetProperty = (classGetters[propValue]
|| [properties objectForKey: MAPIPropertyKey (propTag)]);
@@ -336,19 +336,19 @@ static Class NSExceptionK, MAPIStoreFolderK;
operations. If they need to be set (move operations), the caller will need
to take care of them. */
exclusions = talloc_array (memCtx, bool, 65536);
exclusions[PidTagRowType >> 16] = true;
exclusions[PidTagInstanceKey >> 16] = true;
exclusions[PidTagInstanceNum >> 16] = true;
exclusions[PidTagInstID >> 16] = true;
exclusions[PidTagAttachNumber >> 16] = true;
exclusions[PidTagFolderId >> 16] = true;
exclusions[PidTagMid >> 16] = true;
exclusions[PidTagSourceKey >> 16] = true;
exclusions[PidTagParentSourceKey >> 16] = true;
exclusions[PidTagParentFolderId >> 16] = true;
exclusions[PidTagChangeKey >> 16] = true;
exclusions[PidTagChangeNumber >> 16] = true;
exclusions[PidTagPredecessorChangeList >> 16] = true;
exclusions[(PidTagRowType >> 16) & 0xffff] = true;
exclusions[(PidTagInstanceKey >> 16) & 0xffff] = true;
exclusions[(PidTagInstanceNum >> 16) & 0xffff] = true;
exclusions[(PidTagInstID >> 16) & 0xffff] = true;
exclusions[(PidTagAttachNumber >> 16) & 0xffff] = true;
exclusions[(PidTagFolderId >> 16) & 0xffff] = true;
exclusions[(PidTagMid >> 16) & 0xffff] = true;
exclusions[(PidTagSourceKey >> 16) & 0xffff] = true;
exclusions[(PidTagParentSourceKey >> 16) & 0xffff] = true;
exclusions[(PidTagParentFolderId >> 16) & 0xffff] = true;
exclusions[(PidTagChangeKey >> 16) & 0xffff] = true;
exclusions[(PidTagChangeNumber >> 16) & 0xffff] = true;
exclusions[(PidTagPredecessorChangeList >> 16) & 0xffff] = true;
row.cValues = 0;
row.lpProps = talloc_array (memCtx, struct SPropValue, 65535);
@@ -356,12 +356,13 @@ static Class NSExceptionK, MAPIStoreFolderK;
for (count = 0; count < availableProps->cValues; count++)
{
propTag = availableProps->aulPropTag[count];
if (!exclusions[propTag >> 16])
if (!exclusions[(propTag >> 16) & 0xffff])
{
error = [self getProperty: &data withTag: propTag inMemCtx: memCtx];
if (error == MAPISTORE_SUCCESS && data)
{
set_SPropValue_proptag (row.lpProps + row.cValues, propTag, data);
set_SPropValue_proptag (row.lpProps + row.cValues, propTag,
data);
row.cValues++;
}
}
+7 -7
View File
@@ -186,7 +186,7 @@ MAPIStoreTallocWrapperDestroy (void *data)
const MAPIStorePropertyGetter *classGetters;
NSUInteger count;
enum MAPITAGS propTag;
uint16_t propValue;
uint16_t propId;
properties = talloc_zero (memCtx, struct SPropTagArray);
properties->aulPropTag = talloc_array (properties, enum MAPITAGS,
@@ -195,8 +195,8 @@ MAPIStoreTallocWrapperDestroy (void *data)
for (count = 0; count < MAPIStoreSupportedPropertiesCount; count++)
{
propTag = MAPIStoreSupportedProperties[count];
propValue = (propTag & 0xffff0000) >> 16;
if (classGetters[propValue])
propId = (propTag >> 16) & 0xffff;
if (classGetters[propId])
{
properties->aulPropTag[properties->cValues] = propTag;
properties->cValues++;
@@ -220,7 +220,7 @@ MAPIStoreTallocWrapperDestroy (void *data)
[self getAvailableProperties: &subProperties inMemCtx: localMemCtx];
for (count = 0; count < subProperties->cValues; count++)
{
propId = (subProperties->aulPropTag[count] >> 16);
propId = (subProperties->aulPropTag[count] >> 16) & 0xffff;
if (!exclusions[propId])
{
properties->aulPropTag[properties->cValues]
@@ -259,13 +259,13 @@ MAPIStoreTallocWrapperDestroy (void *data)
- (BOOL) canGetProperty: (enum MAPITAGS) propTag
{
uint16_t propValue;
uint16_t propId;
const IMP *classGetters;
classGetters = (IMP *) MAPIStorePropertyGettersForClass (isa);
propValue = (propTag & 0xffff0000) >> 16;
propId = (propTag >> 16) & 0xffff;
return (classGetters[propValue] != NULL);
return (classGetters[propId] != NULL);
}
@end