mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.0
into pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint BitKeeper/etc/ignore: auto-union client/mysqltest.c: Auto merged extra/comp_err.c: Auto merged include/my_time.h: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/r/mysqltest.result: Auto merged mysql-test/r/type_blob.result: Auto merged mysql-test/t/mysqltest.test: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_strfunc.cc: Auto merged sql/log.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/tztime.cc: Auto merged client/mysql_upgrade.c: Manual merge mysql-test/mysql-test-run.pl: Manual merge mysql-test/r/ctype_cp932.result: Manual merge mysql-test/r/mysqlbinlog.result: Manual merge mysql-test/t/ctype_cp932.test: Manual merge mysql-test/t/mysql.test: Manual merge mysql-test/t/mysqlbinlog.test: Manual merge
This commit is contained in:
@ -89,10 +89,10 @@ enum {
|
||||
};
|
||||
|
||||
static int record= 0, opt_sleep= -1;
|
||||
static char *db= 0, *pass= 0;
|
||||
const char *user= 0, *host= 0, *unix_sock= 0, *opt_basedir= "./";
|
||||
static char *opt_db= 0, *opt_pass= 0;
|
||||
const char *opt_user= 0, *opt_host= 0, *unix_sock= 0, *opt_basedir= "./";
|
||||
const char *opt_include= 0, *opt_charsets_dir;
|
||||
static int port= 0;
|
||||
static int opt_port= 0;
|
||||
static int opt_max_connect_retries;
|
||||
static my_bool opt_compress= 0, silent= 0, verbose= 0;
|
||||
static my_bool tty_password= 0;
|
||||
@ -623,15 +623,14 @@ void check_command_args(struct st_command *command,
|
||||
int i;
|
||||
const char *ptr= arguments;
|
||||
const char *start;
|
||||
|
||||
DBUG_ENTER("check_command_args");
|
||||
DBUG_PRINT("enter", ("num_args: %d", num_args));
|
||||
|
||||
for (i= 0; i < num_args; i++)
|
||||
{
|
||||
const struct command_arg *arg= &args[i];
|
||||
|
||||
switch (arg->type)
|
||||
{
|
||||
switch (arg->type) {
|
||||
/* A string */
|
||||
case ARG_STRING:
|
||||
/* Skip leading spaces */
|
||||
@ -796,7 +795,7 @@ void free_used_memory()
|
||||
dynstr_free(&ds_progress);
|
||||
dynstr_free(&ds_warning_messages);
|
||||
free_all_replace();
|
||||
my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
|
||||
my_free(opt_pass,MYF(MY_ALLOW_ZERO_PTR));
|
||||
free_defaults(default_argv);
|
||||
free_re();
|
||||
#ifdef __WIN__
|
||||
@ -1345,7 +1344,7 @@ void var_set_errno(int sql_errno)
|
||||
|
||||
void var_query_set(VAR *var, const char *query, const char** query_end)
|
||||
{
|
||||
char* end = (char*)((query_end && *query_end) ?
|
||||
char *end = (char*)((query_end && *query_end) ?
|
||||
*query_end : query + strlen(query));
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
@ -1376,7 +1375,6 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
|
||||
DYNAMIC_STRING result;
|
||||
uint i;
|
||||
ulong *lengths;
|
||||
char *end;
|
||||
#ifdef NOT_YET
|
||||
MYSQL_FIELD *fields= mysql_fetch_fields(res);
|
||||
#endif
|
||||
@ -1973,7 +1971,7 @@ void do_copy_file(struct st_command *command)
|
||||
|
||||
void do_chmod_file(struct st_command *command)
|
||||
{
|
||||
ulong mode= 0;
|
||||
long mode= 0;
|
||||
static DYNAMIC_STRING ds_mode;
|
||||
static DYNAMIC_STRING ds_file;
|
||||
const struct command_arg chmod_file_args[] = {
|
||||
@ -2425,6 +2423,7 @@ void do_perl(struct st_command *command)
|
||||
int do_echo(struct st_command *command)
|
||||
{
|
||||
DYNAMIC_STRING ds_echo;
|
||||
DBUG_ENTER("do_echo");
|
||||
|
||||
init_dynamic_string(&ds_echo, "", command->query_len, 256);
|
||||
do_eval(&ds_echo, command->first_argument, command->end, FALSE);
|
||||
@ -2432,7 +2431,7 @@ int do_echo(struct st_command *command)
|
||||
dynstr_append_mem(&ds_res, "\n", 1);
|
||||
dynstr_free(&ds_echo);
|
||||
command->last_argument= command->end;
|
||||
return(0);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
@ -2728,7 +2727,6 @@ void do_let(struct st_command *command)
|
||||
char *p= command->first_argument;
|
||||
char *var_name, *var_name_end;
|
||||
DYNAMIC_STRING let_rhs_expr;
|
||||
|
||||
DBUG_ENTER("do_let");
|
||||
|
||||
init_dynamic_string(&let_rhs_expr, "", 512, 2048);
|
||||
@ -3408,7 +3406,7 @@ int connect_n_handle_errors(struct st_command *command,
|
||||
|
||||
void do_connect(struct st_command *command)
|
||||
{
|
||||
int con_port= port;
|
||||
int con_port= opt_port;
|
||||
char *con_options;
|
||||
bool con_ssl= 0, con_compress= 0;
|
||||
char *ptr;
|
||||
@ -3544,13 +3542,12 @@ void do_connect(struct st_command *command)
|
||||
|
||||
/* Use default db name */
|
||||
if (ds_database.length == 0)
|
||||
dynstr_set(&ds_database, db);
|
||||
dynstr_set(&ds_database, opt_db);
|
||||
|
||||
/* Special database to allow one to connect without a database name */
|
||||
if (ds_database.length && !strcmp(ds_database.str,"*NO-ONE*"))
|
||||
dynstr_set(&ds_database, "");
|
||||
|
||||
|
||||
if (connect_n_handle_errors(command, &next_con->mysql,
|
||||
ds_host.str,ds_user.str,
|
||||
ds_password.str, ds_database.str,
|
||||
@ -3974,7 +3971,7 @@ int read_line(char *buf, int size)
|
||||
void convert_to_format_v1(char* query)
|
||||
{
|
||||
int last_c_was_quote= 0;
|
||||
char *p= query, *write= query;
|
||||
char *p= query, *to= query;
|
||||
char *end= strend(query);
|
||||
char last_c;
|
||||
|
||||
@ -3982,7 +3979,7 @@ void convert_to_format_v1(char* query)
|
||||
{
|
||||
if (*p == '\n' && !last_c_was_quote)
|
||||
{
|
||||
*write++ = *p++; /* Save the newline */
|
||||
*to++ = *p++; /* Save the newline */
|
||||
|
||||
/* Skip any spaces on next line */
|
||||
while (*p && my_isspace(charset_info, *p))
|
||||
@ -3993,19 +3990,19 @@ void convert_to_format_v1(char* query)
|
||||
else if (*p == '\'' || *p == '"' || *p == '`')
|
||||
{
|
||||
last_c= *p;
|
||||
*write++ = *p++;
|
||||
*to++ = *p++;
|
||||
|
||||
/* Copy anything until the next quote of same type */
|
||||
while (*p && *p != last_c)
|
||||
*write++ = *p++;
|
||||
*to++ = *p++;
|
||||
|
||||
*write++ = *p++;
|
||||
*to++ = *p++;
|
||||
|
||||
last_c_was_quote= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*write++ = *p++;
|
||||
*to++ = *p++;
|
||||
last_c_was_quote= 0;
|
||||
}
|
||||
}
|
||||
@ -4123,19 +4120,17 @@ void check_eol_junk(const char *eol)
|
||||
Create a command from a set of lines
|
||||
|
||||
SYNOPSIS
|
||||
read_command()
|
||||
command_ptr pointer where to return the new query
|
||||
read_command()
|
||||
command_ptr pointer where to return the new query
|
||||
|
||||
DESCRIPTION
|
||||
Converts lines returned by read_line into a command, this involves
|
||||
parsing the first word in the read line to find the command type.
|
||||
|
||||
Converts lines returned by read_line into a command, this involves
|
||||
parsing the first word in the read line to find the command type.
|
||||
|
||||
A -- comment may contain a valid query as the first word after the
|
||||
comment start. Thus it's always checked to see if that is the case.
|
||||
The advantage with this approach is to be able to execute commands
|
||||
terminated by new line '\n' regardless how many "delimiter" it contain.
|
||||
|
||||
*/
|
||||
|
||||
#define MAX_QUERY (256*1024) /* 256K -- a test in sp-big is >128K */
|
||||
@ -4221,7 +4216,7 @@ static struct my_option my_long_options[] =
|
||||
{"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statements.",
|
||||
(gptr*) &cursor_protocol, (gptr*) &cursor_protocol, 0,
|
||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"database", 'D', "Database to use.", (gptr*) &db, (gptr*) &db, 0,
|
||||
{"database", 'D', "Database to use.", (gptr*) &opt_db, (gptr*) &opt_db, 0,
|
||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifdef DBUG_OFF
|
||||
{"debug", '#', "This is a non-debug version. Catch this and exit",
|
||||
@ -4230,7 +4225,7 @@ static struct my_option my_long_options[] =
|
||||
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
|
||||
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0,
|
||||
{"host", 'h', "Connect to host.", (gptr*) &opt_host, (gptr*) &opt_host, 0,
|
||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"include", 'i', "Include SQL before each test case.", (gptr*) &opt_include,
|
||||
(gptr*) &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
@ -4244,8 +4239,8 @@ static struct my_option my_long_options[] =
|
||||
GET_INT, REQUIRED_ARG, 500, 1, 10000, 0, 0, 0},
|
||||
{"password", 'p', "Password to use when connecting to server.",
|
||||
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"port", 'P', "Port number to use for connection.", (gptr*) &port,
|
||||
(gptr*) &port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_port,
|
||||
(gptr*) &opt_port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"ps-protocol", OPT_PS_PROTOCOL, "Use prepared statements protocol for communication",
|
||||
(gptr*) &ps_protocol, (gptr*) &ps_protocol, 0,
|
||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
@ -4281,8 +4276,8 @@ static struct my_option my_long_options[] =
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"tmpdir", 't', "Temporary directory where sockets are put.",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"user", 'u', "User for login.", (gptr*) &user, (gptr*) &user, 0, GET_STR,
|
||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"user", 'u', "User for login.", (gptr*) &opt_user, (gptr*) &opt_user, 0,
|
||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"verbose", 'v', "Write more.", (gptr*) &verbose, (gptr*) &verbose, 0,
|
||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"version", 'V', "Output version information and exit.",
|
||||
@ -4409,8 +4404,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
case 'p':
|
||||
if (argument)
|
||||
{
|
||||
my_free(pass, MYF(MY_ALLOW_ZERO_PTR));
|
||||
pass= my_strdup(argument, MYF(MY_FAE));
|
||||
my_free(opt_pass, MYF(MY_ALLOW_ZERO_PTR));
|
||||
opt_pass= my_strdup(argument, MYF(MY_FAE));
|
||||
while (*argument) *argument++= 'x'; /* Destroy argument */
|
||||
tty_password= 0;
|
||||
}
|
||||
@ -4447,7 +4442,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
exit(0);
|
||||
case '?':
|
||||
usage();
|
||||
exit(1);
|
||||
exit(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -4467,9 +4462,9 @@ int parse_args(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
if (argc == 1)
|
||||
db= *argv;
|
||||
opt_db= *argv;
|
||||
if (tty_password)
|
||||
pass=get_tty_password(NullS);
|
||||
opt_pass= get_tty_password(NullS); /* purify tested */
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -4772,13 +4767,13 @@ void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res)
|
||||
void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
|
||||
MYSQL_FIELD *fields, uint num_fields)
|
||||
{
|
||||
MYSQL_BIND *bind;
|
||||
MYSQL_BIND *my_bind;
|
||||
my_bool *is_null;
|
||||
ulong *length;
|
||||
uint i;
|
||||
|
||||
/* Allocate array with bind structs, lengths and NULL flags */
|
||||
bind= (MYSQL_BIND*) my_malloc(num_fields * sizeof(MYSQL_BIND),
|
||||
my_bind= (MYSQL_BIND*) my_malloc(num_fields * sizeof(MYSQL_BIND),
|
||||
MYF(MY_WME | MY_FAE | MY_ZEROFILL));
|
||||
length= (ulong*) my_malloc(num_fields * sizeof(ulong),
|
||||
MYF(MY_WME | MY_FAE));
|
||||
@ -4789,25 +4784,25 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
|
||||
for (i= 0; i < num_fields; i++)
|
||||
{
|
||||
uint max_length= fields[i].max_length + 1;
|
||||
bind[i].buffer_type= MYSQL_TYPE_STRING;
|
||||
bind[i].buffer= (char *)my_malloc(max_length, MYF(MY_WME | MY_FAE));
|
||||
bind[i].buffer_length= max_length;
|
||||
bind[i].is_null= &is_null[i];
|
||||
bind[i].length= &length[i];
|
||||
my_bind[i].buffer_type= MYSQL_TYPE_STRING;
|
||||
my_bind[i].buffer= (char *)my_malloc(max_length, MYF(MY_WME | MY_FAE));
|
||||
my_bind[i].buffer_length= max_length;
|
||||
my_bind[i].is_null= &is_null[i];
|
||||
my_bind[i].length= &length[i];
|
||||
|
||||
DBUG_PRINT("bind", ("col[%d]: buffer_type: %d, buffer_length: %lu",
|
||||
i, bind[i].buffer_type, bind[i].buffer_length));
|
||||
i, my_bind[i].buffer_type, my_bind[i].buffer_length));
|
||||
}
|
||||
|
||||
if (mysql_stmt_bind_result(stmt, bind))
|
||||
if (mysql_stmt_bind_result(stmt, my_bind))
|
||||
die("mysql_stmt_bind_result failed: %d: %s",
|
||||
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
|
||||
|
||||
while (mysql_stmt_fetch(stmt) == 0)
|
||||
{
|
||||
for (i= 0; i < num_fields; i++)
|
||||
append_field(ds, i, &fields[i], (const char *) bind[i].buffer,
|
||||
*bind[i].length, *bind[i].is_null);
|
||||
append_field(ds, i, &fields[i], (const char *) my_bind[i].buffer,
|
||||
*my_bind[i].length, *my_bind[i].is_null);
|
||||
if (!display_result_vertically)
|
||||
dynstr_append_mem(ds, "\n", 1);
|
||||
}
|
||||
@ -4819,10 +4814,10 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
|
||||
for (i= 0; i < num_fields; i++)
|
||||
{
|
||||
/* Free data for output */
|
||||
my_free((gptr)bind[i].buffer, MYF(MY_WME | MY_FAE));
|
||||
my_free((gptr)my_bind[i].buffer, MYF(MY_WME | MY_FAE));
|
||||
}
|
||||
/* Free array with bind structs, lengths and NULL flags */
|
||||
my_free((gptr)bind , MYF(MY_WME | MY_FAE));
|
||||
my_free((gptr)my_bind , MYF(MY_WME | MY_FAE));
|
||||
my_free((gptr)length , MYF(MY_WME | MY_FAE));
|
||||
my_free((gptr)is_null , MYF(MY_WME | MY_FAE));
|
||||
}
|
||||
@ -4959,17 +4954,14 @@ int append_warnings(DYNAMIC_STRING *ds, MYSQL* mysql)
|
||||
/*
|
||||
Run query using MySQL C API
|
||||
|
||||
SYNPOSIS
|
||||
run_query_normal
|
||||
mysql - mysql handle
|
||||
command - currrent command pointer
|
||||
flags -flags indicating wheter to SEND and/or REAP
|
||||
query - query string to execute
|
||||
query_len - length query string to execute
|
||||
ds - output buffer wherte to store result form query
|
||||
|
||||
RETURN VALUE
|
||||
error - function will not return
|
||||
SYNOPSIS
|
||||
run_query_normal()
|
||||
mysql mysql handle
|
||||
command current command pointer
|
||||
flags flags indicating if we should SEND and/or REAP
|
||||
query query string to execute
|
||||
query_len length query string to execute
|
||||
ds output buffer where to store result form query
|
||||
*/
|
||||
|
||||
void run_query_normal(struct st_connection *cn, struct st_command *command,
|
||||
@ -5495,15 +5487,14 @@ int util_query(MYSQL* org_mysql, const char* query){
|
||||
/*
|
||||
Run query
|
||||
|
||||
SYNPOSIS
|
||||
run_query()
|
||||
mysql mysql handle
|
||||
command currrent command pointer
|
||||
|
||||
flags control the phased/stages of query execution to be performed
|
||||
if QUERY_SEND_FLAG bit is on, the query will be sent. If QUERY_REAP_FLAG
|
||||
is on the result will be read - for regular query, both bits must be on
|
||||
|
||||
SYNPOSIS
|
||||
run_query
|
||||
mysql - mysql handle
|
||||
command - currrent command pointer
|
||||
|
||||
*/
|
||||
|
||||
void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
||||
@ -5518,6 +5509,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
||||
my_bool view_created= 0, sp_created= 0;
|
||||
my_bool complete_query= ((flags & QUERY_SEND_FLAG) &&
|
||||
(flags & QUERY_REAP_FLAG));
|
||||
DBUG_ENTER("run_query");
|
||||
|
||||
init_dynamic_string(&ds_warnings, NULL, 0, 256);
|
||||
|
||||
@ -5683,7 +5675,6 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
||||
|
||||
if (command->require_file[0])
|
||||
{
|
||||
|
||||
/* A result file was specified for _this_ query
|
||||
and the output should be checked against an already
|
||||
existing file which has been specified using --require or --result
|
||||
@ -5696,6 +5687,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
||||
dynstr_free(&ds_result);
|
||||
if (command->type == Q_EVAL)
|
||||
dynstr_free(&eval_query);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
@ -6025,8 +6017,8 @@ int main(int argc, char **argv)
|
||||
if (!(cur_con->name = my_strdup("default", MYF(MY_WME))))
|
||||
die("Out of memory");
|
||||
|
||||
safe_connect(&cur_con->mysql, cur_con->name, host, user, pass,
|
||||
db, port, unix_sock);
|
||||
safe_connect(&cur_con->mysql, cur_con->name, opt_host, opt_user, opt_pass,
|
||||
opt_db, opt_port, unix_sock);
|
||||
|
||||
/* Use all time until exit if no explicit 'start_timer' */
|
||||
timer_start= timer_now();
|
||||
@ -6396,8 +6388,6 @@ int main(int argc, char **argv)
|
||||
if (result_file_name && ds_warning_messages.length)
|
||||
dump_warning_messages();
|
||||
|
||||
dynstr_free(&ds_res);
|
||||
|
||||
timer_output();
|
||||
free_used_memory();
|
||||
my_end(MY_CHECK_ERROR);
|
||||
@ -6608,7 +6598,8 @@ typedef struct st_replace_found {
|
||||
|
||||
|
||||
void replace_strings_append(REPLACE *rep, DYNAMIC_STRING* ds,
|
||||
const char *str, int len)
|
||||
const char *str,
|
||||
int len __attribute__((unused)))
|
||||
{
|
||||
reg1 REPLACE *rep_pos;
|
||||
reg2 REPLACE_STRING *rep_str;
|
||||
@ -6999,7 +6990,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
|
||||
we need at least what we have so far in the buffer + the part
|
||||
before this match
|
||||
*/
|
||||
need_buf_len= (res_p - buf) + subs[0].rm_so;
|
||||
need_buf_len= (res_p - buf) + (int) subs[0].rm_so;
|
||||
|
||||
/* on this pass, calculate the memory for the result buffer */
|
||||
while (expr_p < replace_end)
|
||||
@ -7009,17 +7000,17 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
|
||||
|
||||
if (c == '\\' && expr_p + 1 < replace_end)
|
||||
{
|
||||
back_ref_num= expr_p[1] - '0';
|
||||
back_ref_num= (int) (expr_p[1] - '0');
|
||||
}
|
||||
|
||||
/* found a valid back_ref (eg. \1)*/
|
||||
if (back_ref_num >= 0 && back_ref_num <= (int)r.re_nsub)
|
||||
{
|
||||
int start_off,end_off;
|
||||
regoff_t start_off, end_off;
|
||||
if ((start_off=subs[back_ref_num].rm_so) > -1 &&
|
||||
(end_off=subs[back_ref_num].rm_eo) > -1)
|
||||
{
|
||||
need_buf_len += (end_off - start_off);
|
||||
need_buf_len += (int) (end_off - start_off);
|
||||
}
|
||||
expr_p += 2;
|
||||
}
|
||||
@ -7039,7 +7030,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
|
||||
/* copy the pre-match part */
|
||||
if (subs[0].rm_so)
|
||||
{
|
||||
memcpy(res_p, str_p, subs[0].rm_so);
|
||||
memcpy(res_p, str_p, (size_t) subs[0].rm_so);
|
||||
res_p+= subs[0].rm_so;
|
||||
}
|
||||
|
||||
@ -7058,11 +7049,11 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
|
||||
|
||||
if (back_ref_num >= 0 && back_ref_num <= (int)r.re_nsub)
|
||||
{
|
||||
int start_off,end_off;
|
||||
regoff_t start_off, end_off;
|
||||
if ((start_off=subs[back_ref_num].rm_so) > -1 &&
|
||||
(end_off=subs[back_ref_num].rm_eo) > -1)
|
||||
{
|
||||
int block_len= end_off - start_off;
|
||||
int block_len= (int) (end_off - start_off);
|
||||
memcpy(res_p,str_p + start_off, block_len);
|
||||
res_p += block_len;
|
||||
}
|
||||
|
Reference in New Issue
Block a user