本文整理匯總了Golang中github.com/calmh/xdr.ElementSizeExceeded函數的典型用法代碼示例。如果您正苦於以下問題:Golang ElementSizeExceeded函數的具體用法?Golang ElementSizeExceeded怎麽用?Golang ElementSizeExceeded使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ElementSizeExceeded函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: DecodeXDRFrom
func (o *Device) DecodeXDRFrom(xr *xdr.Reader) error {
o.ID = xr.ReadBytesMax(32)
o.Name = xr.ReadStringMax(64)
_AddressesSize := int(xr.ReadUint32())
if _AddressesSize < 0 {
return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 64)
}
if _AddressesSize > 64 {
return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 64)
}
o.Addresses = make([]string, _AddressesSize)
for i := range o.Addresses {
o.Addresses[i] = xr.ReadStringMax(2083)
}
o.Compression = xr.ReadUint32()
o.CertName = xr.ReadStringMax(64)
o.MaxLocalVersion = int64(xr.ReadUint64())
o.Flags = xr.ReadUint32()
_OptionsSize := int(xr.ReadUint32())
if _OptionsSize < 0 {
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
}
if _OptionsSize > 64 {
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
}
o.Options = make([]Option, _OptionsSize)
for i := range o.Options {
(&o.Options[i]).DecodeXDRFrom(xr)
}
return xr.Error()
}
示例2: DecodeXDRFrom
func (o *Folder) DecodeXDRFrom(xr *xdr.Reader) error {
o.ID = xr.ReadStringMax(64)
_DevicesSize := int(xr.ReadUint32())
if _DevicesSize < 0 {
return xdr.ElementSizeExceeded("Devices", _DevicesSize, 1000000)
}
if _DevicesSize > 1000000 {
return xdr.ElementSizeExceeded("Devices", _DevicesSize, 1000000)
}
o.Devices = make([]Device, _DevicesSize)
for i := range o.Devices {
(&o.Devices[i]).DecodeXDRFrom(xr)
}
o.Flags = xr.ReadUint32()
_OptionsSize := int(xr.ReadUint32())
if _OptionsSize < 0 {
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
}
if _OptionsSize > 64 {
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
}
o.Options = make([]Option, _OptionsSize)
for i := range o.Options {
(&o.Options[i]).DecodeXDRFrom(xr)
}
return xr.Error()
}
示例3: EncodeXDRInto
func (o IndexMessage) EncodeXDRInto(xw *xdr.Writer) (int, error) {
if l := len(o.Folder); l > 256 {
return xw.Tot(), xdr.ElementSizeExceeded("Folder", l, 256)
}
xw.WriteString(o.Folder)
if l := len(o.Files); l > 1000000 {
return xw.Tot(), xdr.ElementSizeExceeded("Files", l, 1000000)
}
xw.WriteUint32(uint32(len(o.Files)))
for i := range o.Files {
_, err := o.Files[i].EncodeXDRInto(xw)
if err != nil {
return xw.Tot(), err
}
}
xw.WriteUint32(o.Flags)
if l := len(o.Options); l > 64 {
return xw.Tot(), xdr.ElementSizeExceeded("Options", l, 64)
}
xw.WriteUint32(uint32(len(o.Options)))
for i := range o.Options {
_, err := o.Options[i].EncodeXDRInto(xw)
if err != nil {
return xw.Tot(), err
}
}
return xw.Tot(), xw.Error()
}
示例4: EncodeXDRInto
func (o Device) EncodeXDRInto(xw *xdr.Writer) (int, error) {
if l := len(o.ID); l > 32 {
return xw.Tot(), xdr.ElementSizeExceeded("ID", l, 32)
}
xw.WriteBytes(o.ID)
if l := len(o.Addresses); l > 16 {
return xw.Tot(), xdr.ElementSizeExceeded("Addresses", l, 16)
}
xw.WriteUint32(uint32(len(o.Addresses)))
for i := range o.Addresses {
_, err := o.Addresses[i].EncodeXDRInto(xw)
if err != nil {
return xw.Tot(), err
}
}
if l := len(o.Relays); l > 16 {
return xw.Tot(), xdr.ElementSizeExceeded("Relays", l, 16)
}
xw.WriteUint32(uint32(len(o.Relays)))
for i := range o.Relays {
_, err := o.Relays[i].EncodeXDRInto(xw)
if err != nil {
return xw.Tot(), err
}
}
return xw.Tot(), xw.Error()
}
示例5: EncodeXDRInto
func (o Folder) EncodeXDRInto(xw *xdr.Writer) (int, error) {
if l := len(o.ID); l > 64 {
return xw.Tot(), xdr.ElementSizeExceeded("ID", l, 64)
}
xw.WriteString(o.ID)
if l := len(o.Devices); l > 1000000 {
return xw.Tot(), xdr.ElementSizeExceeded("Devices", l, 1000000)
}
xw.WriteUint32(uint32(len(o.Devices)))
for i := range o.Devices {
_, err := o.Devices[i].EncodeXDRInto(xw)
if err != nil {
return xw.Tot(), err
}
}
xw.WriteUint32(o.Flags)
if l := len(o.Options); l > 64 {
return xw.Tot(), xdr.ElementSizeExceeded("Options", l, 64)
}
xw.WriteUint32(uint32(len(o.Options)))
for i := range o.Options {
_, err := o.Options[i].EncodeXDRInto(xw)
if err != nil {
return xw.Tot(), err
}
}
return xw.Tot(), xw.Error()
}
示例6: MarshalXDRInto
func (o Folder) MarshalXDRInto(m *xdr.Marshaller) error {
if l := len(o.ID); l > 256 {
return xdr.ElementSizeExceeded("ID", l, 256)
}
m.MarshalString(o.ID)
if l := len(o.Label); l > 256 {
return xdr.ElementSizeExceeded("Label", l, 256)
}
m.MarshalString(o.Label)
if l := len(o.Devices); l > 1000000 {
return xdr.ElementSizeExceeded("Devices", l, 1000000)
}
m.MarshalUint32(uint32(len(o.Devices)))
for i := range o.Devices {
if err := o.Devices[i].MarshalXDRInto(m); err != nil {
return err
}
}
m.MarshalUint32(o.Flags)
if l := len(o.Options); l > 64 {
return xdr.ElementSizeExceeded("Options", l, 64)
}
m.MarshalUint32(uint32(len(o.Options)))
for i := range o.Options {
if err := o.Options[i].MarshalXDRInto(m); err != nil {
return err
}
}
return m.Error
}
示例7: MarshalXDRInto
func (o Device) MarshalXDRInto(m *xdr.Marshaller) error {
if l := len(o.ID); l > 32 {
return xdr.ElementSizeExceeded("ID", l, 32)
}
m.MarshalBytes(o.ID)
if l := len(o.Addresses); l > 16 {
return xdr.ElementSizeExceeded("Addresses", l, 16)
}
m.MarshalUint32(uint32(len(o.Addresses)))
for i := range o.Addresses {
if err := o.Addresses[i].MarshalXDRInto(m); err != nil {
return err
}
}
if l := len(o.Relays); l > 16 {
return xdr.ElementSizeExceeded("Relays", l, 16)
}
m.MarshalUint32(uint32(len(o.Relays)))
for i := range o.Relays {
if err := o.Relays[i].MarshalXDRInto(m); err != nil {
return err
}
}
return m.Error
}
示例8: encodeXDR
func (o ClusterConfigMessage) encodeXDR(xw *xdr.Writer) (int, error) {
if l := len(o.ClientName); l > 64 {
return xw.Tot(), xdr.ElementSizeExceeded("ClientName", l, 64)
}
xw.WriteString(o.ClientName)
if l := len(o.ClientVersion); l > 64 {
return xw.Tot(), xdr.ElementSizeExceeded("ClientVersion", l, 64)
}
xw.WriteString(o.ClientVersion)
if l := len(o.Folders); l > 64 {
return xw.Tot(), xdr.ElementSizeExceeded("Folders", l, 64)
}
xw.WriteUint32(uint32(len(o.Folders)))
for i := range o.Folders {
_, err := o.Folders[i].encodeXDR(xw)
if err != nil {
return xw.Tot(), err
}
}
if l := len(o.Options); l > 64 {
return xw.Tot(), xdr.ElementSizeExceeded("Options", l, 64)
}
xw.WriteUint32(uint32(len(o.Options)))
for i := range o.Options {
_, err := o.Options[i].encodeXDR(xw)
if err != nil {
return xw.Tot(), err
}
}
return xw.Tot(), xw.Error()
}
示例9: DecodeXDRFrom
func (o *Device) DecodeXDRFrom(xr *xdr.Reader) error {
o.ID = xr.ReadBytesMax(32)
_AddressesSize := int(xr.ReadUint32())
if _AddressesSize < 0 {
return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 16)
}
if _AddressesSize > 16 {
return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 16)
}
o.Addresses = make([]string, _AddressesSize)
for i := range o.Addresses {
o.Addresses[i] = xr.ReadString()
}
_RelaysSize := int(xr.ReadUint32())
if _RelaysSize < 0 {
return xdr.ElementSizeExceeded("Relays", _RelaysSize, 16)
}
if _RelaysSize > 16 {
return xdr.ElementSizeExceeded("Relays", _RelaysSize, 16)
}
o.Relays = make([]Relay, _RelaysSize)
for i := range o.Relays {
(&o.Relays[i]).DecodeXDRFrom(xr)
}
return xr.Error()
}
示例10: DecodeXDRFrom
func (o *TestStruct) DecodeXDRFrom(xr *xdr.Reader) error {
o.I = int(xr.ReadUint64())
o.I8 = int8(xr.ReadUint8())
o.UI8 = xr.ReadUint8()
o.I16 = int16(xr.ReadUint16())
o.UI16 = xr.ReadUint16()
o.I32 = int32(xr.ReadUint32())
o.UI32 = xr.ReadUint32()
o.I64 = int64(xr.ReadUint64())
o.UI64 = xr.ReadUint64()
o.BS = xr.ReadBytesMax(1024)
o.S = xr.ReadStringMax(1024)
(&o.C).DecodeXDRFrom(xr)
_SSSize := int(xr.ReadUint32())
if _SSSize < 0 {
return xdr.ElementSizeExceeded("SS", _SSSize, 1024)
}
if _SSSize > 1024 {
return xdr.ElementSizeExceeded("SS", _SSSize, 1024)
}
o.SS = make([]string, _SSSize)
for i := range o.SS {
o.SS[i] = xr.ReadString()
}
return xr.Error()
}
示例11: EncodeXDRInto
func (o TestStruct) EncodeXDRInto(xw *xdr.Writer) (int, error) {
xw.WriteUint64(uint64(o.I))
xw.WriteUint8(uint8(o.I8))
xw.WriteUint8(o.UI8)
xw.WriteUint16(uint16(o.I16))
xw.WriteUint16(o.UI16)
xw.WriteUint32(uint32(o.I32))
xw.WriteUint32(o.UI32)
xw.WriteUint64(uint64(o.I64))
xw.WriteUint64(o.UI64)
if l := len(o.BS); l > 1024 {
return xw.Tot(), xdr.ElementSizeExceeded("BS", l, 1024)
}
xw.WriteBytes(o.BS)
if l := len(o.S); l > 1024 {
return xw.Tot(), xdr.ElementSizeExceeded("S", l, 1024)
}
xw.WriteString(o.S)
_, err := o.C.EncodeXDRInto(xw)
if err != nil {
return xw.Tot(), err
}
if l := len(o.SS); l > 1024 {
return xw.Tot(), xdr.ElementSizeExceeded("SS", l, 1024)
}
xw.WriteUint32(uint32(len(o.SS)))
for i := range o.SS {
xw.WriteString(o.SS[i])
}
return xw.Tot(), xw.Error()
}
示例12: MarshalXDRInto
func (o ClusterConfigMessage) MarshalXDRInto(m *xdr.Marshaller) error {
if l := len(o.DeviceName); l > 64 {
return xdr.ElementSizeExceeded("DeviceName", l, 64)
}
m.MarshalString(o.DeviceName)
if l := len(o.ClientName); l > 64 {
return xdr.ElementSizeExceeded("ClientName", l, 64)
}
m.MarshalString(o.ClientName)
if l := len(o.ClientVersion); l > 64 {
return xdr.ElementSizeExceeded("ClientVersion", l, 64)
}
m.MarshalString(o.ClientVersion)
if l := len(o.Folders); l > 1000000 {
return xdr.ElementSizeExceeded("Folders", l, 1000000)
}
m.MarshalUint32(uint32(len(o.Folders)))
for i := range o.Folders {
if err := o.Folders[i].MarshalXDRInto(m); err != nil {
return err
}
}
if l := len(o.Options); l > 64 {
return xdr.ElementSizeExceeded("Options", l, 64)
}
m.MarshalUint32(uint32(len(o.Options)))
for i := range o.Options {
if err := o.Options[i].MarshalXDRInto(m); err != nil {
return err
}
}
return m.Error
}
示例13: UnmarshalXDRFrom
func (o *RequestMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
o.Folder = u.UnmarshalStringMax(256)
o.Name = u.UnmarshalStringMax(8192)
o.Offset = int64(u.UnmarshalUint64())
o.Size = int32(u.UnmarshalUint32())
o.Hash = u.UnmarshalBytesMax(64)
o.Flags = u.UnmarshalUint32()
_OptionsSize := int(u.UnmarshalUint32())
if _OptionsSize < 0 {
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
} else if _OptionsSize == 0 {
o.Options = nil
} else {
if _OptionsSize > 64 {
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
}
if _OptionsSize <= len(o.Options) {
o.Options = o.Options[:_OptionsSize]
} else {
o.Options = make([]Option, _OptionsSize)
}
for i := range o.Options {
(&o.Options[i]).UnmarshalXDRFrom(u)
}
}
return u.Error
}
示例14: UnmarshalXDRFrom
func (o *TestStruct) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
o.B = u.UnmarshalBool()
o.I = int(u.UnmarshalUint64())
o.I8 = int8(u.UnmarshalUint8())
o.UI8 = u.UnmarshalUint8()
o.I16 = int16(u.UnmarshalUint16())
o.UI16 = u.UnmarshalUint16()
o.I32 = int32(u.UnmarshalUint32())
o.UI32 = u.UnmarshalUint32()
o.I64 = int64(u.UnmarshalUint64())
o.UI64 = u.UnmarshalUint64()
o.BS = u.UnmarshalBytesMax(1024)
o.S = u.UnmarshalStringMax(1024)
(&o.C).UnmarshalXDRFrom(u)
_SSSize := int(u.UnmarshalUint32())
if _SSSize < 0 {
return xdr.ElementSizeExceeded("SS", _SSSize, 1024)
} else if _SSSize == 0 {
o.SS = nil
} else {
if _SSSize > 1024 {
return xdr.ElementSizeExceeded("SS", _SSSize, 1024)
}
if _SSSize <= len(o.SS) {
for i := _SSSize; i < len(o.SS); i++ {
o.SS[i] = ""
}
o.SS = o.SS[:_SSSize]
} else {
o.SS = make([]string, _SSSize)
}
for i := range o.SS {
o.SS[i] = u.UnmarshalString()
}
}
(&o.ES).UnmarshalXDRFrom(u)
(&o.OS).UnmarshalXDRFrom(u)
_OSsSize := int(u.UnmarshalUint32())
if _OSsSize < 0 {
return xdr.ElementSizeExceeded("OSs", _OSsSize, 0)
} else if _OSsSize == 0 {
o.OSs = nil
} else {
if _OSsSize <= len(o.OSs) {
o.OSs = o.OSs[:_OSsSize]
} else {
o.OSs = make([]OtherStruct, _OSsSize)
}
for i := range o.OSs {
(&o.OSs[i]).UnmarshalXDRFrom(u)
}
}
return u.Error
}
示例15: MarshalXDRInto
func (o Version13HelloMessage) MarshalXDRInto(m *xdr.Marshaller) error {
if l := len(o.DeviceName); l > 64 {
return xdr.ElementSizeExceeded("DeviceName", l, 64)
}
m.MarshalString(o.DeviceName)
if l := len(o.ClientName); l > 64 {
return xdr.ElementSizeExceeded("ClientName", l, 64)
}
m.MarshalString(o.ClientName)
if l := len(o.ClientVersion); l > 64 {
return xdr.ElementSizeExceeded("ClientVersion", l, 64)
}
m.MarshalString(o.ClientVersion)
return m.Error
}