Skip to content

Commit a0184f5

Browse files
NWilsonucko
andcommitted
Improved cast for addressing 64-to-32-bit warnings
Co-authored-by: Aaron M. Ucko <ucko@ncbi.nlm.nih.gov>
1 parent 804b10a commit a0184f5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/pcre2test.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9782,6 +9782,7 @@ if (arg_error != NULL)
97829782
int len;
97839783
int errcode;
97849784
char *endptr;
9785+
long li;
97859786

97869787
/* Ensure the relevant non-8-bit buffer is available. Ensure that it is at
97879788
least 128 code units, because it is used for retrieving error messages. */
@@ -9820,13 +9821,14 @@ least 128 code units, because it is used for retrieving error messages. */
98209821

98219822
for (;;)
98229823
{
9823-
errcode = (int)strtol(arg_error, &endptr, 10);
9824-
if (*endptr != 0 && *endptr != CHAR_COMMA)
9824+
li = strtol(arg_error, &endptr, 10);
9825+
if (S32OVERFLOW(li) || (*endptr != 0 && *endptr != CHAR_COMMA))
98259826
{
98269827
fprintf(stderr, "** \"%s\" is not a valid error number list\n", arg_error);
98279828
yield = 1;
98289829
goto EXIT;
98299830
}
9831+
errcode = (int)li;
98309832
printf("Error %d: ", errcode);
98319833
PCRE2_GET_ERROR_MESSAGE(len, errcode, pbuffer);
98329834
if (len < 0)

0 commit comments

Comments
 (0)