diff --git a/ext/puma_http11/io_buffer.c b/ext/puma_http11/io_buffer.c index 0fb97bc5..b12a1732 100644 --- a/ext/puma_http11/io_buffer.c +++ b/ext/puma_http11/io_buffer.c @@ -116,7 +116,7 @@ static VALUE buf_to_str(VALUE self) { struct buf_int* b; Data_Get_Struct(self, struct buf_int, b); - return rb_str_new(b->top, b->cur - b->top); + return rb_str_new((const char*)(b->top), b->cur - b->top); } static VALUE buf_used(VALUE self) { diff --git a/ext/puma_http11/mini_ssl.c b/ext/puma_http11/mini_ssl.c index 8b562164..e11f1fb9 100644 --- a/ext/puma_http11/mini_ssl.c +++ b/ext/puma_http11/mini_ssl.c @@ -1,7 +1,13 @@ #define RSTRING_NOT_MODIFIED 1 #include +#include + +#if RUBY_API_VERSION_MAJOR == 1 #include +#else +#include +#endif #ifdef HAVE_OPENSSL_BIO_H @@ -347,7 +353,7 @@ VALUE engine_peercert(VALUE self) { } } - rb_cert_buf = rb_str_new(buf, bytes); + rb_cert_buf = rb_str_new((const char*)(buf), bytes); if(!cert_buf) { OPENSSL_free(buf); }