Commit c88f5f1a authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

refs #5206 merge signed types fix to main

git-svn-id: file:///svn/toku/tokudb@45638 c7de825b-a66e-492c-adef-691d508d4ae1
parent ab842ae7
......@@ -413,7 +413,7 @@ ct_maybe_merge_child(struct flusher_advice *fa,
flush_some_child(h, root_node, &new_fa);
(void) __sync_fetch_and_add(&STATUS_VALUE(FT_FLUSHER_CLEANER_NUM_LEAF_MERGES_RUNNING), -1);
(void) __sync_fetch_and_sub(&STATUS_VALUE(FT_FLUSHER_CLEANER_NUM_LEAF_MERGES_RUNNING), 1);
toku_free(ctme.target_key.data);
}
......
......@@ -2108,7 +2108,7 @@ static void putbuf_int32 (struct dbuf *dbuf, int v) {
putbuf_bytes(dbuf, &v, 4);
}
static void putbuf_int64 (struct dbuf *dbuf, unsigned long long v) {
static void putbuf_int64 (struct dbuf *dbuf, long long v) {
putbuf_int32(dbuf, v>>32);
putbuf_int32(dbuf, v&0xFFFFFFFF);
}
......
......@@ -621,7 +621,7 @@ int toku_omt_delete_at(OMT omt, u_int32_t index) {
OMTVALUE v;
int r;
if (index>=omt_size(omt)) return EINVAL;
if ((r=maybe_resize_or_convert(omt, -1+omt_size(omt)))) return r;
if ((r=maybe_resize_or_convert(omt, omt_size(omt)-1))) return r;
if (omt->is_array && index!=0 && index!=omt->i.a.num_values-1) {
if ((r=omt_convert_to_tree(omt))) return r;
}
......
......@@ -25,7 +25,7 @@ flush (CACHEFILE f __attribute__((__unused__)),
BOOL UU(is_clone)
) {
if (w) {
int curr_size = __sync_fetch_and_add(&total_size, -1);
int curr_size = __sync_fetch_and_sub(&total_size, 1);
assert(curr_size <= 200);
usleep(500*1000);
}
......
......@@ -64,7 +64,7 @@ static size_t bad_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stre
if (do_write_errors && event_count_trigger == event_add_and_fetch()) {
event_hit();
errno = ENOSPC;
r = -1;
r = (size_t) -1;
} else {
r = fwrite(ptr, size, nmemb, stream);
if (r!=nmemb) {
......
......@@ -45,7 +45,7 @@ static size_t bad_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stre
event_hit();
if (verbose) printf("%s %d\n", __FUNCTION__, event_count);
errno = ENOSPC;
r = -1;
r = (size_t) -1;
} else {
r = fwrite(ptr, size, nmemb, stream);
if (r!=nmemb) {
......
......@@ -72,7 +72,7 @@ insert_something(FT_HANDLE t, CACHETABLE UU(ct), void *UU(extra))
{
assert(t);
int r = 0;
unsigned int dummy_value = 1 << 31;
unsigned int dummy_value = 1U << 31;
DBT key;
DBT val;
toku_fill_dbt(&key, &dummy_value, sizeof(unsigned int));
......
......@@ -29,10 +29,10 @@ static uint64_t htonl64(uint64_t x) {
typedef size_t (*malloc_usable_size_fun_t)(void *p);
#if defined(HAVE_MALLOC_USABLE_SIZE)
size_t malloc_usable_size(void *p);
size_t malloc_usable_size(void *p) __THROW;
static malloc_usable_size_fun_t malloc_usable_size_f = malloc_usable_size;
#elif defined(HAVE_MALLOC_SIZE)
size_t malloc_size(void *p);
size_t malloc_size(void *p) __THROW;
static malloc_usable_size_fun_t malloc_usable_size_f = malloc_size;
#endif
......
......@@ -29,10 +29,10 @@ static uint64_t htonl64(uint64_t x) {
typedef size_t (*malloc_usable_size_fun_t)(void *p);
#if defined(HAVE_MALLOC_USABLE_SIZE)
size_t malloc_usable_size(void *p);
size_t malloc_usable_size(void *p) __THROW;
static malloc_usable_size_fun_t malloc_usable_size_f = malloc_usable_size;
#elif defined(HAVE_MALLOC_SIZE)
size_t malloc_size(void *p);
size_t malloc_size(void *p) __THROW;
static malloc_usable_size_fun_t malloc_usable_size_f = malloc_size;
#endif
......
......@@ -176,7 +176,7 @@ static size_t bad_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stre
if (fwrite_count_trigger == fwrite_count || event_count == event_count_trigger) {
error_injected++;
errno = ENOSPC;
r = -1;
r = (size_t) -1;
} else {
r = fwrite(ptr, size, nmemb, stream);
if (r!=nmemb) {
......
......@@ -15,8 +15,8 @@ enum {NUM_DBS=2};
int USE_PUTS=0;
uint32_t num_rows = 1;
uint32_t which_db_to_fail = -1;
uint32_t which_row_to_fail = -1;
uint32_t which_db_to_fail = (uint32_t) -1;
uint32_t which_row_to_fail = (uint32_t) -1;
enum how_to_fail { FAIL_NONE, FAIL_KSIZE, FAIL_VSIZE } how_to_fail = FAIL_NONE;
static int put_multiple_generate(DB *dest_db,
......@@ -198,7 +198,7 @@ int num_rows_set = FALSE;
int test_main(int argc, char * const *argv) {
do_args(argc, argv);
run_test(1, -1, -1, FAIL_NONE);
run_test(1, (uint32_t) -1, (uint32_t) -1, FAIL_NONE);
run_test(1, 0, 0, FAIL_NONE);
run_test(1, 0, 0, FAIL_KSIZE);
run_test(1, 0, 0, FAIL_VSIZE);
......
......@@ -113,7 +113,8 @@ unlock_and_maybe_close_db(struct db_bucket *bucket, ARG arg) {
int r = db->close(db, 0);
CKERR(r);
bucket->is_open = false;
assert(__sync_fetch_and_add(&open_buckets, -1) > 0);
int old_open_buckets = __sync_fetch_and_sub(&open_buckets, 1);
assert(old_open_buckets > 0);
verbose_printf("decided to close a bucket's db before unlocking\n");
}
toku_mutex_unlock(&bucket->mutex);
......
......@@ -33,7 +33,7 @@ test_main (int argc, char *const argv[]) {
DB_ENV *env;
r = db_env_create(&env, 0); assert(r==0);
env->set_errfile(env,0); // Turn off those annoying errors
r = env->open(env, ENVDIR, -1, 0644);
r = env->open(env, ENVDIR, (u_int32_t) -1, 0644);
CKERR2(r, EINVAL);
assert(n_handle_error==0);
r = env->close(env, 0); assert(r==0);
......@@ -62,7 +62,7 @@ test_main (int argc, char *const argv[]) {
env->set_errfile(env, write_here);
if (do_errcall)
env->set_errcall(env, handle_error);
r = env->open(env, ENVDIR, -1, 0644);
r = env->open(env, ENVDIR, (u_int32_t) -1, 0644);
assert(r==EINVAL);
r = env->close(env, 0); assert(r==0);
fclose(write_here);
......
......@@ -130,7 +130,7 @@ toku_txn_id(DB_TXN * txn) {
HANDLE_PANICKED_ENV(txn->mgrp);
toku_ydb_barf();
abort();
return -1;
return (u_int32_t) -1;
}
static u_int64_t
......
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