From 666c9a7325df73e0ae694de54becdb0f37cc8686 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 21 Jan 2024 18:46:08 +0300 Subject: [PATCH] =?UTF-8?q?fix:=2032bit=20systems=20support=20=E2=84=962?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit change other usages to int64 --- errors.go | 4 ++-- internal/transport/transport.go | 6 +++--- mtproto.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/errors.go b/errors.go index b90529c5..23ae831a 100755 --- a/errors.go +++ b/errors.go @@ -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. @@ -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, diff --git a/internal/transport/transport.go b/internal/transport/transport.go index 37e08a9f..2421891d 100755 --- a/internal/transport/transport.go +++ b/internal/transport/transport.go @@ -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) } @@ -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)) } diff --git a/mtproto.go b/mtproto.go index 8994e956..953a5972 100755 --- a/mtproto.go +++ b/mtproto.go @@ -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: