Commit Graph

21 Commits

Author SHA1 Message Date
Will Thompson
b45d911cc6
gio-test: fix leak & maybe-uninitialized warning
GCC 8 on F29 complains:

../tests/gio-test.c: In function ‘main’:
../tests/gio-test.c:375:7: warning: ‘id’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       g_free (id);
       ^~~~~~~~~~~

In the normal case, when run without arguments, 'id' will be assigned
exactly once, so all is fine. If run with argument '0', 'id' will never
be assigned, so the warning is legit; but in that case the test program
will never exit. If run with any argument greater than 1, 'id' will be
assigned more than once but only the last incarnation will be freed.

Tweak the scope of the variable to match its use, and arrange for it to
be freed when its watch is destroyed.
2018-11-26 15:46:54 +00:00
Руслан Ижбулатов
190ea6ed10 tests W32: Fix Windows values casting
LPARAM is LONG_PTR which is the same as INT_PTR on Windows.
WPARAM is UINT_PTR.
HWND is a pointer.
(%p prints pointers without 0x prefix, hence the extra 0x).
2018-09-21 08:45:54 -04:00
Руслан Ижбулатов
3cdce16668 tests W32: Cast the MSG struct as (gchar *) for g_io_channel_read 2018-09-21 08:45:54 -04:00
Sébastien Wilmet
f6c44ec3e4 tests/: LGPLv2+ -> LGPLv2.1+
gen-casefold-txt.pl and gen-casemap-txt.pl are licensed under GPLv2+, so
they are not touched by this commit.

A lot of *.c files in tests/ don't have a license header.

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:35 +02:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01: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
Stef Walter
fc4630b7ac gio-test: Fix leaks in tests
https://bugzilla.gnome.org/show_bug.cgi?id=711751
2013-11-10 22:41:44 +01:00
Matthias Clasen
d4f8854785 Cosmetic changes 2012-06-11 10:25:24 -04:00
Tor Lillqvist
7d2ec70a49 Not needed, just use -DPCRE_STATIC.
2007-11-07  Tor Lillqvist  <tml@novell.com>

	* glib/update-pcre/notdll.patch: Not needed, just use -DPCRE_STATIC.

	* glib/update-pcre/Makefile.am: Drop notdll.patch.

	* glib/update-pcre/Makefile.am-1
	* glib/update-pcre/update.sh
	* glib/pcre/Makefile.am
	* glib/Makefile.am: Use -DPCRE_STATIC.

	* tests/gio-test.c
	* tests/mainloop-test.c
	* tests/spawn-test.c: #define pipe(fds) _pipe(fds, 4096,
	_O_BINARY) on Windows.

	* tests/regex-test.c (test_expand): Don't print NULL with %s.


svn path=/trunk/; revision=5805
2007-11-07 09:49:25 +00:00
Matthias Clasen
7221f500f5 Make the tests silent on success.
2005-07-14  Matthias Clasen  <mclasen@redhat.com>

	* tests/spawn-test.c:
	* tests/uri-test.c:
	* tests/thread-test.c:
	* tests/queue-test.c:
	* tests/mainloop-test.c:
	* tests/iochannel-test.c:
	* tests/gio-test.c:
	* tests/child-test.c: Make the tests silent on success.
2005-07-14 05:20:14 +00:00
Manish Singh
d1f37d5053 add -DG_DISABLED_DEPRECATED
Tue Oct 15 15:07:45 2002  Manish Singh  <yosh@gimp.org>

        * gmodule/Makefile.am gobject/Makefile.am gthread/Makefile.am:
        add -DG_DISABLED_DEPRECATED

        * tests/gio-test.c tests/mainloop-test.c tests/string-test.c
        tests/testglib.c test/tree-test.c tests/unicode-collate.c
        tests/unicode-normalize.c: Deprecation cleanup
2002-10-15 22:16:57 +00:00
Sebastian Wilhelmi
d81ac5339f Added #undef G_DISABLE_ASSERT and #undef G_LOG_DOMAIN throughout the
2002-07-04  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

	* tests/*.c: Added #undef G_DISABLE_ASSERT and #undef G_LOG_DOMAIN
	throughout the files, which didn't already have them. (#87312)
2002-07-04 15:19:30 +00:00
Sebastian Wilhelmi
e7d925595c Use gsize instead of gint. From Miroslaw Dobrzanski-Neumann
2002-04-08  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

	* tests/gio-test.c, tests/markup-test.c: Use gsize instead of
	gint. From Miroslaw Dobrzanski-Neumann
	<mne@mosaic-ag.com>. (#77982)
2002-04-08 08:36:35 +00:00
Hans Breuer
847d8e9212 make it compile again
2001-07-20  Hans Breuer  <hans@breuer.org>

	* glib/glib/giowin32.c : make it compile again

	* glib/glib.def : updated exports

	* glib/makefile.msc.in :
	* glib/makefile.mingw.in :
	* tests/makefile.msc.in : reflect glib move

	* tests/mainloop-test.c : #include <io.h> for _pipe()

	* tests/gio-test.c : casts for strict compiler settings

	* makefile.msc.in : new master makefile reflecting the glib
	move. The '.in' isn't really needed anymore, because there
	is no version number in it
2001-07-20 17:13:52 +00:00
Dan Winship
655d467602 Add a check for the Darwin dynamic linker. Use AC_TRY_LINK when checking
* configure.in: Add a check for the Darwin dynamic linker. Use
        AC_TRY_LINK when checking for "nonposix getpwuid_r" so it notices
        "no getpwuid_r" correctly.

        * testglib.c (main): Make template[] bigger to prevent an overrun.
        Remove an unused variable. Initialize error to NULL.

        * tests/gio-test.c (main): Add a cast to prevent a warning when
        size_t is a long.

        * tests/type-test.c (main): Add an #ifdef to prevent a warning
        when G_HAVE_GINT64 is defined and G_GINT64_FORMAT isn't.
2001-04-20 17:08:57 +00:00
Tor Lillqvist
8a0df0a71c Socket support rewritten. It was utterly broken, and untested in fact. We
2001-01-25  Tor Lillqvist  <tml@iki.fi>

	* giowin32.c: Socket support rewritten. It was utterly broken, and
	untested in fact. We still do use a thread for each socket being
	watched, but instead of blocking in recv() (which of course was
	plain stupid for sockets being liste()ed on), we block in
	select(). The read method for sockets calls recv(). It is now
	possible for the application to call accept(), recv() or send() in
	the callback, just like on Unix. Tested with code kindly provided
	by Andrew Lanoix.

	Rename g_io_channel_win32_new_stream_socket() to
	g_io_channel_win32_new_socket() as it isn't restricted to stream
	sockets.

	* gmain.c (g_poll): Related changes in the Win32 version of
	g_poll(). When polling for messages, always do a PeekMessage()
	first. We used to miss messages if several were posted between
	calls to g_poll().

	* giochannel.h: Improve Win32-related comments.

	* gutf8.c: (Win32) Include <stdio.h> for sprintf.

	* tests/gio-test.c: (Win32) Add tests for polling for Windows
	messages.

	* tests/makefile.mingw.in: Remove superfluous compilation command
	line.
2001-01-25 21:16:46 +00:00
Tor Lillqvist
18e7dc0215 Fix the Win32-only code to use current API,
2000-10-06  Tor Lillqvist  <tml@iki.fi>

	* tests/gio-test.c (main): Fix the Win32-only code to use current
	API, g_io_channel_win32_make_pollfd() and g_io_channel_win32_poll().
2000-10-06 21:43:25 +00:00
Owen Taylor
33df64519d Fix a couple of trivial bugs that were causing warnings.
Mon Aug 21 14:46:23 2000  Owen Taylor  <otaylor@redhat.com>

	* tests/gio-test.c: Fix a couple of trivial bugs that
	were causing warnings.

Mon Aug 21 14:39:36 2000  Owen Taylor  <otaylor@redhat.com>

	* glib.h: Use C99 varargs macros where possible
	(check __STDC_VERSION__), otherwise, on gcc, use an alternate
	form of gcc varargs which is more likely
	to be supported going forward. (Based on some code
	from Raja Harinath)
2000-08-21 18:46:52 +00:00
Tor Lillqvist
3d6f441f96 New function, that calls g_source_remove(). Check return value of
2000-08-07  Tor Lillqvist  <tml@iki.fi>

	* tests/gio-test.c (shutdown_source): New function, that calls
	g_source_remove(). Check return value of g_source_remove(), and
	decrement running subprocess counter only if g_source_remove()
	actually did remove the source.

	(recv_message): Call shutdown_source() on EOF condition. Return
	FALSE on G_IO_HUP and G_IO_ERR condition. Fix printf format typo.
2000-08-06 23:33:29 +00:00
Tor Lillqvist
1860151db0 Compile in the debugging code all the time, but only output debug messages
2000-07-30  Tor Lillqvist  <tml@iki.fi>

	* giowin32.c: Compile in the debugging code all the time, but only
	output debug messages if told so. Add (unadvertised) function to
	turn on/off debug messages for a channel.

	(buffer_read): Don't loop. It is expected behaviour to return a
	short read occasionally, for instance when reading from
	pipes. It's the calling code that should loop if it *knows* how
	much the writer has written.

	* tests/gio-test.c: Correct the program's name in the output.
	(recv_message): Loop calling g_io_channel_read() (in a new
	function read_all()) until we have all the bytes we want (that we
	know the writer has written/will write).
2000-07-30 00:27:39 +00:00
Tor Lillqvist
b965bb5db1 Finally, a new and improved IO Channel and condition watch implementation
2000-07-30  Tor Lillqvist  <tml@iki.fi>

	Finally, a new and improved IO Channel and condition watch
	implementation for Win32. Based on code provided by Craig Setera.

	When watching file descriptors, for which there is no select()
	like functionality on Win32 that would work on all Win32 platforms
	for all types of file descriptors (including anonymous pipes), we
	start a new thread that blocks while trying to read from the file
	descriptor. When the read returns, a Win32 Event is signalled that
	the polling routine eventually notices. Meanwhile, the data being
	read is stored in a circular buffer, from where the IO channel's
	read() method picks it up.

	If the buffer fills up the reading thread has to wait for space
	becoming available. For this another Win32 Event is used. The IO
	Channel's read() method signals this when it has read some data
	out of the buffer.

	The separate reader thread(s), and the circular buffer(s) with
	associated events mean lots of possibilities for fun parallellism
	errors. But it seems to work OK, i.e. GIMP runs.

	* gmain.c: Small changes to the Win32 polling function.
	(g_main_win32_get_poll_func): New function. Perhaps it would be a
	good idea to provide this on all platforms.

	* giowin32.c: The bulk of the new implementation.
	(g_io_channel_win32_wait_for_condition): New function. To be used
	where on Unix one does a select() on the channel's fd, like
	libgimp's gimp_extension_process(). Could be provided on all
	platforms.

	* glib.h: Update documentation for IO Channels on Win32. Remove
	the declarations for the as of now obsolete old functions related
	to IO Channels for pipes with "wakeup" messages.

	* glib.def: Some new functions.

	* tests/gio-test.c: New file, to test GIOChannel and main loop.

	* tests/Makefile.am
	* tests/makefile.mingw.in: Add it.
2000-07-29 20:59:07 +00:00