Make stats_event write function parameters const

Bug: 143968790
Test: bit statsd_test:*
Change-Id: I2660cad5400a0e819c60b9caa706bb66ca2eef4f
This commit is contained in:
Muhammad Qureshi 2019-12-04 08:17:25 -08:00
parent 30a176c99e
commit c8ef71b425
2 changed files with 7 additions and 7 deletions

View file

@ -95,14 +95,14 @@ void stats_event_write_int64(struct stats_event* event, int64_t value);
void stats_event_write_float(struct stats_event* event, float value);
void stats_event_write_bool(struct stats_event* event, bool value);
void stats_event_write_byte_array(struct stats_event* event, uint8_t* buf, size_t numBytes);
void stats_event_write_byte_array(struct stats_event* event, const uint8_t* buf, size_t numBytes);
// Buf must be null-terminated.
void stats_event_write_string8(struct stats_event* event, const char* buf);
// Tags must be null-terminated.
void stats_event_write_attribution_chain(struct stats_event* event, uint32_t* uids,
const char** tags, uint8_t numNodes);
void stats_event_write_attribution_chain(struct stats_event* event, const uint32_t* uids,
const char* const* tags, uint8_t numNodes);
/* key_value_pair struct can be constructed as follows:
* struct key_value_pair pair = {.key = key, .valueType = STRING_TYPE,

View file

@ -132,7 +132,7 @@ static void append_float(struct stats_event* event, float value) {
}
}
static void append_byte_array(struct stats_event* event, uint8_t* buf, size_t size) {
static void append_byte_array(struct stats_event* event, const uint8_t* buf, size_t size) {
if (!overflows(event, size)) {
memcpy(&event->buf[event->size], buf, size);
event->size += size;
@ -185,7 +185,7 @@ void stats_event_write_bool(struct stats_event* event, bool value) {
append_bool(event, value);
}
void stats_event_write_byte_array(struct stats_event* event, uint8_t* buf, size_t numBytes) {
void stats_event_write_byte_array(struct stats_event* event, const uint8_t* buf, size_t numBytes) {
if (event->errors) return;
start_field(event, BYTE_ARRAY_TYPE);
@ -202,8 +202,8 @@ void stats_event_write_string8(struct stats_event* event, const char* buf) {
}
// Tags are assumed to be encoded using UTF8
void stats_event_write_attribution_chain(struct stats_event* event, uint32_t* uids,
const char** tags, uint8_t numNodes) {
void stats_event_write_attribution_chain(struct stats_event* event, const uint32_t* uids,
const char* const* tags, uint8_t numNodes) {
if (numNodes > MAX_BYTE_VALUE) event->errors |= ERROR_ATTRIBUTION_CHAIN_TOO_LONG;
if (event->errors) return;