summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorBrett Wilson <brettw@chromium.org>2015-07-07 16:38:09 -0700
committerBrett Wilson <brettw@chromium.org>2015-07-07 23:39:16 +0000
commite3c4d1a1228e00b190ad743a83f88a2266f45238 (patch)
tree3923b42b43c9b7a8a689d0468688b30bf9ea8f83 /net
parent1c33a26e56880fbf058fd796aa004e097e07b691 (diff)
downloadchromium_src-e3c4d1a1228e00b190ad743a83f88a2266f45238.zip
chromium_src-e3c4d1a1228e00b190ad743a83f88a2266f45238.tar.gz
chromium_src-e3c4d1a1228e00b190ad743a83f88a2266f45238.tar.bz2
Move WriteInto to base namespace.
Update all callers. De-inlines the template. For some reason touching the namespaces started givin errors about DCHECK not being defined. Indeed, this header does not include logging.h. Rather than include logging in this very common header, it seems preferable to move the implementation to the .cc file. This removes support for the wstring variant and updates the callers that used it. R=ben@chromium.org, ben TBR=jschuh (sandbox_win.cc) NOPRESUBMIT=true (this patch touches code using legacy wstrings) Review URL: https://codereview.chromium.org/1223983002. Cr-Commit-Position: refs/heads/master@{#337703}
Diffstat (limited to 'net')
-rw-r--r--net/android/keystore_unittest.cc2
-rw-r--r--net/base/net_string_util_icu.cc2
-rw-r--r--net/cert/crl_set_storage.cc2
-rw-r--r--net/cert/ct_objects_extractor_openssl.cc3
-rw-r--r--net/cert/jwk_serializer_openssl.cc6
-rw-r--r--net/cert/x509_cert_types_win.cc2
-rw-r--r--net/cert/x509_certificate_openssl.cc2
-rw-r--r--net/cert/x509_util_openssl.cc2
-rw-r--r--net/disk_cache/blockfile/entry_impl.cc2
-rw-r--r--net/disk_cache/blockfile/entry_impl_v3.cc2
-rw-r--r--net/proxy/proxy_resolver_v8.cc8
-rw-r--r--net/quic/crypto/channel_id_chromium.cc2
12 files changed, 20 insertions, 15 deletions
diff --git a/net/android/keystore_unittest.cc b/net/android/keystore_unittest.cc
index f1012a4..b7eb083 100644
--- a/net/android/keystore_unittest.cc
+++ b/net/android/keystore_unittest.cc
@@ -97,7 +97,7 @@ std::string GetOpenSSLErrorString(void) {
// Return the string's new buffer in memory, as an 'unsigned char*'
// pointer.
unsigned char* OpenSSLWriteInto(std::string* str, size_t size) {
- return reinterpret_cast<unsigned char*>(WriteInto(str, size + 1));
+ return reinterpret_cast<unsigned char*>(base::WriteInto(str, size + 1));
}
// Load a given private key file into an EVP_PKEY.
diff --git a/net/base/net_string_util_icu.cc b/net/base/net_string_util_icu.cc
index 435f9de..525800c 100644
--- a/net/base/net_string_util_icu.cc
+++ b/net/base/net_string_util_icu.cc
@@ -27,7 +27,7 @@ bool ConvertToUtf8(const std::string& text, const char* charset,
// in UTF-8. Therefore, the expansion ratio is 3 at most. Add one for a
// trailing '\0'.
size_t output_length = text.length() * 3 + 1;
- char* buf = WriteInto(output, output_length);
+ char* buf = base::WriteInto(output, output_length);
output_length = ucnv_toAlgorithmic(UCNV_UTF8, converter, buf, output_length,
text.data(), text.length(), &err);
ucnv_close(converter);
diff --git a/net/cert/crl_set_storage.cc b/net/cert/crl_set_storage.cc
index 99403da..da8ade1 100644
--- a/net/cert/crl_set_storage.cc
+++ b/net/cert/crl_set_storage.cc
@@ -520,7 +520,7 @@ std::string CRLSetStorage::Serialize(const CRLSet* crl_set) {
std::string ret;
uint8_t* out = reinterpret_cast<uint8_t*>(
- WriteInto(&ret, len + 1 /* to include final NUL */));
+ base::WriteInto(&ret, len + 1 /* to include final NUL */));
size_t off = 0;
CHECK(base::IsValueInRangeForNumericType<uint16_t>(header.size()));
out[off++] = static_cast<uint8_t>(header.size());
diff --git a/net/cert/ct_objects_extractor_openssl.cc b/net/cert/ct_objects_extractor_openssl.cc
index 80fed58..6fcc3b8 100644
--- a/net/cert/ct_objects_extractor_openssl.cc
+++ b/net/cert/ct_objects_extractor_openssl.cc
@@ -224,7 +224,8 @@ bool GetPrecertLogEntry(X509Certificate::OSCertHandle leaf,
int len = i2d_X509_CINF(leaf_copy->cert_info, NULL);
if (len < 0)
return false;
- uint8_t* ptr = reinterpret_cast<uint8_t*>(WriteInto(&to_be_signed, len + 1));
+ uint8_t* ptr =
+ reinterpret_cast<uint8_t*>(base::WriteInto(&to_be_signed, len + 1));
if (i2d_X509_CINF(leaf_copy->cert_info, &ptr) < 0)
return false;
diff --git a/net/cert/jwk_serializer_openssl.cc b/net/cert/jwk_serializer_openssl.cc
index d4cebb4..67683fb 100644
--- a/net/cert/jwk_serializer_openssl.cc
+++ b/net/cert/jwk_serializer_openssl.cc
@@ -62,9 +62,11 @@ bool ConvertEcKeyToJwk(EVP_PKEY* pkey,
std::string x_bytes;
std::string y_bytes;
if (!BN_bn2bin_padded(reinterpret_cast<uint8_t*>(
- WriteInto(&x_bytes, degree_bytes + 1)), degree_bytes, x.get()) ||
+ base::WriteInto(&x_bytes, degree_bytes + 1)),
+ degree_bytes, x.get()) ||
!BN_bn2bin_padded(reinterpret_cast<uint8_t*>(
- WriteInto(&y_bytes, degree_bytes + 1)), degree_bytes, y.get())) {
+ base::WriteInto(&y_bytes, degree_bytes + 1)),
+ degree_bytes, y.get())) {
return false;
}
diff --git a/net/cert/x509_cert_types_win.cc b/net/cert/x509_cert_types_win.cc
index f5f426d..1ec64c0 100644
--- a/net/cert/x509_cert_types_win.cc
+++ b/net/cert/x509_cert_types_win.cc
@@ -50,7 +50,7 @@ bool GetAttributeValue(PCERT_RDN_ATTR attribute,
std::wstring wide_name;
DWORD chars_written = CertRDNValueToStrW(
attribute->dwValueType, &attribute->Value,
- WriteInto(&wide_name, chars_needed), chars_needed);
+ base::WriteInto(&wide_name, chars_needed), chars_needed);
if (chars_written <= 1)
return false;
wide_name.resize(chars_written - 1);
diff --git a/net/cert/x509_certificate_openssl.cc b/net/cert/x509_certificate_openssl.cc
index 8f85d35..0d92a83 100644
--- a/net/cert/x509_certificate_openssl.cc
+++ b/net/cert/x509_certificate_openssl.cc
@@ -203,7 +203,7 @@ void X509Certificate::Initialize() {
// value.
int bytes_required = i2c_ASN1_INTEGER(serial_num, NULL);
unsigned char* buffer = reinterpret_cast<unsigned char*>(
- WriteInto(&serial_number_, bytes_required + 1));
+ base::WriteInto(&serial_number_, bytes_required + 1));
int bytes_written = i2c_ASN1_INTEGER(serial_num, &buffer);
DCHECK_EQ(static_cast<size_t>(bytes_written), serial_number_.size());
}
diff --git a/net/cert/x509_util_openssl.cc b/net/cert/x509_util_openssl.cc
index d5873ca..baf7d12 100644
--- a/net/cert/x509_util_openssl.cc
+++ b/net/cert/x509_util_openssl.cc
@@ -136,7 +136,7 @@ bool DerEncodeCert(X509* x509, std::string* out_der) {
if (len < 0)
return false;
- uint8_t* ptr = reinterpret_cast<uint8_t*>(WriteInto(out_der, len + 1));
+ uint8_t* ptr = reinterpret_cast<uint8_t*>(base::WriteInto(out_der, len + 1));
if (i2d_X509(x509, &ptr) < 0) {
NOTREACHED();
out_der->clear();
diff --git a/net/disk_cache/blockfile/entry_impl.cc b/net/disk_cache/blockfile/entry_impl.cc
index ed975e1..c26026e 100644
--- a/net/disk_cache/blockfile/entry_impl.cc
+++ b/net/disk_cache/blockfile/entry_impl.cc
@@ -785,7 +785,7 @@ std::string EntryImpl::GetKey() const {
if (!offset && key_file->GetLength() != static_cast<size_t>(key_len))
return std::string();
- if (!key_file->Read(WriteInto(&key_, key_len), key_len, offset))
+ if (!key_file->Read(base::WriteInto(&key_, key_len), key_len, offset))
key_.clear();
return key_;
}
diff --git a/net/disk_cache/blockfile/entry_impl_v3.cc b/net/disk_cache/blockfile/entry_impl_v3.cc
index 01ac276..7371936 100644
--- a/net/disk_cache/blockfile/entry_impl_v3.cc
+++ b/net/disk_cache/blockfile/entry_impl_v3.cc
@@ -498,7 +498,7 @@ std::string EntryImplV3::GetKey() const {
if (!offset && key_file->GetLength() != static_cast<size_t>(key_len))
return std::string();
- if (!key_file->Read(WriteInto(&key_, key_len), key_len, offset))
+ if (!key_file->Read(base::WriteInto(&key_, key_len), key_len, offset))
key_.clear();
return key_;
}
diff --git a/net/proxy/proxy_resolver_v8.cc b/net/proxy/proxy_resolver_v8.cc
index 206cd34..73f0428 100644
--- a/net/proxy/proxy_resolver_v8.cc
+++ b/net/proxy/proxy_resolver_v8.cc
@@ -140,7 +140,7 @@ std::string V8StringToUTF8(v8::Local<v8::String> s) {
int len = s->Length();
std::string result;
if (len > 0)
- s->WriteUtf8(WriteInto(&result, len + 1));
+ s->WriteUtf8(base::WriteInto(&result, len + 1));
return result;
}
@@ -150,8 +150,10 @@ base::string16 V8StringToUTF16(v8::Local<v8::String> s) {
base::string16 result;
// Note that the reinterpret cast is because on Windows string16 is an alias
// to wstring, and hence has character type wchar_t not uint16_t.
- if (len > 0)
- s->Write(reinterpret_cast<uint16_t*>(WriteInto(&result, len + 1)), 0, len);
+ if (len > 0) {
+ s->Write(reinterpret_cast<uint16_t*>(base::WriteInto(&result, len + 1)), 0,
+ len);
+ }
return result;
}
diff --git a/net/quic/crypto/channel_id_chromium.cc b/net/quic/crypto/channel_id_chromium.cc
index ab50efa8e..a4d6d91 100644
--- a/net/quic/crypto/channel_id_chromium.cc
+++ b/net/quic/crypto/channel_id_chromium.cc
@@ -44,7 +44,7 @@ bool ChannelIDKeyChromium::Sign(base::StringPiece signed_data,
if (!sig_creator->DecodeSignature(der_signature, &raw_signature)) {
return false;
}
- memcpy(WriteInto(out_signature, raw_signature.size() + 1),
+ memcpy(base::WriteInto(out_signature, raw_signature.size() + 1),
&raw_signature[0], raw_signature.size());
return true;
}