date.c: Fix type missmatch warings from msvc

Fix compiler warings from msvc in date.c for value truncation from 64 bit to 32 bit integers. Also switch from int to size_t for all variables with result of strlen() which cannot become negative. Signed-off-by: Sören Krecker <soekkle@freenet.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sören Krecker committed Dec 23, 2024 at 12:04 UTC d11d003ba5e98c036fb94204df6dcef28aafe2f8
1 file changed +3 -3
date.c
+3 -3
@@ -1244,7 +1244,7 @@ static const char *approxidate_alpha(const char *date, struct tm *tm, struct tm
1244 }
1245
1246 for (s = special; s->name; s++) {
1247 - int len = strlen(s->name);
1247 + size_t len = strlen(s->name);
1248 if (match_string(date, s->name) == len) {
1249 s->fn(tm, now, num);
1250 *touched = 1;
@@ -1254,7 +1254,7 @@ static const char *approxidate_alpha(const char *date, struct tm *tm, struct tm
1254
1255 if (!*num) {
1256 for (i = 1; i < 11; i++) {
1257 - int len = strlen(number_name[i]);
1257 + size_t len = strlen(number_name[i]);
1258 if (match_string(date, number_name[i]) == len) {
1259 *num = i;
1260 *touched = 1;
@@ -1270,7 +1270,7 @@ static const char *approxidate_alpha(const char *date, struct tm *tm, struct tm
1270
1271 tl = typelen;
1272 while (tl->type) {
1273 - int len = strlen(tl->type);
1273 + size_t len = strlen(tl->type);
1274 if (match_string(date, tl->type) >= len-1) {
1275 update_tm(tm, now, tl->length * *num);
1276 *num = 0;