Commit 80c3867b760a8e07d563ef08d47e47ad0a07bcd3

Edward Thomson 2019-01-20T19:20:12

patch: explicitly cast down in parse_header_percent Quiet down a warning from MSVC about how we're potentially losing data. This is safe since we've explicitly tested that it's within the range of 0-100.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/patch_parse.c b/src/patch_parse.c
index 1bf3ad8..647929f 100644
--- a/src/patch_parse.c
+++ b/src/patch_parse.c
@@ -282,7 +282,7 @@ static int parse_header_percent(uint16_t *out, git_patch_parse_ctx *ctx)
 	if (val < 0 || val > 100)
 		return -1;
 
-	*out = val;
+	*out = (uint16_t)val;
 	return 0;
 }