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

Side by Side Diff: media/webm/webm_parser.cc

Issue 14299005: Add support for zero-padded strings to WebMParser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | media/webm/webm_parser_unittest.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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/webm/webm_parser.h" 5 #include "media/webm/webm_parser.h"
6 6
7 // This file contains code to parse WebM file elements. It was created 7 // This file contains code to parse WebM file elements. It was created
8 // from information in the Matroska spec. 8 // from information in the Matroska spec.
9 // http://www.matroska.org/technical/specs/index.html 9 // http://www.matroska.org/technical/specs/index.html
10 // This file contains code for encrypted WebM. Current WebM 10 // This file contains code for encrypted WebM. Current WebM
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 return size; 592 return size;
593 } 593 }
594 594
595 static int ParseBinary(const uint8* buf, int size, int id, 595 static int ParseBinary(const uint8* buf, int size, int id,
596 WebMParserClient* client) { 596 WebMParserClient* client) {
597 return client->OnBinary(id, buf, size) ? size : -1; 597 return client->OnBinary(id, buf, size) ? size : -1;
598 } 598 }
599 599
600 static int ParseString(const uint8* buf, int size, int id, 600 static int ParseString(const uint8* buf, int size, int id,
601 WebMParserClient* client) { 601 WebMParserClient* client) {
602 std::string str(reinterpret_cast<const char*>(buf), size); 602 int length = strnlen(reinterpret_cast<const char*>(buf), size);
scherkus (not reviewing) 2013/04/16 21:01:00 fyi compile failure on mac ../../media/webm/webm_
603 std::string str(reinterpret_cast<const char*>(buf), length);
603 return client->OnString(id, str) ? size : -1; 604 return client->OnString(id, str) ? size : -1;
604 } 605 }
605 606
606 static int ParseNonListElement(ElementType type, int id, int64 element_size, 607 static int ParseNonListElement(ElementType type, int id, int64 element_size,
607 const uint8* buf, int size, 608 const uint8* buf, int size,
608 WebMParserClient* client) { 609 WebMParserClient* client) {
609 DCHECK_GE(size, element_size); 610 DCHECK_GE(size, element_size);
610 611
611 int result = -1; 612 int result = -1;
612 switch(type) { 613 switch(type) {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 if (kSegmentIds[i].id_ == id_b) 932 if (kSegmentIds[i].id_ == id_b)
932 return true; 933 return true;
933 } 934 }
934 } 935 }
935 936
936 // kWebMIdSegment siblings. 937 // kWebMIdSegment siblings.
937 return ((id_b == kWebMIdSegment) || (id_b == kWebMIdEBMLHeader)); 938 return ((id_b == kWebMIdSegment) || (id_b == kWebMIdEBMLHeader));
938 } 939 }
939 940
940 } // namespace media 941 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/webm/webm_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698