ffi 1.2.0-x86-mingw32 → 1.2.1-x86-mingw32
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.
- data/Rakefile +3 -1
- data/ext/ffi_c/Type.c +1 -1
- data/ext/ffi_c/ffi.c +1 -1
- data/ffi.gemspec +18 -0
- data/lib/1.8/ffi_c.so +0 -0
- data/lib/1.9/ffi_c.so +0 -0
- data/lib/Lib.iml +9 -0
- data/spec/ffi/struct_spec.rb +8 -8
- metadata +5 -5
- data/ext/ffi_c/LongDouble.c.orig +0 -65
data/Rakefile
CHANGED
@@ -72,7 +72,9 @@ LIBTEST = "build/libtest.#{LIBEXT}"
|
|
72
72
|
BUILD_DIR = "build"
|
73
73
|
BUILD_EXT_DIR = File.join(BUILD_DIR, "#{RbConfig::CONFIG['arch']}", 'ffi_c', RUBY_VERSION)
|
74
74
|
|
75
|
-
gem_spec
|
75
|
+
def gem_spec
|
76
|
+
@gem_spec ||= Gem::Specification.load('ffi.gemspec')
|
77
|
+
end
|
76
78
|
|
77
79
|
Gem::PackageTask.new(gem_spec) do |pkg|
|
78
80
|
pkg.need_zip = true
|
data/ext/ffi_c/Type.c
CHANGED
@@ -39,6 +39,7 @@ static void builtin_type_free(BuiltinType *);
|
|
39
39
|
VALUE rbffi_TypeClass = Qnil;
|
40
40
|
|
41
41
|
static VALUE classBuiltinType = Qnil;
|
42
|
+
static VALUE moduleNativeType = Qnil;
|
42
43
|
static VALUE typeMap = Qnil, sizeMap = Qnil;
|
43
44
|
static ID id_find_type = 0, id_type_size = 0, id_size = 0;
|
44
45
|
|
@@ -243,7 +244,6 @@ rbffi_Type_Find(VALUE name)
|
|
243
244
|
void
|
244
245
|
rbffi_Type_Init(VALUE moduleFFI)
|
245
246
|
{
|
246
|
-
VALUE moduleNativeType;
|
247
247
|
/*
|
248
248
|
* Document-class: FFI::Type
|
249
249
|
* This class manages C types.
|
data/ext/ffi_c/ffi.c
CHANGED
@@ -56,7 +56,7 @@ Init_ffi_c(void) {
|
|
56
56
|
* This module embbed type constants from {FFI::NativeType}.
|
57
57
|
*/
|
58
58
|
rbffi_FFIModule = moduleFFI = rb_define_module("FFI");
|
59
|
-
rb_global_variable(&
|
59
|
+
rb_global_variable(&rbffi_FFIModule);
|
60
60
|
|
61
61
|
|
62
62
|
/* FFI::Type needs to be initialized before most other classes */
|
data/ffi.gemspec
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'ffi'
|
3
|
+
s.version = '1.2.1'
|
4
|
+
s.author = 'Wayne Meissner'
|
5
|
+
s.email = 'wmeissner@gmail.com'
|
6
|
+
s.homepage = 'http://wiki.github.com/ffi/ffi'
|
7
|
+
s.summary = 'Ruby FFI'
|
8
|
+
s.description = 'Ruby FFI library'
|
9
|
+
s.files = %w(ffi.gemspec History.txt LICENSE COPYING COPYING.LESSER README.md Rakefile) + Dir.glob("{ext,gen,lib,spec,libtest}/**/*").reject { |f| f =~ /lib\/1\.[89]/}
|
10
|
+
s.extensions << 'ext/ffi_c/extconf.rb'
|
11
|
+
s.has_rdoc = false
|
12
|
+
s.license = 'LGPL-3'
|
13
|
+
s.require_paths << 'ext/ffi_c'
|
14
|
+
s.required_ruby_version = '>= 1.8.7'
|
15
|
+
s.add_development_dependency 'rake'
|
16
|
+
s.add_development_dependency 'rake-compiler', '>=0.6.0'
|
17
|
+
s.add_development_dependency 'rspec'
|
18
|
+
end
|
data/lib/1.8/ffi_c.so
CHANGED
Binary file
|
data/lib/1.9/ffi_c.so
CHANGED
Binary file
|
data/lib/Lib.iml
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="FacetManager">
|
4
|
+
<facet type="gem" name="Gem">
|
5
|
+
<configuration>
|
6
|
+
<option name="GEM_APP_ROOT_PATH" value="" />
|
7
|
+
<option name="GEM_APP_TEST_PATH" value="" />
|
8
|
+
<option name="GEM_APP_LIB_PATH" value="" />
|
9
|
+
</configuration>
|
10
|
+
</facet>
|
11
|
+
</component>
|
3
12
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
4
13
|
<exclude-output />
|
5
14
|
<content url="file://$MODULE_DIR$">
|
data/spec/ffi/struct_spec.rb
CHANGED
@@ -740,10 +740,10 @@ describe "variable-length arrays" do
|
|
740
740
|
layout :count, :int, :data, [ :long, 0 ]
|
741
741
|
end
|
742
742
|
s = struct_class.new(FFI::MemoryPointer.new(1024))
|
743
|
-
s[:data][0] =
|
744
|
-
s[:data][1] =
|
745
|
-
s[:data][0].should eq
|
746
|
-
s[:data][1].should eq
|
743
|
+
s[:data][0] = 0x1eadbeef
|
744
|
+
s[:data][1] = 0x12345678
|
745
|
+
s[:data][0].should eq 0x1eadbeef
|
746
|
+
s[:data][1].should eq 0x12345678
|
747
747
|
end
|
748
748
|
|
749
749
|
it "non-variable length array is bounds checked" do
|
@@ -751,9 +751,9 @@ describe "variable-length arrays" do
|
|
751
751
|
layout :count, :int, :data, [ :long, 1 ]
|
752
752
|
end
|
753
753
|
s = struct_class.new(FFI::MemoryPointer.new(1024))
|
754
|
-
s[:data][0] =
|
755
|
-
lambda { s[:data][1] =
|
756
|
-
s[:data][0].should eq
|
757
|
-
lambda { s[:data][1].should eq
|
754
|
+
s[:data][0] = 0x1eadbeef
|
755
|
+
lambda { s[:data][1] = 0x12345678 }.should raise_error
|
756
|
+
s[:data][0].should eq 0x1eadbeef
|
757
|
+
lambda { s[:data][1].should eq 0x12345678 }.should raise_error
|
758
758
|
end
|
759
759
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 1
|
10
|
+
version: 1.2.1
|
11
11
|
platform: x86-mingw32
|
12
12
|
authors:
|
13
13
|
- Wayne Meissner
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2013-01-08 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
prerelease: false
|
@@ -70,6 +70,7 @@ extensions: []
|
|
70
70
|
extra_rdoc_files: []
|
71
71
|
|
72
72
|
files:
|
73
|
+
- ffi.gemspec
|
73
74
|
- History.txt
|
74
75
|
- LICENSE
|
75
76
|
- COPYING
|
@@ -375,7 +376,6 @@ files:
|
|
375
376
|
- ext/ffi_c/libffi.vc.mk
|
376
377
|
- ext/ffi_c/libffi.vc64.mk
|
377
378
|
- ext/ffi_c/LongDouble.c
|
378
|
-
- ext/ffi_c/LongDouble.c.orig
|
379
379
|
- ext/ffi_c/LongDouble.h
|
380
380
|
- ext/ffi_c/MappedType.c
|
381
381
|
- ext/ffi_c/MappedType.h
|
data/ext/ffi_c/LongDouble.c.orig
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
#include "LongDouble.h"
|
2
|
-
#include <stdio.h>
|
3
|
-
#include <stdarg.h>
|
4
|
-
#include <float.h>
|
5
|
-
|
6
|
-
#if defined (__CYGWIN__) || defined(__INTERIX)
|
7
|
-
|
8
|
-
#define strtold(str, endptr) ((long double)strtod((str),(endptr)))
|
9
|
-
|
10
|
-
#endif /* defined (__CYGWIN__) */
|
11
|
-
|
12
|
-
static VALUE rb_cBigDecimal = Qnil;
|
13
|
-
static VALUE bigdecimal_load(VALUE unused);
|
14
|
-
static VALUE bigdecimal_failed(VALUE value);
|
15
|
-
|
16
|
-
VALUE
|
17
|
-
rbffi_longdouble_new(long double ld)
|
18
|
-
{
|
19
|
-
if (!RTEST(rb_cBigDecimal)) {
|
20
|
-
/* allow fallback if the bigdecimal library is unavailable in future ruby versions */
|
21
|
-
rb_cBigDecimal = rb_rescue(bigdecimal_load, Qnil, bigdecimal_failed, rb_cObject);
|
22
|
-
}
|
23
|
-
|
24
|
-
if (RTEST(rb_cBigDecimal) && rb_cBigDecimal != rb_cObject) {
|
25
|
-
char buf[128];
|
26
|
-
return rb_funcall(rb_cBigDecimal, rb_intern("new"), 1, rb_str_new(buf, sprintf(buf, "%.35Le", ld)));
|
27
|
-
}
|
28
|
-
|
29
|
-
/* Fall through to handling as a float */
|
30
|
-
return rb_float_new(ld);
|
31
|
-
}
|
32
|
-
|
33
|
-
long double
|
34
|
-
rbffi_num2longdouble(VALUE value)
|
35
|
-
{
|
36
|
-
if (TYPE(value) == T_FLOAT) {
|
37
|
-
return rb_num2dbl(value);
|
38
|
-
}
|
39
|
-
|
40
|
-
if (!RTEST(rb_cBigDecimal) && rb_const_defined(rb_cObject, rb_intern("BigDecimal"))) {
|
41
|
-
rb_cBigDecimal = rb_const_get(rb_cObject, rb_intern("BigDecimal"));
|
42
|
-
}
|
43
|
-
|
44
|
-
if (RTEST(rb_cBigDecimal) && rb_cBigDecimal != rb_cObject && RTEST(rb_obj_is_kind_of(value, rb_cBigDecimal))) {
|
45
|
-
VALUE s = rb_funcall(value, rb_intern("to_s"), 1, rb_str_new2("E"));
|
46
|
-
return strtold(RSTRING_PTR(s), NULL);
|
47
|
-
}
|
48
|
-
|
49
|
-
/* Fall through to handling as a float */
|
50
|
-
return rb_num2dbl(value);
|
51
|
-
}
|
52
|
-
|
53
|
-
|
54
|
-
static VALUE
|
55
|
-
bigdecimal_load(VALUE unused)
|
56
|
-
{
|
57
|
-
rb_require("bigdecimal");
|
58
|
-
return rb_const_get(rb_cObject, rb_intern("BigDecimal"));
|
59
|
-
}
|
60
|
-
|
61
|
-
static VALUE
|
62
|
-
bigdecimal_failed(VALUE value)
|
63
|
-
{
|
64
|
-
return value;
|
65
|
-
}
|