Skip to content

Commit 8afabc8

Browse files
author
Tor Didriksen
committed
Merge bundle from Mats
2 parents 5bf0e91 + bc0d87c commit 8afabc8

119 files changed

Lines changed: 556 additions & 323 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

BUILD/SETUP.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ if test -z "$CC" ; then
215215
fi
216216

217217
if test -z "$CXX" ; then
218-
CXX=gcc
218+
CXX=g++
219219
fi
220220

221221
# If ccache (a compiler cache which reduces build time)

client/mysql.cc

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141
#include <signal.h>
4242
#include <violite.h>
4343

44+
#include <algorithm>
45+
46+
using std::min;
47+
using std::max;
48+
4449
#if defined(USE_LIBEDIT_INTERFACE) && defined(HAVE_LOCALE_H)
4550
#include <locale.h>
4651
#endif
@@ -3499,9 +3504,9 @@ print_table_data(MYSQL_RES *result)
34993504
{
35003505
uint length= column_names ? field->name_length : 0;
35013506
if (quick)
3502-
length=max(length,field->length);
3507+
length= max<size_t>(length, field->length);
35033508
else
3504-
length=max(length,field->max_length);
3509+
length= max<size_t>(length, field->max_length);
35053510
if (length < 4 && !IS_NOT_NULL(field->flags))
35063511
length=4; // Room for "NULL"
35073512
field->max_length=length;
@@ -3521,8 +3526,8 @@ print_table_data(MYSQL_RES *result)
35213526
field->name,
35223527
field->name + name_length);
35233528
uint display_length= field->max_length + name_length - numcells;
3524-
tee_fprintf(PAGER, " %-*s |",(int) min(display_length,
3525-
MAX_COLUMN_LENGTH),
3529+
tee_fprintf(PAGER, " %-*s |",
3530+
min<int>(display_length, MAX_COLUMN_LENGTH),
35263531
field->name);
35273532
num_flag[off]= IS_NUM(field->type);
35283533
}
@@ -3611,9 +3616,9 @@ static int get_field_disp_length(MYSQL_FIELD *field)
36113616
uint length= column_names ? field->name_length : 0;
36123617

36133618
if (quick)
3614-
length= max(length, field->length);
3619+
length= max<uint>(length, field->length);
36153620
else
3616-
length= max(length, field->max_length);
3621+
length= max<uint>(length, field->max_length);
36173622

36183623
if (length < 4 && !IS_NOT_NULL(field->flags))
36193624
length= 4; /* Room for "NULL" */

client/mysql_upgrade.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ static int extract_variable_from_show(DYNAMIC_STRING* ds, char* value)
549549
if ((value_end= strchr(value_start, '\n')) == NULL)
550550
return 1; /* Unexpected result */
551551

552-
strncpy(value, value_start, min(FN_REFLEN, value_end-value_start));
552+
strncpy(value, value_start, MY_MIN(FN_REFLEN, value_end - value_start));
553553
return 0;
554554
}
555555

client/mysqlbinlog.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@
4141
#include "sql_common.h"
4242
#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
4343

44-
#define BIN_LOG_HEADER_SIZE 4
44+
#include <algorithm>
45+
46+
using std::min;
47+
using std::max;
48+
49+
#define BIN_LOG_HEADER_SIZE 4U
4550
#define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4)
4651

4752

@@ -2076,7 +2081,7 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
20762081
my_off_t length,tmp;
20772082
for (length= start_position_mot ; length > 0 ; length-=tmp)
20782083
{
2079-
tmp=min(length,sizeof(buff));
2084+
tmp= min<size_t>(length, sizeof(buff));
20802085
if (my_b_read(file, buff, (uint) tmp))
20812086
{
20822087
error("Failed reading from file.");

client/mysqldump.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
849849
&err_ptr, &err_len);
850850
if (err_len)
851851
{
852-
strmake(buff, err_ptr, min(sizeof(buff) - 1, err_len));
852+
strmake(buff, err_ptr, MY_MIN(sizeof(buff) - 1, err_len));
853853
fprintf(stderr, "Invalid mode to --compatible: %s\n", buff);
854854
exit(1);
855855
}
@@ -4678,7 +4678,7 @@ static ulong find_set(TYPELIB *lib, const char *x, uint length,
46784678

46794679
for (; pos != end && *pos != ','; pos++) ;
46804680
var_len= (uint) (pos - start);
4681-
strmake(buff, start, min(sizeof(buff) - 1, var_len));
4681+
strmake(buff, start, MY_MIN(sizeof(buff) - 1, var_len));
46824682
find= find_type(buff, lib, FIND_TYPE_BASIC);
46834683
if (!find)
46844684
{

client/mysqltest.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747

4848
#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
4949

50+
#include <algorithm>
51+
52+
using std::min;
53+
using std::max;
54+
5055
#ifdef __WIN__
5156
#include <crtdbg.h>
5257
#define SIGNAL_FMT "exception 0x%x"
@@ -5920,9 +5925,9 @@ int read_line(char *buf, int size)
59205925
}
59215926
else if ((c == '{' &&
59225927
(!my_strnncoll_simple(charset_info, (const uchar*) "while", 5,
5923-
(uchar*) buf, min(5, p - buf), 0) ||
5928+
(uchar*) buf, min<my_ptrdiff_t>(5, p - buf), 0) ||
59245929
!my_strnncoll_simple(charset_info, (const uchar*) "if", 2,
5925-
(uchar*) buf, min(2, p - buf), 0))))
5930+
(uchar*) buf, min<my_ptrdiff_t>(2, p - buf), 0))))
59265931
{
59275932
/* Only if and while commands can be terminated by { */
59285933
*p++= c;

client/sql_string.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525

2626
#include "sql_string.h"
2727

28+
#include <algorithm>
29+
30+
using std::min;
31+
using std::max;
32+
2833
/*****************************************************************************
2934
** String functions
3035
*****************************************************************************/

config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@
377377

378378
#cmakedefine HAVE_MBSTATE_T
379379

380-
#define MAX_INDEXES 64
380+
#define MAX_INDEXES 64U
381381

382382
#cmakedefine QSORT_TYPE_IS_VOID 1
383383
#cmakedefine RETQSORTTYPE @RETQSORTTYPE@

dbug/dbug.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,7 @@ void _db_dump_(uint _line_, const char *keyword,
13231323
if (TRACING)
13241324
{
13251325
Indent(cs, cs->level + 1);
1326-
pos= min(max(cs->level-cs->stack->sub_level,0)*INDENT,80);
1326+
pos= MY_MIN(MY_MAX(cs->level-cs->stack->sub_level,0)*INDENT,80);
13271327
}
13281328
else
13291329
{
@@ -1743,7 +1743,7 @@ static void Indent(CODE_STATE *cs, int indent)
17431743
{
17441744
REGISTER int count;
17451745

1746-
indent= max(indent-1-cs->stack->sub_level,0)*INDENT;
1746+
indent= MY_MAX(indent-1-cs->stack->sub_level,0)*INDENT;
17471747
for (count= 0; count < indent ; count++)
17481748
{
17491749
if ((count % INDENT) == 0)

include/m_string.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ size_t my_gcvt(double x, my_gcvt_arg_type type, int width, char *to,
145145
(DBL_DIG + 2) significant digits + sign + "." + ("e-NNN" or
146146
MAX_DECPT_FOR_F_FORMAT zeros for cases when |x|<1 and the 'f' format is used).
147147
*/
148-
#define MY_GCVT_MAX_FIELD_WIDTH (DBL_DIG + 4 + max(5, MAX_DECPT_FOR_F_FORMAT)) \
148+
#define MY_GCVT_MAX_FIELD_WIDTH (DBL_DIG + 4 + MY_MAX(5, MAX_DECPT_FOR_F_FORMAT)) \
149149

150150
extern char *llstr(longlong value,char *buff);
151151
extern char *ullstr(longlong value,char *buff);

0 commit comments

Comments
 (0)