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
4a784356
Commit
4a784356
authored
Sep 30, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: an outbreak of templatonia cured.
parent
9fe7feb8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
63 deletions
+9
-63
sql/log_event.cc
sql/log_event.cc
+9
-28
sql/sql_priv.h
sql/sql_priv.h
+0
-35
No files found.
sql/log_event.cc
View file @
4a784356
...
...
@@ -88,23 +88,6 @@ TYPELIB binlog_checksum_typelib=
*/
#define FMT_G_BUFSIZE(PREC) (3 + (PREC) + 5 + 1)
/*
Explicit instantiation to unsigned int of template available_buffer
function.
*/
template
unsigned
int
available_buffer
<
unsigned
int
>(
const
char
*
,
const
char
*
,
unsigned
int
);
/*
Explicit instantiation to unsigned int of template valid_buffer_range
function.
*/
template
bool
valid_buffer_range
<
unsigned
int
>(
unsigned
int
,
const
char
*
,
const
char
*
,
unsigned
int
);
/*
replication event checksum is introduced in the following "checksum-home" version.
The checksum-aware servers extract FD's version to decide whether the FD event
...
...
@@ -7539,9 +7522,9 @@ User_var_log_event(const char* buf, uint event_len,
#endif
{
bool
error
=
false
;
const
char
*
buf_start
=
buf
;
const
char
*
buf_start
=
buf
,
*
buf_end
=
buf
+
event_len
;
/* The Post-Header is empty. The Variable Data part begins immediately. */
const
char
*
start
=
buf
;
buf
+=
description_event
->
common_header_len
+
description_event
->
post_header_len
[
USER_VAR_EVENT
-
1
];
name_len
=
uint4korr
(
buf
);
...
...
@@ -7552,8 +7535,7 @@ User_var_log_event(const char* buf, uint event_len,
may have the bigger value possible, is_null= True and there is no
payload for val, or even that name_len is 0.
*/
if
(
!
valid_buffer_range
<
uint
>
(
name_len
,
buf_start
,
name
,
event_len
-
UV_VAL_IS_NULL
))
if
(
name
+
name_len
+
UV_NAME_LEN_SIZE
>
buf_end
)
{
error
=
true
;
goto
err
;
...
...
@@ -7571,9 +7553,10 @@ User_var_log_event(const char* buf, uint event_len,
}
else
{
if
(
!
valid_buffer_range
<
uint
>
(
UV_VAL_IS_NULL
+
UV_VAL_TYPE_SIZE
+
UV_CHARSET_NUMBER_SIZE
+
UV_VAL_LEN_SIZE
,
buf_start
,
buf
,
event_len
))
val
=
(
char
*
)
(
buf
+
UV_VAL_IS_NULL
+
UV_VAL_TYPE_SIZE
+
UV_CHARSET_NUMBER_SIZE
+
UV_VAL_LEN_SIZE
);
if
(
val
>
buf_end
)
{
error
=
true
;
goto
err
;
...
...
@@ -7583,10 +7566,8 @@ User_var_log_event(const char* buf, uint event_len,
charset_number
=
uint4korr
(
buf
+
UV_VAL_IS_NULL
+
UV_VAL_TYPE_SIZE
);
val_len
=
uint4korr
(
buf
+
UV_VAL_IS_NULL
+
UV_VAL_TYPE_SIZE
+
UV_CHARSET_NUMBER_SIZE
);
val
=
(
char
*
)
(
buf
+
UV_VAL_IS_NULL
+
UV_VAL_TYPE_SIZE
+
UV_CHARSET_NUMBER_SIZE
+
UV_VAL_LEN_SIZE
);
if
(
!
valid_buffer_range
<
uint
>
(
val_len
,
buf_start
,
val
,
event_len
)
)
if
(
val
+
val_len
>
buf_end
)
{
error
=
true
;
goto
err
;
...
...
@@ -7603,7 +7584,7 @@ User_var_log_event(const char* buf, uint event_len,
Old events will not have this extra byte, thence,
we keep the flags set to UNDEF_F.
*/
uint
bytes_read
=
((
val
+
val_len
)
-
start
);
uint
bytes_read
=
((
val
+
val_len
)
-
buf_
start
);
#ifndef DBUG_OFF
bool
old_pre_checksum_fd
=
description_event
->
is_version_before_checksum
(
&
description_event
->
server_version_split
);
...
...
sql/sql_priv.h
View file @
4a784356
...
...
@@ -159,41 +159,6 @@
#define OPTION_ALLOW_BATCH (1ULL << 36) // THD, intern (slave)
#define OPTION_SKIP_REPLICATION (1ULL << 37) // THD, user
/*
Check how many bytes are available on buffer.
@param buf_start Pointer to buffer start.
@param buf_current Pointer to the current position on buffer.
@param buf_len Buffer length.
@return Number of bytes available on event buffer.
*/
template
<
class
T
>
T
available_buffer
(
const
char
*
buf_start
,
const
char
*
buf_current
,
T
buf_len
)
{
return
buf_len
-
(
buf_current
-
buf_start
);
}
/*
Check if jump value is within buffer limits.
@param jump Number of positions we want to advance.
@param buf_start Pointer to buffer start
@param buf_current Pointer to the current position on buffer.
@param buf_len Buffer length.
@return True If jump value is within buffer limits.
False Otherwise.
*/
template
<
class
T
>
bool
valid_buffer_range
(
T
jump
,
const
char
*
buf_start
,
const
char
*
buf_current
,
T
buf_len
)
{
return
(
jump
<=
available_buffer
(
buf_start
,
buf_current
,
buf_len
));
}
/* The rest of the file is included in the server only */
#ifndef MYSQL_CLIENT
...
...
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