test/buffer_tests.c

changeset 69
fb59270b1de3
parent 64
16590c9c497c
child 71
303dabadff1c
--- a/test/buffer_tests.c	Thu Oct 11 16:29:30 2012 +0200
+++ b/test/buffer_tests.c	Fri Oct 12 10:54:55 2012 +0200
@@ -5,7 +5,7 @@
 #include "buffer_tests.h"
 
 UCX_TEST_IMPLEMENT(test_ucx_buffer_seektell) {
-    char *buffer = malloc(16);
+    char *buffer = (char*) malloc(16);
     memset(buffer, 32, 7);
     buffer[7] = 0;
 
@@ -48,7 +48,7 @@
 }
 
 UCX_TEST_IMPLEMENT(test_ucx_buffer_putc) {
-    char *buffer = malloc(16);
+    char *buffer = (char*) malloc(16);
     memset(buffer, 32, 16);
 
     UcxBuffer *b = ucx_buffer_new(buffer, 16, UCX_BUFFER_DEFAULT);
@@ -74,7 +74,7 @@
 }
 
 UCX_TEST_IMPLEMENT(test_ucx_buffer_getc) {
-    char *buffer = malloc(16);
+    char *buffer = (char*) malloc(16);
     memset(buffer, 32, 8);
     for (int i = 8; i < 16 ; i++) {
         buffer[i] = 40+i;
@@ -104,7 +104,7 @@
 }
 
 UCX_TEST_IMPLEMENT(test_ucx_buffer_write) {
-    char *buffer = malloc(16);
+    char *buffer = (char*) malloc(16);
     memset(buffer, 32, 8);
     for (int i = 8; i < 16 ; i++) {
         buffer[i] = 40+i;
@@ -115,8 +115,8 @@
 
     UCX_TEST_BEGIN
 
-    char* teststring = "this is way too much";
-    r = ucx_buffer_write(teststring, 1, 20, b);
+    const char* teststring = "this is way too much";
+    r = ucx_buffer_write((void*)teststring, 1, 20, b);
     UCX_TEST_ASSERT(r == 16, "string not correctly trimed");
     UCX_TEST_ASSERT(memcmp(buffer, teststring, 16) == 0,
             "buffer data incorrect");
@@ -128,10 +128,10 @@
     UCX_TEST_ASSERT(memcmp(buffer, "this is not too much", 16) == 0,
             "modified buffer is incorrect");
 
-    char* threebytestring = "  t  h  r  e  e   ";
+    const char* threebytestring = "  t  h  r  e  e   ";
     memset(buffer, 49, 16);
     ucx_buffer_seek(b, 0, SEEK_SET);
-    r = ucx_buffer_write(threebytestring, 3, 6, b);
+    r = ucx_buffer_write((void*)threebytestring, 3, 6, b);
     UCX_TEST_ASSERT(r == 15, "three byte string not correctly trimed");
     UCX_TEST_ASSERT(b->pos == 15,
             "position after write of three byte string incorrect");
@@ -146,7 +146,7 @@
 }
 
 UCX_TEST_IMPLEMENT(test_ucx_buffer_write_ax) {
-    char *buffer = malloc(4);
+    char *buffer = (char*) malloc(4);
 
     UcxBuffer *b = ucx_buffer_new(buffer, 16,
             UCX_BUFFER_AUTOEXTEND | UCX_BUFFER_AUTOFREE);
@@ -154,9 +154,9 @@
 
     UCX_TEST_BEGIN
 
-    char* teststring = "this is way too much";
-    r = ucx_buffer_write(teststring, 1, 20, b);
-    buffer = b->space; /* autoextend is enabled, so we MUST retrieve pointer */
+    const char* teststring = "this is way too much";
+    r = ucx_buffer_write((void*)teststring, 1, 20, b);
+    buffer = (char*) b->space; /*autoextend enabled, we MUST retrieve pointer*/
     UCX_TEST_ASSERT(r == 20, "not all characters written");
     UCX_TEST_ASSERT(b->size == 32, "buffer not properly extended");
     UCX_TEST_ASSERT(b->pos == 20, "position incorrect");
@@ -170,7 +170,7 @@
 }
 
 UCX_TEST_IMPLEMENT(test_ucx_buffer_read) {
-    char *buffer = malloc(16);
+    char *buffer = (char*) malloc(16);
     memset(buffer, 56, 8);
     for (int i = 8; i < 16 ; i++) {
         buffer[i] = 40+i;
@@ -211,7 +211,7 @@
 }
 
 UCX_TEST_IMPLEMENT(test_ucx_buffer_extract) {
-    char *buffer = malloc(16);
+    char *buffer = (char*) malloc(16);
     strcpy(buffer, "this is a test!");
 
     UcxBuffer *src = ucx_buffer_new(buffer, 16, UCX_BUFFER_AUTOFREE),

mercurial