glib r7561 - trunk/gio



Author: tml
Date: Tue Sep 30 10:47:06 2008
New Revision: 7561
URL: http://svn.gnome.org/viewvc/glib?rev=7561&view=rev

Log:
2008-09-30  Tor Lillqvist  <tml novell com>

	* glocalfile.c (get_volume_for_path) [Win32]: Avoid a
	g_critical(). Pass a large enough result buffer to
	GetVolumePathNameW(). Just use MAX_PATH.



Modified:
   trunk/gio/ChangeLog
   trunk/gio/glocalfile.c

Modified: trunk/gio/glocalfile.c
==============================================================================
--- trunk/gio/glocalfile.c	(original)
+++ trunk/gio/glocalfile.c	Tue Sep 30 10:47:06 2008
@@ -844,10 +844,10 @@
   wchar_t *wpath;
   wchar_t *result;
 
-  wpath = g_utf8_to_utf16 (path, -1, NULL, &len, NULL);
-  result = g_new (wchar_t, len + 2);
+  wpath = g_utf8_to_utf16 (path, -1, NULL, NULL, NULL);
+  result = g_new (wchar_t, MAX_PATH);
 
-  if (!GetVolumePathNameW (wpath, result, len + 2))
+  if (!GetVolumePathNameW (wpath, result, MAX_PATH))
     {
       char *msg = g_win32_error_message (GetLastError ());
       g_critical ("GetVolumePathName failed: %s", msg);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]