cupsffi 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e503f73b0996f2259fd2554a428238d1ec3ee860
4
- data.tar.gz: b28e8f71ccb5fd7027d760b2dcb8e94369727325
3
+ metadata.gz: 5dc42d5733faba1d922a1bb2049ffb676891d825
4
+ data.tar.gz: adf32d3a751973533fb46eda8fd9f004d50aba9e
5
5
  SHA512:
6
- metadata.gz: 3989931b43da26f35a7e4beed3205fb316dc17c196f42ae78eff525cdf3fad5e4f0d46a96863512bbf0d4d5429d0efb236e324795ed8429c3f1d0e354a7d392b
7
- data.tar.gz: 4e891aec86685e754b51c37cc62d378879f2d9e0d6f13ac7f785e9ff5e8fe0545af6343eecd8bee4bd0119472fd4cf1301f88cbff666bbb9588bfab4bd8ceb2c
6
+ metadata.gz: ffced75bf023e694075a312097dba31f28a42078a56c685bcf0d71cbd2dd62d34a6257e6cb42c7b318af3d723bebe286dc39e5de6f68d98ae4d7b35fb1490944
7
+ data.tar.gz: 3f48bdcdea3b8427b1362cba31932fbc3c60c1e5abc953698d860f5c3b74911bed7d6387b5b3e8c2f112b6b50e51ba035b1292f26fa56ebfdcddd88720141b67
data/lib/cupsffi/lib.rb CHANGED
@@ -245,7 +245,7 @@ module CupsFFI
245
245
  # - length of data
246
246
  # Returns
247
247
  # - HttpStatus
248
- attach_function 'cupsWriteRequestData', [:pointer, :string, :size_t], HttpStatus
248
+ attach_function 'cupsWriteRequestData', [:pointer, :pointer, :size_t], HttpStatus
249
249
 
250
250
  # Parameters
251
251
  # - pointer to http connection to server or CUPS_HTTP_DEFAULT
@@ -165,13 +165,19 @@ class CupsPrinter
165
165
  raise last_error
166
166
  end
167
167
 
168
+ # Copy the data into a char pointer to allow null bytes
169
+ data_pointer = FFI::MemoryPointer.new(:char, data.bytesize)
170
+ data_pointer.put_bytes(0, data)
171
+
168
172
  http_status = CupsFFI::cupsStartDocument(@connection, @name,
169
173
  job_id, 'my doc', mime_type, 1)
170
174
 
171
- http_status = CupsFFI::cupsWriteRequestData(@connection, data, data.length)
175
+ http_status = CupsFFI::cupsWriteRequestData(@connection, data_pointer, data.bytesize)
172
176
 
173
177
  ipp_status = CupsFFI::cupsFinishDocument(@connection, @name)
174
178
 
179
+ data_pointer.free
180
+
175
181
  unless ipp_status == :ipp_ok
176
182
  CupsFFI::cupsFreeOptions(num_options, options_pointer) unless options_pointer.nil?
177
183
  raise ipp_status.to_s
@@ -1,3 +1,3 @@
1
1
  module Cupsffi
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,31 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cupsffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Ehresman
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-03 00:00:00.000000000 Z
11
+ date: 2017-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: ffi
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
18
  version: '0'
20
- type: :runtime
19
+ name: ffi
21
20
  prerelease: false
21
+ type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description: Simple wrapper around libcups to give CUPS printing capabilities to Ruby
28
- apps.
27
+ description: Simple wrapper around libcups to give CUPS printing capabilities to Ruby apps.
29
28
  email:
30
29
  - nehresma@gmail.com
31
30
  executables: []
@@ -47,7 +46,7 @@ files:
47
46
  homepage: https://github.com/nehresma/cupsffi
48
47
  licenses: []
49
48
  metadata: {}
50
- post_install_message:
49
+ post_install_message:
51
50
  rdoc_options: []
52
51
  require_paths:
53
52
  - lib
@@ -63,8 +62,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
62
  version: '0'
64
63
  requirements: []
65
64
  rubyforge_project: cupsffi
66
- rubygems_version: 2.4.8
67
- signing_key:
65
+ rubygems_version: 2.6.8
66
+ signing_key:
68
67
  specification_version: 4
69
68
  summary: FFI wrapper around libcups
70
69
  test_files: []