Skip to content
Permalink
Browse files

post-merge: gcc 8 warnings

note: Inherit String from Sql_alloc,
to get operators new and new[] in sync

in rocksdb gcc was complaining that non-lvalue was cast to const.
  • Loading branch information...
vuvova committed Mar 15, 2019
1 parent 0508d32 commit f1134d567695990dc7d62b6c25e4b9aa8de439e0
@@ -334,7 +334,6 @@ get_mysql_vars(MYSQL *connection)
char *version_comment_var = NULL;
char *innodb_version_var = NULL;
char *have_backup_locks_var = NULL;
char *have_backup_safe_binlog_info_var = NULL;
char *log_bin_var = NULL;
char *lock_wait_timeout_var= NULL;
char *wsrep_on_var = NULL;
@@ -2014,7 +2014,6 @@ xtrabackup_read_metadata(char *filename)
{
FILE *fp;
my_bool r = TRUE;
int t;

fp = fopen(filename,"r");
if(!fp) {
@@ -5319,27 +5318,6 @@ innodb_free_param()
}


/** Store the current binary log coordinates in a specified file.
@param[in] filename file name
@param[in] name binary log file name
@param[in] pos binary log file position
@return whether the operation succeeded */
static bool
store_binlog_info(const char* filename, const char* name, ulonglong pos)
{
FILE *fp = fopen(filename, "w");

if (!fp) {
msg("mariabackup: failed to open '%s'", filename);
return(false);
}

fprintf(fp, "%s\t%llu\n", name, pos);
fclose(fp);

return(true);
}

/** Check if file exists*/
static bool file_exists(std::string name)
{
@@ -680,11 +680,11 @@ static int alloc_tmp_paths(THD *thd, uint n_paths,

*paths= (json_path_with_flags *) alloc_root(root,
sizeof(json_path_with_flags) * n_paths);
*tmp_paths= (String *) alloc_root(root, sizeof(String) * n_paths);

*tmp_paths= new (root) String[n_paths];
if (*paths == 0 || *tmp_paths == 0)
return 1;

bzero(*tmp_paths, sizeof(String) * n_paths);
for (uint c_path=0; c_path < n_paths; c_path++)
(*tmp_paths)[c_path].set_charset(&my_charset_utf8_general_ci);
}
@@ -1348,7 +1348,6 @@ QUICK_INDEX_SORT_SELECT::QUICK_INDEX_SORT_SELECT(THD *thd_param, TABLE *table)
DBUG_ENTER("QUICK_INDEX_SORT_SELECT::QUICK_INDEX_SORT_SELECT");
index= MAX_KEY;
head= table;
bzero(&read_record, sizeof(read_record));
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0,
MYF(MY_THREAD_SPECIFIC));
DBUG_VOID_RETURN;
@@ -772,7 +772,7 @@ enum enum_acl_tables
ROLES_MAPPING_TABLE,
TABLES_MAX // <== always the last
};
// bits for open_grant_tables

static const int Table_user= 1 << USER_TABLE;
static const int Table_db= 1 << DB_TABLE;
static const int Table_tables_priv= 1 << TABLES_PRIV_TABLE;
@@ -853,7 +853,7 @@ class Grant_table_base

Grant_table_base() : start_privilege_column(0), num_privilege_cols(0)
{
bzero(&tl, sizeof(tl));
tl.reset();
};

/* Initialization sequence common for all grant tables. This should be called
@@ -2447,7 +2447,7 @@ bool JOIN::make_aggr_tables_info()

aggr_tables++;
curr_tab= join_tab + exec_join_tab_cnt();
bzero(curr_tab, sizeof(JOIN_TAB));
bzero((void*)curr_tab, sizeof(JOIN_TAB));
curr_tab->ref.key= -1;
curr_tab->join= this;

@@ -2535,7 +2535,7 @@ bool JOIN::make_aggr_tables_info()
{
aggr_tables++;
curr_tab= join_tab + exec_join_tab_cnt();
bzero(curr_tab, sizeof(JOIN_TAB));
bzero((void*)curr_tab, sizeof(JOIN_TAB));
curr_tab->ref.key= -1;
if (only_const_tables())
first_select= sub_select_postjoin_aggr;
@@ -2663,7 +2663,7 @@ bool JOIN::make_aggr_tables_info()

curr_tab++;
aggr_tables++;
bzero(curr_tab, sizeof(JOIN_TAB));
bzero((void*)curr_tab, sizeof(JOIN_TAB));
curr_tab->ref.key= -1;

/* group data to new table */
&bitmaps, bitmap_buffer_size(field_count) * 6,
NullS))
return true;
bzero(s, sizeof(*s));
s->reset();
s->blob_field= blob_field;
setup_tmp_table_column_bitmaps(this, bitmaps, field_count);
m_alloced_field_count= field_count;
@@ -2046,9 +2046,9 @@ class Virtual_tmp_table: public TABLE
static void *operator new(size_t size, THD *thd) throw();
static void operator delete(void *ptr, size_t size) {TRASH_FREE(ptr, size);}

Virtual_tmp_table(THD *thd)
Virtual_tmp_table(THD *thd) : m_alloced_field_count(0)
{
bzero(this, sizeof(*this));
reset();
temp_pool_slot= MY_BIT_NONE;
in_use= thd;
}
@@ -27,6 +27,7 @@
#include "m_ctype.h" /* my_charset_bin */
#include "my_sys.h" /* alloc_root, my_free, my_realloc */
#include "m_string.h" /* TRASH */
#include "sql_list.h"

class String;
typedef struct st_io_cache IO_CACHE;
@@ -129,7 +130,7 @@ uint convert_to_printable(char *to, size_t to_len,
const char *from, size_t from_len,
CHARSET_INFO *from_cs, size_t nbytes= 0);

class String
class String : public Sql_alloc
{
char *Ptr;
uint32 str_length,Alloced_length, extra_alloc;
@@ -179,16 +180,6 @@ class String
alloced= thread_specific= 0;
str_charset=str.str_charset;
}
static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
{ return (void*) alloc_root(mem_root, (uint) size); }
static void operator delete(void *ptr_arg, size_t size)
{
(void) ptr_arg;
(void) size;
TRASH_FREE(ptr_arg, size);
}
static void operator delete(void *, MEM_ROOT *)
{ /* never called */ }
~String() { free(); }

/* Mark variable thread specific it it's not allocated already */
@@ -5782,7 +5782,7 @@ AIO::AIO(
m_not_full = os_event_create("aio_not_full");
m_is_empty = os_event_create("aio_is_empty");

memset(&m_slots[0], 0x0, sizeof(m_slots[0]) * m_slots.size());
memset((void*)&m_slots[0], 0x0, sizeof(m_slots[0]) * m_slots.size());
#ifdef LINUX_NATIVE_AIO
memset(&m_events[0], 0x0, sizeof(m_events[0]) * m_events.size());
#endif /* LINUX_NATIVE_AIO */
@@ -2591,7 +2591,7 @@ ha_mroonga::~ha_mroonga()
}
if (blob_buffers)
{
::delete [] blob_buffers;
delete [] blob_buffers;
}
grn_obj_unlink(ctx, &top_left_point);
grn_obj_unlink(ctx, &bottom_right_point);
@@ -4726,11 +4726,8 @@ int ha_mroonga::storage_open_columns(void)

if (table_share->blob_fields)
{
if (blob_buffers)
{
delete [] blob_buffers;
}
if (!(blob_buffers = new String[n_columns]))
DBUG_ASSERT(!blob_buffers);
if (!(blob_buffers = new (&table->mem_root) String[n_columns]))
{
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
@@ -676,7 +676,7 @@ static void rocksdb_set_rocksdb_info_log_level(
RDB_MUTEX_LOCK_CHECK(rdb_sysvars_mutex);
rocksdb_info_log_level = *static_cast<const uint64_t *>(save);
rocksdb_db_options->info_log->SetInfoLogLevel(
static_cast<const rocksdb::InfoLogLevel>(rocksdb_info_log_level));
static_cast<rocksdb::InfoLogLevel>(rocksdb_info_log_level));
RDB_MUTEX_UNLOCK_CHECK(rdb_sysvars_mutex);
}

@@ -127,9 +127,9 @@ Rdb_key_def::Rdb_key_def(const Rdb_key_def &k)
m_total_index_flags_length == 0);
if (k.m_pack_info) {
const size_t size = sizeof(Rdb_field_packing) * k.m_key_parts;
m_pack_info =
reinterpret_cast<Rdb_field_packing *>(my_malloc(size, MYF(0)));
memcpy(m_pack_info, k.m_pack_info, size);
void *pack_info= my_malloc(size, MYF(0));
memcpy(pack_info, k.m_pack_info, size);
m_pack_info = reinterpret_cast<Rdb_field_packing *>(pack_info);
}

if (k.m_pk_part_no) {
@@ -1090,7 +1090,7 @@ uint Rdb_key_def::pack_record(
// Insert TTL timestamp
if (has_ttl() && ttl_bytes) {
write_index_flag_field(unpack_info,
reinterpret_cast<const uchar *const>(ttl_bytes),
reinterpret_cast<const uchar *>(ttl_bytes),
Rdb_key_def::TTL_FLAG);
}
}
@@ -28,7 +28,7 @@ namespace myrocks {

void *Rdb_thread::thread_func(void *const thread_ptr) {
DBUG_ASSERT(thread_ptr != nullptr);
Rdb_thread *const thread = static_cast<Rdb_thread *const>(thread_ptr);
Rdb_thread *const thread = static_cast<Rdb_thread *>(thread_ptr);
if (!thread->m_run_once.exchange(true)) {
thread->setname();
thread->run();

0 comments on commit f1134d5

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.