ruby-macho 1.1.0 → 1.2.0

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
- SHA1:
3
- metadata.gz: 633935fc4cb74f62b33362d5ecb5f4db5b6d4cbf
4
- data.tar.gz: f69c9cedb248620ce5e8477f5f3ee02d9cf9a483
2
+ SHA256:
3
+ metadata.gz: bd8e36f6bd2e8cd96c08b2c032ce8dd4b8a97249ae5363419e7930a7997cc03c
4
+ data.tar.gz: 4ab73d409143e72912e1de7fa050b6debd02cc58bebfcfe92deb0c269cad9702
5
5
  SHA512:
6
- metadata.gz: 957d16360147749264145ac81312e28e8fdd612d24802659642416f8bb2ad2a2e0d3998bc8be15d2adb24c41ef00ba8ec9be16e4c4f28fc6801cf07f358f9128
7
- data.tar.gz: 327c34832cc7233b81023f49fbbb6ae34fbece07ea6cdb0c4e7f9b89237e5780d1acfd359a073c5638f3fd81eb23895d540caca07cd91c1706ca10cded96c6b3
6
+ metadata.gz: f030168651f8882b7dc44f4ab8392e21222e4c9a3ecf3e78e08612e85a07da0bbd07bb46b93bd3e37509e9d8e296ad21f2f0bf196abb0fbfbe006c10c3bb38cf
7
+ data.tar.gz: 4f4c53e171932244957261a7f28fdc129993decffcfc2c212d0b1b6d3c4c67290a609fe3fae91442553456ea38a99660d68eae79bb32e0c4b1fca9287c7b71c7
data/README.md CHANGED
@@ -3,6 +3,7 @@ ruby-macho
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/ruby-macho.svg)](http://badge.fury.io/rb/ruby-macho)
5
5
  [![Build Status](https://travis-ci.org/Homebrew/ruby-macho.svg?branch=master)](https://travis-ci.org/Homebrew/ruby-macho)
6
+ [![Coverage Status](https://codecov.io/gh/Homebrew/ruby-macho/branch/master/graph/badge.svg)](https://codecov.io/gh/Homebrew/ruby-macho)
6
7
 
7
8
  A Ruby library for examining and modifying Mach-O files.
8
9
 
data/lib/macho.rb CHANGED
@@ -12,7 +12,7 @@ require "#{File.dirname(__FILE__)}/macho/tools"
12
12
  # The primary namespace for ruby-macho.
13
13
  module MachO
14
14
  # release version
15
- VERSION = "1.1.0".freeze
15
+ VERSION = "1.2.0".freeze
16
16
 
17
17
  # Opens the given filename as a MachOFile or FatFile, depending on its magic.
18
18
  # @param filename [String] the file being opened
@@ -10,7 +10,7 @@ module MachO
10
10
  # Raised when a Mach-O file modification fails but can be recovered when
11
11
  # operating on multiple Mach-O slices of a fat binary in non-strict mode.
12
12
  class RecoverableModificationError < ModificationError
13
- # @return [Fixnum, nil] The index of the Mach-O slice of a fat binary for
13
+ # @return [Integer, nil] The index of the Mach-O slice of a fat binary for
14
14
  # which modification failed or `nil` if not a fat binary. This is used to
15
15
  # make the error message more useful.
16
16
  attr_accessor :macho_slice
@@ -40,7 +40,7 @@ module MachO
40
40
 
41
41
  # Raised when a file's magic bytes are not valid Mach-O magic.
42
42
  class MagicError < NotAMachOError
43
- # @param num [Fixnum] the unknown number
43
+ # @param num [Integer] the unknown number
44
44
  def initialize(num)
45
45
  super "Unrecognized Mach-O magic: 0x#{"%02x" % num}"
46
46
  end
@@ -69,7 +69,7 @@ module MachO
69
69
 
70
70
  # Raised when the CPU type is unknown.
71
71
  class CPUTypeError < MachOError
72
- # @param cputype [Fixnum] the unknown CPU type
72
+ # @param cputype [Integer] the unknown CPU type
73
73
  def initialize(cputype)
74
74
  super "Unrecognized CPU type: 0x#{"%08x" % cputype}"
75
75
  end
@@ -77,8 +77,8 @@ module MachO
77
77
 
78
78
  # Raised when the CPU type/sub-type pair is unknown.
79
79
  class CPUSubtypeError < MachOError
80
- # @param cputype [Fixnum] the CPU type of the unknown pair
81
- # @param cpusubtype [Fixnum] the CPU sub-type of the unknown pair
80
+ # @param cputype [Integer] the CPU type of the unknown pair
81
+ # @param cpusubtype [Integer] the CPU sub-type of the unknown pair
82
82
  def initialize(cputype, cpusubtype)
83
83
  super "Unrecognized CPU sub-type: 0x#{"%08x" % cpusubtype}" \
84
84
  " (for CPU type: 0x#{"%08x" % cputype})"
@@ -87,7 +87,7 @@ module MachO
87
87
 
88
88
  # Raised when a mach-o file's filetype field is unknown.
89
89
  class FiletypeError < MachOError
90
- # @param num [Fixnum] the unknown number
90
+ # @param num [Integer] the unknown number
91
91
  def initialize(num)
92
92
  super "Unrecognized Mach-O filetype code: 0x#{"%02x" % num}"
93
93
  end
@@ -95,7 +95,7 @@ module MachO
95
95
 
96
96
  # Raised when an unknown load command is encountered.
97
97
  class LoadCommandError < MachOError
98
- # @param num [Fixnum] the unknown number
98
+ # @param num [Integer] the unknown number
99
99
  def initialize(num)
100
100
  super "Unrecognized Mach-O load command: 0x#{"%02x" % num}"
101
101
  end
@@ -113,8 +113,8 @@ module MachO
113
113
  # is wrong.
114
114
  class LoadCommandCreationArityError < MachOError
115
115
  # @param cmd_sym [Symbol] the load command's symbol
116
- # @param expected_arity [Fixnum] the number of arguments expected
117
- # @param actual_arity [Fixnum] the number of arguments received
116
+ # @param expected_arity [Integer] the number of arguments expected
117
+ # @param actual_arity [Integer] the number of arguments received
118
118
  def initialize(cmd_sym, expected_arity, actual_arity)
119
119
  super "Expected #{expected_arity} arguments for #{cmd_sym} creation," \
120
120
  " got #{actual_arity}"
@@ -140,7 +140,7 @@ module MachO
140
140
 
141
141
  # Raised when a change at an offset is not valid.
142
142
  class OffsetInsertionError < ModificationError
143
- # @param offset [Fixnum] the invalid offset
143
+ # @param offset [Integer] the invalid offset
144
144
  def initialize(offset)
145
145
  super "Insertion at offset #{offset} is not valid"
146
146
  end
@@ -261,11 +261,8 @@ module MachO
261
261
  # @raise [MachOError] if the instance was initialized without a file
262
262
  # @note Overwrites all data in the file!
263
263
  def write!
264
- if filename.nil?
265
- raise MachOError, "cannot write to a default file when initialized from a binary string"
266
- else
267
- File.open(@filename, "wb") { |f| f.write(@raw_data) }
268
- end
264
+ raise MachOError, "no initial file to write to" if filename.nil?
265
+ File.open(@filename, "wb") { |f| f.write(@raw_data) }
269
266
  end
270
267
 
271
268
  private
data/lib/macho/headers.rb CHANGED
@@ -450,10 +450,10 @@ module MachO
450
450
  # Fat binary header structure
451
451
  # @see MachO::FatArch
452
452
  class FatHeader < MachOStructure
453
- # @return [Fixnum] the magic number of the header (and file)
453
+ # @return [Integer] the magic number of the header (and file)
454
454
  attr_reader :magic
455
455
 
456
- # @return [Fixnum] the number of fat architecture structures following the header
456
+ # @return [Integer] the number of fat architecture structures following the header
457
457
  attr_reader :nfat_arch
458
458
 
459
459
  # always big-endian
@@ -481,19 +481,19 @@ module MachO
481
481
  # these, representing one or more internal Mach-O blobs.
482
482
  # @see MachO::Headers::FatHeader
483
483
  class FatArch < MachOStructure
484
- # @return [Fixnum] the CPU type of the Mach-O
484
+ # @return [Integer] the CPU type of the Mach-O
485
485
  attr_reader :cputype
486
486
 
487
- # @return [Fixnum] the CPU subtype of the Mach-O
487
+ # @return [Integer] the CPU subtype of the Mach-O
488
488
  attr_reader :cpusubtype
489
489
 
490
- # @return [Fixnum] the file offset to the beginning of the Mach-O data
490
+ # @return [Integer] the file offset to the beginning of the Mach-O data
491
491
  attr_reader :offset
492
492
 
493
- # @return [Fixnum] the size, in bytes, of the Mach-O data
493
+ # @return [Integer] the size, in bytes, of the Mach-O data
494
494
  attr_reader :size
495
495
 
496
- # @return [Fixnum] the alignment, as a power of 2
496
+ # @return [Integer] the alignment, as a power of 2
497
497
  attr_reader :align
498
498
 
499
499
  # always big-endian
@@ -522,25 +522,25 @@ module MachO
522
522
 
523
523
  # 32-bit Mach-O file header structure
524
524
  class MachHeader < MachOStructure
525
- # @return [Fixnum] the magic number
525
+ # @return [Integer] the magic number
526
526
  attr_reader :magic
527
527
 
528
- # @return [Fixnum] the CPU type of the Mach-O
528
+ # @return [Integer] the CPU type of the Mach-O
529
529
  attr_reader :cputype
530
530
 
531
- # @return [Fixnum] the CPU subtype of the Mach-O
531
+ # @return [Integer] the CPU subtype of the Mach-O
532
532
  attr_reader :cpusubtype
533
533
 
534
- # @return [Fixnum] the file type of the Mach-O
534
+ # @return [Integer] the file type of the Mach-O
535
535
  attr_reader :filetype
536
536
 
537
- # @return [Fixnum] the number of load commands in the Mach-O
537
+ # @return [Integer] the number of load commands in the Mach-O
538
538
  attr_reader :ncmds
539
539
 
540
- # @return [Fixnum] the size of all load commands, in bytes, in the Mach-O
540
+ # @return [Integer] the size of all load commands, in bytes, in the Mach-O
541
541
  attr_reader :sizeofcmds
542
542
 
543
- # @return [Fixnum] the header flags associated with the Mach-O
543
+ # @return [Integer] the header flags associated with the Mach-O
544
544
  attr_reader :flags
545
545
 
546
546
  # @see MachOStructure::FORMAT
@@ -635,7 +635,7 @@ module MachO
635
635
  Utils.magic64?(magic)
636
636
  end
637
637
 
638
- # @return [Fixnum] the file's internal alignment
638
+ # @return [Integer] the file's internal alignment
639
639
  def alignment
640
640
  magic32? ? 4 : 8
641
641
  end
@@ -58,6 +58,8 @@ module MachO
58
58
  0x2e => :LC_LINKER_OPTIMIZATION_HINT,
59
59
  0x2f => :LC_VERSION_MIN_TVOS,
60
60
  0x30 => :LC_VERSION_MIN_WATCHOS,
61
+ 0x31 => :LC_NOTE,
62
+ 0x32 => :LC_BUILD_VERSION,
61
63
  }.freeze
62
64
 
63
65
  # association of symbol representations to load command constants
@@ -66,20 +68,20 @@ module MachO
66
68
 
67
69
  # load commands responsible for loading dylibs
68
70
  # @api private
69
- DYLIB_LOAD_COMMANDS = [
70
- :LC_LOAD_DYLIB,
71
- :LC_LOAD_WEAK_DYLIB,
72
- :LC_REEXPORT_DYLIB,
73
- :LC_LAZY_LOAD_DYLIB,
74
- :LC_LOAD_UPWARD_DYLIB,
71
+ DYLIB_LOAD_COMMANDS = %i[
72
+ LC_LOAD_DYLIB
73
+ LC_LOAD_WEAK_DYLIB
74
+ LC_REEXPORT_DYLIB
75
+ LC_LAZY_LOAD_DYLIB
76
+ LC_LOAD_UPWARD_DYLIB
75
77
  ].freeze
76
78
 
77
79
  # load commands that can be created manually via {LoadCommand.create}
78
80
  # @api private
79
- CREATABLE_LOAD_COMMANDS = DYLIB_LOAD_COMMANDS + [
80
- :LC_ID_DYLIB,
81
- :LC_RPATH,
82
- :LC_LOAD_DYLINKER,
81
+ CREATABLE_LOAD_COMMANDS = DYLIB_LOAD_COMMANDS + %i[
82
+ LC_ID_DYLIB
83
+ LC_RPATH
84
+ LC_LOAD_DYLINKER
83
85
  ].freeze
84
86
 
85
87
  # association of load command symbols to string representations of classes
@@ -141,6 +143,8 @@ module MachO
141
143
  :LC_LINKER_OPTIMIZATION_HINT => "LinkeditDataCommand",
142
144
  :LC_VERSION_MIN_TVOS => "VersionMinCommand",
143
145
  :LC_VERSION_MIN_WATCHOS => "VersionMinCommand",
146
+ :LC_NOTE => "LoadCommand",
147
+ :LC_BUILD_VERSION => "BuildVersionCommand",
144
148
  }.freeze
145
149
 
146
150
  # association of segment name symbols to names
@@ -173,10 +177,10 @@ module MachO
173
177
  # @return [MachO::MachOView] the raw view associated with the load command
174
178
  attr_reader :view
175
179
 
176
- # @return [Fixnum] the load command's identifying number
180
+ # @return [Integer] the load command's identifying number
177
181
  attr_reader :cmd
178
182
 
179
- # @return [Fixnum] the size of the load command, in bytes
183
+ # @return [Integer] the size of the load command, in bytes
180
184
  attr_reader :cmdsize
181
185
 
182
186
  # @see MachOStructure::FORMAT
@@ -216,8 +220,8 @@ module MachO
216
220
  end
217
221
 
218
222
  # @param view [MachO::MachOView] the load command's raw view
219
- # @param cmd [Fixnum] the load command's identifying number
220
- # @param cmdsize [Fixnum] the size of the load command in bytes
223
+ # @param cmd [Integer] the load command's identifying number
224
+ # @param cmdsize [Integer] the size of the load command in bytes
221
225
  # @api private
222
226
  def initialize(view, cmd, cmdsize)
223
227
  @view = view
@@ -241,7 +245,7 @@ module MachO
241
245
  [cmd, SIZEOF].pack(format)
242
246
  end
243
247
 
244
- # @return [Fixnum] the load command's offset in the source file
248
+ # @return [Integer] the load command's offset in the source file
245
249
  # @deprecated use {#view} instead
246
250
  def offset
247
251
  view.offset
@@ -267,7 +271,7 @@ module MachO
267
271
  # explicit operations on the raw Mach-O data.
268
272
  class LCStr
269
273
  # @param lc [LoadCommand] the load command
270
- # @param lc_str [Fixnum, String] the offset to the beginning of the
274
+ # @param lc_str [Integer, String] the offset to the beginning of the
271
275
  # string, or the string itself if not being initialized with a view.
272
276
  # @raise [MachO::LCStrMalformedError] if the string is malformed
273
277
  # @todo devise a solution such that the `lc_str` parameter is not
@@ -295,7 +299,7 @@ module MachO
295
299
  @string
296
300
  end
297
301
 
298
- # @return [Fixnum] the offset to the beginning of the string in the
302
+ # @return [Integer] the offset to the beginning of the string in the
299
303
  # load command
300
304
  def to_i
301
305
  @string_offset
@@ -308,7 +312,7 @@ module MachO
308
312
  # @return [Symbol] the endianness of the serialized load command
309
313
  attr_reader :endianness
310
314
 
311
- # @return [Fixnum] the constant alignment value used to pad the
315
+ # @return [Integer] the constant alignment value used to pad the
312
316
  # serialized load command
313
317
  attr_reader :alignment
314
318
 
@@ -320,7 +324,7 @@ module MachO
320
324
  end
321
325
 
322
326
  # @param endianness [Symbol] the endianness of the context
323
- # @param alignment [Fixnum] the alignment of the context
327
+ # @param alignment [Integer] the alignment of the context
324
328
  # @api private
325
329
  def initialize(endianness, alignment)
326
330
  @endianness = endianness
@@ -333,7 +337,7 @@ module MachO
333
337
  # identifying an object produced by static link editor. Corresponds to
334
338
  # LC_UUID.
335
339
  class UUIDCommand < LoadCommand
336
- # @return [Array<Fixnum>] the UUID
340
+ # @return [Array<Integer>] the UUID
337
341
  attr_reader :uuid
338
342
 
339
343
  # @see MachOStructure::FORMAT
@@ -368,28 +372,28 @@ module MachO
368
372
  # @return [String] the name of the segment
369
373
  attr_reader :segname
370
374
 
371
- # @return [Fixnum] the memory address of the segment
375
+ # @return [Integer] the memory address of the segment
372
376
  attr_reader :vmaddr
373
377
 
374
- # @return [Fixnum] the memory size of the segment
378
+ # @return [Integer] the memory size of the segment
375
379
  attr_reader :vmsize
376
380
 
377
- # @return [Fixnum] the file offset of the segment
381
+ # @return [Integer] the file offset of the segment
378
382
  attr_reader :fileoff
379
383
 
380
- # @return [Fixnum] the amount to map from the file
384
+ # @return [Integer] the amount to map from the file
381
385
  attr_reader :filesize
382
386
 
383
- # @return [Fixnum] the maximum VM protection
387
+ # @return [Integer] the maximum VM protection
384
388
  attr_reader :maxprot
385
389
 
386
- # @return [Fixnum] the initial VM protection
390
+ # @return [Integer] the initial VM protection
387
391
  attr_reader :initprot
388
392
 
389
- # @return [Fixnum] the number of sections in the segment
393
+ # @return [Integer] the number of sections in the segment
390
394
  attr_reader :nsects
391
395
 
392
- # @return [Fixnum] any flags associated with the segment
396
+ # @return [Integer] any flags associated with the segment
393
397
  attr_reader :flags
394
398
 
395
399
  # @see MachOStructure::FORMAT
@@ -466,13 +470,13 @@ module MachO
466
470
  # name as an LCStr
467
471
  attr_reader :name
468
472
 
469
- # @return [Fixnum] the library's build time stamp
473
+ # @return [Integer] the library's build time stamp
470
474
  attr_reader :timestamp
471
475
 
472
- # @return [Fixnum] the library's current version number
476
+ # @return [Integer] the library's current version number
473
477
  attr_reader :current_version
474
478
 
475
- # @return [Fixnum] the library's compatibility version number
479
+ # @return [Integer] the library's compatibility version number
476
480
  attr_reader :compatibility_version
477
481
 
478
482
  # @see MachOStructure::FORMAT
@@ -551,10 +555,10 @@ module MachO
551
555
  # name as an LCStr
552
556
  attr_reader :name
553
557
 
554
- # @return [Fixnum] the number of modules in the library
558
+ # @return [Integer] the number of modules in the library
555
559
  attr_reader :nmodules
556
560
 
557
- # @return [Fixnum] a bit vector of linked modules
561
+ # @return [Integer] a bit vector of linked modules
558
562
  attr_reader :linked_modules
559
563
 
560
564
  # @see MachOStructure::FORMAT
@@ -591,10 +595,10 @@ module MachO
591
595
  # initialization routine and an index into the module table for the module
592
596
  # that defines the routine. Corresponds to LC_ROUTINES.
593
597
  class RoutinesCommand < LoadCommand
594
- # @return [Fixnum] the address of the initialization routine
598
+ # @return [Integer] the address of the initialization routine
595
599
  attr_reader :init_address
596
600
 
597
- # @return [Fixnum] the index into the module table that the init routine
601
+ # @return [Integer] the index into the module table that the init routine
598
602
  # is defined in
599
603
  attr_reader :init_module
600
604
 
@@ -739,10 +743,10 @@ module MachO
739
743
  # A load command containing the offsets and sizes of the link-edit 4.3BSD
740
744
  # "stab" style symbol table information. Corresponds to LC_SYMTAB.
741
745
  class SymtabCommand < LoadCommand
742
- # @return [Fixnum] the symbol table's offset
746
+ # @return [Integer] the symbol table's offset
743
747
  attr_reader :symoff
744
748
 
745
- # @return [Fixnum] the number of symbol table entries
749
+ # @return [Integer] the number of symbol table entries
746
750
  attr_reader :nsyms
747
751
 
748
752
  # @return the string table's offset
@@ -772,58 +776,58 @@ module MachO
772
776
  # A load command containing symbolic information needed to support data
773
777
  # structures used by the dynamic link editor. Corresponds to LC_DYSYMTAB.
774
778
  class DysymtabCommand < LoadCommand
775
- # @return [Fixnum] the index to local symbols
779
+ # @return [Integer] the index to local symbols
776
780
  attr_reader :ilocalsym
777
781
 
778
- # @return [Fixnum] the number of local symbols
782
+ # @return [Integer] the number of local symbols
779
783
  attr_reader :nlocalsym
780
784
 
781
- # @return [Fixnum] the index to externally defined symbols
785
+ # @return [Integer] the index to externally defined symbols
782
786
  attr_reader :iextdefsym
783
787
 
784
- # @return [Fixnum] the number of externally defined symbols
788
+ # @return [Integer] the number of externally defined symbols
785
789
  attr_reader :nextdefsym
786
790
 
787
- # @return [Fixnum] the index to undefined symbols
791
+ # @return [Integer] the index to undefined symbols
788
792
  attr_reader :iundefsym
789
793
 
790
- # @return [Fixnum] the number of undefined symbols
794
+ # @return [Integer] the number of undefined symbols
791
795
  attr_reader :nundefsym
792
796
 
793
- # @return [Fixnum] the file offset to the table of contents
797
+ # @return [Integer] the file offset to the table of contents
794
798
  attr_reader :tocoff
795
799
 
796
- # @return [Fixnum] the number of entries in the table of contents
800
+ # @return [Integer] the number of entries in the table of contents
797
801
  attr_reader :ntoc
798
802
 
799
- # @return [Fixnum] the file offset to the module table
803
+ # @return [Integer] the file offset to the module table
800
804
  attr_reader :modtaboff
801
805
 
802
- # @return [Fixnum] the number of entries in the module table
806
+ # @return [Integer] the number of entries in the module table
803
807
  attr_reader :nmodtab
804
808
 
805
- # @return [Fixnum] the file offset to the referenced symbol table
809
+ # @return [Integer] the file offset to the referenced symbol table
806
810
  attr_reader :extrefsymoff
807
811
 
808
- # @return [Fixnum] the number of entries in the referenced symbol table
812
+ # @return [Integer] the number of entries in the referenced symbol table
809
813
  attr_reader :nextrefsyms
810
814
 
811
- # @return [Fixnum] the file offset to the indirect symbol table
815
+ # @return [Integer] the file offset to the indirect symbol table
812
816
  attr_reader :indirectsymoff
813
817
 
814
- # @return [Fixnum] the number of entries in the indirect symbol table
818
+ # @return [Integer] the number of entries in the indirect symbol table
815
819
  attr_reader :nindirectsyms
816
820
 
817
- # @return [Fixnum] the file offset to the external relocation entries
821
+ # @return [Integer] the file offset to the external relocation entries
818
822
  attr_reader :extreloff
819
823
 
820
- # @return [Fixnum] the number of external relocation entries
824
+ # @return [Integer] the number of external relocation entries
821
825
  attr_reader :nextrel
822
826
 
823
- # @return [Fixnum] the file offset to the local relocation entries
827
+ # @return [Integer] the file offset to the local relocation entries
824
828
  attr_reader :locreloff
825
829
 
826
- # @return [Fixnum] the number of local relocation entries
830
+ # @return [Integer] the number of local relocation entries
827
831
  attr_reader :nlocrel
828
832
 
829
833
  # @see MachOStructure::FORMAT
@@ -865,10 +869,10 @@ module MachO
865
869
  # A load command containing the offset and number of hints in the two-level
866
870
  # namespace lookup hints table. Corresponds to LC_TWOLEVEL_HINTS.
867
871
  class TwolevelHintsCommand < LoadCommand
868
- # @return [Fixnum] the offset to the hint table
872
+ # @return [Integer] the offset to the hint table
869
873
  attr_reader :htoffset
870
874
 
871
- # @return [Fixnum] the number of hints in the hint table
875
+ # @return [Integer] the number of hints in the hint table
872
876
  attr_reader :nhints
873
877
 
874
878
  # @return [TwolevelHintsTable]
@@ -898,8 +902,8 @@ module MachO
898
902
  attr_reader :hints
899
903
 
900
904
  # @param view [MachO::MachOView] the view into the current Mach-O
901
- # @param htoffset [Fixnum] the offset of the hints table
902
- # @param nhints [Fixnum] the number of two-level hints in the table
905
+ # @param htoffset [Integer] the offset of the hints table
906
+ # @param nhints [Integer] the number of two-level hints in the table
903
907
  # @api private
904
908
  def initialize(view, htoffset, nhints)
905
909
  format = Utils.specialize_format("L=#{nhints}", view.endianness)
@@ -911,13 +915,13 @@ module MachO
911
915
 
912
916
  # An individual two-level namespace lookup hint.
913
917
  class TwolevelHint
914
- # @return [Fixnum] the index into the sub-images
918
+ # @return [Integer] the index into the sub-images
915
919
  attr_reader :isub_image
916
920
 
917
- # @return [Fixnum] the index into the table of contents
921
+ # @return [Integer] the index into the table of contents
918
922
  attr_reader :itoc
919
923
 
920
- # @param blob [Fixnum] the 32-bit number containing the lookup hint
924
+ # @param blob [Integer] the 32-bit number containing the lookup hint
921
925
  # @api private
922
926
  def initialize(blob)
923
927
  @isub_image = blob >> 24
@@ -930,7 +934,7 @@ module MachO
930
934
  # A load command containing the value of the original checksum for prebound
931
935
  # files, or zero. Corresponds to LC_PREBIND_CKSUM.
932
936
  class PrebindCksumCommand < LoadCommand
933
- # @return [Fixnum] the checksum or 0
937
+ # @return [Integer] the checksum or 0
934
938
  attr_reader :cksum
935
939
 
936
940
  # @see MachOStructure::FORMAT
@@ -987,10 +991,10 @@ module MachO
987
991
  # LC_SEGMENT_SPLIT_INFO, LC_FUNCTION_STARTS, LC_DATA_IN_CODE,
988
992
  # LC_DYLIB_CODE_SIGN_DRS, and LC_LINKER_OPTIMIZATION_HINT.
989
993
  class LinkeditDataCommand < LoadCommand
990
- # @return [Fixnum] offset to the data in the __LINKEDIT segment
994
+ # @return [Integer] offset to the data in the __LINKEDIT segment
991
995
  attr_reader :dataoff
992
996
 
993
- # @return [Fixnum] size of the data in the __LINKEDIT segment
997
+ # @return [Integer] size of the data in the __LINKEDIT segment
994
998
  attr_reader :datasize
995
999
 
996
1000
  # @see MachOStructure::FORMAT
@@ -1012,13 +1016,13 @@ module MachO
1012
1016
  # A load command representing the offset to and size of an encrypted
1013
1017
  # segment. Corresponds to LC_ENCRYPTION_INFO.
1014
1018
  class EncryptionInfoCommand < LoadCommand
1015
- # @return [Fixnum] the offset to the encrypted segment
1019
+ # @return [Integer] the offset to the encrypted segment
1016
1020
  attr_reader :cryptoff
1017
1021
 
1018
- # @return [Fixnum] the size of the encrypted segment
1022
+ # @return [Integer] the size of the encrypted segment
1019
1023
  attr_reader :cryptsize
1020
1024
 
1021
- # @return [Fixnum] the encryption system, or 0 if not encrypted yet
1025
+ # @return [Integer] the encryption system, or 0 if not encrypted yet
1022
1026
  attr_reader :cryptid
1023
1027
 
1024
1028
  # @see MachOStructure::FORMAT
@@ -1041,16 +1045,16 @@ module MachO
1041
1045
  # A load command representing the offset to and size of an encrypted
1042
1046
  # segment. Corresponds to LC_ENCRYPTION_INFO_64.
1043
1047
  class EncryptionInfoCommand64 < LoadCommand
1044
- # @return [Fixnum] the offset to the encrypted segment
1048
+ # @return [Integer] the offset to the encrypted segment
1045
1049
  attr_reader :cryptoff
1046
1050
 
1047
- # @return [Fixnum] the size of the encrypted segment
1051
+ # @return [Integer] the size of the encrypted segment
1048
1052
  attr_reader :cryptsize
1049
1053
 
1050
- # @return [Fixnum] the encryption system, or 0 if not encrypted yet
1054
+ # @return [Integer] the encryption system, or 0 if not encrypted yet
1051
1055
  attr_reader :cryptid
1052
1056
 
1053
- # @return [Fixnum] 64-bit padding value
1057
+ # @return [Integer] 64-bit padding value
1054
1058
  attr_reader :pad
1055
1059
 
1056
1060
  # @see MachOStructure::FORMAT
@@ -1075,10 +1079,10 @@ module MachO
1075
1079
  # was built to run. Corresponds to LC_VERSION_MIN_MACOSX and
1076
1080
  # LC_VERSION_MIN_IPHONEOS.
1077
1081
  class VersionMinCommand < LoadCommand
1078
- # @return [Fixnum] the version X.Y.Z packed as x16.y8.z8
1082
+ # @return [Integer] the version X.Y.Z packed as x16.y8.z8
1079
1083
  attr_reader :version
1080
1084
 
1081
- # @return [Fixnum] the SDK version X.Y.Z packed as x16.y8.z8
1085
+ # @return [Integer] the SDK version X.Y.Z packed as x16.y8.z8
1082
1086
  attr_reader :sdk
1083
1087
 
1084
1088
  # @see MachOStructure::FORMAT
@@ -1119,38 +1123,129 @@ module MachO
1119
1123
  end
1120
1124
  end
1121
1125
 
1126
+ # A load command containing the minimum OS version on which
1127
+ # the binary was built for its platform.
1128
+ # Corresponds to LC_BUILD_VERSION.
1129
+ class BuildVersionCommand < LoadCommand
1130
+ # @return [Integer]
1131
+ attr_reader :platform
1132
+
1133
+ # @return [Integer] the minimum OS version X.Y.Z packed as x16.y8.z8
1134
+ attr_reader :minos
1135
+
1136
+ # @return [Integer] the SDK version X.Y.Z packed as x16.y8.z8
1137
+ attr_reader :sdk
1138
+
1139
+ # @return [ToolEntries] tool entries
1140
+ attr_reader :tool_entries
1141
+
1142
+ # @see MachOStructure::FORMAT
1143
+ # @api private
1144
+ FORMAT = "L=6".freeze
1145
+
1146
+ # @see MachOStructure::SIZEOF
1147
+ # @api private
1148
+ SIZEOF = 24
1149
+
1150
+ # @api private
1151
+ def initialize(view, cmd, cmdsize, platform, minos, sdk, ntools)
1152
+ super(view, cmd, cmdsize)
1153
+ @platform = platform
1154
+ @minos = minos
1155
+ @sdk = sdk
1156
+ @tool_entries = ToolEntries.new(view, ntools)
1157
+ end
1158
+
1159
+ # A representation of the tool versions exposed
1160
+ # by a {BuildVersionCommand} (`LC_BUILD_VERSION`).
1161
+ class ToolEntries
1162
+ # @return [Array<Tool>] all tools
1163
+ attr_reader :tools
1164
+
1165
+ # @param view [MachO::MachOView] the view into the current Mach-O
1166
+ # @param ntools [Integer] the number of tools
1167
+ # @api private
1168
+ def initialize(view, ntools)
1169
+ format = Utils.specialize_format("L=#{ntools * 2}", view.endianness)
1170
+ raw_table = view.raw_data[view.offset + 24, ntools * 8]
1171
+ blobs = raw_table.unpack(format).each_slice(2).to_a
1172
+
1173
+ @tools = blobs.map { |b| Tool.new(*b) }
1174
+ end
1175
+
1176
+ # An individual tool.
1177
+ class Tool
1178
+ # @return [Integer] the enum for the tool
1179
+ attr_reader :tool
1180
+
1181
+ # @return [Integer] the tool's version number
1182
+ attr_reader :version
1183
+
1184
+ # @param tool 32-bit integer
1185
+ # # @param version 32-bit integer
1186
+ # @api private
1187
+ def initialize(tool, version)
1188
+ @tool = tool
1189
+ @version = version
1190
+ end
1191
+ end
1192
+ end
1193
+
1194
+ # A string representation of the binary's minimum OS version.
1195
+ # @return [String] a string representing the minimum OS version.
1196
+ def minos_string
1197
+ binary = "%032b" % minos
1198
+ segs = [
1199
+ binary[0..15], binary[16..23], binary[24..31]
1200
+ ].map { |s| s.to_i(2) }
1201
+
1202
+ segs.join(".")
1203
+ end
1204
+
1205
+ # A string representation of the binary's SDK version.
1206
+ # @return [String] a string representing the SDK version.
1207
+ def sdk_string
1208
+ binary = "%032b" % sdk
1209
+ segs = [
1210
+ binary[0..15], binary[16..23], binary[24..31]
1211
+ ].map { |s| s.to_i(2) }
1212
+
1213
+ segs.join(".")
1214
+ end
1215
+ end
1216
+
1122
1217
  # A load command containing the file offsets and sizes of the new
1123
1218
  # compressed form of the information dyld needs to load the image.
1124
1219
  # Corresponds to LC_DYLD_INFO and LC_DYLD_INFO_ONLY.
1125
1220
  class DyldInfoCommand < LoadCommand
1126
- # @return [Fixnum] the file offset to the rebase information
1221
+ # @return [Integer] the file offset to the rebase information
1127
1222
  attr_reader :rebase_off
1128
1223
 
1129
- # @return [Fixnum] the size of the rebase information
1224
+ # @return [Integer] the size of the rebase information
1130
1225
  attr_reader :rebase_size
1131
1226
 
1132
- # @return [Fixnum] the file offset to the binding information
1227
+ # @return [Integer] the file offset to the binding information
1133
1228
  attr_reader :bind_off
1134
1229
 
1135
- # @return [Fixnum] the size of the binding information
1230
+ # @return [Integer] the size of the binding information
1136
1231
  attr_reader :bind_size
1137
1232
 
1138
- # @return [Fixnum] the file offset to the weak binding information
1233
+ # @return [Integer] the file offset to the weak binding information
1139
1234
  attr_reader :weak_bind_off
1140
1235
 
1141
- # @return [Fixnum] the size of the weak binding information
1236
+ # @return [Integer] the size of the weak binding information
1142
1237
  attr_reader :weak_bind_size
1143
1238
 
1144
- # @return [Fixnum] the file offset to the lazy binding information
1239
+ # @return [Integer] the file offset to the lazy binding information
1145
1240
  attr_reader :lazy_bind_off
1146
1241
 
1147
- # @return [Fixnum] the size of the lazy binding information
1242
+ # @return [Integer] the size of the lazy binding information
1148
1243
  attr_reader :lazy_bind_size
1149
1244
 
1150
- # @return [Fixnum] the file offset to the export information
1245
+ # @return [Integer] the file offset to the export information
1151
1246
  attr_reader :export_off
1152
1247
 
1153
- # @return [Fixnum] the size of the export information
1248
+ # @return [Integer] the size of the export information
1154
1249
  attr_reader :export_size
1155
1250
 
1156
1251
  # @see MachOStructure::FORMAT
@@ -1182,7 +1277,7 @@ module MachO
1182
1277
  # A load command containing linker options embedded in object files.
1183
1278
  # Corresponds to LC_LINKER_OPTION.
1184
1279
  class LinkerOptionCommand < LoadCommand
1185
- # @return [Fixnum] the number of strings
1280
+ # @return [Integer] the number of strings
1186
1281
  attr_reader :count
1187
1282
 
1188
1283
  # @see MachOStructure::FORMAT
@@ -1202,10 +1297,10 @@ module MachO
1202
1297
 
1203
1298
  # A load command specifying the offset of main(). Corresponds to LC_MAIN.
1204
1299
  class EntryPointCommand < LoadCommand
1205
- # @return [Fixnum] the file (__TEXT) offset of main()
1300
+ # @return [Integer] the file (__TEXT) offset of main()
1206
1301
  attr_reader :entryoff
1207
1302
 
1208
- # @return [Fixnum] if not 0, the initial stack size.
1303
+ # @return [Integer] if not 0, the initial stack size.
1209
1304
  attr_reader :stacksize
1210
1305
 
1211
1306
  # @see MachOStructure::FORMAT
@@ -1227,7 +1322,7 @@ module MachO
1227
1322
  # A load command specifying the version of the sources used to build the
1228
1323
  # binary. Corresponds to LC_SOURCE_VERSION.
1229
1324
  class SourceVersionCommand < LoadCommand
1230
- # @return [Fixnum] the version packed as a24.b10.c10.d10.e10
1325
+ # @return [Integer] the version packed as a24.b10.c10.d10.e10
1231
1326
  attr_reader :version
1232
1327
 
1233
1328
  # @see MachOStructure::FORMAT
@@ -1260,10 +1355,10 @@ module MachO
1260
1355
  # An obsolete load command containing the offset and size of the (GNU style)
1261
1356
  # symbol table information. Corresponds to LC_SYMSEG.
1262
1357
  class SymsegCommand < LoadCommand
1263
- # @return [Fixnum] the offset to the symbol segment
1358
+ # @return [Integer] the offset to the symbol segment
1264
1359
  attr_reader :offset
1265
1360
 
1266
- # @return [Fixnum] the size of the symbol segment in bytes
1361
+ # @return [Integer] the size of the symbol segment in bytes
1267
1362
  attr_reader :size
1268
1363
 
1269
1364
  # @see MachOStructure::FORMAT
@@ -1301,7 +1396,7 @@ module MachO
1301
1396
  # @return [LCStr] the pathname of the file being loaded
1302
1397
  attr_reader :name
1303
1398
 
1304
- # @return [Fixnum] the virtual address being loaded at
1399
+ # @return [Integer] the virtual address being loaded at
1305
1400
  attr_reader :header_addr
1306
1401
 
1307
1402
  # @see MachOStructure::FORMAT
@@ -1325,10 +1420,10 @@ module MachO
1325
1420
  # @return [LCStr] the library's target pathname
1326
1421
  attr_reader :name
1327
1422
 
1328
- # @return [Fixnum] the library's minor version number
1423
+ # @return [Integer] the library's minor version number
1329
1424
  attr_reader :minor_version
1330
1425
 
1331
- # @return [Fixnum] the library's header address
1426
+ # @return [Integer] the library's header address
1332
1427
  attr_reader :header_addr
1333
1428
 
1334
1429
  # @see MachOStructure::FORMAT
@@ -134,7 +134,7 @@ module MachO
134
134
  alias [] command
135
135
 
136
136
  # Inserts a load command at the given offset.
137
- # @param offset [Fixnum] the offset to insert at
137
+ # @param offset [Integer] the offset to insert at
138
138
  # @param lc [LoadCommands::LoadCommand] the load command to insert
139
139
  # @param options [Hash]
140
140
  # @option options [Boolean] :repopulate (true) whether or not to repopulate
@@ -404,11 +404,8 @@ module MachO
404
404
  # @raise [MachOError] if the instance was initialized without a file
405
405
  # @note Overwrites all data in the file!
406
406
  def write!
407
- if @filename.nil?
408
- raise MachOError, "cannot write to a default file when initialized from a binary string"
409
- else
410
- File.open(@filename, "wb") { |f| f.write(@raw_data) }
411
- end
407
+ raise MachOError, "no initial file to write to" if @filename.nil?
408
+ File.open(@filename, "wb") { |f| f.write(@raw_data) }
412
409
  end
413
410
 
414
411
  private
@@ -434,7 +431,7 @@ module MachO
434
431
  end
435
432
 
436
433
  # Read just the file's magic number and check its validity.
437
- # @return [Fixnum] the magic
434
+ # @return [Integer] the magic
438
435
  # @raise [MagicError] if the magic is not valid Mach-O magic
439
436
  # @raise [FatBinaryError] if the magic is for a Fat file
440
437
  # @api private
@@ -450,7 +447,7 @@ module MachO
450
447
  end
451
448
 
452
449
  # Check the file's CPU type.
453
- # @param cputype [Fixnum] the CPU type
450
+ # @param cputype [Integer] the CPU type
454
451
  # @raise [CPUTypeError] if the CPU type is unknown
455
452
  # @api private
456
453
  def check_cputype(cputype)
@@ -458,7 +455,7 @@ module MachO
458
455
  end
459
456
 
460
457
  # Check the file's CPU type/subtype pair.
461
- # @param cpusubtype [Fixnum] the CPU subtype
458
+ # @param cpusubtype [Integer] the CPU subtype
462
459
  # @raise [CPUSubtypeError] if the CPU sub-type is unknown
463
460
  # @api private
464
461
  def check_cpusubtype(cputype, cpusubtype)
@@ -467,7 +464,7 @@ module MachO
467
464
  end
468
465
 
469
466
  # Check the file's type.
470
- # @param filetype [Fixnum] the file type
467
+ # @param filetype [Integer] the file type
471
468
  # @raise [FiletypeError] if the file type is unknown
472
469
  # @api private
473
470
  def check_filetype(filetype)
@@ -503,7 +500,7 @@ module MachO
503
500
  end
504
501
 
505
502
  # The low file offset (offset to first section data).
506
- # @return [Fixnum] the offset
503
+ # @return [Integer] the offset
507
504
  # @api private
508
505
  def low_fileoff
509
506
  offset = @raw_data.size
@@ -523,7 +520,7 @@ module MachO
523
520
  end
524
521
 
525
522
  # Updates the number of load commands in the raw data.
526
- # @param ncmds [Fixnum] the new number of commands
523
+ # @param ncmds [Integer] the new number of commands
527
524
  # @return [void]
528
525
  # @api private
529
526
  def update_ncmds(ncmds)
@@ -533,7 +530,7 @@ module MachO
533
530
  end
534
531
 
535
532
  # Updates the size of all load commands in the raw data.
536
- # @param size [Fixnum] the new size, in bytes
533
+ # @param size [Integer] the new size, in bytes
537
534
  # @return [void]
538
535
  # @api private
539
536
  def update_sizeofcmds(size)
@@ -76,25 +76,25 @@ module MachO
76
76
  # pad bytes
77
77
  attr_reader :segname
78
78
 
79
- # @return [Fixnum] the memory address of the section
79
+ # @return [Integer] the memory address of the section
80
80
  attr_reader :addr
81
81
 
82
- # @return [Fixnum] the size, in bytes, of the section
82
+ # @return [Integer] the size, in bytes, of the section
83
83
  attr_reader :size
84
84
 
85
- # @return [Fixnum] the file offset of the section
85
+ # @return [Integer] the file offset of the section
86
86
  attr_reader :offset
87
87
 
88
- # @return [Fixnum] the section alignment (power of 2) of the section
88
+ # @return [Integer] the section alignment (power of 2) of the section
89
89
  attr_reader :align
90
90
 
91
- # @return [Fixnum] the file offset of the section's relocation entries
91
+ # @return [Integer] the file offset of the section's relocation entries
92
92
  attr_reader :reloff
93
93
 
94
- # @return [Fixnum] the number of relocation entries
94
+ # @return [Integer] the number of relocation entries
95
95
  attr_reader :nreloc
96
96
 
97
- # @return [Fixnum] flags for type and attributes of the section
97
+ # @return [Integer] flags for type and attributes of the section
98
98
  attr_reader :flags
99
99
 
100
100
  # @return [void] reserved (for offset or index)
@@ -8,11 +8,11 @@ module MachO
8
8
  FORMAT = "".freeze
9
9
 
10
10
  # The size of the data structure, in bytes.
11
- # @return [Fixnum] the size, in bytes
11
+ # @return [Integer] the size, in bytes
12
12
  # @api private
13
13
  SIZEOF = 0
14
14
 
15
- # @return [Fixnum] the size, in bytes, of the represented structure.
15
+ # @return [Integer] the size, in bytes, of the represented structure.
16
16
  def self.bytesize
17
17
  self::SIZEOF
18
18
  end
data/lib/macho/tools.rb CHANGED
@@ -88,7 +88,7 @@ module MachO
88
88
 
89
89
  # Merge multiple Mach-Os into one universal (Fat) binary.
90
90
  # @param filename [String] the fat binary to create
91
- # @param files [Array<MachO::MachOFile, MachO::FatFile>] the files to merge
91
+ # @param files [Array<String>] the files to merge
92
92
  # @return [void]
93
93
  def self.merge_machos(filename, *files)
94
94
  machos = files.map do |file|
data/lib/macho/utils.rb CHANGED
@@ -2,9 +2,9 @@ module MachO
2
2
  # A collection of utility functions used throughout ruby-macho.
3
3
  module Utils
4
4
  # Rounds a value to the next multiple of the given round.
5
- # @param value [Fixnum] the number being rounded
6
- # @param round [Fixnum] the number being rounded with
7
- # @return [Fixnum] the rounded value
5
+ # @param value [Integer] the number being rounded
6
+ # @param round [Integer] the number being rounded with
7
+ # @return [Integer] the rounded value
8
8
  # @see http://www.opensource.apple.com/source/cctools/cctools-870/libstuff/rnd.c
9
9
  def self.round(value, round)
10
10
  round -= 1
@@ -15,9 +15,9 @@ module MachO
15
15
 
16
16
  # Returns the number of bytes needed to pad the given size to the given
17
17
  # alignment.
18
- # @param size [Fixnum] the unpadded size
19
- # @param alignment [Fixnum] the number to alignment the size with
20
- # @return [Fixnum] the number of pad bytes required
18
+ # @param size [Integer] the unpadded size
19
+ # @param alignment [Integer] the number to alignment the size with
20
+ # @return [Integer] the number of pad bytes required
21
21
  def self.padding_for(size, alignment)
22
22
  round(size, alignment) - size
23
23
  end
@@ -33,9 +33,9 @@ module MachO
33
33
  end
34
34
 
35
35
  # Packs tagged strings into an aligned payload.
36
- # @param fixed_offset [Fixnum] the baseline offset for the first packed
36
+ # @param fixed_offset [Integer] the baseline offset for the first packed
37
37
  # string
38
- # @param alignment [Fixnum] the alignment value to use for packing
38
+ # @param alignment [Integer] the alignment value to use for packing
39
39
  # @param strings [Hash] the labeled strings to pack
40
40
  # @return [Array<String, Hash>] the packed string and labeled offsets
41
41
  def self.pack_strings(fixed_offset, alignment, strings = {})
@@ -55,42 +55,42 @@ module MachO
55
55
  end
56
56
 
57
57
  # Compares the given number to valid Mach-O magic numbers.
58
- # @param num [Fixnum] the number being checked
58
+ # @param num [Integer] the number being checked
59
59
  # @return [Boolean] whether `num` is a valid Mach-O magic number
60
60
  def self.magic?(num)
61
61
  Headers::MH_MAGICS.key?(num)
62
62
  end
63
63
 
64
64
  # Compares the given number to valid Fat magic numbers.
65
- # @param num [Fixnum] the number being checked
65
+ # @param num [Integer] the number being checked
66
66
  # @return [Boolean] whether `num` is a valid Fat magic number
67
67
  def self.fat_magic?(num)
68
68
  num == Headers::FAT_MAGIC
69
69
  end
70
70
 
71
71
  # Compares the given number to valid 32-bit Mach-O magic numbers.
72
- # @param num [Fixnum] the number being checked
72
+ # @param num [Integer] the number being checked
73
73
  # @return [Boolean] whether `num` is a valid 32-bit magic number
74
74
  def self.magic32?(num)
75
75
  num == Headers::MH_MAGIC || num == Headers::MH_CIGAM
76
76
  end
77
77
 
78
78
  # Compares the given number to valid 64-bit Mach-O magic numbers.
79
- # @param num [Fixnum] the number being checked
79
+ # @param num [Integer] the number being checked
80
80
  # @return [Boolean] whether `num` is a valid 64-bit magic number
81
81
  def self.magic64?(num)
82
82
  num == Headers::MH_MAGIC_64 || num == Headers::MH_CIGAM_64
83
83
  end
84
84
 
85
85
  # Compares the given number to valid little-endian magic numbers.
86
- # @param num [Fixnum] the number being checked
86
+ # @param num [Integer] the number being checked
87
87
  # @return [Boolean] whether `num` is a valid little-endian magic number
88
88
  def self.little_magic?(num)
89
89
  num == Headers::MH_CIGAM || num == Headers::MH_CIGAM_64
90
90
  end
91
91
 
92
92
  # Compares the given number to valid big-endian magic numbers.
93
- # @param num [Fixnum] the number being checked
93
+ # @param num [Integer] the number being checked
94
94
  # @return [Boolean] whether `num` is a valid big-endian magic number
95
95
  def self.big_magic?(num)
96
96
  num == Headers::MH_CIGAM || num == Headers::MH_CIGAM_64
data/lib/macho/view.rb CHANGED
@@ -7,13 +7,13 @@ module MachO
7
7
  # @return [Symbol] the endianness of the data (`:big` or `:little`)
8
8
  attr_reader :endianness
9
9
 
10
- # @return [Fixnum] the offset of the relevant data (in {#raw_data})
10
+ # @return [Integer] the offset of the relevant data (in {#raw_data})
11
11
  attr_reader :offset
12
12
 
13
13
  # Creates a new MachOView.
14
14
  # @param raw_data [String] the raw Mach-O data
15
15
  # @param endianness [Symbol] the endianness of the data
16
- # @param offset [Fixnum] the offset of the relevant data
16
+ # @param offset [Integer] the offset of the relevant data
17
17
  def initialize(raw_data, endianness, offset)
18
18
  @raw_data = raw_data
19
19
  @endianness = endianness
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: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Woodruff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-26 00:00:00.000000000 Z
11
+ date: 2018-06-06 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
@@ -50,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
50
  version: '0'
51
51
  requirements: []
52
52
  rubyforge_project:
53
- rubygems_version: 2.6.8
53
+ rubygems_version: 2.7.6
54
54
  signing_key:
55
55
  specification_version: 4
56
56
  summary: ruby-macho - Mach-O file analyzer.