Commit Graph

18 Commits

Author SHA1 Message Date
Colin Walters
28254a38a7 GDataInputStream: Add _utf8() variants of _read_line
These will validate the resulting line, and throw a conversion error.
In practice these will likely be used by bindings, but it's good
for even C apps too that don't want to explode if that text file
they're reading into Pango actually has invalid UTF-8.

https://bugzilla.gnome.org/show_bug.cgi?id=652758
2011-06-16 20:03:02 -04:00
Ryan Lortie
2e78d07f86 Add g_data_input_stream_read_upto{,async,finish}
These functions are meant to replace the read_until() flavour, with the
following improvements:

  - consistency between the synchronous and asynchronous versions as to
    if the separator character is read (it never is).

  - support for using a nul byte as a separator character by way of
    addition of a length parameter which allows stop_chars to be treated
    as a byte array rather than a nul-terminated string.

The read_until() functions are not yet formally deprecated, but a note
has been added to the documentation warning not to use them as they will
be in the future.

This is bug #584284.
2010-09-13 13:14:25 -04:00
Christian Persch
45331a4640 Plug a mem leak in data-input-stream test
==12351== 45,045 bytes in 4,095 blocks are definitely lost in loss record 377 of 380
==12351==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==12351==    by 0x4057094: g_malloc (gmem.c:134)
==12351==    by 0x40573DB: g_malloc_n (gmem.c:281)
==12351==    by 0x4071ABD: g_strconcat (gstrfuncs.c:315)
==12351==    by 0x8049811: test_read_lines (data-input-stream.c:99)

Bug #628331.
2010-09-03 15:53:05 -04:00
Christian Persch
36c7d95c9c Plug a mem leak in data-input-stream test
==2415== 45,045 bytes in 4,095 blocks are definitely lost in loss record 393 of 399
==2415==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==2415==    by 0x4057094: g_malloc (gmem.c:134)
==2415==    by 0x417FC29: g_data_input_stream_read_line (gdatainputstream.c:797)
==2415==    by 0x8049874: test_read_lines (data-input-stream.c:111)

==12088== 360 bytes in 40 blocks are definitely lost in loss record 368 of 381
==12088==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==12088==    by 0x4057094: g_malloc (gmem.c:134)
==12088==    by 0x417FF4C: g_data_input_stream_read_until (gdatainputstream.c:914)
==12088==    by 0x8049B6F: test_read_until (data-input-stream.c:182)

Bug #628331.
2010-09-03 15:47:38 -04:00
Christian Persch
91e3803596 Plug a mem leak in data-input-stream test
==2415== 165 (72 direct, 93 indirect) bytes in 3 blocks are definitely lost in loss record 373 of 399
==2415==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==2415==    by 0x4057094: g_malloc (gmem.c:134)
==2415==    by 0x406F2D6: g_slice_alloc (gslice.c:836)
==2415==    by 0x406F31B: g_slice_alloc0 (gslice.c:848)
==2415==    by 0x403A8A6: g_error_new_literal (gerror.c:117)
==2415==    by 0x403AC31: g_set_error_literal (gerror.c:314)
==2415==    by 0x417ED29: read_data (gdatainputstream.c:309)
==2415==    by 0x417EE9D: g_data_input_stream_read_byte (gdatainputstream.c:344)
==2415==    by 0x8049DEC: test_data_array (data-input-stream.c:263)

Bug #628331.
2010-09-03 15:45:48 -04:00
Matthias Clasen
758c3216cd Improve coverage of stream tests 2010-07-30 19:51:20 -04:00
Matthias Clasen
5694ab7642 Revert "Move gio tests from gio/tests/ to tests/gio/"
This reverts commit 2262d76b33.

Move GIO tests back to where they belong.
2009-07-05 22:49:24 -04:00
Benjamin Otte
2262d76b33 Move gio tests from gio/tests/ to tests/gio/
This avoids getting tests built every time when working on libgio and
running make in the gio/ directory.
2009-07-01 19:03:19 +02:00
Benjamin Otte
afd63c3281 fix warnings from gcc compilation with my mad CFLAGS 2009-06-29 18:25:02 +02:00
Matthias Clasen
e959473234 Revert behaviour change in g_data_input_stream_read_line
svn path=/trunk/; revision=7720
2008-12-01 19:02:58 +00:00
Matthias Clasen
e449a91b98 Bug 547481 – g_data_input_stream_read_line behaves not as stated in the
2008-11-28  Matthias Clasen  <mclasen@redhat.com>

        Bug 547481 – g_data_input_stream_read_line behaves not as stated in
        the docs

        * gdatainputstream.c (g_data_input_stream_read_line): Behave as
        documented and include the line end in the returned string.
        Pointed out by Paul Pogonyshev.

        * tests/data-input-stream.c: Fix the read_line test to test the
        documented behaviour.



svn path=/trunk/; revision=7694
2008-11-28 07:42:48 +00:00
Dan Winship
29ddd48ff2 Use g_assert_error() and g_assert_no_error()
* tests/data-input-stream.c:
	* tests/data-output-stream.c:
	* tests/live-g-file.c:
	* tests/memory-input-stream.c:
	* tests/memory-output-stream.c: Use g_assert_error() and
	g_assert_no_error()

svn path=/trunk/; revision=7556
2008-09-27 01:43:43 +00:00
Michael Natterer
03a5797a62 don't define G_DISABLE_SINGLE_INCLUDES, it's in the global CPPFLAGS now.
2008-05-28  Michael Natterer  <mitch@imendio.com>

	* Makefile.am: don't define G_DISABLE_SINGLE_INCLUDES, it's in
	the global CPPFLAGS now.

	* tests/data-input-stream.c
	* tests/data-output-stream.c
	* tests/g-file-info.c
	* tests/g-file.c
	* tests/live-g-file.c
	* tests/memory-input-stream.c: don't include <glib/gtestutils.h>


svn path=/trunk/; revision=6954
2008-05-28 16:17:45 +00:00
Matthias Clasen
689a9e4b1a Revert the patch for bug 527214 and related changes. GTimer
is supposed to work without threads.


svn path=/trunk/; revision=6943
2008-05-27 16:00:51 +00:00
Matthias Clasen
cdc2910103 Make tests work
svn path=/trunk/; revision=6935
2008-05-26 05:57:09 +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
Alexander Larsson
fc93e63edd C89 fixes from Jens Granseuer (#512849)
2008-01-30  Alexander Larsson  <alexl@redhat.com>

        * tests/data-input-stream.c:
        * tests/data-output-stream.c:
	C89 fixes from Jens Granseuer (#512849)



svn path=/trunk/; revision=6423
2008-01-30 09:28:10 +00:00
Alexander Larsson
b784923e9c Allow UTF-8 in file:// parse names.
2008-01-22  Alexander Larsson  <alexl@redhat.com>

        * glocalfile.c:
	Allow UTF-8 in file:// parse names.
	
        * tests/Makefile.am:
        * tests/data-input-stream.c:
        * tests/data-output-stream.c:
        * tests/g-file-info.c:
        * tests/g-file.c:
	Added a bunch of tests from Tomas Bzatek


svn path=/trunk/; revision=6351
2008-01-22 09:13:28 +00:00