OSSP CVS Repository

ossp - Difference in ossp-pkg/l2/l2_stream.c versions 1.10 and 1.11
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

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;
 }
 

CVSTrac 2.0.1