Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-macho-2.5.1/lib/macho/macho_file.rb
# Replace a load command with another command in the Mach-O, preserving location.
# @param old_lc [LoadCommands::LoadCommand] the load command being replaced
# @param new_lc [LoadCommands::LoadCommand] the load command being added
# @return [void]
# @raise [HeaderPadError] if the new command exceeds the header pad buffer
# @see #insert_command
# @note This is public, but methods like {#dylib_id=} should be preferred.
Replace a load command with another command in the Mach-O, preserving location.
Replace a load command with another command in the Mach - O preserving location .
def replace_command(old_lc, new_lc)
      context = LoadCommands::LoadCommand::SerializationContext.context_for(self)
      cmd_raw = new_lc.serialize(context)
      new_sizeofcmds = sizeofcmds + cmd_raw.bytesize - old_lc.cmdsize
      raise HeaderPadError, @filename if header.class.bytesize + new_sizeofcmds > low_fileoff
      delete_command(old_lc)
      insert_command(old_lc.view.offset, new_lc)
    end
def replace_command ( old_lc , new_lc ) context = LoadCommands :: LoadCommand :: SerializationContext . context_for ( self ) cmd_raw = new_lc . serialize ( context ) new_sizeofcmds = sizeofcmds + cmd_raw . bytesize - old_lc . cmdsize raise HeaderPadError , @filename if header . class . bytesize + new_sizeofcmds > low_fileoff delete_command ( old_lc ) insert_command ( old_lc . view . offset , new_lc ) end
Replace a load command with another command in the Mach-O, preserving location.
Replace a load command with another command in the Mach - O preserving location .
None
void
[HeaderPadError] if the new command exceeds the header pad buffer
[ HeaderPadError ] if the new command exceeds the header pad buffer
old_lc
the load command being replaced
the load command being replaced
new_lc
the load command being added
the load command being added
see
None
note
This is public, but methods like {#dylib_id=} should be preferred.
This is public but methods like { #dylib_id = } should be preferred .