-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathglib-2.46.x.patch
791 lines (688 loc) · 21.2 KB
/
glib-2.46.x.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
--- gio/gapplication.c Sat Nov 07 01:12:04 2015
+++ gio/gapplication.c Thu Dec 24 12:44:12 2015
@@ -2256,7 +2256,34 @@
g_return_val_if_fail (!application->priv->must_quit_now, 1);
#ifdef G_OS_WIN32
- arguments = g_win32_get_command_line ();
+ {
+ gint new_argc = 0;
+
+ arguments = g_win32_get_command_line ();
+
+ /*
+ * CommandLineToArgvW(), which is called by g_win32_get_command_line(),
+ * pulls in the whole command line that is used to call the program. This is
+ * fine in cases where the program is a .exe program, but in the cases where the
+ * program is a called via a script, such as PyGObject's gtk-demo.py, which is normally
+ * called using 'python gtk-demo.py' on Windows, the program name (argv[0])
+ * returned by g_win32_get_command_line() will not be the argv[0] that ->local_command_line()
+ * would expect, causing the program to fail with "This application can not open files."
+ */
+ new_argc = g_strv_length (arguments);
+
+ if (new_argc > argc)
+ {
+ gint i;
+
+ for (i = 0; i < new_argc - argc; i++)
+ g_free (arguments[i]);
+
+ memmove (&arguments[0],
+ &arguments[new_argc - argc],
+ sizeof (arguments[0]) * (argc + 1));
+ }
+ }
#else
{
gint i;
--- gio/gdbusaddress.c Sat Nov 07 01:12:04 2015
+++ gio/gdbusaddress.c Tue Oct 04 02:45:56 2016
@@ -1355,6 +1355,25 @@
g_main_loop_quit (loop);
}
+/* Satisfies STARTF_FORCEONFEEDBACK */
+static void
+turn_off_the_starting_cursor (void)
+{
+ MSG msg;
+ BOOL bRet;
+
+ PostQuitMessage (0);
+
+ while ((bRet = GetMessage (&msg, 0, 0, 0)) != 0)
+ {
+ if (bRet == -1)
+ continue;
+
+ TranslateMessage (&msg);
+ DispatchMessage (&msg);
+ }
+}
+
__declspec(dllexport) void CALLBACK g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow);
__declspec(dllexport) void CALLBACK
@@ -1365,6 +1384,8 @@
const char *address;
GError *error = NULL;
+ turn_off_the_starting_cursor ();
+
if (g_getenv ("GDBUS_DAEMON_DEBUG") != NULL)
open_console_window ();
@@ -1418,7 +1439,13 @@
wchar_t gio_path_short[MAX_PATH];
wchar_t rundll_path[MAX_PATH*2];
wchar_t args[MAX_PATH*4];
-
+ wchar_t root[MAX_PATH];
+ wchar_t root_short[MAX_PATH];
+ wchar_t drive[_MAX_DRIVE];
+ wchar_t dir[_MAX_DIR];
+ _wsplitpath(gio_path, drive, dir, NULL, NULL);
+ _wmakepath(root, drive, dir, NULL, NULL);
+ GetShortPathNameW (root, root_short, MAX_PATH);
GetShortPathNameW (gio_path, gio_path_short, MAX_PATH);
GetWindowsDirectoryW (rundll_path, MAX_PATH);
@@ -1444,7 +1471,7 @@
res = CreateProcessW (rundll_path, args,
0, 0, FALSE,
NORMAL_PRIORITY_CLASS | CREATE_NO_WINDOW | DETACHED_PROCESS,
- 0, NULL /* TODO: Should be root */,
+ 0, root_short /* Changed to glib directory */,
&si, &pi);
if (res)
address = read_shm (DBUS_DAEMON_ADDRESS_INFO);
--- glib/gconvert.c Sat Feb 07 22:32:45 2015
+++ glib/gconvert.c Sat Nov 07 22:33:53 2015
@@ -1157,7 +1157,7 @@
"UTF-8", charset, bytes_read, bytes_written, error);
}
-#if defined (G_OS_WIN32) && !defined (_WIN64)
+#ifdef G_OS_WIN32
#undef g_filename_to_utf8
@@ -1228,7 +1228,7 @@
charset, "UTF-8", bytes_read, bytes_written, error);
}
-#if defined (G_OS_WIN32) && !defined (_WIN64)
+#ifdef G_OS_WIN32
#undef g_filename_from_utf8
@@ -1663,7 +1663,7 @@
return result;
}
-#if defined (G_OS_WIN32) && !defined (_WIN64)
+#ifdef G_OS_WIN32
#undef g_filename_from_uri
@@ -1738,7 +1738,7 @@
return escaped_uri;
}
-#if defined (G_OS_WIN32) && !defined (_WIN64)
+#ifdef G_OS_WIN32
#undef g_filename_to_uri
--- glib/gdir.c Wed Dec 03 14:03:32 2014
+++ glib/gdir.c Sat Nov 07 22:33:53 2015
@@ -159,7 +159,7 @@
return dir;
}
-#if defined (G_OS_WIN32) && !defined (_WIN64)
+#ifdef G_OS_WIN32
/* The above function actually is called g_dir_open_utf8, and it's
* that what applications compiled with this GLib version will
@@ -293,7 +293,7 @@
#endif
}
-#if defined (G_OS_WIN32) && !defined (_WIN64)
+#ifdef G_OS_WIN32
/* Ditto for g_dir_read_name */
--- glib/genviron.c Wed Oct 14 18:41:16 2015
+++ glib/genviron.c Sat Nov 07 22:33:53 2015
@@ -632,7 +632,6 @@
}
/* Win32 binary compatibility versions {{{1 */
-#ifndef _WIN64
#undef g_getenv
@@ -682,8 +681,6 @@
g_free (utf8_variable);
}
-
-#endif /* _WIN64 */
#endif /* G_OS_WIN32 */
--- glib/gfileutils.c Wed Oct 14 18:39:37 2015
+++ glib/gfileutils.c Sat Nov 07 22:33:53 2015
@@ -2504,7 +2504,7 @@
/* NOTE : Keep this part last to ensure nothing in this file uses thn
* below binary compatibility versions.
*/
-#if defined (G_OS_WIN32) && !defined (_WIN64)
+#ifdef G_OS_WIN32
/* Binary compatibility versions. Will be called by code compiled
* against quite old (pre-2.8, I think) headers only, not from more
--- glib/giowin32.c Fri Nov 06 03:49:18 2015
+++ glib/giowin32.c Sat Nov 07 22:33:53 2015
@@ -1746,7 +1746,6 @@
return channel;
}
-#if !defined (_WIN64)
#undef g_io_channel_new_file
@@ -1770,7 +1769,6 @@
return retval;
}
-#endif
static GIOStatus
g_io_win32_unimpl_set_flags (GIOChannel *channel,
--- glib/grand.c Tue Mar 24 01:45:34 2015
+++ glib/grand.c Sat Nov 07 22:33:53 2015
@@ -263,7 +263,7 @@
}
#else /* G_OS_WIN32 */
/* rand_s() is only available since Visual Studio 2005 */
-#if defined(_MSC_VER) && _MSC_VER >= 1400
+#if (defined(_MSC_VER) && _MSC_VER >= 1400) || (defined (__MINGW64_VERSION_MAJOR) && __MSVCRT_VERSION__>= 0x0800)
gint i;
for (i = 0; i < G_N_ELEMENTS (seed); i++)
--- glib/gspawn-win32-helper.c Wed Oct 14 18:41:16 2015
+++ glib/gspawn-win32-helper.c Tue Oct 04 03:59:05 2016
@@ -33,7 +33,7 @@
* Please see http://msdn.microsoft.com/zh-tw/library/ks2530z6%28v=vs.80%29.aspx
* for an explanation on this.
*/
-#if (defined (_MSC_VER) && _MSC_VER >= 1400)
+#if (defined (_MSC_VER) && _MSC_VER >= 1400) || (defined (__MINGW64_VERSION_MAJOR) && __MSVCRT_VERSION__>= 0x0800)
#include <crtdbg.h>
#endif
@@ -67,6 +67,20 @@
* but a WinMain().
*/
+/* Info peeked from mingw runtime's source code. __wgetmainargs() is a
+ * function to get the program's argv in wide char format.
+ */
+
+typedef struct {
+ int newmode;
+} _startupinfo;
+
+extern void __wgetmainargs(int *argc,
+ wchar_t ***wargv,
+ wchar_t ***wenviron,
+ int expand_wildcards,
+ _startupinfo *startupinfo);
+
/* Copy of protect_argv that handles wchar_t strings */
static gint
@@ -146,7 +160,7 @@
return argc;
}
-#if (defined (_MSC_VER) && _MSC_VER >= 1400)
+#if (defined (_MSC_VER) && _MSC_VER >= 1400) || (defined (__MINGW64_VERSION_MAJOR) && __MSVCRT_VERSION__>= 0x0800)
/*
* This is the (empty) invalid parameter handler
* that is used for Visual C++ 2005 (and later) builds
@@ -167,6 +181,13 @@
const wchar_t * file,
unsigned int line,
uintptr_t pReserved
+);
+void myInvalidParameterHandler(
+ const wchar_t * expression,
+ const wchar_t * function,
+ const wchar_t * file,
+ unsigned int line,
+ uintptr_t pReserved
)
{
return;
@@ -174,6 +195,16 @@
#endif
+static int
+get_file_descriptor (const gchar *arg,
+ gboolean is_handle)
+{
+ if (is_handle)
+ return _open_osfhandle (atoi (arg), 0);
+ else
+ return atoi (arg);
+}
+
#ifndef HELPER_CONSOLE
int _stdcall
WinMain (struct HINSTANCE__ *hInstance,
@@ -197,10 +228,12 @@
wchar_t **new_wargv;
int argc;
char **argv;
- wchar_t **wargv;
+ wchar_t **wargv, **wenvp;
+ gboolean handles_in_argv;
+ _startupinfo si = { 0 };
char c;
-#if (defined (_MSC_VER) && _MSC_VER >= 1400)
+#if (defined (_MSC_VER) && _MSC_VER >= 1400) || (defined (__MINGW64_VERSION_MAJOR) && __MSVCRT_VERSION__>= 0x0800)
/* set up our empty invalid parameter handler */
_invalid_parameter_handler oldHandler, newHandler;
newHandler = myInvalidParameterHandler;
@@ -211,7 +244,11 @@
#endif
/* Fetch the wide-char argument vector */
+ #ifndef _WIN64
+ __wgetmainargs (&argc, &wargv, &wenvp, 0, &si);
+ #else
wargv = CommandLineToArgvW (GetCommandLineW(), &argc);
+ #endif
g_assert (argc >= ARG_COUNT);
@@ -221,10 +258,17 @@
argv[i] = g_utf16_to_utf8(wargv[i], -1, NULL, NULL, NULL);
argv[i] = NULL;
- /* argv[ARG_CHILD_ERR_REPORT] is the file descriptor number onto
+ /* argv[ARG_HANDLES_IN_ARGV] is "y" or "n" telling whether
+ * file handle arguments contain HANDLE's or file descriptors.
+ */
+ handles_in_argv = __argv[ARG_HANDLES_IN_ARGV][0] == 'y';
+
+ /* argv[ARG_CHILD_ERR_REPORT] is the pipe handle onto
* which write error messages.
*/
- child_err_report_fd = atoi (argv[ARG_CHILD_ERR_REPORT]);
+ child_err_report_fd = get_file_descriptor (__argv[ARG_CHILD_ERR_REPORT], handles_in_argv);
+ if (child_err_report_fd < 0)
+ g_error ("child_err_report_fd not set");
/* Hack to implement G_SPAWN_FILE_AND_ARGV_ZERO. If
* argv[ARG_CHILD_ERR_REPORT] is suffixed with a '#' it means we get
@@ -241,7 +285,7 @@
*/
helper_sync_fd = atoi (argv[ARG_HELPER_SYNC]);
- /* argv[ARG_STDIN..ARG_STDERR] are the file descriptor numbers that
+ /* argv[ARG_STDIN..ARG_STDERR] are the pipe handles that
* should be dup2'd to 0, 1 and 2. '-' if the corresponding fd
* should be left alone, and 'z' if it should be connected to the
* bit bucket NUL:.
@@ -259,7 +303,9 @@
}
else
{
- fd = atoi (argv[ARG_STDIN]);
+ fd = get_file_descriptor (__argv[ARG_STDIN], handles_in_argv);
+ if (fd < 0)
+ g_error ("could not open stdin pipe");
if (fd != 0)
{
dup2 (fd, 0);
@@ -280,7 +326,9 @@
}
else
{
- fd = atoi (argv[ARG_STDOUT]);
+ fd = get_file_descriptor (__argv[ARG_STDOUT], handles_in_argv);
+ if (fd < 0)
+ g_error ("could not open stdout pipe");
if (fd != 1)
{
dup2 (fd, 1);
@@ -301,7 +349,9 @@
}
else
{
- fd = atoi (argv[ARG_STDERR]);
+ fd = get_file_descriptor (__argv[ARG_STDERR], handles_in_argv);
+ if (fd < 0)
+ g_error ("could not open stderr pipe");
if (fd != 2)
{
dup2 (fd, 2);
--- glib/gspawn-win32.c Sun Mar 01 08:50:05 2015
+++ glib/gspawn-win32.c Sat Nov 07 22:33:53 2015
@@ -91,7 +91,8 @@
};
enum {
- ARG_CHILD_ERR_REPORT = 1,
+ ARG_HANDLES_IN_ARGV = 1,
+ ARG_CHILD_ERR_REPORT,
ARG_HELPER_SYNC,
ARG_STDIN,
ARG_STDOUT,
@@ -353,7 +354,11 @@
}
if (bytes < sizeof(gintptr)*2)
+ {
+ g_set_error (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED,
+ _("Failed to read from child pipe"));
return FALSE;
+ }
return TRUE;
}
@@ -514,6 +519,77 @@
return TRUE;
}
+static int
+spawn_with_hidden_console (wchar_t **wargv,
+ wchar_t **wenvp,
+ GError **error)
+{
+ GArray *cmd_line;
+ STARTUPINFOW sinfo;
+ PROCESS_INFORMATION pinfo;
+ wchar_t **p;
+ wchar_t *env_string = NULL;
+ int rc = -1;
+ guint flags;
+
+ cmd_line = g_array_new (FALSE, FALSE, sizeof (wchar_t));
+ for (p = wargv; *p; p++)
+ {
+ if (p > wargv)
+ g_array_append_vals (cmd_line, L" ", 1);
+ g_array_append_vals (cmd_line, *p, wcslen (*p));
+ }
+ g_array_append_vals (cmd_line, L"", 1);
+
+ memset (&sinfo, 0, sizeof sinfo);
+ sinfo.cb = sizeof (STARTUPINFO);
+ sinfo.dwFlags = STARTF_USESHOWWINDOW;
+ sinfo.wShowWindow = SW_HIDE;
+ flags = CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP;
+
+ if (wenvp)
+ {
+ GArray *tmp;
+
+ flags |= CREATE_UNICODE_ENVIRONMENT;
+
+ /* format is "var=value\0var=value\0\0" */
+ tmp = g_array_new (FALSE, FALSE, sizeof (wchar_t));
+ for (p = wenvp; p && *p; p++)
+ g_array_append_vals (tmp, *p, wcslen (*p) + 1);
+ g_array_append_vals (tmp, L"", 1);
+ env_string = (wchar_t*) g_array_free (tmp, FALSE);
+ }
+
+ if (CreateProcessW (NULL, (wchar_t*) cmd_line->data, NULL, NULL, TRUE,
+ flags, env_string, NULL, &sinfo, &pinfo))
+ {
+ rc = (int) pinfo.hProcess;
+ CloseHandle (pinfo.hThread);
+ }
+ else
+ {
+ g_set_error (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED,
+ _("Failed to execute helper program (%s)"),
+ g_win32_error_message (GetLastError ()));
+ }
+
+ g_free (env_string);
+ g_array_free (cmd_line, TRUE);
+ return rc;
+}
+
+static void
+sprintf_file_descriptor (gchar *dest,
+ gint fd,
+ gboolean print_handle)
+{
+ if (print_handle)
+ _g_sprintf (dest, "%ld", _get_osfhandle (fd));
+ else
+ _g_sprintf (dest, "%d", fd);
+}
+
static gboolean
do_spawn_with_pipes (gint *exit_status,
gboolean do_return_handle,
@@ -549,6 +625,8 @@
CONSOLE_CURSOR_INFO cursor_info;
wchar_t *whelper, **wargv, **wenvp;
gchar *glib_dll_directory;
+ gboolean error_set = FALSE;
+ gboolean handles_in_argv = FALSE;
if (child_setup && !warned_about_child_setup)
{
@@ -559,6 +637,7 @@
argc = protect_argv (argv, &protected_argv);
if (!standard_input && !standard_output && !standard_error &&
+ !(flags & G_SPAWN_WIN32_HIDDEN_CONSOLE) &&
(flags & G_SPAWN_CHILD_INHERITS_STDIN) &&
!(flags & G_SPAWN_STDOUT_TO_DEV_NULL) &&
!(flags & G_SPAWN_STDERR_TO_DEV_NULL) &&
@@ -590,7 +669,7 @@
goto cleanup_and_fail;
new_argv = g_new (char *, argc + 1 + ARG_COUNT);
- if (GetConsoleWindow () != NULL)
+ if ((flags & G_SPAWN_WIN32_HIDDEN_CONSOLE) || GetConsoleWindow () != NULL)
helper_process = HELPER_PROCESS "-console.exe";
else
helper_process = HELPER_PROCESS ".exe";
@@ -606,7 +685,14 @@
new_argv[0] = protect_argv_string (helper_process);
- _g_sprintf (args[ARG_CHILD_ERR_REPORT], "%d", child_err_report_pipe[1]);
+ if (flags & G_SPAWN_WIN32_HIDDEN_CONSOLE)
+ handles_in_argv = TRUE;
+
+ strcpy (args[ARG_HANDLES_IN_ARGV], handles_in_argv ? "y" : "n");
+ new_argv[ARG_HANDLES_IN_ARGV] = args[ARG_HANDLES_IN_ARGV];
+
+ sprintf_file_descriptor (args[ARG_CHILD_ERR_REPORT],
+ child_err_report_pipe[1], handles_in_argv);
new_argv[ARG_CHILD_ERR_REPORT] = args[ARG_CHILD_ERR_REPORT];
/* Make the read end of the child error report pipe
@@ -637,7 +723,7 @@
if (standard_input)
{
- _g_sprintf (args[ARG_STDIN], "%d", stdin_pipe[0]);
+ sprintf_file_descriptor (args[ARG_STDIN], stdin_pipe[0], handles_in_argv);
new_argv[ARG_STDIN] = args[ARG_STDIN];
}
else if (flags & G_SPAWN_CHILD_INHERITS_STDIN)
@@ -653,7 +739,7 @@
if (standard_output)
{
- _g_sprintf (args[ARG_STDOUT], "%d", stdout_pipe[1]);
+ sprintf_file_descriptor (args[ARG_STDOUT], stdout_pipe[1], handles_in_argv);
new_argv[ARG_STDOUT] = args[ARG_STDOUT];
}
else if (flags & G_SPAWN_STDOUT_TO_DEV_NULL)
@@ -667,7 +753,7 @@
if (standard_error)
{
- _g_sprintf (args[ARG_STDERR], "%d", stderr_pipe[1]);
+ sprintf_file_descriptor (args[ARG_STDERR], stderr_pipe[1], handles_in_argv);
new_argv[ARG_STDERR] = args[ARG_STDERR];
}
else if (flags & G_SPAWN_STDERR_TO_DEV_NULL)
@@ -750,7 +836,13 @@
whelper = g_utf8_to_utf16 (helper_process, -1, NULL, NULL, NULL);
g_free (helper_process);
- if (wenvp != NULL)
+ if (flags & G_SPAWN_WIN32_HIDDEN_CONSOLE)
+ {
+ rc = spawn_with_hidden_console (wargv, wenvp, error);
+ if (rc == -1)
+ error_set = TRUE;
+ }
+ else if (wenvp != NULL)
rc = _wspawnvpe (P_NOWAIT, whelper, (const wchar_t **) wargv, (const wchar_t **) wenvp);
else
rc = _wspawnvp (P_NOWAIT, whelper, (const wchar_t **) wargv);
@@ -777,8 +869,9 @@
g_free (new_argv);
/* Check if gspawn-win32-helper couldn't be run */
- if (rc == -1 && saved_errno != 0)
+ if (rc == -1 && (saved_errno != 0 || error_set))
{
+ if (!error_set)
g_set_error (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED,
_("Failed to execute helper program (%s)"),
g_strerror (saved_errno));
@@ -1240,8 +1333,6 @@
return ret;
}
-#if !defined (_WIN64)
-
/* Binary compatibility versions that take system codepage pathnames,
* argument vectors and environments. These get used only by code
* built against 2.8.1 or earlier. Code built against 2.8.2 or later
@@ -1507,6 +1598,5 @@
return retval;
}
-#endif /* !_WIN64 */
#endif /* !GSPAWN_HELPER */
--- glib/gspawn.h Wed Oct 14 18:39:37 2015
+++ glib/gspawn.h Sat Nov 07 22:33:53 2015
@@ -182,7 +182,8 @@
G_SPAWN_CHILD_INHERITS_STDIN = 1 << 5,
G_SPAWN_FILE_AND_ARGV_ZERO = 1 << 6,
G_SPAWN_SEARCH_PATH_FROM_ENVP = 1 << 7,
- G_SPAWN_CLOEXEC_PIPES = 1 << 8
+ G_SPAWN_CLOEXEC_PIPES = 1 << 8,
+ G_SPAWN_WIN32_HIDDEN_CONSOLE = 1 << 9
} GSpawnFlags;
GLIB_AVAILABLE_IN_ALL
--- glib/gstdio.c Wed Oct 14 18:39:37 2015
+++ glib/gstdio.c Sat Nov 07 22:38:06 2015
@@ -49,7 +49,7 @@
#error Please port this to your operating system
#endif
-#if defined (_MSC_VER) && !defined(_WIN64)
+#if defined (_MSC_VER) && !defined(_WIN64) && defined(_USE_32BIT_TIME_T)
#undef _wstat
#define _wstat _wstat32
#endif
--- glib/gstdio.h Wed Oct 14 18:41:16 2015
+++ glib/gstdio.h Sat Nov 07 22:39:42 2015
@@ -26,7 +26,7 @@
G_BEGIN_DECLS
-#if (defined (__MINGW64_VERSION_MAJOR) || defined (_MSC_VER)) && !defined(_WIN64)
+#if (defined (__MINGW64_VERSION_MAJOR) || defined (_MSC_VER)) && !defined(_WIN64) && defined(_USE_32BIT_TIME_T)
/* Make it clear that we mean the struct with 32-bit st_size and
* 32-bit st_*time fields as that is how the 32-bit GLib DLL normally
--- glib/gutils.c Sat Nov 07 01:12:04 2015
+++ glib/gutils.c Sat Nov 07 22:33:53 2015
@@ -2291,7 +2291,7 @@
}
}
-#if defined (G_OS_WIN32) && !defined (_WIN64)
+#ifdef G_OS_WIN32
/* Binary compatibility versions. Not for newly compiled code. */
--- glib/gwin32.c Fri Nov 06 03:49:18 2015
+++ glib/gwin32.c Tue Oct 04 02:49:58 2016
@@ -189,7 +189,7 @@
{
gchar *retval;
wchar_t *msg = NULL;
- int nchars;
+ size_t nchars;
FormatMessageW (FORMAT_MESSAGE_ALLOCATE_BUFFER
|FORMAT_MESSAGE_IGNORE_INSERTS
@@ -200,8 +200,8 @@
{
nchars = wcslen (msg);
- if (nchars > 2 && msg[nchars-1] == '\n' && msg[nchars-2] == '\r')
- msg[nchars-2] = '\0';
+ if (nchars >= 2 && msg[nchars-1] == L'\n' && msg[nchars-2] == L'\r')
+ msg[nchars-2] = L'\0';
retval = g_utf16_to_utf8 (msg, -1, NULL, NULL, NULL);
@@ -252,44 +252,24 @@
gchar *
g_win32_get_package_installation_directory_of_module (gpointer hmodule)
{
- gchar *filename;
gchar *retval;
gchar *p;
wchar_t wc_fn[MAX_PATH];
- /* NOTE: it relies that GetModuleFileNameW returns only canonical paths */
if (!GetModuleFileNameW (hmodule, wc_fn, MAX_PATH))
return NULL;
- filename = g_utf16_to_utf8 (wc_fn, -1, NULL, NULL, NULL);
+ retval = g_utf16_to_utf8 (wc_fn, -1, NULL, NULL, NULL);
- if ((p = strrchr (filename, G_DIR_SEPARATOR)) != NULL)
+ if ((p = strrchr (retval, G_DIR_SEPARATOR)) != NULL)
*p = '\0';
- retval = g_strdup (filename);
-
- do
- {
p = strrchr (retval, G_DIR_SEPARATOR);
- if (p == NULL)
- break;
+ if (p && (g_ascii_strcasecmp (p + 1, "bin") == 0 ||
+ g_ascii_strcasecmp (p + 1, "lib") == 0))
*p = '\0';
- if (g_ascii_strcasecmp (p + 1, "bin") == 0 ||
- g_ascii_strcasecmp (p + 1, "lib") == 0)
- break;
- }
- while (p != NULL);
-
- if (p == NULL)
- {
- g_free (retval);
- retval = filename;
- }
- else
- g_free (filename);
-
#ifdef G_WITH_CYGWIN
/* In Cygwin we need to have POSIX paths */
{
@@ -427,8 +407,9 @@
return result;
}
-#if !defined (_WIN64)
+#ifdef G_OS_WIN32
+#undef g_win32_get_package_installation_directory
/* DLL ABI binary compatibility version that uses system codepage file names */
gchar *
@@ -506,7 +487,9 @@
return dirname;
}
-#if !defined (_WIN64)
+#ifdef G_OS_WIN32
+
+#undef g_win32_get_package_installation_subdirectory
/* DLL ABI binary compatibility version that uses system codepage file names */
--- glib/gwin32.h Wed Oct 14 18:39:37 2015
+++ glib/gwin32.h Sat Nov 07 22:33:53 2015
@@ -84,7 +84,6 @@
GLIB_AVAILABLE_IN_ALL
gchar* g_win32_error_message (gint error);
-#ifndef _WIN64
GLIB_DEPRECATED
gchar* g_win32_get_package_installation_directory (const gchar *package,
const gchar *dll_name);
@@ -93,7 +92,6 @@
gchar* g_win32_get_package_installation_subdirectory (const gchar *package,
const gchar *dll_name,
const gchar *subdir);
-#endif
GLIB_AVAILABLE_IN_ALL
gchar* g_win32_get_package_installation_directory_of_module (gpointer hmodule);
@@ -113,10 +111,9 @@
#ifndef __GTK_DOC_IGNORE__
#ifdef G_OS_WIN32
-#ifdef _WIN64
+
#define g_win32_get_package_installation_directory g_win32_get_package_installation_directory_utf8
#define g_win32_get_package_installation_subdirectory g_win32_get_package_installation_subdirectory_utf8
-#endif
GLIB_AVAILABLE_IN_ALL
gchar *g_win32_get_package_installation_directory_utf8 (const gchar *package,
--- gmodule/gmodule.c Sat Jul 05 06:59:10 2014
+++ gmodule/gmodule.c Sat Nov 07 22:33:53 2015
@@ -649,7 +649,7 @@
return module;
}
-#if defined (G_OS_WIN32) && !defined(_WIN64)
+#ifdef G_OS_WIN32
#undef g_module_open
@@ -872,7 +872,7 @@
return module->file_name;
}
-#if defined (G_OS_WIN32) && !defined(_WIN64)
+#ifdef G_OS_WIN32
#undef g_module_name
@@ -883,8 +883,11 @@
if (module == main_module)
return "main";
-
+#ifndef _WIN64
return module->cp_file_name;
+#else
+ return module->file_name;
+#endif
}
#endif