Commit c4605a28 authored by marko's avatar marko

branches/zip: Fix most MSVC (Windows) compilation warnings.

lock_get_table(), locks_row_eq_lock(), buf_page_get_mutex(): Add return
after ut_error.  On Windows, ut_error is not declared as "noreturn".

Add explicit type casts when assigning ulint to byte to get rid of
"possible loss of precision" warnings.

struct i_s_table_cache_struct: Declare rows_used, rows_allocd as ulint
instead of ullint.  32 bits should be enough.

fill_innodb_trx_from_cache(), i_s_zip_fill_low(): Cast 64-bit unsigned
integers to longlong when calling Field::store(longlong, bool is_unsigned).
Otherwise, the compiler would implicitly convert them to double and
invoke Field::store(double) instead.

recv_truncate_group(), recv_copy_group(), recv_calc_lsn_on_data_add():
Cast ib_uint64_t expressions to ulint to get rid of "possible loss of
precision" warnings.  (There should not be any loss of precision in
these cases.)

log_close(), log_checkpoint_margin(): Declare some variables as ib_uint64_t
instead of ulint, so that there won't be any potential loss of precision.

mach_write_ull(): Cast the second argument of mach_write_to_4() to ulint.

OS_FILE_FROM_FD(): Cast the return value of _get_osfhandle() to HANDLE.

row_merge_dict_table_get_index(): Cast the parameter of mem_free() to (void*)
in order to get rid of the bogus MSVC warning C4090, which has been reported
as MSVC bug 101661:
<http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=101661>

row_mysql_read_blob_ref(): To get rid of a bogus MSVC warning C4090,
drop a const qualifier.
parent 7c119c95
...@@ -330,7 +330,8 @@ fill_innodb_trx_from_cache( ...@@ -330,7 +330,8 @@ fill_innodb_trx_from_cache(
} }
/* trx_weight */ /* trx_weight */
OK(fields[IDX_TRX_WEIGHT]->store(row->trx_weight)); OK(fields[IDX_TRX_WEIGHT]->store((longlong) row->trx_weight,
true));
/* trx_mysql_thread_id */ /* trx_mysql_thread_id */
OK(fields[IDX_TRX_MYSQL_THREAD_ID]->store( OK(fields[IDX_TRX_MYSQL_THREAD_ID]->store(
...@@ -1103,8 +1104,10 @@ i_s_zip_fill_low( ...@@ -1103,8 +1104,10 @@ i_s_zip_fill_low(
table->field[2]->store(UNIV_LIKELY(x < BUF_BUDDY_SIZES) table->field[2]->store(UNIV_LIKELY(x < BUF_BUDDY_SIZES)
? UT_LIST_GET_LEN(buf_pool->zip_free[x]) ? UT_LIST_GET_LEN(buf_pool->zip_free[x])
: 0); : 0);
table->field[3]->store(buf_buddy_relocated[x]); table->field[3]->store((longlong) buf_buddy_relocated[x],
table->field[4]->store(buf_buddy_relocated_duration[x]); true);
table->field[4]->store((longlong)
buf_buddy_relocated_duration[x], true);
if (reset) { if (reset) {
/* This is protected by buf_pool_mutex. */ /* This is protected by buf_pool_mutex. */
...@@ -1122,9 +1125,13 @@ i_s_zip_fill_low( ...@@ -1122,9 +1125,13 @@ i_s_zip_fill_low(
const uint i = x - y; const uint i = x - y;
table->field[5]->store(page_zip_compress_count[i]); table->field[5]->store(page_zip_compress_count[i]);
table->field[6]->store(page_zip_compress_ok[i]); table->field[6]->store(page_zip_compress_ok[i]);
table->field[7]->store(page_zip_compress_duration[i]); table->field[7]->store((longlong)
page_zip_compress_duration[i],
true);
table->field[8]->store(page_zip_decompress_count[i]); table->field[8]->store(page_zip_decompress_count[i]);
table->field[9]->store(page_zip_decompress_duration[i]); table->field[9]->store((longlong)
page_zip_decompress_duration[i],
true);
if (reset) { if (reset) {
page_zip_compress_count[i] = 0; page_zip_compress_count[i] = 0;
page_zip_compress_ok[i] = 0; page_zip_compress_ok[i] = 0;
......
...@@ -278,7 +278,7 @@ buf_page_get_mutex( ...@@ -278,7 +278,7 @@ buf_page_get_mutex(
switch (buf_page_get_state(bpage)) { switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_FREE: case BUF_BLOCK_ZIP_FREE:
ut_error; ut_error;
break; return(NULL);
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY: case BUF_BLOCK_ZIP_DIRTY:
return(&buf_pool_zip_mutex); return(&buf_pool_zip_mutex);
......
...@@ -287,8 +287,8 @@ mach_write_ull( ...@@ -287,8 +287,8 @@ mach_write_ull(
{ {
ut_ad(b); ut_ad(b);
mach_write_to_4(b, n >> 32); mach_write_to_4(b, (ulint) (n >> 32));
mach_write_to_4(b + 4, n); mach_write_to_4(b + 4, (ulint) n);
} }
/************************************************************ /************************************************************
......
...@@ -43,7 +43,7 @@ extern ulint os_n_pending_writes; ...@@ -43,7 +43,7 @@ extern ulint os_n_pending_writes;
#ifdef __WIN__ #ifdef __WIN__
#define os_file_t HANDLE #define os_file_t HANDLE
#define OS_FILE_FROM_FD(fd) _get_osfhandle(fd) #define OS_FILE_FROM_FD(fd) (HANDLE) _get_osfhandle(fd)
#else #else
typedef int os_file_t; typedef int os_file_t;
#define OS_FILE_FROM_FD(fd) fd #define OS_FILE_FROM_FD(fd) fd
......
...@@ -135,7 +135,7 @@ trx_i_s_cache_end_write( ...@@ -135,7 +135,7 @@ trx_i_s_cache_end_write(
Retrieves the number of used rows in the cache for a given Retrieves the number of used rows in the cache for a given
INFORMATION SCHEMA table. */ INFORMATION SCHEMA table. */
UNIV_INTERN UNIV_INTERN
ullint ulint
trx_i_s_cache_get_rows_used( trx_i_s_cache_get_rows_used(
/*========================*/ /*========================*/
/* out: number of rows */ /* out: number of rows */
......
...@@ -5432,6 +5432,7 @@ lock_get_table( ...@@ -5432,6 +5432,7 @@ lock_get_table(
return(lock->un_member.tab_lock.table); return(lock->un_member.tab_lock.table);
default: default:
ut_error; ut_error;
return(NULL);
} }
} }
......
...@@ -333,7 +333,7 @@ log_close(void) ...@@ -333,7 +333,7 @@ log_close(void)
ib_uint64_t oldest_lsn; ib_uint64_t oldest_lsn;
ib_uint64_t lsn; ib_uint64_t lsn;
log_t* log = log_sys; log_t* log = log_sys;
ulint checkpoint_age; ib_uint64_t checkpoint_age;
ut_ad(mutex_own(&(log->mutex))); ut_ad(mutex_own(&(log->mutex)));
...@@ -2002,9 +2002,9 @@ log_checkpoint_margin(void) ...@@ -2002,9 +2002,9 @@ log_checkpoint_margin(void)
/*=======================*/ /*=======================*/
{ {
log_t* log = log_sys; log_t* log = log_sys;
ulint age; ib_uint64_t age;
ulint checkpoint_age; ib_uint64_t checkpoint_age;
ulint advance; ib_uint64_t advance;
ib_uint64_t oldest_lsn; ib_uint64_t oldest_lsn;
ibool sync; ibool sync;
ibool checkpoint_sync; ibool checkpoint_sync;
......
...@@ -300,7 +300,7 @@ recv_truncate_group( ...@@ -300,7 +300,7 @@ recv_truncate_group(
ut_memcpy(log_sys->buf, recv_sys->last_block, ut_memcpy(log_sys->buf, recv_sys->last_block,
OS_FILE_LOG_BLOCK_SIZE); OS_FILE_LOG_BLOCK_SIZE);
log_block_set_data_len(log_sys->buf, log_block_set_data_len(log_sys->buf,
recovered_lsn - start_lsn); (ulint) (recovered_lsn - start_lsn));
} }
if (start_lsn >= finish_lsn) { if (start_lsn >= finish_lsn) {
...@@ -316,7 +316,7 @@ recv_truncate_group( ...@@ -316,7 +316,7 @@ recv_truncate_group(
end_lsn = finish_lsn; end_lsn = finish_lsn;
} }
len = end_lsn - start_lsn; len = (ulint) (end_lsn - start_lsn);
log_group_write_buf(group, log_sys->buf, len, start_lsn, 0); log_group_write_buf(group, log_sys->buf, len, start_lsn, 0);
if (end_lsn >= finish_lsn) { if (end_lsn >= finish_lsn) {
...@@ -372,7 +372,7 @@ recv_copy_group( ...@@ -372,7 +372,7 @@ recv_copy_group(
log_group_read_log_seg(LOG_RECOVER, log_sys->buf, log_group_read_log_seg(LOG_RECOVER, log_sys->buf,
up_to_date_group, start_lsn, end_lsn); up_to_date_group, start_lsn, end_lsn);
len = end_lsn - start_lsn; len = (ulint) (end_lsn - start_lsn);
log_group_write_buf(group, log_sys->buf, len, start_lsn, 0); log_group_write_buf(group, log_sys->buf, len, start_lsn, 0);
...@@ -1802,9 +1802,10 @@ recv_calc_lsn_on_data_add( ...@@ -1802,9 +1802,10 @@ recv_calc_lsn_on_data_add(
- LOG_BLOCK_HDR_SIZE; - LOG_BLOCK_HDR_SIZE;
ut_ad(frag_len < OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE ut_ad(frag_len < OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE
- LOG_BLOCK_TRL_SIZE); - LOG_BLOCK_TRL_SIZE);
lsn_len = len + ((len + frag_len) lsn_len = (ulint) len;
/ (OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE lsn_len += (lsn_len + frag_len)
- LOG_BLOCK_TRL_SIZE)) / (OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE
- LOG_BLOCK_TRL_SIZE)
* (LOG_BLOCK_HDR_SIZE + LOG_BLOCK_TRL_SIZE); * (LOG_BLOCK_HDR_SIZE + LOG_BLOCK_TRL_SIZE);
return(lsn + lsn_len); return(lsn + lsn_len);
......
...@@ -370,10 +370,10 @@ page_zip_fixed_field_encode( ...@@ -370,10 +370,10 @@ page_zip_fixed_field_encode(
126 = nullable variable field with maximum length >255; 126 = nullable variable field with maximum length >255;
127 = not null variable field with maximum length >255 127 = not null variable field with maximum length >255
*/ */
*buf++ = val; *buf++ = (byte) val;
} else { } else {
*buf++ = 0x80 | val >> 8; *buf++ = (byte) (0x80 | val >> 8);
*buf++ = 0xff & val; *buf++ = (byte) val;
} }
return(buf); return(buf);
...@@ -431,7 +431,7 @@ page_zip_fields_encode( ...@@ -431,7 +431,7 @@ page_zip_fields_encode(
col++; col++;
} }
*buf++ = val; *buf++ = (byte) val;
col++; col++;
} else if (val) { } else if (val) {
/* fixed-length non-nullable field */ /* fixed-length non-nullable field */
...@@ -497,10 +497,10 @@ page_zip_fields_encode( ...@@ -497,10 +497,10 @@ page_zip_fields_encode(
} }
if (i < 128) { if (i < 128) {
*buf++ = i; *buf++ = (byte) i;
} else { } else {
*buf++ = 0x80 | i >> 8; *buf++ = (byte) (0x80 | i >> 8);
*buf++ = 0xff & i; *buf++ = (byte) i;
} }
ut_ad((ulint) (buf - buf_start) <= (n + 2) * 2); ut_ad((ulint) (buf - buf_start) <= (n + 2) * 2);
...@@ -1676,7 +1676,7 @@ page_zip_set_extra_bytes( ...@@ -1676,7 +1676,7 @@ page_zip_set_extra_bytes(
rec_set_next_offs_new(rec, offs); rec_set_next_offs_new(rec, offs);
rec = page + offs; rec = page + offs;
rec[-REC_N_NEW_EXTRA_BYTES] = info_bits; rec[-REC_N_NEW_EXTRA_BYTES] = (byte) info_bits;
info_bits = 0; info_bits = 0;
} }
...@@ -1684,7 +1684,7 @@ page_zip_set_extra_bytes( ...@@ -1684,7 +1684,7 @@ page_zip_set_extra_bytes(
rec_set_next_offs_new(rec, PAGE_NEW_SUPREMUM); rec_set_next_offs_new(rec, PAGE_NEW_SUPREMUM);
/* Set n_owned of the supremum record. */ /* Set n_owned of the supremum record. */
page[PAGE_NEW_SUPREMUM - REC_N_NEW_EXTRA_BYTES] = n_owned; page[PAGE_NEW_SUPREMUM - REC_N_NEW_EXTRA_BYTES] = (byte) n_owned;
/* The dense directory excludes the infimum and supremum records. */ /* The dense directory excludes the infimum and supremum records. */
n = page_dir_get_n_heap(page) - PAGE_HEAP_NO_USER_LOW; n = page_dir_get_n_heap(page) - PAGE_HEAP_NO_USER_LOW;
...@@ -3250,10 +3250,10 @@ page_zip_write_rec( ...@@ -3250,10 +3250,10 @@ page_zip_write_rec(
0 is reserved to indicate the end of the modification log. */ 0 is reserved to indicate the end of the modification log. */
if (UNIV_UNLIKELY(heap_no - 1 >= 64)) { if (UNIV_UNLIKELY(heap_no - 1 >= 64)) {
*data++ = 0x80 | (heap_no - 1) >> 7; *data++ = (byte) (0x80 | (heap_no - 1) >> 7);
ut_ad(!*data); ut_ad(!*data);
} }
*data++ = (heap_no - 1) << 1; *data++ = (byte) ((heap_no - 1) << 1);
ut_ad(!*data); ut_ad(!*data);
{ {
...@@ -3802,10 +3802,10 @@ page_zip_clear_rec( ...@@ -3802,10 +3802,10 @@ page_zip_clear_rec(
data = page_zip->data + page_zip->m_end; data = page_zip->data + page_zip->m_end;
ut_ad(!*data); ut_ad(!*data);
if (UNIV_UNLIKELY(heap_no - 1 >= 64)) { if (UNIV_UNLIKELY(heap_no - 1 >= 64)) {
*data++ = 0x80 | (heap_no - 1) >> 7; *data++ = (byte) (0x80 | (heap_no - 1) >> 7);
ut_ad(!*data); ut_ad(!*data);
} }
*data++ = (heap_no - 1) << 1 | 1; *data++ = (byte) ((heap_no - 1) << 1 | 1);
ut_ad(!*data); ut_ad(!*data);
ut_ad((ulint) (data - page_zip->data) ut_ad((ulint) (data - page_zip->data)
< page_zip_get_size(page_zip)); < page_zip_get_size(page_zip));
......
...@@ -526,10 +526,10 @@ row_merge_buf_write( ...@@ -526,10 +526,10 @@ row_merge_buf_write(
/* Encode extra_size + 1 */ /* Encode extra_size + 1 */
if (extra_size + 1 < 0x80) { if (extra_size + 1 < 0x80) {
*b++ = extra_size + 1; *b++ = (byte) (extra_size + 1);
} else { } else {
ut_ad((extra_size + 1) < 0x8000); ut_ad((extra_size + 1) < 0x8000);
*b++ = 0x80 | ((extra_size + 1) >> 8); *b++ = (byte) (0x80 | ((extra_size + 1) >> 8));
*b++ = (byte) (extra_size + 1); *b++ = (byte) (extra_size + 1);
} }
...@@ -617,7 +617,7 @@ row_merge_dict_table_get_index( ...@@ -617,7 +617,7 @@ row_merge_dict_table_get_index(
index = dict_table_get_index_by_max_id( index = dict_table_get_index_by_max_id(
table, index_def->name, column_names, index_def->n_fields); table, index_def->name, column_names, index_def->n_fields);
mem_free(column_names); mem_free((void*) column_names);
return(index); return(index);
} }
...@@ -868,9 +868,9 @@ row_merge_write_rec_low( ...@@ -868,9 +868,9 @@ row_merge_write_rec_low(
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
if (e < 0x80) { if (e < 0x80) {
*b++ = e; *b++ = (byte) e;
} else { } else {
*b++ = 0x80 | (e >> 8); *b++ = (byte) (0x80 | (e >> 8));
*b++ = (byte) e; *b++ = (byte) e;
} }
......
...@@ -230,7 +230,7 @@ row_mysql_read_blob_ref( ...@@ -230,7 +230,7 @@ row_mysql_read_blob_ref(
ulint col_len) /* in: BLOB reference length ulint col_len) /* in: BLOB reference length
(not BLOB length) */ (not BLOB length) */
{ {
const byte* data; byte* data;
*len = mach_read_from_n_little_endian(ref, col_len - 8); *len = mach_read_from_n_little_endian(ref, col_len - 8);
......
...@@ -108,8 +108,8 @@ typedef struct i_s_mem_chunk_struct { ...@@ -108,8 +108,8 @@ typedef struct i_s_mem_chunk_struct {
/* This represents one table's cache. */ /* This represents one table's cache. */
typedef struct i_s_table_cache_struct { typedef struct i_s_table_cache_struct {
ullint rows_used; /* number of used rows */ ulint rows_used; /* number of used rows */
ullint rows_allocd; /* number of allocated rows */ ulint rows_allocd; /* number of allocated rows */
ulint row_size; /* size of a single row */ ulint row_size; /* size of a single row */
i_s_mem_chunk_t chunks[MEM_CHUNKS_IN_TABLE_CACHE]; /* array of i_s_mem_chunk_t chunks[MEM_CHUNKS_IN_TABLE_CACHE]; /* array of
memory chunks that stores the memory chunks that stores the
...@@ -780,6 +780,7 @@ locks_row_eq_lock( ...@@ -780,6 +780,7 @@ locks_row_eq_lock(
default: default:
ut_error; ut_error;
return(FALSE);
} }
#endif #endif
} }
...@@ -1305,7 +1306,7 @@ cache_select_table( ...@@ -1305,7 +1306,7 @@ cache_select_table(
Retrieves the number of used rows in the cache for a given Retrieves the number of used rows in the cache for a given
INFORMATION SCHEMA table. */ INFORMATION SCHEMA table. */
UNIV_INTERN UNIV_INTERN
ullint ulint
trx_i_s_cache_get_rows_used( trx_i_s_cache_get_rows_used(
/*========================*/ /*========================*/
/* out: number of rows */ /* out: number of rows */
......
...@@ -572,7 +572,7 @@ trx_undo_page_report_modify( ...@@ -572,7 +572,7 @@ trx_undo_page_report_modify(
type_cmpl |= cmpl_info * TRX_UNDO_CMPL_INFO_MULT; type_cmpl |= cmpl_info * TRX_UNDO_CMPL_INFO_MULT;
type_cmpl_ptr = ptr; type_cmpl_ptr = ptr;
*ptr++ = type_cmpl; *ptr++ = (byte) type_cmpl;
ptr += mach_dulint_write_much_compressed(ptr, trx->undo_no); ptr += mach_dulint_write_much_compressed(ptr, trx->undo_no);
ptr += mach_dulint_write_much_compressed(ptr, table->id); ptr += mach_dulint_write_much_compressed(ptr, table->id);
...@@ -580,7 +580,7 @@ trx_undo_page_report_modify( ...@@ -580,7 +580,7 @@ trx_undo_page_report_modify(
/*----------------------------------------*/ /*----------------------------------------*/
/* Store the state of the info bits */ /* Store the state of the info bits */
*ptr++ = rec_get_info_bits(rec, dict_table_is_comp(table)); *ptr++ = (byte) rec_get_info_bits(rec, dict_table_is_comp(table));
/* Store the values of the system columns */ /* Store the values of the system columns */
field = rec_get_nth_field(rec, offsets, field = rec_get_nth_field(rec, offsets,
......
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