OSSP CVS Repository

ossp - Check-in [950]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 950
Date: 2001-Sep-12 11:39:16 (local)
2001-Sep-12 09:39:16 (UTC)
User:ms
Branch:
Comment: Corrected bufsize variable inconsistency and upgraded file descriptor handler to new L2_LEVEL parameter design.
Tickets:
Inspections:
Files:
ossp-pkg/l2/l2_ch_buffer.c      1.18 -> 1.19     16 inserted, 16 deleted

ossp-pkg/l2/l2_ch_buffer.c 1.18 -> 1.19

--- l2_ch_buffer.c       2001/09/11 11:59:59     1.18
+++ l2_ch_buffer.c       2001/09/12 09:39:16     1.19
@@ -97,28 +97,28 @@
 }
 
 /* write to channel */
-static l2_result_t hook_write(l2_context_t *ctx, l2_channel_t *ch, 
-                      const char *buf, size_t bufsize)
+static l2_result_t hook_write(l2_context_t *ctx, l2_channel_t *ch,
+                              l2_level_t level, const char *buf, size_t buf_size)
 {
     l2_ch_buffer_t *cfg = (l2_ch_buffer_t *)ctx->vp;
     l2_channel_t *downstream = l2_channel_downstream(ch);
     l2_result_t rv;
 
-    if (bufsize > (cfg->bufsize - cfg->bufpos)) {
+    if (buf_size > (cfg->bufsize - cfg->bufpos)) {
         /* flush buffer if necessary */
         if (cfg->bufpos > 0) {
-            if ((rv = l2_channel_write(downstream, cfg->buf, cfg->bufpos)) != L2_OK)
+            if ((rv = l2_channel_write(downstream, level, cfg->buf, cfg->bufpos)) != L2_OK)
                 return rv;
             cfg->bufpos = 0;
         }
         /* pass through immediately to downstream if still too large */
-        if (bufsize > cfg->bufsize)
-            return l2_channel_write(downstream, buf, bufsize);
+        if (buf_size > cfg->bufsize)
+            return l2_channel_write(downstream, level, buf, buf_size);
     }
 
     /* write message to channel buffer */
-    memcpy(cfg->buf+cfg->bufpos, buf, bufsize);
-    cfg->bufpos += bufsize;
+    memcpy(cfg->buf+cfg->bufpos, buf, buf_size);
+    cfg->bufpos += buf_size;
 
     return L2_OK;
 }
@@ -131,10 +131,10 @@
     l2_result_t rv;
 
     /* write the buffer contents downstream */
-    if (cfg->bufpos > 0) {
-        if ((rv = l2_channel_write(downstream, cfg->buf, cfg->bufpos)) != L2_OK)
-            return rv;
-        cfg->bufpos = 0;
+    if (cfg->bufpos > 0) {                    /* !---------! */
+        if ((rv = l2_channel_write(downstream, L2_LEVEL_PANIC, cfg->buf, cfg->bufpos)) != L2_OK)
+            return rv;                        /* !! FIXME !! */
+        cfg->bufpos = 0;                      /* !---------! */
     }
 
     /* optionally flush downstream channel, too */
@@ -152,10 +152,10 @@
     l2_result_t rv;
 
     /* write pending data before closing down */
-    if (cfg->bufpos > 0) {
-        if ((rv = l2_channel_write(downstream, cfg->buf, cfg->bufpos)) != L2_OK)
-            return rv;
-        cfg->bufpos = 0;
+    if (cfg->bufpos > 0) {                    /* !---------! */
+        if ((rv = l2_channel_write(downstream, L2_LEVEL_PANIC, cfg->buf, cfg->bufpos)) != L2_OK)
+            return rv;                        /* !! FIXME !! */
+        cfg->bufpos = 0;                      /* !---------! */
     }
 
     /* optionally close downstream channel, too */

CVSTrac 2.0.1