Commit Graph

5326 Commits

Author SHA1 Message Date
Philip Withnall
21b6b1fba7 gmessages: Don’t check G_MESSAGES_DEBUG in old logging API
Now that the old logging API forwards through to the new structured
logging API, we don’t need to check the level or domain of a message
against INFO_LEVELS or G_MESSAGES_DEBUG — just pass it straight through
to the new structured logging API writer function.

https://bugzilla.gnome.org/show_bug.cgi?id=775879
2017-03-24 15:08:16 +00:00
Philip Withnall
aebcb15a9b gversionmacros: Add version macros for GLib 2.54
Let the new API season commence.
2017-03-23 16:21:28 +00:00
Philip Withnall
b3362bb834 ghash: Document order of parameters in GEqualFunc usage
See https://bugzilla.gnome.org/show_bug.cgi?id=698064#c15.
2017-03-23 15:55:31 +00:00
Philip Withnall
fb5a07ad39 ghash: Fix gtk-doc syntax in a documentation comment 2017-03-23 15:55:05 +00:00
Philip Withnall
35c0dd2755 gbase64: Fix base-64 stepped encoding with small chunks
If encoding with small chunks such that the call to
g_base64_encode_close() has to deal with 0 < x < 24 bits of remaining
state, the encoding code would not correctly use zeroes to pad out the
state — it would use left-over state from an earlier iteration in the
encoding process.

This resulted in invalid base-64 encodings.

Add a unit test for incremental encoding using different sized chunks
too.

Thanks to Rainier Perske for reporting and analysing the bug.

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

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-03-23 15:34:11 +00:00
Philip Withnall
32aae79db5 gmain: Document that set_ready_time() is safe on destroyed GSources
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=778049
2017-03-23 15:07:49 +00:00
Philip Withnall
c408256b52 gmain: Document threading properties of g_source_is_destroyed()
https://bugzilla.gnome.org/show_bug.cgi?id=778049
2017-03-23 15:03:13 +00:00
Daniel Macks
929e1b1fde Do not build utf8_encode on CARBON platform
utf8_encode is not used by g_utf8_collate_key on this platform.

https://bugzilla.gnome.org/show_bug.cgi?id=780306
2017-03-21 08:43:43 +00:00
Philip Withnall
69b4c72fe5 gutf8: Clarify documentation for g_utf8_get_char_validated()
There is no such thing as ‘no maximum’ when reading a string. It’s got
to end somewhere.

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

https://bugzilla.gnome.org/show_bug.cgi?id=780095
2017-03-20 11:07:48 +00:00
Philip Withnall
1c56a87c08 gutf8: Clarify return values from g_utf8_get_char_extended()
It’s hard to remember what the difference is between -1 and -2, so give
them names.

This introduces no functional changes.

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

https://bugzilla.gnome.org/show_bug.cgi?id=780095
2017-03-20 11:07:48 +00:00
Philip Withnall
e6e38f4b8a gbase64: Document that g_base64_encode_close() does not nul-terminate
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-03-17 11:33:13 +00:00
Philip Withnall
2411b76c5e docs: Fix some DocBook usage in a few gtk-doc comments
<emphasis> and <ulink> tags. Replace them with Markdown.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-03-16 13:50:19 +00:00
Iain Lane
ec02a1875f tests/gdatetime: Use a real rather than invented timezone
The tzdata maintainers had previously invented abbreviations for
timezones. As of their 2017a release, the one we were testing ("BRT")
has been dropped.

Switch to testing PST, which is a real timezone abbreviation.

https://bugzilla.gnome.org/show_bug.cgi?id=779799
2017-03-15 11:06:55 +00:00
Emmanuele Bassi
c68903945d Regenerate the vasnprintf gnulib module imported files
Use gnulibg-tool --lgpl to import the vasnprintf module using the
correct GNU Lesser General Public License, version 2.1 or later, like
the rest of GLib.

https://bugzilla.gnome.org/show_bug.cgi?id=777203
2017-03-09 17:18:55 +00:00
Carlos Sánchez de La Lama
525b33c05f Correct collation key generation on OS X
This ixes bug #673047.
2017-03-08 22:37:29 -05:00
Philip Withnall
424ec6022f gtestutils: Fix a typo in a documentation comment
Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2017-03-05 12:24:37 +00:00
Paolo Borelli
935cd72bdd utf8: add unit test for g_utf8_make_valid 2017-03-04 19:59:37 +01:00
Simon McVittie
e3f59e482b Install gdb Python helpers as data, not as executable scripts
They do not start with the #!/usr/bin/python that would be necessary
to make them run with Python rather than a shell, and they would
not be useful to run anyway: they are libraries to be imported,
not scripts to be run.

Signed-off-by: Simon McVittie <smcv@debian.org>
2017-03-03 20:08:42 +00:00
Paolo Borelli
f559bc01dc Make g_utf8_make_valid optionally take a length
g_utf8_make_valid was turned into a public API this cycle. However
now that it is public we should make the API more generic, allowing
the caller to specify the length. This is especially useful if
the function is called with a string that has \0 in the middle
or for chunks of a strings that are not nul terminated.
This is also consistent with most of the other utf8 utils.

Callers inside glib are updated to the new signature.

https://bugzilla.gnome.org/show_bug.cgi?id=779456
2017-03-02 10:46:51 +01:00
Chun-wei Fan
9aaf7588fc glib/gmessages.c: Fix build when targeting Windows Vista+
In my previous attempt to improve colored console output on Windows, we
called GetFileInformationByHandleEx() directly if we target Vista or
later, but the check macro for doing so via LoadLibrary() had a typo.  Fix
this by correcting the check macro.

Pointed out by Ignacio Casal Quinteiro.
2017-03-02 08:22:49 +08:00
Philip Withnall
001245171b gchecksum: Fix validity checks for GChecksumType
This fixes the unit tests after commit 3e32350b rearranged the enum
order.

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

https://bugzilla.gnome.org/show_bug.cgi?id=771997
2017-02-27 10:19:19 +00:00
Igor Gnatenko
f6db42f698 ghmac: use stable version in documentation
Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
2017-02-26 11:53:22 +01:00
Igor Gnatenko
3e32350b54 gchecksum: don't break ABI by inserting new enum member in the middle
Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
2017-02-26 11:52:17 +01:00
Philip Withnall
77945667f7 ghmac: Add support for G_CHECKSUM_SHA384 to GHmac
It has the same block size as SHA-512, so it just needs a new case in
the switch, some documentation updates, and the test vectors from RFC
4868.

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

https://bugzilla.gnome.org/show_bug.cgi?id=771997
2017-02-20 12:40:26 +01:00
Igor Gnatenko
1f9a9f8ce5 gchecksum: add SHA-384 support
Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
2017-02-20 12:40:26 +01:00
Bastien Nocera
4b75333c83 guuid: Remove support for curly braces and URN UUIDs
As we currently cannot generate UUIDs with curly braces, or as URNs,
remove those from the possible valid UUIDs.

We do this separately to make it easier to re-add later, should we want
to enhance the coverage of our UUID functions.

https://bugzilla.gnome.org/show_bug.cgi?id=639078
2017-02-06 14:40:38 +01:00
Bastien Nocera
215c9b7951 guuid: Add UUID helper functions to GLib
Many UUID users will just need a random string, which can be generated
simply by calling the function g_uuid_string_random().

Based on original patch by
Marc-André Lureau <marcandre.lureau@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=639078
2017-02-06 14:40:38 +01:00
Philip Withnall
edc68f2659 gkeyfile: Be more specific about error codes in documentation
It’s hard to know whether trying to load a non-existent key file will
result in G_KEY_FILE_ERROR_NOT_FOUND or G_FILE_ERROR_NOENT; try to
improve the documentation to clarify that.

https://bugzilla.gnome.org/show_bug.cgi?id=777135
2017-02-05 15:03:57 +01:00
Philip Withnall
24d1575b8d gkeyfile: Clarify handling of out-of-range integers in documentation
Clarify that g_key_file_get_integer() and g_key_file_get_integer_list()
both return G_KEY_FILE_ERROR_INVALID_VALUE if used to load a valid
integer which is out of range for a gint.
2017-01-24 13:19:58 +00:00
Bastien Nocera
810a6eb1d6 gfileutils: Mention g_dir_make_tmp() in g_mkdtemp*() docs
https://bugzilla.gnome.org/show_bug.cgi?id=777493
2017-01-24 11:05:31 +01:00
Philip Chimento
4fbcd18bdf introspection: Skip g_mkdtemp() and friends
Based on bugs [1] and [2], gobject-introspection does not handle the
same string being 1) returned from an inout argument and 2) returned
as the function's return value, and is not going to.
Therefore, these functions should be skipped in introspection.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=679351
[2] https://bugzilla.gnome.org/show_bug.cgi?id=679362

https://bugzilla.gnome.org/show_bug.cgi?id=777493
2017-01-24 11:04:28 +01:00
Philip Withnall
b001f59206 gvariant: Add example to docs for g_variant_builder_open()
Try to clarify that the type is the type of the container, not of the
items with in it; and give an example of how to use it for nested types.

https://bugzilla.gnome.org/show_bug.cgi?id=777592
2017-01-24 09:50:01 +00:00
Bastien Nocera
bc8361262b gfileutils: Fix g_mkdtemp*() API docs
Don't refer to g_mkdtemp() when documenting g_mkdtemp_full() and
speaking about the function itself, and remove mention of flags in
aforementioned g_mkdtemp_full(), as it doesn't have such an argument
(but g_mkstemp_full() does).

https://bugzilla.gnome.org/show_bug.cgi?id=777493
2017-01-23 14:33:11 +01:00
Philip Withnall
2c35acff7b gregex: Fix an assignment-after-free error
The match_info is freed just above this line, so this would result in a
write to freed memory.

Spotted by Leslie Zhai <xiangzhai83@gmail.com>.

https://bugzilla.gnome.org/show_bug.cgi?id=777077
2017-01-12 09:04:39 +00:00
Philip Withnall
88e977266b gregex: Fix a potential use-after-free bug
If the match_info out argument is NULL, info will be freed, but then its
matches member will be accessed.

Spotted by Leslie Zhai <xiangzhai83@gmail.com>.

https://bugzilla.gnome.org/show_bug.cgi?id=777077
2017-01-12 09:04:38 +00:00
Chun-wei Fan
6dfc6fee7b Visual Studio builds: Move project files to win32/
It was suggested that the project files be moved here as we don't actually
need to go two directory layers from $(srcroot), and would help us to
standardize on things in the future across the board.
2017-01-09 14:00:46 +08:00
Sébastien Wilmet
6231b1abc9 License headers: replace current FSF address by a link to gnu.org
Even if the address is correct, it's far more convenient to have a link
to a website.

https://bugzilla.gnome.org/show_bug.cgi?id=776586
2017-01-04 19:12:57 +01:00
Sébastien Wilmet
46c0c5cd85 License headers: replace old FSF address by a link to gnu.org
https://bugzilla.gnome.org/show_bug.cgi?id=776586
2017-01-04 19:12:57 +01:00
Sébastien Wilmet
f60590534d License headers: "the Gnome Library" -> "this library"
Harmonize a little the license headers. In most of the license headers
in GLib, it is "this library".

It is also what is explained at:
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html#SEC4
"How to Apply These Terms to Your New Libraries"

https://bugzilla.gnome.org/show_bug.cgi?id=776586
2017-01-04 19:12:56 +01:00
Sébastien Wilmet
8edcf67b02 License headers: "GLib" -> "This library"
Harmonize a little the license headers. In most of the license headers
in GLib, it is "This library".

It is also what is explained at:
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html#SEC4
"How to Apply These Terms to Your New Libraries"

https://bugzilla.gnome.org/show_bug.cgi?id=776586
2017-01-04 19:12:56 +01:00
Sébastien Wilmet
e603035d13 License headers: "The GLib Library" -> "This library"
Harmonize a little the license headers. In most of the license headers
in GLib, it is "This library".

It is also what is explained at:
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html#SEC4
"How to Apply These Terms to Your New Libraries"

https://bugzilla.gnome.org/show_bug.cgi?id=776586
2017-01-04 19:12:56 +01:00
Shawn Walker
9b3cb4470d Remove stray semicolon after g_variant_print() function in gvariant.c
https://bugzilla.gnome.org/show_bug.cgi?id=776198

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2016-12-27 20:49:42 +01:00
Sjoerd Simons
e097619327 Assert threads are created in test 642026
We kept seeing the glib testsuite hanging on our CI system in the
testcase for 642026. After some digging it turned out the jenkins slave
was misconfigured and its task limit was too low.

Add an assertion that the test thread has been created to more easily
spot this error condition as opposed to the test simply hanging.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>

https://bugzilla.gnome.org/show_bug.cgi?id=769672
2016-12-27 20:43:17 +01:00
Chun-wei Fan
7518067cec gmessages.c: Windows: Improve g_log_writer_supports_colors()
... when tty terminal emulators (such as mintty) are used.  This support
is however for Vista and later, so use of such terminals should have
support for ANSI color codes in their outputs, even on Windows 7/8/8.1/

https://bugzilla.gnome.org/show_bug.cgi?id=775468
2016-12-08 22:15:47 +08:00
Sebastian Dröge
620b3c1e56 gmessages: Fix compilation on Android
There is no systemd on Android.

https://bugzilla.gnome.org/show_bug.cgi?id=775621
2016-12-05 12:12:50 +02:00
Chun-wei Fan
7a61a94b95 gmessages.c/Windows: Improve g_log_writer_supports_color()
Windows 10 begins to support color output on the console using ANSI
codes, but a few extra steps are required for this support, so we cannot
just use isatty() and expect colors to work in the outputs.
Instead, we use still use isatty() from the Windows CRT, and then enable
ENABLE_VIRTUAL_TERMINAL_PROCESSING if it returns true.

Also make the invalid parameter handler shared between gmessages.c and
gspawn-win32-helper.c, since it is basically intended to be a no-op stub.

https://bugzilla.gnome.org/show_bug.cgi?id=775468
2016-12-05 16:47:09 +08:00
Simon McVittie
4496ef91b5 g_hostname_is_ip_address: detect integer overflow
Signed integer overflow is undefined behaviour, which the undefined
behaviour sanitizer detects.

Previously, if the compiler had implemented this in the obvious way
(overflowing signed multiplication wraps around mod 2**32), we would
have incorrectly classified addresses where one octet was, for example,
(2**32 + 42) as valid IP addresses, by treating that octet as though
it was 42.

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
Reviewed-by: Colin Walters
2016-12-02 19:10:45 +00:00
Simon McVittie
1d697a5f30 g_unichar_iswide_cjk: add a special case for U+0000
bsearch() is defined to search for a non-null key, so we can't
search for NULL. The undefined behaviour sanitizer picks this up.

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
Reviewed-by: Colin Walters
2016-12-02 19:10:44 +00:00
Simon McVittie
e5ed410c8c Avoid calling Standard C string/array functions with NULL arguments
glibc string.h declares memcpy() with attribute(nonnull(1,2)), causing
calls with NULL arguments to be treated as undefined behaviour.
This is consistent with ISO C99 and C11, which state that passing 0
to string functions as an array length does not remove the requirement
that the pointer to the array is a valid pointer.
gcc -fsanitize=undefined catches this while running OSTree's test suite.

Similarly, running the GLib test suite reports similar issues for
qsort(), memmove(), memcmp().

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
Reviewed-by: Colin Walters
2016-12-02 19:10:39 +00:00
Philip Withnall
3e7b5cbef8 glib: Namespace global tapset variables by soname
global variables in SystemTap are shared between all SystemTap scripts;
so if scripts are loaded for two versions of GLib (for example, a stable
and a development version), those global variables will conflict.

Avoid that by including the soname’s version in the global variable
names.

https://bugzilla.gnome.org/show_bug.cgi?id=770646
2016-11-23 10:50:39 +00:00