ruby: fixes compatibility with ruby-1.8.5

This commit is contained in:
frsyuki
2010-08-31 07:00:19 +09:00
parent b5c78de2dd
commit 09b47cc536
5 changed files with 48 additions and 23 deletions

View File

@@ -16,7 +16,7 @@
* limitations under the License.
*/
#include "ruby.h"
#include "encoding.h"
#include "compat.h"
#include "msgpack/pack_define.h"
@@ -169,7 +169,7 @@ static VALUE MessagePack_Float_to_msgpack(int argc, VALUE *argv, VALUE self)
static VALUE MessagePack_String_to_msgpack(int argc, VALUE *argv, VALUE self)
{
ARG_BUFFER(out, argc, argv);
#ifdef MSGPACK_RUBY_ENCODING
#ifdef COMPAT_HAVE_ENCODING
int enc = ENCODING_GET(self);
if(enc != s_enc_utf8 && enc != s_enc_ascii8bit && enc != s_enc_usascii) {
if(!ENC_CODERANGE_ASCIIONLY(self)) {
@@ -193,7 +193,7 @@ static VALUE MessagePack_String_to_msgpack(int argc, VALUE *argv, VALUE self)
*/
static VALUE MessagePack_Symbol_to_msgpack(int argc, VALUE *argv, VALUE self)
{
#ifdef MSGPACK_RUBY_ENCODING
#ifdef COMPAT_HAVE_ENCODING
return MessagePack_String_to_msgpack(argc, argv, rb_id2str(SYM2ID(self)));
#else
ARG_BUFFER(out, argc, argv);