2
0

Fix up objc code to match new C API.

This commit is contained in:
Maarten Billemont 2017-08-28 19:37:51 -04:00
parent 328d38ac19
commit 74f9f1ca00
2 changed files with 6 additions and 6 deletions

View File

@ -133,7 +133,7 @@ static NSOperationQueue *_mpwQueue = nil;
keyData = [NSData dataWithBytes:masterKey length:MPMasterKeySize]; keyData = [NSData dataWithBytes:masterKey length:MPMasterKeySize];
trc( @"User: %@, password: %@ derives to key ID: %@ (took %0.2fs)", // trc( @"User: %@, password: %@ derives to key ID: %@ (took %0.2fs)", //
fullName, masterPassword, [self keyIDForKey:masterKey], -[start timeIntervalSinceNow] ); fullName, masterPassword, [self keyIDForKey:masterKey], -[start timeIntervalSinceNow] );
mpw_free( masterKey, MPMasterKeySize ); mpw_free( &masterKey, MPMasterKeySize );
} }
}]; }];
@ -368,7 +368,7 @@ static NSOperationQueue *_mpwQueue = nil;
name.UTF8String, counter, purpose, context.UTF8String, type, parameter.UTF8String, [self version] ); name.UTF8String, counter, purpose, context.UTF8String, type, parameter.UTF8String, [self version] );
if (resultBytes) { if (resultBytes) {
result = [NSString stringWithCString:resultBytes encoding:NSUTF8StringEncoding]; result = [NSString stringWithCString:resultBytes encoding:NSUTF8StringEncoding];
mpw_free_string( resultBytes ); mpw_free_string( &resultBytes );
} }
}]; }];
@ -396,7 +396,7 @@ static NSOperationQueue *_mpwQueue = nil;
MPCounterValueInitial, MPKeyPurposeAuthentication, NULL, site.type, plainText.UTF8String, [self version] ); MPCounterValueInitial, MPKeyPurposeAuthentication, NULL, site.type, plainText.UTF8String, [self version] );
if (stateBytes) { if (stateBytes) {
state = [[NSString stringWithCString:stateBytes encoding:NSUTF8StringEncoding] decodeBase64]; state = [[NSString stringWithCString:stateBytes encoding:NSUTF8StringEncoding] decodeBase64];
mpw_free_string( stateBytes ); mpw_free_string( &stateBytes );
} }
}]; }];

View File

@ -692,7 +692,7 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted );
((MPGeneratedSiteEntity *)site).counter = importSite->counter; ((MPGeneratedSiteEntity *)site).counter = importSite->counter;
site.algorithm = MPAlgorithmForVersion( importSite->algorithm ); site.algorithm = MPAlgorithmForVersion( importSite->algorithm );
site.loginName = importSite->loginContent? @(importSite->loginContent): nil; site.loginName = importSite->loginContent? @(importSite->loginContent): nil;
site.loginGenerated = importSite->loginGenerated; site.loginGenerated = importSite->loginType & MPResultTypeClassTemplate;
site.url = importSite->url? @(importSite->url): nil; site.url = importSite->url? @(importSite->url): nil;
site.uses = importSite->uses; site.uses = importSite->uses;
site.lastUsed = [NSDate dateWithTimeIntervalSince1970:importSite->lastUsed]; site.lastUsed = [NSDate dateWithTimeIntervalSince1970:importSite->lastUsed];
@ -725,7 +725,7 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted );
site.name.UTF8String, site.type, counter, site.algorithm.version ); site.name.UTF8String, site.type, counter, site.algorithm.version );
exportSite->content = content.UTF8String; exportSite->content = content.UTF8String;
exportSite->loginContent = site.loginName.UTF8String; exportSite->loginContent = site.loginName.UTF8String;
exportSite->loginGenerated = site.loginGenerated; exportSite->loginType = site.loginGenerated? MPResultTypeTemplateName: MPResultTypeStatefulPersonal;
exportSite->url = site.url.UTF8String; exportSite->url = site.url.UTF8String;
exportSite->uses = (unsigned int)site.uses; exportSite->uses = (unsigned int)site.uses;
exportSite->lastUsed = (time_t)site.lastUsed.timeIntervalSince1970; exportSite->lastUsed = (time_t)site.lastUsed.timeIntervalSince1970;
@ -740,7 +740,7 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted );
NSString *mpsites = nil; NSString *mpsites = nil;
if (export && exportError.type == MPMarshallSuccess) if (export && exportError.type == MPMarshallSuccess)
mpsites = [NSString stringWithCString:export encoding:NSUTF8StringEncoding]; mpsites = [NSString stringWithCString:export encoding:NSUTF8StringEncoding];
mpw_free_string( export ); mpw_free_string( &export );
resultBlock( mpsites, exportError.type == MPMarshallSuccess? nil: resultBlock( mpsites, exportError.type == MPMarshallSuccess? nil:
[NSError errorWithDomain:MPErrorDomain code:MPErrorMarshallCode userInfo:@{ [NSError errorWithDomain:MPErrorDomain code:MPErrorMarshallCode userInfo:@{