Move length-encoded integer/string functions to maxsql

This commit is contained in:
Esa Korhonen
2018-11-29 14:41:10 +02:00
parent 5e03ff35eb
commit 655e5fab5b
12 changed files with 170 additions and 173 deletions

View File

@ -573,7 +573,7 @@ int CacheFilterSession::handle_expecting_response()
{
// mxs_leint_bytes() returns the length of the int type field + the size of the
// integer.
size_t n_bytes = mxs_leint_bytes(&header[4]);
size_t n_bytes = mxq::leint_bytes(&header[4]);
if (MYSQL_HEADER_LEN + n_bytes <= buflen)
{
@ -581,7 +581,7 @@ int CacheFilterSession::handle_expecting_response()
// need to copy some more data.
copy_data(MYSQL_HEADER_LEN + 1, n_bytes - 1, &header[MYSQL_HEADER_LEN + 1]);
m_res.nTotalFields = mxs_leint_value(&header[4]);
m_res.nTotalFields = mxq::leint_value(&header[4]);
m_res.offset = MYSQL_HEADER_LEN + n_bytes;
m_state = CACHE_EXPECTING_FIELDS;

View File

@ -37,7 +37,7 @@ public:
*/
LEncInt(uint8_t* pData)
{
m_value = mxs_leint_value(pData);
m_value = mxq::leint_value(pData);
}
/**
@ -49,8 +49,8 @@ public:
*/
LEncInt(uint8_t** ppData)
{
size_t nBytes = mxs_leint_bytes(*ppData);
m_value = mxs_leint_value(*ppData);
size_t nBytes = mxq::leint_bytes(*ppData);
m_value = mxq::leint_value(*ppData);
*ppData += nBytes;
}
@ -226,7 +226,7 @@ public:
// NULL is sent as 0xfb. See https://dev.mysql.com/doc/internals/en/com-query-response.html
if (*pData != 0xfb)
{
m_pString = mxs_lestr_consume(&pData, &m_length);
m_pString = mxq::lestr_consume(&pData, &m_length);
}
else
{
@ -247,7 +247,7 @@ public:
// NULL is sent as 0xfb. See https://dev.mysql.com/doc/internals/en/com-query-response.html
if (**ppData != 0xfb)
{
m_pString = mxs_lestr_consume(ppData, &m_length);
m_pString = mxq::lestr_consume(ppData, &m_length);
}
else
{

View File

@ -768,7 +768,7 @@ static int handle_expecting_response(MAXROWS_SESSION_DATA* csdata)
{
// mxs_leint_bytes() returns the length of the int type field + the size of the
// integer.
size_t n_bytes = mxs_leint_bytes(&header[4]);
size_t n_bytes = mxq::leint_bytes(&header[4]);
if (MYSQL_HEADER_LEN + n_bytes <= buflen)
{
@ -779,7 +779,7 @@ static int handle_expecting_response(MAXROWS_SESSION_DATA* csdata)
n_bytes - 1,
&header[MYSQL_HEADER_LEN + 1]);
csdata->res.n_totalfields = mxs_leint_value(&header[4]);
csdata->res.n_totalfields = mxq::leint_value(&header[4]);
csdata->res.offset += MYSQL_HEADER_LEN + n_bytes;
csdata->state = MAXROWS_EXPECTING_FIELDS;