1
0
Эх сурвалжийг харах

libobs: Fix "possible loss of data" warning

Fixes the following warning of MSVC:

warning C4244: '=' : conversion from '__int64' to 'uint32_t', possible
loss of data
jp9000 10 жил өмнө
parent
commit
d7848f3cb7
1 өөрчлөгдсөн 5 нэмэгдсэн , 4 устгасан
  1. 5 4
      libobs/obs-data.c

+ 5 - 4
libobs/obs-data.c

@@ -2070,10 +2070,11 @@ static inline bool get_frames_per_second(obs_data_t *data,
 		goto free;
 	}
 
-	fps->numerator   =
-		CLAMP(obs_data_item_get_int(num), 0, UINT32_MAX);
-	fps->denominator =
-		CLAMP(obs_data_item_get_int(den), 0, UINT32_MAX);
+	uint32_t num_uint32 = (uint32_t)obs_data_item_get_int(num);
+	uint32_t den_uint32 = (uint32_t)obs_data_item_get_int(den);
+
+	fps->numerator   = CLAMP(num_uint32, 0, UINT32_MAX);
+	fps->denominator = CLAMP(den_uint32, 0, UINT32_MAX);
 
 	obs_data_item_release(&num);
 	obs_data_item_release(&den);