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
65e53c8b
Commit
65e53c8b
authored
Oct 18, 2016
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: Field_blob::get_ptr()
and declare few other Field getters to be 'const'
parent
9a3ec79b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
36 deletions
+30
-36
sql/field.cc
sql/field.cc
+5
-6
sql/field.h
sql/field.h
+22
-24
sql/sql_insert.cc
sql/sql_insert.cc
+1
-3
sql/sql_join_cache.cc
sql/sql_join_cache.cc
+1
-1
storage/archive/ha_archive.cc
storage/archive/ha_archive.cc
+1
-2
No files found.
sql/field.cc
View file @
65e53c8b
...
...
@@ -7883,7 +7883,7 @@ void Field_blob::store_length(uchar *i_ptr, uint i_packlength, uint32 i_number)
}
uint32
Field_blob
::
get_length
(
const
uchar
*
pos
,
uint
packlength_arg
)
uint32
Field_blob
::
get_length
(
const
uchar
*
pos
,
uint
packlength_arg
)
const
{
return
(
uint32
)
read_lowendian
(
pos
,
packlength_arg
);
}
...
...
@@ -7898,8 +7898,7 @@ int Field_blob::copy_value(Field_blob *from)
DBUG_ASSERT
(
field_charset
==
from
->
charset
());
int
rc
=
0
;
uint32
length
=
from
->
get_length
();
uchar
*
data
;
from
->
get_ptr
(
&
data
);
uchar
*
data
=
from
->
get_ptr
();
if
(
packlength
<
from
->
packlength
)
{
set_if_smaller
(
length
,
Field_blob
::
max_data_length
());
...
...
@@ -8146,7 +8145,7 @@ uint Field_blob::get_key_image(uchar *buff,uint length, imagetype type_arg)
bzero
(
buff
,
image_length
);
return
image_length
;
}
get_ptr
(
&
blob
);
blob
=
get_ptr
(
);
gobj
=
Geometry
::
construct
(
&
buffer
,
(
char
*
)
blob
,
blob_length
);
if
(
!
gobj
||
gobj
->
get_mbr
(
&
mbr
,
&
dummy
))
bzero
(
buff
,
image_length
);
...
...
@@ -8161,7 +8160,7 @@ uint Field_blob::get_key_image(uchar *buff,uint length, imagetype type_arg)
}
#endif
/*HAVE_SPATIAL*/
get_ptr
(
&
blob
);
blob
=
get_ptr
(
);
uint
local_char_length
=
length
/
field_charset
->
mbmaxlen
;
local_char_length
=
my_charpos
(
field_charset
,
blob
,
blob
+
blob_length
,
local_char_length
);
...
...
@@ -8320,7 +8319,7 @@ uchar *Field_blob::pack(uchar *to, const uchar *from, uint max_length)
*/
if
(
length
>
0
)
{
get_ptr
((
uchar
**
)
&
from
);
from
=
get_ptr
(
);
memcpy
(
to
+
packlength
,
from
,
length
);
}
ptr
=
save
;
// Restore org row pointer
...
...
sql/field.h
View file @
65e53c8b
...
...
@@ -1265,7 +1265,7 @@ class Field: public Value_source
virtual
uint
max_packed_col_length
(
uint
max_length
)
{
return
max_length
;}
uint
offset
(
uchar
*
record
)
uint
offset
(
uchar
*
record
)
const
{
return
(
uint
)
(
ptr
-
record
);
}
...
...
@@ -3266,30 +3266,29 @@ class Field_blob :public Field_longstr {
{
store_length
(
ptr
,
packlength
,
number
);
}
inline
uint32
get_length
(
uint
row_offset
=
0
)
inline
uint32
get_length
(
uint
row_offset
=
0
)
const
{
return
get_length
(
ptr
+
row_offset
,
this
->
packlength
);
}
uint32
get_length
(
const
uchar
*
ptr
,
uint
packlength
);
uint32
get_length
(
const
uchar
*
ptr_arg
)
uint32
get_length
(
const
uchar
*
ptr
,
uint
packlength
)
const
;
uint32
get_length
(
const
uchar
*
ptr_arg
)
const
{
return
get_length
(
ptr_arg
,
this
->
packlength
);
}
inline
void
get_ptr
(
uchar
**
str
)
{
memcpy
(
str
,
ptr
+
packlength
,
sizeof
(
uchar
*
));
}
inline
void
get_ptr
(
uchar
**
str
,
uint
row_offset
)
{
memcpy
(
str
,
ptr
+
packlength
+
row_offset
,
sizeof
(
char
*
));
}
inline
uchar
*
get_ptr
()
const
{
return
get_ptr
(
0
);
}
inline
uchar
*
get_ptr
(
my_ptrdiff_t
row_offset
)
const
{
uchar
*
s
;
memcpy
(
&
s
,
ptr
+
packlength
+
row_offset
,
sizeof
(
uchar
*
));
return
s
;
}
inline
void
set_ptr
(
uchar
*
length
,
uchar
*
data
)
{
memcpy
(
ptr
,
length
,
packlength
);
memcpy
(
ptr
+
packlength
,
&
data
,
sizeof
(
char
*
));
}
{
memcpy
(
ptr
,
length
,
packlength
);
memcpy
(
ptr
+
packlength
,
&
data
,
sizeof
(
char
*
));
}
void
set_ptr_offset
(
my_ptrdiff_t
ptr_diff
,
uint32
length
,
uchar
*
data
)
{
uchar
*
ptr_ofs
=
ADD_TO_PTR
(
ptr
,
ptr_diff
,
uchar
*
);
store_length
(
ptr_ofs
,
packlength
,
length
);
memcpy
(
ptr_ofs
+
packlength
,
&
data
,
sizeof
(
char
*
));
}
{
uchar
*
ptr_ofs
=
ADD_TO_PTR
(
ptr
,
ptr_diff
,
uchar
*
);
store_length
(
ptr_ofs
,
packlength
,
length
);
memcpy
(
ptr_ofs
+
packlength
,
&
data
,
sizeof
(
char
*
));
}
inline
void
set_ptr
(
uint32
length
,
uchar
*
data
)
{
set_ptr_offset
(
0
,
length
,
data
);
...
...
@@ -3303,8 +3302,7 @@ class Field_blob :public Field_longstr {
void
sql_type
(
String
&
str
)
const
;
inline
bool
copy
()
{
uchar
*
tmp
;
get_ptr
(
&
tmp
);
uchar
*
tmp
=
get_ptr
();
if
(
value
.
copy
((
char
*
)
tmp
,
get_length
(),
charset
()))
{
Field_blob
::
reset
();
...
...
@@ -3320,7 +3318,7 @@ class Field_blob :public Field_longstr {
uint
packed_col_length
(
const
uchar
*
col_ptr
,
uint
length
);
uint
max_packed_col_length
(
uint
max_length
);
void
free
()
{
value
.
free
();
}
inline
void
clear_temporary
()
{
bzero
((
uchar
*
)
&
value
,
sizeof
(
value
));
}
inline
void
clear_temporary
()
{
bzero
((
uchar
*
)
&
value
,
sizeof
(
value
));
}
uint
size_of
()
const
{
return
sizeof
(
*
this
);
}
bool
has_charset
(
void
)
const
{
return
charset
()
==
&
my_charset_bin
?
FALSE
:
TRUE
;
}
...
...
sql/sql_insert.cc
View file @
65e53c8b
...
...
@@ -3126,9 +3126,7 @@ static void free_delayed_insert_blobs(register TABLE *table)
{
if
((
*
ptr
)
->
flags
&
BLOB_FLAG
)
{
uchar
*
str
;
((
Field_blob
*
)
(
*
ptr
))
->
get_ptr
(
&
str
);
my_free
(
str
);
my_free
(((
Field_blob
*
)
(
*
ptr
))
->
get_ptr
());
((
Field_blob
*
)
(
*
ptr
))
->
reset
();
}
}
...
...
sql/sql_join_cache.cc
View file @
65e53c8b
...
...
@@ -1304,7 +1304,7 @@ uint JOIN_CACHE::write_record_data(uchar * link, bool *is_full)
uint
blob_len
=
blob_field
->
get_length
();
(
*
copy_ptr
)
->
blob_length
=
blob_len
;
len
+=
blob_len
;
blob_field
->
get_ptr
(
&
(
*
copy_ptr
)
->
str
);
(
*
copy_ptr
)
->
str
=
blob_field
->
get_ptr
(
);
}
}
}
...
...
storage/archive/ha_archive.cc
View file @
65e53c8b
...
...
@@ -383,8 +383,7 @@ unsigned int ha_archive::pack_row_v1(uchar *record)
uint32
length
=
((
Field_blob
*
)
table
->
field
[
*
blob
])
->
get_length
();
if
(
length
)
{
uchar
*
data_ptr
;
((
Field_blob
*
)
table
->
field
[
*
blob
])
->
get_ptr
(
&
data_ptr
);
uchar
*
data_ptr
=
((
Field_blob
*
)
table
->
field
[
*
blob
])
->
get_ptr
();
memcpy
(
pos
,
data_ptr
,
length
);
pos
+=
length
;
}
...
...
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