Skip to content

Commit

Permalink
Merge pull request #470 from pkg/hotfix/constants-overflow-implicit-3…
Browse files Browse the repository at this point in the history
…2bit-types

Need to type constants that overflow `int` on 32-bit archs
  • Loading branch information
puellanivis authored Sep 26, 2021
2 parents ec1ca37 + f36d79f commit 42e9800
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 32 deletions.
18 changes: 9 additions & 9 deletions internal/encoding/ssh/filexfer/attrs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (

func TestAttributes(t *testing.T) {
const (
size = 0x123456789ABCDEF0
uid = 1000
gid = 100
perms = 0x87654321
atime = 0x2A2B2C2D
mtime = 0x42434445
size uint64 = 0x123456789ABCDEF0
uid = 1000
gid = 100
perms FileMode = 0x87654321
atime = 0x2A2B2C2D
mtime = 0x42434445
)

extAttr := ExtendedAttribute{
Expand Down Expand Up @@ -177,9 +177,9 @@ func TestAttributes(t *testing.T) {

func TestNameEntry(t *testing.T) {
const (
filename = "foo"
longname = "bar"
perms = 0x87654321
filename = "foo"
longname = "bar"
perms FileMode = 0x87654321
)

e := &NameEntry{
Expand Down
14 changes: 7 additions & 7 deletions internal/encoding/ssh/filexfer/handle_packets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ var _ Packet = &ReadPacket{}

func TestReadPacket(t *testing.T) {
const (
id = 42
handle = "somehandle"
offset = 0x123456789ABCDEF0
length = 0xFEDCBA98
id = 42
handle = "somehandle"
offset uint64 = 0x123456789ABCDEF0
length uint32 = 0xFEDCBA98
)

p := &ReadPacket{
Expand Down Expand Up @@ -103,9 +103,9 @@ var _ Packet = &WritePacket{}

func TestWritePacket(t *testing.T) {
const (
id = 42
handle = "somehandle"
offset = 0x123456789ABCDEF0
id = 42
handle = "somehandle"
offset uint64 = 0x123456789ABCDEF0
)

var payload = []byte(`foobar`)
Expand Down
6 changes: 3 additions & 3 deletions internal/encoding/ssh/filexfer/open_packets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ var _ Packet = &OpenPacket{}

func TestOpenPacket(t *testing.T) {
const (
id = 42
filename = "/foo"
perms = 0x87654321
id = 42
filename = "/foo"
perms FileMode = 0x87654321
)

p := &OpenPacket{
Expand Down
12 changes: 6 additions & 6 deletions internal/encoding/ssh/filexfer/path_packets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ var _ Packet = &SetstatPacket{}

func TestSetstatPacket(t *testing.T) {
const (
id = 42
path = "/foo"
perms = 0x87654321
id = 42
path = "/foo"
perms FileMode = 0x87654321
)

p := &SetstatPacket{
Expand Down Expand Up @@ -144,9 +144,9 @@ var _ Packet = &MkdirPacket{}

func TestMkdirPacket(t *testing.T) {
const (
id = 42
path = "/foo"
perms = 0x87654321
id = 42
path = "/foo"
perms FileMode = 0x87654321
)

p := &MkdirPacket{
Expand Down
14 changes: 7 additions & 7 deletions internal/encoding/ssh/filexfer/response_packets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ var _ Packet = &NamePacket{}

func TestNamePacket(t *testing.T) {
const (
id = 42
filename = "foo"
longname = "bar"
perms = 0x87654300
id = 42
filename = "foo"
longname = "bar"
perms FileMode = 0x87654300
)

p := &NamePacket{
Expand Down Expand Up @@ -241,7 +241,7 @@ func TestNamePacket(t *testing.T) {
t.Errorf("UnmarshalBinary(): Entries[%d].Attrs.Flags was %#x, but expected %#x", i, got, want)
}

if got, want := e.Attrs.Permissions, FileMode(perms|(i+1)); got != want {
if got, want := e.Attrs.Permissions, perms|FileMode(i+1); got != want {
t.Errorf("UnmarshalBinary(): Entries[%d].Attrs.Permissions was %#v, but expected %#v", i, got, want)
}
}
Expand All @@ -251,8 +251,8 @@ var _ Packet = &AttrsPacket{}

func TestAttrsPacket(t *testing.T) {
const (
id = 42
perms = 0x87654321
id = 42
perms FileMode = 0x87654321
)

p := &AttrsPacket{
Expand Down

0 comments on commit 42e9800

Please sign in to comment.