Commit Graph

59 Commits

Author SHA1 Message Date
Philip Withnall
635100b1f5 gio: Fix invalid doc links
Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 11:26:53 +01:00
Matthias Clasen
08990badb6 docs: Move the GBufferedInputStream SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-17 11:19:27 +01:00
Michael Catanzaro
5d738ddcfe Audit and fix incorrect use of (closure) in glib
Following Emmanuele's instructions for use of introspection annotations:

https://www.bassi.io/articles/2023/02/20/bindable-api-2023/

I have audited all uses of the (closure) annotation in glib and
determined that only a handful are correct. This commit changes almost
all of our use of (closure) annotations to conform to Emmanuele's rules.
2023-07-21 19:03:57 +01:00
Philip Withnall
5942cd7984 gio: Add SPDX license headers automatically
Add SPDX license (but not copyright) headers to all files which follow a
certain pattern in their existing non-machine-readable header comment.

This commit was entirely generated using the command:
```
git ls-files gio/*.[ch] | xargs perl -0777 -pi -e 's/\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/\n \*\n \* SPDX-License-Identifier: LGPL-2.1-or-later\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/igs'
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1415
2022-05-18 09:18:52 +01:00
Emmanuel Fleury
23dad977d8 Change SkipAsyncData fields to be gsize (and not gssize) 2021-02-19 18:10:30 +01:00
Emmanuel Fleury
18097c8acb Fix signedness warning in gio/gbufferedinputstream.c:g_buffered_input_stream_seek()
gio/gbufferedinputstream.c: In function ‘g_buffered_input_stream_seek’:
gio/gbufferedinputstream.c:899:18: error: comparison of integer expressions of different signedness: ‘goffset’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  899 |       if (offset <= priv->end - priv->pos && offset >= -priv->pos)
      |                  ^~
gio/gbufferedinputstream.c:899:53: error: comparison of integer expressions of different signedness: ‘goffset’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  899 |       if (offset <= priv->end - priv->pos && offset >= -priv->pos)
      |                                                     ^~
2021-02-16 13:32:26 +01:00
Emmanuel Fleury
477d53b2b0 Fix signedness warning in gio/gbufferedoutputstream.c:g_buffered_output_stream_set_buffer_size()
gio/gbufferedoutputstream.c: In function ‘g_buffered_output_stream_set_buffer_size’:
glib/gmacros.h:806:26: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘goffset’ {aka ‘long int’}
  806 | #define MAX(a, b)  (((a) > (b)) ? (a) : (b))
      |                          ^
gio/gbufferedoutputstream.c:211:14: note: in expansion of macro ‘MAX’
  211 |       size = MAX (size, priv->pos);
      |              ^~~

Fix signedness warning in gio/gbufferedinputstream.c:g_buffered_input_stream_real_fill()

gio/gbufferedinputstream.c: In function ‘g_buffered_input_stream_real_fill’:
glib/gmacros.h:809:26: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}K [-Werror=sign-compare]
  809 | #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
      |                          ^
gio/gbufferedinputstream.c:664:11: note: in expansion of macro ‘MIN’
  664 |   count = MIN (count, priv->len - in_buffer);
      |           ^~~
gio/gbufferedinputstream.c:667:29: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘long int’}
  667 |   if (priv->len - priv->end < count)
      |                             ^

Fix signedness warnings in gio/gbufferedinputstream.c:g_buffered_input_stream_real_fill_async()

gio/gbufferedinputstream.c: In function ‘g_buffered_input_stream_real_fill_async’:
glib/gmacros.h:809:26: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  809 | #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
      |                          ^
gio/gbufferedinputstream.c:1075:11: note: in expansion of macro ‘MIN’
 1075 |   count = MIN (count, priv->len - in_buffer);
      |           ^~~
gio/gbufferedinputstream.c:1078:29: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘long int’}
 1078 |   if (priv->len - priv->end < count)
      |                             ^
2020-12-18 12:26:26 +01:00
Philip Withnall
8e8f4e6486 docs: Fix various minor syntax errors in gtk-doc comments
This will fix a few broken links in the documentation, and shut up a
load of gtk-doc warnings (but certainly not all of them).

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

https://bugzilla.gnome.org/show_bug.cgi?id=790015
2017-11-07 14:51:12 +00:00
Sébastien Wilmet
3bf4a720c3 gio/: LGPLv2+ -> LGPLv2.1+
Sub-directories inside gio/ already processed in a previous commit:
- fam/
- gdbus-2.0/ (which contains only codegen/)
- gvdb/
- inotify/
- tests/
- win32/
- xdgmime/

Other sub-directories inside gio/:
- completion/: no license headers
- kqueue/: not LGPL, BSD-style license

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Christian Hergert
18a33f72db introspection: use (nullable) or (optional) instead of (allow-none)
If we have an input parameter (or return value) we need to use (nullable).
However, if it is an (inout) or (out) parameter, (optional) is sufficient.

It looks like (nullable) could be used for everything according to the
Annotation documentation, but (optional) is more specific.
2016-11-22 14:14:37 -08:00
Philip Withnall
3613b7a366 gio: Add source tags to various GTasks constructed in GLib
This makes them easier to identify when debugging and profiling.

This patch was somewhat less than interesting to write.

https://bugzilla.gnome.org/show_bug.cgi?id=767765
2016-06-29 15:16:52 +01:00
Matthias Clasen
e7fd3de86d Eradicate links and xrefs
These are all replaced by markdown ref links.
2014-02-08 12:26:56 -05:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01: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
Djalal Harouni
d308ede491 gio/gbufferedinputstream: fix redundant-decls of g_buffered_input_stream_finalize()
g_buffered_input_stream_finalize() is already declared as static in this
gbufferedinputstream.c file, so just remove the redundant declaration.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>

https://bugzilla.gnome.org/show_bug.cgi?id=710345
2013-10-19 12:18:55 -04:00
Emmanuele Bassi
54cc43630d Rename the generated private data getter function
As it turns out, we have examples of internal functions called
type_name_get_private() in the wild (especially among older libraries),
so we need to use a name for the per-instance private data getter
function that hopefully won't conflict with anything.
2013-06-24 15:43:04 +01:00
Emmanuele Bassi
32747def4b gio: Use the new private instance data declaration
Use the newly added macros, and remove the explicit calls to
g_type_class_add_private().

https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-06-24 14:18:01 +01:00
Dan Winship
669505e354 gio: port basic I/O classes from GSimpleAsyncResult to GTask
https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-12-18 09:07:19 -05:00
Dan Winship
82d914d808 gio: add g_async_result_is_tagged()
Rather than doing a two step first-check-the-GAsyncResult-subtype-then-
check-the-tag, add a GAsyncResult-level method so that you can do them
both at once, simplifying the code for "short-circuit" async return
values where the vmethod never gets called.

https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-07-10 10:49:20 -04:00
Dan Winship
f8532a13e2 gio: Add g_async_result_legacy_propagate_error()
Finish deprecating the "handle GSimpleAsyncResult errors in the
wrapper function" idiom (and protect against future GSimpleAsyncResult
deprecation warnings) by adding a "legacy" GAsyncResult method
to do it in those classes/methods where it had been traditionally
done.

(This applies only to wrapper methods; in cases where an _async
vmethod explicitly uses GSimpleAsyncResult, its corresponding _finish
vmethod still uses g_simple_async_result_propagate_error.)

https://bugzilla.gnome.org/show_bug.cgi?id=667375
https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-07-10 10:49:14 -04:00
Dan Winship
538b2f106d gio: handle GSimpleAsyncResult errors in _finish vmethods
Originally, the standard idiom with GSimpleAsyncResult was to handle
all errors in the _finish wrapper function, so that vmethods only had
to deal with successful results. But this means that chaining up to a
parent _finish vmethod won't work correctly. Fix this by also checking
for errors in all the relevant vmethods. (We have to redundantly check
in both the vmethod and the wrapper to preserve compatibility.)

https://bugzilla.gnome.org/show_bug.cgi?id=667375
https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-07-10 10:47:55 -04:00
Maciej Piechotka
90739baec0 Make GBufferedInputStream implement GSeekable
https://bugzilla.gnome.org/show_bug.cgi?id=673034
2012-04-23 10:57:01 +02:00
Dan Winship
00ee06e6a3 gio: use GPollable* to implement fallback read_async/write_async
If a GInputStream does not provide a read_async() implementation, but
does implement GPollableInputStream, then instead of doing
read-synchronously-in-a-thread, just use
g_pollable_input_stream_read_nonblocking() and
g_pollable_input_stream_create_source() to implement an async read in
the same thread. Similarly for GOutputStream.

Remove a bunch of existing read_async()/write_async() implementations
that are basically equivalent to the new fallback method.

https://bugzilla.gnome.org/show_bug.cgi?id=673997
2012-04-17 12:33:12 -04:00
Evan Nemerson
c3d6595f5a GIO: add lots of annotations for Vala bindings
https://bugzilla.gnome.org/show_bug.cgi?id=667447
2012-01-11 15:50:08 -05:00
Matthias Clasen
1b28408b8b Spelling fixes
Spelling fixes in comments and docs, provided by
Kjartan Maraas in bug 657336.
2011-08-29 14:49:32 -04:00
Pavel Holejsovsky
86b250019a Add GI annotations to GBufferedInputStream 2010-12-21 18:21:33 +01:00
Christian Persch
ba45e36932 Add g_simple_async_report_take_gerror_in_idle
... and use it where appropriate. Saves an extra GError copy.

Bug #633686.
2010-11-03 14:38:08 +01:00
Christian Persch
9e0c07870a Use g_simple_async_result_{new_,}take_error
Bug #633685.
2010-11-03 14:25:35 +01:00
Ryan Lortie
5b946e0504 gio/: fully remove gioalias hacks 2010-07-07 19:53:22 -04:00
Matthias Clasen
1ba87d1a0e Trivial cleanups 2010-07-05 23:13:16 -04:00
Matthias Clasen
f2c8572d84 Remmove a dead assignment.
Spotted by clang.
2009-09-07 03:07:22 -04:00
Ryan Lortie
fc10cb46ad Bug 568723 – g_buffered_input_stream_fill_async doesn't take count == -1
2009-01-22  Ryan Lortie  <desrt@desrt.ca>

        Bug 568723 – g_buffered_input_stream_fill_async doesn't take count == -1

        * gbufferedinputstream.c (g_buffered_input_stream_fill_async,
        g_buffered_input_stream_fill): check for count < -1 instead of count <
        0 and copy modified check to non-async version for consistency.
        document the "count = -1" API.


svn path=/trunk/; revision=7828
2009-01-22 19:18:26 +00:00
Ryan Lortie
fb50c2ae1a Bug 568741 – g_buffered_input_stream_fill_async doesn't work
2009-01-22  Ryan Lortie  <desrt@desrt.ca>

        Bug 568741 – g_buffered_input_stream_fill_async doesn't work

        * gbufferedinputstream.c (fill_async_callback): grow the buffer tail
        after we have successfully read data from the base stream


svn path=/trunk/; revision=7827
2009-01-22 19:00:05 +00:00
Matthias Clasen
0b715510de Bug 562393 – g_buffered_input_stream_read_byte broken if data available
2008-11-28  Matthias Clasen  <mclasen@redhat.com>

        Bug 562393 – g_buffered_input_stream_read_byte broken if data
        available

        * gio/gbufferedinputstream.c (g_buffered_input_stream_read_byte): Fix
        handling of buffered content.  Patch by Philip Withnall

        * gio/tests/buffered-input-stream.c: Add a testcase for this bug.
        * gio/tests/Makefile.am: And build it



svn path=/trunk/; revision=7686
2008-11-28 05:57:07 +00:00
Cody Russell
3d93bf6968 Moved all relevant typedefs into these files.
2008-07-01  Cody Russell  <bratsche@gnome.org>

        * gio/gioenums.h:
        * gio/giotypes.h:
	Moved all relevant typedefs into these	files.

        * gio/*.[ch]:
	Updated wrt added files.

        Split types into separate file	for easier maintainership. (#538564)


svn path=/trunk/; revision=7127
2008-07-01 06:32:35 +00:00
Johan Dahlin
761424465a Include "config.h" instead of <config.h> Command used: find -name
2008-06-21  Johan Dahlin  <jdahlin@async.com.br>

    * *.[ch]: Include "config.h" instead of <config.h>
    Command used:
    find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g'
    Rubberstamped by Mitch


svn path=/trunk/; revision=7092
2008-06-22 15:10:51 +00:00
Christian Persch
9c17697b56 Use g_set_error_literal where appropriate. Patch from bug #535947.
svn path=/trunk/; revision=7051
2008-06-16 16:53:58 +00:00
Michael Natterer
a4427bfff5 chain up unconditionally in finalize() and dispose(). Also don't
2008-06-16  Michael Natterer  <mitch@imendio.com>

	* *.c: chain up unconditionally in finalize() and dispose(). Also
	don't dereference these function pointers when calling them since
	that has no meaning at all.


svn path=/trunk/; revision=7048
2008-06-16 09:54:04 +00:00
Wouter Bolsterlee
1d1ffab20d Fix typo in parameter documentation.
2008-03-04  Wouter Bolsterlee  <wbolster@svn.gnome.org>

	* gio/gbufferedinputstream.c: Fix typo in parameter
	documentation.

svn path=/trunk/; revision=6622
2008-03-04 15:21:31 +00:00
Matthias Clasen
f3144c7efe Doc fixes
svn path=/trunk/; revision=6554
2008-02-21 18:20:17 +00:00
Matthias Clasen
da0e7e81c1 /bin/ksh can't handle a for-loop with no arguments, so add a "." for when
2008-02-09  Matthias Clasen <mclasen@redhat.com>

        * Makefile.decl: /bin/ksh can't handle a for-loop with no
        arguments, so add a "." for when $(SUBDIRS) is empty.

        * glib/tests/option-context.c:
        * glib/tests/testing.c:
        * gthread/gthread-posix.c:
        * tets/testingbase64.c:
        * glib/gtester.c:
        * glib/gsequence.c: Portability fixes.  (#515154)



svn path=/trunk/; revision=6487
2008-02-10 04:41:25 +00:00
Matthias Clasen
7bfc60de2e Deprecate G_GNUC_(PRETTY)_FUNCTION.
2008-01-27  Matthias Clasen  <mclasen@redhat.com>

        * glib/gmacros.h: Deprecate G_GNUC_(PRETTY)_FUNCTION.



svn path=/trunk/; revision=6389
2008-01-27 23:42:33 +00:00
Matthias Clasen
af7645a498 String fixes
svn path=/trunk/; revision=6370
2008-01-25 06:10:29 +00:00
Matthias Clasen
0debd52858 Fix up includes in section docs
svn path=/trunk/; revision=6149
2007-12-18 02:52:11 +00:00
Alexander Larsson
2ae689e31f g_push/pop_current_cancellable -> g_cancellable_push/pop_current
2007-12-13  Alexander Larsson  <alexl@redhat.com>

        * gcancellable.[ch]:
        * gio.symbols:
        * gbufferedinputstream.c:
        * gfileenumerator.c:
        * gfileinputstream.c:
        * gfileoutputstream.c:
        * ginputstream.c:
        * gioscheduler.c:
        * goutputstream.c:
	g_push/pop_current_cancellable ->
	g_cancellable_push/pop_current


svn path=/trunk/; revision=6115
2007-12-13 16:48:06 +00:00
Alexander Larsson
41d1650c9b Fix up a bunch of details in the docs.
2007-12-12  Alexander Larsson  <alexl@redhat.com>

        * gappinfo.[ch]:
        * gasyncresult.c:
        * gbufferedinputstream.c:
        * gbufferedoutputstream.c:
        * gcancellable.c:
        * gcontenttype.c:
        * gdatainputstream.[ch]:
        * gdesktopappinfo.c:
        * gdirectorymonitor.c:
        * gfile.[ch]:
        * gfileattribute.[ch]:
        * gfileicon.[ch]:
        * gfileinfo.h:
        * gfileinputstream.h:
        * gfilemonitor.[ch]:
        * gfileoutputstream.[ch]:
        * gfilterinputstream.h:
        * gfilteroutputstream.h:
        * gicon.h:
        * gioscheduler.c:
        * gloadableicon.[ch]:
        * gmemoryinputstream.c:
        * gmountoperation.c:
        * gthemedicon.c:
	Fix up a bunch of details in the docs.

        * glocalfileinfo.c:
	CR/LF -> LF fixups


svn path=/trunk/; revision=6100
2007-12-12 12:19:02 +00:00
15:08:59 Tim Janik
cc3de68e21 http://mail.gnome.org/archives/gtk-devel-list/2007-October/msg00089.html
2007-12-10 15:08:59  Tim Janik  <timj@imendio.com>

        * let g_warn_if_fail replace g_assert as discussed here:
          http://mail.gnome.org/archives/gtk-devel-list/2007-October/msg00089.html

        * fix bug #502498: Test framework assertion failures should follow
        gcc error format.

        * gmessages.h, gmessages.c: deprecated g_assert_warning() which is
        unused now. removed g_assert*() definitions whcih are provided by 
        gtestutils.h now. added g_warn_if_reached() and g_warn_if_fail()  
        which are recommended as g_assert/g_assert_not_reached replacements
        for non-test programs.
        added g_warn_message() to implement g_warn_*() macros.
        use emacs-next-error friendly formatting for file:line: for warnings.

        * gtestutils.h, gtestutils.c: use emacs-next-error friendly formatting.
        implement g_assert_not_reached() with g_assertion_message() and
        g_assert() in terms of g_assertion_message_expr() so we'll be able to
        provide assertion messages in test logs.

        * gkeyfile.c, gbookmarkfile.c: changed g_assert*() to g_warn_if_fail()
        or g_return_if_fail() where suitable.

        * gio/: changed g_assert to g_warn_if_fail.



svn path=/trunk/; revision=6086
2007-12-10 14:07:42 +00:00
Alexander Larsson
2c362b7f9e Rename all struct members named: read, write, close, truncate, or mount to
2007-12-05  Alexander Larsson  <alexl@redhat.com>

        * gbufferedinputstream.c:
        * gbufferedoutputstream.c:
        * gdrive.[ch]:
        * gfile.[ch]:
        * gfileenumerator.[ch]:
        * gfileinputstream.c:
        * gfileoutputstream.[ch]:
        * gfilterinputstream.c:
        * gfilteroutputstream.c:
        * ginputstream.[ch]:
        * glocalfile.c:
        * glocalfileenumerator.c:
        * glocalfileinputstream.c:
        * glocalfileoutputstream.c:
        * gmemoryinputstream.c:
        * gmemoryoutputstream.c:
        * goutputstream.[ch]:
        * gseekable.[ch]:
        * gunixdrive.c:
        * gunixinputstream.c:
        * gunixoutputstream.c:
	Rename all struct members named:
	read, write, close, truncate, or mount
	to foo_fn, as these are reserved names
	and could be defined as macros in libc.
	(#501645)


svn path=/trunk/; revision=6048
2007-12-05 10:38:03 +00:00
Dan Winship
117de38f04 Make this take a GError and return a gboolean, and do the "outstanding
2007-11-30  Dan Winship  <danw@gnome.org>

	* ginputstream.c (g_input_stream_set_pending): Make this take a
	GError and return a gboolean, and do the "outstanding operation"
	check (and the "stream is already closed" check) itself.
	(g_input_stream_clear_pending): Formerly set_pending(FALSE).

	* goutputstream.c (g_output_stream_set_pending)
	(g_output_stream_clear_pending): Likewise

	* gbufferedinputstream.c: 
	* gfileinputstream.c: 
	* gfileoutputstream.c: Update for that

	* gsimpleasyncresult.c (g_simple_async_report_gerror_in_idle):
	Like g_simple_async_report_error_in_idle, but takes a GError
	rather than building one.


svn path=/trunk/; revision=6039
2007-12-04 08:57:04 +00:00
Dan Winship
b22aa6dde6 Don't cheat and unset the "pending" flag around inner calls. Instead, call
2007-11-30  Dan Winship  <danw@gnome.org>

	* goutputstream.c: Don't cheat and unset the "pending" flag around
	inner calls. Instead, call the class method directly rather than
	the wrapper function that checks "pending"


svn path=/trunk/; revision=6038
2007-12-04 08:55:51 +00:00