This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated discards e0a04e8ae2d7a772cab0eb49858bb6d3045c025d (commit) via 25054131fde91ee366211edb541a0628ffa4b2e3 (commit) via 96f9ca184489a22e585571f01592fa2dcb93c588 (commit)
This update added new revisions after undoing existing revisions. That is to say, the old revision is not a strict subset of the new revision. This situation occurs when you --force push a change and generate a repository containing something like this:
* -- * -- B -- O -- O -- O (e0a04e8ae2d7a772cab0eb49858bb6d3045c025d) N -- N -- N (25054131fde91ee366211edb541a0628ffa4b2e3)
When this happens we assume that you've already had alert emails for all of the O revisions, and so we here report only the revisions in the N branch from the common base, B.
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/25054131fde91ee366211edb541a0628ffa4b...
commit 25054131fde91ee366211edb541a0628ffa4b2e3 Author: Cyril Hrubis metan@ucw.cz Date: Tue Jun 17 18:39:38 2014 +0200
tests: loaders: Add GP_IOFlush() test.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/tests/loaders/IO.c b/tests/loaders/IO.c index 723c17d0..c193098d 100644 --- a/tests/loaders/IO.c +++ b/tests/loaders/IO.c @@ -257,6 +257,50 @@ static int test_IOFill(void)
static size_t counter;
+static ssize_t flush_write(GP_IO GP_UNUSED(*io), void *buf, size_t size) +{ + size_t to_write = GP_MIN(7u, size); + + if (((uint8_t*)buf)[0] != counter) + return -1; + + counter += to_write; + + return to_write; +} + +static int test_IOFlush(void) +{ + GP_IO io = {.Write = flush_write}; + unsigned int i; + int fail = 0; + uint8_t buf[255]; + + for (i = 0; i < 255; i++) + buf[i] = i; + + for (i = 1; i < 255; i++) { + counter = 0; + if (GP_IOFlush(&io, buf, i)) { + if (!fail) + tst_msg("GP_IOFlush failed"); + fail++; + } + + if (counter != i) { + if (!fail) + tst_msg("Bytes written %zu expected %u", + counter, i); + fail++; + } + } + + if (fail) + return TST_FAILED; + + return TST_SUCCESS; +} + static ssize_t wbuf_write(GP_IO GP_UNUSED(*io), void *buf, size_t size) { unsigned int i; @@ -318,7 +362,6 @@ static int test_IOWBuffer(void) return TST_SUCCESS; }
- const struct tst_suite tst_suite = { .suite_name = "IO", .tests = { @@ -333,8 +376,12 @@ const struct tst_suite tst_suite = { {.name = "IOFill", .tst_fn = test_IOFill},
+ {.name = "IOFlush", + .tst_fn = test_IOFlush}, + {.name = "IOWBuffer", - .tst_fn = test_IOWBuffer}, + .tst_fn = test_IOWBuffer, + .flags = TST_CHECK_MALLOC},
{.name = NULL}, }
http://repo.or.cz/w/gfxprim.git/commit/96f9ca184489a22e585571f01592fa2dcb93c...
commit 96f9ca184489a22e585571f01592fa2dcb93c588 Author: Cyril Hrubis metan@ucw.cz Date: Tue Jun 17 00:02:09 2014 +0200
doc: loaders: Update I/O documentation.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/doc/loaders_io.txt b/doc/loaders_io.txt index 2e010bbc..d3d00a7e 100644 --- a/doc/loaders_io.txt +++ b/doc/loaders_io.txt @@ -73,7 +73,21 @@ This is a wrapper to 'io->Read()'. Reads at most 'size' bytes from an 'IO' stream and stores them into the buffer. Returns number of bytes read.
-On failure the return value is negative and errno is set. +On failure negative value is returned and errno is set. + + +[source,c] +------------------------------------------------------------------------------- +#include <loaders/GP_IO.h> +/* or */ +#include <GP.h> + +int GP_IOFill(GP_IO *io, void *buf, size_t size); +------------------------------------------------------------------------------- + +Similar to 'GP_IORead()' but either reads the whole buffer or fails. + +Returns zero on success and non-zero on failure.
[source,c] @@ -90,7 +104,34 @@ This is a wrapper to 'io->Write()'. Writes at most 'size' bytes from an 'IO' stream and stores them into the buffer. Returns number of bytes read.
-On failure the return value is negative and errno is set. +On failure negative value is returned and errno is set. + + +[source,c] +------------------------------------------------------------------------------- +#include <loaders/GP_IO.h> +/* or */ +#include <GP.h> + +int GP_IOFlush(GP_IO *io, void *buf, size_t size); +------------------------------------------------------------------------------- + +Similar to 'GP_IOWrite()' but either writes the whole buffer or fails. + +Returns zero on success and non-zero on failure. + +[source,c] +------------------------------------------------------------------------------- +#include <loaders/GP_IO.h> +/* or */ +#include <GP.h> + +int GP_IOPrintF(GP_IO *io, const char *fmt, ...); +------------------------------------------------------------------------------- + +Printf-like function for an I/O stream. + +Returns zero on success and non-zero on failure.
[source,c] ------------------------------------------------------------------------------- @@ -106,7 +147,7 @@ This is a wrapper to 'io->Close()'. Finalizes reading/writing, closes file descriptors (in case of file IO), frees memory buffers.
-Returns zero on success, non-zero on IO failure and errno is set. +Returns zero on success, non-zero on I/O failure and errno is set.
[source,c] @@ -115,13 +156,30 @@ Returns zero on success, non-zero on IO failure and errno is set. /* or */ #include <GP.h>
+enum GP_IOWhence { + GP_IO_SEEK_SET = 0, + GP_IO_SEEK_CUR = 1, + GP_IO_SEEK_END = 2, +}; + off_t GP_IOSeek(GP_IO *io, off_t off, enum GP_IOWhence whence); -------------------------------------------------------------------------------
This is a wrapper to 'io->Seek()'.
-//TODO
+Returns '(off_t)-1' on failure and errno is set. + +Generally not all read I/O streams are seekable back (zlib/rle decompression +streams, etc.) but all streams should be able to seek to the start of the +stream, to the end and forward. + +.Most common errno values +|============================================================================== +| 'EINVAL' | Invalid 'whence' or 'off' points outside the stream. +| 'ENOSYS' | Operation not supported, combination of 'whence' and 'off' points + inside the stream (is valid) but action cannot be done. +|==============================================================================
[source,c] ------------------------------------------------------------------------------- @@ -132,7 +190,7 @@ This is a wrapper to 'io->Seek()'. off_t GP_IOTell(GP_IO *io); -------------------------------------------------------------------------------
-Wrapper to 'GP_IOSeek()', returns current position in IO stream. +Wrapper to 'GP_IOSeek()', returns current position in I/O stream.
[source,c] @@ -144,7 +202,7 @@ Wrapper to 'GP_IOSeek()', returns current position in IO stream. off_t GP_IORewind(GP_IO *io) -------------------------------------------------------------------------------
-Wrapper to 'GP_IOSeek()', rewinds to the start of the IO stream. +Wrapper to 'GP_IOSeek()', rewinds to the start of the I/O stream.
Returns zero on success, non-zero on failure and errno is set.
@@ -158,16 +216,17 @@ Returns zero on success, non-zero on failure and errno is set. GP_IO *GP_IOMem(void *buf, size_t size, void (*free)(void *)); -------------------------------------------------------------------------------
-Creates an read-only IO from a memory buffer. +Creates an read-only I/O from a memory buffer.
-Returns initialized IO or in case of failure NULL and errno is set. +Returns initialized I/O or in case of failure NULL and errno is set.
The 'buf' is pointer to the start of the buffer, the 'size' is size in bytes.
The 'free()' callback if not NULL is called with the start of the buffer as an argument on 'IOClose()'.
-TIP: See link:example_memory_io.html[memory IO example]. +TIP: See link:example_memory_io.html[memory I/O example]. +
[source,c] ------------------------------------------------------------------------------- @@ -186,5 +245,24 @@ GP_IO *GP_IOFile(const char *path, enum GP_IOFileMode mode);
Creates an IO stream from a file.
-Returns a pointer to initialized IO stream, or in case of failure NULL and +Returns a pointer to initialized I/O stream, or in case of failure NULL and errno is set. + + +[source,c] +------------------------------------------------------------------------------- +#include <loaders/GP_IO.h> +/* or */ +#include <GP.h> + +GP_IO *GP_IOWBuffer(GP_IO *io, size_t bsize); +------------------------------------------------------------------------------- + +Creates write buffered I/O on the top of an existing I/O. + +Generally you should create a buffered I/O if you are about to write data a +few bytes at the time. + +If 'bsize' is zero default size is choosen. + +TIP: See link:example_loader_registration.html[example buffered I/O usage].
-----------------------------------------------------------------------
Summary of changes: tests/loaders/IO.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 49 insertions(+), 2 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.