mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
WireDecoder::Read(): Use const char instead of plain char.
Change-Id: I14932ccd174b70fa3f90676c66ac0907e6086238 MessageReader: Use StringRef for callbacks.
This commit is contained in:
@@ -45,8 +45,9 @@ class WireDecoder {
|
||||
/* Reads the specified number of bytes.
|
||||
* @param buf pointer to read data (output parameter)
|
||||
* @param len number of bytes to read
|
||||
* Caution: the buffer is only temporarily valid.
|
||||
*/
|
||||
bool Read(char** buf, std::size_t len) {
|
||||
bool Read(const char** buf, std::size_t len) {
|
||||
if (len > m_allocated) Realloc(len);
|
||||
*buf = m_buf;
|
||||
return m_is.read(m_buf, len);
|
||||
@@ -54,7 +55,7 @@ class WireDecoder {
|
||||
|
||||
/* Reads a single byte. */
|
||||
bool Read8(unsigned int* val) {
|
||||
char* buf;
|
||||
const char* buf;
|
||||
if (!Read(&buf, 1)) return false;
|
||||
*val = (*((unsigned char*)buf)) & 0xff;
|
||||
return true;
|
||||
@@ -62,7 +63,7 @@ class WireDecoder {
|
||||
|
||||
/* Reads a 16-bit word. */
|
||||
bool Read16(unsigned int* val) {
|
||||
char* buf;
|
||||
const char* buf;
|
||||
if (!Read(&buf, 2)) return false;
|
||||
unsigned int v = (*((unsigned char*)buf)) & 0xff;
|
||||
++buf;
|
||||
@@ -74,7 +75,7 @@ class WireDecoder {
|
||||
|
||||
/* Reads a 32-bit word. */
|
||||
bool Read32(unsigned long* val) {
|
||||
char* buf;
|
||||
const char* buf;
|
||||
if (!Read(&buf, 4)) return false;
|
||||
unsigned int v = (*((unsigned char*)buf)) & 0xff;
|
||||
++buf;
|
||||
|
||||
Reference in New Issue
Block a user