summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_string.h2
-rw-r--r--mysql-test/r/variables.result1
-rw-r--r--strings/int2str.c41
3 files changed, 25 insertions, 19 deletions
diff --git a/include/m_string.h b/include/m_string.h
index 27da759f2c7..7fc35dc2e48 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -225,7 +225,7 @@ extern long strtol(const char *str, char **ptr, int base);
extern ulong strtoul(const char *str, char **ptr, int base);
#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 *str2int(const char *src,int radix,long lower,long upper,
long *val);
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index fbd9664ba9d..cd86c69d8f0 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -385,6 +385,7 @@ select 1;
1
1
select @@session.key_buffer_size;
+ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable
set ft_boolean_syntax = @@init_connect;
ERROR HY000: Variable 'ft_boolean_syntax' is a GLOBAL variable and should be set with SET GLOBAL
set global ft_boolean_syntax = @@init_connect;
diff --git a/strings/int2str.c b/strings/int2str.c
index 39b38ef3e1b..be86e9735ab 100644
--- a/strings/int2str.c
+++ b/strings/int2str.c
@@ -34,7 +34,7 @@ char NEAR _dig_vec_lower[] =
val - value to convert
dst - points to buffer where string representation should be stored
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
Converts the (long) integer value to its character form and moves it to
@@ -52,34 +52,39 @@ char NEAR _dig_vec_lower[] =
char *
int2str(register long int val, register char *dst, register int radix,
- char upcase)
+ int upcase)
{
char buffer[65];
register char *p;
long int new_val;
char *dig_vec= upcase ? _dig_vec_upper : _dig_vec_lower;
- if (radix < 0) {
- if (radix < -36 || radix > -2) return NullS;
- if (val < 0) {
+ if (radix < 0)
+ {
+ if (radix < -36 || radix > -2)
+ return NullS;
+ if (val < 0)
+ {
*dst++ = '-';
val = -val;
}
radix = -radix;
- } else {
- if (radix > 36 || radix < 2) return NullS;
}
- /* The slightly contorted code which follows is due to the
- fact that few machines directly support unsigned long / and %.
- 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
- that signed integer 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.
- */
+ else if (radix > 36 || radix < 2)
+ return NullS;
+
+ /*
+ The slightly contorted code which follows is due to the fact that
+ few machines directly support unsigned long / and %. 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 that signed integer
+ 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 = '\0';
new_val=(ulong) val / (ulong) radix;