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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
646f4e4f
Commit
646f4e4f
authored
May 23, 2008
by
sunny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branches/5.1: Fix for bug# 36793. This is a back port from branches/zip. This
code has been tested on a big-endian machine too.
parent
1d628f12
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
49 deletions
+26
-49
include/mach0data.h
include/mach0data.h
+2
-2
include/mach0data.ic
include/mach0data.ic
+22
-16
row/row0sel.c
row/row0sel.c
+2
-31
No files found.
include/mach0data.h
View file @
646f4e4f
...
...
@@ -331,10 +331,10 @@ mach_write_to_2_little_endian(
Convert integral type from storage byte order (big endian) to
host byte order. */
UNIV_INLINE
void
ullint
mach_read_int_type
(
/*===============*/
byte
*
dest
,
/* out: where to writ
e */
/* out: integer valu
e */
const
byte
*
src
,
/* in: where to read from */
ulint
len
,
/* in: length of src */
ibool
unsigned_type
);
/* in: signed or unsigned flag */
...
...
include/mach0data.ic
View file @
646f4e4f
...
...
@@ -696,33 +696,39 @@ mach_write_to_2_little_endian(
Convert integral type from storage byte order (big endian) to
host byte order. */
UNIV_INLINE
void
ullint
mach_read_int_type(
/*===============*/
byte* dest, /* out: where to writ
e */
/* out: integer valu
e */
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);
/* XXX this can be optimized on big-endian machines */
ullint ret;
uint i;
if (unsigned_type || (src[0] & 0x80)) {
ret = 0x0000000000000000ULL;
} else {
if (!unsigned_type) {
dest[0] ^= 128;
ret = 0xFFFFFFFFFFFFFF00ULL;
}
#else
byte* ptr;
/* Convert integer data from Innobase to a little-endian format,
sign bit restored to normal. */
if (unsigned_type) {
ret |= src[0];
} else {
for (ptr = dest + len; ptr != dest; ++src) {
--ptr;
*ptr = *src;
ret |= src[0] ^ 0x80;
}
if (!unsigned_type) {
dest[len - 1] ^= 128;
for (i = 1; i < len; i++) {
ret <<= 8;
ret |= src[i];
}
#endif
return(ret);
}
row/row0sel.c
View file @
646f4e4f
...
...
@@ -4563,8 +4563,6 @@ row_search_autoinc_read_column(
const
byte
*
data
;
ib_ulonglong
value
;
mem_heap_t
*
heap
=
NULL
;
/* Our requirement is that dest should be word aligned. */
byte
dest
[
sizeof
(
value
)];
ulint
offsets_
[
REC_OFFS_NORMAL_SIZE
];
ulint
*
offsets
=
offsets_
;
...
...
@@ -4582,40 +4580,13 @@ row_search_autoinc_read_column(
ut_a
(
len
!=
UNIV_SQL_NULL
);
ut_a
(
len
<=
sizeof
value
);
mach_read_int_type
(
dest
,
data
,
len
,
unsigned_type
);
/* The assumption here is that the AUTOINC value can't be negative
and that dest is word aligned. */
switch
(
len
)
{
case
8
:
value
=
*
(
ib_ulonglong
*
)
dest
;
break
;
case
4
:
value
=
*
(
ib_uint32_t
*
)
dest
;
break
;
case
3
:
value
=
*
(
ib_uint32_t
*
)
dest
;
value
&=
0xFFFFFF
;
break
;
case
2
:
value
=
*
(
uint16
*
)
dest
;
break
;
case
1
:
value
=
*
dest
;
break
;
default:
ut_error
;
}
value
=
mach_read_int_type
(
data
,
len
,
unsigned_type
);
if
(
UNIV_LIKELY_NULL
(
heap
))
{
mem_heap_free
(
heap
);
}
/* We assume that the autoinc counter can't be negative. */
if
(
!
unsigned_type
&&
(
ib_longlong
)
value
<
0
)
{
value
=
0
;
}
...
...
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