Skip to content

Commit

Permalink
Fixes archivist on 32-bit architectures (arm)
Browse files Browse the repository at this point in the history
  • Loading branch information
nullstyle committed Aug 17, 2016
1 parent a6ceb8b commit 0ad8bac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions tools/stellar-archivist/internal/xdrstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,13 @@ func (x *XdrStream) ReadOne(in interface{}) error {
func WriteFramedXdr(out io.Writer, in interface{}) error {
var tmp bytes.Buffer
n, err := xdr.Marshal(&tmp, in)
if n > 0x7fffffff {
un := uint32(n)
if un > 0x7fffffff {
return fmt.Errorf("Overlong write: %d bytes", n)
}
nbytes := uint32(n | 0x80000000)
binary.Write(out, binary.BigEndian, &nbytes)

un = un | 0x80000000
binary.Write(out, binary.BigEndian, &un)
k, err := tmp.WriteTo(out)
if int64(n) != k {
return fmt.Errorf("Mismatched write length: %d vs. %d", n, k)
Expand Down
6 changes: 3 additions & 3 deletions tools/stellar-archivist/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func status(a string, opts *Options) {

type Options struct {
Low int
High int
High uint32
Last int
Profile bool
CommandOpts archivist.CommandOptions
Expand Down Expand Up @@ -124,10 +124,10 @@ func main() {
"first ledger to act on",
)

rootCmd.PersistentFlags().IntVar(
rootCmd.PersistentFlags().Uint32Var(
&opts.High,
"high",
0xffffffff,
uint32(0xffffffff),
"last ledger to act on",
)

Expand Down

0 comments on commit 0ad8bac

Please sign in to comment.