Check-in Number:
|
850 | |
Date: |
2001-Sep-05 09:38:04 (local)
2001-Sep-05 07:38:04 (UTC) |
User: | rse |
Branch: | |
Comment: |
on stream attachment of a channel stack, make sure the stack of channels
consists of zero or more filter channels followed by exactly one output
channel. I knew that providing l2_channel_type() will be useful... ;) |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/l2/l2_stream.c 1.10 -> 1.11
--- l2_stream.c 2001/09/04 14:56:25 1.10
+++ l2_stream.c 2001/09/05 07:38:04 1.11
@@ -49,15 +49,30 @@
l2_result_t l2_stream_channel(l2_stream_t *st, l2_channel_t *ch, unsigned int levelmask)
{
int i;
+ l2_channel_t *chC;
+ l2_channel_t *chN;
if (st == NULL || ch == NULL || levelmask == 0)
return L2_ERROR;
+
+ /* make sure the stack of channels consists of zero or more
+ filter channels followed by exactly one output channel */
+ for (chC = ch; (chN = l2_channel_downstream(chC)) != NULL; chC = chN)
+ if (l2_channel_type(chC) != L2_CHANNEL_FILTER)
+ return L2_ERROR;
+ if (l2_channel_type(chC) != L2_CHANNEL_OUTPUT)
+ return L2_ERROR;
+
+ /* find next free channel position in channel array */
for (i = 0; i < L2_MAX_CHANNELS && st->channels[i].ch != NULL; i++)
;
if (i == L2_MAX_CHANNELS)
return L2_ERROR;
+
+ /* attach this channel */
st->channels[i].ch = ch;
st->channels[i].levelmask = levelmask;
+
return L2_OK;
}
|
|