2007-05-30 Tor Lillqvist <tml@novell.com>

* parse.c: Fix problem on Win32 where the automagic prefix
	replacement logic didn't work. I don't know what change had 
	broken it.
	(pathnamecmp): New Win32-only function. Compares two file
	paths case insensitively and treating backslashes as equal to
	slashes.
	(parse_line): Use it instead of g_ascii_strcasecmp().
This commit is contained in:
Tollef Fog Heen 2007-05-30 13:24:42 +02:00
parent 9a1becb5d6
commit a5c1a0d417
2 changed files with 34 additions and 2 deletions

View file

@ -1,3 +1,13 @@
2007-05-30 Tor Lillqvist <tml@novell.com>
* parse.c: Fix problem on Win32 where the automagic prefix
replacement logic didn't work. I don't know what change had
broken it.
(pathnamecmp): New Win32-only function. Compares two file
paths case insensitively and treating backslashes as equal to
slashes.
(parse_line): Use it instead of g_ascii_strcasecmp().
2007-05-29 Tollef Fog Heen <tfheen@err.no>
* pkg.m4: Update URL to pkg-config website. Thanks to Peter

26
parse.c
View file

@ -39,6 +39,12 @@ char *prefix_variable = "prefix";
int msvc_syntax = FALSE;
#endif
#ifdef G_OS_WIN32
#ifndef G_IS_DIR_SEPARATOR
#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR || (c) == '/')
#endif
#endif
/**
* Read an entire line from a file into a buffer. Lines may
* be delimited with '\n', '\r', '\n\r', or '\r\n'. The delimiter
@ -890,6 +896,22 @@ parse_url (Package *pkg, const char *str, const char *path)
pkg->url = trim_and_sub (pkg, str, path);
}
#ifdef G_OS_WIN32
static int
pathnamecmp (const char *a,
const char *b)
{
while (*a && *b &&
((G_IS_DIR_SEPARATOR (*a) && G_IS_DIR_SEPARATOR (*b)) ||
g_ascii_toupper (*a) == g_ascii_toupper (*b)))
{
a++;
b++;
}
return g_ascii_toupper (*a) - g_ascii_toupper (*b);
}
#endif
static void
parse_line (Package *pkg, const char *untrimmed, const char *path, gboolean ignore_requires, gboolean ignore_private_libs)
{
@ -992,8 +1014,8 @@ parse_line (Package *pkg, const char *untrimmed, const char *path, gboolean igno
const int lib_pkgconfig_len = strlen (lib_pkgconfig);
if (strlen (prefix) > lib_pkgconfig_len &&
g_ascii_strcasecmp (prefix + prefix_len - lib_pkgconfig_len,
lib_pkgconfig) == 0)
pathnamecmp (prefix + prefix_len - lib_pkgconfig_len,
lib_pkgconfig) == 0)
{
/* It ends in lib\pkgconfig. Good. */