diff --git a/include/maxscale/mysql_utils.h b/include/maxscale/mysql_utils.h index 38331f034..a03c9d2fd 100644 --- a/include/maxscale/mysql_utils.h +++ b/include/maxscale/mysql_utils.h @@ -21,13 +21,13 @@ MXS_BEGIN_DECLS /** Length-encoded integers */ -size_t leint_bytes(const uint8_t* ptr); -uint64_t leint_value(const uint8_t* c); -uint64_t leint_consume(uint8_t ** c); +size_t mxs_leint_bytes(const uint8_t* ptr); +uint64_t mxs_leint_value(const uint8_t* c); +uint64_t mxs_leint_consume(uint8_t ** c); /** Length-encoded strings */ -char* lestr_consume_dup(uint8_t** c); -char* lestr_consume(uint8_t** c, size_t *size); +char* mxs_lestr_consume_dup(uint8_t** c); +char* mxs_lestr_consume(uint8_t** c, size_t *size); MYSQL *mxs_mysql_real_connect(MYSQL *mysql, SERVER *server, const char *user, const char *passwd); diff --git a/server/core/mysql_binlog.c b/server/core/mysql_binlog.c index 668c54778..f0acfdded 100644 --- a/server/core/mysql_binlog.c +++ b/server/core/mysql_binlog.c @@ -30,7 +30,7 @@ * * @param type The table column type * @return The type of the column in human readable format - * @see lestr_consume + * @see mxs_lestr_consume */ const char* column_type_to_string(uint8_t type) { @@ -120,7 +120,7 @@ bool column_is_blob(uint8_t type) * * @param type Type of the column * @return True if the column is a string type column - * @see lestr_consume + * @see mxs_lestr_consume */ bool column_is_variable_string(uint8_t type) { @@ -175,7 +175,7 @@ bool column_is_temporal(uint8_t type) * * @param type Type of the column * @return True if the column is a string type column - * @see lestr_consume + * @see mxs_lestr_consume */ bool column_is_fixed_string(uint8_t type) { diff --git a/server/core/mysql_utils.c b/server/core/mysql_utils.c index 8d4f42865..03b3f8897 100644 --- a/server/core/mysql_utils.c +++ b/server/core/mysql_utils.c @@ -34,7 +34,7 @@ * @param ptr Start of the length encoded value * @return Number of bytes before the actual value */ -size_t leint_bytes(const uint8_t* ptr) +size_t mxs_leint_bytes(const uint8_t* ptr) { uint8_t val = *ptr; if (val < 0xfb) @@ -62,7 +62,7 @@ size_t leint_bytes(const uint8_t* ptr) * @param c Pointer to the first byte of a length-encoded integer * @return The value converted to a standard unsigned integer */ -uint64_t leint_value(const uint8_t* c) +uint64_t mxs_leint_value(const uint8_t* c) { uint64_t sz = 0; @@ -98,10 +98,10 @@ uint64_t leint_value(const uint8_t* c) * * @param c Pointer to the first byte of a length-encoded integer */ -uint64_t leint_consume(uint8_t ** c) +uint64_t mxs_leint_consume(uint8_t ** c) { - uint64_t rval = leint_value(*c); - *c += leint_bytes(*c); + uint64_t rval = mxs_leint_value(*c); + *c += mxs_leint_bytes(*c); return rval; } @@ -114,9 +114,9 @@ uint64_t leint_consume(uint8_t ** c) * @param c Pointer to the first byte of a valid packet. * @return The newly allocated string or NULL if memory allocation failed */ -char* lestr_consume_dup(uint8_t** c) +char* mxs_lestr_consume_dup(uint8_t** c) { - uint64_t slen = leint_consume(c); + uint64_t slen = mxs_leint_consume(c); char *str = MXS_MALLOC((slen + 1) * sizeof(char)); if (str) @@ -138,9 +138,9 @@ char* lestr_consume_dup(uint8_t** c) * @param size Pointer to a variable where the size of the string is stored * @return Pointer to the start of the string */ -char* lestr_consume(uint8_t** c, size_t *size) +char* mxs_lestr_consume(uint8_t** c, size_t *size) { - uint64_t slen = leint_consume(c); + uint64_t slen = mxs_leint_consume(c); *size = slen; char* start = (char*) *c; *c += slen; diff --git a/server/modules/filter/cache/cachefiltersession.cc b/server/modules/filter/cache/cachefiltersession.cc index df78f6de4..07ddca4dc 100644 --- a/server/modules/filter/cache/cachefiltersession.cc +++ b/server/modules/filter/cache/cachefiltersession.cc @@ -425,9 +425,9 @@ int CacheFilterSession::handle_expecting_response() } else { - // leint_bytes() returns the length of the int type field + the size of the + // mxs_leint_bytes() returns the length of the int type field + the size of the // integer. - size_t n_bytes = leint_bytes(&header[4]); + size_t n_bytes = mxs_leint_bytes(&header[4]); if (MYSQL_HEADER_LEN + n_bytes <= buflen) { @@ -436,7 +436,7 @@ int CacheFilterSession::handle_expecting_response() gwbuf_copy_data(m_res.pData, MYSQL_HEADER_LEN + 1, n_bytes - 1, &header[MYSQL_HEADER_LEN + 1]); - m_res.nTotalFields = leint_value(&header[4]); + m_res.nTotalFields = mxs_leint_value(&header[4]); m_res.offset = MYSQL_HEADER_LEN + n_bytes; m_state = CACHE_EXPECTING_FIELDS; diff --git a/server/modules/filter/maxrows/maxrows.c b/server/modules/filter/maxrows/maxrows.c index b1e53ef50..c1822bd5a 100644 --- a/server/modules/filter/maxrows/maxrows.c +++ b/server/modules/filter/maxrows/maxrows.c @@ -632,9 +632,9 @@ static int handle_expecting_response(MAXROWS_SESSION_DATA *csdata) } else { - // leint_bytes() returns the length of the int type field + the size of the + // mxs_leint_bytes() returns the length of the int type field + the size of the // integer. - size_t n_bytes = leint_bytes(&header[4]); + size_t n_bytes = mxs_leint_bytes(&header[4]); if (MYSQL_HEADER_LEN + n_bytes <= buflen) { @@ -643,7 +643,7 @@ static int handle_expecting_response(MAXROWS_SESSION_DATA *csdata) gwbuf_copy_data(csdata->res.data, MYSQL_HEADER_LEN + 1, n_bytes - 1, &header[MYSQL_HEADER_LEN + 1]); - csdata->res.n_totalfields = leint_value(&header[4]); + csdata->res.n_totalfields = mxs_leint_value(&header[4]); csdata->res.offset += MYSQL_HEADER_LEN + n_bytes; csdata->state = MAXROWS_EXPECTING_FIELDS; diff --git a/server/modules/routing/avrorouter/avro_rbr.c b/server/modules/routing/avrorouter/avro_rbr.c index 59af65190..125552004 100644 --- a/server/modules/routing/avrorouter/avro_rbr.c +++ b/server/modules/routing/avrorouter/avro_rbr.c @@ -247,7 +247,7 @@ bool handle_row_event(AVRO_INSTANCE *router, REP_HEADER *hdr, uint8_t *ptr) } /** Number of columns in the table */ - uint64_t ncolumns = leint_consume(&ptr); + uint64_t ncolumns = mxs_leint_consume(&ptr); /** If full row image is used, all columns are present. Currently only full * row image is supported and thus the bitfield should be all ones. In @@ -546,7 +546,7 @@ uint8_t* process_row_event_data(TABLE_MAP *map, TABLE_CREATE *create, avro_value else if (column_is_variable_string(map->column_types[i])) { size_t sz; - char *str = lestr_consume(&ptr, &sz); + char *str = mxs_lestr_consume(&ptr, &sz); char buf[sz + 1]; memcpy(buf, str, sz); buf[sz] = '\0'; diff --git a/server/modules/routing/avrorouter/avro_schema.c b/server/modules/routing/avrorouter/avro_schema.c index 80db99f9d..6ec11eefb 100644 --- a/server/modules/routing/avrorouter/avro_schema.c +++ b/server/modules/routing/avrorouter/avro_schema.c @@ -952,15 +952,15 @@ TABLE_MAP *table_map_alloc(uint8_t *ptr, uint8_t hdr_len, TABLE_CREATE* create) memcpy(table_name, ptr, table_name_len + 1); ptr += table_name_len + 1; - uint64_t column_count = leint_value(ptr); - ptr += leint_bytes(ptr); + uint64_t column_count = mxs_leint_value(ptr); + ptr += mxs_leint_bytes(ptr); /** Column types */ uint8_t *column_types = ptr; ptr += column_count; size_t metadata_size = 0; - uint8_t* metadata = (uint8_t*)lestr_consume(&ptr, &metadata_size); + uint8_t* metadata = (uint8_t*)mxs_lestr_consume(&ptr, &metadata_size); uint8_t *nullmap = ptr; size_t nullmap_size = (column_count + 7) / 8; TABLE_MAP *map = MXS_MALLOC(sizeof(TABLE_MAP));