summaryrefslogtreecommitdiff
path: root/storage/innobase/include/mach0data.h
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-03-01 08:27:39 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-03-07 19:07:27 +0200
commit89d80c1b0be94639d0913dee7b6a284c32787b09 (patch)
treea08340d45a09b067df4490259f68b5a3f9d2fa03 /storage/innobase/include/mach0data.h
parentd2f5e624223fe502ddf4c6f42062c29edb988627 (diff)
downloadmariadb-git-89d80c1b0be94639d0913dee7b6a284c32787b09.tar.gz
Fix many -Wconversion warnings.
Define my_thread_id as an unsigned type, to avoid mismatch with ulonglong. Change some parameters to this type. Use size_t in a few more places. Declare many flag constants as unsigned to avoid sign mismatch when shifting bits or applying the unary ~ operator. When applying the unary ~ operator to enum constants, explictly cast the result to an unsigned type, because enum constants can be treated as signed. In InnoDB, change the source code line number parameters from ulint to unsigned type. Also, make some InnoDB functions return a narrower type (unsigned or uint32_t instead of ulint; bool instead of ibool).
Diffstat (limited to 'storage/innobase/include/mach0data.h')
-rw-r--r--storage/innobase/include/mach0data.h44
1 files changed, 20 insertions, 24 deletions
diff --git a/storage/innobase/include/mach0data.h b/storage/innobase/include/mach0data.h
index 3d6bccec718..d3e3a53c655 100644
--- a/storage/innobase/include/mach0data.h
+++ b/storage/innobase/include/mach0data.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -45,14 +46,13 @@ mach_write_to_1(
/*============*/
byte* b, /*!< in: pointer to byte where to store */
ulint n); /*!< in: ulint integer to be stored, >= 0, < 256 */
-/********************************************************//**
-The following function is used to fetch data from one byte.
+/** The following function is used to fetch data from one byte.
+@param[in] b pointer to a byte to read
@return ulint integer, >= 0, < 256 */
UNIV_INLINE
-ulint
+uint8_t
mach_read_from_1(
-/*=============*/
- const byte* b) /*!< in: pointer to byte */
+ const byte* b)
MY_ATTRIBUTE((warn_unused_result));
/*******************************************************//**
The following function is used to store data in two consecutive
@@ -63,17 +63,15 @@ mach_write_to_2(
/*============*/
byte* b, /*!< in: pointer to two bytes where to store */
ulint n); /*!< in: ulint integer to be stored, >= 0, < 64k */
-/********************************************************//**
-The following function is used to fetch data from two consecutive
+/** The following function is used to fetch data from 2 consecutive
bytes. The most significant byte is at the lowest address.
-@return ulint integer, >= 0, < 64k */
+@param[in] b pointer to 2 bytes where to store
+@return 2-byte integer, >= 0, < 64k */
UNIV_INLINE
-ulint
+uint16_t
mach_read_from_2(
-/*=============*/
- const byte* b) /*!< in: pointer to two bytes */
+ const byte* b)
MY_ATTRIBUTE((warn_unused_result));
-
/********************************************************//**
The following function is used to convert a 16-bit data item
to the canonical format, for fast bytewise equality test
@@ -105,15 +103,14 @@ mach_write_to_3(
/*============*/
byte* b, /*!< in: pointer to 3 bytes where to store */
ulint n); /*!< in: ulint integer to be stored */
-/********************************************************//**
-The following function is used to fetch data from 3 consecutive
+/** The following function is used to fetch data from 3 consecutive
bytes. The most significant byte is at the lowest address.
-@return ulint integer */
+@param[in] b pointer to 3 bytes to read
+@return 32 bit integer */
UNIV_INLINE
-ulint
+uint32_t
mach_read_from_3(
-/*=============*/
- const byte* b) /*!< in: pointer to 3 bytes */
+ const byte* b)
MY_ATTRIBUTE((warn_unused_result));
/*******************************************************//**
The following function is used to store data in four consecutive
@@ -124,15 +121,14 @@ mach_write_to_4(
/*============*/
byte* b, /*!< in: pointer to four bytes where to store */
ulint n); /*!< in: ulint integer to be stored */
-/********************************************************//**
-The following function is used to fetch data from 4 consecutive
+/** The following function is used to fetch data from 4 consecutive
bytes. The most significant byte is at the lowest address.
-@return ulint integer */
+@param[in] b pointer to 4 bytes to read
+@return 32 bit integer */
UNIV_INLINE
-ulint
+uint32_t
mach_read_from_4(
-/*=============*/
- const byte* b) /*!< in: pointer to four bytes */
+ const byte* b)
MY_ATTRIBUTE((warn_unused_result));
/*********************************************************//**
Writes a ulint in a compressed form (1..5 bytes).