Browse Source

libobs/graphics: Fix printf format warning

Added cast to unsigned and the assert because microsoft's compiler
doesn't support "%zu"

Actual warning:
libobs/graphics/effect-parser.c:1387:4: warning: format specifies type
'unsigned int' but the argument has type 'size_t' (aka 'unsigned long')
[-Wformat]
Palana 10 years ago
parent
commit
4a22f314d6
1 changed files with 3 additions and 1 deletions
  1. 3 1
      libobs/graphics/effect-parser.c

+ 3 - 1
libobs/graphics/effect-parser.c

@@ -16,6 +16,7 @@
 ******************************************************************************/
 
 #include <assert.h>
+#include <limits.h>
 #include "../util/platform.h"
 #include "effect-parser.h"
 #include "effect.h"
@@ -1383,8 +1384,9 @@ static inline bool ep_compile_pass_shader(struct effect_parser *ep,
 	/*else if (type == SHADER_GEOMETRY)
 		dstr_cat(&location, " (Geometry ");*/
 
+	assert(pass_idx <= UINT_MAX);
 	dstr_catf(&location, "shader, technique %s, pass %u)", tech->name,
-			pass_idx);
+			(unsigned)pass_idx);
 
 	if (type == GS_SHADER_VERTEX) {
 		ep_makeshaderstring(ep, &shader_str,