Skip to content

Commit 4edcd72

Browse files
committed
Bug#37471922: Auto-fix clang-tidy warnings [15/n] [noclose]
Generate fixes for a number of warnings that clang-tidy can fix automatically. This commit fixes the warning 'readability-qualified-auto'. Change example: - auto descendentref = down_cast<Descendent *>(baseref); + auto *descendentref = down_cast<Descendent *>(baseref); Change-Id: I4b329c2b6a9271b4b21588916396d483a1b87c64
1 parent 4a5a06f commit 4edcd72

File tree

86 files changed

+284
-281
lines changed

Some content is hidden

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

86 files changed

+284
-281
lines changed

client/mysqltest.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2983,7 +2983,7 @@ static void var_set_escape(struct st_command *command, VAR *dst) {
29832983
if (std::find(begin, end, c) != end) dst_len++;
29842984
// Allocate space for escaped string
29852985
alloc_var(dst, dst_len);
2986-
auto dst_char = dst->str_val;
2986+
auto *dst_char = dst->str_val;
29872987
// Compute escaped string
29882988
for (char c : src) {
29892989
if (std::find(begin, end, c) != end) *dst_char++ = '\\';

client/pattern_matcher.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ bool Pattern_matcher::is_matching(const std::string &text,
8181
DBUG_TRACE;
8282

8383
// traverse all patterns, return true on first match
84-
for (auto &pattern : m_patterns) {
84+
for (const auto &pattern : m_patterns) {
8585
if (info->coll->wildcmp(info, text.c_str(), text.c_str() + text.length(),
8686
pattern.c_str(), pattern.c_str() + pattern.length(),
8787
WILD_ESCAPE, WILD_ONE, WILD_MANY) == 0) {

components/libminchassis/dynamic_loader.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ bool mysql_dynamic_loader_imp::unload_do_lock_provided_services(
11711171

11721172
if (pre_unload_notification.is_valid()) {
11731173
std::vector<const char *> services;
1174-
for (auto &one : components_to_unload) {
1174+
for (const auto &one : components_to_unload) {
11751175
for (const mysql_service_ref_t *service :
11761176
one->get_provided_services()) {
11771177
services.push_back(service->name);
@@ -1402,7 +1402,7 @@ bool mysql_dynamic_loader_imp::unload_do_unload_components(
14021402
mysql_component pointers. */
14031403
for (auto list = mysql_dynamic_loader_imp::urns_with_gen_list.begin();
14041404
list != mysql_dynamic_loader_imp::urns_with_gen_list.end(); ++list) {
1405-
auto comp_ele = (*component_it).second.get();
1405+
auto *comp_ele = (*component_it).second.get();
14061406
auto v_element =
14071407
find_if((*list).begin(), (*list).end(),
14081408
[comp_ele](mysql_component *ptr) { return ptr == comp_ele; });

components/mysqlbackup/backup_page_tracker.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ mysql_service_status_t Backup_page_tracker::register_udfs() {
127127
// Initialize the UDF list
128128
initialize_udf_list();
129129

130-
for (auto udf : m_udf_list) {
130+
for (auto *udf : m_udf_list) {
131131
if (udf->m_is_registered) {
132132
std::string msg{udf->m_name + " is already registered."};
133133
LogErr(ERROR_LEVEL, ER_MYSQLBACKUP_MSG, msg.c_str());
@@ -163,7 +163,7 @@ mysql_service_status_t Backup_page_tracker::register_udfs() {
163163
mysql_service_status_t Backup_page_tracker::unregister_udfs() {
164164
mysql_service_status_t fail_status{0};
165165

166-
for (auto udf : m_udf_list) {
166+
for (auto *udf : m_udf_list) {
167167
int was_present;
168168
if (mysql_service_udf_registration->udf_unregister(udf->m_name.c_str(),
169169
&was_present) &&

components/test/event_tracking_test/event_tracking_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ int main(int argc, char **argv) {
159159
deinit_registry();
160160
});
161161

162-
auto dynamic_loader = get_dynamic_loader();
162+
auto *dynamic_loader = get_dynamic_loader();
163163

164164
if (!dynamic_loader) {
165165
std::cerr << "Could not get handle of dynamic loader" << std::endl;

components/test/keyring_encryption_test/components.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ Keyring_encryption_test::Keyring_encryption_test(
122122
bool Keyring_encryption_test::test_aes() {
123123
if (!ok_) return false;
124124

125-
const auto writer = aes_service_.writer();
126-
const auto aes = aes_service_.aes();
125+
const auto *const writer = aes_service_.writer();
126+
const auto *const aes = aes_service_.aes();
127127

128128
const std::string aes_key_1("AES_test_key_1");
129129
if (writer->store("aes_key_1", "keyring_aes_test",

components/test/statement_services/test_execute_prepared_statement.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static auto test_execute_prepared_statement(UDF_INIT *, UDF_ARGS *arguments,
105105
unsigned char *error) -> char * {
106106
*error = 1;
107107

108-
auto statement = my_h_statement{nullptr};
108+
auto *statement = my_h_statement{nullptr};
109109
auto query =
110110
mysql_cstring_with_length{arguments->args[0], strlen(arguments->args[0])};
111111

@@ -220,7 +220,7 @@ static auto test_execute_prepared_statement(UDF_INIT *, UDF_ARGS *arguments,
220220
arg_index++) {
221221
switch (arguments->arg_type[arg_index]) {
222222
case STRING_RESULT: {
223-
auto value = arguments->args[arg_index];
223+
auto *value = arguments->args[arg_index];
224224
if (SERVICE_PLACEHOLDER(mysql_stmt_bind)
225225
->bind_param(statement, param_index, false,
226226
MYSQL_SP_ARG_TYPE_VARCHAR, false, value,
@@ -353,7 +353,7 @@ static auto test_execute_prepared_statement(UDF_INIT *, UDF_ARGS *arguments,
353353
}
354354
#endif
355355

356-
if (auto exec_result = execute_statement(statement, error, result, length);
356+
if (auto *exec_result = execute_statement(statement, error, result, length);
357357
exec_result != nullptr) {
358358
return exec_result;
359359
}

components/test/statement_services/test_execute_regular_statement.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static auto test_execute_regular_statement(UDF_INIT *, UDF_ARGS *arguments,
9090
unsigned char *error) -> char * {
9191
*error = 1;
9292

93-
auto statement = my_h_statement{nullptr};
93+
auto *statement = my_h_statement{nullptr};
9494
auto query =
9595
mysql_cstring_with_length{arguments->args[0], strlen(arguments->args[0])};
9696
if (SERVICE_PLACEHOLDER(mysql_stmt_factory)->init(&statement) != 0) return {};

components/test/statement_services/utils.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ auto parse_headers(uint64_t num_fields, my_h_statement statement,
6868
unsigned char *error) -> std::vector<std::string> {
6969
*error = 1;
7070
auto header_row = std::vector<std::string>{};
71-
auto field = my_h_field{nullptr};
72-
auto field_name = static_cast<char *>(nullptr);
73-
auto charset_name = static_cast<char *>(nullptr);
74-
auto collation_name = static_cast<char *>(nullptr);
71+
auto *field = my_h_field{nullptr};
72+
auto *field_name = static_cast<char *>(nullptr);
73+
auto *charset_name = static_cast<char *>(nullptr);
74+
auto *collation_name = static_cast<char *>(nullptr);
7575
for (auto j = size_t{}; j < num_fields; j++) {
7676
if (SERVICE_PLACEHOLDER(mysql_stmt_resultset_metadata)
7777
->fetch_field(statement, j, &field) != 0)
@@ -94,7 +94,7 @@ auto parse_headers(uint64_t num_fields, my_h_statement statement,
9494

9595
auto get_field_type(my_h_statement statement, size_t index,
9696
unsigned char *error) -> uint64_t {
97-
auto field = my_h_field{nullptr};
97+
auto *field = my_h_field{nullptr};
9898
if (SERVICE_PLACEHOLDER(mysql_stmt_resultset_metadata)
9999
->fetch_field(statement, index, &field) != 0) {
100100
*error = 1;
@@ -150,7 +150,7 @@ auto parse_value_at_index(uint64_t field_type, my_h_row row, size_t index)
150150
}
151151

152152
auto fetch_statement_row(my_h_statement statement) -> std::optional<my_h_row> {
153-
auto row = static_cast<my_h_row>(nullptr);
153+
auto *row = static_cast<my_h_row>(nullptr);
154154
if (SERVICE_PLACEHOLDER(mysql_stmt_result)->fetch(statement, &row) != 0)
155155
return {};
156156
return row;

components/test/test_mysql_signal_handler.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ static auto test_fatal_signal_callback(int signum,
6565
-> void {
6666
assert(signum == SIGSEGV);
6767
if (signum != SIGSEGV) return;
68-
auto message = "Signal from the test_mysql_signal_handler component.\n";
68+
const auto *message =
69+
"Signal from the test_mysql_signal_handler component.\n";
6970
safe_write_stderr(message, strlen(message));
7071
}
7172

0 commit comments

Comments
 (0)