You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by rl...@apache.org on 2016/09/06 05:17:55 UTC
[08/51] [partial] incubator-hawq git commit: HAWQ-959. revert thrift
build commands.
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/test/testthrifttestclient.cpp
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/test/testthrifttestclient.cpp b/depends/thirdparty/thrift/lib/c_glib/test/testthrifttestclient.cpp
deleted file mode 100755
index e618fe9..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/test/testthrifttestclient.cpp
+++ /dev/null
@@ -1,627 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/* test a C client with a C++ server */
-
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <thrift/protocol/TBinaryProtocol.h>
-#include <thrift/protocol/TDebugProtocol.h>
-#include <thrift/server/TSimpleServer.h>
-#include <thrift/transport/TServerSocket.h>
-#include "ThriftTest.h"
-#include "ThriftTest_types.h"
-
-#include <iostream>
-
-using namespace std;
-using namespace boost;
-
-using namespace apache::thrift;
-using namespace apache::thrift::concurrency;
-using namespace apache::thrift::protocol;
-using namespace apache::thrift::transport;
-using namespace apache::thrift::server;
-
-using namespace thrift::test;
-
-#define TEST_PORT 9980
-
-// Extra functions required for ThriftTest_types to work
-namespace thrift { namespace test {
-
-bool Insanity::operator<(thrift::test::Insanity const& other) const {
- using apache::thrift::ThriftDebugString;
- return ThriftDebugString(*this) < ThriftDebugString(other);
-}
-
-}}
-
-class TestHandler : public ThriftTestIf {
- public:
- TestHandler() {}
-
- void testVoid() {
- printf("[C -> C++] testVoid()\n");
- }
-
- void testString(string& out, const string &thing) {
- printf("[C -> C++] testString(\"%s\")\n", thing.c_str());
- out = thing;
- }
-
- bool testBool(const bool thing) {
- printf("[C -> C++] testBool(%s)\n", thing ? "true" : "false");
- return thing;
- }
- int8_t testByte(const int8_t thing) {
- printf("[C -> C++] testByte(%d)\n", (int)thing);
- return thing;
- }
- int32_t testI32(const int32_t thing) {
- printf("[C -> C++] testI32(%d)\n", thing);
- return thing;
- }
-
- int64_t testI64(const int64_t thing) {
- printf("[C -> C++] testI64(%ld)\n", thing);
- return thing;
- }
-
- double testDouble(const double thing) {
- printf("[C -> C++] testDouble(%lf)\n", thing);
- return thing;
- }
-
- void testBinary(string& out, const string &thing) {
- printf("[C -> C++] testBinary(\"%s\")\n", thing.c_str());
- out = thing;
- }
-
- void testStruct(Xtruct& out, const Xtruct &thing) {
- printf("[C -> C++] testStruct({\"%s\", %d, %d, %ld})\n", thing.string_thing.c_str(), (int)thing.byte_thing, thing.i32_thing, thing.i64_thing);
- out = thing;
- }
-
- void testNest(Xtruct2& out, const Xtruct2& nest) {
- const Xtruct &thing = nest.struct_thing;
- printf("[C -> C++] testNest({%d, {\"%s\", %d, %d, %ld}, %d})\n", (int)nest.byte_thing, thing.string_thing.c_str(), (int)thing.byte_thing, thing.i32_thing, thing.i64_thing, nest.i32_thing);
- out = nest;
- }
-
- void testMap(map<int32_t, int32_t> &out, const map<int32_t, int32_t> &thing) {
- printf("[C -> C++] testMap({");
- map<int32_t, int32_t>::const_iterator m_iter;
- bool first = true;
- for (m_iter = thing.begin(); m_iter != thing.end(); ++m_iter) {
- if (first) {
- first = false;
- } else {
- printf(", ");
- }
- printf("%d => %d", m_iter->first, m_iter->second);
- }
- printf("})\n");
- out = thing;
- }
-
- void testStringMap(map<std::string, std::string> &out, const map<std::string, std::string> &thing) {
- printf("[C -> C++] testStringMap({");
- map<std::string, std::string>::const_iterator m_iter;
- bool first = true;
- for (m_iter = thing.begin(); m_iter != thing.end(); ++m_iter) {
- if (first) {
- first = false;
- } else {
- printf(", ");
- }
- printf("\"%s\" => \"%s\"", (m_iter->first).c_str(), (m_iter->second).c_str());
- }
- printf("})\n");
- out = thing;
- }
-
-
- void testSet(set<int32_t> &out, const set<int32_t> &thing) {
- printf("[C -> C++] testSet({");
- set<int32_t>::const_iterator s_iter;
- bool first = true;
- for (s_iter = thing.begin(); s_iter != thing.end(); ++s_iter) {
- if (first) {
- first = false;
- } else {
- printf(", ");
- }
- printf("%d", *s_iter);
- }
- printf("})\n");
- out = thing;
- }
-
- void testList(vector<int32_t> &out, const vector<int32_t> &thing) {
- printf("[C -> C++] testList({");
- vector<int32_t>::const_iterator l_iter;
- bool first = true;
- for (l_iter = thing.begin(); l_iter != thing.end(); ++l_iter) {
- if (first) {
- first = false;
- } else { printf(", ");
- }
- printf("%d", *l_iter);
- }
- printf("})\n");
- out = thing;
- }
-
- Numberz::type testEnum(const Numberz::type thing) {
- printf("[C -> C++] testEnum(%d)\n", thing);
- return thing;
- }
-
- UserId testTypedef(const UserId thing) {
- printf("[C -> C++] testTypedef(%ld)\n", thing);
- return thing; }
-
- void testMapMap(map<int32_t, map<int32_t,int32_t> > &mapmap, const int32_t hello) {
- printf("[C -> C++] testMapMap(%d)\n", hello);
-
- map<int32_t,int32_t> pos;
- map<int32_t,int32_t> neg;
- for (int i = 1; i < 5; i++) {
- pos.insert(make_pair(i,i));
- neg.insert(make_pair(-i,-i));
- }
-
- mapmap.insert(make_pair(4, pos));
- mapmap.insert(make_pair(-4, neg));
-
- }
-
- void testInsanity(map<UserId, map<Numberz::type,Insanity> > &insane, const Insanity &argument) {
- THRIFT_UNUSED_VARIABLE (argument);
-
- printf("[C -> C++] testInsanity()\n");
-
- Xtruct hello;
- hello.string_thing = "Hello2";
- hello.byte_thing = 2;
- hello.i32_thing = 2;
- hello.i64_thing = 2;
-
- Xtruct goodbye;
- goodbye.string_thing = "Goodbye4";
- goodbye.byte_thing = 4;
- goodbye.i32_thing = 4;
- goodbye.i64_thing = 4;
-
- Insanity crazy;
- crazy.userMap.insert(make_pair(Numberz::EIGHT, 8));
- crazy.xtructs.push_back(goodbye);
-
- Insanity looney;
- crazy.userMap.insert(make_pair(Numberz::FIVE, 5));
- crazy.xtructs.push_back(hello);
-
- map<Numberz::type, Insanity> first_map;
- map<Numberz::type, Insanity> second_map;
-
- first_map.insert(make_pair(Numberz::TWO, crazy));
- first_map.insert(make_pair(Numberz::THREE, crazy));
-
- second_map.insert(make_pair(Numberz::SIX, looney));
-
- insane.insert(make_pair(1, first_map));
- insane.insert(make_pair(2, second_map));
-
- printf("return");
- printf(" = {");
- map<UserId, map<Numberz::type,Insanity> >::const_iterator i_iter;
- for (i_iter = insane.begin(); i_iter != insane.end(); ++i_iter) {
- printf("%ld => {", i_iter->first);
- map<Numberz::type,Insanity>::const_iterator i2_iter;
- for (i2_iter = i_iter->second.begin();
- i2_iter != i_iter->second.end();
- ++i2_iter) {
- printf("%d => {", i2_iter->first);
- map<Numberz::type, UserId> userMap = i2_iter->second.userMap;
- map<Numberz::type, UserId>::const_iterator um;
- printf("{");
- for (um = userMap.begin(); um != userMap.end(); ++um) {
- printf("%d => %ld, ", um->first, um->second);
- }
- printf("}, ");
-
- vector<Xtruct> xtructs = i2_iter->second.xtructs;
- vector<Xtruct>::const_iterator x;
- printf("{");
- for (x = xtructs.begin(); x != xtructs.end(); ++x) {
- printf("{\"%s\", %d, %d, %ld}, ", x->string_thing.c_str(), (int)x->byte_thing, x->i32_thing, x->i64_thing);
- }
- printf("}");
-
- printf("}, ");
- }
- printf("}, ");
- }
- printf("}\n");
-
-
- }
-
- void testMulti(Xtruct &hello, const int8_t arg0, const int32_t arg1, const int64_t arg2, const std::map<int16_t, std::string> &arg3, const Numberz::type arg4, const UserId arg5) {
- THRIFT_UNUSED_VARIABLE (arg3);
- THRIFT_UNUSED_VARIABLE (arg4);
- THRIFT_UNUSED_VARIABLE (arg5);
-
- printf("[C -> C++] testMulti()\n");
-
- hello.string_thing = "Hello2";
- hello.byte_thing = arg0;
- hello.i32_thing = arg1;
- hello.i64_thing = (int64_t)arg2;
- }
-
- void testException(const std::string &arg)
- throw(Xception, apache::thrift::TException)
- {
- printf("[C -> C++] testException(%s)\n", arg.c_str());
- if (arg.compare("Xception") == 0) {
- Xception e;
- e.errorCode = 1001;
- e.message = arg;
- throw e;
- } else if (arg.compare("ApplicationException") == 0) {
- apache::thrift::TException e;
- throw e;
- } else {
- Xtruct result;
- result.string_thing = arg;
- return;
- }
- }
-
- void testMultiException(Xtruct &result, const std::string &arg0, const std::string &arg1) throw(Xception, Xception2) {
-
- printf("[C -> C++] testMultiException(%s, %s)\n", arg0.c_str(), arg1.c_str());
-
- if (arg0.compare("Xception") == 0) {
- Xception e;
- e.errorCode = 1001;
- e.message = "This is an Xception";
- throw e;
- } else if (arg0.compare("Xception2") == 0) {
- Xception2 e;
- e.errorCode = 2002;
- e.struct_thing.string_thing = "This is an Xception2";
- throw e;
- } else {
- result.string_thing = arg1;
- return;
- }
- }
-
- void testOneway(int sleepFor) {
- printf("testOneway(%d): Sleeping...\n", sleepFor);
- sleep(sleepFor);
- printf("testOneway(%d): done sleeping!\n", sleepFor);
- }
-};
-
-// C CLIENT
-extern "C" {
-
-#undef THRIFT_SOCKET /* from lib/cpp */
-
-#include "t_test_thrift_test.h"
-#include "t_test_thrift_test_types.h"
-#include <thrift/c_glib/transport/thrift_socket.h>
-#include <thrift/c_glib/protocol/thrift_protocol.h>
-#include <thrift/c_glib/protocol/thrift_binary_protocol.h>
-
-static void
-test_thrift_client (void)
-{
- ThriftSocket *tsocket = NULL;
- ThriftBinaryProtocol *protocol = NULL;
- TTestThriftTestClient *client = NULL;
- TTestThriftTestIf *iface = NULL;
- GError *error = NULL;
- gchar *string = NULL;
- gint8 byte = 0;
- gint16 i16 = 0;
- gint32 i32 = 0, another_i32 = 56789;
- gint64 i64 = 0;
- double dbl = 0.0;
- TTestXtruct *xtruct_in, *xtruct_out;
- TTestXtruct2 *xtruct2_in, *xtruct2_out;
- GHashTable *map_in = NULL, *map_out = NULL;
- GHashTable *set_in = NULL, *set_out = NULL;
- GArray *list_in = NULL, *list_out = NULL;
- TTestNumberz enum_in, enum_out;
- TTestUserId user_id_in, user_id_out;
- GHashTable *insanity_in = NULL;
- TTestXtruct *xtruct1, *xtruct2;
- TTestInsanity *insanity_out = NULL;
- TTestXtruct *multi_in = NULL;
- GHashTable *multi_map_out = NULL;
- TTestXception *xception = NULL;
- TTestXception2 *xception2 = NULL;
-
-#if (!GLIB_CHECK_VERSION (2, 36, 0))
- // initialize gobject
- g_type_init ();
-#endif
-
- // create a C client
- tsocket = (ThriftSocket *) g_object_new (THRIFT_TYPE_SOCKET,
- "hostname", "localhost",
- "port", TEST_PORT, NULL);
- protocol = (ThriftBinaryProtocol *) g_object_new (THRIFT_TYPE_BINARY_PROTOCOL,
- "transport",
- tsocket, NULL);
- client = (TTestThriftTestClient *) g_object_new (T_TEST_TYPE_THRIFT_TEST_CLIENT, "input_protocol", protocol, "output_protocol", protocol, NULL);
- iface = T_TEST_THRIFT_TEST_IF (client);
-
- // open and send
- thrift_transport_open (THRIFT_TRANSPORT(tsocket), NULL);
-
- assert (t_test_thrift_test_client_test_void (iface, &error) == TRUE);
- assert (error == NULL);
-
- assert (t_test_thrift_test_client_test_string (iface, &string, "test123", &error) == TRUE);
- assert (strcmp (string, "test123") == 0);
- g_free (string);
- assert (error == NULL);
-
- assert (t_test_thrift_test_client_test_byte (iface, &byte, (gint8) 5, &error) == TRUE);
- assert (byte == 5);
- assert (error == NULL);
-
- assert (t_test_thrift_test_client_test_i32 (iface, &i32, 123, &error) == TRUE);
- assert (i32 == 123);
- assert (error == NULL);
-
- assert (t_test_thrift_test_client_test_i64 (iface, &i64, 12345, &error) == TRUE);
- assert (i64 == 12345);
- assert (error == NULL);
-
- assert (t_test_thrift_test_client_test_double (iface, &dbl, 5.6, &error) == TRUE);
- assert (dbl == 5.6);
- assert (error == NULL);
-
- xtruct_out = (TTestXtruct *) g_object_new (T_TEST_TYPE_XTRUCT, NULL);
- xtruct_out->byte_thing = 1;
- xtruct_out->__isset_byte_thing = TRUE;
- xtruct_out->i32_thing = 15;
- xtruct_out->__isset_i32_thing = TRUE;
- xtruct_out->i64_thing = 151;
- xtruct_out->__isset_i64_thing = TRUE;
- xtruct_out->string_thing = g_strdup ("abc123");
- xtruct_out->__isset_string_thing = TRUE;
- xtruct_in = (TTestXtruct *) g_object_new(T_TEST_TYPE_XTRUCT, NULL);
- assert (t_test_thrift_test_client_test_struct (iface, &xtruct_in, xtruct_out, &error) == TRUE);
- assert (error == NULL);
-
- xtruct2_out = (TTestXtruct2 *) g_object_new (T_TEST_TYPE_XTRUCT2, NULL);
- xtruct2_out->byte_thing = 1;
- xtruct2_out->__isset_byte_thing = TRUE;
- if (xtruct2_out->struct_thing != NULL)
- g_object_unref(xtruct2_out->struct_thing);
- xtruct2_out->struct_thing = xtruct_out;
- xtruct2_out->__isset_struct_thing = TRUE;
- xtruct2_out->i32_thing = 123;
- xtruct2_out->__isset_i32_thing = TRUE;
- xtruct2_in = (TTestXtruct2 *) g_object_new (T_TEST_TYPE_XTRUCT2, NULL);
- assert (t_test_thrift_test_client_test_nest (iface, &xtruct2_in, xtruct2_out, &error) == TRUE);
- assert (error == NULL);
-
- g_object_unref (xtruct2_out);
- g_object_unref (xtruct2_in);
- g_object_unref (xtruct_in);
-
- map_out = g_hash_table_new (NULL, NULL);
- map_in = g_hash_table_new (NULL, NULL); g_hash_table_insert (map_out, &i32, &i32);
- assert (t_test_thrift_test_client_test_map (iface, &map_in, map_out, &error) == TRUE);
- assert (error == NULL);
- g_hash_table_destroy (map_out);
- g_hash_table_destroy (map_in);
-
- map_out = g_hash_table_new (NULL, NULL);
- map_in = g_hash_table_new (NULL, NULL);
- g_hash_table_insert (map_out, g_strdup ("a"), g_strdup ("123"));
- g_hash_table_insert (map_out, g_strdup ("a b"), g_strdup ("with spaces "));
- g_hash_table_insert (map_out, g_strdup ("same"), g_strdup ("same"));
- g_hash_table_insert (map_out, g_strdup ("0"), g_strdup ("numeric key"));
- assert (t_test_thrift_test_client_test_string_map (iface, &map_in, map_out, &error) == TRUE);
- assert (error == NULL);
- g_hash_table_destroy (map_out);
- g_hash_table_destroy (map_in);
-
- set_out = g_hash_table_new (NULL, NULL);
- set_in = g_hash_table_new (NULL, NULL);
- g_hash_table_insert (set_out, &i32, &i32);
- assert (t_test_thrift_test_client_test_set (iface, &set_in, set_out, &error) == TRUE);
- assert (error == NULL);
- g_hash_table_destroy (set_out);
- g_hash_table_destroy (set_in);
-
- list_out = g_array_new(TRUE, TRUE, sizeof(gint32));
- list_in = g_array_new(TRUE, TRUE, sizeof(gint32));
- another_i32 = 456;
- g_array_append_val (list_out, i32);
- g_array_append_val (list_out, another_i32);
- assert (t_test_thrift_test_client_test_list (iface, &list_in, list_out, &error) == TRUE);
- assert (error == NULL);
- g_array_free (list_out, TRUE);
- g_array_free (list_in, TRUE);
-
- enum_out = T_TEST_NUMBERZ_ONE;
- assert (t_test_thrift_test_client_test_enum (iface, &enum_in, enum_out, &error) == TRUE);
- assert (enum_in == enum_out);
- assert (error == NULL);
-
- user_id_out = 12345;
- assert (t_test_thrift_test_client_test_typedef (iface, &user_id_in, user_id_out, &error) == TRUE);
- assert (user_id_in == user_id_out);
- assert (error == NULL);
-
- map_in = g_hash_table_new (NULL, NULL);
- assert (t_test_thrift_test_client_test_map_map (iface, &map_in, i32, &error) == TRUE);
- assert (error == NULL);
- g_hash_table_destroy (map_in);
-
- // insanity
- insanity_out = (TTestInsanity *) g_object_new (T_TEST_TYPE_INSANITY, NULL);
- insanity_out->userMap = g_hash_table_new (NULL, NULL);
- g_hash_table_insert (insanity_out->userMap, GINT_TO_POINTER (enum_out), &user_id_out);
-
- xtruct1 = (TTestXtruct *) g_object_new (T_TEST_TYPE_XTRUCT, NULL);
- xtruct1->byte_thing = 1;
- xtruct1->__isset_byte_thing = TRUE;
- xtruct1->i32_thing = 15;
- xtruct1->__isset_i32_thing = TRUE;
- xtruct1->i64_thing = 151;
- xtruct1->__isset_i64_thing = TRUE;
- xtruct1->string_thing = g_strdup ("abc123");
- xtruct1->__isset_string_thing = TRUE;
- xtruct2 = (TTestXtruct *) g_object_new (T_TEST_TYPE_XTRUCT, NULL);
- xtruct2->byte_thing = 1;
- xtruct2->__isset_byte_thing = TRUE;
- xtruct2->i32_thing = 15;
- xtruct2->__isset_i32_thing = TRUE;
- xtruct2->i64_thing = 151;
- xtruct2->__isset_i64_thing = TRUE;
- xtruct2->string_thing = g_strdup ("abc123");
- xtruct2->__isset_string_thing = TRUE;
-
- insanity_in = g_hash_table_new (NULL, NULL);
- g_ptr_array_add (insanity_out->xtructs, xtruct1);
- g_ptr_array_add (insanity_out->xtructs, xtruct2);
- assert (t_test_thrift_test_client_test_insanity (iface, &insanity_in, insanity_out, &error) == TRUE);
-
- g_hash_table_unref (insanity_in);
- g_ptr_array_free (insanity_out->xtructs, TRUE);
-
- multi_map_out = g_hash_table_new (NULL, NULL);
- string = g_strdup ("abc123");
- g_hash_table_insert (multi_map_out, &i16, string);
- multi_in = (TTestXtruct *) g_object_new (T_TEST_TYPE_XTRUCT, NULL);
- assert (t_test_thrift_test_client_test_multi (iface, &multi_in, byte, i32, i64, multi_map_out, enum_out, user_id_out, &error) == TRUE);
- assert (multi_in->i32_thing == i32);
- assert (multi_in->i64_thing == i64);
- g_object_unref (multi_in);
- g_hash_table_unref (multi_map_out);
- g_free (string);
-
- assert (t_test_thrift_test_client_test_exception (iface, "Xception", &xception, &error) == FALSE);
- assert (xception->errorCode == 1001);
- g_error_free (error);
- error = NULL;
- g_object_unref (xception);
- xception = NULL;
-
- assert (t_test_thrift_test_client_test_exception (iface, "ApplicationException", &xception, &error) == FALSE);
- g_error_free (error);
- error = NULL;
- assert (xception == NULL);
-
- assert (t_test_thrift_test_client_test_exception (iface, "Test", &xception, &error) == TRUE);
- assert (error == NULL);
-
- multi_in = (TTestXtruct*) g_object_new (T_TEST_TYPE_XTRUCT, NULL);
- assert (t_test_thrift_test_client_test_multi_exception (iface, &multi_in, "Xception", NULL, &xception, &xception2, &error) == FALSE);
- assert (xception->errorCode == 1001);
- assert (xception2 == NULL);
- g_error_free (error);
- error = NULL;
- g_object_unref (xception);
- g_object_unref (multi_in);
- xception = NULL;
- multi_in = NULL;
-
- multi_in = (TTestXtruct*) g_object_new (T_TEST_TYPE_XTRUCT, NULL);
- assert (t_test_thrift_test_client_test_multi_exception (iface, &multi_in, "Xception2", NULL, &xception, &xception2, &error) == FALSE);
- assert (xception2->errorCode == 2002);
- assert (xception == NULL);
- g_error_free (error);
- error = NULL;
- g_object_unref (xception2);
- g_object_unref (multi_in);
- xception2 = NULL;
- multi_in = NULL;
-
- multi_in = (TTestXtruct*) g_object_new (T_TEST_TYPE_XTRUCT, NULL);
- assert (t_test_thrift_test_client_test_multi_exception (iface, &multi_in, NULL , NULL, &xception, &xception2, &error) == TRUE);
- assert (error == NULL);
- g_object_unref(multi_in);
- multi_in = NULL;
-
- assert (t_test_thrift_test_client_test_oneway (iface, 1, &error) == TRUE);
- assert (error == NULL);
-
- /* sleep to let the oneway call go through */
- sleep (5);
-
- thrift_transport_close (THRIFT_TRANSPORT(tsocket), NULL);
- g_object_unref (client);
- g_object_unref (protocol);
- g_object_unref (tsocket);
-}
-
-
-} /* extern "C" */
-
-
-static void
-bailout (int signum)
-{
- THRIFT_UNUSED_VARIABLE (signum);
-
- exit (1);
-}
-
-int
-main (void)
-{
- int status;
- int pid = fork ();
- assert (pid >= 0);
-
- if (pid == 0) /* child */
- {
- boost::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
- boost::shared_ptr<TestHandler> testHandler(new TestHandler());
- boost::shared_ptr<ThriftTestProcessor> testProcessor(new ThriftTestProcessor(testHandler));
- boost::shared_ptr<TServerSocket> serverSocket(new TServerSocket(TEST_PORT));
- boost::shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
- TSimpleServer simpleServer(testProcessor, serverSocket, transportFactory, protocolFactory);
- signal (SIGALRM, bailout);
- alarm (60);
- simpleServer.serve();
- } else {
- sleep (1);
- test_thrift_client ();
- kill (pid, SIGINT);
- assert (wait (&status) == pid);
- }
-
- return 0;
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/test/testtransportsocket.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/test/testtransportsocket.c b/depends/thirdparty/thrift/lib/c_glib/test/testtransportsocket.c
deleted file mode 100755
index d91507f..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/test/testtransportsocket.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include <assert.h>
-#include <netdb.h>
-#include <sys/wait.h>
-
-#include <thrift/c_glib/transport/thrift_transport.h>
-#include <thrift/c_glib/transport/thrift_buffered_transport.h>
-#include <thrift/c_glib/transport/thrift_server_transport.h>
-#include <thrift/c_glib/transport/thrift_server_socket.h>
-
-#define TEST_DATA { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' }
-
-/* substituted functions to test failures of system and library calls */
-static int socket_error = 0;
-int
-my_socket(int domain, int type, int protocol)
-{
- if (socket_error == 0)
- {
- return socket (domain, type, protocol);
- }
- return -1;
-}
-
-static int recv_error = 0;
-ssize_t
-my_recv(int socket, void *buffer, size_t length, int flags)
-{
- if (recv_error == 0)
- {
- return recv (socket, buffer, length, flags);
- }
- return -1;
-}
-
-static int send_error = 0;
-ssize_t
-my_send(int socket, const void *buffer, size_t length, int flags)
-{
- if (send_error == 0)
- {
- return send (socket, buffer, length, flags);
- }
- return -1;
-}
-
-#define socket my_socket
-#define recv my_recv
-#define send my_send
-#include "../src/thrift/c_glib/transport/thrift_socket.c"
-#undef socket
-#undef recv
-#undef send
-
-static void thrift_socket_server (const int port);
-
-/* test object creation and destruction */
-static void
-test_create_and_destroy(void)
-{
- gchar *hostname = NULL;
- guint port = 0;
-
- GObject *object = NULL;
- object = g_object_new (THRIFT_TYPE_SOCKET, NULL);
- assert (object != NULL);
- g_object_get (G_OBJECT(object), "hostname", &hostname, "port", &port, NULL);
- g_free (hostname);
-
- g_object_unref (object);
-}
-
-static void
-test_open_and_close(void)
-{
- ThriftSocket *tsocket = NULL;
- ThriftTransport *transport = NULL;
- GError *err = NULL;
-
- /* open a connection and close it */
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
- "port", 51188, NULL);
- transport = THRIFT_TRANSPORT (tsocket);
- thrift_socket_open (transport, NULL);
- assert (thrift_socket_is_open (transport) == TRUE);
- thrift_socket_close (transport, NULL);
- assert (thrift_socket_is_open (transport) == FALSE);
-
- /* test close failure */
- tsocket->sd = -1;
- thrift_socket_close (transport, NULL);
- g_object_unref (tsocket);
-
- /* try a hostname lookup failure */
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost.broken",
- NULL);
- transport = THRIFT_TRANSPORT (tsocket);
- assert (thrift_socket_open (transport, &err) == FALSE);
- g_object_unref (tsocket);
- g_error_free (err);
- err = NULL;
-
- /* try an error call to socket() */
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost", NULL);
- transport = THRIFT_TRANSPORT (tsocket);
- socket_error = 1;
- assert (thrift_socket_open (transport, &err) == FALSE);
- socket_error = 0;
- g_object_unref (tsocket);
- g_error_free (err);
-}
-
-static void
-test_read_and_write(void)
-{
- int status;
- pid_t pid;
- ThriftSocket *tsocket = NULL;
- ThriftTransport *transport = NULL;
- int port = 51199;
- guchar buf[10] = TEST_DATA; /* a buffer */
-
- pid = fork ();
- assert ( pid >= 0 );
-
- if ( pid == 0 )
- {
- /* child listens */
- thrift_socket_server (port);
- exit (0);
- } else {
- /* parent connects, wait a bit for the socket to be created */
- sleep (1);
-
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
- "port", port, NULL);
- transport = THRIFT_TRANSPORT (tsocket);
- assert (thrift_socket_open (transport, NULL) == TRUE);
- assert (thrift_socket_is_open (transport));
- thrift_socket_write (transport, buf, 10, NULL);
-
- /* write fail */
- send_error = 1;
- thrift_socket_write (transport, buf, 1, NULL);
- send_error = 0;
-
- thrift_socket_write_end (transport, NULL);
- thrift_socket_flush (transport, NULL);
- thrift_socket_close (transport, NULL);
- g_object_unref (tsocket);
-
- assert ( wait (&status) == pid );
- assert ( status == 0 );
- }
-}
-
-/* test ThriftSocket's peek() implementation */
-static void
-test_peek(void)
-{
- gint status;
- pid_t pid;
- guint port = 51199;
- gchar data = 'A';
- ThriftTransport *client_transport;
- GError *error = NULL;
-
- client_transport = g_object_new (THRIFT_TYPE_SOCKET,
- "hostname", "localhost",
- "port", port,
- NULL);
-
- /* thrift_transport_peek returns FALSE when the socket is closed */
- g_assert (thrift_transport_is_open (client_transport) == FALSE);
- g_assert (thrift_transport_peek (client_transport, &error) == FALSE);
- g_assert (error == NULL);
-
- pid = fork ();
- g_assert (pid >= 0);
-
- if (pid == 0)
- {
- ThriftServerTransport *server_transport = NULL;
-
- g_object_unref (client_transport);
-
- /* child listens */
- server_transport = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
- "port", port,
- NULL);
- g_assert (server_transport != NULL);
-
- thrift_server_transport_listen (server_transport, &error);
- g_assert (error == NULL);
-
- client_transport = g_object_new
- (THRIFT_TYPE_BUFFERED_TRANSPORT,
- "transport", thrift_server_transport_accept (server_transport, &error),
- "r_buf_size", 0,
- "w_buf_size", sizeof data,
- NULL);
- g_assert (error == NULL);
- g_assert (client_transport != NULL);
-
- /* write exactly one character to the client */
- g_assert (thrift_transport_write (client_transport,
- &data,
- sizeof data,
- &error) == TRUE);
-
- thrift_transport_flush (client_transport, &error);
- thrift_transport_write_end (client_transport, &error);
- thrift_transport_close (client_transport, &error);
-
- g_object_unref (client_transport);
- g_object_unref (server_transport);
-
- exit (0);
- }
- else {
- /* parent connects, wait a bit for the socket to be created */
- sleep (1);
-
- /* connect to the child */
- thrift_transport_open (client_transport, &error);
- g_assert (error == NULL);
- g_assert (thrift_transport_is_open (client_transport) == TRUE);
-
- /* thrift_transport_peek returns TRUE when the socket is open and there is
- data available to be read */
- g_assert (thrift_transport_peek (client_transport, &error) == TRUE);
- g_assert (error == NULL);
-
- /* read exactly one character from the server */
- g_assert_cmpint (thrift_transport_read (client_transport,
- &data,
- sizeof data,
- &error), ==, sizeof data);
-
- /* thrift_transport_peek returns FALSE when the socket is open but there is
- no (more) data available to be read */
- g_assert (thrift_transport_is_open (client_transport) == TRUE);
- g_assert (thrift_transport_peek (client_transport, &error) == FALSE);
- g_assert (error == NULL);
-
- thrift_transport_read_end (client_transport, &error);
- thrift_transport_close (client_transport, &error);
-
- g_object_unref (client_transport);
-
- g_assert (wait (&status) == pid);
- g_assert (status == 0);
- }
-}
-
-static void
-thrift_socket_server (const int port)
-{
- int bytes = 0;
- ThriftServerTransport *transport = NULL;
- ThriftTransport *client = NULL;
- guchar buf[10]; /* a buffer */
- guchar match[10] = TEST_DATA;
-
- ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
- "port", port, NULL);
-
- transport = THRIFT_SERVER_TRANSPORT (tsocket);
- thrift_server_transport_listen (transport, NULL);
- client = thrift_server_transport_accept (transport, NULL);
- assert (client != NULL);
-
- /* read 10 bytes */
- bytes = thrift_socket_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 */
-
- /* failed read */
- recv_error = 1;
- thrift_socket_read (client, buf, 1, NULL);
- recv_error = 0;
-
- thrift_socket_read_end (client, NULL);
- thrift_socket_close (client, NULL);
- g_object_unref (tsocket);
- g_object_unref (client);
-}
-
-int
-main(int argc, char *argv[])
-{
-#if (!GLIB_CHECK_VERSION (2, 36, 0))
- g_type_init();
-#endif
-
- g_test_init (&argc, &argv, NULL);
-
- g_test_add_func ("/testtransportsocket/CreateAndDestroy", test_create_and_destroy);
- g_test_add_func ("/testtransportsocket/OpenAndClose", test_open_and_close);
- g_test_add_func ("/testtransportsocket/ReadAndWrite", test_read_and_write);
- g_test_add_func ("/testtransportsocket/Peek", test_peek);
-
- return g_test_run ();
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/thrift_c_glib.pc.in
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/thrift_c_glib.pc.in b/depends/thirdparty/thrift/lib/c_glib/thrift_c_glib.pc.in
deleted file mode 100644
index 568c7a2..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/thrift_c_glib.pc.in
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: Thrift
-Description: Thrift C API
-Version: @VERSION@
-Requires: glib-2.0 gobject-2.0
-Libs: -L${libdir} -lthrift_c_glib
-Cflags: -I${includedir}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/README.md
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/README.md b/depends/thirdparty/thrift/lib/cocoa/README.md
deleted file mode 100644
index bbe3c93..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-Thrift Cocoa Software Library
-
-License
-=======
-
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/coding_standards.md
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/coding_standards.md b/depends/thirdparty/thrift/lib/cocoa/coding_standards.md
deleted file mode 100644
index fa0390b..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/coding_standards.md
+++ /dev/null
@@ -1 +0,0 @@
-Please follow [General Coding Standards](/doc/coding_standards.md)
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/src/TApplicationException.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/src/TApplicationException.h b/depends/thirdparty/thrift/lib/cocoa/src/TApplicationException.h
deleted file mode 100644
index 7b027d6..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/src/TApplicationException.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TException.h"
-#import "TProtocol.h"
-
-enum {
- TApplicationException_UNKNOWN = 0,
- TApplicationException_UNKNOWN_METHOD = 1,
- TApplicationException_INVALID_MESSAGE_TYPE = 2,
- TApplicationException_WRONG_METHOD_NAME = 3,
- TApplicationException_BAD_SEQUENCE_ID = 4,
- TApplicationException_MISSING_RESULT = 5,
- TApplicationException_INTERNAL_ERROR = 6,
- TApplicationException_PROTOCOL_ERROR = 7,
- TApplicationException_INVALID_TRANSFORM = 8,
- TApplicationException_INVALID_PROTOCOL = 9,
- TApplicationException_UNSUPPORTED_CLIENT_TYPE = 10
-};
-
-// FIXME
-@interface TApplicationException : TException {
- int mType;
-}
-
-+ (TApplicationException *) read: (id <TProtocol>) protocol;
-
-- (void) write: (id <TProtocol>) protocol;
-
-+ (TApplicationException *) exceptionWithType: (int) type
- reason: (NSString *) message;
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/src/TApplicationException.m
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/src/TApplicationException.m b/depends/thirdparty/thrift/lib/cocoa/src/TApplicationException.m
deleted file mode 100644
index 974dfc5..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/src/TApplicationException.m
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TApplicationException.h"
-#import "TProtocolUtil.h"
-#import "TObjective-C.h"
-
-@implementation TApplicationException
-
-- (id) initWithType: (int) type
- reason: (NSString *) reason
-{
- mType = type;
-
- NSString * name;
- switch (type) {
- case TApplicationException_UNKNOWN_METHOD:
- name = @"Unknown method";
- break;
- case TApplicationException_INVALID_MESSAGE_TYPE:
- name = @"Invalid message type";
- break;
- case TApplicationException_WRONG_METHOD_NAME:
- name = @"Wrong method name";
- break;
- case TApplicationException_BAD_SEQUENCE_ID:
- name = @"Bad sequence ID";
- break;
- case TApplicationException_MISSING_RESULT:
- name = @"Missing result";
- break;
- case TApplicationException_INTERNAL_ERROR:
- name = @"Internal error";
- break;
- case TApplicationException_PROTOCOL_ERROR:
- name = @"Protocol error";
- break;
- case TApplicationException_INVALID_TRANSFORM:
- name = @"Invalid transform";
- break;
- case TApplicationException_INVALID_PROTOCOL:
- name = @"Invalid protocol";
- break;
- case TApplicationException_UNSUPPORTED_CLIENT_TYPE:
- name = @"Unsupported client type";
- break;
- default:
- name = @"Unknown";
- break;
- }
-
- self = [super initWithName: name reason: reason userInfo: nil];
- return self;
-}
-
-
-+ (TApplicationException *) read: (id <TProtocol>) protocol
-{
- NSString * reason = nil;
- int type = TApplicationException_UNKNOWN;
- int fieldType;
- int fieldID;
-
- [protocol readStructBeginReturningName: NULL];
-
- while (true) {
- [protocol readFieldBeginReturningName: NULL
- type: &fieldType
- fieldID: &fieldID];
- if (fieldType == TType_STOP) {
- break;
- }
- switch (fieldID) {
- case 1:
- if (fieldType == TType_STRING) {
- reason = [protocol readString];
- } else {
- [TProtocolUtil skipType: fieldType onProtocol: protocol];
- }
- break;
- case 2:
- if (fieldType == TType_I32) {
- type = [protocol readI32];
- } else {
- [TProtocolUtil skipType: fieldType onProtocol: protocol];
- }
- break;
- default:
- [TProtocolUtil skipType: fieldType onProtocol: protocol];
- break;
- }
- [protocol readFieldEnd];
- }
- [protocol readStructEnd];
-
- return [TApplicationException exceptionWithType: type reason: reason];
-}
-
-
-- (void) write: (id <TProtocol>) protocol
-{
- [protocol writeStructBeginWithName: @"TApplicationException"];
-
- if ([self reason] != nil) {
- [protocol writeFieldBeginWithName: @"message"
- type: TType_STRING
- fieldID: 1];
- [protocol writeString: [self reason]];
- [protocol writeFieldEnd];
- }
-
- [protocol writeFieldBeginWithName: @"type"
- type: TType_I32
- fieldID: 2];
- [protocol writeI32: mType];
- [protocol writeFieldEnd];
-
- [protocol writeFieldStop];
- [protocol writeStructEnd];
-}
-
-
-+ (TApplicationException *) exceptionWithType: (int) type
- reason: (NSString *) reason
-{
- return [[[TApplicationException alloc] initWithType: type
- reason: reason] autorelease_stub];
-}
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/src/TBaseClient.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/src/TBaseClient.h b/depends/thirdparty/thrift/lib/cocoa/src/TBaseClient.h
deleted file mode 100644
index 12944b1..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/src/TBaseClient.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TProtocol.h"
-#import "TApplicationException.h"
-
-@interface TBaseClient : NSObject {
- id <TProtocol> inProtocol;
- id <TProtocol> outProtocol;
-}
-
-- (TApplicationException *)checkIncomingMessageException;
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/src/TBaseClient.m
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/src/TBaseClient.m b/depends/thirdparty/thrift/lib/cocoa/src/TBaseClient.m
deleted file mode 100644
index d15f9d3..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/src/TBaseClient.m
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TBaseClient.h"
-#import "TApplicationException.h"
-#import "TObjective-C.h"
-
-@implementation TBaseClient
-
-- (void) dealloc
-{
- [inProtocol release_stub];
- [outProtocol release_stub];
- [super dealloc_stub];
-}
-
-- (TApplicationException *)checkIncomingMessageException
-{
- int msgType = 0;
- [inProtocol readMessageBeginReturningName: nil type: &msgType sequenceID: NULL];
- if (msgType == TMessageType_EXCEPTION) {
- TApplicationException * x = [TApplicationException read: inProtocol];
- [inProtocol readMessageEnd];
- return x;
- }
-
- return nil;
-}
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/src/TException.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/src/TException.h b/depends/thirdparty/thrift/lib/cocoa/src/TException.h
deleted file mode 100644
index e56f4fa..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/src/TException.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-
-@interface TException : NSException {
-}
-
-+ (id) exceptionWithName: (NSString *) name;
-
-+ (id) exceptionWithName: (NSString *) name
- reason: (NSString *) reason;
-
-+ (id) exceptionWithName: (NSString *) name
- reason: (NSString *) reason
- error: (NSError *) error;
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/src/TException.m
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/src/TException.m b/depends/thirdparty/thrift/lib/cocoa/src/TException.m
deleted file mode 100644
index 0160e3b..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/src/TException.m
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TException.h"
-#import "TObjective-C.h"
-
-@implementation TException
-
-+ (id) exceptionWithName: (NSString *) name
-{
- return [self exceptionWithName: name reason: @"unknown" error: nil];
-}
-
-
-+ (id) exceptionWithName: (NSString *) name
- reason: (NSString *) reason
-{
- return [self exceptionWithName: name reason: reason error: nil];
-}
-
-
-+ (id) exceptionWithName: (NSString *) name
- reason: (NSString *) reason
- error: (NSError *) error
-{
- NSDictionary * userInfo = nil;
- if (error != nil) {
- userInfo = [NSDictionary dictionaryWithObject: error forKey: @"error"];
- }
-
- return [super exceptionWithName: name
- reason: reason
- userInfo: userInfo];
-}
-
-
-- (NSString *) description
-{
- NSMutableString * result = [NSMutableString stringWithString: [self name]];
- [result appendFormat: @": %@", [self reason]];
- if ([self userInfo] != nil) {
- [result appendFormat: @"\n userInfo = %@", [self userInfo]];
- }
-
- return result;
-}
-
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/src/TObjective-C.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/src/TObjective-C.h b/depends/thirdparty/thrift/lib/cocoa/src/TObjective-C.h
deleted file mode 100644
index 9c0831d..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/src/TObjective-C.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * TObjective-C.h is for supporting coexistence of both the ARC (Automatic
- * Reference Counting) mode and the Non-ARC mode of Objective-C
- * in the same source code.
- *
- * 2011/11/14 HIRANO Satoshi (AIST, Japan)
- *
- * Before:
- *
- * var = [aObject retain];
- * [aObject release];
- * [aObject autorelease];
- * [super dealloc];
- * CFFunction(obj);
- *
- * ARC and Non-ARC compatible:
- *
- * #import "TObjective-C.h"
- * var = [aObject retain_stub];
- * [aObject release_stub];
- * [aObject autorelease_stub];
- * [super dealloc_stub];
- * CFFunction(bridge_stub obj);
- *
- * Don't use retain_stub for @property(retain).
- * Use NSAutoreleasePool like this:
- * #if __has_feature(objc_arc)
- * @autoreleasepool {
- * // code
- * }
- * #else
- * NSAutoReleasePool *pool = [[NSAutoReleasePool alloc] init...
- * // code
- * [pool release];
- * #endif
- */
-
-
-#if !defined(retain_stub)
-#if __has_feature(objc_arc)
-#define retain_stub self
-#define autorelease_stub self
-#define release_stub self
-#define dealloc_stub self
-#define bridge_stub __bridge
-#else
-#define retain_stub retain
-#define autorelease_stub autorelease
-#define release_stub release
-#define dealloc_stub dealloc
-#define bridge_stub
-#endif
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/src/TProcessor.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/src/TProcessor.h b/depends/thirdparty/thrift/lib/cocoa/src/TProcessor.h
deleted file mode 100644
index 980be94..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/src/TProcessor.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "TProtocol.h"
-
-
-@protocol TProcessor <NSObject>
-
-- (BOOL) processOnInputProtocol: (id <TProtocol>) inProtocol
- outputProtocol: (id <TProtocol>) outProtocol;
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/src/TProcessorFactory.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/src/TProcessorFactory.h b/depends/thirdparty/thrift/lib/cocoa/src/TProcessorFactory.h
deleted file mode 100644
index 29d12b3..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/src/TProcessorFactory.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "TProcessor.h"
-
-@protocol TProcessorFactory <NSObject>
-
-- (id<TProcessor>) processorForTransport: (id<TTransport>) transport;
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/src/TSharedProcessorFactory.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/src/TSharedProcessorFactory.h b/depends/thirdparty/thrift/lib/cocoa/src/TSharedProcessorFactory.h
deleted file mode 100644
index cf4a462..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/src/TSharedProcessorFactory.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import "TProcessorFactory.h"
-
-@interface TSharedProcessorFactory : NSObject <TProcessorFactory> {
- id<TProcessor> mSharedProcessor;
-}
-- (id) initWithSharedProcessor: (id<TProcessor>) sharedProcessor;
-@end
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/src/TSharedProcessorFactory.m
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/src/TSharedProcessorFactory.m b/depends/thirdparty/thrift/lib/cocoa/src/TSharedProcessorFactory.m
deleted file mode 100644
index a0007c0..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/src/TSharedProcessorFactory.m
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-#import "TSharedProcessorFactory.h"
-#import "TObjective-C.h"
-
-
-@implementation TSharedProcessorFactory
-
-
-- (id) initWithSharedProcessor: (id<TProcessor>) sharedProcessor
-{
- self = [super init];
- if (!self) {
- return nil;
- }
-
- mSharedProcessor = [sharedProcessor retain_stub];
- return self;
-}
-
-
-- (void) dealloc
-{
- [mSharedProcessor release_stub];
- [super dealloc_stub];
-}
-
-
-- (id<TProcessor>) processorForTransport: (id<TTransport>) transport
-{
- return [[mSharedProcessor retain_stub] autorelease_stub];
-}
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/src/Thrift.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/src/Thrift.h b/depends/thirdparty/thrift/lib/cocoa/src/Thrift.h
deleted file mode 100644
index 9cedb66..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/src/Thrift.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#define ThriftVersion @"0.9.3"
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/src/protocol/TBase.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/src/protocol/TBase.h b/depends/thirdparty/thrift/lib/cocoa/src/protocol/TBase.h
deleted file mode 100644
index 33037ef..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/src/protocol/TBase.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import <Foundation/Foundation.h>
-
-#import "TProtocol.h"
-
-@protocol TBase <NSObject>
-
-/**
- * De-serialize object from the given input protocol
- *
- * @param input protocol used for reading
- */
-- (void) read: (id <TProtocol>) inProtocol;
-
-/**
- * Serialize object to the given protocol
- *
- * @param buf output protocol used for writing
- */
-- (void) write: (id <TProtocol>) outProtocol;
-
-@end
-
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/src/protocol/TBinaryProtocol.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/src/protocol/TBinaryProtocol.h b/depends/thirdparty/thrift/lib/cocoa/src/protocol/TBinaryProtocol.h
deleted file mode 100644
index 9a73730..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/src/protocol/TBinaryProtocol.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TProtocol.h"
-#import "TTransport.h"
-#import "TProtocolFactory.h"
-
-
-@interface TBinaryProtocol : NSObject <TProtocol> {
- id <TTransport> mTransport;
- BOOL mStrictRead;
- BOOL mStrictWrite;
- int32_t mMessageSizeLimit;
-}
-
-- (id) initWithTransport: (id <TTransport>) transport;
-
-- (id) initWithTransport: (id <TTransport>) transport
- strictRead: (BOOL) strictRead
- strictWrite: (BOOL) strictWrite;
-
-- (int32_t) messageSizeLimit;
-- (void) setMessageSizeLimit: (int32_t) sizeLimit;
-
-@end
-
-
-@interface TBinaryProtocolFactory : NSObject <TProtocolFactory> {
-}
-
-+ (TBinaryProtocolFactory *) sharedFactory;
-
-- (TBinaryProtocol *) newProtocolOnTransport: (id <TTransport>) transport;
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/src/protocol/TBinaryProtocol.m
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/src/protocol/TBinaryProtocol.m b/depends/thirdparty/thrift/lib/cocoa/src/protocol/TBinaryProtocol.m
deleted file mode 100644
index 847c723..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/src/protocol/TBinaryProtocol.m
+++ /dev/null
@@ -1,530 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TBinaryProtocol.h"
-#import "TProtocolException.h"
-#import "TObjective-C.h"
-
-/* In the modern protocol, version is stored in the high half of an int32.
- * The low half contains type info. */
-static const uint16_t VERSION_1 = 0x8001;
-
-NS_INLINE size_t
-CheckedCastInt32ToSizeT(int32_t size)
-{
- if (size < 0) {
- NSString *reason = [NSString stringWithFormat:
- @"%s: refusing to read data with negative size: %"PRId32,
- __func__, size];
- @throw [TProtocolException
- exceptionWithName: @"TProtocolException"
- reason: reason];
- }
- size_t checkedSize = (size_t)size;
- return checkedSize;
-}
-
-NS_INLINE int32_t
-CheckedCastSizeTToInt32(size_t size)
-{
- if (size > INT32_MAX) {
- NSString *reason = [NSString stringWithFormat:
- @"%s: data size exceeds values representable by a 32-bit signed integer: %zu",
- __func__, size];
- @throw [TProtocolException
- exceptionWithName: @"TProtocolException"
- reason: reason];
- }
- int32_t checkedSize = (int32_t)size;
- return checkedSize;
-}
-
-NS_INLINE uint8_t
-CheckedCastIntToUInt8(int size)
-{
- if (size > UINT8_MAX) {
- NSString *reason = [NSString stringWithFormat:
- @"%s: data size exceeds values representable by a 8-bit unsigned integer: %d",
- __func__, size];
- @throw [TProtocolException
- exceptionWithName: @"TProtocolException"
- reason: reason];
- }
- uint8_t checkedSize = (uint8_t)size;
- return checkedSize;
-}
-
-static TBinaryProtocolFactory * gSharedFactory = nil;
-
-@implementation TBinaryProtocolFactory
-
-+ (TBinaryProtocolFactory *) sharedFactory {
- if (gSharedFactory == nil) {
- gSharedFactory = [[TBinaryProtocolFactory alloc] init];
- }
-
- return gSharedFactory;
-}
-
-- (TBinaryProtocol *) newProtocolOnTransport: (id <TTransport>) transport {
- return [[TBinaryProtocol alloc] initWithTransport: transport];
-}
-
-@end
-
-
-
-@implementation TBinaryProtocol
-
-- (id) initWithTransport: (id <TTransport>) transport
-{
- return [self initWithTransport: transport strictRead: NO strictWrite: YES];
-}
-
-- (id) initWithTransport: (id <TTransport>) transport
- strictRead: (BOOL) strictRead
- strictWrite: (BOOL) strictWrite
-{
- self = [super init];
- mTransport = [transport retain_stub];
- mStrictRead = strictRead;
- mStrictWrite = strictWrite;
- return self;
-}
-
-
-- (int32_t) messageSizeLimit
-{
- return mMessageSizeLimit;
-}
-
-
-- (void) setMessageSizeLimit: (int32_t) sizeLimit
-{
- mMessageSizeLimit = sizeLimit;
-}
-
-
-- (void) dealloc
-{
- [mTransport release_stub];
- [super dealloc_stub];
-}
-
-
-- (id <TTransport>) transport
-{
- return mTransport;
-}
-
-
-- (NSString *) readStringBody: (int) rawSize
-{
- size_t size = CheckedCastInt32ToSizeT(rawSize);
- char * buffer = malloc(size+1);
- if (!buffer) {
- @throw [TProtocolException exceptionWithName: @"TProtocolException"
- reason: [NSString stringWithFormat: @"Unable to allocate memory in %s, size: %zu",
- __PRETTY_FUNCTION__,
- size]];;
- }
- [mTransport readAll: (uint8_t *) buffer offset: 0 length: size];
- buffer[size] = 0;
- NSString * result = [NSString stringWithUTF8String: buffer];
- free(buffer);
- return result;
-}
-
-
-- (void) readMessageBeginReturningName: (NSString **) name
- type: (int *) type
- sequenceID: (int *) sequenceID
-{
- int32_t size = [self readI32];
- if (size < 0) {
- /* Version (unsigned) is stored in the high halfword. */
- uint16_t version = (size >> 16) & 0xFFFF;
- if (version != VERSION_1) {
- NSString *reason = [NSString stringWithFormat:
- @"%s: Expected version %"PRIu16", instead found: %"PRIu16,
- __func__, VERSION_1, version];
- @throw [TProtocolException exceptionWithName: @"TProtocolException"
- reason: reason];
- }
- if (type != NULL) {
- *type = size & 0x00FF;
- }
- NSString * messageName = [self readString];
- if (name != NULL) {
- *name = messageName;
- }
- int seqID = [self readI32];
- if (sequenceID != NULL) {
- *sequenceID = seqID;
- }
- } else {
- if (mStrictRead) {
- @throw [TProtocolException exceptionWithName: @"TProtocolException"
- reason: @"Missing version in readMessageBegin, old client?"];
- }
- if ([self messageSizeLimit] > 0 && size > [self messageSizeLimit]) {
- @throw [TProtocolException exceptionWithName: @"TProtocolException"
- reason: [NSString stringWithFormat: @"Message too big. Size limit is: %d Message size is: %d",
- mMessageSizeLimit,
- size]];
- }
- NSString * messageName = [self readStringBody: size];
- if (name != NULL) {
- *name = messageName;
- }
- int messageType = [self readByte];
- if (type != NULL) {
- *type = messageType;
- }
- int seqID = [self readI32];
- if (sequenceID != NULL) {
- *sequenceID = seqID;
- }
- }
-}
-
-
-- (void) readMessageEnd {}
-
-
-- (void) readStructBeginReturningName: (NSString **) name
-{
- if (name != NULL) {
- *name = nil;
- }
-}
-
-
-- (void) readStructEnd {}
-
-
-- (void) readFieldBeginReturningName: (NSString **) name
- type: (int *) fieldType
- fieldID: (int *) fieldID
-{
- if (name != NULL) {
- *name = nil;
- }
- int ft = [self readByte];
- if (fieldType != NULL) {
- *fieldType = ft;
- }
- if (ft != TType_STOP) {
- int fid = [self readI16];
- if (fieldID != NULL) {
- *fieldID = fid;
- }
- }
-}
-
-
-- (void) readFieldEnd {}
-
-
-- (int32_t) readI32
-{
- uint8_t i32rd[4];
- [mTransport readAll: i32rd offset: 0 length: 4];
- return
- ((i32rd[0] & 0xff) << 24) |
- ((i32rd[1] & 0xff) << 16) |
- ((i32rd[2] & 0xff) << 8) |
- ((i32rd[3] & 0xff));
-}
-
-
-- (NSString *) readString
-{
- int32_t size = [self readI32];
- return [self readStringBody: size];
-}
-
-
-- (BOOL) readBool
-{
- return [self readByte] == 1;
-}
-
-- (uint8_t) readByte
-{
- uint8_t myByte;
- [mTransport readAll: &myByte offset: 0 length: 1];
- return myByte;
-}
-
-- (short) readI16
-{
- uint8_t buff[2];
- [mTransport readAll: buff offset: 0 length: 2];
- return (short)
- (((buff[0] & 0xff) << 8) |
- ((buff[1] & 0xff)));
-}
-
-- (int64_t) readI64
-{
- uint8_t i64rd[8];
- [mTransport readAll: i64rd offset: 0 length: 8];
- return
- ((int64_t)(i64rd[0] & 0xff) << 56) |
- ((int64_t)(i64rd[1] & 0xff) << 48) |
- ((int64_t)(i64rd[2] & 0xff) << 40) |
- ((int64_t)(i64rd[3] & 0xff) << 32) |
- ((int64_t)(i64rd[4] & 0xff) << 24) |
- ((int64_t)(i64rd[5] & 0xff) << 16) |
- ((int64_t)(i64rd[6] & 0xff) << 8) |
- ((int64_t)(i64rd[7] & 0xff));
-}
-
-- (double) readDouble
-{
- // FIXME - will this get us into trouble on PowerPC?
- int64_t ieee754 = [self readI64];
- return *((double *) &ieee754);
-}
-
-
-- (NSData *) readBinary
-{
- int32_t size = [self readI32];
- size_t binarySize = CheckedCastInt32ToSizeT(size);
- uint8_t * buff = malloc(binarySize);
- if (buff == NULL) {
- @throw [TProtocolException
- exceptionWithName: @"TProtocolException"
- reason: [NSString stringWithFormat: @"Out of memory. Unable to allocate %d bytes trying to read binary data.",
- size]];
- }
- [mTransport readAll: buff offset: 0 length: binarySize];
- return [NSData dataWithBytesNoCopy: buff length: binarySize];
-}
-
-
-- (void) readMapBeginReturningKeyType: (int *) keyType
- valueType: (int *) valueType
- size: (int *) size
-{
- int kt = [self readByte];
- int vt = [self readByte];
- int s = [self readI32];
- if (keyType != NULL) {
- *keyType = kt;
- }
- if (valueType != NULL) {
- *valueType = vt;
- }
- if (size != NULL) {
- *size = s;
- }
-}
-
-- (void) readMapEnd {}
-
-
-- (void) readSetBeginReturningElementType: (int *) elementType
- size: (int *) size
-{
- int et = [self readByte];
- int s = [self readI32];
- if (elementType != NULL) {
- *elementType = et;
- }
- if (size != NULL) {
- *size = s;
- }
-}
-
-
-- (void) readSetEnd {}
-
-
-- (void) readListBeginReturningElementType: (int *) elementType
- size: (int *) size
-{
- int et = [self readByte];
- int s = [self readI32];
- if (elementType != NULL) {
- *elementType = et;
- }
- if (size != NULL) {
- *size = s;
- }
-}
-
-
-- (void) readListEnd {}
-
-
-- (void) writeByte: (uint8_t) value
-{
- [mTransport write: &value offset: 0 length: 1];
-}
-
-
-- (void) writeMessageBeginWithName: (NSString *) name
- type: (int) messageType
- sequenceID: (int) sequenceID
-{
- if (mStrictWrite) {
- int version = (VERSION_1 << 16) | messageType;
- [self writeI32: version];
- [self writeString: name];
- [self writeI32: sequenceID];
- } else {
- [self writeString: name];
- [self writeByte: CheckedCastIntToUInt8(messageType)];
- [self writeI32: sequenceID];
- }
-}
-
-
-- (void) writeMessageEnd {}
-
-
-- (void) writeStructBeginWithName: (NSString *) name {}
-
-
-- (void) writeStructEnd {}
-
-
-- (void) writeFieldBeginWithName: (NSString *) name
- type: (int) fieldType
- fieldID: (int) fieldID
-{
- [self writeByte: CheckedCastIntToUInt8(fieldType)];
- [self writeI16: CheckedCastIntToUInt8(fieldID)];
-}
-
-
-- (void) writeI32: (int32_t) value
-{
- uint8_t buff[4];
- buff[0] = 0xFF & (value >> 24);
- buff[1] = 0xFF & (value >> 16);
- buff[2] = 0xFF & (value >> 8);
- buff[3] = 0xFF & value;
- [mTransport write: buff offset: 0 length: 4];
-}
-
-- (void) writeI16: (short) value
-{
- uint8_t buff[2];
- buff[0] = 0xff & (value >> 8);
- buff[1] = 0xff & value;
- [mTransport write: buff offset: 0 length: 2];
-}
-
-
-- (void) writeI64: (int64_t) value
-{
- uint8_t buff[8];
- buff[0] = 0xFF & (value >> 56);
- buff[1] = 0xFF & (value >> 48);
- buff[2] = 0xFF & (value >> 40);
- buff[3] = 0xFF & (value >> 32);
- buff[4] = 0xFF & (value >> 24);
- buff[5] = 0xFF & (value >> 16);
- buff[6] = 0xFF & (value >> 8);
- buff[7] = 0xFF & value;
- [mTransport write: buff offset: 0 length: 8];
-}
-
-- (void) writeDouble: (double) value
-{
- // spit out IEEE 754 bits - FIXME - will this get us in trouble on
- // PowerPC?
- [self writeI64: *((int64_t *) &value)];
-}
-
-
-- (void) writeString: (NSString *) value
-{
- if (value != nil) {
- const char * utf8Bytes = [value UTF8String];
- size_t length = strlen(utf8Bytes);
- int32_t size = CheckedCastSizeTToInt32(length);
- [self writeI32: size];
- [mTransport write: (uint8_t *) utf8Bytes offset: 0 length: length];
- } else {
- // instead of crashing when we get null, let's write out a zero
- // length string
- [self writeI32: 0];
- }
-}
-
-
-- (void) writeBinary: (NSData *) data
-{
- int32_t size = CheckedCastSizeTToInt32([data length]);
- [self writeI32: size];
- [mTransport write: [data bytes] offset: 0 length: [data length]];
-}
-
-- (void) writeFieldStop
-{
- [self writeByte: TType_STOP];
-}
-
-
-- (void) writeFieldEnd {}
-
-
-- (void) writeMapBeginWithKeyType: (int) keyType
- valueType: (int) valueType
- size: (int) size
-{
- [self writeByte: CheckedCastIntToUInt8(keyType)];
- [self writeByte: CheckedCastIntToUInt8(valueType)];
- [self writeI32: size];
-}
-
-- (void) writeMapEnd {}
-
-
-- (void) writeSetBeginWithElementType: (int) elementType
- size: (int) size
-{
- [self writeByte: CheckedCastIntToUInt8(elementType)];
- [self writeI32: size];
-}
-
-- (void) writeSetEnd {}
-
-
-- (void) writeListBeginWithElementType: (int) elementType
- size: (int) size
-{
- [self writeByte: CheckedCastIntToUInt8(elementType)];
- [self writeI32: size];
-}
-
-- (void) writeListEnd {}
-
-
-- (void) writeBool: (BOOL) value
-{
- [self writeByte: (value ? 1 : 0)];
-}
-
-@end
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/cocoa/src/protocol/TCompactProtocol.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/cocoa/src/protocol/TCompactProtocol.h b/depends/thirdparty/thrift/lib/cocoa/src/protocol/TCompactProtocol.h
deleted file mode 100644
index 3c9195c..0000000
--- a/depends/thirdparty/thrift/lib/cocoa/src/protocol/TCompactProtocol.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#import "TProtocol.h"
-#import "TTransport.h"
-#import "TProtocolFactory.h"
-
-@interface TCompactProtocol : NSObject <TProtocol>
-
-- (id) initWithTransport: (id <TTransport>) transport;
-
-@end
-
-@interface TCompactProtocolFactory : NSObject <TProtocolFactory>
-
-+ (TCompactProtocolFactory *) sharedFactory;
-
-- (TCompactProtocol *) newProtocolOnTransport: (id <TTransport>) transport;
-
-@end