Skip to content

Commit

Permalink
WT-2031 Fix -Wsign-conversion warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
sueloverso committed Aug 26, 2015
1 parent 075570e commit d90aa22
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/include/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,16 @@
/* Slot is in use, but closed to new joins */
#define WT_LOG_SLOT_CLOSED(state) \
(WT_LOG_SLOT_ACTIVE(state) && \
(FLD64_ISSET(state, WT_LOG_SLOT_CLOSE) && \
!FLD64_ISSET(state, WT_LOG_SLOT_RESERVED)))
(FLD64_ISSET((uint64_t)state, WT_LOG_SLOT_CLOSE) && \
!FLD64_ISSET((uint64_t)state, WT_LOG_SLOT_RESERVED)))
/* Slot is in use, all data copied into buffer */
#define WT_LOG_SLOT_DONE(state) \
(WT_LOG_SLOT_CLOSED(state) && \
(WT_LOG_SLOT_RELEASED(state) == WT_LOG_SLOT_JOINED(state)))
/* Slot is in use, more threads may join this slot */
#define WT_LOG_SLOT_OPEN(state) \
(WT_LOG_SLOT_ACTIVE(state) && \
!FLD64_ISSET((state), WT_LOG_SLOT_CLOSE) && \
!FLD64_ISSET((uint64_t)(state), WT_LOG_SLOT_CLOSE) && \
WT_LOG_SLOT_JOINED(state) < WT_LOG_SLOT_BUF_MAX)

struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_logslot {
Expand Down
6 changes: 3 additions & 3 deletions src/log/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ __log_release(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, int *freep)
}

if (F_ISSET(slot, WT_SLOT_BUFFERED)) {
write_size = (size_t)release_bytes - slot->slot_unbuffered;
write_size = (size_t)(release_bytes - slot->slot_unbuffered);
if (write_size != 0)
WT_ERR(__wt_write(session,
slot->slot_fh, slot->slot_start_offset,
Expand Down Expand Up @@ -1680,8 +1680,8 @@ __log_direct_write(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp,
WT_RET(__wt_log_acquire(session, record->size, &tmp));
WT_ASSERT(session,
__wt_log_cmp(&log->write_lsn, &tmp.slot_release_lsn) <= 0);
tmp.slot_end_lsn.offset += record->size;
tmp.slot_direct_size = record->size;
tmp.slot_end_lsn.offset += (wt_off_t)record->size;
tmp.slot_direct_size = (int64_t)record->size;
WT_RET(__log_fill(session, &myslot, 1, record, lsnp));
WT_RET(__log_release(session, myslot.slot, NULL));
log->alloc_lsn = tmp.slot_end_lsn;
Expand Down
15 changes: 8 additions & 7 deletions src/log/log_slot.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ __wt_log_slot_close(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, int *releasep)
/*
* If someone completely processed this slot, we're done.
*/
if (FLD64_ISSET(slot->slot_state, WT_LOG_SLOT_RESERVED))
if (FLD64_ISSET((uint64_t)slot->slot_state, WT_LOG_SLOT_RESERVED))
return (0);
new_state = (old_state | WT_LOG_SLOT_CLOSE);
/*
Expand Down Expand Up @@ -280,9 +280,10 @@ __wt_log_slot_destroy(WT_SESSION_IMPL *session)
*/
for (i = 0; i < WT_SLOT_POOL; i++) {
slot = &log->slot_pool[i];
if (!FLD64_ISSET(slot->slot_state, WT_LOG_SLOT_RESERVED)) {
if (!FLD64_ISSET(
(uint64_t)slot->slot_state, WT_LOG_SLOT_RESERVED)) {
rel = WT_LOG_SLOT_RELEASED(slot->slot_state);
write_size = (size_t)rel - slot->slot_unbuffered;
write_size = (size_t)(rel - slot->slot_unbuffered);
if (write_size != 0)
WT_RET(__wt_write(session, slot->slot_fh,
slot->slot_start_offset, write_size,
Expand Down Expand Up @@ -345,8 +346,8 @@ __wt_log_slot_join(WT_SESSION_IMPL *session, uint64_t mysize,
released = WT_LOG_SLOT_RELEASED(old_state);
join_offset = WT_LOG_SLOT_JOINED(old_state);
new_join = join_offset + (int32_t)mysize;
new_state = WT_LOG_SLOT_JOIN_REL(
(uint64_t)new_join, released, flag_state);
new_state = (int64_t)WT_LOG_SLOT_JOIN_REL(
(int64_t)new_join, (int64_t)released, (int64_t)flag_state);

/*
* Check if the slot is open for joining and we are able to
Expand Down Expand Up @@ -377,7 +378,7 @@ __wt_log_slot_join(WT_SESSION_IMPL *session, uint64_t mysize,
F_SET(slot, WT_SLOT_SYNC);
myslotp->slot = slot;
myslotp->offset = join_offset;
myslotp->end_offset = join_offset + mysize;
myslotp->end_offset = (wt_off_t)((uint64_t)join_offset + mysize);
return (0);
}

Expand Down Expand Up @@ -411,7 +412,7 @@ __wt_log_slot_release(WT_MYSLOT *myslot, int64_t size)
/*
* Add my size into the state and return the new size.
*/
my_size = WT_LOG_SLOT_JOIN_REL((uint64_t)0, size, 0);
my_size = (int64_t)WT_LOG_SLOT_JOIN_REL((int64_t)0, size, 0);
return (__wt_atomic_addiv64(&slot->slot_state, my_size));
}

Expand Down

0 comments on commit d90aa22

Please sign in to comment.