Commit Graph

5186 Commits

Author SHA1 Message Date
Giovanni Campagna
a9e9bc74c3 Fix annotations of g_compute_hmac_for_data
https://bugzilla.gnome.org/show_bug.cgi?id=765338
2016-07-16 20:40:11 -04:00
Evan Nemerson
ebfbae534b gtestutils: add missing dash in seed argument's --help documentation
https://bugzilla.gnome.org/show_bug.cgi?id=760115
2016-07-16 20:39:18 -04:00
Nirbheek Chauhan
92e3189613 gmacros.h: offsetof is also available on MSVC
All versions since Visual C++ 2005 have this available, so we can just
use it for G_STRUCT_OFFSET.

See: https://msdn.microsoft.com/en-us/library/dz4y9b9a.aspx
2016-07-13 11:44:34 +08:00
Philip Withnall
ae9e72ef61 gmessages: Simplify _g_log_abort() in gmessages.c a little
https://bugzilla.gnome.org/show_bug.cgi?id=744456
2016-06-29 17:18:55 +01:00
Philip Withnall
7ea4949cda gmain: Add G_PID_FORMAT
This will be useful for printing out GPids in printf()-style functions.

https://bugzilla.gnome.org/show_bug.cgi?id=767765
2016-06-29 15:16:52 +01:00
Philip Withnall
c4695f192c build: Rename SystemTap scripts to include the LT version
In a vague attempt at ensuring the .stp scripts can be closely
associated with the .so files which they hard-code references to, rename
the scripts so they include the LT version — so that they are the .so
file name plus .stp.

This does not fix the fact that our .stp scripts will not work on
multiarch systems, as they are installed in an architecture-independent
directory (/usr/share/systemtap/tapset). At the moment, it is
recommended that any distribution who package the .stp files should
install them in the architecture-specific subdirectories of this (for
example, /usr/share/systemtap/tapset/x86-64).

A better long-term solution for this is under discussion upstream:
https://sourceware.org/bugzilla/show_bug.cgi?id=20264

https://bugzilla.gnome.org/show_bug.cgi?id=662802
2016-06-29 14:43:52 +01:00
Cosimo Cecchi
d07e166432 gkeyfile: add g_key_file_load_from_bytes() API
This makes it easier to use GKeyFile from language bindings, and makes
the API more consistent and modern with the new data type available in
GLib.

https://bugzilla.gnome.org/show_bug.cgi?id=767880
2016-06-20 17:53:00 -07:00
Ryan Lortie
7563ab4734 build: simplify dtrace configuration
The ability to pass libtool via $(CC) to dtrace and have it respect this
appears to be a feature that is only present in the systemtap version of
the tool.  In particular, FreeBSD (which seems to be using a copy of the
tool from Solaris) doesn't support this.

The result is that, with $(CC) ignored, and a .lo file specified in -o,
we get an ELF written to the .lo.

Instead of trying to have dtrace run libtool we can have libtool run
dtrace.  dtrace is really just a compiler that produces an object file
here, and it even understands -o, so libtool can make the appropriate
adjustments.

There appears to be some prior art for this approach.  A quick search
shows that at least QEMU is using this approach.  It also appears to
work on Linux with systemtap's dtrace and on FreeBSD.

This may regress cross-compilation because the dtrace command will have
no way of knowing which compiler we intend for it to use to produce the
object file.  I say "may" because I don't know if dtrace ever worked in
the first place under cross-compilation.

https://bugzilla.gnome.org/show_bug.cgi?id=725902
2016-06-20 12:35:47 -04:00
John Ralls
35b401c8bb Bug 767824 - Some UTC timezones incorrectly recognized on Windows 7
The condition removed erroneously excluded UTC-based and DST-less
timezones and so left the GArray with no contents, so GTimeZone functions
returned whatever random garbage was in memory.
2016-06-19 15:03:20 -07:00
Philip Withnall
cfb692825a glib: Add more GLib main context SystemTap and DTrace probes
Expand the set of available probes, and add a few more output parameters
to some of the existing ones to make them more useful. I do not know if
this breaks any existing stability guarantees for GLib’s SystemTap
tapset, as it is effectively just adding some more local variables in
the user’s probe.

https://bugzilla.gnome.org/show_bug.cgi?id=759813
2016-06-15 16:15:12 -04:00
Nikita Churaev
ec40e9d921 gfileutils: Add missing (type filename) annotations
These differentiate between strings in the GLib filename encoding, and
strings in UTF-8.

https://bugzilla.gnome.org/show_bug.cgi?id=700756
2016-06-15 11:04:18 -04:00
Philip Withnall
c91411464e gfileutils: Fix a signed/unsigned integer comparison
Also use size_t rather than int, allowing for larger files to be
handled.

https://bugzilla.gnome.org/show_bug.cgi?id=700756
2016-06-15 10:59:56 -04:00
Christoph Reiter
c9dd204909 Partly revert "glib: Add filename type annotations"
Revert all annotation changes for environment variables and command line
arguments.

See commit 41013a01f4.
2016-06-07 19:48:11 +02:00
Christoph Reiter
41013a01f4 glib: Add filename type annotations
Adds the filename annotation for all file names
and things which can contain file names like
environment variables, argv-

On Unix they can contain anything while on Windows
they are always utf-8.

https://bugzilla.gnome.org/show_bug.cgi?id=767245
2016-06-04 20:38:33 +02:00
Chun-wei Fan
6bd94863d0 glib/gnulib/printf-parse.c: Fix build on Visual Studio 2008
Visual Studio 2008 does not come with stdint.h, so define intmax_t instead
on Visual Studio 2008 so that the code will continue to build.  This was
previously unnoticed as building GTK+ since 3.16 requires an
implementation of stdint.h (such as msinttypes), and it took care of the
need of including the stdint.h header here, but people could be very well
using GLib without using GTK+ 3.x.
2016-05-25 14:13:33 +08:00
Tom Tromey
b7145a1d72 Rename gdb macros with _gdb suffix to avoid ns clashes
glib installs a gdb helper file named `glib.py`.
Then the "hook" file updates `sys.path` and does `import glib`.

This will fail if glib has already been imported into gdb, say
using `from gi.repository import GLib`.  This is due to a namespace clash.

One fix would be to rename the gdb helper files to not clash with
other Python modules.  This should be done for all such helper files.

https://bugzilla.gnome.org/show_bug.cgi?id=760186
2016-05-23 10:52:10 -04:00
Руслан Ижбулатов
6a1e8e8fa7 g_date_time_format_locale: ensure locale encoding is used
Fallback code for g_date_time_format_locale() fetches translated
strings (such as day and month names) from .mo catalogues via
gettext. These strings always come in UTF-8 encoding, because
that is the encoding that glib sets when it initializes gettext
for itself.
However, the non-fallback code uses nl_langinfo() and expects
its results to be in locale-dependent encoding.

This mismatch can result in UTF-8 strings being converted to UTF-8,
producing gibberish.

Fix this by converting UTF-8 strings to locale-dependent encoding
before using them. Also fix the code that was already doing the locale->UTF-8
conversion to not convert the strings when they are already UTF-8-encoded.

https://bugzilla.gnome.org/show_bug.cgi?id=766092
2016-05-16 05:19:10 +00:00
Руслан Ижбулатов
e88796cad0 testsuite: don't forget -DPCRE_STATIC when PCRE is static
https://bugzilla.gnome.org/show_bug.cgi?id=766407
2016-05-14 04:59:39 +00:00
Руслан Ижбулатов
36c47f2a55 testsuite: include pthread.h in thread testfile
https://bugzilla.gnome.org/show_bug.cgi?id=766407
2016-05-14 04:59:39 +00:00
Krzesimir Nowak
89d8dc979b docs: Clarify clearing the builder after ending the build process
There is no need to call g_variant_builder_clear() after the
g_variant_builder_end(). This is mentioned in docs of the former
function, but not in the docs of the latter one. Add them there too.
2016-05-11 10:18:05 -04:00
Iain Lane
bcbd8d73ce Fix the upper bound in g_unichar_iswide_bsearch
asan noticed an array out of bound access in this function, which was
because we were accessing G_N_ELEMENTS + 1.

https://bugzilla.gnome.org/show_bug.cgi?id=766211
2016-05-10 22:43:23 -04:00
Matthias Clasen
9a865020ca Add a few more test cases for g_unichar_iswide 2016-05-10 22:43:15 -04:00
Garrett Regier
c494ae06b7 gsequence: Improve is_end()
Instead of finding the GSequence, just walk up
the tree and determine if the iter is the end node.

https://bugzilla.gnome.org/show_bug.cgi?id=749583
Signed-off-by: Garrett Regier <garrettregier@gmail.com>
2016-05-09 15:55:53 +03:00
Aleksander Morgado
a340a5ef44 docs: improve g_main_context_push_thread_default() documentation
Explicitly suggest to use g_main_context_pop_thread_default() when there's no
user control on the life cycle of the thread being used.

https://bugzilla.gnome.org/show_bug.cgi?id=765173
2016-05-08 14:11:10 +02:00
Matthias Clasen
a17bbbc8a3 doc: Update a few links to the Unicode Standard 2016-05-07 12:38:09 -04:00
Chun-wei Fan
2ca496a2e7 glib/gmacros.h: Fix build on C++ mode in Visual Studio
Later Visual Studio versions does not allow one to define known keywords,
even if they are actually not known to the compiler.  Avoid this issue by
checking more conditions before we define inline as __inline:

-We are not building under C++ mode.
-We are on Visual Studio 2013 or earlier.

Where both of these conditions need to hold true.

https://bugzilla.gnome.org/show_bug.cgi?id=765990
2016-05-05 00:44:48 +08:00
Руслан Ижбулатов
210a9796f7 W32: Do not ignore short waits in g_poll
Do the actual wait dance even if wait timeout is < 10ms. Otherwise
we might busyloop.

https://bugzilla.gnome.org/show_bug.cgi?id=764415
2016-04-28 14:22:51 +00:00
Víctor Manuel Jáquez Leal
96c962de22 glib tests: add pthread flag to 'thread' test
Commit 99bdfd1b introduced a direct call to pthreads_setname_np in the
'thread' test case.  Because we are directly calling pthreads functions
from this file now, we need to make sure we link it with the system
thread library flags (as we already do for another file).

https://bugzilla.gnome.org/show_bug.cgi?id=765712
2016-04-28 11:21:52 +02:00
Emmanuele Bassi
41df41550f utils: Compile g_abort() only on Windows
Otherwise it will break the build on non-Windows because of the macro in
the header, and the unconditional use of Windows-only API.

https://bugzilla.gnome.org/show_bug.cgi?id=665446
2016-04-27 14:55:45 +01:00
Руслан Ижбулатов
e47904a26f Use g_abort() instead of abort() where possible
https://bugzilla.gnome.org/show_bug.cgi?id=665446
2016-04-27 13:17:28 +00:00
Руслан Ижбулатов
5974428d25 Add g_abort()
The new g_abort() macro just expands to abort() on systems where abort()
behaves in a sane way. On other systems (read: Windows) it does its best
to emulate a sane abort() behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=665446
2016-04-27 13:17:27 +00:00
Руслан Ижбулатов
e4aaae4ed6 glib: Add 2.50 availibity macros
https://bugzilla.gnome.org/show_bug.cgi?id=665446
2016-04-27 13:17:27 +00:00
Руслан Ижбулатов
999711abc8 gthread: Better fallback for W32 g_get_num_processors()
https://bugzilla.gnome.org/show_bug.cgi?id=748530
2016-04-26 13:52:45 +00:00
Руслан Ижбулатов
e118856430 Add g_system_thread_set_name() implementation for W32 threads
This works by using semi-documented[1] exception to tell the debugger
that a thread needs to have its name changed.

If this exception is not caught and handled by something, it will crash
the process, so we need to set up our own handler in case there's no
debugger attached or the debugger can't handle this type of exception.

Since SEH is not supported by gcc on i686 (at the moment), we need to use VEH
instead. For completeness the MSVC-oriented code still uses SEH, although
there is no reason why it shouldn't work with the VEH variant used by MinGW.

VEH handler has to be set up somewhere (g_thread_win32_init () works nicely)
and removed once it's not needed (g_thread_win32_process_detach () is added
expressly for that purpose). Note that g_thread_win32_process_detach() is
only called when glib is unloaded by FreeLibrary(), not when glib-using
process is terminating.

This exception is known to work with WinDbg, and adding support for it into
GDB proved to be feasible (GDB patch will be sent upstream, eventually).

[1] https://msdn.microsoft.com/en-us/library/xcb2z8hs%28v=vs.71%29.aspx

https://bugzilla.gnome.org/show_bug.cgi?id=747478
2016-04-26 10:40:07 +00:00
Matthias Clasen
99bdfd1bcb Stop using ptrctl for thread names
We now prefer pthread_setname_np when available, and don't
need the linux specific API anymore. Also change the test
for this functionality to use pthread_getname_np.
2016-04-26 06:35:06 -04:00
Alan Coopersmith
28f0160031 gthread: add thread name support on Solaris
https://bugzilla.gnome.org/show_bug.cgi?id=747478
2016-04-26 06:18:34 -04:00
Emmanuele Bassi
a772c28c95 docs: Clean up the GVariant introduction
Fix the example, as well as the consistency in the terms.

https://bugzilla.gnome.org/show_bug.cgi?id=748806
2016-04-13 09:53:00 +01:00
Phillip Wood
38c4e31c8a Fix documentation typos
Character entities are not supposed to be supported by gtk-doc¹ and
fix the spelling of ‘optional’

¹https://bugzilla.gnome.org/show_bug.cgi?id=758137

https://bugzilla.gnome.org/show_bug.cgi?id=758174
2016-04-11 23:31:38 -04:00
Bastian Ilsø
985ae37d19 gvariant.c: Elaborate on GVariant concept and its use
Inserts a paragraph in the start of the description
explaining briefly the concept of GVariant as a
variant datatypes using examples and explaining
a few use cases where GVariant can be useful.

https://bugzilla.gnome.org/show_bug.cgi?id=748806
2016-04-11 23:28:46 -04:00
Michael Catanzaro
026368add7 Fix a typo 2016-04-07 08:43:24 -05:00
Bastien Nocera
35bd69202d tests: Fix compilation errors due to Y2K format problems
Newer versions of GCC are particularly verbose in relation to
formatting errors, use GCC pragmas to disable warnings for this
section.

gdatetime.c: In function ‘test_strftime’:
gdatetime.c:1334:3: error: ‘%c’ yields only last 2 digits of year in some locales [-Werror=format-y2k]
   "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
   ^
gdatetime.c:1334:3: note: in definition of macro ‘TEST_FORMAT’
   "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gdatetime.c:1334:3: error: ‘%g’ yields only last 2 digits of year [-Werror=format-y2k]
   "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
   ^
gdatetime.c:1334:3: note: in definition of macro ‘TEST_FORMAT’
   "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gdatetime.c:1334:3: error: ‘%x’ yields only last 2 digits of year in some locales [-Werror=format-y2k]
   "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
   ^
gdatetime.c:1334:3: note: in definition of macro ‘TEST_FORMAT’
   "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gdatetime.c:1334:3: error: ‘%y’ yields only last 2 digits of year [-Werror=format-y2k]
   "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
   ^
gdatetime.c:1334:3: note: in definition of macro ‘TEST_FORMAT’
   "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note that the pragma is outside the function as older versions of GCC
don't support pragma inside functions.

https://bugzilla.gnome.org/show_bug.cgi?id=764575
2016-04-04 15:08:31 +02:00
Bastien Nocera
21ad4c800c gstrfuncs: Add test for g_strjoinv() behaviour
https://bugzilla.gnome.org/show_bug.cgi?id=764092
2016-04-04 15:06:57 +02:00
Bastien Nocera
283c565af6 gstrfuncs: Document the behaviour of g_strjoinv()
The behaviour of g_strjoinv() isn't explicitely explained when the array
contains less than 2 items. This removes the guesswork.

https://bugzilla.gnome.org/show_bug.cgi?id=764092
2016-04-04 15:06:57 +02:00
Benjamin Gilbert
41888493f0 Fix thread safety of g_get_language_names()
https://bugzilla.gnome.org/show_bug.cgi?id=748474
2016-03-26 08:52:40 -04:00
Philip Withnall
58f56b2460 gkeyfile: Clear a variable after freeing it
find_file_in_data_dirs() doesn’t actually clear output_path to NULL on
failure, so this prevents a use-after-free on that (fd == -1) error
path.

Spotted by Coverity (CID: #1352981).
2016-03-21 12:35:25 +00:00
Philip Withnall
d8a7d5f168 gmessages: Clarify documentation for G_LOG_LEVEL_CRITICAL
Clarify that it’s a critical //warning//, not a critical something-else.
2016-03-15 12:30:01 +00:00
Marc-André Lureau
37ebc83f7f win32: use wide-char for constants
Use the appropriate type for comparisons and assignment of wide chars.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=762202
2016-03-15 11:14:57 +01:00
Marc-André Lureau
622748680c win32: fix indentation
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=762202
2016-03-15 11:14:57 +01:00
Marc-André Lureau
5be8cab966 win32: use wcslen() return type
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=762202
2016-03-15 11:14:57 +01:00
Marc-André Lureau
a1bcd1e45a win32: fix off-by-one length check
Laszlo Ersek said: "The length check is off by one (in the safe direction); it
should be (nchars >= 2). The processing should be active for the wide string
L"\r\n" -- resulting in the empty wide string --, I believe."

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=762202
2016-03-15 11:14:57 +01:00