Commit 2f14c4fcb80cddb06de19c7d412ef25395cde67b

Patrick Steinhardt 2019-06-28T14:39:20

w32_stack: convert buffer length param to `size_t` In both `git_win32__stack_format` and `git_win32__stack`, we handle buffer lengths via an integer variable. As we only ever pass buffer sizes to it, this should be a `size_t` though to avoid loss of precision. As we also use it to compare with other `size_t` variables, this also silences signed/unsigned comparison warnings.

diff --git a/src/win32/w32_stack.c b/src/win32/w32_stack.c
index 67a50ef..78c78db 100644
--- a/src/win32/w32_stack.c
+++ b/src/win32/w32_stack.c
@@ -76,7 +76,7 @@ int git_win32__stack_compare(
 }
 
 int git_win32__stack_format(
-	char *pbuf, int buf_len,
+	char *pbuf, size_t buf_len,
 	const git_win32__stack__raw_data *pdata,
 	const char *prefix, const char *suffix)
 {
@@ -171,7 +171,7 @@ int git_win32__stack_format(
 }
 
 int git_win32__stack(
-	char * pbuf, int buf_len,
+	char * pbuf, size_t buf_len,
 	int skip,
 	const char *prefix, const char *suffix)
 {
diff --git a/src/win32/w32_stack.h b/src/win32/w32_stack.h
index 3196981..c2565c2 100644
--- a/src/win32/w32_stack.h
+++ b/src/win32/w32_stack.h
@@ -116,7 +116,7 @@ int git_win32__stack_compare(
  * @param suffix String written after each frame; defaults to "\n".
  */
 int git_win32__stack_format(
-	char *pbuf, int buf_len,
+	char *pbuf, size_t buf_len,
 	const git_win32__stack__raw_data *pdata,
 	const char *prefix, const char *suffix);
 
@@ -132,7 +132,7 @@ int git_win32__stack_format(
  * @param suffix String written after each frame; defaults to "\n".
  */
 int git_win32__stack(
-	char * pbuf, int buf_len,
+	char * pbuf, size_t buf_len,
 	int skip,
 	const char *prefix, const char *suffix);