Skip to content

Commit

Permalink
fix: 32bit systems support №2
Browse files Browse the repository at this point in the history
change other usages to int64
  • Loading branch information
aiexz committed Jan 21, 2024
1 parent d870d1e commit 666c9a7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

type ErrResponseCode struct {
Code int
Code int64
Message string
Description string
AdditionalInfo any // some errors has additional data like timeout seconds, dc id etc.
Expand All @@ -32,7 +32,7 @@ func RpcErrorToNative(r *objects.RpcError) error {
}

return &ErrResponseCode{
Code: int(r.ErrorCode),
Code: int64(r.ErrorCode),
Message: nativeErrorName,
Description: desc,
AdditionalInfo: additionalData,
Expand Down
6 changes: 3 additions & 3 deletions internal/transport/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (t *transport) ReadMsg() (messages.Common, error) {
}

if len(data) == tl.WordLen {
code := int(binary.LittleEndian.Uint32(data))
code := int64(binary.LittleEndian.Uint32(data))
return nil, ErrCode(code)
}

Expand Down Expand Up @@ -121,8 +121,8 @@ func isPacketEncrypted(data []byte) bool {
return binary.LittleEndian.Uint64(authKeyHash) != 0
}

type ErrCode int
type ErrCode int64

func (e ErrCode) Error() string {
return fmt.Sprintf("code %v", int(e))
return fmt.Sprintf("code %v", int64(e))
}
2 changes: 1 addition & 1 deletion mtproto.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ func (m *MTProto) readMsg() error {
response, err := m.transport.ReadMsg()
if err != nil {
if e, ok := err.(transport.ErrCode); ok {
return &ErrResponseCode{Code: int(e)}
return &ErrResponseCode{Code: int64(e)}
}
switch err {
case io.EOF, context.Canceled:
Expand Down

0 comments on commit 666c9a7

Please sign in to comment.