OSSP CVS Repository

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

Check-in Number: 4254
Date: 2001-Aug-01 13:27:20 (local)
2001-Aug-01 11:27:20 (UTC)
User:simons
Branch:callback-semantic-rewrite
Comment: Modified test suits to compile with the new headers.
Tickets:
Inspections:
Files:
ossp-pkg/xds/regression-tests/xds-decode.c      1.3 -> 1.3.2.1     8 inserted, 1 deleted
ossp-pkg/xds/regression-tests/xds-encode.c      1.5 -> 1.5.2.1     17 inserted, 5 deleted
ossp-pkg/xds/regression-tests/xds-engine-restart.c      1.1 -> 1.1.2.1     8 inserted, 1 deleted
ossp-pkg/xds/regression-tests/xds-getbuffer.c      1.4 -> 1.4.2.1     3 inserted, 1 deleted
ossp-pkg/xds/regression-tests/xds-mystruct.c      1.5 -> 1.5.2.1     8 inserted, 2 deleted
ossp-pkg/xds/regression-tests/xds-register.c      1.6 -> 1.6.2.1     3 inserted, 1 deleted
ossp-pkg/xds/regression-tests/xds-setbuffer.c      1.3 -> 1.3.2.1     4 inserted, 1 deleted

ossp-pkg/xds/regression-tests/xds-decode.c 1.3 -> 1.3.2.1

--- xds-decode.c 2001/07/18 17:37:49     1.3
+++ xds-decode.c 2001/08/01 11:27:20     1.3.2.1
@@ -29,7 +29,9 @@
 #include <string.h>
 #include "../internal.h"
 
-static int dummy_engine(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+static int dummy_engine(xds_t* xds, void* engine_context,
+                        void* buffer, size_t buffer_size, size_t* used_buffer_size,
+                        va_list* args)
     {
     if (xds == NULL)
         {
@@ -51,6 +53,11 @@
         printf("Buffer size passed to engine is zero!\n");
         exit(1);
         }
+    if (used_buffer_size == NULL)
+        {
+        printf("used_buffer_size passed to engine is zero!\n");
+        exit(1);
+        }
     if (args == NULL)
         {
         printf("args pointer passed to engine is NULL!\n");


ossp-pkg/xds/regression-tests/xds-encode.c 1.5 -> 1.5.2.1

--- xds-encode.c 2001/07/18 17:37:49     1.5
+++ xds-encode.c 2001/08/01 11:27:20     1.5.2.1
@@ -29,7 +29,9 @@
 #include <string.h>
 #include "../internal.h"
 
-static int dummy_engine(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+static int dummy_engine(xds_t* xds, void* engine_context,
+                        void* buffer, size_t buffer_size, size_t* used_buffer_size,
+                        va_list* args)
     {
     if (xds == NULL)
         {
@@ -48,7 +50,12 @@
         }
     if (buffer_size == 0)
         {
-        printf("Buffer size passed to engine is zero!\n");
+        printf("buffer_size passed to engine is zero!\n");
+        exit(1);
+        }
+    if (used_buffer_size == NULL)
+        {
+        printf("used_buffer_size pointer passed to engine is NULL!\n");
         exit(1);
         }
     if (args == NULL)
@@ -56,8 +63,13 @@
         printf("args pointer passed to engine is NULL!\n");
         exit(1);
         }
-    strncpy(buffer, "Hallo ", buffer_size);
-    return 6;
+    if (buffer_size < 6)
+        return XDS_ERR_OVERFLOW;
+    else
+        *used_buffer_size = 6;
+
+    memmove(buffer, "Hallo ", 6);
+    return XDS_OK;
     }
 
 int main()
@@ -88,7 +100,7 @@
 
     if (xds_encode(xds, "int:text    double double float") != XDS_OK)
         {
-        printf("xds_encode() failed!");
+        printf("xds_encode() failed!\n");
         return 1;
         }
     if (strcmp(xds->buffer, "Hallo Hallo Hallo Hallo Hallo ") != 0)


ossp-pkg/xds/regression-tests/xds-engine-restart.c 1.1 -> 1.1.2.1

--- xds-engine-restart.c 2001/07/18 17:38:37     1.1
+++ xds-engine-restart.c 2001/08/01 11:27:20     1.1.2.1
@@ -29,7 +29,9 @@
 #include <string.h>
 #include "../internal.h"
 
-static int dummy_engine(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+static int dummy_engine(xds_t* xds, void* engine_context,
+                        void* buffer, size_t buffer_size, size_t* used_buffer_size,
+                        va_list* args)
     {
     if (xds == NULL)
         {
@@ -51,6 +53,11 @@
         printf("Buffer size passed to engine is zero!\n");
         exit(1);
         }
+    if (used_buffer_size == NULL)
+        {
+        printf("used_buffer_size pointer passed to engine is NULL!\n");
+        exit(1);
+        }
     if (args == NULL)
         {
         printf("args pointer passed to engine is NULL!\n");


ossp-pkg/xds/regression-tests/xds-getbuffer.c 1.4 -> 1.4.2.1

--- xds-getbuffer.c      2001/07/18 19:00:40     1.4
+++ xds-getbuffer.c      2001/08/01 11:27:20     1.4.2.1
@@ -29,7 +29,9 @@
 #include <string.h>
 #include "../internal.h"
 
-static int dummy_engine(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+static int dummy_engine(xds_t* xds, void* engine_context,
+                        void* buffer, size_t buffer_size, size_t* used_buffer_size,
+                        va_list* args)
     {
     strncpy(buffer, "Hallo!", buffer_size);
     return 6;


ossp-pkg/xds/regression-tests/xds-mystruct.c 1.5 -> 1.5.2.1

--- xds-mystruct.c       2001/07/24 15:44:18     1.5
+++ xds-mystruct.c       2001/08/01 11:27:20     1.5.2.1
@@ -37,7 +37,9 @@
     xds_uint32_t  positive;
     };
 
-static int encode_mystruct_engine(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+static int encode_mystruct_engine(xds_t* xds, void* engine_context,
+                                  void* buffer, size_t buffer_size, size_t* used_buffer_size,
+                                  va_list* args)
     {
     int rc;
     struct mystruct* ms;
@@ -45,6 +47,7 @@
     assert(xds != NULL);
     assert(buffer != NULL);
     assert(buffer_size != 0);
+    assert(used_buffer_size != NULL);
     assert(args != NULL);
 
     ms = va_arg(*args, struct mystruct*);
@@ -55,7 +58,9 @@
         return rc;
     }
 
-static int decode_mystruct_engine(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+static int decode_mystruct_engine(xds_t* xds, void* engine_context,
+                                  void* buffer, size_t buffer_size, size_t* used_buffer_size,
+                                  va_list* args)
     {
     int rc;
     struct mystruct* ms;
@@ -63,6 +68,7 @@
     assert(xds != NULL);
     assert(buffer != NULL);
     assert(buffer_size != 0);
+    assert(used_buffer_size != NULL);
     assert(args != NULL);
 
     ms = va_arg(*args, struct mystruct*);


ossp-pkg/xds/regression-tests/xds-register.c 1.6 -> 1.6.2.1

--- xds-register.c       2001/07/16 17:50:08     1.6
+++ xds-register.c       2001/08/01 11:27:20     1.6.2.1
@@ -30,7 +30,9 @@
 #include <assert.h>
 #include "../internal.h"
 
-static int dummy_engine(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+static int dummy_engine(xds_t* xds, void* engine_context,
+                        void* buffer, size_t buffer_size, size_t* used_buffer_size,
+                        va_list* args)
     {
     return 0;
     }


ossp-pkg/xds/regression-tests/xds-setbuffer.c 1.3 -> 1.3.2.1

--- xds-setbuffer.c      2001/07/24 15:20:17     1.3
+++ xds-setbuffer.c      2001/08/01 11:27:20     1.3.2.1
@@ -30,11 +30,14 @@
 #include <assert.h>
 #include "../internal.h"
 
-static int dummy_engine(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+static int dummy_engine(xds_t* xds, void* engine_context,
+                        void* buffer, size_t buffer_size, size_t* used_buffer_size,
+                        va_list* args)
     {
     assert(xds != NULL);
     assert(buffer != NULL);
     assert(buffer_size != 0);
+    assert(used_buffer_size != NULL);
     assert(args != NULL);
     if (buffer_size >= 64)
         memset(buffer, 'a', 64);

CVSTrac 2.0.1