diff options
author | shenhan@google.com <shenhan@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-05 01:54:46 +0000 |
---|---|---|
committer | shenhan@google.com <shenhan@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-05 01:54:46 +0000 |
commit | 3fcbd4b4db3bb67e5e3d10944335c3a91f22723e (patch) | |
tree | 3e35507ef2b232faf4f672f1a5f450d4c8b151ca /crypto | |
parent | 34d4ebbfd10b704f4f9be87a74e2e072c4dec081 (diff) | |
download | chromium_src-3fcbd4b4db3bb67e5e3d10944335c3a91f22723e.zip chromium_src-3fcbd4b4db3bb67e5e3d10944335c3a91f22723e.tar.gz chromium_src-3fcbd4b4db3bb67e5e3d10944335c3a91f22723e.tar.bz2 |
Fixing gcc 4.7 building problems.
a) - gcc-4.7 improved the implicit headers that it includes. with
<4.7, the gthr-default.h file always pulls in unistd.h. with >=4.7,
they avoided that include when possible. so code that isn't including
unistd.h itself but needs it now breaks.
b) - narrowing conversion in initiliazation list now raises an
'ill-formed conversion' warning, which causes error when -Werror is
given.
[THIS PART IS NOW REVERTED IN THE PATCH} c) - included patches from pastebin - http://pastebin.com/raw.php?i=p3UKs7Cg
Note - this may not be fixing all the gcc 4.7 build problems for all
parts, but rather than submitting one big-fix-for-all CL, we'd better
do it incrementally (given that all the modification is reasonable and
minor) so that at least some parts get a successful gcc 4.7 build.
BUG=None
TEST=Built successfully using GCC-4.7 under chromium chroot
Review URL: https://chromiumcodereview.appspot.com/10451068
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140470 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/ec_private_key_nss.cc | 13 | ||||
-rw-r--r-- | crypto/ec_signature_creator_nss.cc | 9 | ||||
-rw-r--r-- | crypto/third_party/nss/secsign.cc | 6 |
3 files changed, 18 insertions, 10 deletions
diff --git a/crypto/ec_private_key_nss.cc b/crypto/ec_private_key_nss.cc index 1fb13e7..a799285 100644 --- a/crypto/ec_private_key_nss.cc +++ b/crypto/ec_private_key_nss.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -128,7 +128,7 @@ bool ECPrivateKey::ImportFromEncryptedPrivateKeyInfo( SECItem encoded_epki = { siBuffer, const_cast<unsigned char*>(encrypted_private_key_info), - encrypted_private_key_info_len + static_cast<unsigned>(encrypted_private_key_info_len) }; SECKEYEncryptedPrivateKeyInfo epki; memset(&epki, 0, sizeof(epki)); @@ -150,7 +150,7 @@ bool ECPrivateKey::ImportFromEncryptedPrivateKeyInfo( SECItem password_item = { siBuffer, reinterpret_cast<unsigned char*>(const_cast<char*>(password.data())), - password.size() + static_cast<unsigned>(password.size()) }; rv = ImportEncryptedECPrivateKeyInfoAndReturnKey( @@ -185,7 +185,7 @@ bool ECPrivateKey::ExportEncryptedPrivateKey( SECItem password_item = { siBuffer, reinterpret_cast<unsigned char*>(const_cast<char*>(password.data())), - password.size() + static_cast<unsigned>(password.size()) }; SECKEYEncryptedPrivateKeyInfo* encrypted = PK11_ExportEncryptedPrivKeyInfo( @@ -264,7 +264,8 @@ ECPrivateKey* ECPrivateKey::CreateWithParams(bool permanent, DCHECK_LE(oid_data->oid.len, 127U); std::vector<unsigned char> parameters_buf(2 + oid_data->oid.len); SECKEYECParams ec_parameters = { - siDEROID, ¶meters_buf[0], parameters_buf.size() + siDEROID, ¶meters_buf[0], + static_cast<unsigned>(parameters_buf.size()) }; ec_parameters.data[0] = SEC_ASN1_OBJECT_ID; @@ -300,7 +301,7 @@ ECPrivateKey* ECPrivateKey::CreateFromEncryptedPrivateKeyInfoWithParams( SECItem encoded_spki = { siBuffer, const_cast<unsigned char*>(&subject_public_key_info[0]), - subject_public_key_info.size() + static_cast<unsigned>(subject_public_key_info.size()) }; CERTSubjectPublicKeyInfo* decoded_spki = SECKEY_DecodeDERSubjectPublicKeyInfo( &encoded_spki); diff --git a/crypto/ec_signature_creator_nss.cc b/crypto/ec_signature_creator_nss.cc index 388870f..a85b1e9 100644 --- a/crypto/ec_signature_creator_nss.cc +++ b/crypto/ec_signature_creator_nss.cc @@ -8,6 +8,9 @@ #include <pk11pub.h> #include <secerr.h> #include <sechash.h> +#if defined(OS_POSIX) +#include <unistd.h> +#endif #include "base/logging.h" #include "crypto/ec_private_key.h" @@ -34,12 +37,14 @@ SECStatus SignData(SECItem* result, hash_type, &hash_data[0], input->data, input->len); if (rv != SECSuccess) return rv; - SECItem hash = {siBuffer, &hash_data[0], hash_data.size()}; + SECItem hash = {siBuffer, &hash_data[0], + static_cast<unsigned int>(hash_data.size())}; // Compute signature of hash. int signature_len = PK11_SignatureLen(key); std::vector<uint8> signature_data(signature_len); - SECItem sig = {siBuffer, &signature_data[0], signature_len}; + SECItem sig = {siBuffer, &signature_data[0], + static_cast<unsigned int>(signature_len)}; rv = PK11_Sign(key, &sig, &hash); if (rv != SECSuccess) return rv; diff --git a/crypto/third_party/nss/secsign.cc b/crypto/third_party/nss/secsign.cc index 9272d4a..a788def 100644 --- a/crypto/third_party/nss/secsign.cc +++ b/crypto/third_party/nss/secsign.cc @@ -93,12 +93,14 @@ SECStatus DerSignData(PLArenaPool *arena, hash_type, &hash_data[0], input->data, input->len); if (rv != SECSuccess) return rv; - SECItem hash = {siBuffer, &hash_data[0], hash_data.size()}; + SECItem hash = {siBuffer, &hash_data[0], + static_cast<unsigned int>(hash_data.size())}; // Compute signature of hash. int signature_len = PK11_SignatureLen(key); std::vector<uint8> signature_data(signature_len); - SECItem sig = {siBuffer, &signature_data[0], signature_len}; + SECItem sig = {siBuffer, &signature_data[0], + static_cast<unsigned int>(signature_len)}; rv = PK11_Sign(key, &sig, &hash); if (rv != SECSuccess) return rv; |