You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2009/02/03 19:16:54 UTC
svn commit: r740366 - in /incubator/thrift/trunk/lib/rb/ext:
binary_protocol_accelerated.c binary_protocol_accelerated.h constants.h
memory_buffer.c memory_buffer.h protocol.c protocol.h struct.c struct.h
thrift_native.c
Author: bryanduxbury
Date: Tue Feb 3 18:16:54 2009
New Revision: 740366
URL: http://svn.apache.org/viewvc?rev=740366&view=rev
Log:
THRIFT-302. ruby: Native extension fails to build
A piece of code needed for compilation on Linux was missing; this patch replaces it. Also, there were some compiler warnings and declarations that were missing that are now fixed.
Modified:
incubator/thrift/trunk/lib/rb/ext/binary_protocol_accelerated.c
incubator/thrift/trunk/lib/rb/ext/binary_protocol_accelerated.h
incubator/thrift/trunk/lib/rb/ext/constants.h
incubator/thrift/trunk/lib/rb/ext/memory_buffer.c
incubator/thrift/trunk/lib/rb/ext/memory_buffer.h
incubator/thrift/trunk/lib/rb/ext/protocol.c
incubator/thrift/trunk/lib/rb/ext/protocol.h
incubator/thrift/trunk/lib/rb/ext/struct.c
incubator/thrift/trunk/lib/rb/ext/struct.h
incubator/thrift/trunk/lib/rb/ext/thrift_native.c
Modified: incubator/thrift/trunk/lib/rb/ext/binary_protocol_accelerated.c
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/ext/binary_protocol_accelerated.c?rev=740366&r1=740365&r2=740366&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/ext/binary_protocol_accelerated.c (original)
+++ incubator/thrift/trunk/lib/rb/ext/binary_protocol_accelerated.c Tue Feb 3 18:16:54 2009
@@ -1,5 +1,6 @@
#include <ruby.h>
#include <stdbool.h>
+#include <stdint.h>
#include <constants.h>
#include <struct.h>
@@ -434,4 +435,4 @@
VALUE method_table_object = Data_Wrap_Struct(rb_cObject, 0, free, npmt);
rb_const_set(bpa_class, rb_intern("@native_method_table"), method_table_object);
-}
\ No newline at end of file
+}
Modified: incubator/thrift/trunk/lib/rb/ext/binary_protocol_accelerated.h
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/ext/binary_protocol_accelerated.h?rev=740366&r1=740365&r2=740366&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/ext/binary_protocol_accelerated.h (original)
+++ incubator/thrift/trunk/lib/rb/ext/binary_protocol_accelerated.h Tue Feb 3 18:16:54 2009
@@ -1,2 +1 @@
-
-void Init_binary_protocol_accelerated();
\ No newline at end of file
+void Init_binary_protocol_accelerated();
Modified: incubator/thrift/trunk/lib/rb/ext/constants.h
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/ext/constants.h?rev=740366&r1=740365&r2=740366&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/ext/constants.h (original)
+++ incubator/thrift/trunk/lib/rb/ext/constants.h Tue Feb 3 18:16:54 2009
@@ -72,4 +72,4 @@
extern VALUE thrift_module;
extern VALUE thrift_types_module;
extern VALUE class_thrift_protocol;
-extern VALUE protocol_exception_class;
\ No newline at end of file
+extern VALUE protocol_exception_class;
Modified: incubator/thrift/trunk/lib/rb/ext/memory_buffer.c
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/ext/memory_buffer.c?rev=740366&r1=740365&r2=740366&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/ext/memory_buffer.c (original)
+++ incubator/thrift/trunk/lib/rb/ext/memory_buffer.c Tue Feb 3 18:16:54 2009
@@ -49,4 +49,4 @@
slice_method_id = rb_intern("slice");
GARBAGE_BUFFER_SIZE = FIX2INT(rb_const_get(thrift_memory_buffer_class, rb_intern("GARBAGE_BUFFER_SIZE")));
-}
\ No newline at end of file
+}
Modified: incubator/thrift/trunk/lib/rb/ext/memory_buffer.h
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/ext/memory_buffer.h?rev=740366&r1=740365&r2=740366&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/ext/memory_buffer.h (original)
+++ incubator/thrift/trunk/lib/rb/ext/memory_buffer.h Tue Feb 3 18:16:54 2009
@@ -1,2 +1 @@
-
-void Init_memory_buffer();
\ No newline at end of file
+void Init_memory_buffer();
Modified: incubator/thrift/trunk/lib/rb/ext/protocol.c
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/ext/protocol.c?rev=740366&r1=740365&r2=740366&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/ext/protocol.c (original)
+++ incubator/thrift/trunk/lib/rb/ext/protocol.c Tue Feb 3 18:16:54 2009
@@ -163,4 +163,4 @@
//
// VALUE method_table_object = Data_Wrap_Struct(rb_cObject, 0, free, npmt);
// rb_const_set(c_protocol, rb_intern("@native_method_table"), method_table_object);
-}
\ No newline at end of file
+}
Modified: incubator/thrift/trunk/lib/rb/ext/protocol.h
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/ext/protocol.h?rev=740366&r1=740365&r2=740366&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/ext/protocol.h (original)
+++ incubator/thrift/trunk/lib/rb/ext/protocol.h Tue Feb 3 18:16:54 2009
@@ -1,2 +1 @@
-
-void Init_protocol();
\ No newline at end of file
+void Init_protocol();
Modified: incubator/thrift/trunk/lib/rb/ext/struct.c
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/ext/struct.c?rev=740366&r1=740365&r2=740366&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/ext/struct.c (original)
+++ incubator/thrift/trunk/lib/rb/ext/struct.c Tue Feb 3 18:16:54 2009
@@ -1,7 +1,28 @@
-
#include <struct.h>
#include <constants.h>
+#ifndef HAVE_STRLCPY
+
+static
+size_t
+strlcpy (char *dst, const char *src, size_t dst_sz)
+{
+ size_t n;
+
+ for (n = 0; n < dst_sz; n++) {
+ if ((*dst++ = *src++) == '\0')
+ break;
+ }
+
+ if (n < dst_sz)
+ return n;
+ if (n > 0)
+ *(dst - 1) = '\0';
+ return n + strlen (src);
+}
+
+#endif
+
static native_proto_method_table *mt;
#define IS_CONTAINER(ttype) ((ttype) == TTYPE_MAP || (ttype) == TTYPE_LIST || (ttype) == TTYPE_SET)
Modified: incubator/thrift/trunk/lib/rb/ext/struct.h
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/ext/struct.h?rev=740366&r1=740365&r2=740366&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/ext/struct.h (original)
+++ incubator/thrift/trunk/lib/rb/ext/struct.h Tue Feb 3 18:16:54 2009
@@ -45,4 +45,4 @@
} native_proto_method_table;
-void Init_struct();
\ No newline at end of file
+void Init_struct();
Modified: incubator/thrift/trunk/lib/rb/ext/thrift_native.c
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/ext/thrift_native.c?rev=740366&r1=740365&r2=740366&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/ext/thrift_native.c (original)
+++ incubator/thrift/trunk/lib/rb/ext/thrift_native.c Tue Feb 3 18:16:54 2009
@@ -166,4 +166,4 @@
Init_struct();
Init_binary_protocol_accelerated();
Init_memory_buffer();
-}
\ No newline at end of file
+}