/* * Copyright 2004 The WebRTC Project Authors. All rights reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
bool ByteBufferReader::ReadUVarint(uint64_t* val) { if (!val) { returnfalse;
} // Integers are deserialized 7 bits at a time, with each byte having a // continuation byte (msb=1) if there are more bytes to be read.
uint64_t v = 0; for (int i = 0; i < 64; i += 7) {
uint8_t byte; if (!ReadBytes(&byte, 1)) { returnfalse;
} // Read the first 7 bits of the byte, then offset by bits read so far.
v |= (static_cast<uint64_t>(byte) & 0x7F) << i; // Return if the msb is not a continuation byte. if (byte < 0x80) {
*val = v; returntrue;
}
} returnfalse;
}
bool ByteBufferReader::ReadString(std::string* val, size_t len) { if (!val) returnfalse;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.