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

Side by Side Diff: webrtc/logging/rtc_event_log/rtc_event_log2stats.cc

Issue 2988153003: Replace CHECK(x && y) with two separate CHECK() calls (Closed)
Patch Set: fix mistakes Created 3 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/logging/rtc_event_log/rtc_event_log_parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 uint64_t varint = 0; 47 uint64_t varint = 0;
48 for (size_t bytes_read = 0; bytes_read < 10; ++bytes_read) { 48 for (size_t bytes_read = 0; bytes_read < 10; ++bytes_read) {
49 // The most significant bit of each byte is 0 if it is the last byte in 49 // The most significant bit of each byte is 0 if it is the last byte in
50 // the varint and 1 otherwise. Thus, we take the 7 least significant bits 50 // the varint and 1 otherwise. Thus, we take the 7 least significant bits
51 // of each byte and shift them 7 bits for each byte read previously to get 51 // of each byte and shift them 7 bits for each byte read previously to get
52 // the (unsigned) integer. 52 // the (unsigned) integer.
53 int byte = stream.get(); 53 int byte = stream.get();
54 if (stream.eof()) { 54 if (stream.eof()) {
55 return std::make_pair(varint, false); 55 return std::make_pair(varint, false);
56 } 56 }
57 RTC_DCHECK(0 <= byte && byte <= 255); 57 RTC_DCHECK_GE(byte, 0);
58 RTC_DCHECK_LE(byte, 255);
58 varint |= static_cast<uint64_t>(byte & 0x7F) << (7 * bytes_read); 59 varint |= static_cast<uint64_t>(byte & 0x7F) << (7 * bytes_read);
59 if ((byte & 0x80) == 0) { 60 if ((byte & 0x80) == 0) {
60 return std::make_pair(varint, true); 61 return std::make_pair(varint, true);
61 } 62 }
62 } 63 }
63 return std::make_pair(varint, false); 64 return std::make_pair(varint, false);
64 } 65 }
65 66
66 bool ParseEvents(const std::string& filename, 67 bool ParseEvents(const std::string& filename,
67 std::vector<webrtc::rtclog::Event>* events) { 68 std::vector<webrtc::rtclog::Event>* events) {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 static_cast<double>(malformed_event_size) / malformed_events, 244 static_cast<double>(malformed_event_size) / malformed_events,
244 static_cast<double>(malformed_event_size) / file_size * 100); 245 static_cast<double>(malformed_event_size) / file_size * 100);
245 } 246 }
246 if (file_size - accumulated_event_size != 0) { 247 if (file_size - accumulated_event_size != 0) {
247 printf("WARNING: %" PRId64 " bytes not accounted for\n", 248 printf("WARNING: %" PRId64 " bytes not accounted for\n",
248 file_size - accumulated_event_size); 249 file_size - accumulated_event_size);
249 } 250 }
250 251
251 return 0; 252 return 0;
252 } 253 }
OLDNEW
« no previous file with comments | « no previous file | webrtc/logging/rtc_event_log/rtc_event_log_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698