Commit Graph

14513 Commits

Author SHA1 Message Date
Chun-wei Fan
b9322bf9ab gio/tests/memory-output-stream.c: Avoid an uninitialized variable
Be a little bit more careful in regards to initializing a primitive type
variable before passing it by reference, as it could have random stuff
in the variable's address depending on the CRT, such as MSVCR110.DLL,
causing random, invalid stuff being written in that address.

This will fix this test when built with Visual Studio 2012.

https://bugzilla.gnome.org/show_bug.cgi?id=711047
2013-11-27 08:01:47 +08:00
Chun-wei Fan
29b66e1458 glib/tests/enviroment.c: Fix running on Windows
Don't attempt to insert environmental variables in the hash table during
the test listenv that is an empty string, as GetEnvironmentStringsW() also
returns special enviroment variables which have empty strings as their
variable names, at least on Windows 7 and 8.

https://bugzilla.gnome.org/show_bug.cgi?id=711047
2013-11-27 08:01:46 +08:00
Michael Natterer
32cfcc8740 gio: remove precondition checks from g_output_stream_printf()
because we call g_output_stream_vprintf() which does exactly the same
checks.
2013-11-26 23:00:52 +01:00
Stef Walter
c9cfa7d1d5 gthread-posix: Don't use gslice allocated GRecMutex
This leads to problems during cleanup, and seems strange
to have locks defined in terms of things that need locking.

https://bugzilla.gnome.org/show_bug.cgi?id=711753
2013-11-26 20:23:48 +01:00
Michael Natterer
d86396f21f gio: add g_output_string_[v]printf()
which are useful for porting FILE* based output code.
2013-11-26 11:51:24 +01:00
Chun-wei Fan
a997cfe90f gio/gdbusauthmechanismsha1.c: Move G_OS_* checks down
The G_OS_* checks are only valid if the GLib headers have been previously
included, so that io.h can be included properly on Windows
2013-11-26 13:16:15 +08:00
Colin Walters
03bf43e14a gsubprocess: Document g_subprocess_get_identifier() 2013-11-25 18:39:46 -05:00
Daniel Mustieles
ed1df0ea59 Updated Spanish translation 2013-11-25 17:27:43 +01:00
Philip Withnall
299bcbfa41 gsubprocess: Fix potential strlen(NULL) calls
Also clarify the nullability of stdin_buf arguments in GSubprocess
communication calls.

Found with scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=715164
2013-11-25 15:46:51 +00:00
Marc-André Lureau
d6a19d2e76 utf8: report allocation error
Make some of the conversion functions a bit more friendly to allocation
failure.

Even though the glib policy is to abort() on allocation failure by
default, it can be quite helpful to return an allocation error for
functions already providing a GError.

I needed a safer g_utf16_to_utf8() to solve crash on big clipboard
operations with win32, related to rhbz#1017250 (and coming gdk handling
bug).

https://bugzilla.gnome.org/show_bug.cgi?id=711546
2013-11-25 12:07:57 +01:00
Chun-wei Fan
0dbe5c43df msvc_recommended_pragmas.h: Treat C4819 warnings as errors
Warning C4819 in Visual Studio builds indicates an issue of Visual Studio
2005 and later running on East Asian locales of Windows, which likely
results in broken builds of GLib, Pango, GTK+, and possibly other GNOME
projects such as Cogl and Clutter (and is also an issue when building other
projects like QT and Firefox).

Treat this warning as an error as a result when building GLib-based items
on Visual Studio, and tell people how to remedy this issue correctly.
2013-11-25 15:26:25 +08:00
Dan Winship
3d70db0750 Reorganize the "don't dump core from test subprocesses" code.
g_test_init() was calling _g_messages_set_exit_on_fatal() from
subprocesses, to make fatal log messages call _exit() rather than
abort(), but the function name is sort of confusing, and we don't
really need it anyway, since g_log() can just call g_test_subprocess()
instead and decide for itself.

Likewise, update g_assertion_message() to do the check itself, rather
than calling into gmessages to do it, and fix
g_assertion_message_expr() to also check whether it should exit or
abort. (Previously it always called abort(), although this didn't
actually matter since that was dead code until
test_nonfatal_assertions was added.)

https://bugzilla.gnome.org/show_bug.cgi?id=711800
2013-11-24 15:14:13 -05:00
Dan Winship
97fac93670 gtestutils: add g_assert_nonnull() to go with g_assert_null()
https://bugzilla.gnome.org/show_bug.cgi?id=711800
2013-11-24 14:59:51 -05:00
Dan Winship
f4c30feb95 gtestutils: fix g_test_set_nonfatal_assertions()
g_test_set_nonfatal_assertions() was a no-op, because
g_assertion_message() wasn't actually checking the
test_nonfatal_assertions flag. Fix that and add a test.

Also, g_test_set_nonfatal_assertions() has to set test_mode_fatal to
FALSE as well, or else a failed assertion will cause the test program
to abort at the end of the failed test.

Also, belatedly add this and the new g_assert_* methods to the docs.

https://bugzilla.gnome.org/show_bug.cgi?id=711800
2013-11-24 14:59:51 -05:00
Matthias Clasen
910191597a Add boolean returns to some hash functions
The functions g_hash_table_insert, g_hash_table_replace
and g_hash_table_add now return TRUE if they inserted a
new key/value pair.

https://bugzilla.gnome.org/show_bug.cgi?id=697828
2013-11-24 01:22:44 -05:00
Matthias Clasen
616af3b80e Avoid a compiler warning 2013-11-24 00:59:35 -05:00
Manuel Bachmann
1fb4b3b2bf Fix G_OS #ifdefs in gbusserver.c
G_OS #ifdefs are only available once glibconfig.h has been
evaluated ; that is, after including glib headers.
Move this block down so it gets correctly evaluated.
2013-11-24 04:51:21 +01:00
Matthias Clasen
5efc038e0d Fix up appinfo test
Make it possible to skip the terminal-launching test simply
by setting DISPLAY= . Previously, you had to unset DISPLAY,
which is a little more cumbersome.

https://bugzilla.gnome.org/show_bug.cgi?id=711178
2013-11-23 22:24:51 -05:00
Matthias Clasen
0fc0754e65 Fix up the appinfo test
One testcase was launching appinfo-test from a GAppInfo that
does not have a filename. In this case, the G_LAUNCHED_DESKTOP_FILE
envvar is not exported. Make appinfo-test deal with that, without
spewing warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=711178
2013-11-23 22:21:29 -05:00
Matthias Clasen
0250d185b1 Fix warnings in a the actions test
The actions test tests the GSimpleActionGroup API. Maybe this
should be moved to use GActionMap, but for now, just disable
the deprecations.

There was also one test that wasn't actually hooked up, so
do that as well.
2013-11-23 21:28:40 -05:00
Matthias Clasen
dedc990e28 Fix array API inconsistency
g_array_remove_range and g_byte_array_remove_range return
a pointer to the array, g_ptr_array_remove_range returns
void. Since it is pretty harmless, make it return the array
too.

https://bugzilla.gnome.org/show_bug.cgi?id=159528
2013-11-23 21:10:06 -05:00
Matthias Clasen
698393f15d Fix the stack direction check again
Turns out I got it wrong.
2013-11-23 21:09:32 -05:00
Matthias Clasen
341c0b1988 Improve stack direction detection
When the function in the test program is inlined, all bets are
off whether the detection will work correctly or not. Make it
harder for the compiler to play games on us by making the
function recursive.

https://bugzilla.gnome.org/show_bug.cgi?id=307947
2013-11-23 20:27:04 -05:00
Matthias Clasen
df71ecfc2d Fix the configure check for growing stack
The check was getting the direction wrong, as proven by the
just committed signal invocation hint test.

https://bugzilla.gnome.org/show_bug.cgi?id=711871
2013-11-23 20:26:10 -05:00
Matthias Clasen
e81e33b35d Add a test for g_signal_get_invocation_hint
This is the sole piece of code in GLib where we make use of the
stack growing direction. And this test proves that we have been
getting the direction wrong all these years...
2013-11-23 20:06:07 -05:00
Christian Persch
bd8fb391aa application: Use printerr for runtime errors
g_critical can be fatal (with --g-fatal-warnings, or some env var set),
so don't use it to print out runtime errors.

Bug #676761.
2013-11-23 18:16:41 -05:00
Matthias Clasen
e45372895d Fix desktop-app-info test
The recent change to the search scoring algorithm made
nautilus and konqueror switch places in the search results.
Update the test to reflect that.
2013-11-23 18:15:04 -05:00
Stef Walter
baf92d09d6 gtestdbus: Properly close server connections
Otherwise g_test_dbus_down() following a g_test_dbus_stop()
will hang until it times out.

https://bugzilla.gnome.org/show_bug.cgi?id=711807
2013-11-23 17:37:58 -05:00
Matthias Clasen
f16045c9cf Add a test for notify emission ordering
This tests the ordering that was just documented.
See

https://bugzilla.gnome.org/show_bug.cgi?id=607016
2013-11-23 16:58:51 -05:00
Matthias Clasen
429010b15c Document details of GObject::notify
The signals queued while notify is frozen are emitted in
reverse order, while omitting duplicates. The lack of documentation
for this was pointed out in

https://bugzilla.gnome.org/show_bug.cgi?id=607016
2013-11-23 16:44:31 -05:00
Stef Walter
5a5aaa203a gdbus-connection: Fix race condition in test
The test was expecting that the spawned process wouldn't start
up before the NameOwnerChanged signal was subscribed.

https://bugzilla.gnome.org/show_bug.cgi?id=711805
2013-11-23 15:20:51 -05:00
Lars Uebernickel
65da592249 Add basic test for the GNotification gtk backend
https://bugzilla.gnome.org/show_bug.cgi?id=711051
2013-11-23 15:11:09 -05:00
Stef Walter
797959f05a gtestdbus: Don't destroy GSource twice
https://bugzilla.gnome.org/show_bug.cgi?id=711806
2013-11-23 13:47:29 -05:00
Gergely POLONKAI
047d9ce6f2 GObject: Introspection annotations for enums
This commit adds a few missing annotations to g_enum and
g_flags functions.

https://bugzilla.gnome.org/show_bug.cgi?id=708274
2013-11-23 13:36:55 -05:00
Bastien Nocera
aef0adc0dd GSettings: More docs for deprecated _list_schemas()
Most _list_schemas() uses were to check for the availability
of a particular schema. g_settings_schema_source_lookup() is
a better way to do this.

https://bugzilla.gnome.org/show_bug.cgi?id=712315
2013-11-23 13:35:52 -05:00
Matthias Clasen
3309055878 GVariantBuilder: small documentation fixes
The examples for g_variant_builder_add and
g_variant_builder_add_parsed were leaking a heap-allocated
builder. Fix that by converting the examples to stack
allocation.

https://bugzilla.gnome.org/show_bug.cgi?id=697585
https://bugzilla.gnome.org/show_bug.cgi?id=703522
2013-11-23 13:16:06 -05:00
Andrew Walton
4382e8b876 CLOEXEC fix for older FreeBSDs and OS X.
Some older POSIX-flavored operating systems may not have adopted
O_CLOEXEC yet.

See https://bugzilla.gnome.org/show_bug.cgi?id=712136.
2013-11-23 11:01:29 -05:00
Matthias Clasen
f969f1fc25 Small documentation clarification
https://bugzilla.gnome.org/show_bug.cgi?id=671557
2013-11-23 10:49:00 -05:00
Stef Walter
e3babb3687 giomodule: Allow overriding source directory gio modules are loaded from
When testing (and valgrinding) we need to have a known set of modules
loaded.

https://bugzilla.gnome.org/show_bug.cgi?id=711801
2013-11-23 01:17:03 -05:00
Dan Winship
be231c6be0 glib-tap.mk: fix to actually use the TAP driver
The Makefile rules in glib-tap.mk were copied from an example that
assumed that all the test programs had names ending in ".test", so
they didn't actually have any effect for us and resulted in us still
using the standard automake test driver. Fix this so we actually do
use TAP now.

https://bugzilla.gnome.org/show_bug.cgi?id=711796
2013-11-23 00:43:54 -05:00
Dan Winship
8f5b40c046 gio/tests: fix output of gdbus-proxy-threads and gdbus-threading
Make gdbus-proxy-threads and gdbus-threading print a newline at the
end of their progress strings, to avoid messing up their TAP-format
output.

https://bugzilla.gnome.org/show_bug.cgi?id=711796
2013-11-23 00:43:54 -05:00
Dan Winship
c762a3a3f6 gio/tests: basic-application is a helper program, not a test
https://bugzilla.gnome.org/show_bug.cgi?id=711796
2013-11-23 00:43:53 -05:00
Dan Winship
41eacde630 gtestutils: add "options" to g_test_init(), make option-argv0 use gtester
Declare that the previously-unused "..." argument to g_test_init() is
actually a NULL-terminated list of strings indicating testing options,
and add an option "no_g_set_prgname", which keeps g_test_init() from
calling g_set_prgname(). Then we can port glib/tests/option-argv0 to
use gtester, by passing that option.

https://bugzilla.gnome.org/show_bug.cgi?id=711796
2013-11-23 00:43:45 -05:00
Dan Winship
f733075cd1 glib/tests/include: port to gtester
https://bugzilla.gnome.org/show_bug.cgi?id=711796
2013-11-23 00:39:07 -05:00
Matthias Clasen
a9d93ca1df Add some mainloop instrumentation
Add trace points around adding, removing and dispatching of
sources.

https://bugzilla.gnome.org/show_bug.cgi?id=710741
2013-11-23 00:22:09 -05:00
Dan Winship
91dd70cf17 building: Document C90 and POSIX requirements
https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-11-20 16:30:43 -05:00
Dan Winship
9d7235dea7 building: belated docs update: GNU make is required, not recommended
https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-11-20 16:30:43 -05:00
Dan Winship
158dde0507 Replace #ifdef HAVE_UNISTD_H checks with #ifdef G_OS_UNIX
In Windows development environments that have it, <unistd.h> is mostly
just a wrapper around several other native headers (in particular,
<io.h>, which contains read(), close(), etc, and <process.h>, which
contains getpid()). But given that some Windows dev environments don't
have <unistd.h>, everything that uses those functions on Windows
already needed to include the correct Windows header as well, and so
there is never any point to including <unistd.h> on Windows.

Also, remove some <unistd.h> includes (and a few others) that were
unnecessary even on unix.

https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-11-20 09:25:39 -05:00
Dan Winship
3981cddbf8 Require POSIX.1 (1990) compliance on unix
Assume unix platforms support the original POSIX.1 standard.
Specifically, assume that if G_OS_UNIX, then we have chown(),
getcwd(), getgrgid(), getpwuid(), link(), <grp.h>, <pwd.h>,
<sys/types.h>, <sys/uio.h>, <sys/wait.h>, and <unistd.h>.

Additionally, since all versions of Windows that we care about also
have <sys/types.h>, we can remove HAVE_SYS_TYPES_H checks everywhere.

Also remove one include of <sys/times.h>, and the corresponding
configure check, since the include is not currently needed (and may
always have just been a typo for <sys/time.h>).

https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-11-20 09:17:42 -05:00
Dan Winship
6e4a7fca43 Require C90 compliance
Assume all supported platforms implement C90, and therefore they
(correctly) implement atexit(), memmove(), setlocale(), strerror(),
and vprintf(), and have <float.h> and <limits.h>.

(Also remove the configure check testing that "do ... while (0)" works
correctly; the non-do/while-based version of G_STMT_START and
G_STMT_END was removed years ago, but the check remained. Also, remove
some checks that configure.ac claimed were needed for libcharset, but
aren't actually used.)

Note that removing the g_memmove() function is not an ABI break even
on systems where g_memmove() was previously not a macro, because it
was never marked GLIB_AVAILABLE_IN_ALL or listed in glib.symbols, so
it would have been glib-internal since 2004.

https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-11-20 09:16:16 -05:00