From 14bfa071688cdf36a8efa8543b0e8e2902fabf2f Mon Sep 17 00:00:00 2001 From: jp9000 Date: Mon, 16 Nov 2015 08:22:55 -0800 Subject: [PATCH] libobs: Fix unsigned expression warning Fixes warning introduced by d7848f3cb74 that pops up in GCC: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] The proper solution was to use the 64bit integer values with the clamp, and then convert to a 32bit unsigned integer. --- libobs/obs-data.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libobs/obs-data.c b/libobs/obs-data.c index 82b8c2fc2..41b33f409 100644 --- a/libobs/obs-data.c +++ b/libobs/obs-data.c @@ -2070,11 +2070,11 @@ static inline bool get_frames_per_second(obs_data_t *data, goto free; } - uint32_t num_uint32 = (uint32_t)obs_data_item_get_int(num); - uint32_t den_uint32 = (uint32_t)obs_data_item_get_int(den); + long long num_ll = obs_data_item_get_int(num); + long long den_ll = obs_data_item_get_int(den); - fps->numerator = CLAMP(num_uint32, 0, UINT32_MAX); - fps->denominator = CLAMP(den_uint32, 0, UINT32_MAX); + fps->numerator = (uint32_t)CLAMP(num_ll, 0, (long long)UINT32_MAX); + fps->denominator = (uint32_t)CLAMP(den_ll, 0, (long long)UINT32_MAX); obs_data_item_release(&num); obs_data_item_release(&den);