mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-10-27 00:08:54 -04:00
libobs: Fix unsigned expression warning
Fixes warning introduced by d7848f3cb7 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.
This commit is contained in:
1 parent
717e2b6e66
commit
14bfa07168
1 file changed
+4
-4
+4
-4
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user