Index: crypto/mock_keychain_mac.cc |
=================================================================== |
--- crypto/mock_keychain_mac.cc (revision 147091) |
+++ crypto/mock_keychain_mac.cc (working copy) |
@@ -92,7 +92,7 @@ |
return &(attribute_list.attr[attribute_index]); |
} |
-void MockKeychain::SetTestDataBytes(int item, |
+void MockKeychain::SetTestDataBytes(unsigned int item, |
UInt32 tag, |
const void* data, |
size_t length) { |
@@ -110,25 +110,27 @@ |
} |
} |
-void MockKeychain::SetTestDataString(int item, UInt32 tag, const char* value) { |
+void MockKeychain::SetTestDataString(unsigned int item, |
+ UInt32 tag, |
+ const char* value) { |
SetTestDataBytes(item, tag, value, value ? strlen(value) : 0); |
} |
-void MockKeychain::SetTestDataPort(int item, UInt32 value) { |
+void MockKeychain::SetTestDataPort(unsigned int item, UInt32 value) { |
SecKeychainAttribute* attribute = AttributeWithTag(keychain_attr_list_[item], |
kSecPortItemAttr); |
UInt32* data = static_cast<UInt32*>(attribute->data); |
*data = value; |
} |
-void MockKeychain::SetTestDataProtocol(int item, SecProtocolType value) { |
+void MockKeychain::SetTestDataProtocol(unsigned int item, SecProtocolType value) { |
SecKeychainAttribute* attribute = AttributeWithTag(keychain_attr_list_[item], |
kSecProtocolItemAttr); |
SecProtocolType* data = static_cast<SecProtocolType*>(attribute->data); |
*data = value; |
} |
-void MockKeychain::SetTestDataAuthType(int item, SecAuthenticationType value) { |
+void MockKeychain::SetTestDataAuthType(unsigned int item, SecAuthenticationType value) { |
SecKeychainAttribute* attribute = AttributeWithTag( |
keychain_attr_list_[item], kSecAuthenticationTypeItemAttr); |
SecAuthenticationType* data = static_cast<SecAuthenticationType*>( |
@@ -136,21 +138,21 @@ |
*data = value; |
} |
-void MockKeychain::SetTestDataNegativeItem(int item, Boolean value) { |
+void MockKeychain::SetTestDataNegativeItem(unsigned int item, Boolean value) { |
SecKeychainAttribute* attribute = AttributeWithTag(keychain_attr_list_[item], |
kSecNegativeItemAttr); |
Boolean* data = static_cast<Boolean*>(attribute->data); |
*data = value; |
} |
-void MockKeychain::SetTestDataCreator(int item, OSType value) { |
+void MockKeychain::SetTestDataCreator(unsigned int item, OSType value) { |
SecKeychainAttribute* attribute = AttributeWithTag(keychain_attr_list_[item], |
kSecCreatorItemAttr); |
OSType* data = static_cast<OSType*>(attribute->data); |
*data = value; |
} |
-void MockKeychain::SetTestDataPasswordBytes(int item, const void* data, |
+void MockKeychain::SetTestDataPasswordBytes(unsigned int item, const void* data, |
size_t length) { |
keychain_data_[item].length = length; |
if (length > 0) { |
@@ -163,7 +165,8 @@ |
} |
} |
-void MockKeychain::SetTestDataPasswordString(int item, const char* value) { |
+void MockKeychain::SetTestDataPasswordString(unsigned int item, |
+ const char* value) { |
SetTestDataPasswordBytes(item, value, value ? strlen(value) : 0); |
} |
@@ -175,7 +178,7 @@ |
UInt32* length, |
void** outData) const { |
DCHECK(itemRef); |
- unsigned int key = reinterpret_cast<unsigned int>(itemRef) - 1; |
+ unsigned int key = static_cast<unsigned int>(reinterpret_cast<uintptr_t>(itemRef)) - 1; |
if (keychain_attr_list_.find(key) == keychain_attr_list_.end()) |
return errSecInvalidItemRef; |
@@ -204,7 +207,7 @@ |
return errSecAuthFailed; |
} |
- unsigned int key = reinterpret_cast<unsigned int>(itemRef) - 1; |
+ unsigned int key = static_cast<unsigned int>(reinterpret_cast<uintptr_t>(itemRef)) - 1; |
if (keychain_attr_list_.find(key) == keychain_attr_list_.end()) |
return errSecInvalidItemRef; |
@@ -232,7 +235,7 @@ |
} |
OSStatus MockKeychain::ItemDelete(SecKeychainItemRef itemRef) const { |
- unsigned int key = reinterpret_cast<unsigned int>(itemRef) - 1; |
+ unsigned int key = static_cast<unsigned int>(reinterpret_cast<uintptr_t>(itemRef)) - 1; |
for (unsigned int i = 0; i < keychain_attr_list_[key].count; ++i) { |
if (keychain_attr_list_[key].attr[i].data) |
@@ -483,7 +486,7 @@ |
if (!ref) |
return; |
- if (reinterpret_cast<int>(ref) == kDummySearchRef) { |
+ if (static_cast<unsigned int>(reinterpret_cast<uintptr_t>(ref)) == kDummySearchRef) { |
--search_copy_count_; |
} else { |
--keychain_item_copy_count_; |