diff --git a/ext/nio4r/bytebuffer.c b/ext/nio4r/bytebuffer.c index c23b953..bd9bf03 100644 --- a/ext/nio4r/bytebuffer.c +++ b/ext/nio4r/bytebuffer.c @@ -124,10 +124,11 @@ static VALUE NIO_ByteBuffer_get_position(VALUE self) static VALUE NIO_ByteBuffer_set_position(VALUE self, VALUE new_position) { + int pos; struct NIO_ByteBuffer *buffer; Data_Get_Struct(self, struct NIO_ByteBuffer, buffer); - int pos = NUM2INT(new_position); + pos = NUM2INT(new_position); if(pos < 0) { rb_raise(rb_eArgError, "negative position given"); @@ -156,10 +157,11 @@ static VALUE NIO_ByteBuffer_get_limit(VALUE self) static VALUE NIO_ByteBuffer_set_limit(VALUE self, VALUE new_limit) { + int lim; struct NIO_ByteBuffer *buffer; Data_Get_Struct(self, struct NIO_ByteBuffer, buffer); - int lim = NUM2INT(new_limit); + lim = NUM2INT(new_limit); if(lim < 0) { rb_raise(rb_eArgError, "negative limit given"); @@ -237,10 +239,11 @@ static VALUE NIO_ByteBuffer_get(int argc, VALUE *argv, VALUE self) static VALUE NIO_ByteBuffer_fetch(VALUE self, VALUE index) { + int i; struct NIO_ByteBuffer *buffer; Data_Get_Struct(self, struct NIO_ByteBuffer, buffer); - int i = NUM2INT(index); + i = NUM2INT(index); if(i < 0) { rb_raise(rb_eArgError, "negative index given"); @@ -255,10 +258,11 @@ static VALUE NIO_ByteBuffer_fetch(VALUE self, VALUE index) static VALUE NIO_ByteBuffer_put(VALUE self, VALUE string) { + long length; struct NIO_ByteBuffer *buffer; Data_Get_Struct(self, struct NIO_ByteBuffer, buffer); - long length = RSTRING_LEN(string); + length = RSTRING_LEN(string); if(length > buffer->limit - buffer->position) { rb_raise(cNIO_ByteBuffer_OverflowError, "buffer is full"); diff --git a/ext/nio4r/extconf.rb b/ext/nio4r/extconf.rb index a763719..1df63a7 100644 --- a/ext/nio4r/extconf.rb +++ b/ext/nio4r/extconf.rb @@ -18,14 +18,14 @@ $defs << "-DHAVE_SYS_RESOURCE_H" if have_header("sys/resource.h") -CONFIG["optflags"] << " -fno-strict-aliasing" +CONFIG["optflags"] << " -fno-strict-aliasing" unless RUBY_PLATFORM =~ /mswin/ dir_config "nio4r_ext" create_makefile "nio4r_ext" # win32 needs to link in "just the right order" for some reason or # ioctlsocket will be mapped to an [inverted] ruby specific version. -if RUBY_PLATFORM =~ /mingw|win32/ +if RUBY_PLATFORM =~ /mingw|mswin/ makefile_contents = File.read "Makefile" makefile_contents.gsub! "DLDFLAGS = ", "DLDFLAGS = -export-all "