Skip to content

Commit

Permalink
Fix MSVC compiler warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
cfis committed May 13, 2020
1 parent b246fd1 commit 0b1b96a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ext/ruby_prof/rp_call_trees.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ VALUE prof_call_trees_callers(VALUE self)
}
}

VALUE result = rb_ary_new_capa(callers->num_entries);
VALUE result = rb_ary_new_capa((long)callers->num_entries);
rb_st_foreach(callers, prof_call_trees_collect_aggregates, result);
rb_st_free_table(callers);
return result;
Expand All @@ -239,7 +239,7 @@ VALUE prof_call_trees_callees(VALUE self)
rb_st_foreach((*call_tree)->children, prof_call_trees_collect_callees, (st_data_t)callees);
}

VALUE result = rb_ary_new_capa(callees->num_entries);
VALUE result = rb_ary_new_capa((long)callees->num_entries);
rb_st_foreach(callees, prof_call_trees_collect_aggregates, result);
rb_st_free_table(callees);
return result;
Expand Down
2 changes: 1 addition & 1 deletion ext/ruby_prof/rp_measure_allocations.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ VALUE total_allocated_objects_key;

static double measure_allocations_via_gc_stats(rb_trace_arg_t* trace_arg)
{
return rb_gc_stat(total_allocated_objects_key);
return (double)rb_gc_stat(total_allocated_objects_key);
}

static double measure_allocations_via_tracing(rb_trace_arg_t* trace_arg)
Expand Down
2 changes: 1 addition & 1 deletion ext/ruby_prof/rp_measure_process_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static double measure_process_time(rb_trace_arg_t* trace_arg)
userTimeInt.LowPart = userTime.dwLowDateTime;
userTimeInt.HighPart = userTime.dwHighDateTime;

return sysTimeInt.QuadPart + userTimeInt.QuadPart;
return (double)(sysTimeInt.QuadPart + userTimeInt.QuadPart);
#elif !defined(CLOCK_PROCESS_CPUTIME_ID)
struct rusage usage;
getrusage(RUSAGE_SELF, &usage);
Expand Down
2 changes: 1 addition & 1 deletion ext/ruby_prof/rp_measure_wall_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static double measure_wall_time(rb_trace_arg_t* trace_arg)
#if defined(_WIN32)
LARGE_INTEGER time;
QueryPerformanceCounter(&time);
return time.QuadPart;
return (double)time.QuadPart;
#elif defined(__APPLE__)
return mach_absolute_time();// * (uint64_t)mach_timebase.numer / (uint64_t)mach_timebase.denom;
#elif defined(__linux__)
Expand Down

0 comments on commit 0b1b96a

Please sign in to comment.