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
2ab1e065
Commit
2ab1e065
authored
Jul 09, 2006
by
kostja@bodhi.local
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compiler warnings in sql_udf.h: ISO C++ forbids casting
between pointer to function and pointer to object.
parent
f1d949a8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
23 deletions
+25
-23
sql/item_func.cc
sql/item_func.cc
+2
-5
sql/sql_udf.cc
sql/sql_udf.cc
+5
-5
sql/sql_udf.h
sql/sql_udf.h
+18
-13
No files found.
sql/item_func.cc
View file @
2ab1e065
...
...
@@ -2510,8 +2510,7 @@ void udf_handler::cleanup()
{
if
(
u_d
->
func_deinit
!=
NULL
)
{
void
(
*
deinit
)(
UDF_INIT
*
)
=
(
void
(
*
)(
UDF_INIT
*
))
u_d
->
func_deinit
;
Udf_func_deinit
deinit
=
u_d
->
func_deinit
;
(
*
deinit
)(
&
initid
);
}
free_udf
(
u_d
);
...
...
@@ -2656,9 +2655,7 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func,
}
}
thd
->
net
.
last_error
[
0
]
=
0
;
my_bool
(
*
init
)(
UDF_INIT
*
,
UDF_ARGS
*
,
char
*
)
=
(
my_bool
(
*
)(
UDF_INIT
*
,
UDF_ARGS
*
,
char
*
))
u_d
->
func_init
;
Udf_func_init
init
=
u_d
->
func_init
;
if
((
error
=
(
uchar
)
init
(
&
initid
,
&
f_args
,
thd
->
net
.
last_error
)))
{
my_error
(
ER_CANT_INITIALIZE_UDF
,
MYF
(
0
),
...
...
sql/sql_udf.cc
View file @
2ab1e065
...
...
@@ -83,7 +83,7 @@ static char *init_syms(udf_func *tmp, char *nm)
{
char
*
end
;
if
(
!
((
tmp
->
func
=
dlsym
(
tmp
->
dlhandle
,
tmp
->
name
.
str
))))
if
(
!
((
tmp
->
func
=
(
Udf_func_any
)
dlsym
(
tmp
->
dlhandle
,
tmp
->
name
.
str
))))
return
tmp
->
name
.
str
;
end
=
strmov
(
nm
,
tmp
->
name
.
str
);
...
...
@@ -91,18 +91,18 @@ static char *init_syms(udf_func *tmp, char *nm)
if
(
tmp
->
type
==
UDFTYPE_AGGREGATE
)
{
(
void
)
strmov
(
end
,
"_clear"
);
if
(
!
((
tmp
->
func_clear
=
dlsym
(
tmp
->
dlhandle
,
nm
))))
if
(
!
((
tmp
->
func_clear
=
(
Udf_func_clear
)
dlsym
(
tmp
->
dlhandle
,
nm
))))
return
nm
;
(
void
)
strmov
(
end
,
"_add"
);
if
(
!
((
tmp
->
func_add
=
dlsym
(
tmp
->
dlhandle
,
nm
))))
if
(
!
((
tmp
->
func_add
=
(
Udf_func_add
)
dlsym
(
tmp
->
dlhandle
,
nm
))))
return
nm
;
}
(
void
)
strmov
(
end
,
"_deinit"
);
tmp
->
func_deinit
=
dlsym
(
tmp
->
dlhandle
,
nm
);
tmp
->
func_deinit
=
(
Udf_func_deinit
)
dlsym
(
tmp
->
dlhandle
,
nm
);
(
void
)
strmov
(
end
,
"_init"
);
tmp
->
func_init
=
dlsym
(
tmp
->
dlhandle
,
nm
);
tmp
->
func_init
=
(
Udf_func_init
)
dlsym
(
tmp
->
dlhandle
,
nm
);
/*
to prefent loading "udf" from, e.g. libc.so
...
...
sql/sql_udf.h
View file @
2ab1e065
...
...
@@ -23,6 +23,15 @@
enum
Item_udftype
{
UDFTYPE_FUNCTION
=
1
,
UDFTYPE_AGGREGATE
};
typedef
void
(
*
Udf_func_clear
)(
UDF_INIT
*
,
uchar
*
,
uchar
*
);
typedef
void
(
*
Udf_func_add
)(
UDF_INIT
*
,
UDF_ARGS
*
,
uchar
*
,
uchar
*
);
typedef
void
(
*
Udf_func_deinit
)(
UDF_INIT
*
);
typedef
my_bool
(
*
Udf_func_init
)(
UDF_INIT
*
,
UDF_ARGS
*
,
char
*
);
typedef
void
(
*
Udf_func_any
)();
typedef
double
(
*
Udf_func_double
)(
UDF_INIT
*
,
UDF_ARGS
*
,
uchar
*
,
uchar
*
);
typedef
longlong
(
*
Udf_func_longlong
)(
UDF_INIT
*
,
UDF_ARGS
*
,
uchar
*
,
uchar
*
);
typedef
struct
st_udf_func
{
LEX_STRING
name
;
...
...
@@ -30,11 +39,11 @@ typedef struct st_udf_func
Item_udftype
type
;
char
*
dl
;
void
*
dlhandle
;
void
*
func
;
void
*
func_init
;
void
*
func_deinit
;
void
*
func_clear
;
void
*
func_add
;
Udf_func_any
func
;
Udf_func_init
func_init
;
Udf_func_deinit
func_deinit
;
Udf_func_clear
func_clear
;
Udf_func_add
func_add
;
ulong
usage_count
;
}
udf_func
;
...
...
@@ -76,8 +85,7 @@ class udf_handler :public Sql_alloc
*
null_value
=
1
;
return
0.0
;
}
double
(
*
func
)(
UDF_INIT
*
,
UDF_ARGS
*
,
uchar
*
,
uchar
*
)
=
(
double
(
*
)(
UDF_INIT
*
,
UDF_ARGS
*
,
uchar
*
,
uchar
*
))
u_d
->
func
;
Udf_func_double
func
=
(
Udf_func_double
)
u_d
->
func
;
double
tmp
=
func
(
&
initid
,
&
f_args
,
&
is_null
,
&
error
);
if
(
is_null
||
error
)
{
...
...
@@ -95,8 +103,7 @@ class udf_handler :public Sql_alloc
*
null_value
=
1
;
return
LL
(
0
);
}
longlong
(
*
func
)(
UDF_INIT
*
,
UDF_ARGS
*
,
uchar
*
,
uchar
*
)
=
(
longlong
(
*
)(
UDF_INIT
*
,
UDF_ARGS
*
,
uchar
*
,
uchar
*
))
u_d
->
func
;
Udf_func_longlong
func
=
(
Udf_func_longlong
)
u_d
->
func
;
longlong
tmp
=
func
(
&
initid
,
&
f_args
,
&
is_null
,
&
error
);
if
(
is_null
||
error
)
{
...
...
@@ -110,8 +117,7 @@ class udf_handler :public Sql_alloc
void
clear
()
{
is_null
=
0
;
void
(
*
func
)(
UDF_INIT
*
,
uchar
*
,
uchar
*
)
=
(
void
(
*
)(
UDF_INIT
*
,
uchar
*
,
uchar
*
))
u_d
->
func_clear
;
Udf_func_clear
func
=
u_d
->
func_clear
;
func
(
&
initid
,
&
is_null
,
&
error
);
}
void
add
(
my_bool
*
null_value
)
...
...
@@ -121,8 +127,7 @@ class udf_handler :public Sql_alloc
*
null_value
=
1
;
return
;
}
void
(
*
func
)(
UDF_INIT
*
,
UDF_ARGS
*
,
uchar
*
,
uchar
*
)
=
(
void
(
*
)(
UDF_INIT
*
,
UDF_ARGS
*
,
uchar
*
,
uchar
*
))
u_d
->
func_add
;
Udf_func_add
func
=
u_d
->
func_add
;
func
(
&
initid
,
&
f_args
,
&
is_null
,
&
error
);
*
null_value
=
(
my_bool
)
(
is_null
||
error
);
}
...
...
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