You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2010/11/26 11:17:50 UTC

svn commit: r1039299 [1/3] - in /thrift/trunk: ./ lib/c_glib/ lib/c_glib/src/ lib/c_glib/src/processor/ lib/c_glib/src/protocol/ lib/c_glib/src/server/ lib/c_glib/src/transport/ lib/c_glib/test/

Author: roger
Date: Fri Nov 26 10:17:48 2010
New Revision: 1039299

URL: http://svn.apache.org/viewvc?rev=1039299&view=rev
Log:
THRIFT-1003 Polishing c_glib code

Patch: Anatol Pomozov

Added:
    thrift/trunk/lib/c_glib/test/testbinaryprotocol.c
Removed:
    thrift/trunk/lib/c_glib/test/test-wrapper.sh.in
    thrift/trunk/lib/c_glib/test/testprotocolbinary.c
Modified:
    thrift/trunk/configure.ac
    thrift/trunk/lib/c_glib/src/processor/thrift_processor.c
    thrift/trunk/lib/c_glib/src/processor/thrift_processor.h
    thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol.c
    thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol.h
    thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol_factory.c
    thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol_factory.h
    thrift/trunk/lib/c_glib/src/protocol/thrift_protocol.c
    thrift/trunk/lib/c_glib/src/protocol/thrift_protocol.h
    thrift/trunk/lib/c_glib/src/protocol/thrift_protocol_factory.c
    thrift/trunk/lib/c_glib/src/protocol/thrift_protocol_factory.h
    thrift/trunk/lib/c_glib/src/server/thrift_server.c
    thrift/trunk/lib/c_glib/src/server/thrift_server.h
    thrift/trunk/lib/c_glib/src/server/thrift_simple_server.c
    thrift/trunk/lib/c_glib/src/server/thrift_simple_server.h
    thrift/trunk/lib/c_glib/src/thrift.c
    thrift/trunk/lib/c_glib/src/thrift.h
    thrift/trunk/lib/c_glib/src/thrift_application_exception.c
    thrift/trunk/lib/c_glib/src/thrift_application_exception.h
    thrift/trunk/lib/c_glib/src/thrift_struct.c
    thrift/trunk/lib/c_glib/src/thrift_struct.h
    thrift/trunk/lib/c_glib/src/transport/thrift_buffered_transport.c
    thrift/trunk/lib/c_glib/src/transport/thrift_buffered_transport.h
    thrift/trunk/lib/c_glib/src/transport/thrift_framed_transport.c
    thrift/trunk/lib/c_glib/src/transport/thrift_framed_transport.h
    thrift/trunk/lib/c_glib/src/transport/thrift_memory_buffer.c
    thrift/trunk/lib/c_glib/src/transport/thrift_memory_buffer.h
    thrift/trunk/lib/c_glib/src/transport/thrift_server_socket.c
    thrift/trunk/lib/c_glib/src/transport/thrift_server_socket.h
    thrift/trunk/lib/c_glib/src/transport/thrift_server_transport.c
    thrift/trunk/lib/c_glib/src/transport/thrift_server_transport.h
    thrift/trunk/lib/c_glib/src/transport/thrift_socket.c
    thrift/trunk/lib/c_glib/src/transport/thrift_socket.h
    thrift/trunk/lib/c_glib/src/transport/thrift_transport.c
    thrift/trunk/lib/c_glib/src/transport/thrift_transport.h
    thrift/trunk/lib/c_glib/src/transport/thrift_transport_factory.c
    thrift/trunk/lib/c_glib/src/transport/thrift_transport_factory.h
    thrift/trunk/lib/c_glib/test/   (props changed)
    thrift/trunk/lib/c_glib/test/Makefile.am
    thrift/trunk/lib/c_glib/test/testbufferedtransport.c
    thrift/trunk/lib/c_glib/test/testdebugproto.c
    thrift/trunk/lib/c_glib/test/testframedtransport.c
    thrift/trunk/lib/c_glib/test/testmemorybuffer.c
    thrift/trunk/lib/c_glib/test/testoptionalrequired.c
    thrift/trunk/lib/c_glib/test/testsimpleserver.c
    thrift/trunk/lib/c_glib/test/teststruct.c
    thrift/trunk/lib/c_glib/test/testthrifttest.c
    thrift/trunk/lib/c_glib/test/testthrifttestclient.cpp
    thrift/trunk/lib/c_glib/test/testtransportsocket.c
    thrift/trunk/lib/c_glib/thrift_c_glib.pc.in

Modified: thrift/trunk/configure.ac
URL: http://svn.apache.org/viewvc/thrift/trunk/configure.ac?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/configure.ac (original)
+++ thrift/trunk/configure.ac Fri Nov 26 10:17:48 2010
@@ -425,9 +425,6 @@ AC_CONFIG_FILES([
   test/rb/Makefile
 ])
 
-AC_CONFIG_FILES([lib/c_glib/test/test-wrapper.sh],
-                [chmod +x lib/c_glib/test/test-wrapper.sh])
-
 AC_OUTPUT
 
 

Modified: thrift/trunk/lib/c_glib/src/processor/thrift_processor.c
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/processor/thrift_processor.c?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/processor/thrift_processor.c (original)
+++ thrift/trunk/lib/c_glib/src/processor/thrift_processor.c Fri Nov 26 10:17:48 2010
@@ -1,36 +1,32 @@
+/*
+ * 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 "thrift.h"
 #include "processor/thrift_processor.h"
 
-/* forward declarations */
-static void thrift_processor_class_init (ThriftProcessorClass *cls);
+G_DEFINE_ABSTRACT_TYPE(ThriftProcessor, thrift_processor, G_TYPE_OBJECT)
 
-/* define ThriftProcessorClass's type */
-GType
-thrift_processor_get_type (void)
+gboolean
+thrift_processor_process (ThriftProcessor *processor, ThriftProtocol *in,
+                          ThriftProtocol *out)
 {
-  static GType type = 0;
-
-  if (type == 0)
-  {
-    static const GTypeInfo info =
-    {
-      sizeof (ThriftProcessorClass),
-      NULL, /* base_init */
-      NULL, /* base_finalize */
-      (GClassInitFunc) thrift_processor_class_init,
-      NULL, /* class_finalize */
-      NULL, /* class_data */
-      sizeof (ThriftProcessor),
-      0, /* n_preallocs */
-      NULL, /* instance_init */
-      NULL, /* value_table */
-    };
-
-    type = g_type_register_static (G_TYPE_OBJECT, "ThriftProcessor",
-                                   &info, G_TYPE_FLAG_ABSTRACT);
-  }
-
-  return type;
+  return THRIFT_PROCESSOR_GET_CLASS (processor)->process (processor, in, out);
 }
 
 /* class initializer for ThriftProcessor */
@@ -41,10 +37,8 @@ thrift_processor_class_init (ThriftProce
   cls->process = thrift_processor_process;
 }
 
-gboolean 
-thrift_processor_process (ThriftProcessor *processor, ThriftProtocol *in,
-                          ThriftProtocol *out)
+static void
+thrift_processor_init (ThriftProcessor *processor)
 {
-  return THRIFT_PROCESSOR_GET_CLASS (processor)->process (processor, in, out);
+  THRIFT_UNUSED_VAR (processor);
 }
-

Modified: thrift/trunk/lib/c_glib/src/processor/thrift_processor.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/processor/thrift_processor.h?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/processor/thrift_processor.h (original)
+++ thrift/trunk/lib/c_glib/src/processor/thrift_processor.h Fri Nov 26 10:17:48 2010
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 #ifndef _THRIFT_PROCESSOR_H
 #define _THRIFT_PROCESSOR_H
 
@@ -5,24 +24,19 @@
 
 #include "protocol/thrift_protocol.h"
 
+G_BEGIN_DECLS
+
 /*! \file thrift_processor.h
  *  \brief Abstract class for Thrift processors.
  */
 
-/* type macros */	
+/* type macros */
 #define THRIFT_TYPE_PROCESSOR (thrift_processor_get_type ())
-#define THRIFT_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                                   THRIFT_TYPE_PROCESSOR, ThriftProcessor))
-#define THRIFT_IS_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                                      THRIFT_TYPE_PROCESSOR))
-#define THRIFT_PROCESSOR_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), \
-                                       THRIFT_TYPE_PROCESSOR, \
-                                       ThriftProcessorClass))
-#define THRIFT_IS_PROCESSOR_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), \
-                                          THRIFT_TYPE_PROCESSOR))
-#define THRIFT_PROCESSOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-                                             THRIFT_TYPE_PROCESSOR, \
-                                             ThriftProcessorClass))
+#define THRIFT_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_PROCESSOR, ThriftProcessor))
+#define THRIFT_IS_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_PROCESSOR))
+#define THRIFT_PROCESSOR_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_PROCESSOR, ThriftProcessorClass))
+#define THRIFT_IS_PROCESSOR_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_PROCESSOR))
+#define THRIFT_PROCESSOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_PROCESSOR, ThriftProcessorClass))
 
 /*!
  * Thrift Processorobject
@@ -47,7 +61,7 @@ struct _ThriftProcessorClass
 typedef struct _ThriftProcessorClass ThriftProcessorClass;
 
 /* used by THRIFT_TYPE_PROCESSOR */
-GType thrift_processor_get_type (void); 
+GType thrift_processor_get_type (void);
 
 /*!
  * Processes the request.
@@ -56,4 +70,6 @@ GType thrift_processor_get_type (void); 
 gboolean thrift_processor_process (ThriftProcessor *processor,
                                    ThriftProtocol *in, ThriftProtocol *out);
 
+G_END_DECLS
+
 #endif /* _THRIFT_PROCESSOR_H */

Modified: thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol.c
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol.c?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol.c (original)
+++ thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol.c Fri Nov 26 10:17:48 2010
@@ -1,3 +1,22 @@
+/*
+ * 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 <string.h>
 #include <stdio.h>
 
@@ -5,118 +24,7 @@
 #include "protocol/thrift_protocol.h"
 #include "protocol/thrift_binary_protocol.h"
 
-/* forward declarations */
-static guint64 thrift_bitwise_cast_guint64 (gdouble v);
-static gdouble thrift_bitwise_cast_gdouble (guint64 v);
-static void thrift_binary_protocol_class_init (ThriftProtocolClass *cls);
-
-gint32 thrift_binary_protocol_write_message_begin (ThriftProtocol *protocol, 
-           const gchar *name, const ThriftMessageType message_type,
-           const gint32 seqid, GError **error);
-gint32 thrift_binary_protocol_write_message_end (ThriftProtocol *protocol,
-                                                 GError **error);
-gint32 thrift_binary_protocol_write_struct_begin (ThriftProtocol *protocol,
-                                                  const gchar *name,
-                                                  GError **error);
-gint32 thrift_binary_protocol_write_struct_end (ThriftProtocol *protocol,
-                                                GError **error);
-gint32 thrift_binary_protocol_write_field_begin (ThriftProtocol *protocol,
-                                                 const gchar *name,
-                                                 const ThriftType field_type,
-                                                 const gint16 field_id,
-                                                 GError **error);
-gint32 thrift_binary_protocol_write_field_end (ThriftProtocol *protocol,
-                                               GError **error);
-gint32 thrift_binary_protocol_write_field_stop (ThriftProtocol *protocol,
-                                                GError **error);
-gint32 thrift_binary_protocol_write_map_begin (ThriftProtocol *protocol,
-                                               const ThriftType key_type,
-                                               const ThriftType value_type,
-                                               const guint32 size,
-                                               GError **error);
-gint32 thrift_binary_protocol_write_map_end (ThriftProtocol *protocol,
-                                             GError **error);
-gint32 thrift_binary_protocol_write_list_begin (ThriftProtocol *protocol,
-                                                const ThriftType element_type,
-                                                const guint32 size, 
-                                                GError **error);
-gint32 thrift_binary_protocol_write_list_end (ThriftProtocol *protocol,
-                                              GError **error);
-gint32 thrift_binary_protocol_write_set_begin (ThriftProtocol *protocol,
-                                               const ThriftType element_type,
-                                               const guint32 size, 
-                                               GError **error);
-gint32 thrift_binary_protocol_write_set_end (ThriftProtocol *protocol,
-                                             GError **error);
-gint32 thrift_binary_protocol_write_bool (ThriftProtocol *protocol,
-                                          const gboolean value, GError **error);
-gint32 thrift_binary_protocol_write_byte (ThriftProtocol *protocol,
-                                          const gint8 value, GError **error);
-gint32 thrift_binary_protocol_write_i16 (ThriftProtocol *protocol,
-                                         const gint16 value, GError **error);
-gint32 thrift_binary_protocol_write_i32 (ThriftProtocol *protocol,
-                                         const gint32 value, GError **error);
-gint32 thrift_binary_protocol_write_i64 (ThriftProtocol *protocol,
-                                         const gint64 value, GError **error);
-gint32 thrift_binary_protocol_write_double (ThriftProtocol *protocol,
-                                            const gdouble value,
-                                            GError **error);
-gint32 thrift_binary_protocol_write_string (ThriftProtocol *protocol,
-                                            const gchar *str, GError **error);
-gint32 thrift_binary_protocol_write_binary (ThriftProtocol *protocol,
-                                            const gpointer buf,
-                                            const guint32 len, GError **error);
-gint32 thrift_binary_protocol_read_message_begin (
-           ThriftProtocol *protocol, gchar **name,
-           ThriftMessageType *message_type, gint32 *seqid, GError **error);
-gint32 thrift_binary_protocol_read_message_end (ThriftProtocol *protocol,
-                                                GError **error);
-gint32 thrift_binary_protocol_read_struct_begin (ThriftProtocol *protocol,
-                                                 gchar **name,
-                                                 GError **error);
-gint32 thrift_binary_protocol_read_struct_end (ThriftProtocol *protocol,
-                                               GError **error);
-gint32 thrift_binary_protocol_read_field_begin (ThriftProtocol *protocol,
-                                                gchar **name,
-                                                ThriftType *field_type,
-                                                gint16 *field_id,
-                                                GError **error);
-gint32 thrift_binary_protocol_read_field_end (ThriftProtocol *protocol,
-                                              GError **error);
-gint32 thrift_binary_protocol_read_map_begin (ThriftProtocol *protocol,
-                                              ThriftType *key_type,
-                                              ThriftType *value_type,
-                                              guint32 *size,
-                                              GError **error);
-gint32 thrift_binary_protocol_read_map_end (ThriftProtocol *protocol,
-                                            GError **error);
-gint32 thrift_binary_protocol_read_list_begin (ThriftProtocol *protocol,
-                                               ThriftType *element_type,
-                                               guint32 *size, GError **error);
-gint32 thrift_binary_protocol_read_list_end (ThriftProtocol *protocol,
-                                             GError **error);
-gint32 thrift_binary_protocol_read_set_begin (ThriftProtocol *protocol,
-                                              ThriftType *element_type,
-                                              guint32 *size, GError **error);
-gint32 thrift_binary_protocol_read_set_end (ThriftProtocol *protocol,
-                                            GError **error);
-gint32 thrift_binary_protocol_read_bool (ThriftProtocol *protocol,
-                                         gboolean *value, GError **error);
-gint32 thrift_binary_protocol_read_byte (ThriftProtocol *protocol, gint8 *value,
-                                         GError **error);
-gint32 thrift_binary_protocol_read_i16 (ThriftProtocol *protocol, gint16 *value,
-                                        GError **error);
-gint32 thrift_binary_protocol_read_i32 (ThriftProtocol *protocol, gint32 *value,
-                                        GError **error);
-gint32 thrift_binary_protocol_read_i64 (ThriftProtocol *protocol, gint64 *value,
-                                        GError **error);
-gint32 thrift_binary_protocol_read_double (ThriftProtocol *protocol,
-                                           gdouble *value, GError **error);
-gint32 thrift_binary_protocol_read_string (ThriftProtocol *protocol,
-                                           gchar **str, GError **error);
-gint32 thrift_binary_protocol_read_binary (ThriftProtocol *protocol,
-                                           gpointer *buf, guint32 *len,
-                                           GError **error);
+G_DEFINE_TYPE(ThriftBinaryProtocol, thrift_binary_protocol, THRIFT_TYPE_PROTOCOL)
 
 static guint64
 thrift_bitwise_cast_guint64 (gdouble v)
@@ -140,82 +48,6 @@ thrift_bitwise_cast_gdouble (guint64 v)
   return u.to;
 }
 
-GType
-thrift_binary_protocol_get_type (void)
-{
-  static GType type = 0;
-
-  if (type == 0)
-  {
-    static const GTypeInfo info =
-    {
-      sizeof (ThriftBinaryProtocolClass),
-      NULL, /* base_init */
-      NULL, /* base_finalize */
-      (GClassInitFunc) thrift_binary_protocol_class_init,
-      NULL, /* class_finalize */
-      NULL, /* class_data */
-      sizeof (ThriftBinaryProtocol),
-      0, /* n_preallocs */
-      NULL, /* instance_init */
-      NULL, /* value_table */
-    };
-
-    type = g_type_register_static (THRIFT_TYPE_PROTOCOL,
-                                   "ThriftBinaryProtocolType",
-                                   &info, 0);
-  }
-
-  return type;
-}
-
-/* initialize the class */
-static void
-thrift_binary_protocol_class_init (ThriftProtocolClass *cls)
-{
-  cls->write_message_begin = thrift_binary_protocol_write_message_begin;
-  cls->write_message_end = thrift_binary_protocol_write_message_end;
-  cls->write_struct_begin = thrift_binary_protocol_write_struct_begin;
-  cls->write_struct_end = thrift_binary_protocol_write_struct_end;
-  cls->write_field_begin = thrift_binary_protocol_write_field_begin;
-  cls->write_field_end = thrift_binary_protocol_write_field_end;
-  cls->write_field_stop = thrift_binary_protocol_write_field_stop;
-  cls->write_map_begin = thrift_binary_protocol_write_map_begin;
-  cls->write_map_end = thrift_binary_protocol_write_map_end;
-  cls->write_list_begin = thrift_binary_protocol_write_list_begin;
-  cls->write_list_end = thrift_binary_protocol_write_list_end;
-  cls->write_set_begin = thrift_binary_protocol_write_set_begin;
-  cls->write_set_end = thrift_binary_protocol_write_set_end;
-  cls->write_bool = thrift_binary_protocol_write_bool;
-  cls->write_byte = thrift_binary_protocol_write_byte;
-  cls->write_i16 = thrift_binary_protocol_write_i16;
-  cls->write_i32 = thrift_binary_protocol_write_i32;
-  cls->write_i64 = thrift_binary_protocol_write_i64;
-  cls->write_double = thrift_binary_protocol_write_double;
-  cls->write_string = thrift_binary_protocol_write_string;
-  cls->write_binary = thrift_binary_protocol_write_binary;
-  cls->read_message_begin = thrift_binary_protocol_read_message_begin;
-  cls->read_message_end = thrift_binary_protocol_read_message_end;
-  cls->read_struct_begin = thrift_binary_protocol_read_struct_begin;
-  cls->read_struct_end = thrift_binary_protocol_read_struct_end;
-  cls->read_field_begin = thrift_binary_protocol_read_field_begin;
-  cls->read_field_end = thrift_binary_protocol_read_field_end;
-  cls->read_map_begin = thrift_binary_protocol_read_map_begin;
-  cls->read_map_end = thrift_binary_protocol_read_map_end;
-  cls->read_list_begin = thrift_binary_protocol_read_list_begin;
-  cls->read_list_end = thrift_binary_protocol_read_list_end;
-  cls->read_set_begin = thrift_binary_protocol_read_set_begin;
-  cls->read_set_end = thrift_binary_protocol_read_set_end;
-  cls->read_bool = thrift_binary_protocol_read_bool;
-  cls->read_byte = thrift_binary_protocol_read_byte;
-  cls->read_i16 = thrift_binary_protocol_read_i16;
-  cls->read_i32 = thrift_binary_protocol_read_i32;
-  cls->read_i64 = thrift_binary_protocol_read_i64;
-  cls->read_double = thrift_binary_protocol_read_double;
-  cls->read_string = thrift_binary_protocol_read_string;
-  cls->read_binary = thrift_binary_protocol_read_binary;
-}
-
 gint32
 thrift_binary_protocol_write_message_begin (ThriftProtocol *protocol,
     const gchar *name, const ThriftMessageType message_type,
@@ -980,4 +812,57 @@ thrift_binary_protocol_read_binary (Thri
   return xfer;
 }
 
+static void
+thrift_binary_protocol_init (ThriftBinaryProtocol *protocol)
+{
+  THRIFT_UNUSED_VAR (protocol);
+}
 
+/* initialize the class */
+static void
+thrift_binary_protocol_class_init (ThriftBinaryProtocolClass *klass)
+{
+  ThriftProtocolClass *cls = THRIFT_PROTOCOL_CLASS (klass);
+
+  cls->write_message_begin = thrift_binary_protocol_write_message_begin;
+  cls->write_message_end = thrift_binary_protocol_write_message_end;
+  cls->write_struct_begin = thrift_binary_protocol_write_struct_begin;
+  cls->write_struct_end = thrift_binary_protocol_write_struct_end;
+  cls->write_field_begin = thrift_binary_protocol_write_field_begin;
+  cls->write_field_end = thrift_binary_protocol_write_field_end;
+  cls->write_field_stop = thrift_binary_protocol_write_field_stop;
+  cls->write_map_begin = thrift_binary_protocol_write_map_begin;
+  cls->write_map_end = thrift_binary_protocol_write_map_end;
+  cls->write_list_begin = thrift_binary_protocol_write_list_begin;
+  cls->write_list_end = thrift_binary_protocol_write_list_end;
+  cls->write_set_begin = thrift_binary_protocol_write_set_begin;
+  cls->write_set_end = thrift_binary_protocol_write_set_end;
+  cls->write_bool = thrift_binary_protocol_write_bool;
+  cls->write_byte = thrift_binary_protocol_write_byte;
+  cls->write_i16 = thrift_binary_protocol_write_i16;
+  cls->write_i32 = thrift_binary_protocol_write_i32;
+  cls->write_i64 = thrift_binary_protocol_write_i64;
+  cls->write_double = thrift_binary_protocol_write_double;
+  cls->write_string = thrift_binary_protocol_write_string;
+  cls->write_binary = thrift_binary_protocol_write_binary;
+  cls->read_message_begin = thrift_binary_protocol_read_message_begin;
+  cls->read_message_end = thrift_binary_protocol_read_message_end;
+  cls->read_struct_begin = thrift_binary_protocol_read_struct_begin;
+  cls->read_struct_end = thrift_binary_protocol_read_struct_end;
+  cls->read_field_begin = thrift_binary_protocol_read_field_begin;
+  cls->read_field_end = thrift_binary_protocol_read_field_end;
+  cls->read_map_begin = thrift_binary_protocol_read_map_begin;
+  cls->read_map_end = thrift_binary_protocol_read_map_end;
+  cls->read_list_begin = thrift_binary_protocol_read_list_begin;
+  cls->read_list_end = thrift_binary_protocol_read_list_end;
+  cls->read_set_begin = thrift_binary_protocol_read_set_begin;
+  cls->read_set_end = thrift_binary_protocol_read_set_end;
+  cls->read_bool = thrift_binary_protocol_read_bool;
+  cls->read_byte = thrift_binary_protocol_read_byte;
+  cls->read_i16 = thrift_binary_protocol_read_i16;
+  cls->read_i32 = thrift_binary_protocol_read_i32;
+  cls->read_i64 = thrift_binary_protocol_read_i64;
+  cls->read_double = thrift_binary_protocol_read_double;
+  cls->read_string = thrift_binary_protocol_read_string;
+  cls->read_binary = thrift_binary_protocol_read_binary;
+}

Modified: thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol.h?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol.h (original)
+++ thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol.h Fri Nov 26 10:17:48 2010
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 #ifndef _THRIFT_BINARY_PROTOCOL_H
 #define _THRIFT_BINARY_PROTOCOL_H
 
@@ -6,6 +25,8 @@
 #include "protocol/thrift_protocol.h"
 #include "transport/thrift_transport.h"
 
+G_BEGIN_DECLS
+
 /*! \file thrift_binary_protocol.h
  *  \brief Binary protocol implementation of a Thrift protocol.  Implements the
  *         ThriftProtocol interface.
@@ -13,19 +34,11 @@
 
 /* type macros */
 #define THRIFT_TYPE_BINARY_PROTOCOL (thrift_binary_protocol_get_type ())
-#define THRIFT_BINARY_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                                         THRIFT_TYPE_BINARY_PROTOCOL, \
-                                         ThriftBinaryProtocol))
-#define THRIFT_IS_BINARY_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                                            THRIFT_TYPE_BINARY_PROTOCOL))
-#define THRIFT_BINARY_PROTOCOL_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), \
-                                             THRIFT_TYPE_BINARY_PROTOCOL, \
-                                             ThriftBinaryProtocolClass))
-#define THRIFT_IS_BINARY_PROTOCOL_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), \
-                                                THRIFT_TYPE_BINARY_PROTOCOL))
-#define THRIFT_BINARY_PROTOCOL_GET_CLASS(obj) \
-            (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_BINARY_PROTOCOL, \
-                                        ThriftBinaryProtocolClass))
+#define THRIFT_BINARY_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_BINARY_PROTOCOL, ThriftBinaryProtocol))
+#define THRIFT_IS_BINARY_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_BINARY_PROTOCOL))
+#define THRIFT_BINARY_PROTOCOL_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_BINARY_PROTOCOL, ThriftBinaryProtocolClass))
+#define THRIFT_IS_BINARY_PROTOCOL_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_BINARY_PROTOCOL))
+#define THRIFT_BINARY_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_BINARY_PROTOCOL, ThriftBinaryProtocolClass))
 
 /* version numbers */
 #define THRIFT_BINARY_PROTOCOL_VERSION_1 0x80010000
@@ -52,4 +65,6 @@ typedef struct _ThriftBinaryProtocolClas
 /* used by THRIFT_TYPE_BINARY_PROTOCOL */
 GType thrift_binary_protocol_get_type (void);
 
+G_END_DECLS
+
 #endif /* _THRIFT_BINARY_PROTOCOL_H */

Modified: thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol_factory.c
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol_factory.c?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol_factory.c (original)
+++ thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol_factory.c Fri Nov 26 10:17:48 2010
@@ -1,47 +1,27 @@
+/*
+ * 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 "thrift.h"
 #include "protocol/thrift_binary_protocol.h"
 #include "protocol/thrift_binary_protocol_factory.h"
 
-/* forward declarations */
-static void thrift_binary_protocol_factory_class_init (ThriftProtocolFactoryClass *cls);
-
-ThriftProtocol *thrift_binary_protocol_factory_get_protocol (ThriftProtocolFactory *factory, ThriftTransport *transport);
-
-GType
-thrift_binary_protocol_factory_get_type (void)
-{
-  static GType type = 0;
-
-  if (type == 0)
-  {
-    static const GTypeInfo info =
-    {
-      sizeof (ThriftBinaryProtocolFactoryClass),
-      NULL, /* base_init */
-      NULL, /* base_finalize */
-      (GClassInitFunc) thrift_binary_protocol_factory_class_init,
-      NULL, /* class_finalize */
-      NULL, /* class_data */
-      sizeof (ThriftBinaryProtocolFactory),
-      0, /* n_preallocs */
-      NULL, /* instance_init */
-      NULL, /* value_table */
-    };
-
-    type = g_type_register_static (THRIFT_TYPE_PROTOCOL_FACTORY,
-                                   "ThriftBinaryProtocolFactoryType",
-                                   &info, 0);
-  }
-
-  return type;
-}
-
-static void
-thrift_binary_protocol_factory_class_init (ThriftProtocolFactoryClass *cls)
-{
-  cls->get_protocol = thrift_binary_protocol_factory_get_protocol;
-}
+G_DEFINE_TYPE(ThriftBinaryProtocolFactory, thrift_binary_protocol_factory, THRIFT_TYPE_PROTOCOL_FACTORY)
 
 ThriftProtocol *
 thrift_binary_protocol_factory_get_protocol (ThriftProtocolFactory *factory,
@@ -55,4 +35,16 @@ thrift_binary_protocol_factory_get_proto
   return THRIFT_PROTOCOL (tb);
 }
 
+static void
+thrift_binary_protocol_factory_class_init (ThriftBinaryProtocolFactoryClass *cls)
+{
+  ThriftProtocolFactoryClass *protocol_factory_class = THRIFT_PROTOCOL_FACTORY_CLASS (cls);
+
+  protocol_factory_class->get_protocol = thrift_binary_protocol_factory_get_protocol;
+}
 
+static void
+thrift_binary_protocol_factory_init (ThriftBinaryProtocolFactory *factory)
+{
+  THRIFT_UNUSED_VAR (factory);
+}

Modified: thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol_factory.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol_factory.h?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol_factory.h (original)
+++ thrift/trunk/lib/c_glib/src/protocol/thrift_binary_protocol_factory.h Fri Nov 26 10:17:48 2010
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 #ifndef _THRIFT_BINARY_PROTOCOL_FACTORY_H
 #define _THRIFT_BINARY_PROTOCOL_FACTORY_H
 
@@ -5,27 +24,15 @@
 
 #include "protocol/thrift_protocol_factory.h"
 
+G_BEGIN_DECLS
+
 /* type macros */
-#define THRIFT_TYPE_BINARY_PROTOCOL_FACTORY \
-            (thrift_binary_protocol_factory_get_type ())
-#define THRIFT_BINARY_PROTOCOL_FACTORY(obj) \
-            (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                                         THRIFT_TYPE_BINARY_PROTOCOL_FACTORY, \
-                                         ThriftBinaryProtocolFactory))
-#define THRIFT_IS_BINARY_PROTOCOL_FACTORY(obj) \
-            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                                         THRIFT_TYPE_BINARY_PROTOCOL_FACTORY))
-#define THRIFT_BINARY_PROTOCOL_FACTORY_CLASS(c) \
-            (G_TYPE_CHECK_CLASS_CAST ((c), \
-                                      THRIFT_TYPE_BINARY_PROTOCOL_FACTORY, \
-                                      ThriftBinaryProtocolFactoryClass))
-#define THRIFT_IS_BINARY_PROTOCOL_FACTORY_CLASS(c) \
-            (G_TYPE_CHECK_CLASS_TYPE ((c), \
-                                      THRIFT_TYPE_BINARY_PROTOCOL_FACTORY))
-#define THRIFT_BINARY_PROTOCOL_FACTORY_GET_CLASS(obj) \
-            (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-                                        THRIFT_TYPE_BINARY_PROTOCOL_FACTORY, \
-                                        ThriftBinaryProtocolFactoryClass))
+#define THRIFT_TYPE_BINARY_PROTOCOL_FACTORY (thrift_binary_protocol_factory_get_type ())
+#define THRIFT_BINARY_PROTOCOL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_BINARY_PROTOCOL_FACTORY, ThriftBinaryProtocolFactory))
+#define THRIFT_IS_BINARY_PROTOCOL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_BINARY_PROTOCOL_FACTORY))
+#define THRIFT_BINARY_PROTOCOL_FACTORY_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_BINARY_PROTOCOL_FACTORY, ThriftBinaryProtocolFactoryClass))
+#define THRIFT_IS_BINARY_PROTOCOL_FACTORY_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_BINARY_PROTOCOL_FACTORY))
+#define THRIFT_BINARY_PROTOCOL_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_BINARY_PROTOCOL_FACTORY, ThriftBinaryProtocolFactoryClass))
 
 struct _ThriftBinaryProtocolFactory
 {
@@ -37,10 +44,11 @@ struct _ThriftBinaryProtocolFactoryClass
 {
   ThriftProtocolFactoryClass parent;
 };
-typedef struct _ThriftBinaryProtocolFactoryClass 
-               ThriftBinaryProtocolFactoryClass;
+typedef struct _ThriftBinaryProtocolFactoryClass ThriftBinaryProtocolFactoryClass;
 
 /* used by THRIFT_TYPE_BINARY_PROTOCOL_FACTORY */
 GType thrift_binary_protocol_factory_get_type (void);
 
+G_END_DECLS
+
 #endif /* _THRIFT_BINARY_PROTOCOL_FACTORY_H */

Modified: thrift/trunk/lib/c_glib/src/protocol/thrift_protocol.c
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/protocol/thrift_protocol.c?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/protocol/thrift_protocol.c (original)
+++ thrift/trunk/lib/c_glib/src/protocol/thrift_protocol.c Fri Nov 26 10:17:48 2010
@@ -1,3 +1,22 @@
+/*
+ * 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 "thrift.h"
 #include "protocol/thrift_protocol.h"
 #include "transport/thrift_transport.h"
@@ -12,103 +31,7 @@ enum _ThriftProtocolProperties
   PROP_THRIFT_PROTOCOL_TRANSPORT
 };
 
-/* forward declarations */
-static void thrift_protocol_instance_init (ThriftProtocol *protocol);
-static void thrift_protocol_class_init (ThriftProtocolClass *cls);
-void thrift_protocol_get_property (GObject *object, guint property_id,
-                                   GValue *value, GParamSpec *pspec);
-void thrift_protocol_set_property (GObject *object, guint property_id,
-                                   const GValue *value, GParamSpec *pspec);
-
-/* define ThriftProtocolInterface's type */
-GType
-thrift_protocol_get_type (void)
-{
-  static GType type = 0;
-
-  if (type == 0)
-  {
-    static const GTypeInfo info = {
-      sizeof (ThriftProtocolClass),
-      NULL, /* base_init */
-      NULL, /* base_finalize */
-      (GClassInitFunc) thrift_protocol_class_init,
-      NULL, /* class_finalize */
-      NULL, /* class_data */
-      sizeof (ThriftProtocol),
-      0, /* n_preallocs */
-      (GInstanceInitFunc) thrift_protocol_instance_init,
-      NULL, /* value_table */
-    };
-
-    type = g_type_register_static (G_TYPE_OBJECT, "ThriftProtocol",
-                                   &info, G_TYPE_FLAG_ABSTRACT);
-  }
-
-  return type;
-}
-
-static void
-thrift_protocol_instance_init (ThriftProtocol *protocol)
-{
-  protocol->transport = NULL;
-}
-
-static void
-thrift_protocol_class_init (ThriftProtocolClass *cls)
-{
-  GObjectClass *gobject_class = G_OBJECT_CLASS (cls);
-
-  gobject_class->get_property = thrift_protocol_get_property;
-  gobject_class->set_property = thrift_protocol_set_property;
-
-  g_object_class_install_property (gobject_class,
-      PROP_THRIFT_PROTOCOL_TRANSPORT,
-      g_param_spec_object ("transport", "Transport", "Thrift Transport",
-                           THRIFT_TYPE_TRANSPORT,
-                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
-  cls->write_message_begin = thrift_protocol_write_message_begin;
-  cls->write_message_end = thrift_protocol_write_message_end;
-  cls->write_struct_begin = thrift_protocol_write_struct_begin;
-  cls->write_struct_end = thrift_protocol_write_struct_end;
-  cls->write_field_begin = thrift_protocol_write_field_begin;
-  cls->write_field_end = thrift_protocol_write_field_end;
-  cls->write_field_stop = thrift_protocol_write_field_stop;
-  cls->write_map_begin = thrift_protocol_write_map_begin;
-  cls->write_map_end = thrift_protocol_write_map_end;
-  cls->write_list_begin = thrift_protocol_write_list_begin;
-  cls->write_list_end = thrift_protocol_write_list_end;
-  cls->write_set_begin = thrift_protocol_write_set_begin;
-  cls->write_set_end = thrift_protocol_write_set_end;
-  cls->write_bool = thrift_protocol_write_bool;
-  cls->write_byte = thrift_protocol_write_byte;
-  cls->write_i16 = thrift_protocol_write_i16;
-  cls->write_i32 = thrift_protocol_write_i32;
-  cls->write_i64 = thrift_protocol_write_i64;
-  cls->write_double = thrift_protocol_write_double;
-  cls->write_string = thrift_protocol_write_string;
-  cls->write_binary = thrift_protocol_write_binary;
-  cls->read_message_begin = thrift_protocol_read_message_begin;
-  cls->read_message_end = thrift_protocol_read_message_end;
-  cls->read_struct_begin = thrift_protocol_read_struct_begin;
-  cls->read_struct_end = thrift_protocol_read_struct_end;
-  cls->read_field_begin = thrift_protocol_read_field_begin;
-  cls->read_field_end = thrift_protocol_read_field_end;
-  cls->read_map_begin = thrift_protocol_read_map_begin;
-  cls->read_map_end = thrift_protocol_read_map_end;
-  cls->read_list_begin = thrift_protocol_read_list_begin;
-  cls->read_set_begin = thrift_protocol_read_set_begin;
-  cls->read_set_end = thrift_protocol_read_set_end;
-  cls->read_bool = thrift_protocol_read_bool;
-  cls->read_byte = thrift_protocol_read_byte;
-  cls->read_i16 = thrift_protocol_read_i16;
-  cls->read_i32 = thrift_protocol_read_i32;
-  cls->read_i64 = thrift_protocol_read_i64;
-  cls->read_double = thrift_protocol_read_double;
-  cls->read_string = thrift_protocol_read_string;
-  cls->read_binary = thrift_protocol_read_binary;
-}
+G_DEFINE_ABSTRACT_TYPE(ThriftProtocol, thrift_protocol, G_TYPE_OBJECT)
 
 void
 thrift_protocol_get_property (GObject *object, guint property_id,
@@ -602,3 +525,65 @@ thrift_protocol_error_quark (void)
   return g_quark_from_static_string (THRIFT_PROTOCOL_ERROR_DOMAIN);
 }
 
+
+static void
+thrift_protocol_init (ThriftProtocol *protocol)
+{
+  protocol->transport = NULL;
+}
+
+static void
+thrift_protocol_class_init (ThriftProtocolClass *cls)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (cls);
+
+  gobject_class->get_property = thrift_protocol_get_property;
+  gobject_class->set_property = thrift_protocol_set_property;
+
+  g_object_class_install_property (gobject_class,
+      PROP_THRIFT_PROTOCOL_TRANSPORT,
+      g_param_spec_object ("transport", "Transport", "Thrift Transport",
+                           THRIFT_TYPE_TRANSPORT,
+                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+  cls->write_message_begin = thrift_protocol_write_message_begin;
+  cls->write_message_end = thrift_protocol_write_message_end;
+  cls->write_struct_begin = thrift_protocol_write_struct_begin;
+  cls->write_struct_end = thrift_protocol_write_struct_end;
+  cls->write_field_begin = thrift_protocol_write_field_begin;
+  cls->write_field_end = thrift_protocol_write_field_end;
+  cls->write_field_stop = thrift_protocol_write_field_stop;
+  cls->write_map_begin = thrift_protocol_write_map_begin;
+  cls->write_map_end = thrift_protocol_write_map_end;
+  cls->write_list_begin = thrift_protocol_write_list_begin;
+  cls->write_list_end = thrift_protocol_write_list_end;
+  cls->write_set_begin = thrift_protocol_write_set_begin;
+  cls->write_set_end = thrift_protocol_write_set_end;
+  cls->write_bool = thrift_protocol_write_bool;
+  cls->write_byte = thrift_protocol_write_byte;
+  cls->write_i16 = thrift_protocol_write_i16;
+  cls->write_i32 = thrift_protocol_write_i32;
+  cls->write_i64 = thrift_protocol_write_i64;
+  cls->write_double = thrift_protocol_write_double;
+  cls->write_string = thrift_protocol_write_string;
+  cls->write_binary = thrift_protocol_write_binary;
+  cls->read_message_begin = thrift_protocol_read_message_begin;
+  cls->read_message_end = thrift_protocol_read_message_end;
+  cls->read_struct_begin = thrift_protocol_read_struct_begin;
+  cls->read_struct_end = thrift_protocol_read_struct_end;
+  cls->read_field_begin = thrift_protocol_read_field_begin;
+  cls->read_field_end = thrift_protocol_read_field_end;
+  cls->read_map_begin = thrift_protocol_read_map_begin;
+  cls->read_map_end = thrift_protocol_read_map_end;
+  cls->read_list_begin = thrift_protocol_read_list_begin;
+  cls->read_set_begin = thrift_protocol_read_set_begin;
+  cls->read_set_end = thrift_protocol_read_set_end;
+  cls->read_bool = thrift_protocol_read_bool;
+  cls->read_byte = thrift_protocol_read_byte;
+  cls->read_i16 = thrift_protocol_read_i16;
+  cls->read_i32 = thrift_protocol_read_i32;
+  cls->read_i64 = thrift_protocol_read_i64;
+  cls->read_double = thrift_protocol_read_double;
+  cls->read_string = thrift_protocol_read_string;
+  cls->read_binary = thrift_protocol_read_binary;
+}

Modified: thrift/trunk/lib/c_glib/src/protocol/thrift_protocol.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/protocol/thrift_protocol.h?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/protocol/thrift_protocol.h (original)
+++ thrift/trunk/lib/c_glib/src/protocol/thrift_protocol.h Fri Nov 26 10:17:48 2010
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 #ifndef _THRIFT_PROTOCOL_H
 #define _THRIFT_PROTOCOL_H
 
@@ -5,12 +24,18 @@
 
 #include "transport/thrift_transport.h"
 
+G_BEGIN_DECLS
+
+/*! \file thrift_protocol.h
+ *  \brief Abstract class for Thrift protocol implementations.
+ */
+
 /**
  * Enumerated definition of the types that the Thrift protocol supports.
  * Take special note of the T_END type which is used specifically to mark
  * the end of a sequence of fields.
  */
-enum _ThriftType {
+typedef enum {
   T_STOP   = 0,
   T_VOID   = 1,
   T_BOOL   = 2,
@@ -29,39 +54,26 @@ enum _ThriftType {
   T_LIST   = 15,
   T_UTF8   = 16,
   T_UTF16  = 17
-};
-typedef enum _ThriftType ThriftType;
+} ThriftType;
 
 /**
  * Enumerated definition of the message types that the Thrift protocol
  * supports.
  */
-enum _ThriftMessageType {
+typedef enum {
   T_CALL      = 1,
   T_REPLY     = 2,
   T_EXCEPTION = 3,
   T_ONEWAY    = 4
-};
-typedef enum _ThriftMessageType ThriftMessageType;
-
-/*! \file thrift_protocol.h
- *  \brief Abstract class for Thrift protocol implementations.
- */
+} ThriftMessageType;
 
 /* type macros */
 #define THRIFT_TYPE_PROTOCOL (thrift_protocol_get_type ())
-#define THRIFT_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                                  THRIFT_TYPE_PROTOCOL, ThriftProtocol))
-#define THRIFT_IS_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                                     THRIFT_TYPE_PROTOCOL))
-#define THRIFT_PROTOCOL_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), \
-                                      THRIFT_TYPE_PROTOCOL, \
-                                      ThriftProtocolClass))
-#define THRIFT_IS_PROTOCOL_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), \
-                                         THRIFT_TYPE_PROTOCOL))
-#define THRIFT_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-                                            THRIFT_TYPE_PROTOCOL, \
-                                            ThriftProtocolClass))
+#define THRIFT_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_PROTOCOL, ThriftProtocol))
+#define THRIFT_IS_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_PROTOCOL))
+#define THRIFT_PROTOCOL_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_PROTOCOL, ThriftProtocolClass))
+#define THRIFT_IS_PROTOCOL_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_PROTOCOL))
+#define THRIFT_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_PROTOCOL, ThriftProtocolClass))
 
 /*!
  * Thrift Protocol object
@@ -141,11 +153,11 @@ struct _ThriftProtocolClass
   gint32 (*read_map_end) (ThriftProtocol *protocol, GError **error);
   gint32 (*read_list_begin) (ThriftProtocol *protocol, ThriftType *element_type,
                              guint32 *size, GError **error);
-  gint32 (*read_list_end) (ThriftProtocol *protocol, GError **error); 
+  gint32 (*read_list_end) (ThriftProtocol *protocol, GError **error);
   gint32 (*read_set_begin) (ThriftProtocol *protocol, ThriftType *element_type,
-                            guint32 *size, GError **error); 
+                            guint32 *size, GError **error);
   gint32 (*read_set_end) (ThriftProtocol *protocol, GError **error);
-  gint32 (*read_bool) (ThriftProtocol *protocol, gboolean *value, 
+  gint32 (*read_bool) (ThriftProtocol *protocol, gboolean *value,
                        GError **error);
   gint32 (*read_byte) (ThriftProtocol *protocol, gint8 *value, GError **error);
   gint32 (*read_i16) (ThriftProtocol *protocol, gint16 *value, GError **error);
@@ -163,7 +175,7 @@ typedef struct _ThriftProtocolClass Thri
 GType thrift_protocol_get_type (void);
 
 /* virtual public methods */
-gint32 thrift_protocol_write_message_begin (ThriftProtocol *protocol, 
+gint32 thrift_protocol_write_message_begin (ThriftProtocol *protocol,
            const gchar *name, const ThriftMessageType message_type,
            const gint32 seqid, GError **error);
 
@@ -231,11 +243,11 @@ gint32 thrift_protocol_write_double (Thr
 gint32 thrift_protocol_write_string (ThriftProtocol *protocol,
                                      const gchar *str, GError **error);
 
-gint32 thrift_protocol_write_binary (ThriftProtocol *protocol, 
+gint32 thrift_protocol_write_binary (ThriftProtocol *protocol,
                                      const gpointer buf,
                                      const guint32 len, GError **error);
 
-gint32 thrift_protocol_read_message_begin (ThriftProtocol *thrift_protocol, 
+gint32 thrift_protocol_read_message_begin (ThriftProtocol *thrift_protocol,
                                            gchar **name,
                                            ThriftMessageType *message_type,
                                            gint32 *seqid, GError **error);
@@ -321,4 +333,6 @@ typedef enum
 GQuark thrift_protocol_error_quark (void);
 #define THRIFT_PROTOCOL_ERROR (thrift_protocol_error_quark ())
 
+G_END_DECLS
+
 #endif /* _THRIFT_PROTOCOL_H */

Modified: thrift/trunk/lib/c_glib/src/protocol/thrift_protocol_factory.c
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/protocol/thrift_protocol_factory.c?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/protocol/thrift_protocol_factory.c (original)
+++ thrift/trunk/lib/c_glib/src/protocol/thrift_protocol_factory.c Fri Nov 26 10:17:48 2010
@@ -1,50 +1,43 @@
+/*
+ * 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 "thrift.h"
 #include "protocol/thrift_protocol_factory.h"
 
-/* forward declarations */
-static void thrift_protocol_factory_class_init (ThriftProtocolFactoryClass *cls);
-ThriftProtocol *thrift_protocol_factory_get_protocol(ThriftProtocolFactory *factory, ThriftTransport *transport);
-
+G_DEFINE_ABSTRACT_TYPE(ThriftProtocolFactory, thrift_protocol_factory, G_TYPE_OBJECT)
 
-/* define ThriftProtocolFactoryInterface's type */
-GType
-thrift_protocol_factory_get_type (void)
+ThriftProtocol *
+thrift_protocol_factory_get_protocol(ThriftProtocolFactory *factory,
+                                     ThriftTransport *transport)
 {
-  static GType type = 0;
-
-  if (type == 0)
-  {
-    static const GTypeInfo info = {
-      sizeof (ThriftProtocolFactoryClass),
-      NULL, /* base_init */
-      NULL, /* base_finalize */
-      (GClassInitFunc) thrift_protocol_factory_class_init,
-      NULL, /* class_finalize */
-      NULL, /* class_data */
-      sizeof (ThriftProtocolFactory),
-      0, /* n_preallocs */
-      NULL, /* instance_init */
-      NULL, /* value_table */
-    };
-
-    type = g_type_register_static (G_TYPE_OBJECT, "ThriftProtocolFactory",
-                                   &info, G_TYPE_FLAG_ABSTRACT);
-  }
-
-  return type;
+  return THRIFT_PROTOCOL_FACTORY_GET_CLASS (factory)->get_protocol (factory,
+                                                                    transport);
 }
 
 static void
-thrift_protocol_factory_class_init (ThriftProtocolFactoryClass *cls)
+thrift_protocol_factory_init (ThriftProtocolFactory *factory)
 {
-  cls->get_protocol = thrift_protocol_factory_get_protocol;
+  THRIFT_UNUSED_VAR (factory);
 }
 
-ThriftProtocol *
-thrift_protocol_factory_get_protocol(ThriftProtocolFactory *factory,
-                                     ThriftTransport *transport)
+static void
+thrift_protocol_factory_class_init (ThriftProtocolFactoryClass *cls)
 {
-  return THRIFT_PROTOCOL_FACTORY_GET_CLASS (factory)->get_protocol (factory,
-                                                                    transport);
+  cls->get_protocol = thrift_protocol_factory_get_protocol;
 }
-

Modified: thrift/trunk/lib/c_glib/src/protocol/thrift_protocol_factory.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/protocol/thrift_protocol_factory.h?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/protocol/thrift_protocol_factory.h (original)
+++ thrift/trunk/lib/c_glib/src/protocol/thrift_protocol_factory.h Fri Nov 26 10:17:48 2010
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 #ifndef _THRIFT_PROTOCOL_FACTORY_H
 #define _THRIFT_PROTOCOL_FACTORY_H
 
@@ -6,26 +25,19 @@
 #include "transport/thrift_transport.h"
 #include "protocol/thrift_protocol.h"
 
+G_BEGIN_DECLS
+
 /*! \file thrift_protocol_factory.h
  *  \brief Abstract class for Thrift protocol factory implementations.
  */
 
 /* type macros */
 #define THRIFT_TYPE_PROTOCOL_FACTORY (thrift_protocol_factory_get_type ())
-#define THRIFT_PROTOCOL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                                          THRIFT_TYPE_PROTOCOL_FACTORY, \
-                                          ThriftProtocolFactory))
-#define THRIFT_IS_PROTOCOL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                                             THRIFT_TYPE_PROTOCOL_FACTORY))
-#define THRIFT_PROTOCOL_FACTORY_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), \
-                                              THRIFT_TYPE_PROTOCOL_FACTORY, \
-                                              ThriftProtocolFactoryClass))
-#define THRIFT_IS_PROTOCOL_FACTORY_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), \
-                                                 THRIFT_TYPE_PROTOCOL_FACTORY))
-#define THRIFT_PROTOCOL_FACTORY_GET_CLASS(obj) \
-            (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-                                        THRIFT_TYPE_PROTOCOL_FACTORY, \
-                                        ThriftProtocolFactoryClass))
+#define THRIFT_PROTOCOL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_PROTOCOL_FACTORY, ThriftProtocolFactory))
+#define THRIFT_IS_PROTOCOL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_PROTOCOL_FACTORY))
+#define THRIFT_PROTOCOL_FACTORY_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_PROTOCOL_FACTORY, ThriftProtocolFactoryClass))
+#define THRIFT_IS_PROTOCOL_FACTORY_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_PROTOCOL_FACTORY))
+#define THRIFT_PROTOCOL_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_PROTOCOL_FACTORY, ThriftProtocolFactoryClass))
 
 /*!
  * Thrift Protocol Factory object
@@ -54,4 +66,6 @@ GType thrift_protocol_factory_get_type (
 /* virtual public methods */
 ThriftProtocol *thrift_protocol_factory_get_protocol(ThriftProtocolFactory *factory, ThriftTransport *transport);
 
+G_END_DECLS
+
 #endif /* _THRIFT_PROTOCOL_FACTORY_H */

Modified: thrift/trunk/lib/c_glib/src/server/thrift_server.c
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/server/thrift_server.c?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/server/thrift_server.c (original)
+++ thrift/trunk/lib/c_glib/src/server/thrift_server.c Fri Nov 26 10:17:48 2010
@@ -1,3 +1,22 @@
+/*
+ * 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 "thrift.h"
 #include "thrift_server.h"
 
@@ -13,108 +32,7 @@ enum _ThriftServerProperties
   PROP_THRIFT_SERVER_OUTPUT_PROTOCOL_FACTORY
 };
 
-/* forward declarations */
-static void thrift_server_instance_init (ThriftServer *server);
-static void thrift_server_class_init (ThriftServerClass *cls);
-void thrift_server_get_property (GObject *object, guint property_id,
-                                 GValue *value, GParamSpec *pspec);
-void thrift_server_set_property (GObject *object, guint property_id,
-                                 const GValue *value, GParamSpec *pspec);
-
-
-/* define ThriftServerClass's type */
-GType
-thrift_server_get_type (void)
-{
-  static GType type = 0;
-
-  if (type == 0)
-  {
-    static const GTypeInfo info =
-    {
-      sizeof (ThriftServerClass),
-      NULL, /* base_init */
-      NULL, /* base_finalize */
-      (GClassInitFunc) thrift_server_class_init,
-      NULL, /* class_finalize */
-      NULL, /* class_data */
-      sizeof (ThriftServer),
-      0, /* n_preallocs */
-      (GInstanceInitFunc) thrift_server_instance_init,
-      NULL, /* value_table */
-    };
-
-    type = g_type_register_static (G_TYPE_OBJECT, "ThriftServer",
-                                   &info, G_TYPE_FLAG_ABSTRACT);
-  }
-
-  return type;
-}
-
-/* instance initializer for Thrift Server */
-static void
-thrift_server_instance_init (ThriftServer *server)
-{
-  server->processor = NULL;
-  server->server_transport = NULL;
-  server->input_transport_factory = NULL;
-  server->output_transport_factory = NULL;
-  server->input_protocol_factory = NULL;
-  server->output_protocol_factory = NULL;
-}
-
-/* class initializer for ThriftServer
- * TODO: implement ServerEventHandler as a GClosure
- */
-static void
-thrift_server_class_init (ThriftServerClass *cls)
-{
-  GObjectClass *gobject_class = G_OBJECT_CLASS (cls);
-
-  gobject_class->get_property = thrift_server_get_property;
-  gobject_class->set_property = thrift_server_set_property;
-
-  g_object_class_install_property (gobject_class,
-      PROP_THRIFT_SERVER_PROCESSOR,
-      g_param_spec_object ("processor", "Processor", "Thrift Processor",
-                           THRIFT_TYPE_PROCESSOR,
-                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-  g_object_class_install_property (gobject_class,
-      PROP_THRIFT_SERVER_SERVER_TRANSPORT,
-      g_param_spec_object ("server_transport", "Server Transport",
-                           "Thrift Server Transport",
-                           THRIFT_TYPE_SERVER_TRANSPORT,
-                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-  g_object_class_install_property (gobject_class,
-      PROP_THRIFT_SERVER_INPUT_TRANSPORT_FACTORY,
-      g_param_spec_object ("input_transport_factory", "Input Transport Factory",
-                           "Thrift Server Input Transport Factory",
-                           THRIFT_TYPE_TRANSPORT_FACTORY,
-                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-  g_object_class_install_property (gobject_class,
-      PROP_THRIFT_SERVER_OUTPUT_TRANSPORT_FACTORY,
-      g_param_spec_object ("output_transport_factory",
-                           "Output Transport Factory",
-                           "Thrift Server Output Transport Factory",
-                           THRIFT_TYPE_TRANSPORT_FACTORY,
-                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-  g_object_class_install_property (gobject_class,
-      PROP_THRIFT_SERVER_INPUT_PROTOCOL_FACTORY,
-      g_param_spec_object ("input_protocol_factory", "Input Protocol Factory",
-                           "Thrift Server Input Protocol Factory",
-                           THRIFT_TYPE_PROTOCOL_FACTORY,
-                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-  g_object_class_install_property (gobject_class,
-      PROP_THRIFT_SERVER_OUTPUT_PROTOCOL_FACTORY,
-      g_param_spec_object ("output_protocol_factory", "Output Protocol Factory",
-                           "Thrift Server Output Protocol Factory",
-                           THRIFT_TYPE_PROTOCOL_FACTORY,
-                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
-  /* set these as virtual methods to be implemented by a subclass */
-  cls->serve = thrift_server_serve;
-  cls->stop = thrift_server_stop;
-}
+G_DEFINE_ABSTRACT_TYPE(ThriftServer, thrift_server, G_TYPE_OBJECT)
 
 void
 thrift_server_get_property (GObject *object, guint property_id,
@@ -190,3 +108,67 @@ thrift_server_stop (ThriftServer *server
   THRIFT_SERVER_GET_CLASS (server)->stop (server);
 }
 
+/* instance initializer for Thrift Server */
+static void
+thrift_server_init (ThriftServer *server)
+{
+  server->processor = NULL;
+  server->server_transport = NULL;
+  server->input_transport_factory = NULL;
+  server->output_transport_factory = NULL;
+  server->input_protocol_factory = NULL;
+  server->output_protocol_factory = NULL;
+}
+
+/* class initializer for ThriftServer
+ * TODO: implement ServerEventHandler as a GClosure
+ */
+static void
+thrift_server_class_init (ThriftServerClass *cls)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (cls);
+
+  gobject_class->get_property = thrift_server_get_property;
+  gobject_class->set_property = thrift_server_set_property;
+
+  g_object_class_install_property (gobject_class,
+      PROP_THRIFT_SERVER_PROCESSOR,
+      g_param_spec_object ("processor", "Processor", "Thrift Processor",
+                           THRIFT_TYPE_PROCESSOR,
+                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (gobject_class,
+      PROP_THRIFT_SERVER_SERVER_TRANSPORT,
+      g_param_spec_object ("server_transport", "Server Transport",
+                           "Thrift Server Transport",
+                           THRIFT_TYPE_SERVER_TRANSPORT,
+                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (gobject_class,
+      PROP_THRIFT_SERVER_INPUT_TRANSPORT_FACTORY,
+      g_param_spec_object ("input_transport_factory", "Input Transport Factory",
+                           "Thrift Server Input Transport Factory",
+                           THRIFT_TYPE_TRANSPORT_FACTORY,
+                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (gobject_class,
+      PROP_THRIFT_SERVER_OUTPUT_TRANSPORT_FACTORY,
+      g_param_spec_object ("output_transport_factory",
+                           "Output Transport Factory",
+                           "Thrift Server Output Transport Factory",
+                           THRIFT_TYPE_TRANSPORT_FACTORY,
+                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (gobject_class,
+      PROP_THRIFT_SERVER_INPUT_PROTOCOL_FACTORY,
+      g_param_spec_object ("input_protocol_factory", "Input Protocol Factory",
+                           "Thrift Server Input Protocol Factory",
+                           THRIFT_TYPE_PROTOCOL_FACTORY,
+                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (gobject_class,
+      PROP_THRIFT_SERVER_OUTPUT_PROTOCOL_FACTORY,
+      g_param_spec_object ("output_protocol_factory", "Output Protocol Factory",
+                           "Thrift Server Output Protocol Factory",
+                           THRIFT_TYPE_PROTOCOL_FACTORY,
+                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+  /* set these as virtual methods to be implemented by a subclass */
+  cls->serve = thrift_server_serve;
+  cls->stop = thrift_server_stop;
+}

Modified: thrift/trunk/lib/c_glib/src/server/thrift_server.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/server/thrift_server.h?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/server/thrift_server.h (original)
+++ thrift/trunk/lib/c_glib/src/server/thrift_server.h Fri Nov 26 10:17:48 2010
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 #ifndef _THRIFT_SERVER_H
 #define _THRIFT_SERVER_H
 
@@ -8,24 +27,19 @@
 #include "transport/thrift_transport_factory.h"
 #include "protocol/thrift_protocol_factory.h"
 
+G_BEGIN_DECLS
+
 /*! \file thrift_server.h
  *  \brief Abstract class for Thrift servers.
  */
 
-/* type macros */	
+/* type macros */
 #define THRIFT_TYPE_SERVER (thrift_server_get_type ())
-#define THRIFT_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                                THRIFT_TYPE_SERVER, ThriftServer))
-#define THRIFT_IS_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                                   THRIFT_TYPE_SERVER))
-#define THRIFT_SERVER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), \
-                                    THRIFT_TYPE_SERVER, \
-                                    ThriftServerClass))
-#define THRIFT_IS_SERVER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), \
-                                       THRIFT_TYPE_SERVER))
-#define THRIFT_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-                                          THRIFT_TYPE_SERVER, \
-                                          ThriftServerClass))
+#define THRIFT_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_SERVER, ThriftServer))
+#define THRIFT_IS_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_SERVER))
+#define THRIFT_SERVER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_SERVER, ThriftServerClass))
+#define THRIFT_IS_SERVER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_SERVER))
+#define THRIFT_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_SERVER, ThriftServerClass))
 
 /*!
  * Thrift Server object
@@ -58,7 +72,7 @@ struct _ThriftServerClass
 typedef struct _ThriftServerClass ThriftServerClass;
 
 /* used by THRIFT_TYPE_SERVER */
-GType thrift_server_get_type (void); 
+GType thrift_server_get_type (void);
 
 /*!
  * Processes the request.
@@ -71,5 +85,7 @@ void thrift_server_serve (ThriftServer *
  */
 void thrift_server_stop (ThriftServer *server);
 
+G_END_DECLS
+
 #endif /* _THRIFT_SERVER_H */
 

Modified: thrift/trunk/lib/c_glib/src/server/thrift_simple_server.c
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/server/thrift_simple_server.c?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/server/thrift_simple_server.c (original)
+++ thrift/trunk/lib/c_glib/src/server/thrift_simple_server.c Fri Nov 26 10:17:48 2010
@@ -1,80 +1,28 @@
+/*
+ * 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 "server/thrift_simple_server.h"
 #include "transport/thrift_transport_factory.h"
 #include "protocol/thrift_protocol_factory.h"
 #include "protocol/thrift_binary_protocol_factory.h"
 
-static void thrift_simple_server_instance_init (ThriftServer *server);
-static void thrift_simple_server_class_init (ThriftServerClass *cls);
-
-/* forward declarations */
-void thrift_simple_server_serve (ThriftServer *server);
-void thrift_simple_server_stop (ThriftServer *server);
-
-GType
-thrift_simple_server_get_type (void)
-{
-  static GType type = 0;
-
-  if (type == 0)
-  {
-    static const GTypeInfo info =
-    {
-      sizeof (ThriftSimpleServerClass),
-      NULL, /* base_init */
-      NULL, /* base_finalize */
-      (GClassInitFunc) thrift_simple_server_class_init,
-      NULL, /* class_finalize */
-      NULL, /* class_data */
-      sizeof (ThriftSimpleServer),
-      0, /* n_preallocs */
-      (GInstanceInitFunc) thrift_simple_server_instance_init,
-      NULL, /* value_table */
-    };
-
-    type = g_type_register_static (THRIFT_TYPE_SERVER,
-                                   "ThriftSimpleServerType",
-                                   &info, 0);
-  }
-
-  return type;
-}
-
-static void
-thrift_simple_server_instance_init (ThriftServer *server)
-{
-  (THRIFT_SIMPLE_SERVER (server))->running = FALSE;
-
-  if (server->input_transport_factory == NULL)
-  {
-    server->input_transport_factory = 
-        g_object_new (THRIFT_TYPE_TRANSPORT_FACTORY, NULL);
-  }
-  if (server->output_transport_factory == NULL)
-  {
-    server->output_transport_factory =
-        g_object_new (THRIFT_TYPE_TRANSPORT_FACTORY, NULL);
-  }
-  if (server->input_protocol_factory == NULL)
-  {
-    server->input_protocol_factory =
-        g_object_new (THRIFT_TYPE_BINARY_PROTOCOL_FACTORY, NULL);
-  }
-  if (server->output_protocol_factory == NULL)
-  {
-    server->output_protocol_factory =
-        g_object_new (THRIFT_TYPE_BINARY_PROTOCOL_FACTORY, NULL);
-  }
-}
-
-
-/* initialize the class */
-static void
-thrift_simple_server_class_init (ThriftServerClass *cls)
-{
-  cls->serve = thrift_simple_server_serve;
-  cls->stop = thrift_simple_server_stop;
-}
+G_DEFINE_TYPE(ThriftSimpleServer, thrift_simple_server, THRIFT_TYPE_SERVER)
 
 void
 thrift_simple_server_serve (ThriftServer *server)
@@ -84,7 +32,7 @@ thrift_simple_server_serve (ThriftServer
   ThriftTransport *t = NULL;
   ThriftTransport *input_transport = NULL, *output_transport = NULL;
   ThriftProtocol *input_protocol = NULL, *output_protocol = NULL;
-  ThriftSimpleServer *tss = THRIFT_SIMPLE_SERVER (server);
+  ThriftSimpleServer *tss = THRIFT_SIMPLE_SERVER(server);
 
   THRIFT_SERVER_TRANSPORT_GET_CLASS (server->server_transport)
       ->listen (server->server_transport, NULL);
@@ -130,4 +78,41 @@ thrift_simple_server_stop (ThriftServer 
   (THRIFT_SIMPLE_SERVER (server))->running = FALSE;
 }
 
+static void
+thrift_simple_server_init (ThriftSimpleServer *tss)
+{
+  tss->running = FALSE;
+
+  ThriftServer *server = THRIFT_SERVER(tss);
+
+  if (server->input_transport_factory == NULL)
+  {
+    server->input_transport_factory =
+        g_object_new (THRIFT_TYPE_TRANSPORT_FACTORY, NULL);
+  }
+  if (server->output_transport_factory == NULL)
+  {
+    server->output_transport_factory =
+        g_object_new (THRIFT_TYPE_TRANSPORT_FACTORY, NULL);
+  }
+  if (server->input_protocol_factory == NULL)
+  {
+    server->input_protocol_factory =
+        g_object_new (THRIFT_TYPE_BINARY_PROTOCOL_FACTORY, NULL);
+  }
+  if (server->output_protocol_factory == NULL)
+  {
+    server->output_protocol_factory =
+        g_object_new (THRIFT_TYPE_BINARY_PROTOCOL_FACTORY, NULL);
+  }
+}
+
+/* initialize the class */
+static void
+thrift_simple_server_class_init (ThriftSimpleServerClass *class)
+{
+  ThriftServerClass *cls = THRIFT_SERVER_CLASS(class);
 
+  cls->serve = thrift_simple_server_serve;
+  cls->stop = thrift_simple_server_stop;
+}

Modified: thrift/trunk/lib/c_glib/src/server/thrift_simple_server.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/server/thrift_simple_server.h?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/server/thrift_simple_server.h (original)
+++ thrift/trunk/lib/c_glib/src/server/thrift_simple_server.h Fri Nov 26 10:17:48 2010
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 #ifndef _THRIFT_SIMPLE_SERVER_H
 #define _THRIFT_SIMPLE_SERVER_H
 
@@ -5,25 +24,19 @@
 
 #include "server/thrift_server.h"
 
+G_BEGIN_DECLS
+
 /*! \file thrift_simple_server.h
  *  \brief A simple Thrift server, single-threaded.
  */
 
 /* type macros */
 #define THRIFT_TYPE_SIMPLE_SERVER (thrift_simple_server_get_type ())
-#define THRIFT_SIMPLE_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                                       THRIFT_TYPE_SIMPLE_SERVER, \
-                                       ThriftSimpleServer))
-#define THRIFT_IS_SIMPLE_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                                          THRIFT_TYPE_SIMPLE_SERVER))
-#define THRIFT_SIMPLE_SERVER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c) \
-                                           THRIFT_TYPE_SIMPLE_SERVER, \
-                                           ThriftSimpleServerClass))
-#define THRIFT_IS_SIMPLE_SERVER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), \
-                                              THRIFT_TYPE_SIMPLE_SERVER))
-#define THRIFT_SIMPLE_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-                                                 THRIFT_TYPE_SIMPLE_SERVER, \
-                                                 ThriftSimpleServerClass))
+#define THRIFT_SIMPLE_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_SIMPLE_SERVER, ThriftSimpleServer))
+#define THRIFT_IS_SIMPLE_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_SIMPLE_SERVER))
+#define THRIFT_SIMPLE_SERVER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c) THRIFT_TYPE_SIMPLE_SERVER, ThriftSimpleServerClass))
+#define THRIFT_IS_SIMPLE_SERVER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_SIMPLE_SERVER))
+#define THRIFT_SIMPLE_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_SIMPLE_SERVER, ThriftSimpleServerClass))
 
 /**
  * Thrift Simple Server instance.
@@ -49,5 +62,7 @@ typedef struct _ThriftSimpleServerClass 
 /* used by THRIFT_TYPE_SIMPLE_SERVER */
 GType thrift_simple_server_get_type (void);
 
+G_END_DECLS
+
 #endif /* _THRIFT_SIMPLE_SERVER_H */
 

Modified: thrift/trunk/lib/c_glib/src/thrift.c
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/thrift.c?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/thrift.c (original)
+++ thrift/trunk/lib/c_glib/src/thrift.c Fri Nov 26 10:17:48 2010
@@ -1,3 +1,22 @@
+/*
+ * 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 "thrift.h"
 
 /**

Modified: thrift/trunk/lib/c_glib/src/thrift.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/thrift.h?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/thrift.h (original)
+++ thrift/trunk/lib/c_glib/src/thrift.h Fri Nov 26 10:17:48 2010
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 #ifndef _THRIFT_H
 #define _THRIFT_H
 

Modified: thrift/trunk/lib/c_glib/src/thrift_application_exception.c
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/thrift_application_exception.c?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/thrift_application_exception.c (original)
+++ thrift/trunk/lib/c_glib/src/thrift_application_exception.c Fri Nov 26 10:17:48 2010
@@ -1,55 +1,26 @@
+/*
+ * 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 "thrift_application_exception.h"
 #include "protocol/thrift_protocol.h"
 
-/* forward declarations */
-void thrift_application_exception_instance_init (ThriftApplicationException *object);
-void thrift_application_exception_class_init (ThriftStructClass *cls);
-gint32 thrift_application_exception_read (ThriftStruct *object, ThriftProtocol *protocol, GError **error);
-gint32 thrift_application_exception_write (ThriftStruct *object, ThriftProtocol *protocol, GError **error);
-
-GType
-thrift_application_exception_get_type (void)
-{
-  static GType type = 0;
-
-  if (type == 0)
-  {
-    static const GTypeInfo type_info =
-    {
-      sizeof (ThriftApplicationExceptionClass),
-      NULL, /* base_init */
-      NULL, /* base_finalize */
-      (GClassInitFunc) thrift_application_exception_class_init,
-      NULL, /* class_finalize */
-      NULL, /* class_data */
-      sizeof (ThriftApplicationException),
-      0, /* n_preallocs */
-      (GInstanceInitFunc) thrift_application_exception_instance_init,
-      NULL, /* value_table */
-    };
-
-    type = g_type_register_static (THRIFT_TYPE_STRUCT,
-                                   "ThriftApplicationExceptionType",
-                                   &type_info, 0);
-  }
-  return type;
-}
-
-void
-thrift_application_exception_instance_init (ThriftApplicationException *object)
-{
-  object->type = 0;
-  object->__isset_type = FALSE;
-  object->message = NULL;
-  object->__isset_message = FALSE;
-}
-
-void
-thrift_application_exception_class_init (ThriftStructClass *cls)
-{
-  cls->read = thrift_application_exception_read;
-  cls->write = thrift_application_exception_write;
-}
+G_DEFINE_TYPE(ThriftApplicationException, thrift_application_exception, THRIFT_TYPE_STRUCT)
 
 gint32
 thrift_application_exception_read (ThriftStruct *object,
@@ -190,3 +161,19 @@ thrift_application_exception_error_quark
   return g_quark_from_static_string (THRIFT_APPLICATION_EXCEPTION_ERROR_DOMAIN);
 }
 
+void
+thrift_application_exception_init (ThriftApplicationException *object)
+{
+  object->type = 0;
+  object->__isset_type = FALSE;
+  object->message = NULL;
+  object->__isset_message = FALSE;
+}
+
+void
+thrift_application_exception_class_init (ThriftApplicationExceptionClass *class)
+{
+  ThriftStructClass *cls = THRIFT_STRUCT_CLASS(class);
+  cls->read = thrift_application_exception_read;
+  cls->write = thrift_application_exception_write;
+}

Modified: thrift/trunk/lib/c_glib/src/thrift_application_exception.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/c_glib/src/thrift_application_exception.h?rev=1039299&r1=1039298&r2=1039299&view=diff
==============================================================================
--- thrift/trunk/lib/c_glib/src/thrift_application_exception.h (original)
+++ thrift/trunk/lib/c_glib/src/thrift_application_exception.h Fri Nov 26 10:17:48 2010
@@ -1,33 +1,41 @@
+/*
+ * 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.
+ */
+
 #ifndef _THRIFT_APPLICATION_EXCEPTION_H
 #define _THRIFT_APPLICATION_EXCEPTION_H
 
 #include <glib-object.h>
 #include "thrift_struct.h"
 
+G_BEGIN_DECLS
+
 /*! \file thrift_application_exception.h
  *  \brief C Implementation of a TApplicationException.
  */
 
 /* type macros */
-#define THRIFT_TYPE_APPLICATION_EXCEPTION \
-            (thrift_application_exception_get_type ())
-#define THRIFT_APPLICATION_EXCEPTION(obj) \
-            (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                                         THRIFT_TYPE_APPLICATION_EXCEPTION, \
-                                         ThriftApplicationException))
-#define THRIFT_IS_APPLICATION_EXCEPTION(obj) \
-            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                                         THRIFT_TYPE_APPLICATION_EXCEPTION))
-#define THRIFT_APPLICATION_EXCEPTION_CLASS(c) \
-            (G_TYPE_CHECK_CLASS_CAST ((c), \
-                                      THRIFT_TYPE_APPLICATION_EXCEPTION, \
-                                      ThriftApplicationExceptionClass))
-#define THRIFT_IS_APPLICATION_EXCEPTION_CLASS(c) \
-            (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_APPLICATION_EXCEPTION))
-#define THRIFT_APPLICATION_EXCEPTION_GET_CLASS(obj) \
-            (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-                                        THRIFT_TYPE_APPLICATION_EXCEPTION, \
-                                        ThriftApplicationExceptionClass))
+#define THRIFT_TYPE_APPLICATION_EXCEPTION (thrift_application_exception_get_type ())
+#define THRIFT_APPLICATION_EXCEPTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_APPLICATION_EXCEPTION, ThriftApplicationException))
+#define THRIFT_IS_APPLICATION_EXCEPTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_APPLICATION_EXCEPTION))
+#define THRIFT_APPLICATION_EXCEPTION_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_APPLICATION_EXCEPTION, ThriftApplicationExceptionClass))
+#define THRIFT_IS_APPLICATION_EXCEPTION_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_APPLICATION_EXCEPTION))
+#define THRIFT_APPLICATION_EXCEPTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_APPLICATION_EXCEPTION, ThriftApplicationExceptionClass))
 
 struct _ThriftApplicationException
 {
@@ -64,4 +72,6 @@ typedef enum
 GQuark thrift_application_exception_error_quark (void);
 #define THRIFT_APPLICATION_EXCEPTION_ERROR (thrift_application_exception_error_quark ())
 
+G_END_DECLS
+
 #endif /* _THRIFT_APPLICATION_EXCEPTION_H */