Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
a3c2aa96
Commit
a3c2aa96
authored
Aug 30, 2007
by
sunny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a bug that handles the case where the host specific byte order matches
the InnoDB storage byte order, which is big-endian.
parent
6eb200a4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
16 deletions
+53
-16
include/mach0data.h
include/mach0data.h
+11
-0
include/mach0data.ic
include/mach0data.ic
+37
-0
row/row0sel.c
row/row0sel.c
+5
-16
No files found.
include/mach0data.h
View file @
a3c2aa96
...
...
@@ -327,6 +327,17 @@ mach_write_to_2_little_endian(
byte
*
dest
,
/* in: where to write */
ulint
n
);
/* in: unsigned long int to write */
/*************************************************************
Convert integral type from storage byte order (big endian) to
host byte order. */
UNIV_INLINE
void
mach_read_int_type
(
/*===============*/
byte
*
dest
,
/* out: where to write */
const
byte
*
src
,
/* in: where to read from */
ulint
len
,
/* in: length of src */
ibool
unsigned_type
);
/* in: signed or unsigned flag */
#ifndef UNIV_NONINL
#include "mach0data.ic"
#endif
...
...
include/mach0data.ic
View file @
a3c2aa96
...
...
@@ -7,6 +7,8 @@ to the machine format.
Created 11/28/1995 Heikki Tuuri
***********************************************************************/
#include "ut0mem.h"
/***********************************************************
The following function is used to store data in one byte. */
UNIV_INLINE
...
...
@@ -689,3 +691,38 @@ mach_write_to_2_little_endian(
*dest = (byte)(n & 0xFFUL);
}
/*************************************************************
Convert integral type from storage byte order (big endian) to
host byte order. */
UNIV_INLINE
void
mach_read_int_type(
/*===============*/
byte* dest, /* out: where to write */
const byte* src, /* in: where to read from */
ulint len, /* in: length of src */
ibool unsigned_type) /* in: signed or unsigned flag */
{
#ifdef WORDS_BIGENDIAN
memcpy(dest, src, len);
if (!unsigned_type) {
dest[0] ^= 128;
}
#else
byte* ptr;
/* Convert integer data from Innobase to a little-endian format,
sign bit restored to normal. */
for (ptr = dest + len; ptr != dest; ++src) {
--ptr;
*ptr = *src;
}
if (!unsigned_type) {
dest[len - 1] ^= 128;
}
#endif
}
row/row0sel.c
View file @
a3c2aa96
...
...
@@ -4533,7 +4533,6 @@ row_search_autoinc_read_column(
ibool
unsigned_type
)
/* in: signed or unsigned flag */
{
ulint
len
;
byte
*
ptr
;
const
byte
*
data
;
ib_longlong
value
;
mem_heap_t
*
heap
=
NULL
;
...
...
@@ -4555,34 +4554,24 @@ row_search_autoinc_read_column(
ut_a
(
len
!=
UNIV_SQL_NULL
);
ut_a
(
len
<=
sizeof
value
);
/* Convert integer data from Innobase to a little-endian format,
sign bit restored to normal */
for
(
ptr
=
dest
+
len
;
ptr
!=
dest
;
++
data
)
{
--
ptr
;
*
ptr
=
*
data
;
}
if
(
!
unsigned_type
)
{
dest
[
len
-
1
]
^=
128
;
}
mach_read_int_type
(
dest
,
data
,
len
,
unsigned_type
);
/* The assumption here is that the AUTOINC value can't be negative.*/
switch
(
len
)
{
case
8
:
value
=
*
(
ib_longlong
*
)
ptr
;
value
=
*
(
ib_longlong
*
)
dest
;
break
;
case
4
:
value
=
*
(
ib_uint32_t
*
)
ptr
;
value
=
*
(
ib_uint32_t
*
)
dest
;
break
;
case
2
:
value
=
*
(
uint16
*
)
ptr
;
value
=
*
(
uint16
*
)
dest
;
break
;
case
1
:
value
=
*
ptr
;
value
=
*
dest
;
break
;
default:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment