BFD 1.3.3 → 1.3.4

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.
Files changed (3) hide show
  1. data/ChangeLog +3 -0
  2. data/lib/BFD.rb +12 -4
  3. metadata +21 -5
data/ChangeLog CHANGED
@@ -1,2 +1,5 @@
1
+ 2011-05-25 : mkfs <mkfs@thoughtgang.org>
2
+ * Fixed usage of Tempfile for buffer targets
3
+ * Version bump
1
4
  2010-08-16 : mkfs <mkfs@thoughtgang.org>
2
5
  * Added license to gemspec.
data/lib/BFD.rb CHANGED
@@ -96,16 +96,21 @@ File descriptors opened for write ('wb') will be rejected by libbfd.
96
96
  end
97
97
 
98
98
  =begin rdoc
99
- Instantiate target from a buffer instead of from a file. Note: this creates
100
- a temp_file which MUST be freed by calling Target.close, or by passing a
101
- block to this method.
99
+ Instantiate target from a buffer instead of from a file.
100
+ Note: this creates a temporary file which MUST be closed and unlinked by
101
+ calling Target.close, or by passing a block to this method.
102
102
  =end
103
103
  def self.from_buffer(buf, args={})
104
104
 
105
105
  f = Tempfile.new( 'bfd_target' )
106
+ path = f.path
107
+ f.close
108
+
109
+ f = File.open(path, 'wb')
106
110
  f.write(buf)
111
+ f.rewind
107
112
 
108
- bfd = ext_new(f.path, args)
113
+ bfd = ext_new(path, args)
109
114
  raise "Unable to construct BFD" if not bfd
110
115
 
111
116
  if not block_given?
@@ -116,6 +121,7 @@ block to this method.
116
121
  # yield bfd object, then close temp file
117
122
  yield bfd
118
123
  f.close
124
+ File.unlink(path)
119
125
  nil
120
126
  end
121
127
 
@@ -124,7 +130,9 @@ Free any resources used by BFD Target
124
130
  =end
125
131
  def close
126
132
  if @temp_file
133
+ path = @temp_file.path
127
134
  @temp_file.close
135
+ File.unlink(path)
128
136
  @temp_file = nil
129
137
  end
130
138
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: BFD
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ hash: 19
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 3
9
+ - 4
10
+ version: 1.3.4
5
11
  platform: ruby
6
12
  authors:
7
13
  - TG Community
@@ -9,7 +15,7 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-10-11 00:00:00 -04:00
18
+ date: 2011-05-25 00:00:00 -04:00
13
19
  default_executable:
14
20
  dependencies: []
15
21
 
@@ -37,7 +43,9 @@ files:
37
43
  - ChangeLog
38
44
  - LICENSE
39
45
  - LICENSE.README
46
+ - tests/ut_bfd.rb
40
47
  - module/rdoc_input/BFD.rb
48
+ - module/extconf.rb
41
49
  has_rdoc: true
42
50
  homepage: http://rubyforge.org/projects/opdis/
43
51
  licenses:
@@ -48,21 +56,29 @@ rdoc_options: []
48
56
  require_paths:
49
57
  - lib
50
58
  required_ruby_version: !ruby/object:Gem::Requirement
59
+ none: false
51
60
  requirements:
52
61
  - - ">="
53
62
  - !ruby/object:Gem::Version
63
+ hash: 57
64
+ segments:
65
+ - 1
66
+ - 8
67
+ - 7
54
68
  version: 1.8.7
55
- version:
56
69
  required_rubygems_version: !ruby/object:Gem::Requirement
70
+ none: false
57
71
  requirements:
58
72
  - - ">="
59
73
  - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
60
77
  version: "0"
61
- version:
62
78
  requirements:
63
79
  - GNU binutils library and headers
64
80
  rubyforge_project: opdis
65
- rubygems_version: 1.3.5
81
+ rubygems_version: 1.4.1
66
82
  signing_key:
67
83
  specification_version: 3
68
84
  summary: Ruby extension library providing an API to GNU BFD