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

Unified Diff: webrtc/call/rtc_event_log_parser.cc

Issue 2297343003: EventLogParser: use std::vector to reduce stack usage (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/call/rtc_event_log_parser.cc
diff --git a/webrtc/call/rtc_event_log_parser.cc b/webrtc/call/rtc_event_log_parser.cc
index 59906b01c8c8163d6727e7ba7a0e369d8f4e1644..a2f95d0a75e2c833b695233489651a1cb57c08b2 100644
--- a/webrtc/call/rtc_event_log_parser.cc
+++ b/webrtc/call/rtc_event_log_parser.cc
@@ -124,7 +124,7 @@ bool ParsedRtcEventLog::ParseString(const std::string& s) {
bool ParsedRtcEventLog::ParseStream(std::istream& stream) {
events_.clear();
const size_t kMaxEventSize = (1u << 16) - 1;
- char tmp_buffer[kMaxEventSize];
+ std::vector<char> tmp_buffer(kMaxEventSize);
uint64_t tag;
uint64_t message_length;
bool success;
@@ -162,7 +162,7 @@ bool ParsedRtcEventLog::ParseStream(std::istream& stream) {
}
// Read the next protobuf event to a temporary char buffer.
- stream.read(tmp_buffer, message_length);
+ stream.read(tmp_buffer.data(), message_length);
if (stream.gcount() != static_cast<int>(message_length)) {
LOG(LS_WARNING) << "Failed to read protobuf message from file.";
return false;
@@ -170,7 +170,7 @@ bool ParsedRtcEventLog::ParseStream(std::istream& stream) {
// Parse the protobuf event from the buffer.
rtclog::Event event;
- if (!event.ParseFromArray(tmp_buffer, message_length)) {
+ if (!event.ParseFromArray(tmp_buffer.data(), message_length)) {
LOG(LS_WARNING) << "Failed to parse protobuf message.";
return false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698