Commit Graph

20404 Commits

Author SHA1 Message Date
Nirbheek Chauhan
be56d90fe9 gmodule: Add support for loading UWP packaged DLLs
LoadLibrary() is not available when building for the Universal Windows
Platform, which is used for shipping apps to the Windows Store on all
devices (Windows Desktop, Windows Phone, Surface, XBox, etc).

Apps are not allowed to load arbitrary DLLs from the system. The only
DLLs they can load are those that are bundled with the app as assets.
LoadPackagedLibrary() can be used to access those assets by filename.

The function is meant to be a drop-in replacement for LoadLibrary(),
and the HANDLE returned can be treated the same as before.
2019-06-26 22:59:19 +05:30
Nirbheek Chauhan
cdc2a798cf uwp: workaround a false positive in certification of glib
It seems that the Windows App Certification Kit searches all files and
binaries for the regex '\<reg\>' (or something like it) and throws
errors if it exists. Supposedly this is for preventing apps from
running REG.EXE

https://blogs.msdn.microsoft.com/appconsult/2017/08/16/how-to-validate-if-your-application-is-compliant-with-the-windows-store-polices-windows-10-and-windows-10-s/
2019-06-25 13:09:04 +05:30
Philip Withnall
c411d0aa6d Merge branch 'fix-mkenums-genmarshal-test-windows' into 'master'
GObject: Fix mkenums.py and genmarshal.py tests on Windows

See merge request GNOME/glib!948
2019-06-24 16:47:30 +00:00
Philip Withnall
bc4d9d7126 Merge branch 'fix-gobject-signals-test-windows' into 'master'
gobject/tests/signals.c: Fix tests on Windows

See merge request GNOME/glib!947
2019-06-24 16:39:44 +00:00
Philip Withnall
aef72f4356 Merge branch 'wip/lantw/dont-limit-host-name-to-99-bytes' into 'master'
gutils: Don't limit the length of the host name to 99

See merge request GNOME/glib!944
2019-06-24 16:18:59 +00:00
Chun-wei Fan
75e3f92cd0 GObject: Fix mkenums.py and genmarshal.py tests on Windows
The two test scripts actually assumed some *NIX paradigms, so we need
to adapt them so that they can work on Windows as well, the changes are
namely:

-Call the glib-mkenums and glib-genmarshal Python scripts with the
 Python interpreter, not just relying on shebang lines, on Windows.
 This is because the native Windows console (cmd.exe) does not support
 shebang lines, for subprocess.run().

-Use NamedTemporaryFile with delete=False, otherwise Windows cannot find
 the temp files we need when running the tests.

-Use universal_newlines=True for subprocess.run() so that we do not need
 to worry out line ending differences on different systems.

-Make sure we are not in the temp directories we create, where the tests
 are being run, upon cleanup.  Windows does not like deleting
 directories that we are currently in.
2019-06-25 00:04:48 +08:00
Chun-wei Fan
108a8d842f gobject/tests/mkenums.py: Fix _write_rspfile()
The 'return f.name' should be in the same level as the body of
'with tempfile.NamedTemporaryFile(...) as f:'
2019-06-25 00:03:09 +08:00
Chun-wei Fan
e1e1e8ee1c gobject/tests/signals.c: Fix tests on Windows
On Windows and possibly other platforms the '%p' printf modifier does
not prefix printed values with '0x', so do not expect the warning
message to contain the '0x' prefix for the handler pointer value.
2019-06-25 00:01:02 +08:00
Ting-Wei Lan
446ba28d31 gutils: Don't limit the length of the host name to 99
It is unclear that why the size of the buffer was chosen to be 100
because the commit introduced the code didn't mention the reason.
POSIX defines _POSIX_HOST_NAME_MAX to be 255 and provides a way to
determine the suitable value with sysconf, so we should use it instead
of hard-coding a small value.
2019-06-24 23:41:40 +08:00
Philip Withnall
bd5922db09 Merge branch 'fix-stack-overrun' into 'master'
Avoid overrunning stack at the end of the varargs.

See merge request GNOME/glib!945
2019-06-24 13:27:33 +00:00
John Ralls
633e9e0bcb Avoid overrunning stack at the end of the varargs. 2019-06-21 16:18:40 -07:00
Philip Withnall
84d0af4226 Merge branch '1811-unicode-annotations' into 'master'
gunidecomp: Add (out) annotations to g_unichar_{de,}compose()

Closes #1811

See merge request GNOME/glib!936
2019-06-21 17:02:58 +00:00
Philip Withnall
9d668a6a86 Merge branch '872-ucs-annotations' into 'master'
Add missing (transfer) annotations to gutf8.c functions

Closes #872

See merge request GNOME/glib!938
2019-06-21 17:01:11 +00:00
Philip Withnall
68feec9ce9 Merge branch 'listmodel-docs' into 'master'
list model: Expand items-changed docs

See merge request GNOME/glib!941
2019-06-21 16:55:15 +00:00
Matthias Clasen
99764fd8fa list model: Expand items-changed docs
Point out explicitly that positions change
when ::items-changed is emitted.
2019-06-21 15:53:51 +00:00
Philip Withnall
1bd72404ba Merge branch 'master' into 'master'
Add g_timer_is_active

Closes #1794

See merge request GNOME/glib!929
2019-06-21 10:22:42 +00:00
Tristan Partin
b9988e5fc9 Add g_timer_is_active
Helper function for exposing the internal state of a GTimer.
2019-06-21 10:22:41 +00:00
Philip Withnall
8f6e5f1b01 gutf8: Add various missing (transfer) annotations
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #872
2019-06-21 11:05:11 +01:00
Philip Withnall
5380f417dc gunidecomp: Fix a (nullable) annotation which should be (optional)
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #872
2019-06-21 11:04:35 +01:00
Philip Withnall
92cd91cee6 Merge branch 'ignore_pycache_directories' into 'master'
Ignore */__pycache__/* directories

See merge request GNOME/glib!935
2019-06-21 09:37:55 +00:00
Emmanuel Fleury
9dab582f9c Prevent taptestrunner to create a __pycache__ directory 2019-06-21 09:13:11 +02:00
Philip Withnall
79502febe0 gunidecomp: Add (out) annotations to g_unichar_{de,}compose()
The `(out)` and (unusually) `(not optional)` annotations were missing.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1811
2019-06-20 23:33:58 +01:00
Philip Withnall
5c5920d968 Merge branch 'fix-fileutils-test-windows' into 'master'
glib/tests/fileutils.c: Fix stdio Wrapper Test on Windows

See merge request GNOME/glib!931
2019-06-19 08:44:39 +00:00
Philip Withnall
213b41e5a4 Merge branch 'fix-convert-tests-windows' into 'master'
glib/tests/convert.c: Skip tests that aren't meaningful for Windows

See merge request GNOME/glib!930
2019-06-19 08:42:30 +00:00
Chun-wei Fan
7a72d3bbae glib/tests/fileutils.c: Fix stdio Wrapper Test on Windows
The g_creat() call was done in *nix style in regards to the mode parameter,
which the Windows CRT isn't going to understand (nor like, on newer CRTs).

Update the program such that it will pass, by using Windows-style
permission mode parameters for g_creat(), on Windows.
2019-06-19 11:21:20 +08:00
Chun-wei Fan
6e224f7677 glib/tests/convert.c: Skip tests that aren't meaningful for Windows
On Windows, everything is assumed as UTF-8 in g_get_filename_charsets(),
so setting G_FILENAME_ENCODING envvar has no effect, so we can just skip
the test on g_get_filename_charsets() where we try to influence it by
setting the G_FILENAME_ENCODING envvar.
2019-06-19 10:55:17 +08:00
Daniel Mustieles
5393f34b8e Updated Spanish translation 2019-06-18 14:52:18 +02:00
Philip Withnall
f8bad07319 Merge branch 'gdbusproxy_prefixes_unstripped_error' into 'master'
gdbus: proxy : Strip remote error on activation failure

Closes #804

See merge request GNOME/glib!925
2019-06-18 10:30:37 +00:00
Philip Withnall
1888deecfc Merge branch 'glib.fixtools.i18n' into 'master'
Tools: Correctly show translated messages on more recent Visual Studio builds

Closes #1169

See merge request GNOME/glib!895
2019-06-18 10:18:31 +00:00
Philip Withnall
b9e27b77ad Merge branch 'wip/chergert/marshall-matters' into 'master'
gio: specify proper c_marshaller and va_marshallers

See merge request GNOME/glib!877
2019-06-18 10:07:59 +00:00
Chun-wei Fan
3046f7b3bb gio-tool.c: Don't hardcode localedir on Windows
We ought to construct the localedir based on the location of the GLib
DLL, like what the other tools do.
2019-06-18 17:29:41 +08:00
Chun-wei Fan
9f709fe1e9 gio tools: Use the proper string for default locale for setlocale()
This makes use of the string we now have from glib-private.h in the
last commit so that setlocale() sets the default system locale
correctly and therefore show the translated messages properly.

Fixes issue #1169.
2019-06-18 17:29:41 +08:00
Chun-wei Fan
3e5d1bd6ff glib-private.h: Set the appropriate string for setlocale()
On Windows, in particular the CRTs on and after Visual Studio 2012, it
is not enough just to do setlocale (LC_ALL, "") to set the default
system locale, which results in the tools that use the translated
messages to show unreadable messages when running the commmand line
tools.

This adds an entry in glib-private.h.in which denotes the appropriate
string to use for setlocale() to set the default system locale by
setting it to ".ACP" if we are building on Windows and "" for
other systems (as we are doing now).

The tools in gio/ will be updated in the next commit to make use of this
entry so that the translated messages can be shown correctly.
2019-06-18 17:29:36 +08:00
Philip Withnall
8c990d9889 Merge branch 'fix-refcount-macro-non-gcc' into 'master'
glib/tests/refcount.c: Fix tests on non-GCC-isque compilers

See merge request GNOME/glib!919
2019-06-18 09:03:12 +00:00
Emmanuel Fleury
ca7a29e8e0 gdbus: proxy : Strip remote error on activation failure
Original patch proposed by Christian Persch

Related to issue #804
2019-06-18 10:54:09 +02:00
Chun-wei Fan
bf40b7c746 glib/tests/refcount.c: Only expect saturation tests to pass on GCC
From grefcount.h, in order to disable warnings when G_DISABLE_CHECKS is
defined, we need to make use of the GCC-isque-only __extension__ for it
to work.  This means that in the saturation tests, we can only expect no
warnings to show if we are building on GCC-isque compilers with
G_DISABLE_CHECKS defined.

This will fix the refcount-macro test on Visual Studio builds at least.
2019-06-18 16:42:51 +08:00
Christian Hergert
22ba4411cc gio: remove use of generic marshaller from GIO objects
Using the generic marshaller has drawbacks beyond performance. One such
drawback is that it breaks the stack unwinding from the Linux kernel due
to having unsufficient data to walk past ffi_call_unixt64. That means that
performance profiling by application developers looks grouped among
seemingly unrelated code paths.

While we can't fix the kernel unwinding here, we can provide proper
c_marshallers and va_marshallers for objects within Gio so that
performance profiling of applications is more reliable.

Related to GNOME/Initiatives#10
2019-06-17 16:29:09 -07:00
Christian Hergert
273c00f620 gio: ensure default va_marshaller is used
If c_marshaller is provided during g_signal_new() registration, the
automatic va_marshaller will not be set. If we leave the c_marshaller as
NULL in the simple cases, both a c_marshaller and va_marshaller will be
set for us.

This is particularly helpful when dealing with stack traces from Linux
perf, which often cannot unwind the stack beyond the ffi_call_unix64
stack-frame on x86_64.

Related to GNOME/Initiatives#10
2019-06-17 16:13:53 -07:00
Christian Hergert
2a4b5caac2 gobject: remove use of generic marshaller from GObject
Using the generic marshaller has drawbacks beyond performance. One such
drawback is that it breaks the stack unwinding from the Linux kernel due
to having unsufficient data to walk past ffi_call_unixt64. That means that
performance profiling by application developers looks grouped among
seemingly unrelated code paths.

Related to GNOME/Initiatives#10
2019-06-17 16:13:53 -07:00
Christian Hergert
d7c1d477bc gdbusobjectmanager: store signal ids for re-use
Having access to the signal-id is useful when we want to specify additional
signal related settings (such as va_marshaller).
2019-06-17 16:13:53 -07:00
Christian Hergert
266a292a35 gsignal: update documentation about va_marshaller
If we specify a c_marshaller, g_signal_newv() will never assign an
va_marshaller automatically. So either use NULL (for simple cases), or
specify both to avoid the generic performance penalty.
2019-06-17 14:07:26 -07:00
Simon McVittie
833d38b40f Merge branch 'mcatanzaro/gdbus-dir-addresses' into 'master'
gdbus: support unix:dir= addresses, and related cleanups

Closes #1808

See merge request GNOME/glib!911
2019-06-17 18:06:11 +00:00
Michael Catanzaro
30524fbdb5 gdbusserver: properly escape all components of server address
https://gitlab.gnome.org/GNOME/glib/merge_requests/911#note_530668
2019-06-17 12:08:06 -05:00
Michael Catanzaro
16cdda5d35 gdbus: run peer test multiple times with different addresses
This ensures that D-Bus connections established with unix:dir and
unix:path addresses actually work properly. Previously, we only tested
unix:tmpdir and TCP addresses.
2019-06-17 12:08:06 -05:00
Michael Catanzaro
eca16677c0 gdbus: Fix minor leak in peer test
This has to be freed even on Windows.
2019-06-17 12:08:06 -05:00
Michael Catanzaro
beac9fe211 gdbus: Clean up sockets and nonces from filesystem
When we close the GDBusServer, it should remove any non-abstract Unix
sockets or TCP nonce files it created from the filesystem.

Fixes #1808
2019-06-17 12:08:06 -05:00
Michael Catanzaro
f5631ecb94 gdbus: improve an error message
Namespace is one word.
2019-06-17 12:08:06 -05:00
Michael Catanzaro
99b580a0b2 gdbus: Stop server on dispose
This is not going to have much any effect currently since stop() just
disconnects a signal handler (that is going to be disconnected in
finalize anyway) and stops the socket service (that is going to be
destroyed in finalize), but it makes sense to do here for robustness.
2019-06-17 12:08:06 -05:00
Michael Catanzaro
fc597fa5f9 gdbus: support unix:dir= addresses
unix:dir= addresses are exactly the same as unix:tmpdir= addresses,
already supported by GDBus, except they forbid use of abstract sockets.
This is convenient for situations where abstract sockets are
impermissible, such as when a D-Bus client inside a network namespace
needs to connect to a server running in a different network namespace.
An abstract socket cannot be shared between two processes in different
network namespaces.

Applications could use unix:path= addresses instead, so this is only a
convenience, but there's no good reason not to support unix:dir=.
Currently it is not supported simply because unix:dir= is a relatively
recent addition to the D-Bus spec.
2019-06-17 12:07:10 -05:00
Michael Catanzaro
6a5c4252cd Merge branch '940-socket-listener-docs' into 'master'
gsocketlistener: Clarify when g_socket_listener_set_backlog() works

Closes #940

See merge request GNOME/glib!921
2019-06-17 17:05:42 +00:00