summaryrefslogtreecommitdiffstats
path: root/src/tests/mcalign-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/mcalign-test.c')
-rw-r--r--src/tests/mcalign-test.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/tests/mcalign-test.c b/src/tests/mcalign-test.c
index 1584256c..9e358359 100644
--- a/src/tests/mcalign-test.c
+++ b/src/tests/mcalign-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -31,9 +29,10 @@
#include <stdlib.h>
#include <time.h>
+#include <pulse/gccmacro.h>
+
#include <pulsecore/core-util.h>
#include <pulsecore/mcalign.h>
-#include <pulsecore/gccmacro.h>
/* A simple program for testing pa_mcalign */
@@ -45,7 +44,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
p = pa_mempool_new(0);
a = pa_mcalign_new(11);
-
+
pa_memchunk_reset(&c);
srand(time(NULL));
@@ -66,13 +65,15 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
l = l <= 1 ? l : rand() % (l-1) +1 ;
p = pa_memblock_acquire(c.memblock);
+
if ((r = read(STDIN_FILENO, (uint8_t*) p + c.index, l)) <= 0) {
pa_memblock_release(c.memblock);
fprintf(stderr, "read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
break;
}
+
pa_memblock_release(c.memblock);
-
+
c.length = r;
pa_mcalign_push(a, &c);
fprintf(stderr, "Read %ld bytes\n", (long)r);