Skip to content

Commit 10f4ff1

Browse files
authored
Use explicit casts (#131)
This fixes the following warnings in Visual Studio when built with /W4: editorconfig\src\lib\ec_glob.c(133,24): warning C5292: 'function': 'PCRE2_SPTR8' to 'char [31]' differs in indirection: one is the unique plain 'char' type and the other is not editorconfig\src\lib\ec_glob.c(282,42): warning C5292: 'function': 'PCRE2_SPTR8' to 'char *' differs in indirection: one is the unique plain 'char' type and the other is not editorconfig\src\lib\ec_glob.c(356,24): warning C5292: 'function': 'PCRE2_SPTR8' to 'char [8194]' differs in indirection: one is the unique plain 'char' type and the other is not editorconfig\src\lib\ec_glob.c(365,26): warning C5292: 'function': 'PCRE2_SPTR8' to 'const char *' differs in indirection: one is the unique plain 'char' type and the other is not Signed-off-by: Sven Strickroth <[email protected]>
1 parent 861eda2 commit 10f4ff1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lib/ec_glob.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ int ec_glob(const char *pattern, const char *string)
130130
}
131131

132132
/* used to search for {num1..num2} case */
133-
re = pcre2_compile("^\\{[\\+\\-]?\\d+\\.\\.[\\+\\-]?\\d+\\}$", PCRE2_ZERO_TERMINATED, 0,
133+
re = pcre2_compile_8((PCRE2_SPTR8)"^\\{[\\+\\-]?\\d+\\.\\.[\\+\\-]?\\d+\\}$", PCRE2_ZERO_TERMINATED, 0,
134134
&error_code, &erroffset, NULL);
135135
if (!re) /* failed to compile */
136136
return -1;
@@ -279,7 +279,7 @@ int ec_glob(const char *pattern, const char *string)
279279
pcre2_match_data * match_data = pcre2_match_data_create_from_pattern(re, NULL);
280280

281281
/* Check the case of {num1..num2} */
282-
rc = pcre2_match(re, c, cc - c + 1, 0, 0, match_data, NULL);
282+
rc = pcre2_match(re, (PCRE2_SPTR8)c, cc - c + 1, 0, 0, match_data, NULL);
283283

284284
pcre2_match_data_free(match_data);
285285

@@ -353,7 +353,7 @@ int ec_glob(const char *pattern, const char *string)
353353

354354
pcre2_code_free(re); /* ^\\d+\\.\\.\\d+$ */
355355

356-
re = pcre2_compile(pcre_str, PCRE2_ZERO_TERMINATED, 0, &error_code, &erroffset, NULL);
356+
re = pcre2_compile((PCRE2_SPTR8)pcre_str, PCRE2_ZERO_TERMINATED, 0, &error_code, &erroffset, NULL);
357357

358358
if (!re) /* failed to compile */
359359
{
@@ -362,7 +362,7 @@ int ec_glob(const char *pattern, const char *string)
362362
}
363363

364364
pcre_match_data = pcre2_match_data_create_from_pattern(re, NULL);
365-
rc = pcre2_match(re, string, strlen(string), 0, 0, pcre_match_data, NULL);
365+
rc = pcre2_match(re, (PCRE2_SPTR8)string, strlen(string), 0, 0, pcre_match_data, NULL);
366366

367367
if (rc < 0) /* failed to match */
368368
{

0 commit comments

Comments
 (0)