This commit is contained in:
nganhkhoa 2024-01-10 15:56:32 +07:00 committed by cocay
parent 62daeb1c52
commit 62fa58f039
5 changed files with 106 additions and 108 deletions

View File

@ -1,16 +1,15 @@
package macho package macho
import ( import (
"fmt"
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"fmt"
"io" "io"
"strings" "strings"
. "ios-wrapper/pkg/ios" . "ios-wrapper/pkg/ios"
) )
type SpecialSelector struct { type SpecialSelector struct {
idx uint idx uint
name string name string
@ -63,7 +62,7 @@ func (mc *MachoContext) CollectSpecialSelectors() []*SpecialSelector {
buffer := bytes.NewReader(selectors_buffer) buffer := bytes.NewReader(selectors_buffer)
for i := uint(0); i < uint(section.Size()) / 8; i++ { for i := uint(0); i < uint(section.Size())/8; i++ {
// this field is actually a Rebase // this field is actually a Rebase
// we assume that no rebase is needed // we assume that no rebase is needed
// so everything sticks to its file offset // so everything sticks to its file offset
@ -72,7 +71,7 @@ func (mc *MachoContext) CollectSpecialSelectors() []*SpecialSelector {
var name_builder strings.Builder var name_builder strings.Builder
for j := uint32(0); ; j++ { for j := uint32(0); ; j++ {
c := methods[offset - methname_offset + j] c := methods[offset-methname_offset+j]
if c == 0 { if c == 0 {
break break
} }
@ -362,4 +361,3 @@ func (mc *MachoContext) ReworkForObjc() {
offset += 4 offset += 4
} }
} }