@@ -133,7 +133,7 @@ + (NSArray*)genericAccountsForServiceName:(NSString*)serviceName {
133
133
struct SecKeychainAttribute attribute ;
134
134
attribute.tag = kSecServiceItemAttr ;
135
135
// Being careful here because strlen(0) causes a crash
136
- attribute.length = serviceNameC ? strlen (serviceNameC) : 0 ;
136
+ attribute.length = serviceNameC ? ( UInt32 ) strlen (serviceNameC) : 0 ;
137
137
attribute.data = (void *)serviceNameC ;
138
138
139
139
struct SecKeychainAttributeList attributeList ;
@@ -179,7 +179,7 @@ + (NSArray*)internetAccountsForHost:(NSString*)host {
179
179
struct SecKeychainAttribute attribute ;
180
180
attribute.tag = kSecServerItemAttr ;
181
181
// Being careful here because strlen(0) causes a crash
182
- attribute.length = hostC ? strlen (hostC) : 0 ;
182
+ attribute.length = hostC ? ( UInt32 ) strlen (hostC) : 0 ;
183
183
attribute.data = (void *)hostC ;
184
184
185
185
struct SecKeychainAttributeList attributeList ;
@@ -277,18 +277,18 @@ + (NSString*)internetPasswordUsername:(NSString*)username
277
277
}
278
278
279
279
const char *hostC = [hostWithSub UTF8String ] ;
280
- attribute.length = strlen (hostC) ;
280
+ attribute.length = ( UInt32 ) strlen (hostC) ;
281
281
attribute.data = (void *)hostC ;
282
282
// strlen(0) causes a crash but we've already checked that [host length] > 0
283
283
NSInteger lengthHost = hostC ? strlen (hostC) : 0 ;
284
284
285
285
OSStatus findResult = SecKeychainFindInternetPassword (
286
286
NULL , // default keychain
287
- lengthHost, // server name length
287
+ ( UInt32 ) lengthHost, // server name length
288
288
hostC, // server name
289
- lengthDomain, // security domain length
289
+ ( UInt32 ) lengthDomain, // security domain length
290
290
dom, // security domain
291
- lengthUser, // account name length
291
+ ( UInt32 ) lengthUser, // account name length
292
292
user, // account name
293
293
0 , // path length
294
294
NULL , // path
@@ -366,18 +366,18 @@ + (BOOL)addInternetPassword:(NSString*)password
366
366
NSInteger lengthNewPassword = pass ? strlen (pass) : 0 ;
367
367
OSStatus addResult = SecKeychainAddInternetPassword (
368
368
NULL , // default keychain
369
- lengthHost, // server name length
369
+ ( UInt32 ) lengthHost, // server name length
370
370
host, // server name
371
- lengthDomain, // security domain length
371
+ ( UInt32 ) lengthDomain, // security domain length
372
372
dom, // security domain
373
- lengthUser, // account name length
373
+ ( UInt32 ) lengthUser, // account name length
374
374
user, // account name
375
375
0 , // path length
376
376
NULL , // path
377
377
port, // port
378
378
kSecProtocolTypeHTTP , // protocol
379
379
kSecAuthenticationTypeHTTPBasic , // authentication type
380
- lengthNewPassword, // password length
380
+ ( UInt32 ) lengthNewPassword, // password length
381
381
pass, // password
382
382
NULL // item ref
383
383
) ;
@@ -414,15 +414,15 @@ + (NSString*)genericPasswordServiceName:(NSString*)serviceName
414
414
NSInteger accountNameLength = strlen (accountNameC) ;
415
415
416
416
const char * serviceNameC = [serviceName UTF8String ] ;
417
- attribute.length = strlen (serviceNameC) ;
417
+ attribute.length = ( UInt32 ) strlen (serviceNameC) ;
418
418
attribute.data = (void *)serviceNameC ;
419
419
NSInteger serviceNameLength = serviceNameC ? strlen (serviceNameC) : 0 ;
420
420
421
421
OSStatus findResult = SecKeychainFindGenericPassword (
422
422
NULL , // default keychain
423
- serviceNameLength, // server name length
423
+ ( UInt32 ) serviceNameLength, // server name length
424
424
serviceNameC, // service name
425
- accountNameLength, // account name length
425
+ ( UInt32 ) accountNameLength, // account name length
426
426
accountNameC, // account name
427
427
&passwordLength, // password length
428
428
&passwordC, // password
@@ -472,11 +472,11 @@ + (BOOL)addGenericPassword:(NSString*)password
472
472
NSInteger passwordLength = passwordC ? strlen (passwordC) : 0 ;
473
473
OSStatus addResult = SecKeychainAddGenericPassword (
474
474
NULL , // default keychain
475
- serviceNameLength,
475
+ ( UInt32 ) serviceNameLength,
476
476
serviceNameC,
477
- accountNameLength,
477
+ ( UInt32 ) accountNameLength,
478
478
accountNameC,
479
- passwordLength,
479
+ ( UInt32 ) passwordLength,
480
480
passwordC,
481
481
NULL
482
482
);
@@ -493,7 +493,7 @@ + (BOOL)changeKeychainItemRef:(SecKeychainItemRef)itemRef
493
493
494
494
if (password && itemRef) {
495
495
const char *pass = [password UTF8String ] ;
496
- OSErr status = SecKeychainItemModifyContent (itemRef, nil , strlen (pass), pass) ;
496
+ OSErr status = SecKeychainItemModifyContent (itemRef, nil , ( UInt32 ) strlen (pass), pass) ;
497
497
success = (status == noErr ) ;
498
498
}
499
499
0 commit comments