diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-08-03 12:21:13 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-08-03 12:21:13 +0300 |
commit | 769f6d2db72dd70ff2fef69bed02fb4124a682ab (patch) | |
tree | 043c2b7e3fb50a295914eb1f3bb0e767614c2070 /extra | |
parent | 0d3972c6bef357dfd4aef0ecdb03b5ac34844e45 (diff) | |
download | mariadb-git-769f6d2db72dd70ff2fef69bed02fb4124a682ab.tar.gz |
Fix -Wclass-memaccess in WSREP,InnoDB,XtraDB
Diffstat (limited to 'extra')
-rw-r--r-- | extra/mariabackup/backup_copy.cc | 19 | ||||
-rw-r--r-- | extra/mariabackup/wsrep.cc | 3 |
2 files changed, 17 insertions, 5 deletions
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 7cdc6b8e3a6..895ef744ea1 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -460,6 +460,21 @@ struct datafile_cur_t { size_t buf_size; size_t buf_read; size_t buf_offset; + + explicit datafile_cur_t(const char* filename = NULL) : + file(), thread_n(0), orig_buf(NULL), buf(NULL), buf_size(0), + buf_read(0), buf_offset(0) + { + memset(rel_path, 0, sizeof rel_path); + if (filename) { + strncpy(abs_path, filename, sizeof abs_path); + abs_path[(sizeof abs_path) - 1] = 0; + } else { + abs_path[0] = '\0'; + } + rel_path[0] = '\0'; + memset(&statinfo, 0, sizeof statinfo); + } }; static @@ -478,9 +493,7 @@ datafile_open(const char *file, datafile_cur_t *cursor, uint thread_n) { ulint success; - memset(cursor, 0, sizeof(datafile_cur_t)); - - strncpy(cursor->abs_path, file, sizeof(cursor->abs_path)); + new (cursor) datafile_cur_t(file); /* Get the relative path for the destination tablespace name, i.e. the one that can be appended to the backup root directory. Non-system diff --git a/extra/mariabackup/wsrep.cc b/extra/mariabackup/wsrep.cc index 3baa9e660d7..7b0b26d803a 100644 --- a/extra/mariabackup/wsrep.cc +++ b/extra/mariabackup/wsrep.cc @@ -179,8 +179,7 @@ xb_write_galera_info(bool incremental_prepare) return; } - memset(&xid, 0, sizeof(xid)); - xid.formatID = -1; + xid.null(); if (!trx_sys_read_wsrep_checkpoint(&xid)) { |