Monotone-Parent: c61e2dc9a2d1575387224156c338b5517bdcbae1

Monotone-Revision: f878485f243e179600dcdcf48b5dffc712d954ca

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2012-08-21T20:39:46
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2012-08-21 20:39:46 +00:00
parent f1c5ee15b7
commit 54434e9896
2 changed files with 34 additions and 0 deletions

View File

@ -45,6 +45,8 @@
+ (id) dataWithChangeKeyGUID: (NSString *) guidString
andCnt: (NSData *) globCnt;
- (void) hexDumpWithLineSize: (NSUInteger) lineSize;
@end
@interface NSMutableData (MAPIStoreDataTypes)

View File

@ -20,6 +20,8 @@
* Boston, MA 02111-1307, USA.
*/
#import <NGExtensions/NSObject+Logs.h>
#import "NSString+MAPIStore.h"
#import "NSData+MAPIStore.h"
@ -185,6 +187,36 @@ static void _fillFlatUIDWithGUID (struct FlatUID_r *flatUID, const struct GUID *
return changeKey;
}
- (void) hexDumpWithLineSize: (NSUInteger) lineSize
{
const char *bytes;
NSUInteger lineCount, count, max, charCount, charMax;
NSMutableString *line;
bytes = [self bytes];
max = [self length];
lineCount = 0;
for (count = 0; count < max; count++)
{
line = [NSMutableString stringWithFormat: @"%d: ", lineCount];
if (lineSize)
{
if ((max - count) > lineSize)
charMax = lineSize;
else
charMax = max - count;
}
else
charMax = max;
for (charCount = 0; charCount < charMax; charCount++)
[line appendFormat: @" %.2x", *(bytes + count + charCount)];
[self logWithFormat: @" %@", line];
count += charMax;
lineCount++;
}
}
@end
@implementation NSMutableData (MAPIStoreDataTypes)