Commit 7edc6be4 authored by marko's avatar marko

branches/zip: Add const qualifiers to the pointer parameters of

mach_read_...() functions.  Remove unnecessary casts.
parent c4e548ce
......@@ -4332,11 +4332,11 @@ btr_copy_externally_stored_field_prefix(
memcpy(buf, data, local_len);
data += local_len;
space_id = mach_read_from_4((byte*) data + BTR_EXTERN_SPACE_ID);
space_id = mach_read_from_4(data + BTR_EXTERN_SPACE_ID);
page_no = mach_read_from_4((byte*) data + BTR_EXTERN_PAGE_NO);
page_no = mach_read_from_4(data + BTR_EXTERN_PAGE_NO);
offset = mach_read_from_4((byte*) data + BTR_EXTERN_OFFSET);
offset = mach_read_from_4(data + BTR_EXTERN_OFFSET);
return(local_len
+ btr_copy_externally_stored_field_prefix_low(buf + local_len,
......@@ -4357,7 +4357,7 @@ btr_copy_externally_stored_field(
/*=============================*/
/* out: the whole field copied to heap */
ulint* len, /* out: length of the whole field */
byte* data, /* in: 'internally' stored part of the
const byte* data, /* in: 'internally' stored part of the
field containing also the reference to
the external part */
ulint zip_size,/* in: nonzero=compressed BLOB page size,
......
......@@ -32,8 +32,8 @@ UNIV_INLINE
ulint
mach_read_from_1(
/*=============*/
/* out: ulint integer, >= 0, < 256 */
byte* b); /* in: pointer to byte */
/* out: ulint integer, >= 0, < 256 */
const byte* b); /* in: pointer to byte */
/***********************************************************
The following function is used to store data in two consecutive
bytes. We store the most significant byte to the lower address. */
......@@ -50,8 +50,8 @@ UNIV_INLINE
ulint
mach_read_from_2(
/*=============*/
/* out: ulint integer, >= 0, < 64k */
byte* b); /* in: pointer to two bytes */
/* out: ulint integer, >= 0, < 64k */
const byte* b); /* in: pointer to two bytes */
/************************************************************
The following function is used to convert a 16-bit data item
......@@ -89,8 +89,8 @@ UNIV_INLINE
ulint
mach_read_from_3(
/*=============*/
/* out: ulint integer */
byte* b); /* in: pointer to 3 bytes */
/* out: ulint integer */
const byte* b); /* in: pointer to 3 bytes */
/***********************************************************
The following function is used to store data in four consecutive
bytes. We store the most significant byte to the lowest address. */
......@@ -107,8 +107,8 @@ UNIV_INLINE
ulint
mach_read_from_4(
/*=============*/
/* out: ulint integer */
byte* b); /* in: pointer to four bytes */
/* out: ulint integer */
const byte* b); /* in: pointer to four bytes */
/*************************************************************
Writes a ulint in a compressed form (1..5 bytes). */
UNIV_INLINE
......@@ -132,8 +132,8 @@ UNIV_INLINE
ulint
mach_read_compressed(
/*=================*/
/* out: read integer */
byte* b); /* in: pointer to memory from where to read */
/* out: read integer */
const byte* b); /* in: pointer to memory from where to read */
/***********************************************************
The following function is used to store data in 6 consecutive
bytes. We store the most significant byte to the lowest address. */
......@@ -150,8 +150,8 @@ UNIV_INLINE
dulint
mach_read_from_6(
/*=============*/
/* out: dulint integer */
byte* b); /* in: pointer to 6 bytes */
/* out: dulint integer */
const byte* b); /* in: pointer to 6 bytes */
/***********************************************************
The following function is used to store data in 7 consecutive
bytes. We store the most significant byte to the lowest address. */
......@@ -168,8 +168,8 @@ UNIV_INLINE
dulint
mach_read_from_7(
/*=============*/
/* out: dulint integer */
byte* b); /* in: pointer to 7 bytes */
/* out: dulint integer */
const byte* b); /* in: pointer to 7 bytes */
/***********************************************************
The following function is used to store data in 8 consecutive
bytes. We store the most significant byte to the lowest address. */
......@@ -186,8 +186,8 @@ UNIV_INLINE
dulint
mach_read_from_8(
/*=============*/
/* out: dulint integer */
byte* b); /* in: pointer to 8 bytes */
/* out: dulint integer */
const byte* b); /* in: pointer to 8 bytes */
/*************************************************************
Writes a dulint in a compressed form (5..9 bytes). */
UNIV_INLINE
......@@ -211,8 +211,8 @@ UNIV_INLINE
dulint
mach_dulint_read_compressed(
/*========================*/
/* out: read dulint */
byte* b); /* in: pointer to memory from where to read */
/* out: read dulint */
const byte* b); /* in: pointer to memory from where to read */
/*************************************************************
Writes a dulint in a compressed form (1..11 bytes). */
UNIV_INLINE
......@@ -236,8 +236,8 @@ UNIV_INLINE
dulint
mach_dulint_read_much_compressed(
/*=============================*/
/* out: read dulint */
byte* b); /* in: pointer to memory from where to read */
/* out: read dulint */
const byte* b); /* in: pointer to memory from where to read */
/*************************************************************
Reads a ulint in a compressed form if the log record fully contains it. */
......@@ -266,8 +266,8 @@ UNIV_INLINE
double
mach_double_read(
/*=============*/
/* out: double read */
byte* b); /* in: pointer to memory from where to read */
/* out: double read */
const byte* b); /* in: pointer to memory from where to read */
/*************************************************************
Writes a double. It is stored in a little-endian format. */
UNIV_INLINE
......@@ -282,8 +282,8 @@ UNIV_INLINE
float
mach_float_read(
/*============*/
/* out: float read */
byte* b); /* in: pointer to memory from where to read */
/* out: float read */
const byte* b); /* in: pointer to memory from where to read */
/*************************************************************
Writes a float. It is stored in a little-endian format. */
UNIV_INLINE
......@@ -298,9 +298,9 @@ UNIV_INLINE
ulint
mach_read_from_n_little_endian(
/*===========================*/
/* out: unsigned long int */
byte* buf, /* in: from where to read */
ulint buf_size); /* in: from how many bytes to read */
/* out: unsigned long int */
const byte* buf, /* in: from where to read */
ulint buf_size); /* in: from how many bytes to read */
/*************************************************************
Writes a ulint in the little-endian format. */
UNIV_INLINE
......@@ -316,8 +316,8 @@ UNIV_INLINE
ulint
mach_read_from_2_little_endian(
/*===========================*/
/* out: unsigned long int */
byte* buf); /* in: from where to read */
/* out: unsigned long int */
const byte* buf); /* in: from where to read */
/*************************************************************
Writes a ulint in the little-endian format. */
UNIV_INLINE
......
......@@ -28,8 +28,8 @@ UNIV_INLINE
ulint
mach_read_from_1(
/*=============*/
/* out: ulint integer, >= 0, < 256 */
byte* b) /* in: pointer to byte */
/* out: ulint integer, >= 0, < 256 */
const byte* b) /* in: pointer to byte */
{
ut_ad(b);
return((ulint)(b[0]));
......@@ -59,8 +59,8 @@ UNIV_INLINE
ulint
mach_read_from_2(
/*=============*/
/* out: ulint integer */
byte* b) /* in: pointer to 2 bytes */
/* out: ulint integer */
const byte* b) /* in: pointer to 2 bytes */
{
ut_ad(b);
return( ((ulint)(b[0]) << 8)
......@@ -96,7 +96,7 @@ mach_decode_2(
uint16 n) /* in: 16-bit integer in canonical format */
{
ut_ad(2 == sizeof n);
return(mach_read_from_2((byte*) &n));
return(mach_read_from_2((const byte*) &n));
}
/***********************************************************
......@@ -124,8 +124,8 @@ UNIV_INLINE
ulint
mach_read_from_3(
/*=============*/
/* out: ulint integer */
byte* b) /* in: pointer to 3 bytes */
/* out: ulint integer */
const byte* b) /* in: pointer to 3 bytes */
{
ut_ad(b);
return( ((ulint)(b[0]) << 16)
......@@ -159,8 +159,8 @@ UNIV_INLINE
ulint
mach_read_from_4(
/*=============*/
/* out: ulint integer */
byte* b) /* in: pointer to four bytes */
/* out: ulint integer */
const byte* b) /* in: pointer to four bytes */
{
ut_ad(b);
return( ((ulint)(b[0]) << 24)
......@@ -234,8 +234,8 @@ UNIV_INLINE
ulint
mach_read_compressed(
/*=================*/
/* out: read integer (< 2^32) */
byte* b) /* in: pointer to memory from where to read */
/* out: read integer (< 2^32) */
const byte* b) /* in: pointer to memory from where to read */
{
ulint flag;
......@@ -280,8 +280,8 @@ UNIV_INLINE
dulint
mach_read_from_8(
/*=============*/
/* out: dulint integer */
byte* b) /* in: pointer to 8 bytes */
/* out: dulint integer */
const byte* b) /* in: pointer to 8 bytes */
{
ulint high;
ulint low;
......@@ -317,8 +317,8 @@ UNIV_INLINE
dulint
mach_read_from_7(
/*=============*/
/* out: dulint integer */
byte* b) /* in: pointer to 7 bytes */
/* out: dulint integer */
const byte* b) /* in: pointer to 7 bytes */
{
ulint high;
ulint low;
......@@ -354,8 +354,8 @@ UNIV_INLINE
dulint
mach_read_from_6(
/*=============*/
/* out: dulint integer */
byte* b) /* in: pointer to 7 bytes */
/* out: dulint integer */
const byte* b) /* in: pointer to 7 bytes */
{
ulint high;
ulint low;
......@@ -406,8 +406,8 @@ UNIV_INLINE
dulint
mach_dulint_read_compressed(
/*========================*/
/* out: read dulint */
byte* b) /* in: pointer to memory from where to read */
/* out: read dulint */
const byte* b) /* in: pointer to memory from where to read */
{
ulint high;
ulint low;
......@@ -473,8 +473,8 @@ UNIV_INLINE
dulint
mach_dulint_read_much_compressed(
/*=============================*/
/* out: read dulint */
byte* b) /* in: pointer to memory from where to read */
/* out: read dulint */
const byte* b) /* in: pointer to memory from where to read */
{
ulint high;
ulint low;
......@@ -502,8 +502,8 @@ UNIV_INLINE
double
mach_double_read(
/*=============*/
/* out: double read */
byte* b) /* in: pointer to memory from where to read */
/* out: double read */
const byte* b) /* in: pointer to memory from where to read */
{
double d;
ulint i;
......@@ -551,8 +551,8 @@ UNIV_INLINE
float
mach_float_read(
/*============*/
/* out: float read */
byte* b) /* in: pointer to memory from where to read */
/* out: float read */
const byte* b) /* in: pointer to memory from where to read */
{
float d;
ulint i;
......@@ -600,12 +600,12 @@ UNIV_INLINE
ulint
mach_read_from_n_little_endian(
/*===========================*/
/* out: unsigned long int */
byte* buf, /* in: from where to read */
ulint buf_size) /* in: from how many bytes to read */
/* out: unsigned long int */
const byte* buf, /* in: from where to read */
ulint buf_size) /* in: from how many bytes to read */
{
ulint n = 0;
byte* ptr;
const byte* ptr;
ut_ad(buf_size <= sizeof(ulint));
ut_ad(buf_size > 0);
......@@ -665,8 +665,8 @@ UNIV_INLINE
ulint
mach_read_from_2_little_endian(
/*===========================*/
/* out: unsigned long int */
byte* buf) /* in: from where to read */
/* out: unsigned long int */
const byte* buf) /* in: from where to read */
{
return((ulint)(*buf) + ((ulint)(*(buf + 1))) * 256);
}
......
......@@ -490,8 +490,7 @@ page_zip_dir_encode(
} else {
status = REC_STATUS_NODE_PTR;
if (UNIV_UNLIKELY
(mach_read_from_4((page_t*) page + FIL_PAGE_PREV)
== FIL_NULL)) {
(mach_read_from_4(page + FIL_PAGE_PREV) == FIL_NULL)) {
min_mark = REC_INFO_MIN_REC_FLAG;
}
}
......@@ -3602,8 +3601,7 @@ page_zip_copy(
+ page_zip->m_end < page_zip->size);
if (!page_is_leaf(src)
&& UNIV_UNLIKELY(mach_read_from_4((byte*) src
+ FIL_PAGE_PREV) == FIL_NULL)
&& UNIV_UNLIKELY(mach_read_from_4(src + FIL_PAGE_PREV) == FIL_NULL)
&& UNIV_LIKELY(mach_read_from_4(page
+ FIL_PAGE_PREV) != FIL_NULL)) {
/* Clear the REC_INFO_MIN_REC_FLAG of the first user record. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment