ruby-macho 0.2.2 → 0.2.3
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 +4 -4
- data/LICENSE +2 -2
- data/README.md +4 -9
- data/lib/macho.rb +2 -2
- data/lib/macho/exceptions.rb +104 -73
- data/lib/macho/fat_file.rb +273 -228
- data/lib/macho/headers.rb +342 -265
- data/lib/macho/load_commands.rb +1009 -999
- data/lib/macho/macho_file.rb +509 -529
- data/lib/macho/open.rb +23 -14
- data/lib/macho/sections.rb +157 -157
- data/lib/macho/structure.rb +33 -17
- data/lib/macho/tools.rb +55 -55
- data/lib/macho/utils.rb +42 -30
- metadata +3 -4
data/lib/macho/utils.rb
CHANGED
@@ -1,36 +1,48 @@
|
|
1
1
|
module MachO
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
# @param value [Fixnum] the number being rounded
|
3
|
+
# @param round [Fixnum] the number being rounded with
|
4
|
+
# @return [Fixnum] the next number >= `value` such that `round` is its divisor
|
5
|
+
# @see http://www.opensource.apple.com/source/cctools/cctools-870/libstuff/rnd.c
|
6
|
+
def self.round(value, round)
|
7
|
+
round -= 1
|
8
|
+
value += round
|
9
|
+
value &= ~round
|
10
|
+
value
|
11
|
+
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
# @param num [Fixnum] the number being checked
|
14
|
+
# @return [Boolean] true if `num` is a valid Mach-O magic number, false otherwise
|
15
|
+
def self.magic?(num)
|
16
|
+
MH_MAGICS.has_key?(num)
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
# @param num [Fixnum] the number being checked
|
20
|
+
# @return [Boolean] true if `num` is a valid Fat magic number, false otherwise
|
21
|
+
def self.fat_magic?(num)
|
22
|
+
num == FAT_MAGIC
|
23
|
+
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
# @param num [Fixnum] the number being checked
|
26
|
+
# @return [Boolean] true if `num` is a valid 32-bit magic number, false otherwise
|
27
|
+
def self.magic32?(num)
|
28
|
+
num == MH_MAGIC || num == MH_CIGAM
|
29
|
+
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
# @param num [Fixnum] the number being checked
|
32
|
+
# @return [Boolean] true if `num` is a valid 64-bit magic number, false otherwise
|
33
|
+
def self.magic64?(num)
|
34
|
+
num == MH_MAGIC_64 || num == MH_CIGAM_64
|
35
|
+
end
|
36
|
+
|
37
|
+
# @param num [Fixnum] the number being checked
|
38
|
+
# @return [Boolean] true if `num` is a valid little-endian magic number, false otherwise
|
39
|
+
def self.little_magic?(num)
|
40
|
+
num == MH_CIGAM || num == MH_CIGAM_64
|
41
|
+
end
|
42
|
+
|
43
|
+
# @param num [Fixnum] the number being checked
|
44
|
+
# @return [Boolean] true if `num` is a valid big-endian magic number, false otherwise
|
45
|
+
def self.big_magic?(num)
|
46
|
+
num == MH_CIGAM || num == MH_CIGAM_64
|
47
|
+
end
|
36
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-macho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Woodruff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A library for viewing and manipulating Mach-O files in Ruby.
|
14
14
|
email: william@tuffbizz.com
|
@@ -30,7 +30,7 @@ files:
|
|
30
30
|
- lib/macho/structure.rb
|
31
31
|
- lib/macho/tools.rb
|
32
32
|
- lib/macho/utils.rb
|
33
|
-
homepage: https://github.com/
|
33
|
+
homepage: https://github.com/Homebrew/ruby-macho
|
34
34
|
licenses:
|
35
35
|
- MIT
|
36
36
|
metadata: {}
|
@@ -55,4 +55,3 @@ signing_key:
|
|
55
55
|
specification_version: 4
|
56
56
|
summary: ruby-macho - Mach-O file analyzer.
|
57
57
|
test_files: []
|
58
|
-
has_rdoc:
|