Monotone-Parent: e5b39af7159de417e83ca1ca334d629ee570f716

Monotone-Revision: 14df382f39f38461d724751dad6ea4e1e8ee57c7

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2012-03-12T05:55:26
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2012-03-12 05:55:26 +00:00
parent c529220318
commit d4b80cbc6a
3 changed files with 36 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2012-03-12 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreTypes.m (MAPICNCompare): new function that
returns an NSComparisonResult for two change numbers (reverse
format).
2012-03-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreCalendarMessage.m

View File

@ -42,6 +42,8 @@ id NSObjectFromSPropValue (const struct SPropValue *);
id NSObjectFromMAPISPropValue (const struct mapi_SPropValue *);
id NSObjectFromValuePointer (enum MAPITAGS, const void *);
NSComparisonResult MAPICNCompare (uint64_t cn1, uint64_t cn2);
static inline NSNumber *
MAPIPropertyKey (enum MAPITAGS propTag)
{

View File

@ -270,6 +270,34 @@ NSObjectFromValuePointer (enum MAPITAGS propTag, const void *data)
return result;
}
static uint64_t
_reverseCN (uint64_t cn)
{
return ((cn & 0x00000000000000ffL) << 56
| (cn & 0x000000000000ff00L) << 40
| (cn & 0x0000000000ff0000L) << 24
| (cn & 0x00000000ff000000L) << 8
| (cn & 0x000000ff00000000L) >> 8
| (cn & 0x0000ff0000000000L) >> 24
| (cn & 0x00ff000000000000L) >> 40
| (cn & 0xff00000000000000L) >> 56);
}
NSComparisonResult
MAPICNCompare (uint64_t cn1, uint64_t cn2)
{
NSComparisonResult result;
if (cn1 == cn2)
result = NSOrderedSame;
else if (_reverseCN (cn1) < _reverseCN (cn2))
result = NSOrderedAscending;
else
result = NSOrderedDescending;
return result;
}
void
MAPIStoreDumpMessageProperties (NSDictionary *properties)
{