ffi-czmq 0.1.1.pre → 0.1.2.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c194cff3d41eae0f11f28592e0f941af8202e66c
4
- data.tar.gz: ba4b758beb7306b357ac680f61b9ee2ba778468f
3
+ metadata.gz: 64d5f262f7a41c3e443e18904ceee841a135e099
4
+ data.tar.gz: 9a9b69a04a45d60a3a73f22d82ee9a1f344d5762
5
5
  SHA512:
6
- metadata.gz: 6789dc075cc8cc874b6035187e5db349c34fc92dec5ce60400658e0f59c4e9f36aedfce79fc4a0f3d548216bf4e4bd8e2337a67fcb00feb08cba99922189418b
7
- data.tar.gz: 1394af326de53f42e345d6d92515ab82b59c2ad24c04038987c1a7c5142a868388165607167426336a3f5c02f1bb09eea3d7d4af22c787e16bb34e51d57ccae4
6
+ metadata.gz: 55bef35d1d53052b79b01181c0620889377a8afdd20ed10d29860114f356b17888fbdc441f780b63be0c4b4d79c59504da2ebcfd63ea2ed48921eee1318244a3
7
+ data.tar.gz: c397e7fb5275afad72bde1b295a6d237c769c5c2e68fc20d750a85333bbbd39f9da7f1ecc522521cec0943c77cb4478a7d7f1f6b585283fc6eb3e0402d9546d1
data/lib/czmq/utils.rb CHANGED
@@ -7,8 +7,8 @@ module CZMQ
7
7
 
8
8
  ffi_lib :libzmq, :czmq
9
9
 
10
- attach_function :zmq_version, :zmq_version, [:buffer_in, :buffer_in, :buffer_in], :void, blocking: true
11
- attach_function :zsys_version, :zsys_version, [:buffer_in, :buffer_in, :buffer_in], :void, blocking: true
10
+ attach_function :zmq_version, :zmq_version, [:buffer_out, :buffer_out, :buffer_out], :void, blocking: true
11
+ attach_function :zsys_version, :zsys_version, [:buffer_out, :buffer_out, :buffer_out], :void, blocking: true
12
12
  attach_function :errno, :zmq_errno, [], :int
13
13
  attach_function :strerror, :zmq_strerror, [:int], :string
14
14
 
data/lib/czmq/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CZMQ
2
- VERSION = Gem::Version.new('0.1.1.pre')
2
+ VERSION = Gem::Version.new('0.1.2.pre')
3
3
  end
data/lib/czmq/zmsg.rb CHANGED
@@ -71,7 +71,8 @@ module CZMQ
71
71
 
72
72
  add_mem(data.data, data.size)
73
73
  elsif data.respond_to?(:to_str)
74
- add_mem(data.to_str, data.to_str.bytesize)
74
+ str = data.to_str
75
+ add_mem(str, str.bytesize)
75
76
  elsif data.nil?
76
77
  add_mem(nil, 0)
77
78
  else
@@ -107,7 +108,8 @@ module CZMQ
107
108
 
108
109
  push_mem(data.data, data.size)
109
110
  elsif data.respond_to?(:to_str)
110
- push_mem(data.to_str, data.to_str.bytesize)
111
+ str = data.to_str
112
+ push_mem(str, str.bytesize)
111
113
  elsif data.nil?
112
114
  push_mem(nil, 0)
113
115
  else
data/lib/libzmq.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'ffi'
1
+ require 'ffi'
2
2
 
3
3
  module Libzmq
4
4
  extend FFI::Library
@@ -10,7 +10,11 @@ module Libzmq
10
10
  POLLPRI = 8
11
11
 
12
12
  class PollItem < FFI::Struct
13
- FD_TYPE = (FFI::Platform.windows? && FFI::Platform::ADDRESS_SIZE == 64) ? :uint64 : :int
13
+ FD_TYPE = if FFI::Platform.windows? # ftp://ftp.microsoft.com/bussys/winsock/winsock2/winsock2.h:84
14
+ (FFI::Platform::ADDRESS_SIZE == 64) ? :uint64_t : :uint
15
+ else
16
+ :int
17
+ end
14
18
 
15
19
  layout :socket, :pointer,
16
20
  :fd, FD_TYPE,
@@ -30,15 +34,14 @@ module Libzmq
30
34
  end
31
35
  end
32
36
 
33
- attach_function :memmove, [:pointer, :pointer, :size_t], :pointer
34
- attach_function :poll, :zmq_poll, [:pointer, :int, :long], :int, blocking: true
37
+ attach_function :poll, :zmq_poll, [:pointer, :int, :long], :int, blocking: true
35
38
 
36
39
  class PollItems < Array
37
40
  def to_ptr
38
41
  items_pointer = FFI::MemoryPointer.new(PollItem, size, true)
39
42
  offset = 0
40
43
  each do |item|
41
- Libzmq.memmove(items_pointer + offset, item, item.size)
44
+ (items_pointer + offset).__copy_from__(item.to_ptr, item.size)
42
45
  offset += item.size
43
46
  end
44
47
  items_pointer
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-czmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.pre
4
+ version: 0.1.2.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hendrik
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-15 00:00:00.000000000 Z
12
+ date: 2014-12-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi