satyr 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/satyr.rb +9 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4e0f369f06852b90c9746acfea433bc58562e5d
|
4
|
+
data.tar.gz: d19091a16c16c806d62fb59165003c36304b86a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79071b5a74ad49f90efa8500d21e2ecdec3675184c9bd85896e264c00fadb645c80def9ca1fbc3149be15e8692f04f70b8c6e03dca9de16d261ef5c8a23d47cf
|
7
|
+
data.tar.gz: b55c24742592f559027a48a1b2e83742ab194b7891f99aa6867d7d8f1405c9d3db79840b9ecd22a67984ec5e81e27a646b3a94a7f096f7bf34542d07fa073770
|
data/lib/satyr.rb
CHANGED
@@ -3,6 +3,11 @@ require 'ffi'
|
|
3
3
|
# Ruby bindings for libsatyr
|
4
4
|
module Satyr
|
5
5
|
|
6
|
+
def self.set_encoding str
|
7
|
+
str.force_encoding('UTF-8') if str.respond_to? :force_encoding
|
8
|
+
str
|
9
|
+
end
|
10
|
+
|
6
11
|
# FFI wrappers for C functions. <em>Do not use this module directly</em>
|
7
12
|
module FFI
|
8
13
|
extend ::FFI::Library
|
@@ -86,7 +91,8 @@ module Satyr
|
|
86
91
|
pointer = Satyr::FFI.sr_report_from_json_text json.to_s, error_msg
|
87
92
|
error_msg = error_msg.read_pointer
|
88
93
|
unless error_msg.null?
|
89
|
-
message = error_msg.read_string
|
94
|
+
message = error_msg.read_string
|
95
|
+
Satyr::set_encoding message
|
90
96
|
Satyr::FFI.free error_msg
|
91
97
|
raise SatyrError, "Failed to parse JSON: #{message}"
|
92
98
|
end
|
@@ -168,7 +174,8 @@ module Satyr
|
|
168
174
|
opts = {:frames => 0, :flags => :normal, :prefix => ""}.merge(opts)
|
169
175
|
str_pointer = Satyr::FFI.sr_thread_get_duphash @struct.to_ptr, opts[:frames], opts[:prefix], opts[:flags]
|
170
176
|
raise SatyrError, "Failed to compute duphash" if str_pointer.null?
|
171
|
-
hash = str_pointer.read_string
|
177
|
+
hash = str_pointer.read_string
|
178
|
+
Satyr::set_encoding hash
|
172
179
|
Satyr::FFI.free str_pointer
|
173
180
|
hash
|
174
181
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: satyr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Milata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|