浏览代码

Fix potentially uninitialized variable warnings

jp9000 11 年之前
父节点
当前提交
a27f2fbb3a
共有 3 个文件被更改,包括 7 次插入6 次删除
  1. 4 3
      libobs-opengl/gl-windows.c
  2. 2 2
      libobs/graphics/bounds.c
  3. 1 1
      libobs/obs-source.c

+ 4 - 3
libobs-opengl/gl-windows.c

@@ -502,11 +502,12 @@ void device_load_swapchain(device_t device, swapchain_t swap)
 
 	device->cur_swap = swap;
 
-	if (swap)
+	if (swap) {
 		hdc = swap->wi->hdc;
 
-	if (!wgl_make_current(hdc, device->plat->hrc))
-		blog(LOG_ERROR, "device_load_swapchain (GL) failed");
+		if (!wgl_make_current(hdc, device->plat->hrc))
+			blog(LOG_ERROR, "device_load_swapchain (GL) failed");
+	}
 }
 
 void device_present(device_t device)

+ 2 - 2
libobs/graphics/bounds.c

@@ -86,7 +86,7 @@ void bounds_get_center(struct vec3 *dst, const struct bounds *b)
 void bounds_transform(struct bounds *dst, const struct bounds *b,
 		const struct matrix4 *m)
 {
-	struct bounds temp;
+	struct bounds temp = {0};
 	bool b_init = false;
 	int i;
 
@@ -123,7 +123,7 @@ void bounds_transform(struct bounds *dst, const struct bounds *b,
 void bounds_transform3x4(struct bounds *dst, const struct bounds *b,
 		const struct matrix3 *m)
 {
-	struct bounds temp;
+	struct bounds temp = {0};
 	bool b_init = false;
 	int i;
 

+ 1 - 1
libobs/obs-source.c

@@ -997,7 +997,7 @@ static void obs_source_draw_async_texture(struct obs_source *source)
 	bool        limited_range = yuv && !source->async_full_range;
 	const char  *type         = yuv ? "DrawMatrix" : "Draw";
 	bool        def_draw      = (!effect);
-	technique_t tech;
+	technique_t tech          = NULL;
 
 	if (def_draw) {
 		effect = obs_get_default_effect();