diff options
author | Himbeer <himbeer@disroot.org> | 2025-01-24 16:12:07 +0100 |
---|---|---|
committer | Himbeer <himbeer@disroot.org> | 2025-01-24 16:16:07 +0100 |
commit | b2c1ec5b4f2afecf43ccb59a68684e68b8706431 (patch) | |
tree | 56a52eb568807faca153ff5021b5d28e8d567c1f | |
parent | 7b8575f6d8b9829f55187efdc135ee704bc69342 (diff) |
Fix ToCltMediaPush.ShouldCache position and logic inversion
Revert "Add README with compiler downgrade note"
This reverts commit df181fce5c1548f1db6ce5d7e74274fe638a767c.
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | serialize.go | 56 | ||||
-rw-r--r-- | tocltcmds.go | 2 |
3 files changed, 29 insertions, 33 deletions
diff --git a/README.md b/README.md deleted file mode 100644 index 23fe340..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# mt - -IMPORTANT: The serialization generator fails if built with Go > 1.21.6 -for unknown reasons. The generated code works fine with later versions. diff --git a/serialize.go b/serialize.go index 40677d6..66d7bcf 100644 --- a/serialize.go +++ b/serialize.go @@ -2617,8 +2617,8 @@ func (obj *ToCltMediaPush) serialize(w io.Writer) { //mt:const uint16(sha1.Size) SHA1 [sha1.Size]byte Filename string + Ephemeral bool CallbackToken uint32 - ShouldCache bool }))(obj)).SHA1)[:]) chk(err) } @@ -2626,8 +2626,8 @@ func (obj *ToCltMediaPush) serialize(w io.Writer) { //mt:const uint16(sha1.Size) SHA1 [sha1.Size]byte Filename string + Ephemeral bool CallbackToken uint32 - ShouldCache bool }))(obj)).Filename))) > math.MaxUint16 { chk(ErrTooLong) } @@ -2636,8 +2636,8 @@ func (obj *ToCltMediaPush) serialize(w io.Writer) { //mt:const uint16(sha1.Size) SHA1 [sha1.Size]byte Filename string + Ephemeral bool CallbackToken uint32 - ShouldCache bool }))(obj)).Filename)))) write16(w, uint16(x)) } @@ -2646,8 +2646,8 @@ func (obj *ToCltMediaPush) serialize(w io.Writer) { //mt:const uint16(sha1.Size) SHA1 [sha1.Size]byte Filename string + Ephemeral bool CallbackToken uint32 - ShouldCache bool }))(obj)).Filename))[:]) chk(err) } @@ -2656,24 +2656,24 @@ func (obj *ToCltMediaPush) serialize(w io.Writer) { //mt:const uint16(sha1.Size) SHA1 [sha1.Size]byte Filename string + Ephemeral bool CallbackToken uint32 - ShouldCache bool - }))(obj)).CallbackToken - write32(w, uint32(x)) + }))(obj)).Ephemeral + if x { + write8(w, 1) + } else { + write8(w, 0) + } } { x := (*(*(struct { //mt:const uint16(sha1.Size) SHA1 [sha1.Size]byte Filename string + Ephemeral bool CallbackToken uint32 - ShouldCache bool - }))(obj)).ShouldCache - if x { - write8(w, 1) - } else { - write8(w, 0) - } + }))(obj)).CallbackToken + write32(w, uint32(x)) } } @@ -2694,8 +2694,8 @@ func (obj *ToCltMediaPush) deserialize(r io.Reader) { //mt:const uint16(sha1.Size) SHA1 [sha1.Size]byte Filename string + Ephemeral bool CallbackToken uint32 - ShouldCache bool }))(obj)).SHA1)[:]) chk(err) } @@ -2714,27 +2714,17 @@ func (obj *ToCltMediaPush) deserialize(r io.Reader) { //mt:const uint16(sha1.Size) SHA1 [sha1.Size]byte Filename string + Ephemeral bool CallbackToken uint32 - ShouldCache bool }))(obj)).Filename) = string(local79) { p := &(*(*(struct { //mt:const uint16(sha1.Size) SHA1 [sha1.Size]byte Filename string + Ephemeral bool CallbackToken uint32 - ShouldCache bool - }))(obj)).CallbackToken - *p = read32(r) - } - { - p := &(*(*(struct { - //mt:const uint16(sha1.Size) - SHA1 [sha1.Size]byte - Filename string - CallbackToken uint32 - ShouldCache bool - }))(obj)).ShouldCache + }))(obj)).Ephemeral switch n := read8(r); n { case 0: *p = false @@ -2744,6 +2734,16 @@ func (obj *ToCltMediaPush) deserialize(r io.Reader) { chk(fmt.Errorf("invalid bool: %d", n)) } } + { + p := &(*(*(struct { + //mt:const uint16(sha1.Size) + SHA1 [sha1.Size]byte + Filename string + Ephemeral bool + CallbackToken uint32 + }))(obj)).CallbackToken + *p = read32(r) + } } func (obj *ToCltChatMsg) serialize(w io.Writer) { diff --git a/tocltcmds.go b/tocltcmds.go index 2358379..e993e68 100644 --- a/tocltcmds.go +++ b/tocltcmds.go @@ -183,8 +183,8 @@ type ToCltMediaPush struct { //mt:const uint16(sha1.Size) SHA1 [sha1.Size]byte Filename string + Ephemeral bool CallbackToken uint32 - ShouldCache bool } // ToCltChatMsg tells the client that is has received a chat message. |