diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-08-03 11:22:20 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-08-03 11:53:57 +0300 |
commit | 9dfef6e29b98459a5077adb95d5b989d39e0db24 (patch) | |
tree | cc3e52ca7b38bdc9fda291eea3fb2eb7b38c5785 /storage | |
parent | b963cbaf4bcfe2c510c38edeacc2d6b1cae2d7a1 (diff) | |
download | mariadb-git-9dfef6e29b98459a5077adb95d5b989d39e0db24.tar.gz |
Fix -Wclass-memaccess warnings in InnoDB,XtraDB
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 2 | ||||
-rw-r--r-- | storage/innobase/buf/buf0lru.cc | 2 | ||||
-rw-r--r-- | storage/innobase/include/dict0mem.h | 3 | ||||
-rw-r--r-- | storage/innobase/include/row0ftsort.h | 9 | ||||
-rw-r--r-- | storage/innobase/row/row0ftsort.cc | 1 | ||||
-rw-r--r-- | storage/innobase/row/row0import.cc | 4 | ||||
-rw-r--r-- | storage/innobase/trx/trx0trx.cc | 2 | ||||
-rw-r--r-- | storage/xtradb/buf/buf0buf.cc | 2 | ||||
-rw-r--r-- | storage/xtradb/buf/buf0lru.cc | 2 | ||||
-rw-r--r-- | storage/xtradb/include/dict0mem.h | 3 | ||||
-rw-r--r-- | storage/xtradb/include/row0ftsort.h | 9 | ||||
-rw-r--r-- | storage/xtradb/row/row0ftsort.cc | 1 | ||||
-rw-r--r-- | storage/xtradb/row/row0import.cc | 4 | ||||
-rw-r--r-- | storage/xtradb/trx/trx0trx.cc | 2 |
14 files changed, 34 insertions, 12 deletions
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index f534f8906f4..11dceacf592 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1611,7 +1611,7 @@ buf_relocate( } #endif /* UNIV_DEBUG */ - memcpy(dpage, bpage, sizeof *dpage); + new (dpage) buf_page_t(*bpage); ut_d(bpage->in_LRU_list = FALSE); ut_d(bpage->in_page_hash = FALSE); diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index 019dddb5863..5b0a2a7dd0c 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -1849,7 +1849,7 @@ func_exit: } else if (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE) { b = buf_page_alloc_descriptor(); ut_a(b); - memcpy(b, bpage, sizeof *b); + new (b) buf_page_t(*bpage); } ut_ad(buf_pool_mutex_own(buf_pool)); diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 394106235ef..872db7865d3 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -509,6 +509,9 @@ struct dict_field_t{ unsigned fixed_len:10; /*!< 0 or the fixed length of the column if smaller than DICT_ANTELOPE_MAX_INDEX_COL_LEN */ + + /** Zero-initialize all fields */ + dict_field_t() : col(NULL), name(NULL), prefix_len(0), fixed_len(0) {} }; /**********************************************************************//** diff --git a/storage/innobase/include/row0ftsort.h b/storage/innobase/include/row0ftsort.h index e949ba302b9..547937bac98 100644 --- a/storage/innobase/include/row0ftsort.h +++ b/storage/innobase/include/row0ftsort.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2015, 2018, MariaDB Corporation. 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 the Free Software @@ -106,6 +107,14 @@ struct fts_tokenize_ctx { ib_rbt_t* cached_stopword;/*!< in: stopword list */ dfield_t sort_field[FTS_NUM_FIELDS_SORT]; /*!< in: sort field */ + + fts_tokenize_ctx() : + processed_len(0), init_pos(0), buf_used(0), + rows_added(), cached_stopword(NULL), sort_field() + { + memset(rows_added, 0, sizeof rows_added); + memset(sort_field, 0, sizeof sort_field); + } }; typedef struct fts_tokenize_ctx fts_tokenize_ctx_t; diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc index 8a3d4573879..757e268c3a7 100644 --- a/storage/innobase/row/row0ftsort.cc +++ b/storage/innobase/row/row0ftsort.cc @@ -638,7 +638,6 @@ fts_parallel_tokenization( merge_file = psort_info->merge_file; blob_heap = mem_heap_create(512); memset(&doc, 0, sizeof(doc)); - memset(&t_ctx, 0, sizeof(t_ctx)); memset(mycount, 0, FTS_NUM_AUX_INDEX * sizeof(int)); doc.charset = fts_index_get_charset( diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index dad55205bc2..ea020fac56e 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -2620,8 +2620,6 @@ row_import_cfg_read_index_fields( dict_field_t* field = index->m_fields; - memset(field, 0x0, sizeof(*field) * n_fields); - for (ulint i = 0; i < n_fields; ++i, ++field) { byte* ptr = row; @@ -2639,6 +2637,8 @@ row_import_cfg_read_index_fields( return(DB_IO_ERROR); } + new (field) dict_field_t(); + field->prefix_len = mach_read_from_4(ptr); ptr += sizeof(ib_uint32_t); diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 2401783648a..3d070e40570 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -140,7 +140,7 @@ trx_create(void) trx->global_read_view_heap = mem_heap_create(256); - trx->xid.formatID = -1; + trx->xid.null(); trx->op_info = ""; diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc index 4ad19c778ec..cc6774cd2b3 100644 --- a/storage/xtradb/buf/buf0buf.cc +++ b/storage/xtradb/buf/buf0buf.cc @@ -1718,7 +1718,7 @@ buf_relocate( } #endif /* UNIV_DEBUG */ - memcpy(dpage, bpage, sizeof *dpage); + new (dpage) buf_page_t(*bpage); ut_d(bpage->in_LRU_list = FALSE); ut_d(bpage->in_page_hash = FALSE); diff --git a/storage/xtradb/buf/buf0lru.cc b/storage/xtradb/buf/buf0lru.cc index caa008e8a96..e00bc3955de 100644 --- a/storage/xtradb/buf/buf0lru.cc +++ b/storage/xtradb/buf/buf0lru.cc @@ -2112,7 +2112,7 @@ not_freed: } if (b) { - memcpy(b, bpage, sizeof *b); + new (b) buf_page_t(*bpage); } if (!buf_LRU_block_remove_hashed(bpage, zip)) { diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h index a4f810652e0..e6c0aa1f252 100644 --- a/storage/xtradb/include/dict0mem.h +++ b/storage/xtradb/include/dict0mem.h @@ -516,6 +516,9 @@ struct dict_field_t{ unsigned fixed_len:10; /*!< 0 or the fixed length of the column if smaller than DICT_ANTELOPE_MAX_INDEX_COL_LEN */ + + /** Zero-initialize all fields */ + dict_field_t() : col(NULL), name(NULL), prefix_len(0), fixed_len(0) {} }; /**********************************************************************//** diff --git a/storage/xtradb/include/row0ftsort.h b/storage/xtradb/include/row0ftsort.h index e949ba302b9..547937bac98 100644 --- a/storage/xtradb/include/row0ftsort.h +++ b/storage/xtradb/include/row0ftsort.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2015, 2018, MariaDB Corporation. 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 the Free Software @@ -106,6 +107,14 @@ struct fts_tokenize_ctx { ib_rbt_t* cached_stopword;/*!< in: stopword list */ dfield_t sort_field[FTS_NUM_FIELDS_SORT]; /*!< in: sort field */ + + fts_tokenize_ctx() : + processed_len(0), init_pos(0), buf_used(0), + rows_added(), cached_stopword(NULL), sort_field() + { + memset(rows_added, 0, sizeof rows_added); + memset(sort_field, 0, sizeof sort_field); + } }; typedef struct fts_tokenize_ctx fts_tokenize_ctx_t; diff --git a/storage/xtradb/row/row0ftsort.cc b/storage/xtradb/row/row0ftsort.cc index 2292083689c..bb9821d4484 100644 --- a/storage/xtradb/row/row0ftsort.cc +++ b/storage/xtradb/row/row0ftsort.cc @@ -641,7 +641,6 @@ fts_parallel_tokenization( merge_file = psort_info->merge_file; blob_heap = mem_heap_create(512); memset(&doc, 0, sizeof(doc)); - memset(&t_ctx, 0, sizeof(t_ctx)); memset(mycount, 0, FTS_NUM_AUX_INDEX * sizeof(int)); doc.charset = fts_index_get_charset( diff --git a/storage/xtradb/row/row0import.cc b/storage/xtradb/row/row0import.cc index dad55205bc2..ea020fac56e 100644 --- a/storage/xtradb/row/row0import.cc +++ b/storage/xtradb/row/row0import.cc @@ -2620,8 +2620,6 @@ row_import_cfg_read_index_fields( dict_field_t* field = index->m_fields; - memset(field, 0x0, sizeof(*field) * n_fields); - for (ulint i = 0; i < n_fields; ++i, ++field) { byte* ptr = row; @@ -2639,6 +2637,8 @@ row_import_cfg_read_index_fields( return(DB_IO_ERROR); } + new (field) dict_field_t(); + field->prefix_len = mach_read_from_4(ptr); ptr += sizeof(ib_uint32_t); diff --git a/storage/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc index 8e62a7dba46..5f5ecba837e 100644 --- a/storage/xtradb/trx/trx0trx.cc +++ b/storage/xtradb/trx/trx0trx.cc @@ -276,7 +276,7 @@ trx_create(void) trx->distinct_page_access_hash = NULL; trx->take_stats = FALSE; - trx->xid.formatID = -1; + trx->xid.null(); trx->op_info = ""; |