OSSP CVS Repository

ossp - Difference in ossp-pkg/xds/vencode.c versions 1.12.2.1 and 1.12.2.2
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/xds/vencode.c 1.12.2.1 -> 1.12.2.2

--- vencode.c    2001/08/01 09:55:58     1.12.2.1
+++ vencode.c    2001/08/01 11:26:16     1.12.2.2
@@ -105,6 +105,7 @@
             if (xds_find_engine(xds->engines, xds->engines_len, name, &pos))
                 {
                 int restart_engine;
+                size_t used_buffer_size;
                 do
                     {
                     args_backup = args;
@@ -112,47 +113,33 @@
                                                      xds->engines[pos].context,
                                                      xds->buffer + xds->buffer_len,
                                                      xds->buffer_capacity - xds->buffer_len,
+                                                     &used_buffer_size,
                                                      &args);
-                    if (rc < 0)
-                        goto leave;
-                    else if (rc >= xds->buffer_capacity - xds->buffer_len)
+                    assert(rc <= 0);
+                    if (rc == XDS_OK)
+                        {
+                        restart_engine = XDS_FALSE;
+                        xds->buffer_len += used_buffer_size;
+                        }
+                    else if (rc == XDS_ERR_OVERFLOW)
                         {               /* enlarge buffer */
-                        int rc2;
-
-                        if (rc > xds->buffer_capacity - xds->buffer_len)
-                            {
-                            restart_engine = XDS_TRUE;
-                            args = args_backup;
-                            }
-                        else
-                            {
-                            restart_engine = XDS_FALSE;
-                            xds->buffer_len += rc;
-                            }
-
                         if (!xds->we_own_buffer)
-                            {
-                            rc = XDS_ERR_OVERFLOW;
                             goto leave;
-                            }
 
-                        rc2 = xds_set_capacity((void**)&xds->buffer,
-                                               &xds->buffer_capacity,
-                                               xds->buffer_capacity + rc,
-                                               sizeof(char),
-                                               XDS_INITIAL_BUFFER_CAPACITY);
-                        assert(rc2 == XDS_OK || rc2 == XDS_ERR_NO_MEM);
-                        if (rc2 != XDS_OK)
-                            {
-                            rc = rc2;
+                        restart_engine = XDS_TRUE;
+                        args = args_backup;
+
+                        rc = xds_set_capacity((void**)&xds->buffer,
+                                              &xds->buffer_capacity,
+                                              xds->buffer_capacity + 1,
+                                              sizeof(char),
+                                              XDS_INITIAL_BUFFER_CAPACITY);
+                        assert(rc == XDS_OK || rc == XDS_ERR_NO_MEM);
+                        if (rc != XDS_OK)
                             goto leave;
-                            }
                         }
                     else
-                        {
-                        restart_engine = XDS_FALSE;
-                        xds->buffer_len += rc;
-                        }
+                        goto leave;
                     }
                 while (restart_engine);
                 }

CVSTrac 2.0.1