You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2017/12/03 01:02:50 UTC

[20/50] [abbrv] thrift git commit: THRIFT-4376: fix a few high impact coverity defects: 1458947: memory leak in compiler 1458787: resource leak in c_glib led to discovery of assert() abuse 1459090: fix string.find result check in JSON processor (unlikely

THRIFT-4376: fix a few high impact coverity defects:
1458947: memory leak in compiler
1458787: resource leak in c_glib led to discovery of assert() abuse
1459090: fix string.find result check in JSON processor (unlikely)

This closes #1404


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/43f4bf2f
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/43f4bf2f
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/43f4bf2f

Branch: refs/heads/0.11.0
Commit: 43f4bf2fdd13c7466e3fea690d436c6a9540f303
Parents: d4df917
Author: James E. King, III <jk...@apache.org>
Authored: Sat Oct 28 12:54:02 2017 -0400
Committer: James E. King, III <jk...@apache.org>
Committed: Sat Oct 28 16:44:09 2017 -0400

----------------------------------------------------------------------
 compiler/cpp/src/thrift/parse/t_function.h      |  15 +-
 .../protocol/thrift_multiplexed_protocol.c      |   1 -
 .../c_glib/protocol/thrift_protocol_decorator.c |   6 +-
 .../transport/thrift_buffered_transport.c       |   3 +-
 .../c_glib/transport/thrift_framed_transport.c  |   3 +-
 .../c_glib/transport/thrift_memory_buffer.c     |   1 -
 lib/c_glib/test/testbinaryprotocol.c            | 287 ++++-----
 lib/c_glib/test/testbufferedtransport.c         |  49 +-
 lib/c_glib/test/testcompactprotocol.c           | 643 +++++++++---------
 lib/c_glib/test/testdebugproto.c                |   9 +-
 lib/c_glib/test/testfdtransport.c               |  57 +-
 lib/c_glib/test/testframedtransport.c           |  27 +-
 lib/c_glib/test/testmemorybuffer.c              |  53 +-
 lib/c_glib/test/testoptionalrequired.c          |  31 +-
 lib/c_glib/test/testsimpleserver.c              |   7 +-
 lib/c_glib/test/teststruct.c                    |   3 +-
 lib/c_glib/test/testthrifttest.c                |   9 +-
 lib/c_glib/test/testtransportsocket.c           |  27 +-
 lib/c_glib/test/testtransportsslsocket.c        | 645 +++++++++----------
 lib/cpp/src/thrift/protocol/TJSONProtocol.cpp   |   2 +-
 test/known_failures_Linux.json                  |   6 +
 21 files changed, 941 insertions(+), 943 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/compiler/cpp/src/thrift/parse/t_function.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/parse/t_function.h b/compiler/cpp/src/thrift/parse/t_function.h
index 05dc930..22d2609 100644
--- a/compiler/cpp/src/thrift/parse/t_function.h
+++ b/compiler/cpp/src/thrift/parse/t_function.h
@@ -34,8 +34,12 @@
 class t_function : public t_doc {
 public:
   t_function(t_type* returntype, std::string name, t_struct* arglist, bool oneway = false)
-    : returntype_(returntype), name_(name), arglist_(arglist), oneway_(oneway) {
-    xceptions_ = new t_struct(NULL);
+    : returntype_(returntype),
+      name_(name),
+      arglist_(arglist),
+      xceptions_(new t_struct(NULL)),
+      own_xceptions_(true),
+      oneway_(oneway) {
     if (oneway_ && (!returntype_->is_void())) {
       pwarning(1, "Oneway methods should return void.\n");
     }
@@ -50,6 +54,7 @@ public:
       name_(name),
       arglist_(arglist),
       xceptions_(xceptions),
+      own_xceptions_(false),
       oneway_(oneway) {
     if (oneway_ && !xceptions_->get_members().empty()) {
       throw std::string("Oneway methods can't throw exceptions.");
@@ -59,7 +64,10 @@ public:
     }
   }
 
-  ~t_function() {}
+  ~t_function() {
+    if (own_xceptions_)
+      delete xceptions_;
+  }
 
   t_type* get_returntype() const { return returntype_; }
 
@@ -78,6 +86,7 @@ private:
   std::string name_;
   t_struct* arglist_;
   t_struct* xceptions_;
+  bool own_xceptions_;
   bool oneway_;
 };
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c b/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c
index dec4dbd..c74f048 100644
--- a/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c
@@ -50,7 +50,6 @@ thrift_multiplexed_protocol_write_message_begin (ThriftMultiplexedProtocol *prot
 
   ThriftMultiplexedProtocol *self = THRIFT_MULTIPLEXED_PROTOCOL (protocol);
   ThriftMultiplexedProtocolClass *multiplexClass = THRIFT_MULTIPLEXED_PROTOCOL_GET_CLASS(self);
-  ThriftProtocolClass *cls = THRIFT_PROTOCOL_CLASS (multiplexClass);
 
   if( (message_type == T_CALL || message_type == T_ONEWAY) && self->service_name != NULL) {
     service_name = g_strdup_printf("%s%s%s", self->service_name, THRIFT_MULTIPLEXED_PROTOCOL_DEFAULT_SEPARATOR, name);

http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c
index 4480315..1feec34 100644
--- a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c
@@ -52,7 +52,7 @@ thrift_protocol_decorator_write_message_begin (ThriftProtocol *protocol,
   ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
   ThriftProtocolClass *proto = THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol);
 
-  g_debug("Concrete protocol %p | %p", self->concrete_protocol, proto);
+  g_debug("Concrete protocol %p | %p", (void *)self->concrete_protocol, (void *)proto);
 
   return proto->write_message_begin (self->concrete_protocol, name,
                                     message_type, seqid,
@@ -492,7 +492,7 @@ thrift_protocol_decorator_set_property (GObject      *object,
   {
   case PROP_THRIFT_TYPE_PROTOCOL_DECORATOR_CONCRETE_PROTOCOL:
     self->concrete_protocol = g_value_dup_object (value);
-    g_debug("Setting concrete protocol %p to %p in %s", self, self->concrete_protocol, g_type_name(G_TYPE_FROM_INSTANCE(object)));
+    g_debug("Setting concrete protocol %p to %p in %s", (void *)self, (void *)self->concrete_protocol, g_type_name(G_TYPE_FROM_INSTANCE(object)));
     break;
 
   default:
@@ -534,7 +534,7 @@ thrift_protocol_decorator_get_concrete_protocol(ThriftProtocolDecorator *protoco
     return NULL;
   }
   ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR(protocol);
-  g_debug("Getting concrete protocol from %X -> %X", self, self->concrete_protocol);
+  g_debug("Getting concrete protocol from %p -> %p", (void *)self, (void *)self->concrete_protocol);
 
   return retval;
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c
index ede28cf..0ab3e93 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c
@@ -17,7 +17,6 @@
  * under the License.
  */
 
-#include <assert.h>
 #include <netdb.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -84,7 +83,7 @@ thrift_buffered_transport_read_slow (ThriftTransport *transport, gpointer buf,
   guint32 have = t->r_buf->len;
 
   /* we shouldn't hit this unless the buffer doesn't have enough to read */
-  assert (t->r_buf->len < want);
+  g_assert (t->r_buf->len < want);
 
   /* first copy what we have in our buffer. */
   if (have > 0)

http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c
index 4c8b71f..c548246 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c
@@ -17,7 +17,6 @@
  * under the License.
  */
 
-#include <assert.h>
 #include <netdb.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -120,7 +119,7 @@ thrift_framed_transport_read_slow (ThriftTransport *transport, gpointer buf,
   gint32 result = -1;
 
   /* we shouldn't hit this unless the buffer doesn't have enough to read */
-  assert (t->r_buf->len < want);
+  g_assert (t->r_buf->len < want);
 
   /* first copy what we have in our buffer, if there is anything left */
   if (have > 0)

http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c
index b96db35..91818e9 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c
@@ -17,7 +17,6 @@
  * under the License.
  */
 
-#include <assert.h>
 #include <netdb.h>
 #include <stdlib.h>
 #include <stdio.h>

http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/test/testbinaryprotocol.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testbinaryprotocol.c b/lib/c_glib/test/testbinaryprotocol.c
index 58f4df8..14f4fb0 100755
--- a/lib/c_glib/test/testbinaryprotocol.c
+++ b/lib/c_glib/test/testbinaryprotocol.c
@@ -19,7 +19,7 @@
 
 /* Disable string-function optimizations when glibc is used, as these produce
    compiler warnings about string length when a string function is used inside
-   a call to assert () */
+   a call to g_assert () */
 #ifdef __GLIBC__
 #include <features.h>
 #define __NO_STRING_INLINES 1
@@ -28,7 +28,6 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <assert.h>
 #include <netdb.h>
 #include <string.h>
 #include <sys/wait.h>
@@ -96,7 +95,7 @@ test_create_and_destroy(void)
 
   /* create an object and then destroy it */
   object = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, NULL);
-  assert (object != NULL);
+  g_assert (object != NULL);
   g_object_unref (object);
 }
 
@@ -110,11 +109,11 @@ test_initialize(void)
   /* create a ThriftTransport */
   tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
                           "port", 51188, NULL);
-  assert (tsocket != NULL);
+  g_assert (tsocket != NULL);
   /* create a ThriftBinaryProtocol using the Transport */
   protocol = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport",
                            tsocket, NULL);
-  assert (protocol != NULL);
+  g_assert (protocol != NULL);
   /* fetch the properties */
   g_object_get (G_OBJECT(protocol), "transport", &temp, NULL);
   g_object_unref (temp);
@@ -139,7 +138,7 @@ test_read_and_write_primitives(void)
 
   /* fork a server from the client */
   pid = fork ();
-  assert (pid >= 0);
+  g_assert (pid >= 0);
 
   if (pid == 0)
   {
@@ -155,48 +154,48 @@ test_read_and_write_primitives(void)
                             "port", port, NULL);
     transport = THRIFT_TRANSPORT (tsocket);
     thrift_transport_open (transport, NULL);
-    assert (thrift_transport_is_open (transport));
+    g_assert (thrift_transport_is_open (transport));
 
     /* create a ThriftBinaryTransport */
     tb = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport",
                        tsocket, NULL);
     protocol = THRIFT_PROTOCOL (tb);
-    assert (protocol != NULL);
+    g_assert (protocol != NULL);
 
     /* write a bunch of primitives */
-    assert (thrift_binary_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
-    assert (thrift_binary_protocol_write_byte (protocol, TEST_BYTE, NULL) > 0);
-    assert (thrift_binary_protocol_write_i16 (protocol, TEST_I16, NULL) > 0);
-    assert (thrift_binary_protocol_write_i32 (protocol, TEST_I32, NULL) > 0);
-    assert (thrift_binary_protocol_write_i64 (protocol, TEST_I64, NULL) > 0);
-    assert (thrift_binary_protocol_write_double (protocol, 
+    g_assert (thrift_binary_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
+    g_assert (thrift_binary_protocol_write_byte (protocol, TEST_BYTE, NULL) > 0);
+    g_assert (thrift_binary_protocol_write_i16 (protocol, TEST_I16, NULL) > 0);
+    g_assert (thrift_binary_protocol_write_i32 (protocol, TEST_I32, NULL) > 0);
+    g_assert (thrift_binary_protocol_write_i64 (protocol, TEST_I64, NULL) > 0);
+    g_assert (thrift_binary_protocol_write_double (protocol, 
                                                  TEST_DOUBLE, NULL) > 0);
-    assert (thrift_binary_protocol_write_string (protocol,
+    g_assert (thrift_binary_protocol_write_string (protocol,
                                                  TEST_STRING, NULL) > 0);
-    assert (thrift_binary_protocol_write_string (protocol, "", NULL) > 0);
-    assert (thrift_binary_protocol_write_binary (protocol, binary, 
+    g_assert (thrift_binary_protocol_write_string (protocol, "", NULL) > 0);
+    g_assert (thrift_binary_protocol_write_binary (protocol, binary, 
                                                  len, NULL) > 0);
-    assert (thrift_binary_protocol_write_binary (protocol, NULL, 0, NULL) > 0);
-    assert (thrift_binary_protocol_write_binary (protocol, binary,
+    g_assert (thrift_binary_protocol_write_binary (protocol, NULL, 0, NULL) > 0);
+    g_assert (thrift_binary_protocol_write_binary (protocol, binary,
                                                  len, NULL) > 0);
 
     /* test write errors */
     transport_write_error = 1;
-    assert (thrift_binary_protocol_write_byte (protocol, TEST_BYTE, 
+    g_assert (thrift_binary_protocol_write_byte (protocol, TEST_BYTE, 
                                                NULL) == -1);
-    assert (thrift_binary_protocol_write_i16 (protocol, TEST_I16, NULL) == -1);
-    assert (thrift_binary_protocol_write_i32 (protocol, TEST_I32, NULL) == -1);
-    assert (thrift_binary_protocol_write_i64 (protocol, TEST_I64, NULL) == -1);
-    assert (thrift_binary_protocol_write_double (protocol, TEST_DOUBLE,
+    g_assert (thrift_binary_protocol_write_i16 (protocol, TEST_I16, NULL) == -1);
+    g_assert (thrift_binary_protocol_write_i32 (protocol, TEST_I32, NULL) == -1);
+    g_assert (thrift_binary_protocol_write_i64 (protocol, TEST_I64, NULL) == -1);
+    g_assert (thrift_binary_protocol_write_double (protocol, TEST_DOUBLE,
                                                  NULL) == -1);
-    assert (thrift_binary_protocol_write_binary (protocol, binary, len,
+    g_assert (thrift_binary_protocol_write_binary (protocol, binary, len,
                                                  NULL) == -1);
     transport_write_error = 0;
 
     /* test binary partial failure */
     transport_write_count = 0;
     transport_write_error_at = 1;
-    assert (thrift_binary_protocol_write_binary (protocol, binary,
+    g_assert (thrift_binary_protocol_write_binary (protocol, binary,
                                                  len, NULL) == -1);
     transport_write_error_at = -1;
 
@@ -204,8 +203,8 @@ test_read_and_write_primitives(void)
     thrift_transport_close (transport, NULL);
     g_object_unref (tsocket);
     g_object_unref (protocol);
-    assert (wait (&status) == pid);
-    assert (status == 0);
+    g_assert (wait (&status) == pid);
+    g_assert (status == 0);
   }
 }
 
@@ -222,7 +221,7 @@ test_read_and_write_complex_types (void)
 
   /* fork a server from the client */
   pid = fork ();
-  assert (pid >= 0);
+  g_assert (pid >= 0);
 
   if (pid == 0)
   {
@@ -238,33 +237,33 @@ test_read_and_write_complex_types (void)
                             "port", port, NULL);
     transport = THRIFT_TRANSPORT (tsocket);
     thrift_transport_open (transport, NULL);
-    assert (thrift_transport_is_open (transport));
+    g_assert (thrift_transport_is_open (transport));
 
     /* create a ThriftBinaryTransport */
     tb = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport",
                        tsocket, NULL);
     protocol = THRIFT_PROTOCOL (tb);
-    assert (protocol != NULL);
+    g_assert (protocol != NULL);
 
     /* test structures */
-    assert (thrift_binary_protocol_write_struct_begin (protocol, 
+    g_assert (thrift_binary_protocol_write_struct_begin (protocol, 
                                                        NULL, NULL) == 0);
-    assert (thrift_binary_protocol_write_struct_end (protocol, NULL) == 0);
+    g_assert (thrift_binary_protocol_write_struct_end (protocol, NULL) == 0);
 
-    assert (thrift_binary_protocol_write_field_begin (protocol, "test", T_VOID,
+    g_assert (thrift_binary_protocol_write_field_begin (protocol, "test", T_VOID,
                                                       1, NULL) > 0);
-    assert (thrift_binary_protocol_write_field_end (protocol, NULL) == 0);
+    g_assert (thrift_binary_protocol_write_field_end (protocol, NULL) == 0);
 
     /* test write error */
     transport_write_error = 1;
-    assert (thrift_binary_protocol_write_field_begin (protocol, "test", T_VOID, 
+    g_assert (thrift_binary_protocol_write_field_begin (protocol, "test", T_VOID, 
                                                       1, NULL) == -1);
     transport_write_error = 0;
 
     /* test 2nd write error */
     transport_write_count = 0;
     transport_write_error_at = 1;
-    assert (thrift_binary_protocol_write_field_begin (protocol, "test", T_VOID,
+    g_assert (thrift_binary_protocol_write_field_begin (protocol, "test", T_VOID,
                                                       1, NULL) == -1);
     transport_write_error_at = -1;
 
@@ -272,12 +271,12 @@ test_read_and_write_complex_types (void)
     thrift_binary_protocol_write_byte (protocol, T_VOID, NULL);
 
     /* test write_field_stop */
-    assert (thrift_binary_protocol_write_field_stop (protocol, NULL) > 0);
+    g_assert (thrift_binary_protocol_write_field_stop (protocol, NULL) > 0);
 
     /* write a map */
-    assert (thrift_binary_protocol_write_map_begin (protocol, T_VOID, T_VOID,
+    g_assert (thrift_binary_protocol_write_map_begin (protocol, T_VOID, T_VOID,
                                                     1, NULL) > 0);
-    assert (thrift_binary_protocol_write_map_end (protocol, NULL) == 0);
+    g_assert (thrift_binary_protocol_write_map_end (protocol, NULL) == 0);
 
     /* test 2nd read failure on a map */
     thrift_binary_protocol_write_byte (protocol, T_VOID, NULL);
@@ -288,21 +287,21 @@ test_read_and_write_complex_types (void)
 
     /* test 1st write failure on a map */
     transport_write_error = 1;
-    assert (thrift_binary_protocol_write_map_begin (protocol, T_VOID, T_VOID,
+    g_assert (thrift_binary_protocol_write_map_begin (protocol, T_VOID, T_VOID,
                                                     1, NULL) == -1);
     transport_write_error = 0;
 
     /* test 2nd write failure on a map */
     transport_write_count = 0;
     transport_write_error_at = 1;
-    assert (thrift_binary_protocol_write_map_begin (protocol, T_VOID, T_VOID,
+    g_assert (thrift_binary_protocol_write_map_begin (protocol, T_VOID, T_VOID,
                                                     1, NULL) == -1);
     transport_write_error_at = -1;
 
     /* test 3rd write failure on a map */
     transport_write_count = 0;
     transport_write_error_at = 2;
-    assert (thrift_binary_protocol_write_map_begin (protocol, T_VOID, T_VOID,
+    g_assert (thrift_binary_protocol_write_map_begin (protocol, T_VOID, T_VOID,
                                                     1, NULL) == -1);
     transport_write_error_at = -1;
 
@@ -312,9 +311,9 @@ test_read_and_write_complex_types (void)
     thrift_binary_protocol_write_i32 (protocol, -10, NULL);
 
     /* test list operations */
-    assert (thrift_binary_protocol_write_list_begin (protocol, T_VOID,
+    g_assert (thrift_binary_protocol_write_list_begin (protocol, T_VOID,
                                                      1, NULL) > 0);
-    assert (thrift_binary_protocol_write_list_end (protocol, NULL) == 0);
+    g_assert (thrift_binary_protocol_write_list_end (protocol, NULL) == 0);
 
     /* test 2nd read failure on a list */
     thrift_binary_protocol_write_byte (protocol, T_VOID, NULL);
@@ -325,27 +324,27 @@ test_read_and_write_complex_types (void)
 
     /* test first write error on a list */
     transport_write_error = 1;
-    assert (thrift_binary_protocol_write_list_begin (protocol, T_VOID,
+    g_assert (thrift_binary_protocol_write_list_begin (protocol, T_VOID,
                                                      1, NULL) == -1);
     transport_write_error = 0;
 
     /* test 2nd write error on a list */
     transport_write_count = 0;
     transport_write_error_at = 1;
-    assert (thrift_binary_protocol_write_list_begin (protocol, T_VOID,
+    g_assert (thrift_binary_protocol_write_list_begin (protocol, T_VOID,
                                                      1, NULL) == -1);
     transport_write_error_at = -1;
 
     /* test set operation s*/
-    assert (thrift_binary_protocol_write_set_begin (protocol, T_VOID,
+    g_assert (thrift_binary_protocol_write_set_begin (protocol, T_VOID,
                                                     1, NULL) > 0);
-    assert (thrift_binary_protocol_write_set_end (protocol, NULL) == 0);
+    g_assert (thrift_binary_protocol_write_set_end (protocol, NULL) == 0);
 
     /* invalid version */
-    assert (thrift_binary_protocol_write_i32 (protocol, -1, NULL) > 0);
+    g_assert (thrift_binary_protocol_write_i32 (protocol, -1, NULL) > 0);
 
     /* sz > 0 for a message */
-    assert (thrift_binary_protocol_write_i32 (protocol, 1, NULL) > 0);
+    g_assert (thrift_binary_protocol_write_i32 (protocol, 1, NULL) > 0);
 
     /* send a valid message */
     thrift_binary_protocol_write_i32 (protocol, 0x80010000, NULL);
@@ -360,26 +359,26 @@ test_read_and_write_complex_types (void)
     thrift_binary_protocol_write_string (protocol, "test", NULL);
 
     /* send a valid message */
-    assert (thrift_binary_protocol_write_message_begin (protocol, "test",
+    g_assert (thrift_binary_protocol_write_message_begin (protocol, "test",
                                                         T_CALL, 1, NULL) > 0);
 
-    assert (thrift_binary_protocol_write_message_end (protocol, NULL) == 0);
+    g_assert (thrift_binary_protocol_write_message_end (protocol, NULL) == 0);
 
     /* send broken writes */
     transport_write_error = 1;
-    assert (thrift_binary_protocol_write_message_begin (protocol, "test",
+    g_assert (thrift_binary_protocol_write_message_begin (protocol, "test",
                                                         T_CALL, 1, NULL) == -1);
     transport_write_error = 0;
 
     transport_write_count = 0;
     transport_write_error_at = 2;
-    assert (thrift_binary_protocol_write_message_begin (protocol, "test",
+    g_assert (thrift_binary_protocol_write_message_begin (protocol, "test",
                                                         T_CALL, 1, NULL) == -1);
     transport_write_error_at = -1;
 
     transport_write_count = 0;
     transport_write_error_at = 3;
-    assert (thrift_binary_protocol_write_message_begin (protocol, "test",
+    g_assert (thrift_binary_protocol_write_message_begin (protocol, "test",
                                                         T_CALL, 1, NULL) == -1);
     transport_write_error_at = -1;
 
@@ -387,8 +386,8 @@ test_read_and_write_complex_types (void)
     thrift_transport_close (transport, NULL);
     g_object_unref (tsocket);
     g_object_unref (protocol);
-    assert (wait (&status) == pid);
-    assert (status == 0);
+    g_assert (wait (&status) == pid);
+    g_assert (status == 0);
   }
 }
 
@@ -408,7 +407,7 @@ test_read_and_write_many_frames (void)
 
   /* fork a server from the client */
   pid = fork ();
-  assert (pid >= 0);
+  g_assert (pid >= 0);
 
   if (pid == 0)
   {
@@ -422,49 +421,49 @@ test_read_and_write_many_frames (void)
     /* create a ThriftSocket */
     tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
                             "port", port, NULL);
-    assert (tsocket != NULL);
+    g_assert (tsocket != NULL);
     transport = THRIFT_TRANSPORT (tsocket);
 
     /* wrap in a framed transport */
     ft = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT, "transport", transport,
                        "w_buf_size", 1, NULL);
-    assert (ft != NULL);
+    g_assert (ft != NULL);
     transport = THRIFT_TRANSPORT (ft);
 
     thrift_transport_open (transport, NULL);
-    assert (thrift_transport_is_open (transport));
+    g_assert (thrift_transport_is_open (transport));
 
     /* create a binary protocol */
     tb = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport",
                        transport, NULL);
     protocol = THRIFT_PROTOCOL (tb);
-    assert (protocol != NULL);
+    g_assert (protocol != NULL);
 
     /* write a bunch of primitives */
-    assert (thrift_binary_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
+    g_assert (thrift_binary_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
     thrift_transport_flush (transport, NULL);
-    assert (thrift_binary_protocol_write_byte (protocol, TEST_BYTE, NULL) > 0);
+    g_assert (thrift_binary_protocol_write_byte (protocol, TEST_BYTE, NULL) > 0);
     thrift_transport_flush (transport, NULL);
-    assert (thrift_binary_protocol_write_i16 (protocol, TEST_I16, NULL) > 0);
+    g_assert (thrift_binary_protocol_write_i16 (protocol, TEST_I16, NULL) > 0);
     thrift_transport_flush (transport, NULL);
-    assert (thrift_binary_protocol_write_i32 (protocol, TEST_I32, NULL) > 0);
+    g_assert (thrift_binary_protocol_write_i32 (protocol, TEST_I32, NULL) > 0);
     thrift_transport_flush (transport, NULL);
-    assert (thrift_binary_protocol_write_i64 (protocol, TEST_I64, NULL) > 0);
+    g_assert (thrift_binary_protocol_write_i64 (protocol, TEST_I64, NULL) > 0);
     thrift_transport_flush (transport, NULL);
-    assert (thrift_binary_protocol_write_double (protocol,
+    g_assert (thrift_binary_protocol_write_double (protocol,
                                                  TEST_DOUBLE, NULL) > 0);
     thrift_transport_flush (transport, NULL);
-    assert (thrift_binary_protocol_write_string (protocol,
+    g_assert (thrift_binary_protocol_write_string (protocol,
                                                  TEST_STRING, NULL) > 0);
     thrift_transport_flush (transport, NULL);
-    assert (thrift_binary_protocol_write_string (protocol, "", NULL) > 0);
+    g_assert (thrift_binary_protocol_write_string (protocol, "", NULL) > 0);
     thrift_transport_flush (transport, NULL);
-    assert (thrift_binary_protocol_write_binary (protocol, binary,
+    g_assert (thrift_binary_protocol_write_binary (protocol, binary,
                                                  len, NULL) > 0);
     thrift_transport_flush (transport, NULL);
-    assert (thrift_binary_protocol_write_binary (protocol, NULL, 0, NULL) > 0);
+    g_assert (thrift_binary_protocol_write_binary (protocol, NULL, 0, NULL) > 0);
     thrift_transport_flush (transport, NULL);
-    assert (thrift_binary_protocol_write_binary (protocol, binary,
+    g_assert (thrift_binary_protocol_write_binary (protocol, binary,
                                                  len, NULL) > 0);
     thrift_transport_flush (transport, NULL);
 
@@ -474,8 +473,8 @@ test_read_and_write_many_frames (void)
     g_object_unref (ft);
     g_object_unref (tsocket);
     g_object_unref (tb);
-    assert (wait (&status) == pid);
-    assert (status == 0);
+    g_assert (wait (&status) == pid);
+    g_assert (status == 0);
   }
 }
 
@@ -504,68 +503,68 @@ thrift_server_primitives (const int port)
   transport = THRIFT_SERVER_TRANSPORT (tsocket);
   thrift_server_transport_listen (transport, NULL);
   client = thrift_server_transport_accept (transport, NULL);
-  assert (client != NULL);
+  g_assert (client != NULL);
 
   tbp = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport",
                       client, NULL);
   protocol = THRIFT_PROTOCOL (tbp);
 
-  assert (thrift_binary_protocol_read_bool (protocol,
+  g_assert (thrift_binary_protocol_read_bool (protocol,
                                             &value_boolean, NULL) > 0);
-  assert (thrift_binary_protocol_read_byte (protocol, &value_byte, NULL) > 0);
-  assert (thrift_binary_protocol_read_i16 (protocol, &value_16, NULL) > 0);
-  assert (thrift_binary_protocol_read_i32 (protocol, &value_32, NULL) > 0);
-  assert (thrift_binary_protocol_read_i64 (protocol, &value_64, NULL) > 0);
-  assert (thrift_binary_protocol_read_double (protocol,
+  g_assert (thrift_binary_protocol_read_byte (protocol, &value_byte, NULL) > 0);
+  g_assert (thrift_binary_protocol_read_i16 (protocol, &value_16, NULL) > 0);
+  g_assert (thrift_binary_protocol_read_i32 (protocol, &value_32, NULL) > 0);
+  g_assert (thrift_binary_protocol_read_i64 (protocol, &value_64, NULL) > 0);
+  g_assert (thrift_binary_protocol_read_double (protocol,
                                               &value_double, NULL) > 0);
-  assert (thrift_binary_protocol_read_string (protocol, &string, NULL) > 0);
-  assert (thrift_binary_protocol_read_string (protocol, &empty_string,
+  g_assert (thrift_binary_protocol_read_string (protocol, &string, NULL) > 0);
+  g_assert (thrift_binary_protocol_read_string (protocol, &empty_string,
                                               NULL) > 0);
-  assert (thrift_binary_protocol_read_binary (protocol, &binary,
+  g_assert (thrift_binary_protocol_read_binary (protocol, &binary,
                                               &len, NULL) > 0);
 
-  assert (value_boolean == TEST_BOOL);
-  assert (value_byte == TEST_BYTE);
-  assert (value_16 == TEST_I16);
-  assert (value_32 == TEST_I32);
-  assert (value_64 == TEST_I64);
-  assert (value_double == TEST_DOUBLE);
-  assert (strcmp (TEST_STRING, string) == 0);
-  assert (strcmp ("", empty_string) == 0);
-  assert (memcmp (comparator, binary, len) == 0);
+  g_assert (value_boolean == TEST_BOOL);
+  g_assert (value_byte == TEST_BYTE);
+  g_assert (value_16 == TEST_I16);
+  g_assert (value_32 == TEST_I32);
+  g_assert (value_64 == TEST_I64);
+  g_assert (value_double == TEST_DOUBLE);
+  g_assert (strcmp (TEST_STRING, string) == 0);
+  g_assert (strcmp ("", empty_string) == 0);
+  g_assert (memcmp (comparator, binary, len) == 0);
 
   g_free (string);
   g_free (empty_string);
   g_free (binary);
 
-  assert (thrift_binary_protocol_read_binary (protocol, &binary,
+  g_assert (thrift_binary_protocol_read_binary (protocol, &binary,
                                               &len, NULL) > 0);
-  assert (binary == NULL);
-  assert (len == 0);
+  g_assert (binary == NULL);
+  g_assert (len == 0);
   g_free (binary);
 
   transport_read_count = 0;
   transport_read_error_at = 0;
-  assert (thrift_binary_protocol_read_binary (protocol, &binary,
+  g_assert (thrift_binary_protocol_read_binary (protocol, &binary,
                                               &len, NULL) == -1);
   transport_read_error_at = -1;
 
   transport_read_count = 0;
   transport_read_error_at = 1;
-  assert (thrift_binary_protocol_read_binary (protocol, &binary,
+  g_assert (thrift_binary_protocol_read_binary (protocol, &binary,
                                               &len, NULL) == -1);
   transport_read_error_at = -1;
 
   transport_read_error = 1;
-  assert (thrift_binary_protocol_read_bool (protocol,
+  g_assert (thrift_binary_protocol_read_bool (protocol,
                                             &value_boolean, NULL) == -1);
-  assert (thrift_binary_protocol_read_byte (protocol,
+  g_assert (thrift_binary_protocol_read_byte (protocol,
                                             &value_byte, NULL) == -1);
-  assert (thrift_binary_protocol_read_i16 (protocol,
+  g_assert (thrift_binary_protocol_read_i16 (protocol,
                                            &value_16, NULL) == -1);
-  assert (thrift_binary_protocol_read_i32 (protocol, &value_32, NULL) == -1);
-  assert (thrift_binary_protocol_read_i64 (protocol, &value_64, NULL) == -1);
-  assert (thrift_binary_protocol_read_double (protocol,
+  g_assert (thrift_binary_protocol_read_i32 (protocol, &value_32, NULL) == -1);
+  g_assert (thrift_binary_protocol_read_i64 (protocol, &value_64, NULL) == -1);
+  g_assert (thrift_binary_protocol_read_double (protocol,
                                               &value_double, NULL) == -1);
   transport_read_error = 0;
 
@@ -603,7 +602,7 @@ thrift_server_complex_types (const int port)
   transport = THRIFT_SERVER_TRANSPORT (tsocket);
   thrift_server_transport_listen (transport, NULL);
   client = thrift_server_transport_accept (transport, NULL);
-  assert (client != NULL);
+  g_assert (client != NULL);
 
   tbp = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport",
                       client, NULL);
@@ -618,7 +617,7 @@ thrift_server_complex_types (const int port)
 
   /* test first read error on a field */
   transport_read_error = 1;
-  assert (thrift_binary_protocol_read_field_begin (protocol,
+  g_assert (thrift_binary_protocol_read_field_begin (protocol,
                                                    &field_name, &field_type,
                                                    &field_id, NULL) == -1);
   transport_read_error = 0;
@@ -629,7 +628,7 @@ thrift_server_complex_types (const int port)
   /* test 2nd read failure on a field */
   transport_read_count = 0;
   transport_read_error_at = 1;
-  assert (thrift_binary_protocol_read_field_begin (protocol,
+  g_assert (thrift_binary_protocol_read_field_begin (protocol,
                                                    &field_name, &field_type,
                                                    &field_id, NULL) == -1);
   transport_read_error_at = -1;
@@ -645,7 +644,7 @@ thrift_server_complex_types (const int port)
   /* test read failure on a map */
   transport_read_count = 0;
   transport_read_error_at = 0;
-  assert (thrift_binary_protocol_read_map_begin (protocol,
+  g_assert (thrift_binary_protocol_read_map_begin (protocol,
                                                  &key_type, &value_type,
                                                  &size, NULL) == -1);
   transport_read_error_at = -1;
@@ -653,7 +652,7 @@ thrift_server_complex_types (const int port)
   /* test 2nd read failure on a map */
   transport_read_count = 0;
   transport_read_error_at = 1;
-  assert (thrift_binary_protocol_read_map_begin (protocol,
+  g_assert (thrift_binary_protocol_read_map_begin (protocol,
                                                  &key_type, &value_type,
                                                  &size, NULL) == -1);
   transport_read_error_at = -1;
@@ -661,7 +660,7 @@ thrift_server_complex_types (const int port)
   /* test 3rd read failure on a map */
   transport_read_count = 0;
   transport_read_error_at = 2;
-  assert (thrift_binary_protocol_read_map_begin (protocol,
+  g_assert (thrift_binary_protocol_read_map_begin (protocol,
                                                  &key_type, &value_type,
                                                  &size, NULL) == -1);
   transport_read_error_at = -1;
@@ -674,7 +673,7 @@ thrift_server_complex_types (const int port)
   thrift_binary_protocol_read_byte (protocol, &value, NULL);
 
   /* test negative map size */
-  assert (thrift_binary_protocol_read_map_begin (protocol,
+  g_assert (thrift_binary_protocol_read_map_begin (protocol,
                                                  &key_type, &value_type,
                                                  &size, NULL) == -1);
 
@@ -684,7 +683,7 @@ thrift_server_complex_types (const int port)
 
   /* test read failure */
   transport_read_error = 1;
-  assert (thrift_binary_protocol_read_list_begin (protocol, &element_type,
+  g_assert (thrift_binary_protocol_read_list_begin (protocol, &element_type,
                                                   &size, NULL) == -1);
   transport_read_error = 0;
 
@@ -706,23 +705,23 @@ thrift_server_complex_types (const int port)
 
   /* broken read */
   transport_read_error = 1;
-  assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
+  g_assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
                                                      &message_type, &seqid,
                                                      NULL) == -1);
   transport_read_error = 0;
 
   /* invalid protocol version */
-  assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
+  g_assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
                                                      &message_type, &seqid,
                                                      NULL) == -1);
 
   /* sz > 0 */
-  assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
+  g_assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
                                                      &message_type, &seqid,
                                                      NULL) > 0);
 
   /* read a valid message */
-  assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
+  g_assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
                                                      &message_type, &seqid,
                                                      NULL) > 0);
   g_free (message_name);
@@ -730,7 +729,7 @@ thrift_server_complex_types (const int port)
   /* broken 2nd read on a message */
   transport_read_count = 0;
   transport_read_error_at = 1;
-  assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
+  g_assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
                                                      &message_type, &seqid,
                                                      NULL) == -1);
   transport_read_error_at = -1;
@@ -738,19 +737,19 @@ thrift_server_complex_types (const int port)
   /* broken 3rd read on a message */
   transport_read_count = 0;
   transport_read_error_at = 3; /* read_string does two reads */
-  assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
+  g_assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
                                                      &message_type, &seqid,
                                                      NULL) == -1);
   g_free (message_name);
   transport_read_error_at = -1;
 
   /* read a valid message */
-  assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
+  g_assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
                                                      &message_type, &seqid, 
                                                      NULL) > 0);
   g_free (message_name);
 
-  assert (thrift_binary_protocol_read_message_end (protocol, NULL) == 0);
+  g_assert (thrift_binary_protocol_read_message_end (protocol, NULL) == 0);
 
   /* handle 2nd write failure on a message */
   thrift_binary_protocol_read_i32 (protocol, &version, NULL);
@@ -792,44 +791,44 @@ thrift_server_many_frames (const int port)
   client = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT, "transport",
                          thrift_server_transport_accept (transport, NULL),
                          "r_buf_size", 1, NULL);
-  assert (client != NULL);
+  g_assert (client != NULL);
 
   tbp = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport",
                       client, NULL);
   protocol = THRIFT_PROTOCOL (tbp);
 
-  assert (thrift_binary_protocol_read_bool (protocol,
+  g_assert (thrift_binary_protocol_read_bool (protocol,
                                             &value_boolean, NULL) > 0);
-  assert (thrift_binary_protocol_read_byte (protocol, &value_byte, NULL) > 0);
-  assert (thrift_binary_protocol_read_i16 (protocol, &value_16, NULL) > 0);
-  assert (thrift_binary_protocol_read_i32 (protocol, &value_32, NULL) > 0);
-  assert (thrift_binary_protocol_read_i64 (protocol, &value_64, NULL) > 0);
-  assert (thrift_binary_protocol_read_double (protocol,
+  g_assert (thrift_binary_protocol_read_byte (protocol, &value_byte, NULL) > 0);
+  g_assert (thrift_binary_protocol_read_i16 (protocol, &value_16, NULL) > 0);
+  g_assert (thrift_binary_protocol_read_i32 (protocol, &value_32, NULL) > 0);
+  g_assert (thrift_binary_protocol_read_i64 (protocol, &value_64, NULL) > 0);
+  g_assert (thrift_binary_protocol_read_double (protocol,
                                               &value_double, NULL) > 0);
-  assert (thrift_binary_protocol_read_string (protocol, &string, NULL) > 0);
-  assert (thrift_binary_protocol_read_string (protocol, &empty_string,
+  g_assert (thrift_binary_protocol_read_string (protocol, &string, NULL) > 0);
+  g_assert (thrift_binary_protocol_read_string (protocol, &empty_string,
                                               NULL) > 0);
-  assert (thrift_binary_protocol_read_binary (protocol, &binary,
+  g_assert (thrift_binary_protocol_read_binary (protocol, &binary,
                                               &len, NULL) > 0);
 
-  assert (value_boolean == TEST_BOOL);
-  assert (value_byte == TEST_BYTE);
-  assert (value_16 == TEST_I16);
-  assert (value_32 == TEST_I32);
-  assert (value_64 == TEST_I64);
-  assert (value_double == TEST_DOUBLE);
-  assert (strcmp (TEST_STRING, string) == 0);
-  assert (strcmp ("", empty_string) == 0);
-  assert (memcmp (comparator, binary, len) == 0);
+  g_assert (value_boolean == TEST_BOOL);
+  g_assert (value_byte == TEST_BYTE);
+  g_assert (value_16 == TEST_I16);
+  g_assert (value_32 == TEST_I32);
+  g_assert (value_64 == TEST_I64);
+  g_assert (value_double == TEST_DOUBLE);
+  g_assert (strcmp (TEST_STRING, string) == 0);
+  g_assert (strcmp ("", empty_string) == 0);
+  g_assert (memcmp (comparator, binary, len) == 0);
 
   g_free (string);
   g_free (empty_string);
   g_free (binary);
 
-  assert (thrift_binary_protocol_read_binary (protocol, &binary,
+  g_assert (thrift_binary_protocol_read_binary (protocol, &binary,
                                               &len, NULL) > 0);
-  assert (binary == NULL);
-  assert (len == 0);
+  g_assert (binary == NULL);
+  g_assert (len == 0);
   g_free (binary);
 
   thrift_transport_read_end (client, NULL);

http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/test/testbufferedtransport.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testbufferedtransport.c b/lib/c_glib/test/testbufferedtransport.c
index 3203a66..1c15ef2 100755
--- a/lib/c_glib/test/testbufferedtransport.c
+++ b/lib/c_glib/test/testbufferedtransport.c
@@ -17,7 +17,6 @@
  * under the License.
  */
 
-#include <assert.h>
 #include <netdb.h>
 #include <signal.h>
 #include <sys/wait.h>
@@ -43,7 +42,7 @@ test_create_and_destroy(void)
 
   GObject *object = NULL;
   object = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT, NULL);
-  assert (object != NULL);
+  g_assert (object != NULL);
   g_object_get (G_OBJECT (object), "transport", &transport,
                 "r_buf_size", &r_buf_size,
                 "w_buf_size", &w_buf_size, NULL);
@@ -66,9 +65,9 @@ test_open_and_close(void)
                             "transport", THRIFT_TRANSPORT (tsocket), NULL);
 
   /* this shouldn't work */
-  assert (thrift_buffered_transport_open (transport, NULL) == FALSE);
-  assert (thrift_buffered_transport_is_open (transport) == TRUE);
-  assert (thrift_buffered_transport_close (transport, NULL) == TRUE);
+  g_assert (thrift_buffered_transport_open (transport, NULL) == FALSE);
+  g_assert (thrift_buffered_transport_is_open (transport) == TRUE);
+  g_assert (thrift_buffered_transport_close (transport, NULL) == TRUE);
   g_object_unref (transport);
   g_object_unref (tsocket);
 
@@ -80,7 +79,7 @@ test_open_and_close(void)
   transport = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT,
                             "transport", THRIFT_TRANSPORT (tsocket), NULL);
 
-  assert (thrift_buffered_transport_open (transport, &err) == FALSE);
+  g_assert (thrift_buffered_transport_open (transport, &err) == FALSE);
   g_object_unref (transport);
   g_object_unref (tsocket);
   g_error_free (err);
@@ -98,7 +97,7 @@ test_read_and_write(void)
   guchar buf[10] = TEST_DATA; /* a buffer */
 
   pid = fork ();
-  assert ( pid >= 0 );
+  g_assert ( pid >= 0 );
 
   if ( pid == 0 )
   {
@@ -115,8 +114,8 @@ test_read_and_write(void)
                               "transport", THRIFT_TRANSPORT (tsocket),
                               "w_buf_size", 4, NULL);
 
-    assert (thrift_buffered_transport_open (transport, NULL) == TRUE);
-    assert (thrift_buffered_transport_is_open (transport));
+    g_assert (thrift_buffered_transport_open (transport, NULL) == TRUE);
+    g_assert (thrift_buffered_transport_is_open (transport));
 
     /* write 10 bytes */
     thrift_buffered_transport_write (transport, buf, 10, NULL);
@@ -149,8 +148,8 @@ test_read_and_write(void)
     g_object_unref (transport);
     g_object_unref (tsocket);
 
-    assert ( wait (&status) == pid );
-    assert ( status == 0 );
+    g_assert ( wait (&status) == pid );
+    g_assert ( status == 0 );
   }
 }
 
@@ -173,12 +172,12 @@ thrift_server (const int port)
   client = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT, "transport",
                          thrift_server_transport_accept (transport, NULL),
                          "r_buf_size", 5, NULL);
-  assert (client != NULL);
+  g_assert (client != NULL);
 
   /* read 10 bytes */
   bytes = thrift_buffered_transport_read (client, buf, 10, NULL);
-  assert (bytes == 10); /* make sure we've read 10 bytes */
-  assert ( memcmp (buf, match, 10) == 0 ); /* make sure what we got matches */
+  g_assert (bytes == 10); /* make sure we've read 10 bytes */
+  g_assert ( memcmp (buf, match, 10) == 0 ); /* make sure what we got matches */
 
   /* read 1 byte */
   bytes = thrift_buffered_transport_read (client, buf, 1, NULL);
@@ -207,7 +206,7 @@ test_write_fail(void)
   signal(SIGPIPE, SIG_IGN);
 
   pid = fork ();
-  assert ( pid >= 0 );
+  g_assert ( pid >= 0 );
 
   if ( pid == 0 )
   {
@@ -225,7 +224,7 @@ test_write_fail(void)
     client = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT, "transport",
         thrift_server_transport_accept (transport, NULL),
         "r_buf_size", 5, NULL);
-    assert (client != NULL);
+    g_assert (client != NULL);
 
     /* just close socket */
     thrift_buffered_transport_close (client, NULL);
@@ -243,28 +242,28 @@ test_write_fail(void)
                               "w_buf_size", 4, NULL);
 
 
-    assert (thrift_buffered_transport_open (transport, NULL) == TRUE);
-    assert (thrift_buffered_transport_is_open (transport));
+    g_assert (thrift_buffered_transport_open (transport, NULL) == TRUE);
+    g_assert (thrift_buffered_transport_is_open (transport));
 
     /* recognize disconnection */
     sleep(1);
-    assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == TRUE);
-    assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == FALSE);
+    g_assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == TRUE);
+    g_assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == FALSE);
 
     /* write and overflow buffer */
-    assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == FALSE);
+    g_assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == FALSE);
 
     /* write 1 and flush */
-    assert (thrift_buffered_transport_write (transport, buf, 1, NULL) == TRUE);
-    assert (thrift_buffered_transport_flush (transport, NULL) == FALSE);
+    g_assert (thrift_buffered_transport_write (transport, buf, 1, NULL) == TRUE);
+    g_assert (thrift_buffered_transport_flush (transport, NULL) == FALSE);
 
     thrift_buffered_transport_close (transport, NULL);
 
     g_object_unref (transport);
     g_object_unref (tsocket);
 
-    assert ( wait (&status) == pid );
-    assert ( status == 0 );
+    g_assert ( wait (&status) == pid );
+    g_assert ( status == 0 );
   }
 }