Author: bryanduxbury
Date: Wed Aug 11 18:37:25 2010
New Revision: 984524

URL: http://svn.apache.org/viewvc?rev=984524&view=rev
Log:
THRIFT-664. rb: Ruby extension fails to build with Ruby 1.9.1

This change takes care of the 1.9 build issues and a few other c-extension 
niceties.

Patch: Rajesh Malepati

Modified:
    incubator/thrift/trunk/lib/rb/ext/compact_protocol.c
    incubator/thrift/trunk/lib/rb/ext/struct.c

Modified: incubator/thrift/trunk/lib/rb/ext/compact_protocol.c
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/ext/compact_protocol.c?rev=984524&r1=984523&r2=984524&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/ext/compact_protocol.c (original)
+++ incubator/thrift/trunk/lib/rb/ext/compact_protocol.c Wed Aug 11 18:37:25 
2010
@@ -20,8 +20,8 @@
 #include <ruby.h>
 #include <stdbool.h>
 #include <stdint.h>
-#include <constants.h>
-#include <struct.h>
+#include "constants.h"
+#include "struct.h"
 #include "macros.h"
 
 #define LAST_ID(obj) FIX2INT(rb_ary_pop(rb_ivar_get(obj, last_field_id)))
@@ -458,7 +458,7 @@ VALUE rb_thrift_compact_proto_read_field
     
     if (modifier == 0) {
       // not a delta. look ahead for the zigzag varint field id.
-      LAST_ID(self);
+      (void) LAST_ID(self);
       field_id = read_i16(self);
     } else {
       // has a delta. add the delta to the last read field id.

Modified: incubator/thrift/trunk/lib/rb/ext/struct.c
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/ext/struct.c?rev=984524&r1=984523&r2=984524&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/ext/struct.c (original)
+++ incubator/thrift/trunk/lib/rb/ext/struct.c Wed Aug 11 18:37:25 2010
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-#include <struct.h>
-#include <constants.h>
+#include "struct.h"
+#include "constants.h"
 #include "macros.h"
 
 #ifndef HAVE_STRLCPY
@@ -40,7 +40,12 @@ strlcpy (char *dst, const char *src, siz
       *(dst - 1) = '\0';
     return n + strlen (src);
 }
-
+#else
+/*
+   Ruby 1.9.x includes the OpenBSD implementation of strlcpy.
+   See missing/strlcpy.c in Ruby 1.9 source
+ */
+extern size_t strlcpy(char *, const char *, size_t);
 #endif
 
 VALUE thrift_union_class;


Reply via email to