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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
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);