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( ...@@ -4332,11 +4332,11 @@ btr_copy_externally_stored_field_prefix(
memcpy(buf, data, local_len); memcpy(buf, data, local_len);
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 return(local_len
+ btr_copy_externally_stored_field_prefix_low(buf + local_len, + btr_copy_externally_stored_field_prefix_low(buf + local_len,
...@@ -4357,7 +4357,7 @@ btr_copy_externally_stored_field( ...@@ -4357,7 +4357,7 @@ btr_copy_externally_stored_field(
/*=============================*/ /*=============================*/
/* out: the whole field copied to heap */ /* out: the whole field copied to heap */
ulint* len, /* out: length of the whole field */ 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 field containing also the reference to
the external part */ the external part */
ulint zip_size,/* in: nonzero=compressed BLOB page size, ulint zip_size,/* in: nonzero=compressed BLOB page size,
......
...@@ -33,7 +33,7 @@ ulint ...@@ -33,7 +33,7 @@ ulint
mach_read_from_1( mach_read_from_1(
/*=============*/ /*=============*/
/* out: ulint integer, >= 0, < 256 */ /* out: ulint integer, >= 0, < 256 */
byte* b); /* in: pointer to byte */ const byte* b); /* in: pointer to byte */
/*********************************************************** /***********************************************************
The following function is used to store data in two consecutive The following function is used to store data in two consecutive
bytes. We store the most significant byte to the lower address. */ bytes. We store the most significant byte to the lower address. */
...@@ -51,7 +51,7 @@ ulint ...@@ -51,7 +51,7 @@ ulint
mach_read_from_2( mach_read_from_2(
/*=============*/ /*=============*/
/* out: ulint integer, >= 0, < 64k */ /* out: ulint integer, >= 0, < 64k */
byte* b); /* in: pointer to two bytes */ const byte* b); /* in: pointer to two bytes */
/************************************************************ /************************************************************
The following function is used to convert a 16-bit data item The following function is used to convert a 16-bit data item
...@@ -90,7 +90,7 @@ ulint ...@@ -90,7 +90,7 @@ ulint
mach_read_from_3( mach_read_from_3(
/*=============*/ /*=============*/
/* out: ulint integer */ /* out: ulint integer */
byte* b); /* in: pointer to 3 bytes */ const byte* b); /* in: pointer to 3 bytes */
/*********************************************************** /***********************************************************
The following function is used to store data in four consecutive The following function is used to store data in four consecutive
bytes. We store the most significant byte to the lowest address. */ bytes. We store the most significant byte to the lowest address. */
...@@ -108,7 +108,7 @@ ulint ...@@ -108,7 +108,7 @@ ulint
mach_read_from_4( mach_read_from_4(
/*=============*/ /*=============*/
/* out: ulint integer */ /* out: ulint integer */
byte* b); /* in: pointer to four bytes */ const byte* b); /* in: pointer to four bytes */
/************************************************************* /*************************************************************
Writes a ulint in a compressed form (1..5 bytes). */ Writes a ulint in a compressed form (1..5 bytes). */
UNIV_INLINE UNIV_INLINE
...@@ -133,7 +133,7 @@ ulint ...@@ -133,7 +133,7 @@ ulint
mach_read_compressed( mach_read_compressed(
/*=================*/ /*=================*/
/* out: read integer */ /* out: read integer */
byte* b); /* in: pointer to memory from where to read */ const byte* b); /* in: pointer to memory from where to read */
/*********************************************************** /***********************************************************
The following function is used to store data in 6 consecutive The following function is used to store data in 6 consecutive
bytes. We store the most significant byte to the lowest address. */ bytes. We store the most significant byte to the lowest address. */
...@@ -151,7 +151,7 @@ dulint ...@@ -151,7 +151,7 @@ dulint
mach_read_from_6( mach_read_from_6(
/*=============*/ /*=============*/
/* out: dulint integer */ /* out: dulint integer */
byte* b); /* in: pointer to 6 bytes */ const byte* b); /* in: pointer to 6 bytes */
/*********************************************************** /***********************************************************
The following function is used to store data in 7 consecutive The following function is used to store data in 7 consecutive
bytes. We store the most significant byte to the lowest address. */ bytes. We store the most significant byte to the lowest address. */
...@@ -169,7 +169,7 @@ dulint ...@@ -169,7 +169,7 @@ dulint
mach_read_from_7( mach_read_from_7(
/*=============*/ /*=============*/
/* out: dulint integer */ /* out: dulint integer */
byte* b); /* in: pointer to 7 bytes */ const byte* b); /* in: pointer to 7 bytes */
/*********************************************************** /***********************************************************
The following function is used to store data in 8 consecutive The following function is used to store data in 8 consecutive
bytes. We store the most significant byte to the lowest address. */ bytes. We store the most significant byte to the lowest address. */
...@@ -187,7 +187,7 @@ dulint ...@@ -187,7 +187,7 @@ dulint
mach_read_from_8( mach_read_from_8(
/*=============*/ /*=============*/
/* out: dulint integer */ /* out: dulint integer */
byte* b); /* in: pointer to 8 bytes */ const byte* b); /* in: pointer to 8 bytes */
/************************************************************* /*************************************************************
Writes a dulint in a compressed form (5..9 bytes). */ Writes a dulint in a compressed form (5..9 bytes). */
UNIV_INLINE UNIV_INLINE
...@@ -212,7 +212,7 @@ dulint ...@@ -212,7 +212,7 @@ dulint
mach_dulint_read_compressed( mach_dulint_read_compressed(
/*========================*/ /*========================*/
/* out: read dulint */ /* out: read dulint */
byte* b); /* in: pointer to memory from where to read */ const byte* b); /* in: pointer to memory from where to read */
/************************************************************* /*************************************************************
Writes a dulint in a compressed form (1..11 bytes). */ Writes a dulint in a compressed form (1..11 bytes). */
UNIV_INLINE UNIV_INLINE
...@@ -237,7 +237,7 @@ dulint ...@@ -237,7 +237,7 @@ dulint
mach_dulint_read_much_compressed( mach_dulint_read_much_compressed(
/*=============================*/ /*=============================*/
/* out: read dulint */ /* out: read dulint */
byte* b); /* in: pointer to memory from where to read */ 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. */ Reads a ulint in a compressed form if the log record fully contains it. */
...@@ -267,7 +267,7 @@ double ...@@ -267,7 +267,7 @@ double
mach_double_read( mach_double_read(
/*=============*/ /*=============*/
/* out: double read */ /* out: double read */
byte* b); /* in: pointer to memory from where to read */ const byte* b); /* in: pointer to memory from where to read */
/************************************************************* /*************************************************************
Writes a double. It is stored in a little-endian format. */ Writes a double. It is stored in a little-endian format. */
UNIV_INLINE UNIV_INLINE
...@@ -283,7 +283,7 @@ float ...@@ -283,7 +283,7 @@ float
mach_float_read( mach_float_read(
/*============*/ /*============*/
/* out: float read */ /* out: float read */
byte* b); /* in: pointer to memory from where to read */ const byte* b); /* in: pointer to memory from where to read */
/************************************************************* /*************************************************************
Writes a float. It is stored in a little-endian format. */ Writes a float. It is stored in a little-endian format. */
UNIV_INLINE UNIV_INLINE
...@@ -299,7 +299,7 @@ ulint ...@@ -299,7 +299,7 @@ ulint
mach_read_from_n_little_endian( mach_read_from_n_little_endian(
/*===========================*/ /*===========================*/
/* out: unsigned long int */ /* out: unsigned long int */
byte* buf, /* in: from where to read */ const byte* buf, /* in: from where to read */
ulint buf_size); /* in: from how many bytes to read */ ulint buf_size); /* in: from how many bytes to read */
/************************************************************* /*************************************************************
Writes a ulint in the little-endian format. */ Writes a ulint in the little-endian format. */
...@@ -317,7 +317,7 @@ ulint ...@@ -317,7 +317,7 @@ ulint
mach_read_from_2_little_endian( mach_read_from_2_little_endian(
/*===========================*/ /*===========================*/
/* out: unsigned long int */ /* out: unsigned long int */
byte* buf); /* in: from where to read */ const byte* buf); /* in: from where to read */
/************************************************************* /*************************************************************
Writes a ulint in the little-endian format. */ Writes a ulint in the little-endian format. */
UNIV_INLINE UNIV_INLINE
......
...@@ -29,7 +29,7 @@ ulint ...@@ -29,7 +29,7 @@ ulint
mach_read_from_1( mach_read_from_1(
/*=============*/ /*=============*/
/* out: ulint integer, >= 0, < 256 */ /* out: ulint integer, >= 0, < 256 */
byte* b) /* in: pointer to byte */ const byte* b) /* in: pointer to byte */
{ {
ut_ad(b); ut_ad(b);
return((ulint)(b[0])); return((ulint)(b[0]));
...@@ -60,7 +60,7 @@ ulint ...@@ -60,7 +60,7 @@ ulint
mach_read_from_2( mach_read_from_2(
/*=============*/ /*=============*/
/* out: ulint integer */ /* out: ulint integer */
byte* b) /* in: pointer to 2 bytes */ const byte* b) /* in: pointer to 2 bytes */
{ {
ut_ad(b); ut_ad(b);
return( ((ulint)(b[0]) << 8) return( ((ulint)(b[0]) << 8)
...@@ -96,7 +96,7 @@ mach_decode_2( ...@@ -96,7 +96,7 @@ mach_decode_2(
uint16 n) /* in: 16-bit integer in canonical format */ uint16 n) /* in: 16-bit integer in canonical format */
{ {
ut_ad(2 == sizeof n); ut_ad(2 == sizeof n);
return(mach_read_from_2((byte*) &n)); return(mach_read_from_2((const byte*) &n));
} }
/*********************************************************** /***********************************************************
...@@ -125,7 +125,7 @@ ulint ...@@ -125,7 +125,7 @@ ulint
mach_read_from_3( mach_read_from_3(
/*=============*/ /*=============*/
/* out: ulint integer */ /* out: ulint integer */
byte* b) /* in: pointer to 3 bytes */ const byte* b) /* in: pointer to 3 bytes */
{ {
ut_ad(b); ut_ad(b);
return( ((ulint)(b[0]) << 16) return( ((ulint)(b[0]) << 16)
...@@ -160,7 +160,7 @@ ulint ...@@ -160,7 +160,7 @@ ulint
mach_read_from_4( mach_read_from_4(
/*=============*/ /*=============*/
/* out: ulint integer */ /* out: ulint integer */
byte* b) /* in: pointer to four bytes */ const byte* b) /* in: pointer to four bytes */
{ {
ut_ad(b); ut_ad(b);
return( ((ulint)(b[0]) << 24) return( ((ulint)(b[0]) << 24)
...@@ -235,7 +235,7 @@ ulint ...@@ -235,7 +235,7 @@ ulint
mach_read_compressed( mach_read_compressed(
/*=================*/ /*=================*/
/* out: read integer (< 2^32) */ /* out: read integer (< 2^32) */
byte* b) /* in: pointer to memory from where to read */ const byte* b) /* in: pointer to memory from where to read */
{ {
ulint flag; ulint flag;
...@@ -281,7 +281,7 @@ dulint ...@@ -281,7 +281,7 @@ dulint
mach_read_from_8( mach_read_from_8(
/*=============*/ /*=============*/
/* out: dulint integer */ /* out: dulint integer */
byte* b) /* in: pointer to 8 bytes */ const byte* b) /* in: pointer to 8 bytes */
{ {
ulint high; ulint high;
ulint low; ulint low;
...@@ -318,7 +318,7 @@ dulint ...@@ -318,7 +318,7 @@ dulint
mach_read_from_7( mach_read_from_7(
/*=============*/ /*=============*/
/* out: dulint integer */ /* out: dulint integer */
byte* b) /* in: pointer to 7 bytes */ const byte* b) /* in: pointer to 7 bytes */
{ {
ulint high; ulint high;
ulint low; ulint low;
...@@ -355,7 +355,7 @@ dulint ...@@ -355,7 +355,7 @@ dulint
mach_read_from_6( mach_read_from_6(
/*=============*/ /*=============*/
/* out: dulint integer */ /* out: dulint integer */
byte* b) /* in: pointer to 7 bytes */ const byte* b) /* in: pointer to 7 bytes */
{ {
ulint high; ulint high;
ulint low; ulint low;
...@@ -407,7 +407,7 @@ dulint ...@@ -407,7 +407,7 @@ dulint
mach_dulint_read_compressed( mach_dulint_read_compressed(
/*========================*/ /*========================*/
/* out: read dulint */ /* out: read dulint */
byte* b) /* in: pointer to memory from where to read */ const byte* b) /* in: pointer to memory from where to read */
{ {
ulint high; ulint high;
ulint low; ulint low;
...@@ -474,7 +474,7 @@ dulint ...@@ -474,7 +474,7 @@ dulint
mach_dulint_read_much_compressed( mach_dulint_read_much_compressed(
/*=============================*/ /*=============================*/
/* out: read dulint */ /* out: read dulint */
byte* b) /* in: pointer to memory from where to read */ const byte* b) /* in: pointer to memory from where to read */
{ {
ulint high; ulint high;
ulint low; ulint low;
...@@ -503,7 +503,7 @@ double ...@@ -503,7 +503,7 @@ double
mach_double_read( mach_double_read(
/*=============*/ /*=============*/
/* out: double read */ /* out: double read */
byte* b) /* in: pointer to memory from where to read */ const byte* b) /* in: pointer to memory from where to read */
{ {
double d; double d;
ulint i; ulint i;
...@@ -552,7 +552,7 @@ float ...@@ -552,7 +552,7 @@ float
mach_float_read( mach_float_read(
/*============*/ /*============*/
/* out: float read */ /* out: float read */
byte* b) /* in: pointer to memory from where to read */ const byte* b) /* in: pointer to memory from where to read */
{ {
float d; float d;
ulint i; ulint i;
...@@ -601,11 +601,11 @@ ulint ...@@ -601,11 +601,11 @@ ulint
mach_read_from_n_little_endian( mach_read_from_n_little_endian(
/*===========================*/ /*===========================*/
/* out: unsigned long int */ /* out: unsigned long int */
byte* buf, /* in: from where to read */ const byte* buf, /* in: from where to read */
ulint buf_size) /* in: from how many bytes to read */ ulint buf_size) /* in: from how many bytes to read */
{ {
ulint n = 0; ulint n = 0;
byte* ptr; const byte* ptr;
ut_ad(buf_size <= sizeof(ulint)); ut_ad(buf_size <= sizeof(ulint));
ut_ad(buf_size > 0); ut_ad(buf_size > 0);
...@@ -666,7 +666,7 @@ ulint ...@@ -666,7 +666,7 @@ ulint
mach_read_from_2_little_endian( mach_read_from_2_little_endian(
/*===========================*/ /*===========================*/
/* out: unsigned long int */ /* out: unsigned long int */
byte* buf) /* in: from where to read */ const byte* buf) /* in: from where to read */
{ {
return((ulint)(*buf) + ((ulint)(*(buf + 1))) * 256); return((ulint)(*buf) + ((ulint)(*(buf + 1))) * 256);
} }
......
...@@ -490,8 +490,7 @@ page_zip_dir_encode( ...@@ -490,8 +490,7 @@ page_zip_dir_encode(
} else { } else {
status = REC_STATUS_NODE_PTR; status = REC_STATUS_NODE_PTR;
if (UNIV_UNLIKELY if (UNIV_UNLIKELY
(mach_read_from_4((page_t*) page + FIL_PAGE_PREV) (mach_read_from_4(page + FIL_PAGE_PREV) == FIL_NULL)) {
== FIL_NULL)) {
min_mark = REC_INFO_MIN_REC_FLAG; min_mark = REC_INFO_MIN_REC_FLAG;
} }
} }
...@@ -3602,8 +3601,7 @@ page_zip_copy( ...@@ -3602,8 +3601,7 @@ page_zip_copy(
+ page_zip->m_end < page_zip->size); + page_zip->m_end < page_zip->size);
if (!page_is_leaf(src) if (!page_is_leaf(src)
&& UNIV_UNLIKELY(mach_read_from_4((byte*) src && UNIV_UNLIKELY(mach_read_from_4(src + FIL_PAGE_PREV) == FIL_NULL)
+ FIL_PAGE_PREV) == FIL_NULL)
&& UNIV_LIKELY(mach_read_from_4(page && UNIV_LIKELY(mach_read_from_4(page
+ FIL_PAGE_PREV) != FIL_NULL)) { + FIL_PAGE_PREV) != FIL_NULL)) {
/* Clear the REC_INFO_MIN_REC_FLAG of the first user record. */ /* 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