Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1116)

Unified Diff: components/metrics/serialization/serialization_utils.cc

Issue 614893004: Refactor AppendToFile and WriteFileDescriptor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/metrics/serialization/serialization_utils.cc
diff --git a/components/metrics/serialization/serialization_utils.cc b/components/metrics/serialization/serialization_utils.cc
index 0eca24b00eae5f359596db5595d999823272395f..30c2675e67f1b21446939b73958d7ecc3c194739 100644
--- a/components/metrics/serialization/serialization_utils.cc
+++ b/components/metrics/serialization/serialization_utils.cc
@@ -196,17 +196,16 @@ bool SerializationUtils::WriteMetricToFile(const MetricSample& sample,
// The file containing the metrics samples will only be read by programs on
// the same device so we do not check endianness.
- if (base::WriteFileDescriptor(file_descriptor.get(),
- reinterpret_cast<char*>(&size),
- sizeof(size)) != sizeof(size)) {
- DLOG(ERROR) << "error writing message length " << errno;
+ if (!base::WriteFileDescriptor(file_descriptor.get(),
+ reinterpret_cast<char*>(&size),
+ sizeof(size))) {
+ DPLOG(ERROR) << "error writing message length";
return false;
}
- if (base::WriteFileDescriptor(
- file_descriptor.get(), msg.c_str(), msg.length()) !=
- static_cast<int>(msg.length())) {
- DLOG(ERROR) << "error writing message" << errno;
+ if (!base::WriteFileDescriptor(
+ file_descriptor.get(), msg.c_str(), msg.size())) {
+ DPLOG(ERROR) << "error writing message";
return false;
}
« no previous file with comments | « chromeos/process_proxy/process_proxy.cc ('k') | components/policy/core/common/policy_loader_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698