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
ccc41712
Commit
ccc41712
authored
May 28, 2004
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Portability fix (using 'char' as argument to C functions may give warnings)
parent
be7f1a35
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
19 deletions
+25
-19
include/m_string.h
include/m_string.h
+1
-1
mysql-test/r/variables.result
mysql-test/r/variables.result
+1
-0
strings/int2str.c
strings/int2str.c
+23
-18
No files found.
include/m_string.h
View file @
ccc41712
...
@@ -225,7 +225,7 @@ extern long strtol(const char *str, char **ptr, int base);
...
@@ -225,7 +225,7 @@ extern long strtol(const char *str, char **ptr, int base);
extern
ulong
strtoul
(
const
char
*
str
,
char
**
ptr
,
int
base
);
extern
ulong
strtoul
(
const
char
*
str
,
char
**
ptr
,
int
base
);
#endif
#endif
extern
char
*
int2str
(
long
val
,
char
*
dst
,
int
radix
,
char
upcase
);
extern
char
*
int2str
(
long
val
,
char
*
dst
,
int
radix
,
int
upcase
);
extern
char
*
int10_to_str
(
long
val
,
char
*
dst
,
int
radix
);
extern
char
*
int10_to_str
(
long
val
,
char
*
dst
,
int
radix
);
extern
char
*
str2int
(
const
char
*
src
,
int
radix
,
long
lower
,
long
upper
,
extern
char
*
str2int
(
const
char
*
src
,
int
radix
,
long
lower
,
long
upper
,
long
*
val
);
long
*
val
);
...
...
mysql-test/r/variables.result
View file @
ccc41712
...
@@ -385,6 +385,7 @@ select 1;
...
@@ -385,6 +385,7 @@ select 1;
1
1
1
1
select @@session.key_buffer_size;
select @@session.key_buffer_size;
ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable
set ft_boolean_syntax = @@init_connect;
set ft_boolean_syntax = @@init_connect;
ERROR HY000: Variable 'ft_boolean_syntax' is a GLOBAL variable and should be set with SET GLOBAL
ERROR HY000: Variable 'ft_boolean_syntax' is a GLOBAL variable and should be set with SET GLOBAL
set global ft_boolean_syntax = @@init_connect;
set global ft_boolean_syntax = @@init_connect;
...
...
strings/int2str.c
View file @
ccc41712
...
@@ -34,7 +34,7 @@ char NEAR _dig_vec_lower[] =
...
@@ -34,7 +34,7 @@ char NEAR _dig_vec_lower[] =
val - value to convert
val - value to convert
dst - points to buffer where string representation should be stored
dst - points to buffer where string representation should be stored
radix - radix of scale of notation
radix - radix of scale of notation
upcase -
flag indicating that whenever
we should use upper-case digits
upcase -
set to 1 if
we should use upper-case digits
DESCRIPTION
DESCRIPTION
Converts the (long) integer value to its character form and moves it to
Converts the (long) integer value to its character form and moves it to
...
@@ -52,34 +52,39 @@ char NEAR _dig_vec_lower[] =
...
@@ -52,34 +52,39 @@ char NEAR _dig_vec_lower[] =
char
*
char
*
int2str
(
register
long
int
val
,
register
char
*
dst
,
register
int
radix
,
int2str
(
register
long
int
val
,
register
char
*
dst
,
register
int
radix
,
char
upcase
)
int
upcase
)
{
{
char
buffer
[
65
];
char
buffer
[
65
];
register
char
*
p
;
register
char
*
p
;
long
int
new_val
;
long
int
new_val
;
char
*
dig_vec
=
upcase
?
_dig_vec_upper
:
_dig_vec_lower
;
char
*
dig_vec
=
upcase
?
_dig_vec_upper
:
_dig_vec_lower
;
if
(
radix
<
0
)
{
if
(
radix
<
0
)
if
(
radix
<
-
36
||
radix
>
-
2
)
return
NullS
;
{
if
(
val
<
0
)
{
if
(
radix
<
-
36
||
radix
>
-
2
)
return
NullS
;
if
(
val
<
0
)
{
*
dst
++
=
'-'
;
*
dst
++
=
'-'
;
val
=
-
val
;
val
=
-
val
;
}
}
radix
=
-
radix
;
radix
=
-
radix
;
}
else
{
if
(
radix
>
36
||
radix
<
2
)
return
NullS
;
}
}
/* The slightly contorted code which follows is due to the
else
if
(
radix
>
36
||
radix
<
2
)
fact that few machines directly support unsigned long / and %.
return
NullS
;
Certainly the VAX C compiler generates a subroutine call. In
the interests of efficiency (hollow laugh) I let this happen
/*
for the first digit only; after that "val" will be in range so
The slightly contorted code which follows is due to the fact that
that signed integer division will do. Sorry 'bout that.
few machines directly support unsigned long / and %. Certainly
CHECK THE CODE PRODUCED BY YOUR C COMPILER. The first % and /
the VAX C compiler generates a subroutine call. In the interests
should be unsigned, the second % and / signed, but C compilers
of efficiency (hollow laugh) I let this happen for the first digit
tend to be extraordinarily sensitive to minor details of style.
only; after that "val" will be in range so that signed integer
This works on a VAX, that's all I claim for it.
division will do. Sorry 'bout that. CHECK THE CODE PRODUCED BY
*/
YOUR C COMPILER. The first % and / should be unsigned, the second
% and / signed, but C compilers tend to be extraordinarily
sensitive to minor details of style. This works on a VAX, that's
all I claim for it.
*/
p
=
&
buffer
[
sizeof
(
buffer
)
-
1
];
p
=
&
buffer
[
sizeof
(
buffer
)
-
1
];
*
p
=
'\0'
;
*
p
=
'\0'
;
new_val
=
(
ulong
)
val
/
(
ulong
)
radix
;
new_val
=
(
ulong
)
val
/
(
ulong
)
radix
;
...
...
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