Update dependencies (#2180)
Some checks failed
Development / golangci-lint (push) Has been cancelled
Development / test-build-upload (1.22.x, ubuntu-latest) (push) Has been cancelled

* Update dependencies

* Fix whatsmeow API changes
This commit is contained in:
Wim
2024-08-27 19:04:05 +02:00
committed by GitHub
parent d16645c952
commit c4157a4d5b
589 changed files with 681707 additions and 198856 deletions

View File

@@ -1,5 +1,5 @@
//go:build (linux || darwin || dragonfly || freebsd || netbsd || openbsd) && !appengine && !tinygo
// +build linux darwin dragonfly freebsd netbsd openbsd
//go:build (linux || darwin || dragonfly || freebsd || illumos || netbsd || openbsd) && !appengine && !tinygo
// +build linux darwin dragonfly freebsd illumos netbsd openbsd
// +build !appengine
// +build !tinygo

View File

@@ -4,7 +4,7 @@
package msgp
import (
"io/ioutil"
"io"
"os"
)
@@ -21,7 +21,7 @@ func ReadFile(dst Unmarshaler, file *os.File) error {
return u.DecodeMsg(NewReader(file))
}
data, err := ioutil.ReadAll(file)
data, err := io.ReadAll(file)
if err != nil {
return err
}

View File

@@ -1,5 +1,7 @@
package msgp
import "encoding/binary"
/* ----------------------------------
integer encoding utilities
(inline-able)
@@ -11,6 +13,8 @@ package msgp
---------------------------------- */
func putMint64(b []byte, i int64) {
_ = b[8] // bounds check elimination
b[0] = mint64
b[1] = byte(i >> 56)
b[2] = byte(i >> 48)
@@ -23,6 +27,8 @@ func putMint64(b []byte, i int64) {
}
func getMint64(b []byte) int64 {
_ = b[8] // bounds check elimination
return (int64(b[1]) << 56) | (int64(b[2]) << 48) |
(int64(b[3]) << 40) | (int64(b[4]) << 32) |
(int64(b[5]) << 24) | (int64(b[6]) << 16) |
@@ -30,6 +36,8 @@ func getMint64(b []byte) int64 {
}
func putMint32(b []byte, i int32) {
_ = b[4] // bounds check elimination
b[0] = mint32
b[1] = byte(i >> 24)
b[2] = byte(i >> 16)
@@ -38,20 +46,28 @@ func putMint32(b []byte, i int32) {
}
func getMint32(b []byte) int32 {
_ = b[4] // bounds check elimination
return (int32(b[1]) << 24) | (int32(b[2]) << 16) | (int32(b[3]) << 8) | (int32(b[4]))
}
func putMint16(b []byte, i int16) {
_ = b[2] // bounds check elimination
b[0] = mint16
b[1] = byte(i >> 8)
b[2] = byte(i)
}
func getMint16(b []byte) (i int16) {
_ = b[2] // bounds check elimination
return (int16(b[1]) << 8) | int16(b[2])
}
func putMint8(b []byte, i int8) {
_ = b[1] // bounds check elimination
b[0] = mint8
b[1] = byte(i)
}
@@ -61,6 +77,8 @@ func getMint8(b []byte) (i int8) {
}
func putMuint64(b []byte, u uint64) {
_ = b[8] // bounds check elimination
b[0] = muint64
b[1] = byte(u >> 56)
b[2] = byte(u >> 48)
@@ -73,6 +91,8 @@ func putMuint64(b []byte, u uint64) {
}
func getMuint64(b []byte) uint64 {
_ = b[8] // bounds check elimination
return (uint64(b[1]) << 56) | (uint64(b[2]) << 48) |
(uint64(b[3]) << 40) | (uint64(b[4]) << 32) |
(uint64(b[5]) << 24) | (uint64(b[6]) << 16) |
@@ -80,6 +100,8 @@ func getMuint64(b []byte) uint64 {
}
func putMuint32(b []byte, u uint32) {
_ = b[4] // bounds check elimination
b[0] = muint32
b[1] = byte(u >> 24)
b[2] = byte(u >> 16)
@@ -88,20 +110,28 @@ func putMuint32(b []byte, u uint32) {
}
func getMuint32(b []byte) uint32 {
_ = b[4] // bounds check elimination
return (uint32(b[1]) << 24) | (uint32(b[2]) << 16) | (uint32(b[3]) << 8) | (uint32(b[4]))
}
func putMuint16(b []byte, u uint16) {
_ = b[2] // bounds check elimination
b[0] = muint16
b[1] = byte(u >> 8)
b[2] = byte(u)
}
func getMuint16(b []byte) uint16 {
_ = b[2] // bounds check elimination
return (uint16(b[1]) << 8) | uint16(b[2])
}
func putMuint8(b []byte, u uint8) {
_ = b[1] // bounds check elimination
b[0] = muint8
b[1] = byte(u)
}
@@ -111,28 +141,15 @@ func getMuint8(b []byte) uint8 {
}
func getUnix(b []byte) (sec int64, nsec int32) {
sec = (int64(b[0]) << 56) | (int64(b[1]) << 48) |
(int64(b[2]) << 40) | (int64(b[3]) << 32) |
(int64(b[4]) << 24) | (int64(b[5]) << 16) |
(int64(b[6]) << 8) | (int64(b[7]))
sec = int64(binary.BigEndian.Uint64(b))
nsec = int32(binary.BigEndian.Uint32(b[8:]))
nsec = (int32(b[8]) << 24) | (int32(b[9]) << 16) | (int32(b[10]) << 8) | (int32(b[11]))
return
}
func putUnix(b []byte, sec int64, nsec int32) {
b[0] = byte(sec >> 56)
b[1] = byte(sec >> 48)
b[2] = byte(sec >> 40)
b[3] = byte(sec >> 32)
b[4] = byte(sec >> 24)
b[5] = byte(sec >> 16)
b[6] = byte(sec >> 8)
b[7] = byte(sec)
b[8] = byte(nsec >> 24)
b[9] = byte(nsec >> 16)
b[10] = byte(nsec >> 8)
b[11] = byte(nsec)
binary.BigEndian.PutUint64(b, uint64(sec))
binary.BigEndian.PutUint32(b[8:], uint32(nsec))
}
/* -----------------------------
@@ -141,12 +158,16 @@ func putUnix(b []byte, sec int64, nsec int32) {
// write prefix and uint8
func prefixu8(b []byte, pre byte, sz uint8) {
_ = b[1] // bounds check elimination
b[0] = pre
b[1] = byte(sz)
}
// write prefix and big-endian uint16
func prefixu16(b []byte, pre byte, sz uint16) {
_ = b[2] // bounds check elimination
b[0] = pre
b[1] = byte(sz >> 8)
b[2] = byte(sz)
@@ -154,6 +175,8 @@ func prefixu16(b []byte, pre byte, sz uint16) {
// write prefix and big-endian uint32
func prefixu32(b []byte, pre byte, sz uint32) {
_ = b[4] // bounds check elimination
b[0] = pre
b[1] = byte(sz >> 24)
b[2] = byte(sz >> 16)
@@ -162,6 +185,8 @@ func prefixu32(b []byte, pre byte, sz uint32) {
}
func prefixu64(b []byte, pre byte, sz uint64) {
_ = b[8] // bounds check elimination
b[0] = pre
b[1] = byte(sz >> 56)
b[2] = byte(sz >> 48)

View File

@@ -1266,7 +1266,7 @@ func (m *Reader) ReadTime() (t time.Time, err error) {
return
}
// ReadIntf reads out the next object as a raw interface{}.
// ReadIntf reads out the next object as a raw interface{}/any.
// Arrays are decoded as []interface{}, and maps are decoded
// as map[string]interface{}. Integers are decoded as int64
// and unsigned integers are decoded as uint64.

View File

@@ -1,6 +1,7 @@
package msgp
import (
"errors"
"math"
"reflect"
"time"
@@ -342,10 +343,10 @@ func AppendMapStrIntf(b []byte, m map[string]interface{}) ([]byte, error) {
// provided []byte. 'i' must be one of the following:
// - 'nil'
// - A bool, float, string, []byte, int, uint, or complex
// - A map[string]interface{} or map[string]string
// - A map[string]T where T is another supported type
// - A []T, where T is another supported type
// - A *T, where T is another supported type
// - A type that satisfieds the msgp.Marshaler interface
// - A type that satisfies the msgp.Marshaler interface
// - A type that satisfies the msgp.Extension interface
func AppendIntf(b []byte, i interface{}) ([]byte, error) {
if i == nil {
@@ -395,6 +396,8 @@ func AppendIntf(b []byte, i interface{}) ([]byte, error) {
return AppendUint64(b, i), nil
case time.Time:
return AppendTime(b, i), nil
case time.Duration:
return AppendDuration(b, i), nil
case map[string]interface{}:
return AppendMapStrIntf(b, i)
case map[string]string:
@@ -414,6 +417,21 @@ func AppendIntf(b []byte, i interface{}) ([]byte, error) {
var err error
v := reflect.ValueOf(i)
switch v.Kind() {
case reflect.Map:
if v.Type().Key().Kind() != reflect.String {
return b, errors.New("msgp: map keys must be strings")
}
ks := v.MapKeys()
b = AppendMapHeader(b, uint32(len(ks)))
for _, key := range ks {
val := v.MapIndex(key)
b = AppendString(b, key.String())
b, err = AppendIntf(b, val.Interface())
if err != nil {
return nil, err
}
}
return b, nil
case reflect.Array, reflect.Slice:
l := v.Len()
b = AppendArrayHeader(b, uint32(l))