1 // Copyright (c) 2016 The WebM project authors. All Rights Reserved. 2 // 3 // Use of this source code is governed by a BSD-style license 4 // that can be found in the LICENSE file in the root of the source 5 // tree. An additional intellectual property rights grant can be found 6 // in the file PATENTS. All contributing project authors may 7 // be found in the AUTHORS file in the root of the source tree. 8 #include "src/parser_utils.h" 9 10 #include <cassert> 11 #include <cstdint> 12 13 #include "webm/reader.h" 14 #include "webm/status.h" 15 16 namespace webm { 17 ReadByte(Reader * reader,std::uint8_t * byte)18Status ReadByte(Reader* reader, std::uint8_t* byte) { 19 assert(reader != nullptr); 20 assert(byte != nullptr); 21 22 std::uint64_t num_bytes_read; 23 const Status status = reader->Read(1, byte, &num_bytes_read); 24 25 if (!status.completed_ok()) { 26 assert(num_bytes_read == 0); 27 } else { 28 assert(num_bytes_read == 1); 29 } 30 31 return status; 32 } 33 34 } // namespace webm 35