[glib] [Win32] Avoid superfluous '/' from g_file_resolve_relative_path()
- From: Tor Lillqvist <tml src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glib] [Win32] Avoid superfluous '/' from g_file_resolve_relative_path()
- Date: Fri, 14 Aug 2009 20:24:18 +0000 (UTC)
commit 406c3aa019a6ce51534f170fd5b82108382a4c6f
Author: Shixin Zeng <zeng shixin gmail com>
Date: Fri Aug 14 23:21:12 2009 +0300
[Win32] Avoid superfluous '/' from g_file_resolve_relative_path()
Patch from bug #591532.
gio/win32/gwinhttpfile.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/gio/win32/gwinhttpfile.c b/gio/win32/gwinhttpfile.c
index 7e72b9f..f47076d 100644
--- a/gio/win32/gwinhttpfile.c
+++ b/gio/win32/gwinhttpfile.c
@@ -375,9 +375,19 @@ g_winhttp_file_resolve_relative_path (GFile *file,
if (*wnew_path != '/')
{
- wchar_t *tmp = g_new (wchar_t, wcslen (winhttp_file->url.lpszUrlPath) + 1 + wcslen (wnew_path) + 1);
- wcscpy (tmp, winhttp_file->url.lpszUrlPath);
- wcscat (tmp, L"/");
+ wchar_t *tmp = NULL;
+ int trailing_slash = winhttp_file->url.lpszUrlPath[winhttp_file->url.dwUrlPathLength-1] == L'/'? 1 : 0;
+ if (trailing_slash)
+ {
+ tmp = g_new (wchar_t, wcslen (winhttp_file->url.lpszUrlPath) + wcslen (wnew_path) + 1);
+ wcscpy (tmp, winhttp_file->url.lpszUrlPath);
+ }
+ else
+ {
+ tmp = g_new (wchar_t, wcslen (winhttp_file->url.lpszUrlPath) + 1 + wcslen (wnew_path) + 1);
+ wcscpy (tmp, winhttp_file->url.lpszUrlPath);
+ wcscat (tmp, L"/");
+ }
wcscat (tmp, wnew_path);
g_free (wnew_path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]