Commit 8a33d36d authored by Marko Mäkelä's avatar Marko Mäkelä

Fix GCC 11.2.0 -Wmaybe-uninitialized

TABLE_LIST::calc_md5(): Remove an untruthful const qualifier.

thd_get_query_start_data(): Pass empty_clex_str instead of
an uninitialized LEX_CSTRING.
parent e4901d95
...@@ -5156,8 +5156,8 @@ extern "C" bool thd_is_strict_mode(const MYSQL_THD thd) ...@@ -5156,8 +5156,8 @@ extern "C" bool thd_is_strict_mode(const MYSQL_THD thd)
*/ */
void thd_get_query_start_data(THD *thd, char *buf) void thd_get_query_start_data(THD *thd, char *buf)
{ {
LEX_CSTRING field_name; Field_timestampf f((uchar *)buf, NULL, 0, Field::NONE, &empty_clex_str,
Field_timestampf f((uchar *)buf, NULL, 0, Field::NONE, &field_name, NULL, 6); NULL, 6);
f.store_TIME(thd->query_start(), thd->query_start_sec_part()); f.store_TIME(thd->query_start(), thd->query_start_sec_part());
} }
......
/* Copyright (c) 2004, 2013, Oracle and/or its affiliates. /* Copyright (c) 2004, 2013, Oracle and/or its affiliates.
Copyright (c) 2011, 2016, MariaDB Corporation Copyright (c) 2011, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -836,7 +836,7 @@ int mariadb_fix_view(THD *thd, TABLE_LIST *view, bool wrong_checksum, ...@@ -836,7 +836,7 @@ int mariadb_fix_view(THD *thd, TABLE_LIST *view, bool wrong_checksum,
if ((view->md5.str= (char *)thd->alloc(32 + 1)) == NULL) if ((view->md5.str= (char *)thd->alloc(32 + 1)) == NULL)
DBUG_RETURN(HA_ADMIN_FAILED); DBUG_RETURN(HA_ADMIN_FAILED);
} }
view->calc_md5(view->md5.str); view->calc_md5(const_cast<char*>(view->md5.str));
view->md5.length= 32; view->md5.length= 32;
} }
view->mariadb_version= MYSQL_VERSION_ID; view->mariadb_version= MYSQL_VERSION_ID;
......
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. /* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2008, 2020, MariaDB Copyright (c) 2008, 2021, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -4879,12 +4879,12 @@ void TABLE::reset_item_list(List<Item> *item_list, uint skip) const ...@@ -4879,12 +4879,12 @@ void TABLE::reset_item_list(List<Item> *item_list, uint skip) const
buffer buffer for md5 writing buffer buffer for md5 writing
*/ */
void TABLE_LIST::calc_md5(const char *buffer) void TABLE_LIST::calc_md5(char *buffer)
{ {
uchar digest[16]; uchar digest[16];
compute_md5_hash(digest, select_stmt.str, compute_md5_hash(digest, select_stmt.str,
select_stmt.length); select_stmt.length);
sprintf((char *) buffer, sprintf(buffer,
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
digest[0], digest[1], digest[2], digest[3], digest[0], digest[1], digest[2], digest[3],
digest[4], digest[5], digest[6], digest[7], digest[4], digest[5], digest[6], digest[7],
......
#ifndef TABLE_INCLUDED #ifndef TABLE_INCLUDED
#define TABLE_INCLUDED #define TABLE_INCLUDED
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. /* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2020, MariaDB Copyright (c) 2009, 2021, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -2562,7 +2562,7 @@ struct TABLE_LIST ...@@ -2562,7 +2562,7 @@ struct TABLE_LIST
List<String> *partition_names; List<String> *partition_names;
#endif /* WITH_PARTITION_STORAGE_ENGINE */ #endif /* WITH_PARTITION_STORAGE_ENGINE */
void calc_md5(const char *buffer); void calc_md5(char *buffer);
int view_check_option(THD *thd, bool ignore_failure); int view_check_option(THD *thd, bool ignore_failure);
bool create_field_translation(THD *thd); bool create_field_translation(THD *thd);
bool setup_underlying(THD *thd); bool setup_underlying(THD *thd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment