當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Unmarshaller.UnmarshalStringMax方法代碼示例

本文整理匯總了Golang中github.com/calmh/xdr.Unmarshaller.UnmarshalStringMax方法的典型用法代碼示例。如果您正苦於以下問題:Golang Unmarshaller.UnmarshalStringMax方法的具體用法?Golang Unmarshaller.UnmarshalStringMax怎麽用?Golang Unmarshaller.UnmarshalStringMax使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/calmh/xdr.Unmarshaller的用法示例。


在下文中一共展示了Unmarshaller.UnmarshalStringMax方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: UnmarshalXDRFrom

func (o *FileInfo) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	o.Name = u.UnmarshalStringMax(8192)
	o.Flags = u.UnmarshalUint32()
	o.Modified = int64(u.UnmarshalUint64())
	(&o.Version).UnmarshalXDRFrom(u)
	o.LocalVersion = int64(u.UnmarshalUint64())
	_BlocksSize := int(u.UnmarshalUint32())
	if _BlocksSize < 0 {
		return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 10000000)
	} else if _BlocksSize == 0 {
		o.Blocks = nil
	} else {
		if _BlocksSize > 10000000 {
			return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 10000000)
		}
		if _BlocksSize <= len(o.Blocks) {
			o.Blocks = o.Blocks[:_BlocksSize]
		} else {
			o.Blocks = make([]BlockInfo, _BlocksSize)
		}
		for i := range o.Blocks {
			(&o.Blocks[i]).UnmarshalXDRFrom(u)
		}
	}
	return u.Error
}
開發者ID:carriercomm,項目名稱:syncthing,代碼行數:26,代碼來源:message_xdr.go

示例2: UnmarshalXDRFrom

func (o *XDRBenchStruct) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	o.I1 = u.UnmarshalUint64()
	o.I2 = u.UnmarshalUint32()
	o.I3 = u.UnmarshalUint16()
	o.I4 = u.UnmarshalUint8()
	o.Bs0 = u.UnmarshalBytesMax(128)
	o.Bs1 = u.UnmarshalBytes()
	_Is0Size := int(u.UnmarshalUint32())
	if _Is0Size < 0 {
		return xdr.ElementSizeExceeded("Is0", _Is0Size, 0)
	} else if _Is0Size == 0 {
		o.Is0 = nil
	} else {
		if _Is0Size <= len(o.Is0) {
			o.Is0 = o.Is0[:_Is0Size]
		} else {
			o.Is0 = make([]int32, _Is0Size)
		}
		for i := range o.Is0 {
			o.Is0[i] = int32(u.UnmarshalUint32())
		}
	}
	o.S0 = u.UnmarshalStringMax(128)
	o.S1 = u.UnmarshalString()
	return u.Error
}
開發者ID:letiemble,項目名稱:syncthing,代碼行數:26,代碼來源:bench_xdr_test.go

示例3: 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
}
開發者ID:letiemble,項目名稱:syncthing,代碼行數:54,代碼來源:encdec_xdr_test.go

示例4: UnmarshalXDRFrom

func (o *ClusterConfigMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	o.DeviceName = u.UnmarshalStringMax(64)
	o.ClientName = u.UnmarshalStringMax(64)
	o.ClientVersion = u.UnmarshalStringMax(64)
	_FoldersSize := int(u.UnmarshalUint32())
	if _FoldersSize < 0 {
		return xdr.ElementSizeExceeded("Folders", _FoldersSize, 1000000)
	} else if _FoldersSize == 0 {
		o.Folders = nil
	} else {
		if _FoldersSize > 1000000 {
			return xdr.ElementSizeExceeded("Folders", _FoldersSize, 1000000)
		}
		if _FoldersSize <= len(o.Folders) {
			o.Folders = o.Folders[:_FoldersSize]
		} else {
			o.Folders = make([]Folder, _FoldersSize)
		}
		for i := range o.Folders {
			(&o.Folders[i]).UnmarshalXDRFrom(u)
		}
	}
	_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
}
開發者ID:hernad,項目名稱:syncthing,代碼行數:42,代碼來源:message_xdr.go

示例5: UnmarshalXDRFrom

func (o *FileInfoTruncated) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	o.Name = u.UnmarshalStringMax(8192)
	o.Flags = u.UnmarshalUint32()
	o.Modified = int64(u.UnmarshalUint64())
	(&o.Version).UnmarshalXDRFrom(u)
	o.LocalVersion = int64(u.UnmarshalUint64())
	_BlocksSize := int(u.UnmarshalUint32())
	if _BlocksSize < 0 {
		return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 1000000)
	} else if _BlocksSize == 0 {
		o.Blocks = nil
	} else {
		if _BlocksSize > 1000000 {
			return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 1000000)
		}
		for i := 0; i < _BlocksSize; i++ {
			size := int64(u.UnmarshalUint32())
			o.CachedSize += size
			u.UnmarshalBytes()
		}
	}

	return u.Error
}
開發者ID:tcrutt,項目名稱:syncthing,代碼行數:24,代碼來源:truncated.go

示例6: UnmarshalXDRFrom

func (o *Version13HelloMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	o.DeviceName = u.UnmarshalStringMax(64)
	o.ClientName = u.UnmarshalStringMax(64)
	o.ClientVersion = u.UnmarshalStringMax(64)
	return u.Error
}
開發者ID:letiemble,項目名稱:syncthing,代碼行數:6,代碼來源:hello_v0.13_xdr.go

示例7: UnmarshalXDRFrom

func (o *Relay) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	o.URL = u.UnmarshalStringMax(2083)
	o.Latency = int32(u.UnmarshalUint32())
	return u.Error
}
開發者ID:tcrutt,項目名稱:syncthing,代碼行數:5,代碼來源:localpackets_xdr.go


注:本文中的github.com/calmh/xdr.Unmarshaller.UnmarshalStringMax方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。