summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-12-21 12:55:42 +0100
committerBenoit Daloze <eregontp@gmail.com>2020-12-21 12:55:42 +0100
commit2f5f999734b7ba7367ff0272e4c6b53fbd81ab7b (patch)
treea04222acf717fecbd129ced47b81397a1d0153de
parent24ef65c059bc0bc9bfd22b3fcc49f1fbbf31b5e3 (diff)
downloadffi-2f5f999734b7ba7367ff0272e4c6b53fbd81ab7b.tar.gz
Remove trailing spaces in .rb files
-rw-r--r--lib/ffi/autopointer.rb2
-rw-r--r--lib/ffi/io.rb6
-rw-r--r--lib/ffi/managedstruct.rb4
-rw-r--r--lib/ffi/pointer.rb4
-rw-r--r--lib/ffi/variadic.rb2
-rw-r--r--spec/ffi/async_callback_spec.rb6
-rw-r--r--spec/ffi/buffer_spec.rb6
-rw-r--r--spec/ffi/dup_spec.rb12
-rw-r--r--spec/ffi/enum_spec.rb4
-rw-r--r--spec/ffi/managed_struct_spec.rb2
-rw-r--r--spec/ffi/memorypointer_spec.rb2
-rw-r--r--spec/ffi/number_spec.rb4
-rw-r--r--spec/ffi/rbx/memory_pointer_spec.rb16
-rw-r--r--spec/ffi/typedef_spec.rb2
-rw-r--r--spec/ffi/union_spec.rb8
15 files changed, 40 insertions, 40 deletions
diff --git a/lib/ffi/autopointer.rb b/lib/ffi/autopointer.rb
index 889a3e3..679d7e6 100644
--- a/lib/ffi/autopointer.rb
+++ b/lib/ffi/autopointer.rb
@@ -117,7 +117,7 @@ module FFI
end
# @abstract Base class for {AutoPointer}'s releasers.
- #
+ #
# All subclasses of Releaser should define a +#release(ptr)+ method.
# A releaser is an object in charge of release an {AutoPointer}.
class Releaser
diff --git a/lib/ffi/io.rb b/lib/ffi/io.rb
index 7fa1cf7..e1bb955 100644
--- a/lib/ffi/io.rb
+++ b/lib/ffi/io.rb
@@ -29,7 +29,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.#
module FFI
-
+
# This module implements a couple of class methods to play with IO.
module IO
# @param [Integer] fd file decriptor
@@ -42,12 +42,12 @@ module FFI
# @param [#read] io io to read from
# @param [AbstractMemory] buf destination for data read from +io+
- # @param [nil, Numeric] len maximul number of bytes to read from +io+. If +nil+,
+ # @param [nil, Numeric] len maximul number of bytes to read from +io+. If +nil+,
# read until end of file.
# @return [Numeric] length really read, in bytes
#
# A version of IO#read that reads data from an IO and put then into a native buffer.
- #
+ #
# This will be optimized at some future time to eliminate the double copy.
#
def self.native_read(io, buf, len)
diff --git a/lib/ffi/managedstruct.rb b/lib/ffi/managedstruct.rb
index 0536280..b5ec8a3 100644
--- a/lib/ffi/managedstruct.rb
+++ b/lib/ffi/managedstruct.rb
@@ -44,7 +44,7 @@ module FFI
# attach_function :new_dlist, [], :pointer
# attach_function :destroy_dlist, [:pointer], :void
# end
- #
+ #
# class DoublyLinkedList < FFI::ManagedStruct
# @@@
# struct do |s|
@@ -71,7 +71,7 @@ module FFI
# @overload initialize(pointer)
# @param [Pointer] pointer
- # Create a new ManagedStruct which will invoke the class method #release on
+ # Create a new ManagedStruct which will invoke the class method #release on
# @overload initialize
# A new instance of FFI::ManagedStruct.
def initialize(pointer=nil)
diff --git a/lib/ffi/pointer.rb b/lib/ffi/pointer.rb
index a5ee655..37a054b 100644
--- a/lib/ffi/pointer.rb
+++ b/lib/ffi/pointer.rb
@@ -52,7 +52,7 @@ module FFI
# @param [nil,Numeric] len length of string to return
# @return [String]
- # Read pointer's contents as a string, or the first +len+ bytes of the
+ # Read pointer's contents as a string, or the first +len+ bytes of the
# equivalent string if +len+ is not +nil+.
def read_string(len=nil)
if len
@@ -96,7 +96,7 @@ module FFI
# @param [String] str string to write
# @param [Numeric] len length of string to return
# @return [self]
- # Write +str+ in pointer's contents, or first +len+ bytes if
+ # Write +str+ in pointer's contents, or first +len+ bytes if
# +len+ is not +nil+.
def write_string(str, len=nil)
len = str.bytesize unless len
diff --git a/lib/ffi/variadic.rb b/lib/ffi/variadic.rb
index 2414055..19a35d4 100644
--- a/lib/ffi/variadic.rb
+++ b/lib/ffi/variadic.rb
@@ -31,7 +31,7 @@
#
module FFI
- class VariadicInvoker
+ class VariadicInvoker
def init(arg_types, type_map)
@fixed = Array.new
@type_map = type_map
diff --git a/spec/ffi/async_callback_spec.rb b/spec/ffi/async_callback_spec.rb
index aa7ffcd..3d24369 100644
--- a/spec/ffi/async_callback_spec.rb
+++ b/spec/ffi/async_callback_spec.rb
@@ -20,17 +20,17 @@ describe "async callback" do
v = 0xdeadbeef
called = false
cb = Proc.new {|i| v = i; called = true }
- LibTest.testAsyncCallback(cb, 0x7fffffff)
+ LibTest.testAsyncCallback(cb, 0x7fffffff)
expect(called).to be true
expect(v).to eq(0x7fffffff)
end
-
+
it "called a second time" do
skip "not yet supported on TruffleRuby" if RUBY_ENGINE == "truffleruby"
v = 0xdeadbeef
called = false
cb = Proc.new {|i| v = i; called = true }
- LibTest.testAsyncCallback(cb, 0x7fffffff)
+ LibTest.testAsyncCallback(cb, 0x7fffffff)
expect(called).to be true
expect(v).to eq(0x7fffffff)
end
diff --git a/spec/ffi/buffer_spec.rb b/spec/ffi/buffer_spec.rb
index b2ea6ee..619cb6b 100644
--- a/spec/ffi/buffer_spec.rb
+++ b/spec/ffi/buffer_spec.rb
@@ -7,8 +7,8 @@ require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
describe "Buffer#total" do
[1,2,3].each do |i|
- { :char => 1, :uchar => 1, :short => 2, :ushort => 2, :int => 4,
- :uint => 4, :long => FFI::Type::LONG.size, :ulong => FFI::Type::ULONG.size,
+ { :char => 1, :uchar => 1, :short => 2, :ushort => 2, :int => 4,
+ :uint => 4, :long => FFI::Type::LONG.size, :ulong => FFI::Type::ULONG.size,
:long_long => 8, :ulong_long => 8, :float => 4, :double => 8
}.each_pair do |t, s|
@@ -46,7 +46,7 @@ describe "Buffer#put_uchar" do
expect(FFI::Buffer.alloc_in(bufsize).put_uchar(offset, i).get_uchar(offset)).to eq(i)
end
end
- end
+ end
end
describe "Buffer#put_short" do
diff --git a/spec/ffi/dup_spec.rb b/spec/ffi/dup_spec.rb
index ae6e523..8b5fd5d 100644
--- a/spec/ffi/dup_spec.rb
+++ b/spec/ffi/dup_spec.rb
@@ -5,31 +5,31 @@
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
-describe "Pointer#dup" do
+describe "Pointer#dup" do
it "clone should be independent" do
p1 = FFI::MemoryPointer.new(:char, 1024)
p1.put_string(0, "test123");
p2 = p1.dup
p1.put_string(0, "deadbeef")
-
+
expect(p2.get_string(0)).to eq("test123")
end
-
+
it "sliced pointer can be cloned" do
p1 = FFI::MemoryPointer.new(:char, 1024)
p1.put_string(0, "test123");
p2 = p1[1].dup
-
+
# first char will be excised
expect(p2.get_string(0)).to eq("est123")
expect(p1.get_string(0)).to eq("test123")
end
-
+
it "sliced pointer when cloned is independent" do
p1 = FFI::MemoryPointer.new(:char, 1024)
p1.put_string(0, "test123");
p2 = p1[1].dup
-
+
p1.put_string(0, "deadbeef")
# first char will be excised
expect(p2.get_string(0)).to eq("est123")
diff --git a/spec/ffi/enum_spec.rb b/spec/ffi/enum_spec.rb
index 93c349e..b8c5b57 100644
--- a/spec/ffi/enum_spec.rb
+++ b/spec/ffi/enum_spec.rb
@@ -17,7 +17,7 @@ module TestEnum1
enum [:c5, 42, :c6, :c7, :c8]
enum [:c9, 42, :c10, :c11, 4242, :c12]
enum [:c13, 42, :c14, 4242, :c15, 424242, :c16, 42424242]
-
+
attach_function :test_untagged_enum, [:int], :int
end
@@ -262,7 +262,7 @@ describe "All enums" do
expect(TestEnum1.enum_value(:c14)).to eq(4242)
expect(TestEnum1.enum_value(:c15)).to eq(424242)
expect(TestEnum1.enum_value(:c16)).to eq(42424242)
-
+
expect(TestEnum3.enum_value(:c13)).to eq(42)
expect(TestEnum3.enum_value(:c14)).to eq(4242)
expect(TestEnum3.enum_value(:c15)).to eq(424242)
diff --git a/spec/ffi/managed_struct_spec.rb b/spec/ffi/managed_struct_spec.rb
index f11c67a..9b02c34 100644
--- a/spec/ffi/managed_struct_spec.rb
+++ b/spec/ffi/managed_struct_spec.rb
@@ -23,7 +23,7 @@ describe "Managed Struct" do
layout :i, :int
def self.release
end
- end
+ end
expect(WhatClassAmI.new(ManagedStructTestLib.ptr_from_address(0x12345678)).class).to eq(WhatClassAmI)
end
diff --git a/spec/ffi/memorypointer_spec.rb b/spec/ffi/memorypointer_spec.rb
index d819f35..c8d1b42 100644
--- a/spec/ffi/memorypointer_spec.rb
+++ b/spec/ffi/memorypointer_spec.rb
@@ -73,6 +73,6 @@ describe "MemoryPointer return value" do
it "fopen returns non-nil" do
fp = Stdio.fopen("/dev/null", "w")
expect(fp).to_not be_nil
- expect(Stdio.fclose(fp)).to eq 0 unless fp.nil? or fp.null?
+ expect(Stdio.fclose(fp)).to eq 0 unless fp.nil? or fp.null?
end
end
diff --git a/spec/ffi/number_spec.rb b/spec/ffi/number_spec.rb
index e48527e..555a5d5 100644
--- a/spec/ffi/number_spec.rb
+++ b/spec/ffi/number_spec.rb
@@ -185,8 +185,8 @@ describe "Three different size Integer arguments" do
module LibTest
extend FFI::Library
ffi_lib TestLibrary::PATH
-
-
+
+
[ 's32', 'u32', 's64', 'u64' ].each do |rt|
TYPES.each do |t1|
TYPES.each do |t2|
diff --git a/spec/ffi/rbx/memory_pointer_spec.rb b/spec/ffi/rbx/memory_pointer_spec.rb
index 9af84e9..3878973 100644
--- a/spec/ffi/rbx/memory_pointer_spec.rb
+++ b/spec/ffi/rbx/memory_pointer_spec.rb
@@ -32,7 +32,7 @@ describe "MemoryPointer" do
expect(FFI::Pointer::NULL.read_string(0)).to eq('')
expect(FFI::Pointer::NULL.read_string(0).encoding).to eq(Encoding::BINARY)
end
-
+
it "makes a pointer for a certain number of bytes" do
m = FFI::MemoryPointer.new(8)
m.write_array_of_int([1,2])
@@ -45,7 +45,7 @@ describe "MemoryPointer" do
expect(m[0].read_int).to eq(1)
expect(m[1].read_int).to eq(2)
end
-
+
it "allows writing as an int" do
m = FFI::MemoryPointer.new(:int)
m.write_int(1)
@@ -138,19 +138,19 @@ describe "MemoryPointer" do
# p = m.read_pointer
# lambda { p.write_int(10) }.should_not raise_error
# end
-
+
it "makes a pointer for a certain type" do
m = FFI::MemoryPointer.new(:int)
m.write_int(10)
expect(m.read_int).to eq(10)
end
-
+
it "makes a memory pointer for a number of a certain type" do
m = FFI::MemoryPointer.new(:int, 2)
m.write_array_of_int([1,2])
expect(m.read_array_of_int(2)).to eq([1,2])
end
-
+
it "makes a pointer for an object responding to #size" do
m = FFI::MemoryPointer.new(Struct.new(:size).new(8))
m.write_array_of_int([1,2])
@@ -161,7 +161,7 @@ describe "MemoryPointer" do
m = FFI::MemoryPointer.new(Struct.new(:size).new(4), 2)
m.write_array_of_int([1,2])
expect(m.read_array_of_int(2)).to eq([1,2])
- end
+ end
it "MemoryPointer#address returns correct value" do
m = FFI::MemoryPointer.new(:long_long)
@@ -172,7 +172,7 @@ describe "MemoryPointer" do
it "MemoryPointer#null? returns true for zero value" do
m = FFI::MemoryPointer.new(:long_long)
- m.write_long(0)
+ m.write_long(0)
expect(m.read_pointer.null?).to be true
end
@@ -181,7 +181,7 @@ describe "MemoryPointer" do
m.write_long(0x12345678)
expect(m.read_pointer.null?).to be false
end
-
+
it "initialize with block should execute block" do
block_executed = false
FFI::MemoryPointer.new(:pointer) do |ptr|
diff --git a/spec/ffi/typedef_spec.rb b/spec/ffi/typedef_spec.rb
index d73247f..9e26cc7 100644
--- a/spec/ffi/typedef_spec.rb
+++ b/spec/ffi/typedef_spec.rb
@@ -61,7 +61,7 @@ describe "Custom type definitions" do
# enum() will insert a custom typedef called :foo for the enum
enum :foo, [ :a, :b ]
typedef :int, :bar
-
+
ffi_lib TestLibrary::PATH
begin
attach_function :ptr_ret_int32_t, [ :string, :foo ], :bar
diff --git a/spec/ffi/union_spec.rb b/spec/ffi/union_spec.rb
index 45bf7ec..3ccc2d2 100644
--- a/spec/ffi/union_spec.rb
+++ b/spec/ffi/union_spec.rb
@@ -8,7 +8,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
module LibTest
Types = {
's8' => [:char, :c, 1],
- 's16' => [:short, :s, 0xff0],
+ 's16' => [:short, :s, 0xff0],
's32' => [:int, :i, 0xff00],
's64' => [:long_long, :j, 0xffff00],
'long' => [:long, :l, 0xffff],
@@ -16,8 +16,8 @@ module LibTest
'f64' => [:double, :d, 1.000000001]
}
class TestUnion < FFI::Union
- layout( :a, [:char, 10],
- :i, :int,
+ layout( :a, [:char, 10],
+ :i, :int,
:f, :float,
:d, :double,
:s, :short,
@@ -25,7 +25,7 @@ module LibTest
:j, :long_long,
:c, :char )
end
- Types.keys.each do |k|
+ Types.keys.each do |k|
attach_function "union_align_#{k}", [ :pointer ], Types[k][0]
attach_function "union_make_union_with_#{k}", [ Types[k][0] ], :pointer
end