THRIFT-1313 implement compact protocol for c_glib library
Client: C_glib
Chandler May <cjmay4754@gmail.com>
This closes #795
diff --git a/test/c_glib/src/test_client.c b/test/c_glib/src/test_client.c
index 0f8a713..3ae9325 100644
--- a/test/c_glib/src/test_client.c
+++ b/test/c_glib/src/test_client.c
@@ -27,6 +27,7 @@
#include <thrift/c_glib/thrift.h>
#include <thrift/c_glib/protocol/thrift_binary_protocol.h>
+#include <thrift/c_glib/protocol/thrift_compact_protocol.h>
#include <thrift/c_glib/transport/thrift_buffered_transport.h>
#include <thrift/c_glib/transport/thrift_framed_transport.h>
#include <thrift/c_glib/transport/thrift_socket.h>
@@ -89,7 +90,7 @@
{ "transport", 0, 0, G_OPTION_ARG_STRING, &transport_option,
"Transport: buffered, framed (=buffered)", NULL },
{ "protocol", 0, 0, G_OPTION_ARG_STRING, &protocol_option,
- "Protocol: binary (=binary)", NULL },
+ "Protocol: binary, compact (=binary)", NULL },
{ "testloops", 'n', 0, G_OPTION_ARG_INT, &num_tests,
"Number of tests (=1)", NULL },
{ NULL }
@@ -141,10 +142,15 @@
host = g_strdup ("localhost");
/* Validate the parsed options */
- if (protocol_option != NULL &&
- strncmp (protocol_option, "binary", 7) != 0) {
- fprintf (stderr, "Unknown protocol type %s\n", protocol_option);
- options_valid = FALSE;
+ if (protocol_option != NULL) {
+ if (strncmp (protocol_option, "compact", 8) == 0) {
+ protocol_type = THRIFT_TYPE_COMPACT_PROTOCOL;
+ protocol_name = "compact";
+ }
+ else if (strncmp (protocol_option, "binary", 7) != 0) {
+ fprintf (stderr, "Unknown protocol type %s\n", protocol_option);
+ options_valid = FALSE;
+ }
}
if (transport_option != NULL) {