本文整理汇总了Golang中github.com/BurntSushi/xgb.Pad函数的典型用法代码示例。如果您正苦于以下问题:Golang Pad函数的具体用法?Golang Pad怎么用?Golang Pad使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Pad函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: unregisterClientsRequest
// Write request to wire for UnregisterClients
// unregisterClientsRequest writes a UnregisterClients request to a byte slice.
func unregisterClientsRequest(c *xgb.Conn, Context Context, NumClientSpecs uint32, ClientSpecs []ClientSpec) []byte {
size := xgb.Pad((12 + xgb.Pad((int(NumClientSpecs) * 4))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RECORD"]
b += 1
buf[b] = 3 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Context))
b += 4
xgb.Put32(buf[b:], NumClientSpecs)
b += 4
for i := 0; i < int(NumClientSpecs); i++ {
xgb.Put32(buf[b:], uint32(ClientSpecs[i]))
b += 4
}
b = xgb.Pad(b)
return buf
}
开发者ID:rjmcguire,项目名称:xgb,代码行数:30,代码来源:record.go
示例2: queryResourceBytesRequest
// Write request to wire for QueryResourceBytes
// queryResourceBytesRequest writes a QueryResourceBytes request to a byte slice.
func queryResourceBytesRequest(c *xgb.Conn, Client uint32, NumSpecs uint32, Specs []ResourceIdSpec) []byte {
size := xgb.Pad((12 + xgb.Pad((int(NumSpecs) * 8))))
b := 0
buf := make([]byte, size)
c.ExtLock.RLock()
buf[b] = c.Extensions["X-Resource"]
c.ExtLock.RUnlock()
b += 1
buf[b] = 5 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], Client)
b += 4
xgb.Put32(buf[b:], NumSpecs)
b += 4
b += ResourceIdSpecListBytes(buf[b:], Specs)
return buf
}
开发者ID:BurntSushi,项目名称:xgb,代码行数:28,代码来源:res.go
示例3: getBuffersWithFormatRequest
// Write request to wire for GetBuffersWithFormat
// getBuffersWithFormatRequest writes a GetBuffersWithFormat request to a byte slice.
func getBuffersWithFormatRequest(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, Attachments []AttachFormat) []byte {
size := xgb.Pad((12 + xgb.Pad((len(Attachments) * 8))))
b := 0
buf := make([]byte, size)
c.ExtLock.RLock()
buf[b] = c.Extensions["DRI2"]
c.ExtLock.RUnlock()
b += 1
buf[b] = 7 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Drawable))
b += 4
xgb.Put32(buf[b:], Count)
b += 4
b += AttachFormatListBytes(buf[b:], Attachments)
return buf
}
开发者ID:BurntSushi,项目名称:xgb,代码行数:28,代码来源:dri2.go
示例4: getBuffersRequest
// Write request to wire for GetBuffers
// getBuffersRequest writes a GetBuffers request to a byte slice.
func getBuffersRequest(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, Attachments []uint32) []byte {
size := xgb.Pad((12 + xgb.Pad((len(Attachments) * 4))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["DRI2"]
b += 1
buf[b] = 5 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Drawable))
b += 4
xgb.Put32(buf[b:], Count)
b += 4
for i := 0; i < int(len(Attachments)); i++ {
xgb.Put32(buf[b:], Attachments[i])
b += 4
}
b = xgb.Pad(b)
return buf
}
开发者ID:varialus,项目名称:xgb,代码行数:30,代码来源:dri2.go
示例5: setAttributesRequest
// Write request to wire for SetAttributes
// setAttributesRequest writes a SetAttributes request to a byte slice.
func setAttributesRequest(c *xgb.Conn, Drawable xproto.Drawable, X int16, Y int16, Width uint16, Height uint16, BorderWidth uint16, Class byte, Depth byte, Visual xproto.Visualid, ValueMask uint32, ValueList []uint32) []byte {
size := xgb.Pad((24 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask)))))))
b := 0
buf := make([]byte, size)
c.ExtLock.RLock()
buf[b] = c.Extensions["MIT-SCREEN-SAVER"]
c.ExtLock.RUnlock()
b += 1
buf[b] = 3 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Drawable))
b += 4
xgb.Put16(buf[b:], uint16(X))
b += 2
xgb.Put16(buf[b:], uint16(Y))
b += 2
xgb.Put16(buf[b:], Width)
b += 2
xgb.Put16(buf[b:], Height)
b += 2
xgb.Put16(buf[b:], BorderWidth)
b += 2
buf[b] = Class
b += 1
buf[b] = Depth
b += 1
xgb.Put32(buf[b:], uint32(Visual))
b += 4
xgb.Put32(buf[b:], ValueMask)
b += 4
for i := 0; i < xgb.PopCount(int(ValueMask)); i++ {
xgb.Put32(buf[b:], ValueList[i])
b += 4
}
b = xgb.Pad(b)
return buf
}
开发者ID:BurntSushi,项目名称:xgb,代码行数:55,代码来源:screensaver.go
示例6: createContextReply
// createContextReply reads a byte slice into a CreateContextReply value.
func createContextReply(buf []byte) *CreateContextReply {
v := new(CreateContextReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.WidthActual = xgb.Get16(buf[b:])
b += 2
v.HeightActual = xgb.Get16(buf[b:])
b += 2
v.FlagsReturn = xgb.Get32(buf[b:])
b += 4
b += 20 // padding
v.PrivData = make([]uint32, v.Length)
for i := 0; i < int(v.Length); i++ {
v.PrivData[i] = xgb.Get32(buf[b:])
b += 4
}
b = xgb.Pad(b)
return v
}
开发者ID:varialus,项目名称:xgb,代码行数:33,代码来源:xvmc.go
示例7: ClientIdValueListSize
// ClientIdValueListSize computes the size (bytes) of a list of ClientIdValue values.
func ClientIdValueListSize(list []ClientIdValue) int {
size := 0
for _, item := range list {
size += (12 + xgb.Pad((int(item.Length) * 4)))
}
return size
}
开发者ID:BurntSushi,项目名称:xgb,代码行数:8,代码来源:res.go
示例8: sendRequest
// Write request to wire for Send
// sendRequest writes a Send request to a byte slice.
func sendRequest(c *xgb.Conn, Event Event, DataType uint32) []byte {
size := 104
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XEVIE"]
b += 1
buf[b] = 3 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
{
structBytes := Event.Bytes()
copy(buf[b:], structBytes)
b += xgb.Pad(len(structBytes))
}
xgb.Put32(buf[b:], DataType)
b += 4
b += 64 // padding
return buf
}
开发者ID:varialus,项目名称:xgb,代码行数:29,代码来源:xevie.go
示例9: getXIDListReply
// getXIDListReply reads a byte slice into a GetXIDListReply value.
func getXIDListReply(buf []byte) *GetXIDListReply {
v := new(GetXIDListReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.IdsLen = xgb.Get32(buf[b:])
b += 4
b += 20 // padding
v.Ids = make([]uint32, v.IdsLen)
for i := 0; i < int(v.IdsLen); i++ {
v.Ids[i] = xgb.Get32(buf[b:])
b += 4
}
b = xgb.Pad(b)
return v
}
开发者ID:rjmcguire,项目名称:xgb,代码行数:27,代码来源:xcmisc.go
示例10: ResourceSizeValueListSize
// ResourceSizeValueListSize computes the size (bytes) of a list of ResourceSizeValue values.
func ResourceSizeValueListSize(list []ResourceSizeValue) int {
size := 0
for _, item := range list {
size += (24 + xgb.Pad((int(item.NumCrossReferences) * 20)))
}
return size
}
开发者ID:BurntSushi,项目名称:xgb,代码行数:8,代码来源:res.go
示例11: ClientInfoListSize
// ClientInfoListSize computes the size (bytes) of a list of ClientInfo values.
func ClientInfoListSize(list []ClientInfo) int {
size := 0
for _, item := range list {
size += (8 + xgb.Pad((int(item.NumRanges) * 24)))
}
return size
}
开发者ID:rjmcguire,项目名称:xgb,代码行数:8,代码来源:record.go
示例12: openConnectionReply
// openConnectionReply reads a byte slice into a OpenConnectionReply value.
func openConnectionReply(buf []byte) *OpenConnectionReply {
v := new(OpenConnectionReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.SareaHandleLow = xgb.Get32(buf[b:])
b += 4
v.SareaHandleHigh = xgb.Get32(buf[b:])
b += 4
v.BusIdLen = xgb.Get32(buf[b:])
b += 4
b += 12 // padding
{
byteString := make([]byte, v.BusIdLen)
copy(byteString[:v.BusIdLen], buf[b:])
v.BusId = string(byteString)
b += xgb.Pad(int(v.BusIdLen))
}
return v
}
开发者ID:rjmcguire,项目名称:xgb,代码行数:33,代码来源:xf86dri.go
示例13: getClientDriverNameReply
// getClientDriverNameReply reads a byte slice into a GetClientDriverNameReply value.
func getClientDriverNameReply(buf []byte) *GetClientDriverNameReply {
v := new(GetClientDriverNameReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.ClientDriverMajorVersion = xgb.Get32(buf[b:])
b += 4
v.ClientDriverMinorVersion = xgb.Get32(buf[b:])
b += 4
v.ClientDriverPatchVersion = xgb.Get32(buf[b:])
b += 4
v.ClientDriverNameLen = xgb.Get32(buf[b:])
b += 4
b += 8 // padding
{
byteString := make([]byte, v.ClientDriverNameLen)
copy(byteString[:v.ClientDriverNameLen], buf[b:])
v.ClientDriverName = string(byteString)
b += xgb.Pad(int(v.ClientDriverNameLen))
}
return v
}
开发者ID:rjmcguire,项目名称:xgb,代码行数:36,代码来源:xf86dri.go
示例14: ResourceIdSpecReadList
// ResourceIdSpecReadList reads a byte slice into a list of ResourceIdSpec values.
func ResourceIdSpecReadList(buf []byte, dest []ResourceIdSpec) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = ResourceIdSpec{}
b += ResourceIdSpecRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
开发者ID:BurntSushi,项目名称:xgb,代码行数:9,代码来源:res.go
示例15: RangeReadList
// RangeReadList reads a byte slice into a list of Range values.
func RangeReadList(buf []byte, dest []Range) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Range{}
b += RangeRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
开发者ID:rjmcguire,项目名称:xgb,代码行数:9,代码来源:record.go
示例16: ResourceSizeValueReadList
// ResourceSizeValueReadList reads a byte slice into a list of ResourceSizeValue values.
func ResourceSizeValueReadList(buf []byte, dest []ResourceSizeValue) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = ResourceSizeValue{}
b += ResourceSizeValueRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
开发者ID:BurntSushi,项目名称:xgb,代码行数:9,代码来源:res.go
示例17: DrmClipRectReadList
// DrmClipRectReadList reads a byte slice into a list of DrmClipRect values.
func DrmClipRectReadList(buf []byte, dest []DrmClipRect) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = DrmClipRect{}
b += DrmClipRectRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
开发者ID:rjmcguire,项目名称:xgb,代码行数:9,代码来源:xf86dri.go
示例18: AttachFormatReadList
// AttachFormatReadList reads a byte slice into a list of AttachFormat values.
func AttachFormatReadList(buf []byte, dest []AttachFormat) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = AttachFormat{}
b += AttachFormatRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
开发者ID:varialus,项目名称:xgb,代码行数:9,代码来源:dri2.go
示例19: DRI2BufferReadList
// DRI2BufferReadList reads a byte slice into a list of DRI2Buffer values.
func DRI2BufferReadList(buf []byte, dest []DRI2Buffer) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = DRI2Buffer{}
b += DRI2BufferRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
开发者ID:varialus,项目名称:xgb,代码行数:9,代码来源:dri2.go
示例20: ScreenInfoReadList
// ScreenInfoReadList reads a byte slice into a list of ScreenInfo values.
func ScreenInfoReadList(buf []byte, dest []ScreenInfo) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = ScreenInfo{}
b += ScreenInfoRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
开发者ID:tejohnso,项目名称:xgb,代码行数:9,代码来源:xinerama.go
注:本文中的github.com/BurntSushi/xgb.Pad函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论