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
...and only include unistd.h when we are on *NIX.
Newer Visual C++ runtimes (8.0/2005 and later) will cause the program to
crash with an internal abort() call when they detect instances of close()
being called on an invalid fd, such as when the fd is -1, and these should
be purged anyways.
https://bugzilla.gnome.org/show_bug.cgi?id=711047
At the same time, also add g_mkdtemp_full and g_dir_make_tmp
variants. The patch also unifies the unique-name-generating
code for all variants of mkstemp and mkdtemp and adds tests
for the new functions.
Based on patches by Paolo Bonzini,
http://bugzilla.gnome.org/show_bug.cgi?id=118563
* glib/gtestutils.h (g_assert_no_error, g_assert_error): Macros to
assert that a GError is not set, or else is set to a particular
error.
* glib/gtestutils.c (g_assertion_message_error): utility for
those macros
* glib/tests/keyfile.c:
* tests/asyncqueue-test.c:
* tests/bookmarkfile-test.c:
* tests/convert-test.c:
* tests/file-test.c: Use g_assert_error/g_assert_no_error
svn path=/trunk/; revision=7555
2006-06-16 Matthias Clasen <mclasen@redhat.com>
* tests/file-test.c (test_mkstemp): Add tests.
* glib/gfileutils.c (g_mkstemp): Allow the XXXXXX to occur
inside the template, not just at the end.
2005-03-10 Sven Neumann <sven@gimp.org>
* glib/gfileutils.c (get_contents_stdio): delay memory allocation
until after the first read. Saves a bunch of reallocs. Also
increased the buffer size to 4096 bytes. (bug #165954)
* tests/file-test.c (test_get_contents): added a (very basic) test
for g_file_get_contents().
Thu Feb 5 01:19:12 2004 Matthias Clasen <maclas@gmx.de>
* tests/file-test.c (test_mkstemp): Weaken an g_assert() to a
g_warning(), since apparently nothing in Posix forces mkstemp()
to reject templates without any X's. (#133397)