diff options
author | Tollef Fog Heen <tfheen@err.no> | 2007-05-30 13:24:42 +0200 |
---|---|---|
committer | Tollef Fog Heen <tfheen@err.no> | 2007-05-30 13:24:42 +0200 |
commit | a5c1a0d417632f4f62af8a2f3151bc475fcb8345 (patch) | |
tree | 8c7232f8785c2e83ee6fe97239846aecfae487f1 /parse.c | |
parent | 9a1becb5d6fa1f65356659a3506c099567493a75 (diff) |
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().
Diffstat (limited to 'parse.c')
-rw-r--r-- | parse.c | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -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. */ |