MCPcopy Index your code
hub / github.com/cockroachdb/errors / Unmarshal

Method Unmarshal

extgrpc/ext_grpc.pb.go:135–203  ·  view source on GitHub ↗
(dAtA []byte)

Source from the content-addressed store, hash-verified

133 return sovExtGrpc(uint64((x << 1) ^ uint64((int64(x) >> 63))))
134}
135func (m *EncodedGrpcCode) Unmarshal(dAtA []byte) error {
136 l := len(dAtA)
137 iNdEx := 0
138 for iNdEx < l {
139 preIndex := iNdEx
140 var wire uint64
141 for shift := uint(0); ; shift += 7 {
142 if shift >= 64 {
143 return ErrIntOverflowExtGrpc
144 }
145 if iNdEx >= l {
146 return io.ErrUnexpectedEOF
147 }
148 b := dAtA[iNdEx]
149 iNdEx++
150 wire |= uint64(b&0x7F) << shift
151 if b < 0x80 {
152 break
153 }
154 }
155 fieldNum := int32(wire >> 3)
156 wireType := int(wire & 0x7)
157 if wireType == 4 {
158 return fmt.Errorf("proto: EncodedGrpcCode: wiretype end group for non-group")
159 }
160 if fieldNum <= 0 {
161 return fmt.Errorf("proto: EncodedGrpcCode: illegal tag %d (wire type %d)", fieldNum, wire)
162 }
163 switch fieldNum {
164 case 1:
165 if wireType != 0 {
166 return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType)
167 }
168 m.Code = 0
169 for shift := uint(0); ; shift += 7 {
170 if shift >= 64 {
171 return ErrIntOverflowExtGrpc
172 }
173 if iNdEx >= l {
174 return io.ErrUnexpectedEOF
175 }
176 b := dAtA[iNdEx]
177 iNdEx++
178 m.Code |= uint32(b&0x7F) << shift
179 if b < 0x80 {
180 break
181 }
182 }
183 default:
184 iNdEx = preIndex
185 skippy, err := skipExtGrpc(dAtA[iNdEx:])
186 if err != nil {
187 return err
188 }
189 if (skippy < 0) || (iNdEx+skippy) < 0 {
190 return ErrInvalidLengthExtGrpc
191 }
192 if (iNdEx + skippy) > l {

Callers 2

XXX_UnmarshalMethod · 0.95
TestEncodeDecodeStatusFunction · 0.45

Calls 1

skipExtGrpcFunction · 0.85

Tested by 1

TestEncodeDecodeStatusFunction · 0.36