On Windows the path prefix should be checked caseless

feature/tap-sh
Ignacio Casal Quinteiro 2018-09-17 15:20:00 +02:00
parent c9dffb8570
commit 9f17da92d2
1 changed files with 11 additions and 1 deletions

View File

@ -188,6 +188,16 @@ determine_prefix(const pkgconf_pkg_t *pkg, char *buf, size_t buflen)
return buf;
}
static bool
is_path_prefix_equal(const char *path1, const char *path2, size_t path2_len)
{
#ifdef _WIN32
return !_strnicmp(path1, path2, path2_len);
#else
return !strncmp(path1, path2, path2_len);
#endif
}
static bool
pkgconf_pkg_parser_value_set(pkgconf_pkg_t *pkg, const size_t lineno, const char *keyword, char *value)
{
@ -198,7 +208,7 @@ pkgconf_pkg_parser_value_set(pkgconf_pkg_t *pkg, const size_t lineno, const char
* file and rewrite any directory that starts with the same prefix.
*/
if (pkg->owner->flags & PKGCONF_PKG_PKGF_REDEFINE_PREFIX && pkg->orig_prefix
&& !strncmp(value, pkg->orig_prefix->value, strlen(pkg->orig_prefix->value)))
&& is_path_prefix_equal(canonicalized_value, pkg->orig_prefix->value, strlen(pkg->orig_prefix->value)))
{
char newvalue[PKGCONF_ITEM_SIZE];