本文整理汇总了Golang中code/google/com/p/gogoprotobuf/proto.Skip函数的典型用法代码示例。如果您正苦于以下问题:Golang Skip函数的具体用法?Golang Skip怎么用?Golang Skip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Skip函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Unmarshal
func (m *SnapshotResponse) Unmarshal(data []byte) error {
l := len(data)
index := 0
for index < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io8.ErrUnexpectedEOF
}
b := data[index]
index++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
switch fieldNum {
case 1:
if wireType != 0 {
return fmt32.Errorf("proto: wrong wireType = %d for field Success", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if index >= l {
return io8.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
b := bool(v != 0)
m.Success = &b
default:
var sizeOfWire int
for {
sizeOfWire++
wire >>= 7
if wire == 0 {
break
}
}
index -= sizeOfWire
skippy, err := code_google_com_p_gogoprotobuf_proto16.Skip(data[index:])
if err != nil {
return err
}
if (index + skippy) > l {
return io8.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
index += skippy
}
}
return nil
}
开发者ID:Kenterfie,项目名称:influxdb,代码行数:60,代码来源:snapshot_response.pb.go
示例2: Unmarshal
func (m *Sub) Unmarshal(data []byte) error {
l := len(data)
index := 0
for index < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io1.ErrUnexpectedEOF
}
b := data[index]
index++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
switch fieldNum {
case 1:
if wireType != 0 {
return proto.ErrWrongType
}
var v int64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io1.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.SubNumber = &v
default:
var sizeOfWire int
for {
sizeOfWire++
wire >>= 7
if wire == 0 {
break
}
}
index -= sizeOfWire
skippy, err := code_google_com_p_gogoprotobuf_proto1.Skip(data[index:])
if err != nil {
return err
}
if (index + skippy) > l {
return io1.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
index += skippy
}
}
return nil
}
开发者ID:raceli,项目名称:gogoprotobuf,代码行数:59,代码来源:unmarshalmerge.pb.go
示例3: Unmarshal
//.........这里部分代码省略.........
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
switch fieldNum {
case 1:
if wireType != 0 {
return proto.ErrWrongType
}
var v uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io3.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.Term = &v
case 2:
if wireType != 0 {
return proto.ErrWrongType
}
var v uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io3.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.LastLogIndex = &v
case 3:
if wireType != 0 {
return proto.ErrWrongType
}
var v uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io3.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.LastLogTerm = &v
case 4:
if wireType != 2 {
return proto.ErrWrongType
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io3.ErrUnexpectedEOF
}
b := data[index]
index++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
postIndex := index + int(stringLen)
if postIndex > l {
return io3.ErrUnexpectedEOF
}
s := string(data[index:postIndex])
m.CandidateName = &s
index = postIndex
default:
var sizeOfWire int
for {
sizeOfWire++
wire >>= 7
if wire == 0 {
break
}
}
index -= sizeOfWire
skippy, err := code_google_com_p_gogoprotobuf_proto6.Skip(data[index:])
if err != nil {
return err
}
m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
index += skippy
}
}
return nil
}
开发者ID:9cat,项目名称:influxdb,代码行数:101,代码来源:request_vote_request.pb.go
示例4: Unmarshal
//.........这里部分代码省略.........
}
var v uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io1.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.PrevLogTerm = &v
case 4:
if wireType != 0 {
return fmt4.Errorf("proto: wrong wireType = %d for field CommitIndex", wireType)
}
var v uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io1.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.CommitIndex = &v
case 5:
if wireType != 2 {
return fmt4.Errorf("proto: wrong wireType = %d for field LeaderName", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io1.ErrUnexpectedEOF
}
b := data[index]
index++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
postIndex := index + int(stringLen)
if postIndex > l {
return io1.ErrUnexpectedEOF
}
s := string(data[index:postIndex])
m.LeaderName = &s
index = postIndex
case 6:
if wireType != 2 {
return fmt4.Errorf("proto: wrong wireType = %d for field Entries", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if index >= l {
return io1.ErrUnexpectedEOF
}
b := data[index]
index++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
postIndex := index + msglen
if postIndex > l {
return io1.ErrUnexpectedEOF
}
m.Entries = append(m.Entries, &LogEntry{})
m.Entries[len(m.Entries)-1].Unmarshal(data[index:postIndex])
index = postIndex
default:
var sizeOfWire int
for {
sizeOfWire++
wire >>= 7
if wire == 0 {
break
}
}
index -= sizeOfWire
skippy, err := code_google_com_p_gogoprotobuf_proto2.Skip(data[index:])
if err != nil {
return err
}
if (index + skippy) > l {
return io1.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
index += skippy
}
}
return nil
}
开发者ID:Kenterfie,项目名称:influxdb,代码行数:101,代码来源:append_entries_request.pb.go
示例5: Unmarshal
//.........这里部分代码省略.........
b := data[index]
index++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
postIndex := index + int(stringLen)
if postIndex > l {
return io.ErrUnexpectedEOF
}
s := string(data[index:postIndex])
m.EnvVersion = &s
index = postIndex
case 8:
if wireType != 0 {
return ErrWrongType
}
var v int32
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (int32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.Pid = &v
case 9:
if wireType != 2 {
return ErrWrongType
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
postIndex := index + int(stringLen)
if postIndex > l {
return io.ErrUnexpectedEOF
}
s := string(data[index:postIndex])
m.Hostname = &s
index = postIndex
case 10:
if wireType != 2 {
return ErrWrongType
}
var msglen int
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
postIndex := index + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Fields = append(m.Fields, &Field{})
m.Fields[len(m.Fields)-1].Unmarshal(data[index:postIndex])
index = postIndex
default:
var sizeOfWire int
for {
sizeOfWire++
wire >>= 7
if wire == 0 {
break
}
}
index -= sizeOfWire
skippy, err := code_google_com_p_gogoprotobuf_proto.Skip(data[index:])
if err != nil {
return err
}
if (index + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
index += skippy
}
}
return nil
}
开发者ID:ruiaylin,项目名称:sqltrack,代码行数:101,代码来源:message.pb.go
示例6: Unmarshal
//.........这里部分代码省略.........
index = postIndex
case 2:
if wireType != 0 {
return proto.ErrWrongType
}
var v uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io5.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.LastIndex = &v
case 3:
if wireType != 0 {
return proto.ErrWrongType
}
var v uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io5.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.LastTerm = &v
case 4:
if wireType != 2 {
return proto.ErrWrongType
}
var msglen int
for shift := uint(0); ; shift += 7 {
if index >= l {
return io5.ErrUnexpectedEOF
}
b := data[index]
index++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
postIndex := index + msglen
if postIndex > l {
return io5.ErrUnexpectedEOF
}
m.Peers = append(m.Peers, &SnapshotRecoveryRequest_Peer{})
m.Peers[len(m.Peers)-1].Unmarshal(data[index:postIndex])
index = postIndex
case 5:
if wireType != 2 {
return proto.ErrWrongType
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if index >= l {
return io5.ErrUnexpectedEOF
}
b := data[index]
index++
byteLen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
postIndex := index + byteLen
if postIndex > l {
return io5.ErrUnexpectedEOF
}
m.State = append(m.State, data[index:postIndex]...)
index = postIndex
default:
var sizeOfWire int
for {
sizeOfWire++
wire >>= 7
if wire == 0 {
break
}
}
index -= sizeOfWire
skippy, err := code_google_com_p_gogoprotobuf_proto10.Skip(data[index:])
if err != nil {
return err
}
m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
index += skippy
}
}
return nil
}
开发者ID:9cat,项目名称:influxdb,代码行数:101,代码来源:snapshot_recovery_request.pb.go
示例7: Unmarshal
//.........这里部分代码省略.........
return io.ErrUnexpectedEOF
}
b := data[index]
index++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
postIndex := index + int(stringLen)
if postIndex > l {
return io.ErrUnexpectedEOF
}
s := string(data[index:postIndex])
m.Key = &s
index = postIndex
case 2:
if wireType != 1 {
return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
}
var v uint64
i := index + 8
if i > l {
return io.ErrUnexpectedEOF
}
index = i
v = uint64(data[i-8])
v |= uint64(data[i-7]) << 8
v |= uint64(data[i-6]) << 16
v |= uint64(data[i-5]) << 24
v |= uint64(data[i-4]) << 32
v |= uint64(data[i-3]) << 40
v |= uint64(data[i-2]) << 48
v |= uint64(data[i-1]) << 56
v2 := math1.Float64frombits(v)
m.Value = &v2
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field IndexKey", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
postIndex := index + int(stringLen)
if postIndex > l {
return io.ErrUnexpectedEOF
}
s := string(data[index:postIndex])
m.IndexKey = &s
index = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Repeat", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
b := bool(v != 0)
m.Repeat = &b
default:
var sizeOfWire int
for {
sizeOfWire++
wire >>= 7
if wire == 0 {
break
}
}
index -= sizeOfWire
skippy, err := code_google_com_p_gogoprotobuf_proto.Skip(data[index:])
if err != nil {
return err
}
if (index + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
index += skippy
}
}
return nil
}
开发者ID:vrecan,项目名称:gomasticate,代码行数:101,代码来源:protoStat.pb.go
示例8: ToString
//.........这里部分代码省略.........
w.String(`}` + "\n")
break
} else {
w.tab()
w.String(f.GetName() + `:`)
var n int
var err error
switch f.GetType() {
case descriptor.FieldDescriptorProto_TYPE_DOUBLE:
n, err = DecFloat64(buf, offset, w)
case descriptor.FieldDescriptorProto_TYPE_FLOAT:
n, err = DecFloat32(buf, offset, w)
case descriptor.FieldDescriptorProto_TYPE_INT64:
n, err = DecInt64(buf, offset, w)
case descriptor.FieldDescriptorProto_TYPE_UINT64:
n, err = DecUint64(buf, offset, w)
case descriptor.FieldDescriptorProto_TYPE_INT32:
n, err = DecInt32(buf, offset, w)
case descriptor.FieldDescriptorProto_TYPE_FIXED64:
n, err = DecFixed64(buf, offset, w)
case descriptor.FieldDescriptorProto_TYPE_FIXED32:
n, err = DecFixed32(buf, offset, w)
case descriptor.FieldDescriptorProto_TYPE_BOOL:
n, err = DecBool(buf, offset, w)
case descriptor.FieldDescriptorProto_TYPE_STRING:
n, err = DecString(buf, offset, w)
case descriptor.FieldDescriptorProto_TYPE_GROUP:
panic("not implemented")
case descriptor.FieldDescriptorProto_TYPE_BYTES:
n, err = DecBytes(buf, offset, w)
case descriptor.FieldDescriptorProto_TYPE_UINT32:
n, err = DecUint32(buf, offset, w)
case descriptor.FieldDescriptorProto_TYPE_ENUM:
n, err = DecInt32(buf, offset, w)
case descriptor.FieldDescriptorProto_TYPE_SFIXED32:
n, err = DecSfixed32(buf, offset, w)
case descriptor.FieldDescriptorProto_TYPE_SFIXED64:
n, err = DecSfixed64(buf, offset, w)
case descriptor.FieldDescriptorProto_TYPE_SINT32:
n, err = DecSint32(buf, offset, w)
case descriptor.FieldDescriptorProto_TYPE_SINT64:
n, err = DecSint64(buf, offset, w)
default:
panic("unreachable")
}
offset += n
if err != nil {
panic(err)
}
w.String(",\n")
break
}
}
if !found {
for _, extRange := range msg.GetExtensionRange() {
if extRange.GetStart() <= fieldNum && fieldNum <= extRange.GetEnd() {
found = true
break
}
}
w.tab()
offset -= n
nn, err := proto.Skip(buf[offset:])
if err != nil {
panic(err)
}
if !found {
w.String("XXX_unrecognized:")
} else {
w.String("XXX_extensions:")
extPkg, ext := desc.FindExtensionByFieldNumber(messagePkg, messageName, fieldNum)
if ext != nil && ext.IsMessage() {
names := strings.Split(ext.GetTypeName(), ".")
if len(names) == 3 {
_, nnn, err := decodeVarint(buf, offset+n)
if err != nil {
panic(err)
}
w.tab()
w.String(extPkg + "." + names[2] + `:{` + "\n")
err = ToString(extPkg, names[2], desc, "", buf[offset+n+nnn:offset+nn], tabs+1, writer)
if err != nil {
return err
}
offset += nn
w.tab()
w.String(`}` + "\n")
break
} else {
panic(ext.GetTypeName())
}
}
}
w.Bytes(buf[offset : offset+nn])
w.String("\n")
offset += nn
}
}
return nil
}
开发者ID:Huangyan9188,项目名称:gogoprotobuf,代码行数:101,代码来源:string.go
示例9: Unmarshal
func (m *GoGoProtobufTestMessage2) Unmarshal(data []byte) error {
l := len(data)
index := 0
for index < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
switch fieldNum {
case 1:
if wireType != 0 {
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
}
var v int32
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (int32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.F0 = &v
case 2:
if wireType != 2 {
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
postIndex := index + int(stringLen)
if postIndex > l {
return io.ErrUnexpectedEOF
}
s := string(data[index:postIndex])
m.F1 = &s
index = postIndex
case 3:
if wireType != 5 {
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
}
var v uint32
i := index + 4
if i > l {
return io.ErrUnexpectedEOF
}
index = i
v = uint32(data[i-4])
v |= uint32(data[i-3]) << 8
v |= uint32(data[i-2]) << 16
v |= uint32(data[i-1]) << 24
v2 := math1.Float32frombits(v)
m.F2 = &v2
default:
var sizeOfWire int
for {
sizeOfWire++
wire >>= 7
if wire == 0 {
break
}
}
index -= sizeOfWire
skippy, err := code_google_com_p_gogoprotobuf_proto.Skip(data[index:])
if err != nil {
return err
}
if (index + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
index += skippy
}
}
return nil
}
开发者ID:jmptrader,项目名称:messenger,代码行数:98,代码来源:gogoproto.pb.go
示例10: Unmarshal
//.........这里部分代码省略.........
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.Recursive = bool(v != 0)
case 13:
if wireType != 0 {
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
}
var v int
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.Sorted = bool(v != 0)
case 14:
if wireType != 0 {
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
}
var v int
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.Quorum = bool(v != 0)
case 15:
if wireType != 0 {
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
}
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
m.Time |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 16:
if wireType != 0 {
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
}
var v int
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.Stream = bool(v != 0)
default:
var sizeOfWire int
for {
sizeOfWire++
wire >>= 7
if wire == 0 {
break
}
}
index -= sizeOfWire
skippy, err := code_google_com_p_gogoprotobuf_proto.Skip(data[index:])
if err != nil {
return err
}
if (index + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
index += skippy
}
}
return nil
}
开发者ID:jhadvig,项目名称:origin,代码行数:101,代码来源:etcdserver.pb.go
示例11: Unmarshal
//.........这里部分代码省略.........
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Entries = append(m.Entries, Entry{})
m.Entries[len(m.Entries)-1].Unmarshal(data[index:postIndex])
index = postIndex
case 8:
if wireType != 0 {
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
}
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
m.Commit |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 9:
if wireType != 2 {
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
}
var msglen int
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
postIndex := index + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Snapshot.Unmarshal(data[index:postIndex]); err != nil {
return err
}
index = postIndex
case 10:
if wireType != 0 {
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
}
var v int
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.Reject = bool(v != 0)
case 11:
if wireType != 0 {
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
}
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
m.RejectHint |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default:
var sizeOfWire int
for {
sizeOfWire++
wire >>= 7
if wire == 0 {
break
}
}
index -= sizeOfWire
skippy, err := code_google_com_p_gogoprotobuf_proto.Skip(data[index:])
if err != nil {
return err
}
if (index + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
index += skippy
}
}
return nil
}
开发者ID:jhadvig,项目名称:origin,代码行数:101,代码来源:raft.pb.go
示例12: Unmarshal
func (m *SnapshotRecoveryRequest_Peer) Unmarshal(data []byte) error {
l := len(data)
index := 0
for index < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io5.ErrUnexpectedEOF
}
b := data[index]
index++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
switch fieldNum {
case 1:
if wireType != 2 {
return fmt20.Errorf("proto: wrong wireType = %d for field Name", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io5.ErrUnexpectedEOF
}
b := data[index]
index++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
postIndex := index + int(stringLen)
if postIndex > l {
return io5.ErrUnexpectedEOF
}
s := string(data[index:postIndex])
m.Name = &s
index = postIndex
case 2:
if wireType != 2 {
return fmt20.Errorf("proto: wrong wireType = %d for field ConnectionString", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io5.ErrUnexpectedEOF
}
b := data[index]
index++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
postIndex := index + int(stringLen)
if postIndex > l {
return io5.ErrUnexpectedEOF
}
s := string(data[index:postIndex])
m.ConnectionString = &s
index = postIndex
default:
var sizeOfWire int
for {
sizeOfWire++
wire >>= 7
if wire == 0 {
break
}
}
index -= sizeOfWire
skippy, err := code_google_com_p_gogoprotobuf_proto10.Skip(data[index:])
if err != nil {
return err
}
if (index + skippy) > l {
return io5.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
index += skippy
}
}
return nil
}
开发者ID:Kenterfie,项目名称:influxdb,代码行数:88,代码来源:snapshot_recovery_request.pb.go
示例13: Unmarshal
func (m *AppendEntriesResponse) Unmarshal(data []byte) error {
l := len(data)
index := 0
for index < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io2.ErrUnexpectedEOF
}
b := data[index]
index++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
switch fieldNum {
case 1:
if wireType != 0 {
return proto.ErrWrongType
}
var v uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io2.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.Term = &v
case 2:
if wireType != 0 {
return proto.ErrWrongType
}
var v uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io2.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.Index = &v
case 3:
if wireType != 0 {
return proto.ErrWrongType
}
var v uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io2.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.CommitIndex = &v
case 4:
if wireType != 0 {
return proto.ErrWrongType
}
var v int
for shift := uint(0); ; shift += 7 {
if index >= l {
return io2.ErrUnexpectedEOF
}
b := data[index]
index++
v |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
b := bool(v != 0)
m.Success = &b
default:
var sizeOfWire int
for {
sizeOfWire++
wire >>= 7
if wire == 0 {
break
}
}
index -= sizeOfWire
skippy, err := code_google_com_p_gogoprotobuf_proto4.Skip(data[index:])
if err != nil {
//.........这里部分代码省略.........
开发者ID:9cat,项目名称:influxdb,代码行数:101,代码来源:append_entries_responses.pb.go
示例14: Unmarshal
func (m *SnapshotRef) Unmarshal(data []byte) error {
l := len(data)
index := 0
for index < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if index >= l {
return io2.ErrUnexpectedEOF
}
b := data[index]
index++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
switch fieldNum {
case 1:
if wireType != 2 {
return code_google_com_p_gogoprotobuf_proto2.ErrWrongType
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if index >= l {
return io2.ErrUnexpectedEOF
}
b := data[index]
index++
byteLen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
postIndex := index + byteLen
if postIndex > l {
return io2.ErrUnexpectedEOF
}
if err := m.Key.Unmarshal(data[index:postIndex]); err != nil {
return err
}
index = postIndex
default:
var sizeOfWire int
for {
sizeOfWire++
wire >>= 7
if wire == 0 {
break
}
}
index -= sizeOfWire
skippy, err := code_google_com_p_gogoprotobuf_proto2.Skip(data[index:])
if err != nil {
return err
}
if (index + skippy) > l {
return io2.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
index += skippy
}
}
return nil
}
开发者ID:voidException,项目名称:bazil,代码行数:66,代码来源:snap.pb.go
示例15: Unmarshal
//.........这里部分代码省略.........
return proto.ErrWrongType
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
byteLen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
postIndex := index + byteLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Command = append(m.Command, data[index:postIndex]...)
index = postIndex
case 6:
if wireType != 0 {
return proto.ErrWrongType
}
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
m.Seq |= (int32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 7:
if wireType != 0 {
return proto.ErrWrongType
}
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
m.Deps1 |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 8:
if wireType != 0 {
return proto.ErrWrongType
}
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
m.Deps2 |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 9:
if wireType != 0 {
return proto.ErrWrongType
}
for shift := uint(0); ; shift += 7 {
if index >= l {
return io.ErrUnexpectedEOF
}
b := data[index]
index++
m.Deps3 |= (int32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default:
var sizeOfWire int
for {
sizeOfWire++
wire >>= 7
if wire == 0 {
break
}
}
index -= sizeOfWire
skippy, err := code_google_com_p_gogoprotobuf_proto.Skip(data[index:])
if err != nil {
return err
}
m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
index += skippy
}
}
return nil
}
开发者ID:hongchaodeng,项目名称:serialization-bench,代码行数:101,代码来源:gogopb.pb.go
注:本文中的code/google/com/p/gogoprotobuf/proto.Skip函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论