From db43dcdd0d589552fa9e02e4a19e43065e811be5 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 13 Aug 2012 17:48:57 +0000 Subject: [PATCH] Monotone-Parent: ded960271197442de0917fc8f66509f7377b6a75 Monotone-Revision: 62face8d68b60cbdfeed3e1857fabd32fceffb4c Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-08-13T17:48:57 Monotone-Branch: ca.inverse.sogo --- OpenChange/MAPIStoreMapping.m | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/OpenChange/MAPIStoreMapping.m b/OpenChange/MAPIStoreMapping.m index 8c7e29090..36c4dc9a3 100644 --- a/OpenChange/MAPIStoreMapping.m +++ b/OpenChange/MAPIStoreMapping.m @@ -30,6 +30,8 @@ #import +#import + #import "MAPIStoreTypes.h" #import "MAPIStoreMapping.h" @@ -209,13 +211,10 @@ MAPIStoreMappingTDBTraverse (TDB_CONTEXT *ctx, TDB_DATA data1, TDB_DATA data2, { NSArray *allKeys; NSUInteger count, max; - NSString *currentKey, *keyEnd, *newKey; - NSUInteger oldURLLength; + NSString *currentKey, *newKey; NSNumber *idKey; TDB_DATA key, dbuf; - oldURLLength = [oldURL length]; - allKeys = [reverseMapping allKeys]; max = [allKeys count]; for (count = 0; count < max; count++) @@ -223,8 +222,8 @@ MAPIStoreMappingTDBTraverse (TDB_CONTEXT *ctx, TDB_DATA data1, TDB_DATA data2, currentKey = [allKeys objectAtIndex: count]; if ([currentKey hasPrefix: oldURL]) { - keyEnd = [currentKey substringFromIndex: oldURLLength]; - newKey = [NSString stringWithFormat: @"%@%@", urlString, keyEnd]; + newKey = [currentKey stringByReplacingPrefix: oldURL + withPrefix: urlString]; idKey = [reverseMapping objectForKey: currentKey]; [mapping setObject: newKey forKey: idKey];