Padding on a list is on the length of the list.
There was a bug where padding was being computed on each element of the list. Close #5.
This commit is contained in:
@@ -295,9 +295,9 @@ func CrtcChangeListBytes(buf []byte, list []CrtcChange) int {
|
||||
for _, item := range list {
|
||||
structBytes = item.Bytes()
|
||||
copy(buf[b:], structBytes)
|
||||
b += xgb.Pad(len(structBytes))
|
||||
b += len(structBytes)
|
||||
}
|
||||
return b
|
||||
return xgb.Pad(b)
|
||||
}
|
||||
|
||||
type Mode uint32
|
||||
@@ -453,11 +453,17 @@ func ModeInfoListBytes(buf []byte, list []ModeInfo) int {
|
||||
for _, item := range list {
|
||||
structBytes = item.Bytes()
|
||||
copy(buf[b:], structBytes)
|
||||
b += xgb.Pad(len(structBytes))
|
||||
b += len(structBytes)
|
||||
}
|
||||
return b
|
||||
return xgb.Pad(b)
|
||||
}
|
||||
|
||||
const (
|
||||
NotifyCrtcChange = 0
|
||||
NotifyOutputChange = 1
|
||||
NotifyOutputProperty = 2
|
||||
)
|
||||
|
||||
// Notify is the event number for a NotifyEvent.
|
||||
const Notify = 1
|
||||
|
||||
@@ -526,12 +532,6 @@ func init() {
|
||||
xgb.NewExtEventFuncs["RANDR"][1] = NotifyEventNew
|
||||
}
|
||||
|
||||
const (
|
||||
NotifyCrtcChange = 0
|
||||
NotifyOutputChange = 1
|
||||
NotifyOutputProperty = 2
|
||||
)
|
||||
|
||||
// NotifyDataUnion is a represention of the NotifyDataUnion union type.
|
||||
// Note that to *create* a Union, you should *never* create
|
||||
// this struct directly (unless you know what you're doing).
|
||||
@@ -809,9 +809,9 @@ func OutputChangeListBytes(buf []byte, list []OutputChange) int {
|
||||
for _, item := range list {
|
||||
structBytes = item.Bytes()
|
||||
copy(buf[b:], structBytes)
|
||||
b += xgb.Pad(len(structBytes))
|
||||
b += len(structBytes)
|
||||
}
|
||||
return b
|
||||
return xgb.Pad(b)
|
||||
}
|
||||
|
||||
type OutputProperty struct {
|
||||
@@ -889,9 +889,9 @@ func OutputPropertyListBytes(buf []byte, list []OutputProperty) int {
|
||||
for _, item := range list {
|
||||
structBytes = item.Bytes()
|
||||
copy(buf[b:], structBytes)
|
||||
b += xgb.Pad(len(structBytes))
|
||||
b += len(structBytes)
|
||||
}
|
||||
return b
|
||||
return xgb.Pad(b)
|
||||
}
|
||||
|
||||
type RefreshRates struct {
|
||||
@@ -950,9 +950,9 @@ func RefreshRatesListBytes(buf []byte, list []RefreshRates) int {
|
||||
for _, item := range list {
|
||||
structBytes = item.Bytes()
|
||||
copy(buf[b:], structBytes)
|
||||
b += xgb.Pad(len(structBytes))
|
||||
b += len(structBytes)
|
||||
}
|
||||
return b
|
||||
return xgb.Pad(b)
|
||||
}
|
||||
|
||||
// RefreshRatesListSize computes the size (bytes) of a list of RefreshRates values.
|
||||
@@ -1174,9 +1174,9 @@ func ScreenSizeListBytes(buf []byte, list []ScreenSize) int {
|
||||
for _, item := range list {
|
||||
structBytes = item.Bytes()
|
||||
copy(buf[b:], structBytes)
|
||||
b += xgb.Pad(len(structBytes))
|
||||
b += len(structBytes)
|
||||
}
|
||||
return b
|
||||
return xgb.Pad(b)
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user