ffi 1.0.12.rc3 → 1.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ffi might be problematic. Click here for more details.

@@ -54,3 +54,49 @@ or from the git repository on github:
54
54
  == LICENSE:
55
55
 
56
56
  See LICENSE file.
57
+
58
+ == CREDITS
59
+
60
+ The following people have submitted code, bug reports, or otherwide contributed to the success of this project:
61
+
62
+ Alban Peignier <alban.peignier@free.fr>
63
+ Aman Gupta <aman@tmm1.net>
64
+ Andrea Fazzi <andrea.fazzi@alcacoop.it>
65
+ Andreas Niederl <rico32@gmx.net>
66
+ Andrew Cholakian <andrew@andrewvc.com>
67
+ Antonio Terceiro <terceiro@softwarelivre.org>
68
+ Brian Candler <B.Candler@pobox.com>
69
+ Brian D. Burns <burns180@gmail.com>
70
+ Bryan Kearney <bkearney@redhat.com>
71
+ Charlie Savage <cfis@zerista.com>
72
+ Chikanaga Tomoyuki <nagachika00@gmail.com>
73
+ Hongli Lai <hongli@phusion.nl>
74
+ Ian MacLeod <ian@nevir.net>
75
+ Jake Douglas <jake@shiftedlabs.com>
76
+ Jean-Dominique Morani <jdmorani@mac.com>
77
+ Jeremy Hinegardner <jeremy@hinegardner.org>
78
+ Jesús García Sáez <blaxter@gmail.com>
79
+ Joe Khoobyar <joe@ankhcraft.com>
80
+ Jurij Smakov <jurij@wooyd.org>
81
+ KISHIMOTO, Makoto <ksmakoto@dd.iij4u.or.jp>
82
+ Kim Burgestrand <kim@burgestrand.se>
83
+ Lars Kanis <kanis@comcard.de>
84
+ Luc Heinrich <luc@honk-honk.com>
85
+ Luis Lavena <luislavena@gmail.com>
86
+ Matijs van Zuijlen <matijs@matijs.net>
87
+ Matthew King <automatthew@gmail.com>
88
+ Mike Dalessio <mike.dalessio@gmail.com>
89
+ NARUSE, Yui <naruse@airemix.jp>
90
+ Park Heesob <phasis@gmail.com>
91
+ Shin Yee <shinyee@speedgocomputing.com>
92
+ Stephen Bannasch <stephen.bannasch@gmail.com>
93
+ Suraj N. Kurapati <sunaku@gmail.com>
94
+ Sylvain Daubert <sylvain.daubert@laposte.net>
95
+ Victor Costan
96
+ beoran@gmail.com
97
+ ctide <christide@christide.com>
98
+ emboss <Martin.Bosslet@googlemail.com>
99
+ hobophobe <unusualtears@gmail.com>
100
+ meh <meh@paranoici.org>
101
+ postmodern <postmodern.mod3@gmail.com>
102
+ wycats@gmail.com <wycats@gmail.com>
data/Rakefile CHANGED
@@ -75,7 +75,7 @@ PROJ.name = 'ffi'
75
75
  PROJ.authors = 'Wayne Meissner'
76
76
  PROJ.email = 'wmeissner@gmail.com'
77
77
  PROJ.url = 'http://wiki.github.com/ffi/ffi'
78
- PROJ.version = '1.0.12.rc3'
78
+ PROJ.version = '1.1.0.rc1'
79
79
  PROJ.rubyforge.name = 'ffi'
80
80
  PROJ.readme_file = 'README.rdoc'
81
81
 
@@ -591,6 +591,18 @@ memory_address(VALUE obj)
591
591
  return ((AbstractMemory *) DATA_PTR(obj))->address;
592
592
  }
593
593
 
594
+ static VALUE
595
+ memory_copy_from(VALUE self, VALUE rbsrc, VALUE rblen)
596
+ {
597
+ AbstractMemory* dst;
598
+
599
+ Data_Get_Struct(self, AbstractMemory, dst);
600
+
601
+ memcpy(dst->address, rbffi_AbstractMemory_Cast(rbsrc, rbffi_AbstractMemoryClass)->address, NUM2INT(rblen));
602
+
603
+ return self;
604
+ }
605
+
594
606
  AbstractMemory*
595
607
  rbffi_AbstractMemory_Cast(VALUE obj, VALUE klass)
596
608
  {
@@ -1008,6 +1020,7 @@ rbffi_AbstractMemory_Init(VALUE moduleFFI)
1008
1020
  rb_define_alias(classMemory, "size", "total");
1009
1021
  rb_define_method(classMemory, "type_size", memory_type_size, 0);
1010
1022
  rb_define_method(classMemory, "[]", memory_aref, 1);
1023
+ rb_define_method(classMemory, "__copy_from__", memory_copy_from, 2);
1011
1024
 
1012
1025
  id_to_ptr = rb_intern("to_ptr");
1013
1026
  id_call = rb_intern("call");
@@ -27,6 +27,9 @@
27
27
  extern "C" {
28
28
  #endif
29
29
 
30
+ #ifdef _MSC_VER
31
+ #define strtold strtod
32
+ #endif
30
33
 
31
34
  extern VALUE rbffi_longdouble_new(long double ld);
32
35
  extern long double rbffi_num2longdouble(VALUE value);
@@ -13,8 +13,10 @@ LIBFFI_BUILD_DIR = $(BUILD_DIR)/libffi
13
13
 
14
14
  ifeq ($(srcdir),.)
15
15
  LIBFFI_SRC_DIR := $(shell pwd)/libffi
16
+ else ifeq ($(srcdir),..)
17
+ LIBFFI_SRC_DIR := $(shell pwd)/../libffi
16
18
  else
17
- LIBFFI_SRC_DIR := $(abspath $(srcdir)/libffi)
19
+ LIBFFI_SRC_DIR := $(realpath $(srcdir)/libffi)
18
20
  endif
19
21
 
20
22
  LIBFFI = "$(LIBFFI_BUILD_DIR)"/.libs/libffi_convenience.a
@@ -52,9 +52,10 @@ module FFI
52
52
  type.struct_class.new(ptr.slice(self.offset, self.size))
53
53
  end
54
54
 
55
- # def put(ptr, value)
56
- # raise TypeError, "wrong value type (expected #{type.struct_class}" unless value.is_a(type.struct_class)
57
- # end
55
+ def put(ptr, value)
56
+ raise TypeError, "wrong value type (expected #{type.struct_class}" unless value.is_a?(type.struct_class)
57
+ ptr.slice(self.offset, self.size).__copy_from__(value.pointer, self.size)
58
+ end
58
59
  end
59
60
 
60
61
  class Mapped < Field
Binary file
@@ -442,6 +442,15 @@ describe FFI::Struct, ' with a nested struct field' do
442
442
  @cs[:ns][:i] = 456
443
443
  LibTest.struct_align_nested_struct(@cs.to_ptr).should eq 456
444
444
  end
445
+
446
+ it 'should be able to assign struct instance to nested field' do
447
+ cs = LibTest::ContainerStruct.new(LibTest.struct_make_container_struct(123))
448
+ ns = LibTest::NestedStruct.new
449
+ ns[:i] = 567
450
+ cs[:ns] = ns
451
+ cs[:ns][:i].should eq 567
452
+ LibTest.struct_align_nested_struct(cs.to_ptr).should eq 567
453
+ end
445
454
  end
446
455
 
447
456
  describe FFI::Struct, ' with a nested array of structs' do
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1646680562
5
- prerelease: 7
4
+ hash: -4184234388
5
+ prerelease: 6
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 12
10
10
  - rc
11
- - 3
12
- version: 1.0.12.rc3
11
+ - 1
12
+ version: 1.1.0.rc1
13
13
  platform: ruby
14
14
  authors:
15
15
  - Wayne Meissner
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-04-03 00:00:00 +10:00
20
+ date: 2012-04-05 00:00:00 +10:00
21
21
  default_executable:
22
22
  dependencies: []
23
23
 
@@ -61,6 +61,7 @@ extra_rdoc_files:
61
61
  - lib/ffi/platform/x86_64-netbsd/types.conf
62
62
  - lib/ffi/platform/x86_64-openbsd/types.conf
63
63
  - lib/ffi/platform/x86_64-solaris/types.conf
64
+ - lib/ffi_c.bundle
64
65
  files:
65
66
  - History.txt
66
67
  - LICENSE
@@ -442,6 +443,7 @@ files:
442
443
  - lib/ffi/types.rb
443
444
  - lib/ffi/union.rb
444
445
  - lib/ffi/variadic.rb
446
+ - lib/ffi_c.bundle
445
447
  - spec/ffi/async_callback_spec.rb
446
448
  - spec/ffi/bool_spec.rb
447
449
  - spec/ffi/buffer_spec.rb