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
70d80305
Commit
70d80305
authored
Jun 03, 2015
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix swapping key numeric values on Big Endian machines.
modified: storage/connect/connect.cc
parent
af26c366
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
1 deletion
+31
-1
storage/connect/connect.cc
storage/connect/connect.cc
+31
-1
No files found.
storage/connect/connect.cc
View file @
70d80305
...
...
@@ -709,6 +709,28 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
return
(
tdbp
->
To_Kindex
->
IsMul
())
?
2
:
1
;
}
// end of CntIndexInit
#if defined(BIG_ENDIAN_ORDER)
/***********************************************************************/
/* Swap bytes of the key that are written in little endian order. */
/***********************************************************************/
static
void
SetSwapValue
(
PVAL
valp
,
char
*
kp
)
{
if
(
valp
->
IsTypeNum
()
&&
valp
->
GetType
()
!=
TYPE_DECIM
)
{
uchar
buf
[
8
];
int
i
,
k
=
valp
->
GetClen
();
for
(
i
=
0
;
k
>
0
;)
buf
[
i
++
]
=
kp
[
--
k
];
valp
->
SetBinValue
((
void
*
)
buf
);
}
else
valp
->
SetBinValue
((
void
*
)
kp
);
}
// end of SetSwapValue
#endif //LITTLE ENDIAN
/***********************************************************************/
/* IndexRead: fetch a record having the index value. */
/***********************************************************************/
...
...
@@ -797,7 +819,11 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
}
// endif b
}
else
#if defined(BIG_ENDIAN_ORDER)
SetSwapValue
(
valp
,
kp
);
#else // LITTLE ENDIAN
valp
->
SetBinValue
((
void
*
)
kp
);
#endif //LITTLE ENDIAN
kp
+=
valp
->
GetClen
();
...
...
@@ -912,7 +938,11 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
}
// endif b
}
else
valp
->
SetBinValue
((
void
*
)
p
);
#if defined(BIG_ENDIAN_ORDER)
SetSwapValue
(
valp
,
(
char
*
)
kp
);
#else // LITTLE ENDIAN
valp
->
SetBinValue
((
void
*
)
kp
);
#endif //LITTLE ENDIAN
if
(
trace
)
{
char
bf
[
32
];
...
...
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