glib2: Update to 2.46.0

This commit is contained in:
Alexey Pavlov
2015-09-22 09:47:39 +03:00
parent c0967dd1de
commit 587e876a35
15 changed files with 210 additions and 321 deletions

View File

@@ -1,28 +1,7 @@
From 7f4f4354540440c0a8a37beaccbec8bc7fc15ec7 Mon Sep 17 00:00:00 2001
From: Erik van Pienbroek <epienbro@fedoraproject.org>
Date: Mon, 27 Aug 2012 23:28:54 +0200
Subject: [PATCH] Use CreateFile on Win32 to make sure g_unlink always works
The functions g_open(), g_creat() and g_fopen() defer to _wopen(),
_wcreat() and _wfopen() respectively. This is very similar to
the corresponding arrangement for Linux. However, those Windows
functions do not support renaming a file whilst it's open. As a
result, g_rename() behaves differently on the Windows platform
compared to its Linux behaviour, where files can be renamed even
while there are file handles still open. Resolved this by using
the Win32 API function CreateFile() instead of _wopen(), _wcreat()
and _wfopen()
Patch initially created by John Emmas
---
glib/gstdio.c | 259 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 233 insertions(+), 26 deletions(-)
diff --git a/glib/gstdio.c b/glib/gstdio.c
index 6d763e1..c1d072f 100644
--- a/glib/gstdio.c
+++ b/glib/gstdio.c
@@ -191,6 +191,11 @@ g_open (const gchar *filename,
diff -Naur glib-2.46.0-orig/glib/gstdio.c glib-2.46.0/glib/gstdio.c
--- glib-2.46.0-orig/glib/gstdio.c 2015-02-26 15:57:09.000000000 +0300
+++ glib-2.46.0/glib/gstdio.c 2015-09-22 09:08:58.032066100 +0300
@@ -192,6 +192,11 @@
int mode)
{
#ifdef G_OS_WIN32
@@ -34,7 +13,7 @@ index 6d763e1..c1d072f 100644
wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
int retval;
int save_errno;
@@ -201,12 +206,114 @@ g_open (const gchar *filename,
@@ -202,12 +207,114 @@
return -1;
}
@@ -152,7 +131,7 @@ index 6d763e1..c1d072f 100644
return retval;
#else
int fd;
@@ -248,6 +355,8 @@ g_creat (const gchar *filename,
@@ -254,6 +361,8 @@
int mode)
{
#ifdef G_OS_WIN32
@@ -161,7 +140,7 @@ index 6d763e1..c1d072f 100644
wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
int retval;
int save_errno;
@@ -258,12 +367,41 @@ g_creat (const gchar *filename,
@@ -264,12 +373,41 @@
return -1;
}
@@ -172,8 +151,7 @@ index 6d763e1..c1d072f 100644
+ if (! (mode & _S_IWRITE))
+ dwFlagsAndAttributes = FILE_ATTRIBUTE_READONLY; /* Sets file to 'read only' after the file gets closed */
+ }
- g_free (wfilename);
+
+ hFile = CreateFileW(wfilename, (GENERIC_READ | GENERIC_WRITE), (FILE_SHARE_READ | FILE_SHARE_DELETE),
+ NULL, CREATE_ALWAYS, dwFlagsAndAttributes, NULL);
+
@@ -200,13 +178,14 @@ index 6d763e1..c1d072f 100644
+ retval = _open_osfhandle((long)hFile, _O_RDWR);
+ save_errno = errno;
+ g_free (wfilename);
g_free (wfilename);
-
errno = save_errno;
+
return retval;
#else
return creat (filename, mode);
@@ -699,33 +837,102 @@ g_fopen (const gchar *filename,
@@ -702,33 +840,102 @@
const gchar *mode)
{
#ifdef G_OS_WIN32
@@ -216,6 +195,25 @@ index 6d763e1..c1d072f 100644
- int save_errno;
-
- if (wfilename == NULL)
- {
- errno = EINVAL;
- return NULL;
- }
-
- wmode = g_utf8_to_utf16 (mode, -1, NULL, NULL, NULL);
-
- if (wmode == NULL)
- {
- g_free (wfilename);
- errno = EINVAL;
- return NULL;
- }
-
- retval = _wfopen (wfilename, wmode);
- save_errno = errno;
-
- g_free (wfilename);
- g_free (wmode);
+ int hFile;
+ int flags = 0;
+ gchar priv_mode[4];
@@ -241,9 +239,7 @@ index 6d763e1..c1d072f 100644
+ if (('c' == priv_mode[2]) || ('n' == priv_mode[2]))
+ priv_mode[2] = '\0';
+ else
{
- errno = EINVAL;
- return NULL;
+ {
+ if (0 == strcmp(priv_mode, "a+b"))
+ flags = _O_RDWR | _O_CREAT | _O_APPEND | _O_BINARY;
+ else if (0 == strcmp(priv_mode, "a+t"))
@@ -261,21 +257,14 @@ index 6d763e1..c1d072f 100644
+ errno = EINVAL;
+ goto out;
+ }
}
-
- wmode = g_utf8_to_utf16 (mode, -1, NULL, NULL, NULL);
-
- if (wmode == NULL)
+ }
+ }
+ if (2 == strlen(priv_mode))
+ {
+ if (('c' == priv_mode[1]) || ('n' == priv_mode[1]))
+ priv_mode[1] = '\0';
+ else
{
- g_free (wfilename);
- errno = EINVAL;
- return NULL;
+ {
+ if (0 == strcmp(priv_mode, "a+"))
+ flags = _O_RDWR | _O_CREAT | _O_APPEND;
+ else if (0 == strcmp(priv_mode, "ab"))
@@ -295,7 +284,7 @@ index 6d763e1..c1d072f 100644
+ errno = EINVAL;
+ goto out;
+ }
}
+ }
+ }
+ if (1 == strlen(priv_mode))
+ {
@@ -311,13 +300,9 @@ index 6d763e1..c1d072f 100644
+ goto out;
+ }
+ }
- retval = _wfopen (wfilename, wmode);
- save_errno = errno;
+
+ hFile = g_open (filename, flags, (_S_IREAD | _S_IWRITE));
- g_free (wfilename);
- g_free (wmode);
+
+ if (INVALID_HANDLE_VALUE == (HANDLE)hFile)
+ /* 'errno' will have already been set by 'g_open()' */
+ retval = NULL;
@@ -329,5 +314,3 @@ index 6d763e1..c1d072f 100644
return retval;
#else
return fopen (filename, mode);
--
1.7.11.4

View File

@@ -1,7 +1,7 @@
diff -ur glib-2.37.4.orig/glib/gbacktrace.c glib-2.37.4/glib/gbacktrace.c
--- glib-2.37.4.orig/glib/gbacktrace.c 2013-06-02 23:20:49.000000000 +0000
+++ glib-2.37.4/glib/gbacktrace.c 2013-07-28 19:59:41.097131300 +0000
@@ -259,7 +259,7 @@
diff -Naur glib-2.46.0-orig/glib/gbacktrace.c glib-2.46.0/glib/gbacktrace.c
--- glib-2.46.0-orig/glib/gbacktrace.c 2014-12-20 00:49:48.000000000 +0300
+++ glib-2.46.0/glib/gbacktrace.c 2015-09-22 09:08:59.311126700 +0300
@@ -254,7 +254,7 @@
if (IsDebuggerPresent ())
G_BREAKPOINT ();
else
@@ -10,10 +10,10 @@ diff -ur glib-2.37.4.orig/glib/gbacktrace.c glib-2.37.4/glib/gbacktrace.c
#endif
}
diff -ur glib-2.37.4.orig/glib/giowin32.c glib-2.37.4/glib/giowin32.c
--- glib-2.37.4.orig/glib/giowin32.c 2013-06-02 23:20:49.000000000 +0000
+++ glib-2.37.4/glib/giowin32.c 2013-07-28 19:59:57.402201800 +0000
@@ -800,7 +800,7 @@
diff -Naur glib-2.46.0-orig/glib/giowin32.c glib-2.46.0/glib/giowin32.c
--- glib-2.46.0-orig/glib/giowin32.c 2014-12-20 00:49:48.000000000 +0300
+++ glib-2.46.0/glib/giowin32.c 2015-09-22 09:08:59.357921600 +0300
@@ -798,7 +798,7 @@
default:
g_assert_not_reached ();
@@ -22,7 +22,7 @@ diff -ur glib-2.37.4.orig/glib/giowin32.c glib-2.37.4/glib/giowin32.c
}
if (channel->debug)
g_print ("\n");
@@ -947,7 +947,7 @@
@@ -945,7 +945,7 @@
default:
g_assert_not_reached ();
@@ -31,7 +31,7 @@ diff -ur glib-2.37.4.orig/glib/giowin32.c glib-2.37.4/glib/giowin32.c
}
}
@@ -1012,7 +1012,7 @@
@@ -1010,7 +1010,7 @@
default:
g_assert_not_reached ();
@@ -40,7 +40,7 @@ diff -ur glib-2.37.4.orig/glib/giowin32.c glib-2.37.4/glib/giowin32.c
}
if (channel->debug)
g_print ("\n");
@@ -1297,7 +1297,7 @@
@@ -1295,7 +1295,7 @@
default:
whence = -1; /* Keep the compiler quiet */
g_assert_not_reached ();
@@ -49,7 +49,7 @@ diff -ur glib-2.37.4.orig/glib/giowin32.c glib-2.37.4/glib/giowin32.c
}
tmp_offset = offset;
@@ -1692,7 +1692,7 @@
@@ -1690,7 +1690,7 @@
break;
default:
g_assert_not_reached ();
@@ -58,7 +58,7 @@ diff -ur glib-2.37.4.orig/glib/giowin32.c glib-2.37.4/glib/giowin32.c
}
/* always open 'untranslated' */
@@ -1738,7 +1738,7 @@
@@ -1736,7 +1736,7 @@
break;
default:
g_assert_not_reached ();
@@ -67,7 +67,7 @@ diff -ur glib-2.37.4.orig/glib/giowin32.c glib-2.37.4/glib/giowin32.c
}
return channel;
@@ -2227,7 +2227,7 @@
@@ -2225,7 +2225,7 @@
default:
g_assert_not_reached ();
@@ -76,9 +76,10 @@ diff -ur glib-2.37.4.orig/glib/giowin32.c glib-2.37.4/glib/giowin32.c
}
fd->events = condition;
--- glib-2.39.3/glib/gmessages.c.orig 2014-01-06 19:02:48.000000000 +0000
+++ glib-2.39.3/glib/gmessages.c 2014-01-22 22:44:37.532985700 +0000
@@ -308,7 +308,7 @@
diff -Naur glib-2.46.0-orig/glib/gmessages.c glib-2.46.0/glib/gmessages.c
--- glib-2.46.0-orig/glib/gmessages.c 2015-09-21 06:33:23.000000000 +0300
+++ glib-2.46.0/glib/gmessages.c 2015-09-22 09:08:59.373519900 +0300
@@ -323,7 +323,7 @@
if (breakpoint)
G_BREAKPOINT ();
else
@@ -87,19 +88,19 @@ diff -ur glib-2.37.4.orig/glib/giowin32.c glib-2.37.4/glib/giowin32.c
}
#ifdef G_OS_WIN32
@@ -1130,7 +1130,7 @@
pretty_function,
expression);
@@ -1176,7 +1176,7 @@
line,
pretty_function);
_g_log_abort (FALSE);
- abort ();
+ g_abort ();
}
/**
diff -ur glib-2.37.4.orig/glib/gslice.c glib-2.37.4/glib/gslice.c
--- glib-2.37.4.orig/glib/gslice.c 2013-06-11 02:14:02.000000000 +0000
+++ glib-2.37.4/glib/gslice.c 2013-07-28 20:00:41.525304700 +0000
@@ -1094,7 +1094,7 @@
diff -Naur glib-2.46.0-orig/glib/gslice.c glib-2.46.0/glib/gslice.c
--- glib-2.46.0-orig/glib/gslice.c 2015-09-08 20:40:27.000000000 +0300
+++ glib-2.46.0/glib/gslice.c 2015-09-22 09:08:59.404716500 +0300
@@ -1082,7 +1082,7 @@
return;
if (G_UNLIKELY (allocator->config.debug_blocks) &&
!smc_notify_free (mem_block, mem_size))
@@ -108,7 +109,7 @@ diff -ur glib-2.37.4.orig/glib/gslice.c glib-2.37.4/glib/gslice.c
if (G_LIKELY (acat == 1)) /* allocate through magazine layer */
{
ThreadMemory *tmem = thread_memory_from_self();
@@ -1178,7 +1178,7 @@
@@ -1165,7 +1165,7 @@
slice = *(gpointer*) (current + next_offset);
if (G_UNLIKELY (allocator->config.debug_blocks) &&
!smc_notify_free (current, mem_size))
@@ -117,7 +118,7 @@ diff -ur glib-2.37.4.orig/glib/gslice.c glib-2.37.4/glib/gslice.c
if (G_UNLIKELY (thread_memory_magazine2_is_full (tmem, ix)))
{
thread_memory_swap_magazines (tmem, ix);
@@ -1199,7 +1199,7 @@
@@ -1186,7 +1186,7 @@
slice = *(gpointer*) (current + next_offset);
if (G_UNLIKELY (allocator->config.debug_blocks) &&
!smc_notify_free (current, mem_size))
@@ -126,7 +127,7 @@ diff -ur glib-2.37.4.orig/glib/gslice.c glib-2.37.4/glib/gslice.c
if (G_UNLIKELY (g_mem_gc_friendly))
memset (current, 0, chunk_size);
slab_allocator_free_chunk (chunk_size, current);
@@ -1213,7 +1213,7 @@
@@ -1200,7 +1200,7 @@
slice = *(gpointer*) (current + next_offset);
if (G_UNLIKELY (allocator->config.debug_blocks) &&
!smc_notify_free (current, mem_size))
@@ -135,7 +136,7 @@ diff -ur glib-2.37.4.orig/glib/gslice.c glib-2.37.4/glib/gslice.c
if (G_UNLIKELY (g_mem_gc_friendly))
memset (current, 0, mem_size);
g_free (current);
@@ -1452,7 +1452,7 @@
@@ -1436,7 +1436,7 @@
vfprintf (stderr, format, args);
va_end (args);
fputs ("\n", stderr);
@@ -144,10 +145,10 @@ diff -ur glib-2.37.4.orig/glib/gslice.c glib-2.37.4/glib/gslice.c
_exit (1);
}
diff -ur glib-2.37.4.orig/glib/gtester.c glib-2.37.4/glib/gtester.c
--- glib-2.37.4.orig/glib/gtester.c 2013-06-02 23:20:49.000000000 +0000
+++ glib-2.37.4/glib/gtester.c 2013-07-28 20:00:48.964249400 +0000
@@ -96,7 +96,7 @@
diff -Naur glib-2.46.0-orig/glib/gtester.c glib-2.46.0/glib/gtester.c
--- glib-2.46.0-orig/glib/gtester.c 2014-12-20 00:49:48.000000000 +0300
+++ glib-2.46.0/glib/gtester.c 2015-09-22 09:08:59.420314800 +0300
@@ -94,7 +94,7 @@
terminate (void)
{
kill (getpid(), SIGTERM);
@@ -156,10 +157,48 @@ diff -ur glib-2.37.4.orig/glib/gtester.c glib-2.37.4/glib/gtester.c
}
static void
diff -ur glib-2.37.4.orig/glib/gthread-posix.c glib-2.37.4/glib/gthread-posix.c
--- glib-2.37.4.orig/glib/gthread-posix.c 2013-07-09 16:45:56.000000000 +0000
+++ glib-2.37.4/glib/gthread-posix.c 2013-07-28 20:01:09.374341100 +0000
@@ -76,7 +76,7 @@
diff -Naur glib-2.46.0-orig/glib/gtestutils.c glib-2.46.0/glib/gtestutils.c
--- glib-2.46.0-orig/glib/gtestutils.c 2015-09-01 06:34:13.000000000 +0300
+++ glib-2.46.0/glib/gtestutils.c 2015-09-22 09:08:59.576297800 +0300
@@ -846,7 +846,7 @@
{
if (test_tap_log)
g_print ("Bail out!\n");
- abort();
+ g_abort();
}
if (result == G_TEST_RUN_SKIPPED)
test_skipped_count++;
@@ -2426,7 +2426,7 @@
_exit (1);
}
else
- abort ();
+ g_abort ();
}
void
@@ -2451,7 +2451,7 @@
if (test_in_subprocess)
_exit (1);
else
- abort ();
+ g_abort ();
}
void
diff -Naur glib-2.46.0-orig/glib/gthread-posix.c glib-2.46.0/glib/gthread-posix.c
--- glib-2.46.0-orig/glib/gthread-posix.c 2015-08-19 06:35:30.000000000 +0300
+++ glib-2.46.0/glib/gthread-posix.c 2015-09-22 09:08:59.560699500 +0300
@@ -46,6 +46,7 @@
#include "gmessages.h"
#include "gstrfuncs.h"
#include "gmain.h"
+#include "gutils.h"
#include <stdlib.h>
#include <stdio.h>
@@ -77,7 +78,7 @@
{
fprintf (stderr, "GLib (gthread-posix.c): Unexpected error from C library during '%s': %s. Aborting.\n",
function, strerror (status));
@@ -168,10 +207,10 @@ diff -ur glib-2.37.4.orig/glib/gthread-posix.c glib-2.37.4/glib/gthread-posix.c
}
/* {{{1 GMutex */
diff -ur glib-2.37.4.orig/glib/gthread-win32.c glib-2.37.4/glib/gthread-win32.c
--- glib-2.37.4.orig/glib/gthread-win32.c 2013-06-02 23:20:49.000000000 +0000
+++ glib-2.37.4/glib/gthread-win32.c 2013-07-28 20:01:13.008802600 +0000
@@ -60,7 +60,7 @@
diff -Naur glib-2.46.0-orig/glib/gthread-win32.c glib-2.46.0/glib/gthread-win32.c
--- glib-2.46.0-orig/glib/gthread-win32.c 2014-12-20 00:49:48.000000000 +0300
+++ glib-2.46.0/glib/gthread-win32.c 2015-09-22 09:08:59.467109700 +0300
@@ -58,7 +58,7 @@
{
fprintf (stderr, "GLib (gthread-win32.c): Unexpected error from C library during '%s': %s. Aborting.\n",
strerror (status), function);
@@ -180,10 +219,10 @@ diff -ur glib-2.37.4.orig/glib/gthread-win32.c glib-2.37.4/glib/gthread-win32.c
}
/* Starting with Vista and Windows 2008, we have access to the
diff -ur glib-2.37.4.orig/glib/gutils.c glib-2.37.4/glib/gutils.c
--- glib-2.37.4.orig/glib/gutils.c 2013-06-11 02:14:02.000000000 +0000
+++ glib-2.37.4/glib/gutils.c 2013-07-28 19:57:12.280734000 +0000
@@ -2433,3 +2433,15 @@
diff -Naur glib-2.46.0-orig/glib/gutils.c glib-2.46.0/glib/gutils.c
--- glib-2.46.0-orig/glib/gutils.c 2015-08-28 21:15:54.000000000 +0300
+++ glib-2.46.0/glib/gutils.c 2015-09-22 09:08:59.498306300 +0300
@@ -2375,3 +2375,15 @@
return FALSE;
#endif
}
@@ -199,10 +238,10 @@ diff -ur glib-2.37.4.orig/glib/gutils.c glib-2.37.4/glib/gutils.c
+ abort ();
+#endif
+}
diff -ur glib-2.37.4.orig/glib/gutils.h glib-2.37.4/glib/gutils.h
--- glib-2.37.4.orig/glib/gutils.h 2013-06-11 02:14:02.000000000 +0000
+++ glib-2.37.4/glib/gutils.h 2013-07-28 19:58:22.568659500 +0000
@@ -230,6 +230,9 @@
diff -Naur glib-2.46.0-orig/glib/gutils.h glib-2.46.0/glib/gutils.h
--- glib-2.46.0-orig/glib/gutils.h 2015-08-21 03:20:48.000000000 +0300
+++ glib-2.46.0/glib/gutils.h 2015-09-22 09:08:59.529502900 +0300
@@ -228,6 +228,9 @@
GLIB_DEPRECATED_FOR(g_format_size)
gchar *g_format_size_for_display (goffset size);
@@ -212,42 +251,3 @@ diff -ur glib-2.37.4.orig/glib/gutils.h glib-2.37.4/glib/gutils.h
#ifndef G_DISABLE_DEPRECATED
/**
* GVoidFunc:
--- glib-2.37.4/glib/gthread-posix.c.orig 2013-07-28 20:02:38.456653100 +0000
+++ glib-2.37.4/glib/gthread-posix.c 2013-07-28 20:06:34.756159300 +0000
@@ -47,6 +47,7 @@
#include "gmessages.h"
#include "gstrfuncs.h"
#include "gmain.h"
+#include "gutils.h"
#include <stdlib.h>
#include <stdio.h>
--- glib-2.39.3/glib/gtestutils.c.orig 2014-01-09 03:58:06.000000000 +0000
+++ glib-2.39.3/glib/gtestutils.c 2014-01-22 22:42:53.192017800 +0000
@@ -764,7 +764,7 @@
{
if (test_tap_log)
g_print ("Bail out!\n");
- abort();
+ g_abort();
}
if (largs[0] == G_TEST_RUN_SKIPPED)
test_skipped_count++;
@@ -2349,7 +2349,7 @@
_exit (1);
}
else
- abort ();
+ g_abort ();
}
void
@@ -2374,7 +2374,7 @@
if (test_in_subprocess)
_exit (1);
else
- abort ();
+ g_abort ();
}
void

View File

@@ -1,22 +1,7 @@
From bc90511c1eb333e26e0bc0eaee62375d0e788db6 Mon Sep 17 00:00:00 2001
From: Erik van Pienbroek <epienbro@fedoraproject.org>
Date: Tue, 16 Apr 2013 11:42:11 +0200
Subject: [PATCH] win32: Prefer the use of constructors over DllMain
This prevents having to depend on DllMain in static libraries
Constructors are available in both the GCC build (GCC 2.7 and later)
and the MSVC build (MSVC 2008 and later using _Pragma, earlier
versions using #pragma)
---
glib/glib-init.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/glib/glib-init.c b/glib/glib-init.c
index 0032ee8..dd6ccbf 100644
--- a/glib/glib-init.c
+++ b/glib/glib-init.c
@@ -223,12 +223,14 @@ glib_init (void)
diff -Naur glib-2.46.0-orig/glib/glib-init.c glib-2.46.0/glib/glib-init.c
--- glib-2.46.0-orig/glib/glib-init.c 2015-09-12 18:13:45.000000000 +0300
+++ glib-2.46.0/glib/glib-init.c 2015-09-22 09:09:00.512195800 +0300
@@ -238,12 +238,14 @@
#if defined (G_OS_WIN32)
@@ -33,7 +18,7 @@ index 0032ee8..dd6ccbf 100644
BOOL WINAPI
DllMain (HINSTANCE hinstDLL,
DWORD fdwReason,
@@ -238,11 +240,6 @@ DllMain (HINSTANCE hinstDLL,
@@ -253,11 +255,6 @@
{
case DLL_PROCESS_ATTACH:
glib_dll = hinstDLL;
@@ -45,7 +30,7 @@ index 0032ee8..dd6ccbf 100644
break;
case DLL_THREAD_DETACH:
@@ -259,7 +256,10 @@ DllMain (HINSTANCE hinstDLL,
@@ -274,7 +271,10 @@
return TRUE;
}
@@ -57,7 +42,7 @@ index 0032ee8..dd6ccbf 100644
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(glib_init_ctor)
@@ -269,6 +269,12 @@ G_DEFINE_CONSTRUCTOR(glib_init_ctor)
@@ -284,6 +284,12 @@
static void
glib_init_ctor (void)
{
@@ -70,5 +55,3 @@ index 0032ee8..dd6ccbf 100644
glib_init ();
}
--
1.8.2

View File

@@ -1,6 +1,7 @@
--- glib/gmessages.c.orig 2013-01-02 01:35:51.326148960 +0100
+++ glib/gmessages.c 2013-01-02 01:36:28.467415487 +0100
@@ -823,7 +823,7 @@
diff -Naur glib-2.46.0-orig/glib/gmessages.c glib-2.46.0/glib/gmessages.c
--- glib-2.46.0-orig/glib/gmessages.c 2015-09-22 09:09:00.356212800 +0300
+++ glib-2.46.0/glib/gmessages.c 2015-09-22 09:09:01.292110800 +0300
@@ -932,7 +932,7 @@
if ((log_level & G_LOG_FLAG_FATAL) != 0 && !g_test_initialized ())
win32_keep_fatal_message = TRUE;
#endif

View File

@@ -1,11 +0,0 @@
--- glib-2.36.0/gtk-doc.make.orig 2013-04-17 19:29:34 +0400
+++ glib-2.36.0/gtk-doc.make 2013-04-17 19:44:07 +0400
@@ -101,7 +101,7 @@
GTK_DOC_V_INTROSPECT_=$(GTK_DOC_V_INTROSPECT_$(AM_DEFAULT_VERBOSITY))
GTK_DOC_V_INTROSPECT_0=@echo " DOC Introspecting gobjects";
-scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
+scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) setup-build.stamp
$(GTK_DOC_V_SCAN)_source_dir='' ; \
for i in $(DOC_SOURCE_DIR) ; do \
_source_dir="$${_source_dir} --source-dir=$$i" ; \

View File

@@ -1,11 +0,0 @@
--- glib-2.39.3/glib/gstdio.h.orig 2013-12-09 01:30:33.000000000 +0000
+++ glib-2.39.3/glib/gstdio.h 2014-01-23 16:01:09.254148700 +0000
@@ -27,7 +27,7 @@
G_BEGIN_DECLS
-#if defined (_MSC_VER) && !defined(_WIN64)
+#if (defined (__MINGW32__) || defined (_MSC_VER)) && !defined(_WIN64)
/* 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

View File

@@ -1,24 +1,7 @@
From ea281f66ce6d71a83d0b0d235a80b505c7d0d26d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
=?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Sun, 2 Mar 2014 18:18:18 +0000
Subject: [PATCH] Switch G_GNUC_(PRINT|SCAN)F to gnu_(print|scan)f format
explicitly
https://bugzilla.gnome.org/show_bug.cgi?id=725470
---
configure.ac | 10 +++++-----
gio/gregistrysettingsbackend.c | 2 +-
gio/win32/gwinhttpfile.c | 2 +-
glib/gmacros.h | 4 ++--
glib/gpoll.h | 2 +-
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6c2ad85..b38715f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -552,7 +552,7 @@ else
diff -Naur glib-2.46.0-orig/configure.ac glib-2.46.0/configure.ac
--- glib-2.46.0-orig/configure.ac 2015-09-21 15:38:33.000000000 +0300
+++ glib-2.46.0/configure.ac 2015-09-22 09:09:02.118820700 +0300
@@ -567,7 +567,7 @@
])
fi
@@ -27,7 +10,7 @@ index 6c2ad85..b38715f 100644
# long long is a 64 bit integer.
AC_MSG_CHECKING(for format to printf and scanf a guint64)
AC_CACHE_VAL(glib_cv_long_long_format,[
@@ -574,8 +574,8 @@
@@ -589,8 +589,8 @@
AS_IF([ test -n "$glib_cv_long_long_format"], [
AC_MSG_RESULT(%${glib_cv_long_long_format}u)
AC_DEFINE(HAVE_LONG_LONG_FORMAT,1,[define if system printf can print long long])
@@ -38,7 +21,7 @@ index 6c2ad85..b38715f 100644
fi
], [AC_MSG_RESULT(none)])
],[ test x$ac_cv_sizeof___int64 = x8], [
@@ -3222,8 +3222,8 @@
@@ -3177,8 +3177,8 @@
glib_msize_type='LONG'
;;
"long long"|__int64)
@@ -49,7 +32,7 @@ index 6c2ad85..b38715f 100644
glib_msize_type='INT64'
;;
esac
@@ -3245,8 +3245,8 @@
@@ -3200,8 +3200,8 @@
glib_mssize_type='LONG'
;;
"long long"|__int64)
@@ -60,7 +43,7 @@ index 6c2ad85..b38715f 100644
glib_mssize_type='INT64'
;;
esac
@@ -3264,9 +3264,9 @@
@@ -3230,9 +3230,9 @@
;;
$ac_cv_sizeof_long_long)
glib_intptr_type_define='long long'
@@ -73,11 +56,10 @@ index 6c2ad85..b38715f 100644
glib_gpi_cast='(gint64)'
glib_gpui_cast='(guint64)'
;;
diff --git a/gio/gregistrysettingsbackend.c b/gio/gregistrysettingsbackend.c
index 396159c..c25a771 100644
--- a/gio/gregistrysettingsbackend.c
+++ b/gio/gregistrysettingsbackend.c
@@ -328,7 +328,7 @@ registry_value_dump (RegistryValue value)
diff -Naur glib-2.46.0-orig/gio/gregistrysettingsbackend.c glib-2.46.0/gio/gregistrysettingsbackend.c
--- glib-2.46.0-orig/gio/gregistrysettingsbackend.c 2015-08-19 06:35:30.000000000 +0300
+++ glib-2.46.0/gio/gregistrysettingsbackend.c 2015-09-22 09:09:02.118820700 +0300
@@ -328,7 +328,7 @@
if (value.type == REG_DWORD)
return g_strdup_printf ("%i", value.dword);
else if (value.type == REG_QWORD)
@@ -86,10 +68,9 @@ index 396159c..c25a771 100644
else if (value.type == REG_SZ)
return g_strdup_printf ("%s", (char *)value.ptr);
else if (value.type == REG_NONE)
diff --git a/gio/win32/gwinhttpfile.c b/gio/win32/gwinhttpfile.c
index 6403a99..a3c149d 100644
--- a/gio/win32/gwinhttpfile.c
+++ b/gio/win32/gwinhttpfile.c
diff -Naur glib-2.46.0-orig/gio/win32/gwinhttpfile.c glib-2.46.0/gio/win32/gwinhttpfile.c
--- glib-2.46.0-orig/gio/win32/gwinhttpfile.c 2015-02-26 15:57:09.000000000 +0300
+++ glib-2.46.0/gio/win32/gwinhttpfile.c 2015-09-22 09:09:02.118820700 +0300
@@ -549,7 +549,7 @@
gint64 cl;
int n;
@@ -99,11 +80,10 @@ index 6403a99..a3c149d 100644
n == wcslen (content_length))
g_file_info_set_size (info, cl);
diff --git a/glib/gmacros.h b/glib/gmacros.h
index 6403a99..a3c149d 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -73,9 +73,9 @@
diff -Naur glib-2.46.0-orig/glib/gmacros.h glib-2.46.0/glib/gmacros.h
--- glib-2.46.0-orig/glib/gmacros.h 2015-08-19 06:35:30.000000000 +0300
+++ glib-2.46.0/glib/gmacros.h 2015-09-22 09:09:02.118820700 +0300
@@ -79,9 +79,9 @@
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
#define G_GNUC_PRINTF( format_idx, arg_idx ) \
@@ -115,12 +95,11 @@ index 6403a99..a3c149d 100644
#define G_GNUC_FORMAT( arg_idx ) \
__attribute__((__format_arg__ (arg_idx)))
#define G_GNUC_NORETURN \
diff --git a/glib/gpoll.h b/glib/gpoll.h
index 6403a99..a3c149d 100644
--- a/glib/gpoll.h
+++ b/glib/gpoll.h
@@ -100,7 +100,7 @@
diff -Naur glib-2.46.0-orig/glib/gpoll.h glib-2.46.0/glib/gpoll.h
--- glib-2.46.0-orig/glib/gpoll.h 2014-12-20 00:49:48.000000000 +0300
+++ glib-2.46.0/glib/gpoll.h 2015-09-22 09:09:02.118820700 +0300
@@ -108,7 +108,7 @@
*/
#ifdef G_OS_WIN32
#if GLIB_SIZEOF_VOID_P == 8
-#define G_POLLFD_FORMAT "%#I64x"
@@ -128,5 +107,3 @@ index 6403a99..a3c149d 100644
#else
#define G_POLLFD_FORMAT "%#x"
#endif
--
1.8.4

View File

@@ -1,50 +0,0 @@
--- glib-2.39.90/gio/glocalfile.c.orig 2014-02-03 17:40:41.000000000 +0000
+++ glib-2.39.90/gio/glocalfile.c 2014-03-02 14:30:32.519644000 +0000
@@ -2648,10 +2648,45 @@
#if defined (AT_FDCWD)
if (fstatat (parent_fd, name->data, &buf, AT_SYMLINK_NOFOLLOW) != 0)
-#else
+ return g_local_file_measure_size_error (state->flags, errno, name, error);
+#elif defined (HAVE_LSTAT) || !defined (G_OS_WIN32)
if (g_lstat (name->data, &buf) != 0)
-#endif
return g_local_file_measure_size_error (state->flags, errno, name, error);
+#else
+ {
+ const char *filename = (const gchar *) name->data;
+ wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
+ int retval;
+ int save_errno;
+ int len;
+
+ if (wfilename == NULL)
+ {
+ errno = EINVAL;
+ return g_local_file_measure_size_error (state->flags, errno, name, error);
+ }
+
+ len = wcslen (wfilename);
+ while (len > 0 && G_IS_DIR_SEPARATOR (wfilename[len-1]))
+ len--;
+ if (len > 0 &&
+ (!g_path_is_absolute (filename) || len > g_path_skip_root (filename) - filename))
+ wfilename[len] = '\0';
+
+#ifdef _WIN64
+ retval = _wstati64 (wfilename, &buf);
+#else
+ retval = _wstat32i64 (wfilename, &buf);
+#endif
+ save_errno = errno;
+
+ g_free (wfilename);
+
+ errno = save_errno;
+ if (retval != 0)
+ return g_local_file_measure_size_error (state->flags, errno, name, error);
+ }
+#endif
if (name->next)
{

View File

@@ -1,5 +1,6 @@
--- glib-2.39.90/glib/tests/test-printf.c.orig 2014-03-02 17:25:28.535468800 +0000
+++ glib-2.39.90/glib/tests/test-printf.c 2014-03-02 17:24:39.981803200 +0000
diff -Naur glib-2.46.0-orig/glib/tests/test-printf.c glib-2.46.0/glib/tests/test-printf.c
--- glib-2.46.0-orig/glib/tests/test-printf.c 2014-12-20 00:49:48.000000000 +0300
+++ glib-2.46.0/glib/tests/test-printf.c 2015-09-22 09:09:03.039120400 +0300
@@ -24,6 +24,9 @@
#include <string.h>
#include "glib.h"
@@ -10,7 +11,7 @@
static void
test_retval_and_trunc (void)
@@ -896,6 +899,9 @@
@@ -907,6 +910,9 @@
main (int argc,
char *argv[])
{

View File

@@ -1,5 +1,6 @@
--- glib-2.40.0/glib/gnulib/printf.c.orig 2014-02-03 17:40:41.000000000 +0000
+++ glib-2.40.0/glib/gnulib/printf.c 2014-05-20 00:11:04.036075100 +0000
diff -Naur glib-2.46.0-orig/glib/gnulib/printf.c glib-2.46.0/glib/gnulib/printf.c
--- glib-2.46.0-orig/glib/gnulib/printf.c 2014-12-20 00:49:48.000000000 +0300
+++ glib-2.46.0/glib/gnulib/printf.c 2015-09-22 09:09:03.834633700 +0300
@@ -88,16 +88,16 @@
int _g_gnulib_vfprintf (FILE *file, char const *format, va_list args)
{

View File

@@ -1,6 +1,7 @@
--- glib-2.43.2/gio/gsocket.c.orig 2014-12-12 15:03:50.000000000 +0000
+++ glib-2.43.2/gio/gsocket.c 2015-01-14 12:44:04.619136700 +0000
@@ -1931,7 +1931,7 @@
diff -Naur glib-2.46.0-orig/gio/gsocket.c glib-2.46.0/gio/gsocket.c
--- glib-2.46.0-orig/gio/gsocket.c 2015-08-31 16:08:34.000000000 +0300
+++ glib-2.46.0/gio/gsocket.c 2015-09-22 09:09:04.614548700 +0300
@@ -1951,7 +1951,7 @@
#if !defined(HAVE_IF_NAMETOINDEX) && defined(G_OS_WIN32)
static guint
@@ -9,7 +10,7 @@
{
PIP_ADAPTER_ADDRESSES addresses = NULL, p;
gulong addresses_len = 0;
@@ -1981,6 +1981,7 @@
@@ -2004,6 +2004,7 @@
}
#define HAVE_IF_NAMETOINDEX 1

View File

@@ -1,6 +1,7 @@
--- a/gio/glocalfileinfo.c 2015-02-26 03:57:52.000000000 +0100
+++ b/gio/glocalfileinfo.c 2015-03-14 14:04:17.044446300 +0100
@@ -1220,7 +1220,7 @@
diff -Naur glib-2.46.0-orig/gio/glocalfileinfo.c glib-2.46.0/gio/glocalfileinfo.c
--- glib-2.46.0-orig/gio/glocalfileinfo.c 2015-08-21 08:00:49.000000000 +0300
+++ glib-2.46.0/gio/glocalfileinfo.c 2015-09-22 09:09:05.410062000 +0300
@@ -1232,7 +1232,7 @@
(symlink_broken || (flags & G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS)))
return g_content_type_from_mime_type ("inode/symlink");
else if (statbuf != NULL && S_ISDIR(statbuf->st_mode))

View File

@@ -1,5 +1,6 @@
--- glib-2.43.2/glib/grand.c.orig 2014-09-15 19:51:01.000000000 +0000
+++ glib-2.43.2/glib/grand.c 2015-01-14 13:53:08.130295800 +0000
diff -Naur glib-2.46.0-orig/glib/grand.c glib-2.46.0/glib/grand.c
--- glib-2.46.0-orig/glib/grand.c 2014-12-20 00:49:48.000000000 +0300
+++ glib-2.46.0/glib/grand.c 2015-09-22 09:09:06.174378700 +0300
@@ -263,7 +263,8 @@
}
#else /* G_OS_WIN32 */

View File

@@ -0,0 +1,14 @@
--- glib-2.46.0/gio/glocalfile.c.orig 2015-09-22 09:21:19.504654600 +0300
+++ glib-2.46.0/gio/glocalfile.c 2015-09-22 09:22:36.185897400 +0300
@@ -2682,7 +2682,11 @@
(!g_path_is_absolute (filename) || len > g_path_skip_root (filename) - filename))
wfilename[len] = '\0';
+#ifdef _WIN64
+ retval = _wstati64 (wfilename, &buf);
+#else
retval = _wstat32i64 (wfilename, &buf);
+#endif
save_errno = errno;
g_free (wfilename);

View File

@@ -2,9 +2,10 @@
# Contributor: Renato Silva <br.renatosilva@gmail.com>
_realname=glib2
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.44.1
pkgrel=4
pkgver=2.46.0
pkgrel=1
url="http://www.gtk.org/"
arch=('any')
pkgdesc="Common C routines used by GTK+ 2.4 and other libs (mingw-w64)"
@@ -21,27 +22,25 @@ source=("http://ftp.gnome.org/pub/GNOME/sources/glib/${pkgver%.*}/glib-${pkgver}
0003-g_abort.all.patch
0004-glib-prefer-constructors-over-DllMain.patch
0005-glib-send-log-messages-to-correct-stdout-and-stderr.patch
0015-fix-stat.all.patch
0017-glib-use-gnu-print-scanf.patch
0021-use-64bit-stat-for-localfile-size-calc.all.patch
0023-print-in-binary-more-for-testing.all.patch
0024-return-actually-written-data-in-printf.all.patch
0027-no_sys_if_nametoindex.patch
0028-inode_directory.patch
0029-grand.all.patch)
md5sums=('83efba4722a9674b97437d1d99af79db'
'98c7778b5e8a30dbcdb86bcd15f9c11d'
'6eb9d56028ea3bbec3d053254a00a04b'
'46969e815f3ab19582ba33667a52048b'
'7b065f9bc154bf996523974a698b24de'
'963a72f6efcaa3405204b76b27b44645'
'29065eb21bc779787080f0529a6c5f96'
'952989e534235721d30b9ee3d89cc225'
'217a997ede1b93ac06f96ed869b74378'
'500f39baea98d98e4a2f877ad56f55a5'
'8bc2941b1a5f082c3532e6f0abfeeb84'
'6c06cdfcbf877fb560e0be393a043d56'
'2d4a7a53cfe9011b12f91c79e0ecc63e')
0029-grand.all.patch
0030-right-wstat-for-64bit.patch)
md5sums=('6d58f9d70893a63e75c2b7df79375ee7'
'10cf1e482b6a1367d79648466f2cf23c'
'27e8188e764eed3b3d565e5fc5746654'
'b3cf766d5e717010a7534c61e53f3204'
'80fb538441701d2dd3ab8bcb13baf90c'
'b66efec303c72876e6e7d25375b8d081'
'f6659fa19dd0395a7a285c84bb75472b'
'3f896edd80eaa9c4e98abca0df6c83bd'
'4aa52b552a6a25b49a1b6f928b3cdafd'
'27ad96697441aabc4a01f881ad9999ea'
'b64390c406d32578e979103eed89232b'
'de0744aac6f847a5031b1dec316911d1')
prepare() {
cd "${srcdir}/glib-${pkgver}"
@@ -49,15 +48,14 @@ prepare() {
patch -Np1 -i "${srcdir}/0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch"
patch -Np1 -i "${srcdir}/0003-g_abort.all.patch"
patch -Np1 -i "${srcdir}/0004-glib-prefer-constructors-over-DllMain.patch"
patch -Np0 -i "${srcdir}/0005-glib-send-log-messages-to-correct-stdout-and-stderr.patch"
patch -Np1 -i "${srcdir}/0015-fix-stat.all.patch"
patch -Np1 -i "${srcdir}/0005-glib-send-log-messages-to-correct-stdout-and-stderr.patch"
patch -Np1 -i "${srcdir}/0017-glib-use-gnu-print-scanf.patch"
patch -Np1 -i "${srcdir}/0021-use-64bit-stat-for-localfile-size-calc.all.patch"
patch -Np1 -i "${srcdir}/0023-print-in-binary-more-for-testing.all.patch"
patch -Np1 -i "${srcdir}/0024-return-actually-written-data-in-printf.all.patch"
patch -Np1 -i "${srcdir}/0027-no_sys_if_nametoindex.patch"
patch -Np1 -i "${srcdir}/0028-inode_directory.patch"
patch -Np1 -i "${srcdir}/0029-grand.all.patch"
patch -Np1 -i "${srcdir}/0030-right-wstat-for-64bit.patch"
NOCONFIGURE=1 ./autogen.sh
}