Remove 64 device limit

This commit is contained in:
Audrius Butkevicius 2014-10-20 21:45:26 +01:00
parent c618eba9a9
commit ec9d68960f
2 changed files with 3 additions and 9 deletions

View File

@ -137,8 +137,8 @@ func (o *ClusterConfigMessage) GetOption(key string) string {
} }
type Folder struct { type Folder struct {
ID string // max:64 ID string // max:64
Devices []Device // max:64 Devices []Device
} }
type Device struct { type Device struct {

View File

@ -644,7 +644,7 @@ Folder Structure:
struct Folder { struct Folder {
string ID<64>; string ID<64>;
Device Devices<64>; Device Devices<>;
} }
*/ */
@ -670,9 +670,6 @@ func (o Folder) encodeXDR(xw *xdr.Writer) (int, error) {
return xw.Tot(), xdr.ErrElementSizeExceeded return xw.Tot(), xdr.ErrElementSizeExceeded
} }
xw.WriteString(o.ID) xw.WriteString(o.ID)
if len(o.Devices) > 64 {
return xw.Tot(), xdr.ErrElementSizeExceeded
}
xw.WriteUint32(uint32(len(o.Devices))) xw.WriteUint32(uint32(len(o.Devices)))
for i := range o.Devices { for i := range o.Devices {
_, err := o.Devices[i].encodeXDR(xw) _, err := o.Devices[i].encodeXDR(xw)
@ -697,9 +694,6 @@ func (o *Folder) UnmarshalXDR(bs []byte) error {
func (o *Folder) decodeXDR(xr *xdr.Reader) error { func (o *Folder) decodeXDR(xr *xdr.Reader) error {
o.ID = xr.ReadStringMax(64) o.ID = xr.ReadStringMax(64)
_DevicesSize := int(xr.ReadUint32()) _DevicesSize := int(xr.ReadUint32())
if _DevicesSize > 64 {
return xdr.ErrElementSizeExceeded
}
o.Devices = make([]Device, _DevicesSize) o.Devices = make([]Device, _DevicesSize)
for i := range o.Devices { for i := range o.Devices {
(&o.Devices[i]).decodeXDR(xr) (&o.Devices[i]).decodeXDR(xr)