From 4800600529aabc0510664afc722426b14c1d07b7 Mon Sep 17 00:00:00 2001 From: Corentin Dupret Date: Wed, 20 Sep 2023 19:34:01 +0200 Subject: [PATCH 01/10] Add unsafe code to UnmarshalVT --- .../conformance/conformance_vtproto.pb.go | 884 +- .../test_messages_proto2_vtproto.pb.go | 7448 +++++++++++++++- .../test_messages_proto3_vtproto.pb.go | 7710 +++++++++++++++++ features/unmarshal/unmarshal.go | 60 +- testproto/pool/pool_vtproto.pb.go | 107 + testproto/pool/pool_with_oneof_vtproto.pb.go | 484 ++ .../pool/pool_with_slice_reuse_vtproto.pb.go | 536 +- testproto/proto2/scalars_vtproto.pb.go | 4638 ++++++++-- testproto/proto3opt/opt_vtproto.pb.go | 355 + 9 files changed, 21508 insertions(+), 714 deletions(-) diff --git a/conformance/internal/conformance/conformance_vtproto.pb.go b/conformance/internal/conformance/conformance_vtproto.pb.go index 47f7ac8..64c5412 100644 --- a/conformance/internal/conformance/conformance_vtproto.pb.go +++ b/conformance/internal/conformance/conformance_vtproto.pb.go @@ -1639,6 +1639,89 @@ func (m *FailureSet) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *FailureSet) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: FailureSet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FailureSet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Failure", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Failure = append(m.Failure, unsafeBytesToString(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ConformanceRequest) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1945,7 +2028,7 @@ func (m *ConformanceRequest) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { +func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1968,17 +2051,17 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ConformanceResponse: wiretype end group for non-group") + return fmt.Errorf("proto: ConformanceRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ConformanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ConformanceRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParseError", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProtobufPayload", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -1988,27 +2071,27 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_ParseError{ParseError: string(dAtA[iNdEx:postIndex])} + v := dAtA[iNdEx:postIndex] + m.Payload = &ConformanceRequest_ProtobufPayload{ProtobufPayload: v} iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RuntimeError", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field JsonPayload", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2036,13 +2119,13 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_RuntimeError{RuntimeError: string(dAtA[iNdEx:postIndex])} + m.Payload = &ConformanceRequest_JsonPayload{JsonPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} iNdEx = postIndex case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProtobufPayload", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestedOutputFormat", wireType) } - var byteLen int + m.RequestedOutputFormat = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -2052,28 +2135,14 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + m.RequestedOutputFormat |= WireFormat(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := make([]byte, postIndex-iNdEx) - copy(v, dAtA[iNdEx:postIndex]) - m.Result = &ConformanceResponse_ProtobufPayload{ProtobufPayload: v} - iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field JsonPayload", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MessageType", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2101,13 +2170,13 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_JsonPayload{JsonPayload: string(dAtA[iNdEx:postIndex])} + m.MessageType = unsafeBytesToString(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Skipped", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TestCategory", wireType) } - var stringLen uint64 + m.TestCategory = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -2117,29 +2186,16 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TestCategory |= TestCategory(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Result = &ConformanceResponse_Skipped{Skipped: string(dAtA[iNdEx:postIndex])} - iNdEx = postIndex case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SerializeError", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field JspbEncodingOptions", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -2149,23 +2205,27 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_SerializeError{SerializeError: string(dAtA[iNdEx:postIndex])} + if m.JspbEncodingOptions == nil { + m.JspbEncodingOptions = &JspbEncodingConfig{} + } + if err := m.JspbEncodingOptions.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 7: if wireType != 2 { @@ -2197,7 +2257,7 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_JspbPayload{JspbPayload: string(dAtA[iNdEx:postIndex])} + m.Payload = &ConformanceRequest_JspbPayload{JspbPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} iNdEx = postIndex case 8: if wireType != 2 { @@ -2229,8 +2289,28 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_TextPayload{TextPayload: string(dAtA[iNdEx:postIndex])} + m.Payload = &ConformanceRequest_TextPayload{TextPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PrintUnknownFields", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PrintUnknownFields = bool(v != 0) default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -2253,7 +2333,693 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *JspbEncodingConfig) UnmarshalVT(dAtA []byte) error { +func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: ConformanceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConformanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParseError", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = &ConformanceResponse_ParseError{ParseError: string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RuntimeError", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = &ConformanceResponse_RuntimeError{RuntimeError: string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProtobufPayload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.Result = &ConformanceResponse_ProtobufPayload{ProtobufPayload: v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field JsonPayload", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = &ConformanceResponse_JsonPayload{JsonPayload: string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Skipped", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = &ConformanceResponse_Skipped{Skipped: string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SerializeError", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = &ConformanceResponse_SerializeError{SerializeError: string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field JspbPayload", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = &ConformanceResponse_JspbPayload{JspbPayload: string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TextPayload", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = &ConformanceResponse_TextPayload{TextPayload: string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConformanceResponse) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: ConformanceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConformanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParseError", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = &ConformanceResponse_ParseError{ParseError: unsafeBytesToString(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RuntimeError", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = &ConformanceResponse_RuntimeError{RuntimeError: unsafeBytesToString(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProtobufPayload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := dAtA[iNdEx:postIndex] + m.Result = &ConformanceResponse_ProtobufPayload{ProtobufPayload: v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field JsonPayload", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = &ConformanceResponse_JsonPayload{JsonPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Skipped", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = &ConformanceResponse_Skipped{Skipped: unsafeBytesToString(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SerializeError", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = &ConformanceResponse_SerializeError{SerializeError: unsafeBytesToString(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field JspbPayload", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = &ConformanceResponse_JspbPayload{JspbPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TextPayload", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = &ConformanceResponse_TextPayload{TextPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *JspbEncodingConfig) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: JspbEncodingConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: JspbEncodingConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UseJspbArrayAnyFormat", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UseJspbArrayAnyFormat = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *JspbEncodingConfig) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { diff --git a/conformance/internal/conformance/test_messages_proto2_vtproto.pb.go b/conformance/internal/conformance/test_messages_proto2_vtproto.pb.go index a627ad5..c5a563f 100644 --- a/conformance/internal/conformance/test_messages_proto2_vtproto.pb.go +++ b/conformance/internal/conformance/test_messages_proto2_vtproto.pb.go @@ -12,6 +12,7 @@ import ( io "io" math "math" bits "math/bits" + unsafe "unsafe" ) const ( @@ -14098,6 +14099,6820 @@ func (m *TestAllTypesProto2) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *TestAllTypesProto2_NestedMessage) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: TestAllTypesProto2_NestedMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TestAllTypesProto2_NestedMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field A", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.A = &v + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Corecursive", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Corecursive == nil { + m.Corecursive = &TestAllTypesProto2{} + } + if err := m.Corecursive.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TestAllTypesProto2_Data) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: TestAllTypesProto2_Data: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TestAllTypesProto2_Data: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 202: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GroupInt32", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.GroupInt32 = &v + case 203: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GroupUint32", wireType) + } + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.GroupUint32 = &v + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TestAllTypesProto2_MessageSetCorrect) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrect: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrect: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + if (fieldNum >= 4) && (fieldNum < 2147483647) { + err = proto.UnmarshalOptions{AllowPartial: true}.Unmarshal(dAtA[iNdEx:iNdEx+skippy], m) + if err != nil { + return err + } + iNdEx += skippy + } else { + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TestAllTypesProto2_MessageSetCorrectExtension1) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrectExtension1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrectExtension1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 25: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Str", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.Str = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TestAllTypesProto2_MessageSetCorrectExtension2) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrectExtension2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrectExtension2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field I", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.I = &v + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: TestAllTypesProto2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TestAllTypesProto2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalInt32", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptionalInt32 = &v + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalInt64", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptionalInt64 = &v + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalUint32", wireType) + } + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptionalUint32 = &v + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalUint64", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptionalUint64 = &v + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalSint32", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.OptionalSint32 = &v + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalSint64", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + v2 := int64(v) + m.OptionalSint64 = &v2 + case 7: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalFixed32", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.OptionalFixed32 = &v + case 8: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalFixed64", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.OptionalFixed64 = &v + case 9: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalSfixed32", wireType) + } + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.OptionalSfixed32 = &v + case 10: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalSfixed64", wireType) + } + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.OptionalSfixed64 = &v + case 11: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalFloat", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.OptionalFloat = &v2 + case 12: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalDouble", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.OptionalDouble = &v2 + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalBool", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.OptionalBool = &b + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.OptionalString = &s + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalBytes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OptionalBytes = append(m.OptionalBytes[:0], dAtA[iNdEx:postIndex]...) + if m.OptionalBytes == nil { + m.OptionalBytes = []byte{} + } + iNdEx = postIndex + case 18: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalNestedMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalNestedMessage == nil { + m.OptionalNestedMessage = &TestAllTypesProto2_NestedMessage{} + } + if err := m.OptionalNestedMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 19: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalForeignMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalForeignMessage == nil { + m.OptionalForeignMessage = &ForeignMessageProto2{} + } + if err := m.OptionalForeignMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 21: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalNestedEnum", wireType) + } + var v TestAllTypesProto2_NestedEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= TestAllTypesProto2_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptionalNestedEnum = &v + case 22: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalForeignEnum", wireType) + } + var v ForeignEnumProto2 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= ForeignEnumProto2(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptionalForeignEnum = &v + case 24: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalStringPiece", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.OptionalStringPiece = &s + iNdEx = postIndex + case 25: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalCord", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.OptionalCord = &s + iNdEx = postIndex + case 27: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RecursiveMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RecursiveMessage == nil { + m.RecursiveMessage = &TestAllTypesProto2{} + } + if err := m.RecursiveMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 31: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedInt32 = append(m.RepeatedInt32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedInt32) == 0 { + m.RepeatedInt32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedInt32 = append(m.RepeatedInt32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedInt32", wireType) + } + case 32: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedInt64 = append(m.RepeatedInt64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedInt64) == 0 { + m.RepeatedInt64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedInt64 = append(m.RepeatedInt64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedInt64", wireType) + } + case 33: + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedUint32 = append(m.RepeatedUint32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedUint32) == 0 { + m.RepeatedUint32 = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedUint32 = append(m.RepeatedUint32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedUint32", wireType) + } + case 34: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedUint64 = append(m.RepeatedUint64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedUint64) == 0 { + m.RepeatedUint64 = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedUint64 = append(m.RepeatedUint64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedUint64", wireType) + } + case 35: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.RepeatedSint32 = append(m.RepeatedSint32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedSint32) == 0 { + m.RepeatedSint32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.RepeatedSint32 = append(m.RepeatedSint32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedSint32", wireType) + } + case 36: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.RepeatedSint64 = append(m.RepeatedSint64, int64(v)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedSint64) == 0 { + m.RepeatedSint64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.RepeatedSint64 = append(m.RepeatedSint64, int64(v)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedSint64", wireType) + } + case 37: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedFixed32 = append(m.RepeatedFixed32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.RepeatedFixed32) == 0 { + m.RepeatedFixed32 = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedFixed32 = append(m.RepeatedFixed32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFixed32", wireType) + } + case 38: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedFixed64 = append(m.RepeatedFixed64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.RepeatedFixed64) == 0 { + m.RepeatedFixed64 = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedFixed64 = append(m.RepeatedFixed64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFixed64", wireType) + } + case 39: + if wireType == 5 { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedSfixed32 = append(m.RepeatedSfixed32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.RepeatedSfixed32) == 0 { + m.RepeatedSfixed32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedSfixed32 = append(m.RepeatedSfixed32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedSfixed32", wireType) + } + case 40: + if wireType == 1 { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedSfixed64 = append(m.RepeatedSfixed64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.RepeatedSfixed64) == 0 { + m.RepeatedSfixed64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedSfixed64 = append(m.RepeatedSfixed64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedSfixed64", wireType) + } + case 41: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.RepeatedFloat = append(m.RepeatedFloat, v2) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.RepeatedFloat) == 0 { + m.RepeatedFloat = make([]float32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.RepeatedFloat = append(m.RepeatedFloat, v2) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFloat", wireType) + } + case 42: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.RepeatedDouble = append(m.RepeatedDouble, v2) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.RepeatedDouble) == 0 { + m.RepeatedDouble = make([]float64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.RepeatedDouble = append(m.RepeatedDouble, v2) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedDouble", wireType) + } + case 43: + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedBool = append(m.RepeatedBool, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(m.RepeatedBool) == 0 { + m.RepeatedBool = make([]bool, 0, elementCount) + } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedBool = append(m.RepeatedBool, bool(v != 0)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedBool", wireType) + } + case 44: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedString = append(m.RepeatedString, unsafeBytesToString(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 45: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedBytes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedBytes = append(m.RepeatedBytes, dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 48: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedNestedMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedNestedMessage = append(m.RepeatedNestedMessage, &TestAllTypesProto2_NestedMessage{}) + if err := m.RepeatedNestedMessage[len(m.RepeatedNestedMessage)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 49: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedForeignMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedForeignMessage = append(m.RepeatedForeignMessage, &ForeignMessageProto2{}) + if err := m.RepeatedForeignMessage[len(m.RepeatedForeignMessage)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 51: + if wireType == 0 { + var v TestAllTypesProto2_NestedEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= TestAllTypesProto2_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedNestedEnum = append(m.RepeatedNestedEnum, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + if elementCount != 0 && len(m.RepeatedNestedEnum) == 0 { + m.RepeatedNestedEnum = make([]TestAllTypesProto2_NestedEnum, 0, elementCount) + } + for iNdEx < postIndex { + var v TestAllTypesProto2_NestedEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= TestAllTypesProto2_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedNestedEnum = append(m.RepeatedNestedEnum, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedNestedEnum", wireType) + } + case 52: + if wireType == 0 { + var v ForeignEnumProto2 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= ForeignEnumProto2(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedForeignEnum = append(m.RepeatedForeignEnum, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + if elementCount != 0 && len(m.RepeatedForeignEnum) == 0 { + m.RepeatedForeignEnum = make([]ForeignEnumProto2, 0, elementCount) + } + for iNdEx < postIndex { + var v ForeignEnumProto2 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= ForeignEnumProto2(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedForeignEnum = append(m.RepeatedForeignEnum, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedForeignEnum", wireType) + } + case 54: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedStringPiece", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedStringPiece = append(m.RepeatedStringPiece, unsafeBytesToString(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 55: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedCord", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedCord = append(m.RepeatedCord, unsafeBytesToString(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 56: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapInt32Int32", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapInt32Int32 == nil { + m.MapInt32Int32 = make(map[int32]int32) + } + var mapkey int32 + var mapvalue int32 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapInt32Int32[mapkey] = mapvalue + iNdEx = postIndex + case 57: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapInt64Int64", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapInt64Int64 == nil { + m.MapInt64Int64 = make(map[int64]int64) + } + var mapkey int64 + var mapvalue int64 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapInt64Int64[mapkey] = mapvalue + iNdEx = postIndex + case 58: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapUint32Uint32", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapUint32Uint32 == nil { + m.MapUint32Uint32 = make(map[uint32]uint32) + } + var mapkey uint32 + var mapvalue uint32 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapUint32Uint32[mapkey] = mapvalue + iNdEx = postIndex + case 59: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapUint64Uint64", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapUint64Uint64 == nil { + m.MapUint64Uint64 = make(map[uint64]uint64) + } + var mapkey uint64 + var mapvalue uint64 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapUint64Uint64[mapkey] = mapvalue + iNdEx = postIndex + case 60: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapSint32Sint32", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapSint32Sint32 == nil { + m.MapSint32Sint32 = make(map[int32]int32) + } + var mapkey int32 + var mapvalue int32 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var mapkeytemp int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkeytemp |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + mapkeytemp = int32((uint32(mapkeytemp) >> 1) ^ uint32(((mapkeytemp&1)<<31)>>31)) + mapkey = int32(mapkeytemp) + } else if fieldNum == 2 { + var mapvaluetemp int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvaluetemp |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + mapvaluetemp = int32((uint32(mapvaluetemp) >> 1) ^ uint32(((mapvaluetemp&1)<<31)>>31)) + mapvalue = int32(mapvaluetemp) + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapSint32Sint32[mapkey] = mapvalue + iNdEx = postIndex + case 61: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapSint64Sint64", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapSint64Sint64 == nil { + m.MapSint64Sint64 = make(map[int64]int64) + } + var mapkey int64 + var mapvalue int64 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var mapkeytemp uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkeytemp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + mapkeytemp = (mapkeytemp >> 1) ^ uint64((int64(mapkeytemp&1)<<63)>>63) + mapkey = int64(mapkeytemp) + } else if fieldNum == 2 { + var mapvaluetemp uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvaluetemp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + mapvaluetemp = (mapvaluetemp >> 1) ^ uint64((int64(mapvaluetemp&1)<<63)>>63) + mapvalue = int64(mapvaluetemp) + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapSint64Sint64[mapkey] = mapvalue + iNdEx = postIndex + case 62: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapFixed32Fixed32", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapFixed32Fixed32 == nil { + m.MapFixed32Fixed32 = make(map[uint32]uint32) + } + var mapkey uint32 + var mapvalue uint32 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + mapkey = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + } else if fieldNum == 2 { + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + mapvalue = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapFixed32Fixed32[mapkey] = mapvalue + iNdEx = postIndex + case 63: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapFixed64Fixed64", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapFixed64Fixed64 == nil { + m.MapFixed64Fixed64 = make(map[uint64]uint64) + } + var mapkey uint64 + var mapvalue uint64 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + mapkey = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + } else if fieldNum == 2 { + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + mapvalue = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapFixed64Fixed64[mapkey] = mapvalue + iNdEx = postIndex + case 64: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapSfixed32Sfixed32", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapSfixed32Sfixed32 == nil { + m.MapSfixed32Sfixed32 = make(map[int32]int32) + } + var mapkey int32 + var mapvalue int32 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + mapkey = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + } else if fieldNum == 2 { + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + mapvalue = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapSfixed32Sfixed32[mapkey] = mapvalue + iNdEx = postIndex + case 65: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapSfixed64Sfixed64", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapSfixed64Sfixed64 == nil { + m.MapSfixed64Sfixed64 = make(map[int64]int64) + } + var mapkey int64 + var mapvalue int64 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + mapkey = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + } else if fieldNum == 2 { + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + mapvalue = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapSfixed64Sfixed64[mapkey] = mapvalue + iNdEx = postIndex + case 66: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapInt32Float", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapInt32Float == nil { + m.MapInt32Float = make(map[int32]float32) + } + var mapkey int32 + var mapvalue float32 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + var mapvaluetemp uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + mapvaluetemp = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + mapvalue = math.Float32frombits(mapvaluetemp) + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapInt32Float[mapkey] = mapvalue + iNdEx = postIndex + case 67: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapInt32Double", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapInt32Double == nil { + m.MapInt32Double = make(map[int32]float64) + } + var mapkey int32 + var mapvalue float64 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + var mapvaluetemp uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + mapvaluetemp = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + mapvalue = math.Float64frombits(mapvaluetemp) + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapInt32Double[mapkey] = mapvalue + iNdEx = postIndex + case 68: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapBoolBool", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapBoolBool == nil { + m.MapBoolBool = make(map[bool]bool) + } + var mapkey bool + var mapvalue bool + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var mapkeytemp int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkeytemp |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + mapkey = bool(mapkeytemp != 0) + } else if fieldNum == 2 { + var mapvaluetemp int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvaluetemp |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + mapvalue = bool(mapvaluetemp != 0) + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapBoolBool[mapkey] = mapvalue + iNdEx = postIndex + case 69: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapStringString", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapStringString == nil { + m.MapStringString = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLength + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLength + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapStringString[mapkey] = mapvalue + iNdEx = postIndex + case 70: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapStringBytes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapStringBytes == nil { + m.MapStringBytes = make(map[string][]byte) + } + var mapkey string + var mapvalue []byte + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapbyteLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapbyteLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intMapbyteLen := int(mapbyteLen) + if intMapbyteLen < 0 { + return ErrInvalidLength + } + postbytesIndex := iNdEx + intMapbyteLen + if postbytesIndex < 0 { + return ErrInvalidLength + } + if postbytesIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = make([]byte, mapbyteLen) + copy(mapvalue, dAtA[iNdEx:postbytesIndex]) + iNdEx = postbytesIndex + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapStringBytes[mapkey] = mapvalue + iNdEx = postIndex + case 71: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapStringNestedMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapStringNestedMessage == nil { + m.MapStringNestedMessage = make(map[string]*TestAllTypesProto2_NestedMessage) + } + var mapkey string + var mapvalue *TestAllTypesProto2_NestedMessage + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLength + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLength + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &TestAllTypesProto2_NestedMessage{} + if err := mapvalue.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapStringNestedMessage[mapkey] = mapvalue + iNdEx = postIndex + case 72: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapStringForeignMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapStringForeignMessage == nil { + m.MapStringForeignMessage = make(map[string]*ForeignMessageProto2) + } + var mapkey string + var mapvalue *ForeignMessageProto2 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLength + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLength + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &ForeignMessageProto2{} + if err := mapvalue.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapStringForeignMessage[mapkey] = mapvalue + iNdEx = postIndex + case 73: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapStringNestedEnum", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapStringNestedEnum == nil { + m.MapStringNestedEnum = make(map[string]TestAllTypesProto2_NestedEnum) + } + var mapkey string + var mapvalue TestAllTypesProto2_NestedEnum + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= TestAllTypesProto2_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapStringNestedEnum[mapkey] = mapvalue + iNdEx = postIndex + case 74: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapStringForeignEnum", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapStringForeignEnum == nil { + m.MapStringForeignEnum = make(map[string]ForeignEnumProto2) + } + var mapkey string + var mapvalue ForeignEnumProto2 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= ForeignEnumProto2(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapStringForeignEnum[mapkey] = mapvalue + iNdEx = postIndex + case 75: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedInt32 = append(m.PackedInt32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedInt32) == 0 { + m.PackedInt32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedInt32 = append(m.PackedInt32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedInt32", wireType) + } + case 76: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedInt64 = append(m.PackedInt64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedInt64) == 0 { + m.PackedInt64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedInt64 = append(m.PackedInt64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedInt64", wireType) + } + case 77: + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedUint32 = append(m.PackedUint32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedUint32) == 0 { + m.PackedUint32 = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedUint32 = append(m.PackedUint32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedUint32", wireType) + } + case 78: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedUint64 = append(m.PackedUint64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedUint64) == 0 { + m.PackedUint64 = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedUint64 = append(m.PackedUint64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedUint64", wireType) + } + case 79: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.PackedSint32 = append(m.PackedSint32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedSint32) == 0 { + m.PackedSint32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.PackedSint32 = append(m.PackedSint32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedSint32", wireType) + } + case 80: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.PackedSint64 = append(m.PackedSint64, int64(v)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedSint64) == 0 { + m.PackedSint64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.PackedSint64 = append(m.PackedSint64, int64(v)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedSint64", wireType) + } + case 81: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedFixed32 = append(m.PackedFixed32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.PackedFixed32) == 0 { + m.PackedFixed32 = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedFixed32 = append(m.PackedFixed32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedFixed32", wireType) + } + case 82: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedFixed64 = append(m.PackedFixed64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.PackedFixed64) == 0 { + m.PackedFixed64 = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedFixed64 = append(m.PackedFixed64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedFixed64", wireType) + } + case 83: + if wireType == 5 { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedSfixed32 = append(m.PackedSfixed32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.PackedSfixed32) == 0 { + m.PackedSfixed32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedSfixed32 = append(m.PackedSfixed32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedSfixed32", wireType) + } + case 84: + if wireType == 1 { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedSfixed64 = append(m.PackedSfixed64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.PackedSfixed64) == 0 { + m.PackedSfixed64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedSfixed64 = append(m.PackedSfixed64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedSfixed64", wireType) + } + case 85: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.PackedFloat = append(m.PackedFloat, v2) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.PackedFloat) == 0 { + m.PackedFloat = make([]float32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.PackedFloat = append(m.PackedFloat, v2) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedFloat", wireType) + } + case 86: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.PackedDouble = append(m.PackedDouble, v2) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.PackedDouble) == 0 { + m.PackedDouble = make([]float64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.PackedDouble = append(m.PackedDouble, v2) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedDouble", wireType) + } + case 87: + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedBool = append(m.PackedBool, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(m.PackedBool) == 0 { + m.PackedBool = make([]bool, 0, elementCount) + } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedBool = append(m.PackedBool, bool(v != 0)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedBool", wireType) + } + case 88: + if wireType == 0 { + var v TestAllTypesProto2_NestedEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= TestAllTypesProto2_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedNestedEnum = append(m.PackedNestedEnum, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + if elementCount != 0 && len(m.PackedNestedEnum) == 0 { + m.PackedNestedEnum = make([]TestAllTypesProto2_NestedEnum, 0, elementCount) + } + for iNdEx < postIndex { + var v TestAllTypesProto2_NestedEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= TestAllTypesProto2_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedNestedEnum = append(m.PackedNestedEnum, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedNestedEnum", wireType) + } + case 89: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedInt32 = append(m.UnpackedInt32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.UnpackedInt32) == 0 { + m.UnpackedInt32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedInt32 = append(m.UnpackedInt32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedInt32", wireType) + } + case 90: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedInt64 = append(m.UnpackedInt64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.UnpackedInt64) == 0 { + m.UnpackedInt64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedInt64 = append(m.UnpackedInt64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedInt64", wireType) + } + case 91: + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedUint32 = append(m.UnpackedUint32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.UnpackedUint32) == 0 { + m.UnpackedUint32 = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedUint32 = append(m.UnpackedUint32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedUint32", wireType) + } + case 92: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedUint64 = append(m.UnpackedUint64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.UnpackedUint64) == 0 { + m.UnpackedUint64 = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedUint64 = append(m.UnpackedUint64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedUint64", wireType) + } + case 93: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.UnpackedSint32 = append(m.UnpackedSint32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.UnpackedSint32) == 0 { + m.UnpackedSint32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.UnpackedSint32 = append(m.UnpackedSint32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedSint32", wireType) + } + case 94: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.UnpackedSint64 = append(m.UnpackedSint64, int64(v)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.UnpackedSint64) == 0 { + m.UnpackedSint64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.UnpackedSint64 = append(m.UnpackedSint64, int64(v)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedSint64", wireType) + } + case 95: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.UnpackedFixed32 = append(m.UnpackedFixed32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.UnpackedFixed32) == 0 { + m.UnpackedFixed32 = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.UnpackedFixed32 = append(m.UnpackedFixed32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedFixed32", wireType) + } + case 96: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.UnpackedFixed64 = append(m.UnpackedFixed64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.UnpackedFixed64) == 0 { + m.UnpackedFixed64 = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.UnpackedFixed64 = append(m.UnpackedFixed64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedFixed64", wireType) + } + case 97: + if wireType == 5 { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.UnpackedSfixed32 = append(m.UnpackedSfixed32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.UnpackedSfixed32) == 0 { + m.UnpackedSfixed32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.UnpackedSfixed32 = append(m.UnpackedSfixed32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedSfixed32", wireType) + } + case 98: + if wireType == 1 { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.UnpackedSfixed64 = append(m.UnpackedSfixed64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.UnpackedSfixed64) == 0 { + m.UnpackedSfixed64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.UnpackedSfixed64 = append(m.UnpackedSfixed64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedSfixed64", wireType) + } + case 99: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.UnpackedFloat = append(m.UnpackedFloat, v2) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.UnpackedFloat) == 0 { + m.UnpackedFloat = make([]float32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.UnpackedFloat = append(m.UnpackedFloat, v2) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedFloat", wireType) + } + case 100: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.UnpackedDouble = append(m.UnpackedDouble, v2) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.UnpackedDouble) == 0 { + m.UnpackedDouble = make([]float64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.UnpackedDouble = append(m.UnpackedDouble, v2) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedDouble", wireType) + } + case 101: + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedBool = append(m.UnpackedBool, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(m.UnpackedBool) == 0 { + m.UnpackedBool = make([]bool, 0, elementCount) + } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedBool = append(m.UnpackedBool, bool(v != 0)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedBool", wireType) + } + case 102: + if wireType == 0 { + var v TestAllTypesProto2_NestedEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= TestAllTypesProto2_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedNestedEnum = append(m.UnpackedNestedEnum, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + if elementCount != 0 && len(m.UnpackedNestedEnum) == 0 { + m.UnpackedNestedEnum = make([]TestAllTypesProto2_NestedEnum, 0, elementCount) + } + for iNdEx < postIndex { + var v TestAllTypesProto2_NestedEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= TestAllTypesProto2_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedNestedEnum = append(m.UnpackedNestedEnum, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedNestedEnum", wireType) + } + case 111: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofUint32", wireType) + } + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OneofField = &TestAllTypesProto2_OneofUint32{OneofUint32: v} + case 112: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofNestedMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.OneofField.(*TestAllTypesProto2_OneofNestedMessage); ok { + if err := oneof.OneofNestedMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &TestAllTypesProto2_NestedMessage{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.OneofField = &TestAllTypesProto2_OneofNestedMessage{OneofNestedMessage: v} + } + iNdEx = postIndex + case 113: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OneofField = &TestAllTypesProto2_OneofString{OneofString: unsafeBytesToString(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 114: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofBytes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := dAtA[iNdEx:postIndex] + m.OneofField = &TestAllTypesProto2_OneofBytes{OneofBytes: v} + iNdEx = postIndex + case 115: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofBool", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.OneofField = &TestAllTypesProto2_OneofBool{OneofBool: b} + case 116: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofUint64", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OneofField = &TestAllTypesProto2_OneofUint64{OneofUint64: v} + case 117: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofFloat", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.OneofField = &TestAllTypesProto2_OneofFloat{OneofFloat: float32(math.Float32frombits(v))} + case 118: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofDouble", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.OneofField = &TestAllTypesProto2_OneofDouble{OneofDouble: float64(math.Float64frombits(v))} + case 119: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofEnum", wireType) + } + var v TestAllTypesProto2_NestedEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= TestAllTypesProto2_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OneofField = &TestAllTypesProto2_OneofEnum{OneofEnum: v} + case 201: + if wireType != 3 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + groupStart := iNdEx + for { + maybeGroupEnd := iNdEx + var groupFieldWire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + groupFieldWire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + groupWireType := int(wire & 0x7) + if groupWireType == 4 { + if err := m.Data.UnmarshalVT(dAtA[groupStart:maybeGroupEnd]); err != nil { + return err + } + break + } + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + iNdEx += skippy + } + case 241: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultInt32", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DefaultInt32 = &v + case 242: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultInt64", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DefaultInt64 = &v + case 243: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultUint32", wireType) + } + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DefaultUint32 = &v + case 244: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultUint64", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DefaultUint64 = &v + case 245: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultSint32", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.DefaultSint32 = &v + case 246: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultSint64", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + v2 := int64(v) + m.DefaultSint64 = &v2 + case 247: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultFixed32", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.DefaultFixed32 = &v + case 248: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultFixed64", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.DefaultFixed64 = &v + case 249: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultSfixed32", wireType) + } + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.DefaultSfixed32 = &v + case 250: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultSfixed64", wireType) + } + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.DefaultSfixed64 = &v + case 251: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultFloat", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.DefaultFloat = &v2 + case 252: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultDouble", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.DefaultDouble = &v2 + case 253: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultBool", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.DefaultBool = &b + case 254: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.DefaultString = &s + iNdEx = postIndex + case 255: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultBytes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DefaultBytes = append(m.DefaultBytes[:0], dAtA[iNdEx:postIndex]...) + if m.DefaultBytes == nil { + m.DefaultBytes = []byte{} + } + iNdEx = postIndex + case 401: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Fieldname1", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Fieldname1 = &v + case 402: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldName2", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FieldName2 = &v + case 403: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field XFieldName3", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.XFieldName3 = &v + case 404: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Field_Name4_", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Field_Name4_ = &v + case 405: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Field0Name5", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Field0Name5 = &v + case 406: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Field_0Name6", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Field_0Name6 = &v + case 407: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldName7", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FieldName7 = &v + case 408: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldName8", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FieldName8 = &v + case 409: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Field_Name9", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Field_Name9 = &v + case 410: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Field_Name10", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Field_Name10 = &v + case 411: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FIELD_NAME11", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FIELD_NAME11 = &v + case 412: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FIELDName12", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FIELDName12 = &v + case 413: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field XFieldName13", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.XFieldName13 = &v + case 414: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field X_FieldName14", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.X_FieldName14 = &v + case 415: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Field_Name15", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Field_Name15 = &v + case 416: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Field__Name16", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Field__Name16 = &v + case 417: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldName17__", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FieldName17__ = &v + case 418: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldName18__", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FieldName18__ = &v + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + if (fieldNum >= 120) && (fieldNum < 201) { + err = proto.UnmarshalOptions{AllowPartial: true}.Unmarshal(dAtA[iNdEx:iNdEx+skippy], m) + if err != nil { + return err + } + iNdEx += skippy + } else { + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ForeignMessageProto2) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -14121,32 +20936,449 @@ func (m *ForeignMessageProto2) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ForeignMessageProto2: wiretype end group for non-group") + return fmt.Errorf("proto: ForeignMessageProto2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ForeignMessageProto2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field C", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.C = &v + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ForeignMessageProto2) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: ForeignMessageProto2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ForeignMessageProto2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field C", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.C = &v + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnknownToTestAllTypes_OptionalGroup) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: UnknownToTestAllTypes_OptionalGroup: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ForeignMessageProto2: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: UnknownToTestAllTypes_OptionalGroup: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field C", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field A", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.A = &v + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnknownToTestAllTypes) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: UnknownToTestAllTypes: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnknownToTestAllTypes: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1001: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalInt32", wireType) } var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow } - if iNdEx >= l { + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptionalInt32 = &v + case 1002: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.OptionalString = &s + iNdEx = postIndex + case 1003: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NestedMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NestedMessage == nil { + m.NestedMessage = &ForeignMessageProto2{} + } + if err := m.NestedMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 1004: + if wireType != 3 { + return fmt.Errorf("proto: wrong wireType = %d for field Optionalgroup", wireType) + } + groupStart := iNdEx + for { + maybeGroupEnd := iNdEx + var groupFieldWire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + groupFieldWire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + groupWireType := int(wire & 0x7) + if groupWireType == 4 { + if err := m.Optionalgroup.UnmarshalVT(dAtA[groupStart:maybeGroupEnd]); err != nil { + return err + } + break + } + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + iNdEx += skippy + } + case 1006: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalBool", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.OptionalBool = &b + case 1011: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedInt32 = append(m.RepeatedInt32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedInt32) == 0 { + m.RepeatedInt32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedInt32 = append(m.RepeatedInt32, v) } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedInt32", wireType) } - m.C = &v default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -14169,7 +21401,7 @@ func (m *ForeignMessageProto2) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *UnknownToTestAllTypes_OptionalGroup) UnmarshalVT(dAtA []byte) error { +func (m *UnknownToTestAllTypes_OptionalGroup) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -14240,7 +21472,7 @@ func (m *UnknownToTestAllTypes_OptionalGroup) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *UnknownToTestAllTypes) UnmarshalVT(dAtA []byte) error { +func (m *UnknownToTestAllTypes) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -14319,7 +21551,7 @@ func (m *UnknownToTestAllTypes) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := string(dAtA[iNdEx:postIndex]) + s := unsafeBytesToString(dAtA[iNdEx:postIndex]) m.OptionalString = &s iNdEx = postIndex case 1003: @@ -14566,6 +21798,57 @@ func (m *NullHypothesisProto2) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *NullHypothesisProto2) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: NullHypothesisProto2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NullHypothesisProto2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *EnumOnlyProto2) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -14617,6 +21900,57 @@ func (m *EnumOnlyProto2) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *EnumOnlyProto2) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: EnumOnlyProto2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EnumOnlyProto2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *OneStringProto2) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -14701,6 +22035,90 @@ func (m *OneStringProto2) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *OneStringProto2) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: OneStringProto2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OneStringProto2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.Data = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skip(dAtA []byte) (n int, err error) { l := len(dAtA) @@ -14786,3 +22204,7 @@ var ( ErrIntOverflow = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") ) + +func unsafeBytesToString(b []byte) string { + return *(*string)(unsafe.Pointer(&b)) +} diff --git a/conformance/internal/conformance/test_messages_proto3_vtproto.pb.go b/conformance/internal/conformance/test_messages_proto3_vtproto.pb.go index 215dc10..2e73fbf 100644 --- a/conformance/internal/conformance/test_messages_proto3_vtproto.pb.go +++ b/conformance/internal/conformance/test_messages_proto3_vtproto.pb.go @@ -16214,6 +16214,7544 @@ func (m *TestAllTypesProto3) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *TestAllTypesProto3_NestedMessage) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: TestAllTypesProto3_NestedMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TestAllTypesProto3_NestedMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field A", wireType) + } + m.A = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.A |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Corecursive", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Corecursive == nil { + m.Corecursive = &TestAllTypesProto3{} + } + if err := m.Corecursive.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: TestAllTypesProto3: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TestAllTypesProto3: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalInt32", wireType) + } + m.OptionalInt32 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OptionalInt32 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalInt64", wireType) + } + m.OptionalInt64 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OptionalInt64 |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalUint32", wireType) + } + m.OptionalUint32 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OptionalUint32 |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalUint64", wireType) + } + m.OptionalUint64 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OptionalUint64 |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalSint32", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.OptionalSint32 = v + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalSint64", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.OptionalSint64 = int64(v) + case 7: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalFixed32", wireType) + } + m.OptionalFixed32 = 0 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + m.OptionalFixed32 = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + case 8: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalFixed64", wireType) + } + m.OptionalFixed64 = 0 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + m.OptionalFixed64 = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + case 9: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalSfixed32", wireType) + } + m.OptionalSfixed32 = 0 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + m.OptionalSfixed32 = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + case 10: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalSfixed64", wireType) + } + m.OptionalSfixed64 = 0 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + m.OptionalSfixed64 = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + case 11: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalFloat", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.OptionalFloat = float32(math.Float32frombits(v)) + case 12: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalDouble", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.OptionalDouble = float64(math.Float64frombits(v)) + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalBool", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptionalBool = bool(v != 0) + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OptionalString = unsafeBytesToString(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalBytes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OptionalBytes = append(m.OptionalBytes[:0], dAtA[iNdEx:postIndex]...) + if m.OptionalBytes == nil { + m.OptionalBytes = []byte{} + } + iNdEx = postIndex + case 18: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalNestedMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalNestedMessage == nil { + m.OptionalNestedMessage = &TestAllTypesProto3_NestedMessage{} + } + if err := m.OptionalNestedMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 19: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalForeignMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalForeignMessage == nil { + m.OptionalForeignMessage = &ForeignMessage{} + } + if err := m.OptionalForeignMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 21: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalNestedEnum", wireType) + } + m.OptionalNestedEnum = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OptionalNestedEnum |= TestAllTypesProto3_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 22: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalForeignEnum", wireType) + } + m.OptionalForeignEnum = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OptionalForeignEnum |= ForeignEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 23: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalAliasedEnum", wireType) + } + m.OptionalAliasedEnum = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OptionalAliasedEnum |= TestAllTypesProto3_AliasedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 24: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalStringPiece", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OptionalStringPiece = unsafeBytesToString(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 25: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalCord", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OptionalCord = unsafeBytesToString(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 27: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RecursiveMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RecursiveMessage == nil { + m.RecursiveMessage = &TestAllTypesProto3{} + } + if err := m.RecursiveMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 31: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedInt32 = append(m.RepeatedInt32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedInt32) == 0 { + m.RepeatedInt32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedInt32 = append(m.RepeatedInt32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedInt32", wireType) + } + case 32: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedInt64 = append(m.RepeatedInt64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedInt64) == 0 { + m.RepeatedInt64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedInt64 = append(m.RepeatedInt64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedInt64", wireType) + } + case 33: + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedUint32 = append(m.RepeatedUint32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedUint32) == 0 { + m.RepeatedUint32 = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedUint32 = append(m.RepeatedUint32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedUint32", wireType) + } + case 34: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedUint64 = append(m.RepeatedUint64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedUint64) == 0 { + m.RepeatedUint64 = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedUint64 = append(m.RepeatedUint64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedUint64", wireType) + } + case 35: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.RepeatedSint32 = append(m.RepeatedSint32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedSint32) == 0 { + m.RepeatedSint32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.RepeatedSint32 = append(m.RepeatedSint32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedSint32", wireType) + } + case 36: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.RepeatedSint64 = append(m.RepeatedSint64, int64(v)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedSint64) == 0 { + m.RepeatedSint64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.RepeatedSint64 = append(m.RepeatedSint64, int64(v)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedSint64", wireType) + } + case 37: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedFixed32 = append(m.RepeatedFixed32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.RepeatedFixed32) == 0 { + m.RepeatedFixed32 = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedFixed32 = append(m.RepeatedFixed32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFixed32", wireType) + } + case 38: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedFixed64 = append(m.RepeatedFixed64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.RepeatedFixed64) == 0 { + m.RepeatedFixed64 = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedFixed64 = append(m.RepeatedFixed64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFixed64", wireType) + } + case 39: + if wireType == 5 { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedSfixed32 = append(m.RepeatedSfixed32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.RepeatedSfixed32) == 0 { + m.RepeatedSfixed32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedSfixed32 = append(m.RepeatedSfixed32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedSfixed32", wireType) + } + case 40: + if wireType == 1 { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedSfixed64 = append(m.RepeatedSfixed64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.RepeatedSfixed64) == 0 { + m.RepeatedSfixed64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedSfixed64 = append(m.RepeatedSfixed64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedSfixed64", wireType) + } + case 41: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.RepeatedFloat = append(m.RepeatedFloat, v2) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.RepeatedFloat) == 0 { + m.RepeatedFloat = make([]float32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.RepeatedFloat = append(m.RepeatedFloat, v2) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFloat", wireType) + } + case 42: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.RepeatedDouble = append(m.RepeatedDouble, v2) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.RepeatedDouble) == 0 { + m.RepeatedDouble = make([]float64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.RepeatedDouble = append(m.RepeatedDouble, v2) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedDouble", wireType) + } + case 43: + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedBool = append(m.RepeatedBool, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(m.RepeatedBool) == 0 { + m.RepeatedBool = make([]bool, 0, elementCount) + } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedBool = append(m.RepeatedBool, bool(v != 0)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedBool", wireType) + } + case 44: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedString = append(m.RepeatedString, unsafeBytesToString(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 45: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedBytes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedBytes = append(m.RepeatedBytes, dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 48: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedNestedMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedNestedMessage = append(m.RepeatedNestedMessage, &TestAllTypesProto3_NestedMessage{}) + if err := m.RepeatedNestedMessage[len(m.RepeatedNestedMessage)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 49: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedForeignMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedForeignMessage = append(m.RepeatedForeignMessage, &ForeignMessage{}) + if err := m.RepeatedForeignMessage[len(m.RepeatedForeignMessage)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 51: + if wireType == 0 { + var v TestAllTypesProto3_NestedEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= TestAllTypesProto3_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedNestedEnum = append(m.RepeatedNestedEnum, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + if elementCount != 0 && len(m.RepeatedNestedEnum) == 0 { + m.RepeatedNestedEnum = make([]TestAllTypesProto3_NestedEnum, 0, elementCount) + } + for iNdEx < postIndex { + var v TestAllTypesProto3_NestedEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= TestAllTypesProto3_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedNestedEnum = append(m.RepeatedNestedEnum, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedNestedEnum", wireType) + } + case 52: + if wireType == 0 { + var v ForeignEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= ForeignEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedForeignEnum = append(m.RepeatedForeignEnum, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + if elementCount != 0 && len(m.RepeatedForeignEnum) == 0 { + m.RepeatedForeignEnum = make([]ForeignEnum, 0, elementCount) + } + for iNdEx < postIndex { + var v ForeignEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= ForeignEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedForeignEnum = append(m.RepeatedForeignEnum, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedForeignEnum", wireType) + } + case 54: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedStringPiece", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedStringPiece = append(m.RepeatedStringPiece, unsafeBytesToString(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 55: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedCord", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedCord = append(m.RepeatedCord, unsafeBytesToString(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 56: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapInt32Int32", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapInt32Int32 == nil { + m.MapInt32Int32 = make(map[int32]int32) + } + var mapkey int32 + var mapvalue int32 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapInt32Int32[mapkey] = mapvalue + iNdEx = postIndex + case 57: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapInt64Int64", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapInt64Int64 == nil { + m.MapInt64Int64 = make(map[int64]int64) + } + var mapkey int64 + var mapvalue int64 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapInt64Int64[mapkey] = mapvalue + iNdEx = postIndex + case 58: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapUint32Uint32", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapUint32Uint32 == nil { + m.MapUint32Uint32 = make(map[uint32]uint32) + } + var mapkey uint32 + var mapvalue uint32 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapUint32Uint32[mapkey] = mapvalue + iNdEx = postIndex + case 59: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapUint64Uint64", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapUint64Uint64 == nil { + m.MapUint64Uint64 = make(map[uint64]uint64) + } + var mapkey uint64 + var mapvalue uint64 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapUint64Uint64[mapkey] = mapvalue + iNdEx = postIndex + case 60: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapSint32Sint32", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapSint32Sint32 == nil { + m.MapSint32Sint32 = make(map[int32]int32) + } + var mapkey int32 + var mapvalue int32 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var mapkeytemp int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkeytemp |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + mapkeytemp = int32((uint32(mapkeytemp) >> 1) ^ uint32(((mapkeytemp&1)<<31)>>31)) + mapkey = int32(mapkeytemp) + } else if fieldNum == 2 { + var mapvaluetemp int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvaluetemp |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + mapvaluetemp = int32((uint32(mapvaluetemp) >> 1) ^ uint32(((mapvaluetemp&1)<<31)>>31)) + mapvalue = int32(mapvaluetemp) + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapSint32Sint32[mapkey] = mapvalue + iNdEx = postIndex + case 61: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapSint64Sint64", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapSint64Sint64 == nil { + m.MapSint64Sint64 = make(map[int64]int64) + } + var mapkey int64 + var mapvalue int64 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var mapkeytemp uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkeytemp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + mapkeytemp = (mapkeytemp >> 1) ^ uint64((int64(mapkeytemp&1)<<63)>>63) + mapkey = int64(mapkeytemp) + } else if fieldNum == 2 { + var mapvaluetemp uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvaluetemp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + mapvaluetemp = (mapvaluetemp >> 1) ^ uint64((int64(mapvaluetemp&1)<<63)>>63) + mapvalue = int64(mapvaluetemp) + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapSint64Sint64[mapkey] = mapvalue + iNdEx = postIndex + case 62: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapFixed32Fixed32", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapFixed32Fixed32 == nil { + m.MapFixed32Fixed32 = make(map[uint32]uint32) + } + var mapkey uint32 + var mapvalue uint32 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + mapkey = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + } else if fieldNum == 2 { + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + mapvalue = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapFixed32Fixed32[mapkey] = mapvalue + iNdEx = postIndex + case 63: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapFixed64Fixed64", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapFixed64Fixed64 == nil { + m.MapFixed64Fixed64 = make(map[uint64]uint64) + } + var mapkey uint64 + var mapvalue uint64 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + mapkey = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + } else if fieldNum == 2 { + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + mapvalue = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapFixed64Fixed64[mapkey] = mapvalue + iNdEx = postIndex + case 64: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapSfixed32Sfixed32", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapSfixed32Sfixed32 == nil { + m.MapSfixed32Sfixed32 = make(map[int32]int32) + } + var mapkey int32 + var mapvalue int32 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + mapkey = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + } else if fieldNum == 2 { + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + mapvalue = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapSfixed32Sfixed32[mapkey] = mapvalue + iNdEx = postIndex + case 65: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapSfixed64Sfixed64", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapSfixed64Sfixed64 == nil { + m.MapSfixed64Sfixed64 = make(map[int64]int64) + } + var mapkey int64 + var mapvalue int64 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + mapkey = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + } else if fieldNum == 2 { + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + mapvalue = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapSfixed64Sfixed64[mapkey] = mapvalue + iNdEx = postIndex + case 66: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapInt32Float", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapInt32Float == nil { + m.MapInt32Float = make(map[int32]float32) + } + var mapkey int32 + var mapvalue float32 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + var mapvaluetemp uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + mapvaluetemp = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + mapvalue = math.Float32frombits(mapvaluetemp) + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapInt32Float[mapkey] = mapvalue + iNdEx = postIndex + case 67: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapInt32Double", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapInt32Double == nil { + m.MapInt32Double = make(map[int32]float64) + } + var mapkey int32 + var mapvalue float64 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + var mapvaluetemp uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + mapvaluetemp = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + mapvalue = math.Float64frombits(mapvaluetemp) + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapInt32Double[mapkey] = mapvalue + iNdEx = postIndex + case 68: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapBoolBool", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapBoolBool == nil { + m.MapBoolBool = make(map[bool]bool) + } + var mapkey bool + var mapvalue bool + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var mapkeytemp int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkeytemp |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + mapkey = bool(mapkeytemp != 0) + } else if fieldNum == 2 { + var mapvaluetemp int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvaluetemp |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + mapvalue = bool(mapvaluetemp != 0) + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapBoolBool[mapkey] = mapvalue + iNdEx = postIndex + case 69: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapStringString", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapStringString == nil { + m.MapStringString = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLength + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLength + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapStringString[mapkey] = mapvalue + iNdEx = postIndex + case 70: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapStringBytes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapStringBytes == nil { + m.MapStringBytes = make(map[string][]byte) + } + var mapkey string + var mapvalue []byte + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapbyteLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapbyteLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intMapbyteLen := int(mapbyteLen) + if intMapbyteLen < 0 { + return ErrInvalidLength + } + postbytesIndex := iNdEx + intMapbyteLen + if postbytesIndex < 0 { + return ErrInvalidLength + } + if postbytesIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = make([]byte, mapbyteLen) + copy(mapvalue, dAtA[iNdEx:postbytesIndex]) + iNdEx = postbytesIndex + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapStringBytes[mapkey] = mapvalue + iNdEx = postIndex + case 71: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapStringNestedMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapStringNestedMessage == nil { + m.MapStringNestedMessage = make(map[string]*TestAllTypesProto3_NestedMessage) + } + var mapkey string + var mapvalue *TestAllTypesProto3_NestedMessage + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLength + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLength + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &TestAllTypesProto3_NestedMessage{} + if err := mapvalue.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapStringNestedMessage[mapkey] = mapvalue + iNdEx = postIndex + case 72: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapStringForeignMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapStringForeignMessage == nil { + m.MapStringForeignMessage = make(map[string]*ForeignMessage) + } + var mapkey string + var mapvalue *ForeignMessage + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLength + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLength + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &ForeignMessage{} + if err := mapvalue.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapStringForeignMessage[mapkey] = mapvalue + iNdEx = postIndex + case 73: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapStringNestedEnum", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapStringNestedEnum == nil { + m.MapStringNestedEnum = make(map[string]TestAllTypesProto3_NestedEnum) + } + var mapkey string + var mapvalue TestAllTypesProto3_NestedEnum + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= TestAllTypesProto3_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapStringNestedEnum[mapkey] = mapvalue + iNdEx = postIndex + case 74: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapStringForeignEnum", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MapStringForeignEnum == nil { + m.MapStringForeignEnum = make(map[string]ForeignEnum) + } + var mapkey string + var mapvalue ForeignEnum + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= ForeignEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.MapStringForeignEnum[mapkey] = mapvalue + iNdEx = postIndex + case 75: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedInt32 = append(m.PackedInt32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedInt32) == 0 { + m.PackedInt32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedInt32 = append(m.PackedInt32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedInt32", wireType) + } + case 76: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedInt64 = append(m.PackedInt64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedInt64) == 0 { + m.PackedInt64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedInt64 = append(m.PackedInt64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedInt64", wireType) + } + case 77: + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedUint32 = append(m.PackedUint32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedUint32) == 0 { + m.PackedUint32 = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedUint32 = append(m.PackedUint32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedUint32", wireType) + } + case 78: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedUint64 = append(m.PackedUint64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedUint64) == 0 { + m.PackedUint64 = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedUint64 = append(m.PackedUint64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedUint64", wireType) + } + case 79: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.PackedSint32 = append(m.PackedSint32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedSint32) == 0 { + m.PackedSint32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.PackedSint32 = append(m.PackedSint32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedSint32", wireType) + } + case 80: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.PackedSint64 = append(m.PackedSint64, int64(v)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedSint64) == 0 { + m.PackedSint64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.PackedSint64 = append(m.PackedSint64, int64(v)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedSint64", wireType) + } + case 81: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedFixed32 = append(m.PackedFixed32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.PackedFixed32) == 0 { + m.PackedFixed32 = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedFixed32 = append(m.PackedFixed32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedFixed32", wireType) + } + case 82: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedFixed64 = append(m.PackedFixed64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.PackedFixed64) == 0 { + m.PackedFixed64 = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedFixed64 = append(m.PackedFixed64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedFixed64", wireType) + } + case 83: + if wireType == 5 { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedSfixed32 = append(m.PackedSfixed32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.PackedSfixed32) == 0 { + m.PackedSfixed32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedSfixed32 = append(m.PackedSfixed32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedSfixed32", wireType) + } + case 84: + if wireType == 1 { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedSfixed64 = append(m.PackedSfixed64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.PackedSfixed64) == 0 { + m.PackedSfixed64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedSfixed64 = append(m.PackedSfixed64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedSfixed64", wireType) + } + case 85: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.PackedFloat = append(m.PackedFloat, v2) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.PackedFloat) == 0 { + m.PackedFloat = make([]float32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.PackedFloat = append(m.PackedFloat, v2) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedFloat", wireType) + } + case 86: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.PackedDouble = append(m.PackedDouble, v2) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.PackedDouble) == 0 { + m.PackedDouble = make([]float64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.PackedDouble = append(m.PackedDouble, v2) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedDouble", wireType) + } + case 87: + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedBool = append(m.PackedBool, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(m.PackedBool) == 0 { + m.PackedBool = make([]bool, 0, elementCount) + } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedBool = append(m.PackedBool, bool(v != 0)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedBool", wireType) + } + case 88: + if wireType == 0 { + var v TestAllTypesProto3_NestedEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= TestAllTypesProto3_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedNestedEnum = append(m.PackedNestedEnum, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + if elementCount != 0 && len(m.PackedNestedEnum) == 0 { + m.PackedNestedEnum = make([]TestAllTypesProto3_NestedEnum, 0, elementCount) + } + for iNdEx < postIndex { + var v TestAllTypesProto3_NestedEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= TestAllTypesProto3_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedNestedEnum = append(m.PackedNestedEnum, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedNestedEnum", wireType) + } + case 89: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedInt32 = append(m.UnpackedInt32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.UnpackedInt32) == 0 { + m.UnpackedInt32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedInt32 = append(m.UnpackedInt32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedInt32", wireType) + } + case 90: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedInt64 = append(m.UnpackedInt64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.UnpackedInt64) == 0 { + m.UnpackedInt64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedInt64 = append(m.UnpackedInt64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedInt64", wireType) + } + case 91: + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedUint32 = append(m.UnpackedUint32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.UnpackedUint32) == 0 { + m.UnpackedUint32 = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedUint32 = append(m.UnpackedUint32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedUint32", wireType) + } + case 92: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedUint64 = append(m.UnpackedUint64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.UnpackedUint64) == 0 { + m.UnpackedUint64 = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedUint64 = append(m.UnpackedUint64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedUint64", wireType) + } + case 93: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.UnpackedSint32 = append(m.UnpackedSint32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.UnpackedSint32) == 0 { + m.UnpackedSint32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.UnpackedSint32 = append(m.UnpackedSint32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedSint32", wireType) + } + case 94: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.UnpackedSint64 = append(m.UnpackedSint64, int64(v)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.UnpackedSint64) == 0 { + m.UnpackedSint64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.UnpackedSint64 = append(m.UnpackedSint64, int64(v)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedSint64", wireType) + } + case 95: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.UnpackedFixed32 = append(m.UnpackedFixed32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.UnpackedFixed32) == 0 { + m.UnpackedFixed32 = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.UnpackedFixed32 = append(m.UnpackedFixed32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedFixed32", wireType) + } + case 96: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.UnpackedFixed64 = append(m.UnpackedFixed64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.UnpackedFixed64) == 0 { + m.UnpackedFixed64 = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.UnpackedFixed64 = append(m.UnpackedFixed64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedFixed64", wireType) + } + case 97: + if wireType == 5 { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.UnpackedSfixed32 = append(m.UnpackedSfixed32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.UnpackedSfixed32) == 0 { + m.UnpackedSfixed32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.UnpackedSfixed32 = append(m.UnpackedSfixed32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedSfixed32", wireType) + } + case 98: + if wireType == 1 { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.UnpackedSfixed64 = append(m.UnpackedSfixed64, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.UnpackedSfixed64) == 0 { + m.UnpackedSfixed64 = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.UnpackedSfixed64 = append(m.UnpackedSfixed64, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedSfixed64", wireType) + } + case 99: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.UnpackedFloat = append(m.UnpackedFloat, v2) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.UnpackedFloat) == 0 { + m.UnpackedFloat = make([]float32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.UnpackedFloat = append(m.UnpackedFloat, v2) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedFloat", wireType) + } + case 100: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.UnpackedDouble = append(m.UnpackedDouble, v2) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.UnpackedDouble) == 0 { + m.UnpackedDouble = make([]float64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.UnpackedDouble = append(m.UnpackedDouble, v2) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedDouble", wireType) + } + case 101: + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedBool = append(m.UnpackedBool, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(m.UnpackedBool) == 0 { + m.UnpackedBool = make([]bool, 0, elementCount) + } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedBool = append(m.UnpackedBool, bool(v != 0)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedBool", wireType) + } + case 102: + if wireType == 0 { + var v TestAllTypesProto3_NestedEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= TestAllTypesProto3_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedNestedEnum = append(m.UnpackedNestedEnum, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + if elementCount != 0 && len(m.UnpackedNestedEnum) == 0 { + m.UnpackedNestedEnum = make([]TestAllTypesProto3_NestedEnum, 0, elementCount) + } + for iNdEx < postIndex { + var v TestAllTypesProto3_NestedEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= TestAllTypesProto3_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpackedNestedEnum = append(m.UnpackedNestedEnum, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnpackedNestedEnum", wireType) + } + case 111: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofUint32", wireType) + } + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OneofField = &TestAllTypesProto3_OneofUint32{OneofUint32: v} + case 112: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofNestedMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.OneofField.(*TestAllTypesProto3_OneofNestedMessage); ok { + if err := oneof.OneofNestedMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &TestAllTypesProto3_NestedMessage{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.OneofField = &TestAllTypesProto3_OneofNestedMessage{OneofNestedMessage: v} + } + iNdEx = postIndex + case 113: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OneofField = &TestAllTypesProto3_OneofString{OneofString: unsafeBytesToString(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 114: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofBytes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := dAtA[iNdEx:postIndex] + m.OneofField = &TestAllTypesProto3_OneofBytes{OneofBytes: v} + iNdEx = postIndex + case 115: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofBool", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.OneofField = &TestAllTypesProto3_OneofBool{OneofBool: b} + case 116: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofUint64", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OneofField = &TestAllTypesProto3_OneofUint64{OneofUint64: v} + case 117: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofFloat", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.OneofField = &TestAllTypesProto3_OneofFloat{OneofFloat: float32(math.Float32frombits(v))} + case 118: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofDouble", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.OneofField = &TestAllTypesProto3_OneofDouble{OneofDouble: float64(math.Float64frombits(v))} + case 119: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofEnum", wireType) + } + var v TestAllTypesProto3_NestedEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= TestAllTypesProto3_NestedEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OneofField = &TestAllTypesProto3_OneofEnum{OneofEnum: v} + case 120: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OneofNullValue", wireType) + } + var v structpb.NullValue + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= structpb.NullValue(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OneofField = &TestAllTypesProto3_OneofNullValue{OneofNullValue: v} + case 201: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalBoolWrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalBoolWrapper == nil { + m.OptionalBoolWrapper = &wrapperspb.BoolValue{} + } + if unmarshal, ok := interface{}(m.OptionalBoolWrapper).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalBoolWrapper); err != nil { + return err + } + } + iNdEx = postIndex + case 202: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalInt32Wrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalInt32Wrapper == nil { + m.OptionalInt32Wrapper = &wrapperspb.Int32Value{} + } + if unmarshal, ok := interface{}(m.OptionalInt32Wrapper).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalInt32Wrapper); err != nil { + return err + } + } + iNdEx = postIndex + case 203: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalInt64Wrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalInt64Wrapper == nil { + m.OptionalInt64Wrapper = &wrapperspb.Int64Value{} + } + if unmarshal, ok := interface{}(m.OptionalInt64Wrapper).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalInt64Wrapper); err != nil { + return err + } + } + iNdEx = postIndex + case 204: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalUint32Wrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalUint32Wrapper == nil { + m.OptionalUint32Wrapper = &wrapperspb.UInt32Value{} + } + if unmarshal, ok := interface{}(m.OptionalUint32Wrapper).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalUint32Wrapper); err != nil { + return err + } + } + iNdEx = postIndex + case 205: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalUint64Wrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalUint64Wrapper == nil { + m.OptionalUint64Wrapper = &wrapperspb.UInt64Value{} + } + if unmarshal, ok := interface{}(m.OptionalUint64Wrapper).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalUint64Wrapper); err != nil { + return err + } + } + iNdEx = postIndex + case 206: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalFloatWrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalFloatWrapper == nil { + m.OptionalFloatWrapper = &wrapperspb.FloatValue{} + } + if unmarshal, ok := interface{}(m.OptionalFloatWrapper).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalFloatWrapper); err != nil { + return err + } + } + iNdEx = postIndex + case 207: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalDoubleWrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalDoubleWrapper == nil { + m.OptionalDoubleWrapper = &wrapperspb.DoubleValue{} + } + if unmarshal, ok := interface{}(m.OptionalDoubleWrapper).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalDoubleWrapper); err != nil { + return err + } + } + iNdEx = postIndex + case 208: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalStringWrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalStringWrapper == nil { + m.OptionalStringWrapper = &wrapperspb.StringValue{} + } + if unmarshal, ok := interface{}(m.OptionalStringWrapper).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalStringWrapper); err != nil { + return err + } + } + iNdEx = postIndex + case 209: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalBytesWrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalBytesWrapper == nil { + m.OptionalBytesWrapper = &wrapperspb.BytesValue{} + } + if unmarshal, ok := interface{}(m.OptionalBytesWrapper).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalBytesWrapper); err != nil { + return err + } + } + iNdEx = postIndex + case 211: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedBoolWrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedBoolWrapper = append(m.RepeatedBoolWrapper, &wrapperspb.BoolValue{}) + if unmarshal, ok := interface{}(m.RepeatedBoolWrapper[len(m.RepeatedBoolWrapper)-1]).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedBoolWrapper[len(m.RepeatedBoolWrapper)-1]); err != nil { + return err + } + } + iNdEx = postIndex + case 212: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedInt32Wrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedInt32Wrapper = append(m.RepeatedInt32Wrapper, &wrapperspb.Int32Value{}) + if unmarshal, ok := interface{}(m.RepeatedInt32Wrapper[len(m.RepeatedInt32Wrapper)-1]).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedInt32Wrapper[len(m.RepeatedInt32Wrapper)-1]); err != nil { + return err + } + } + iNdEx = postIndex + case 213: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedInt64Wrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedInt64Wrapper = append(m.RepeatedInt64Wrapper, &wrapperspb.Int64Value{}) + if unmarshal, ok := interface{}(m.RepeatedInt64Wrapper[len(m.RepeatedInt64Wrapper)-1]).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedInt64Wrapper[len(m.RepeatedInt64Wrapper)-1]); err != nil { + return err + } + } + iNdEx = postIndex + case 214: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedUint32Wrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedUint32Wrapper = append(m.RepeatedUint32Wrapper, &wrapperspb.UInt32Value{}) + if unmarshal, ok := interface{}(m.RepeatedUint32Wrapper[len(m.RepeatedUint32Wrapper)-1]).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedUint32Wrapper[len(m.RepeatedUint32Wrapper)-1]); err != nil { + return err + } + } + iNdEx = postIndex + case 215: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedUint64Wrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedUint64Wrapper = append(m.RepeatedUint64Wrapper, &wrapperspb.UInt64Value{}) + if unmarshal, ok := interface{}(m.RepeatedUint64Wrapper[len(m.RepeatedUint64Wrapper)-1]).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedUint64Wrapper[len(m.RepeatedUint64Wrapper)-1]); err != nil { + return err + } + } + iNdEx = postIndex + case 216: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFloatWrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedFloatWrapper = append(m.RepeatedFloatWrapper, &wrapperspb.FloatValue{}) + if unmarshal, ok := interface{}(m.RepeatedFloatWrapper[len(m.RepeatedFloatWrapper)-1]).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedFloatWrapper[len(m.RepeatedFloatWrapper)-1]); err != nil { + return err + } + } + iNdEx = postIndex + case 217: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedDoubleWrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedDoubleWrapper = append(m.RepeatedDoubleWrapper, &wrapperspb.DoubleValue{}) + if unmarshal, ok := interface{}(m.RepeatedDoubleWrapper[len(m.RepeatedDoubleWrapper)-1]).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedDoubleWrapper[len(m.RepeatedDoubleWrapper)-1]); err != nil { + return err + } + } + iNdEx = postIndex + case 218: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedStringWrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedStringWrapper = append(m.RepeatedStringWrapper, &wrapperspb.StringValue{}) + if unmarshal, ok := interface{}(m.RepeatedStringWrapper[len(m.RepeatedStringWrapper)-1]).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedStringWrapper[len(m.RepeatedStringWrapper)-1]); err != nil { + return err + } + } + iNdEx = postIndex + case 219: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedBytesWrapper", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedBytesWrapper = append(m.RepeatedBytesWrapper, &wrapperspb.BytesValue{}) + if unmarshal, ok := interface{}(m.RepeatedBytesWrapper[len(m.RepeatedBytesWrapper)-1]).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedBytesWrapper[len(m.RepeatedBytesWrapper)-1]); err != nil { + return err + } + } + iNdEx = postIndex + case 301: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalDuration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalDuration == nil { + m.OptionalDuration = &durationpb.Duration{} + } + if unmarshal, ok := interface{}(m.OptionalDuration).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalDuration); err != nil { + return err + } + } + iNdEx = postIndex + case 302: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalTimestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalTimestamp == nil { + m.OptionalTimestamp = ×tamppb.Timestamp{} + } + if unmarshal, ok := interface{}(m.OptionalTimestamp).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalTimestamp); err != nil { + return err + } + } + iNdEx = postIndex + case 303: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalFieldMask", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalFieldMask == nil { + m.OptionalFieldMask = &fieldmaskpb.FieldMask{} + } + if unmarshal, ok := interface{}(m.OptionalFieldMask).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalFieldMask); err != nil { + return err + } + } + iNdEx = postIndex + case 304: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalStruct", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalStruct == nil { + m.OptionalStruct = &structpb.Struct{} + } + if unmarshal, ok := interface{}(m.OptionalStruct).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalStruct); err != nil { + return err + } + } + iNdEx = postIndex + case 305: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalAny", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalAny == nil { + m.OptionalAny = &anypb.Any{} + } + if unmarshal, ok := interface{}(m.OptionalAny).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalAny); err != nil { + return err + } + } + iNdEx = postIndex + case 306: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OptionalValue == nil { + m.OptionalValue = &structpb.Value{} + } + if unmarshal, ok := interface{}(m.OptionalValue).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalValue); err != nil { + return err + } + } + iNdEx = postIndex + case 307: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalNullValue", wireType) + } + m.OptionalNullValue = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OptionalNullValue |= structpb.NullValue(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 311: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedDuration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedDuration = append(m.RepeatedDuration, &durationpb.Duration{}) + if unmarshal, ok := interface{}(m.RepeatedDuration[len(m.RepeatedDuration)-1]).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedDuration[len(m.RepeatedDuration)-1]); err != nil { + return err + } + } + iNdEx = postIndex + case 312: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedTimestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedTimestamp = append(m.RepeatedTimestamp, ×tamppb.Timestamp{}) + if unmarshal, ok := interface{}(m.RepeatedTimestamp[len(m.RepeatedTimestamp)-1]).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedTimestamp[len(m.RepeatedTimestamp)-1]); err != nil { + return err + } + } + iNdEx = postIndex + case 313: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFieldmask", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedFieldmask = append(m.RepeatedFieldmask, &fieldmaskpb.FieldMask{}) + if unmarshal, ok := interface{}(m.RepeatedFieldmask[len(m.RepeatedFieldmask)-1]).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedFieldmask[len(m.RepeatedFieldmask)-1]); err != nil { + return err + } + } + iNdEx = postIndex + case 315: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedAny", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedAny = append(m.RepeatedAny, &anypb.Any{}) + if unmarshal, ok := interface{}(m.RepeatedAny[len(m.RepeatedAny)-1]).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedAny[len(m.RepeatedAny)-1]); err != nil { + return err + } + } + iNdEx = postIndex + case 316: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedValue = append(m.RepeatedValue, &structpb.Value{}) + if unmarshal, ok := interface{}(m.RepeatedValue[len(m.RepeatedValue)-1]).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedValue[len(m.RepeatedValue)-1]); err != nil { + return err + } + } + iNdEx = postIndex + case 317: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedListValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedListValue = append(m.RepeatedListValue, &structpb.ListValue{}) + if unmarshal, ok := interface{}(m.RepeatedListValue[len(m.RepeatedListValue)-1]).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedListValue[len(m.RepeatedListValue)-1]); err != nil { + return err + } + } + iNdEx = postIndex + case 324: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedStruct", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedStruct = append(m.RepeatedStruct, &structpb.Struct{}) + if unmarshal, ok := interface{}(m.RepeatedStruct[len(m.RepeatedStruct)-1]).(interface { + UnmarshalVT([]byte) error + }); ok { + if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedStruct[len(m.RepeatedStruct)-1]); err != nil { + return err + } + } + iNdEx = postIndex + case 401: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Fieldname1", wireType) + } + m.Fieldname1 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Fieldname1 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 402: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldName2", wireType) + } + m.FieldName2 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FieldName2 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 403: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field XFieldName3", wireType) + } + m.XFieldName3 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.XFieldName3 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 404: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Field_Name4_", wireType) + } + m.Field_Name4_ = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Field_Name4_ |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 405: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Field0Name5", wireType) + } + m.Field0Name5 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Field0Name5 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 406: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Field_0Name6", wireType) + } + m.Field_0Name6 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Field_0Name6 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 407: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldName7", wireType) + } + m.FieldName7 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FieldName7 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 408: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldName8", wireType) + } + m.FieldName8 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FieldName8 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 409: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Field_Name9", wireType) + } + m.Field_Name9 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Field_Name9 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 410: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Field_Name10", wireType) + } + m.Field_Name10 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Field_Name10 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 411: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FIELD_NAME11", wireType) + } + m.FIELD_NAME11 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FIELD_NAME11 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 412: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FIELDName12", wireType) + } + m.FIELDName12 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FIELDName12 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 413: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field XFieldName13", wireType) + } + m.XFieldName13 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.XFieldName13 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 414: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field X_FieldName14", wireType) + } + m.X_FieldName14 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.X_FieldName14 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 415: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Field_Name15", wireType) + } + m.Field_Name15 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Field_Name15 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 416: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Field__Name16", wireType) + } + m.Field__Name16 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Field__Name16 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 417: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldName17__", wireType) + } + m.FieldName17__ = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FieldName17__ |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 418: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldName18__", wireType) + } + m.FieldName18__ = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FieldName18__ |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ForeignMessage) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -16284,6 +23822,76 @@ func (m *ForeignMessage) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *ForeignMessage) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: ForeignMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ForeignMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field C", wireType) + } + m.C = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.C |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *NullHypothesisProto3) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -16335,6 +23943,57 @@ func (m *NullHypothesisProto3) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *NullHypothesisProto3) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: NullHypothesisProto3: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NullHypothesisProto3: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *EnumOnlyProto3) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -16386,3 +24045,54 @@ func (m *EnumOnlyProto3) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *EnumOnlyProto3) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: EnumOnlyProto3: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EnumOnlyProto3: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} diff --git a/features/unmarshal/unmarshal.go b/features/unmarshal/unmarshal.go index dca73aa..8d5deb5 100644 --- a/features/unmarshal/unmarshal.go +++ b/features/unmarshal/unmarshal.go @@ -33,7 +33,8 @@ var _ generator.FeatureGenerator = (*unmarshal)(nil) func (p *unmarshal) GenerateFile(file *protogen.File) bool { proto3 := file.Desc.Syntax() == protoreflect.Proto3 for _, message := range file.Messages { - p.message(proto3, message) + p.message(proto3, message, false) + p.message(proto3, message, true) } return p.once @@ -129,6 +130,13 @@ func (p *unmarshal) GenerateHelpers() { ErrUnexpectedEndOfGroup = `, p.Ident("fmt", "Errorf"), `("proto: unexpected end of group") ) `) + + p.Helper("unsafeBytesToString", func(p *generator.GeneratedFile) { + p.P(` + func unsafeBytesToString(b []byte) string { + return *(*string)(`, p.Ident("unsafe", `Pointer`), `(&b)) + }`) + }) } func (p *unmarshal) decodeMessage(varName, buf string, message *protogen.Message) { @@ -337,7 +345,7 @@ func (p *unmarshal) noStarOrSliceType(field *protogen.Field) string { return typ } -func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message *protogen.Message, proto3 bool) { +func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message *protogen.Message, proto3 bool, unsafe bool) { repeated := field.Desc.Cardinality() == protoreflect.Repeated typ := p.noStarOrSliceType(field) oneof := field.Oneof != nil && !field.Oneof.Desc.IsSynthetic() @@ -485,14 +493,18 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * p.P(`if postIndex > l {`) p.P(`return `, p.Ident("io", `ErrUnexpectedEOF`)) p.P(`}`) + str := "string(dAtA[iNdEx:postIndex])" + if unsafe { + str = `unsafeBytesToString(dAtA[iNdEx:postIndex])` + } if oneof { - p.P(`m.`, fieldname, ` = &`, field.GoIdent, `{`, field.GoName, ": ", typ, `(dAtA[iNdEx:postIndex])}`) + p.P(`m.`, fieldname, ` = &`, field.GoIdent, `{`, field.GoName, ": ", str, `}`) } else if repeated { - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, `, typ, `(dAtA[iNdEx:postIndex]))`) + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, `, str, `)`) } else if proto3 && !nullable { - p.P(`m.`, fieldname, ` = `, typ, `(dAtA[iNdEx:postIndex])`) + p.P(`m.`, fieldname, ` = `, str) } else { - p.P(`s := `, typ, `(dAtA[iNdEx:postIndex])`) + p.P(`s := `, str) p.P(`m.`, fieldname, ` = &s`) } p.P(`iNdEx = postIndex`) @@ -623,12 +635,20 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * p.P(`return `, p.Ident("io", `ErrUnexpectedEOF`)) p.P(`}`) if oneof { - p.P(`v := make([]byte, postIndex-iNdEx)`) - p.P(`copy(v, dAtA[iNdEx:postIndex])`) + if unsafe { + p.P(`v := dAtA[iNdEx:postIndex]`) + } else { + p.P(`v := make([]byte, postIndex-iNdEx)`) + p.P(`copy(v, dAtA[iNdEx:postIndex])`) + } p.P(`m.`, fieldname, ` = &`, field.GoIdent, "{", field.GoName, `: v}`) } else if repeated { - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, make([]byte, postIndex-iNdEx))`) - p.P(`copy(m.`, fieldname, `[len(m.`, fieldname, `)-1], dAtA[iNdEx:postIndex])`) + if unsafe { + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, dAtA[iNdEx:postIndex])`) + } else { + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, make([]byte, postIndex-iNdEx))`) + p.P(`copy(m.`, fieldname, `[len(m.`, fieldname, `)-1], dAtA[iNdEx:postIndex])`) + } } else { p.P(`m.`, fieldname, ` = append(m.`, fieldname, `[:0] , dAtA[iNdEx:postIndex]...)`) p.P(`if m.`, fieldname, ` == nil {`) @@ -736,7 +756,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } } -func (p *unmarshal) field(proto3, oneof bool, field *protogen.Field, message *protogen.Message, required protoreflect.FieldNumbers) { +func (p *unmarshal) field(proto3, oneof bool, field *protogen.Field, message *protogen.Message, required protoreflect.FieldNumbers, unsafe bool) { fieldname := field.GoName errFieldname := fieldname if field.Oneof != nil && !field.Oneof.Desc.IsSynthetic() { @@ -747,7 +767,7 @@ func (p *unmarshal) field(proto3, oneof bool, field *protogen.Field, message *pr wireType := generator.ProtoWireType(field.Desc.Kind()) if field.Desc.IsList() && wireType != protowire.BytesType { p.P(`if wireType == `, strconv.Itoa(int(wireType)), `{`) - p.fieldItem(field, fieldname, message, false) + p.fieldItem(field, fieldname, message, false, unsafe) p.P(`} else if wireType == `, strconv.Itoa(int(protowire.BytesType)), `{`) p.P(`var packedLen int`) p.decodeVarint("packedLen", "int") @@ -791,7 +811,7 @@ func (p *unmarshal) field(proto3, oneof bool, field *protogen.Field, message *pr p.P(`}`) p.P(`for iNdEx < postIndex {`) - p.fieldItem(field, fieldname, message, false) + p.fieldItem(field, fieldname, message, false, unsafe) p.P(`}`) p.P(`} else {`) p.P(`return `, p.Ident("fmt", "Errorf"), `("proto: wrong wireType = %d for field `, errFieldname, `", wireType)`) @@ -800,7 +820,7 @@ func (p *unmarshal) field(proto3, oneof bool, field *protogen.Field, message *pr p.P(`if wireType != `, strconv.Itoa(int(wireType)), `{`) p.P(`return `, p.Ident("fmt", "Errorf"), `("proto: wrong wireType = %d for field `, errFieldname, `", wireType)`) p.P(`}`) - p.fieldItem(field, fieldname, message, proto3) + p.fieldItem(field, fieldname, message, proto3, unsafe) } if field.Desc.Cardinality() == protoreflect.Required { @@ -817,9 +837,9 @@ func (p *unmarshal) field(proto3, oneof bool, field *protogen.Field, message *pr } } -func (p *unmarshal) message(proto3 bool, message *protogen.Message) { +func (p *unmarshal) message(proto3 bool, message *protogen.Message, unsafe bool) { for _, nested := range message.Messages { - p.message(proto3, nested) + p.message(proto3, nested, unsafe) } if message.Desc.IsMapEntry() { @@ -830,7 +850,11 @@ func (p *unmarshal) message(proto3 bool, message *protogen.Message) { ccTypeName := message.GoIdent required := message.Desc.RequiredNumbers() - p.P(`func (m *`, ccTypeName, `) UnmarshalVT(dAtA []byte) error {`) + if unsafe { + p.P(`func (m *`, ccTypeName, `) UnmarshalVTUnsafe(dAtA []byte) error {`) + } else { + p.P(`func (m *`, ccTypeName, `) UnmarshalVT(dAtA []byte) error {`) + } if required.Len() > 0 { p.P(`var hasFields [`, strconv.Itoa(1+(required.Len()-1)/64), `]uint64`) } @@ -850,7 +874,7 @@ func (p *unmarshal) message(proto3 bool, message *protogen.Message) { p.P(`}`) p.P(`switch fieldNum {`) for _, field := range message.Fields { - p.field(proto3, false, field, message, required) + p.field(proto3, false, field, message, required, unsafe) } p.P(`default:`) p.P(`iNdEx=preIndex`) diff --git a/testproto/pool/pool_vtproto.pb.go b/testproto/pool/pool_vtproto.pb.go index 0c5a5f3..0b61a5c 100644 --- a/testproto/pool/pool_vtproto.pb.go +++ b/testproto/pool/pool_vtproto.pb.go @@ -11,6 +11,7 @@ import ( io "io" bits "math/bits" sync "sync" + unsafe "unsafe" ) const ( @@ -305,6 +306,108 @@ func (m *MemoryPoolExtension) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *MemoryPoolExtension) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: MemoryPoolExtension: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MemoryPoolExtension: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Foo1", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Foo1 = unsafeBytesToString(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Foo2", wireType) + } + m.Foo2 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Foo2 |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skip(dAtA []byte) (n int, err error) { l := len(dAtA) @@ -390,3 +493,7 @@ var ( ErrIntOverflow = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") ) + +func unsafeBytesToString(b []byte) string { + return *(*string)(unsafe.Pointer(&b)) +} diff --git a/testproto/pool/pool_with_oneof_vtproto.pb.go b/testproto/pool/pool_with_oneof_vtproto.pb.go index 5894fd7..97aed2b 100644 --- a/testproto/pool/pool_with_oneof_vtproto.pb.go +++ b/testproto/pool/pool_with_oneof_vtproto.pb.go @@ -1554,3 +1554,487 @@ func (m *OneofTest) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *OneofTest_Test1) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: OneofTest_Test1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OneofTest_Test1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field A", wireType) + } + m.A = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.A |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OneofTest_Test2) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: OneofTest_Test2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OneofTest_Test2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field B", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.B = append(m.B, unsafeBytesToString(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OneofTest_Test3_Element2) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: OneofTest_Test3_Element2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OneofTest_Test3_Element2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field D", wireType) + } + m.D = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.D |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OneofTest_Test3) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: OneofTest_Test3: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OneofTest_Test3: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field C", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.C == nil { + m.C = OneofTest_Test3_Element2FromVTPool() + } + if err := m.C.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OneofTest) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: OneofTest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OneofTest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Test1", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Test.(*OneofTest_Test1_); ok { + if err := oneof.Test1.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := OneofTest_Test1FromVTPool() + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Test = &OneofTest_Test1_{Test1: v} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Test2", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Test.(*OneofTest_Test2_); ok { + if err := oneof.Test2.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := OneofTest_Test2FromVTPool() + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Test = &OneofTest_Test2_{Test2: v} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Test3", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Test.(*OneofTest_Test3_); ok { + if err := oneof.Test3.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := OneofTest_Test3FromVTPool() + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Test = &OneofTest_Test3_{Test3: v} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} diff --git a/testproto/pool/pool_with_slice_reuse_vtproto.pb.go b/testproto/pool/pool_with_slice_reuse_vtproto.pb.go index 13298a1..b306adc 100644 --- a/testproto/pool/pool_with_slice_reuse_vtproto.pb.go +++ b/testproto/pool/pool_with_slice_reuse_vtproto.pb.go @@ -871,6 +871,89 @@ func (m *Test1) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *Test1) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Test1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Test1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sl = append(m.Sl, unsafeBytesToString(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Test2) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -963,6 +1046,98 @@ func (m *Test2) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *Test2) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Test2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Test2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sl", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if len(m.Sl) == cap(m.Sl) { + m.Sl = append(m.Sl, &Slice2{}) + } else { + m.Sl = m.Sl[:len(m.Sl)+1] + if m.Sl[len(m.Sl)-1] == nil { + m.Sl[len(m.Sl)-1] = &Slice2{} + } + } + if err := m.Sl[len(m.Sl)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Slice2) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1252,7 +1427,366 @@ func (m *Slice2) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Element2) UnmarshalVT(dAtA []byte) error { +func (m *Slice2) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Slice2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Slice2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field A", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.A == nil { + m.A = make(map[int64]int64) + } + var mapkey int64 + var mapvalue int64 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.A[mapkey] = mapvalue + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field B", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.B = &v + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field C", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.C = append(m.C, unsafeBytesToString(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field D", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.D == nil { + m.D = &Element2{} + } + if err := m.D.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field E", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.E = unsafeBytesToString(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field F", wireType) + } + m.F = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.F |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Element2) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Element2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Element2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field A", wireType) + } + m.A = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.A |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Element2) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { diff --git a/testproto/proto2/scalars_vtproto.pb.go b/testproto/proto2/scalars_vtproto.pb.go index 678c899..2296ac1 100644 --- a/testproto/proto2/scalars_vtproto.pb.go +++ b/testproto/proto2/scalars_vtproto.pb.go @@ -12,6 +12,7 @@ import ( io "io" math "math" bits "math/bits" + unsafe "unsafe" ) const ( @@ -3976,7 +3977,7 @@ func (m *DoubleMessage) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *FloatMessage) UnmarshalVT(dAtA []byte) error { +func (m *DoubleMessage) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -4000,46 +4001,46 @@ func (m *FloatMessage) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: FloatMessage: wiretype end group for non-group") + return fmt.Errorf("proto: DoubleMessage: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: FloatMessage: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DoubleMessage: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 5 { + if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v uint32 - if (iNdEx + 4) > l { + var v uint64 + if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) m.RequiredField = &v2 hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 5 { + if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v uint32 - if (iNdEx + 4) > l { + var v uint64 + if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) m.OptionalField = &v2 case 3: - if wireType == 5 { - var v uint32 - if (iNdEx + 4) > l { + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) m.RepeatedField = append(m.RepeatedField, v2) } else if wireType == 2 { var packedLen int @@ -4068,32 +4069,32 @@ func (m *FloatMessage) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 4 + elementCount = packedLen / 8 if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]float32, 0, elementCount) + m.RepeatedField = make([]float64, 0, elementCount) } for iNdEx < postIndex { - var v uint32 - if (iNdEx + 4) > l { + var v uint64 + if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) m.RepeatedField = append(m.RepeatedField, v2) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 5 { - var v uint32 - if (iNdEx + 4) > l { + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) m.PackedField = append(m.PackedField, v2) } else if wireType == 2 { var packedLen int @@ -4122,18 +4123,18 @@ func (m *FloatMessage) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 4 + elementCount = packedLen / 8 if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]float32, 0, elementCount) + m.PackedField = make([]float64, 0, elementCount) } for iNdEx < postIndex { - var v uint32 - if (iNdEx + 4) > l { + var v uint64 + if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) m.PackedField = append(m.PackedField, v2) } } else { @@ -4164,7 +4165,7 @@ func (m *FloatMessage) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Int32Message) UnmarshalVT(dAtA []byte) error { +func (m *FloatMessage) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -4188,71 +4189,47 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Int32Message: wiretype end group for non-group") + return fmt.Errorf("proto: FloatMessage: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Int32Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: FloatMessage: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - m.RequiredField = &v + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.RequiredField = &v2 hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 0 { + if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - m.OptionalField = &v + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.OptionalField = &v2 case 3: - if wireType == 0 { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - m.RepeatedField = append(m.RepeatedField, v) + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.RepeatedField = append(m.RepeatedField, v2) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -4280,55 +4257,33 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count + elementCount = packedLen / 4 if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]int32, 0, elementCount) + m.RepeatedField = make([]float32, 0, elementCount) } for iNdEx < postIndex { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - m.RepeatedField = append(m.RepeatedField, v) + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.RepeatedField = append(m.RepeatedField, v2) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 0 { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - m.PackedField = append(m.PackedField, v) + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.PackedField = append(m.PackedField, v2) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -4356,33 +4311,19 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count + elementCount = packedLen / 4 if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]int32, 0, elementCount) + m.PackedField = make([]float32, 0, elementCount) } for iNdEx < postIndex { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - m.PackedField = append(m.PackedField, v) + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.PackedField = append(m.PackedField, v2) } } else { return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) @@ -4412,7 +4353,7 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Int64Message) UnmarshalVT(dAtA []byte) error { +func (m *FloatMessage) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -4436,71 +4377,47 @@ func (m *Int64Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Int64Message: wiretype end group for non-group") + return fmt.Errorf("proto: FloatMessage: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Int64Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: FloatMessage: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - m.RequiredField = &v + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.RequiredField = &v2 hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 0 { + if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - m.OptionalField = &v + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.OptionalField = &v2 case 3: - if wireType == 0 { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - m.RepeatedField = append(m.RepeatedField, v) + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.RepeatedField = append(m.RepeatedField, v2) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -4528,55 +4445,33 @@ func (m *Int64Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count + elementCount = packedLen / 4 if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]int64, 0, elementCount) + m.RepeatedField = make([]float32, 0, elementCount) } for iNdEx < postIndex { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - m.RepeatedField = append(m.RepeatedField, v) + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.RepeatedField = append(m.RepeatedField, v2) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 0 { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - m.PackedField = append(m.PackedField, v) + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.PackedField = append(m.PackedField, v2) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -4604,33 +4499,19 @@ func (m *Int64Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count + elementCount = packedLen / 4 if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]int64, 0, elementCount) + m.PackedField = make([]float32, 0, elementCount) } for iNdEx < postIndex { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - m.PackedField = append(m.PackedField, v) + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.PackedField = append(m.PackedField, v2) } } else { return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) @@ -4660,7 +4541,7 @@ func (m *Int64Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { +func (m *Int32Message) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -4684,17 +4565,17 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Uint32Message: wiretype end group for non-group") + return fmt.Errorf("proto: Int32Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Uint32Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Int32Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v uint32 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4704,7 +4585,7 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint32(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -4715,7 +4596,7 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v uint32 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4725,7 +4606,7 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint32(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -4733,7 +4614,7 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { m.OptionalField = &v case 3: if wireType == 0 { - var v uint32 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4743,7 +4624,7 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint32(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -4784,10 +4665,10 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { } elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]uint32, 0, elementCount) + m.RepeatedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { - var v uint32 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4797,7 +4678,7 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint32(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -4809,7 +4690,7 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { } case 4: if wireType == 0 { - var v uint32 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4819,7 +4700,7 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint32(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -4860,10 +4741,10 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { } elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]uint32, 0, elementCount) + m.PackedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { - var v uint32 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4873,7 +4754,7 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint32(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -4908,7 +4789,7 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { +func (m *Int32Message) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -4932,17 +4813,17 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Uint64Message: wiretype end group for non-group") + return fmt.Errorf("proto: Int32Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Uint64Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Int32Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v uint64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4952,7 +4833,7 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -4963,7 +4844,7 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v uint64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4973,7 +4854,7 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -4981,7 +4862,7 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { m.OptionalField = &v case 3: if wireType == 0 { - var v uint64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4991,7 +4872,7 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -5032,10 +4913,10 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { } elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]uint64, 0, elementCount) + m.RepeatedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { - var v uint64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5045,7 +4926,7 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -5057,7 +4938,7 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { } case 4: if wireType == 0 { - var v uint64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5067,7 +4948,7 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -5108,10 +4989,10 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { } elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]uint64, 0, elementCount) + m.PackedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { - var v uint64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5121,7 +5002,7 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -5156,7 +5037,7 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { +func (m *Int64Message) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -5180,17 +5061,17 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Sint32Message: wiretype end group for non-group") + return fmt.Errorf("proto: Int64Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Sint32Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Int64Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int32 + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5200,19 +5081,18 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int32 + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5222,16 +5102,15 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.OptionalField = &v case 3: if wireType == 0 { - var v int32 + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5241,12 +5120,11 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int @@ -5283,10 +5161,10 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]int32, 0, elementCount) + m.RepeatedField = make([]int64, 0, elementCount) } for iNdEx < postIndex { - var v int32 + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5296,12 +5174,11 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.RepeatedField = append(m.RepeatedField, v) } } else { @@ -5309,7 +5186,7 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } case 4: if wireType == 0 { - var v int32 + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5319,12 +5196,11 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int @@ -5361,10 +5237,10 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]int32, 0, elementCount) + m.PackedField = make([]int64, 0, elementCount) } for iNdEx < postIndex { - var v int32 + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5374,12 +5250,11 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.PackedField = append(m.PackedField, v) } } else { @@ -5410,7 +5285,7 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { +func (m *Int64Message) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -5434,17 +5309,17 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Sint64Message: wiretype end group for non-group") + return fmt.Errorf("proto: Int64Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Sint64Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Int64Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v uint64 + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5454,20 +5329,18 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - v2 := int64(v) - m.RequiredField = &v2 + m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v uint64 + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5477,17 +5350,15 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - v2 := int64(v) - m.OptionalField = &v2 + m.OptionalField = &v case 3: if wireType == 0 { - var v uint64 + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5497,13 +5368,12 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.RepeatedField = append(m.RepeatedField, int64(v)) + m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -5542,7 +5412,7 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { m.RepeatedField = make([]int64, 0, elementCount) } for iNdEx < postIndex { - var v uint64 + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5552,20 +5422,19 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.RepeatedField = append(m.RepeatedField, int64(v)) + m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: if wireType == 0 { - var v uint64 + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5575,13 +5444,12 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.PackedField = append(m.PackedField, int64(v)) + m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -5620,7 +5488,7 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { m.PackedField = make([]int64, 0, elementCount) } for iNdEx < postIndex { - var v uint64 + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5630,13 +5498,12 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.PackedField = append(m.PackedField, int64(v)) + m.PackedField = append(m.PackedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) @@ -5666,7 +5533,7 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { +func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -5690,43 +5557,70 @@ func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Fixed32Message: wiretype end group for non-group") + return fmt.Errorf("proto: Uint32Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Fixed32Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Uint32Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 5 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 5 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.OptionalField = &v case 3: - if wireType == 5 { + if wireType == 0 { var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int @@ -5755,30 +5649,54 @@ func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 4 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { m.RepeatedField = make([]uint32, 0, elementCount) } for iNdEx < postIndex { var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 5 { + if wireType == 0 { var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int @@ -5807,17 +5725,32 @@ func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 4 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { m.PackedField = make([]uint32, 0, elementCount) } for iNdEx < postIndex { var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.PackedField = append(m.PackedField, v) } } else { @@ -5848,7 +5781,7 @@ func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Fixed64Message) UnmarshalVT(dAtA []byte) error { +func (m *Uint32Message) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -5872,43 +5805,70 @@ func (m *Fixed64Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Fixed64Message: wiretype end group for non-group") + return fmt.Errorf("proto: Uint32Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Fixed64Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Uint32Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 1 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 1 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.OptionalField = &v case 3: - if wireType == 1 { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int @@ -5937,30 +5897,54 @@ func (m *Fixed64Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 8 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]uint64, 0, elementCount) + m.RepeatedField = make([]uint32, 0, elementCount) } for iNdEx < postIndex { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 1 { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int @@ -5989,17 +5973,32 @@ func (m *Fixed64Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 8 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]uint64, 0, elementCount) + m.PackedField = make([]uint32, 0, elementCount) } for iNdEx < postIndex { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.PackedField = append(m.PackedField, v) } } else { @@ -6030,7 +6029,7 @@ func (m *Fixed64Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Sfixed32Message) UnmarshalVT(dAtA []byte) error { +func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -6054,43 +6053,70 @@ func (m *Sfixed32Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Sfixed32Message: wiretype end group for non-group") + return fmt.Errorf("proto: Uint64Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Sfixed32Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Uint64Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 5 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 5 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.OptionalField = &v case 3: - if wireType == 5 { - var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int @@ -6119,30 +6145,54 @@ func (m *Sfixed32Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 4 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]int32, 0, elementCount) + m.RepeatedField = make([]uint64, 0, elementCount) } for iNdEx < postIndex { - var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 5 { - var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int @@ -6171,17 +6221,32 @@ func (m *Sfixed32Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 4 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]int32, 0, elementCount) + m.PackedField = make([]uint64, 0, elementCount) } for iNdEx < postIndex { - var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.PackedField = append(m.PackedField, v) } } else { @@ -6212,7 +6277,7 @@ func (m *Sfixed32Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Sfixed64Message) UnmarshalVT(dAtA []byte) error { +func (m *Uint64Message) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -6236,43 +6301,70 @@ func (m *Sfixed64Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Sfixed64Message: wiretype end group for non-group") + return fmt.Errorf("proto: Uint64Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Sfixed64Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Uint64Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 1 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 1 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.OptionalField = &v case 3: - if wireType == 1 { - var v int64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int @@ -6301,30 +6393,54 @@ func (m *Sfixed64Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 8 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]int64, 0, elementCount) + m.RepeatedField = make([]uint64, 0, elementCount) } for iNdEx < postIndex { - var v int64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 1 { - var v int64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int @@ -6353,17 +6469,32 @@ func (m *Sfixed64Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 8 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]int64, 0, elementCount) + m.PackedField = make([]uint64, 0, elementCount) } for iNdEx < postIndex { - var v int64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.PackedField = append(m.PackedField, v) } } else { @@ -6394,7 +6525,7 @@ func (m *Sfixed64Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { +func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -6418,17 +6549,17 @@ func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: BoolMessage: wiretype end group for non-group") + return fmt.Errorf("proto: Sint32Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: BoolMessage: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Sint32Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6438,19 +6569,19 @@ func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } - b := bool(v != 0) - m.RequiredField = &b + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6460,16 +6591,16 @@ func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } - b := bool(v != 0) - m.OptionalField = &b + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.OptionalField = &v case 3: if wireType == 0 { - var v int + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6479,12 +6610,13 @@ func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } - m.RepeatedField = append(m.RepeatedField, bool(v != 0)) + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -6512,12 +6644,18 @@ func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]bool, 0, elementCount) + m.RepeatedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { - var v int + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6527,19 +6665,20 @@ func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } - m.RepeatedField = append(m.RepeatedField, bool(v != 0)) + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: if wireType == 0 { - var v int + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6549,12 +6688,13 @@ func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } - m.PackedField = append(m.PackedField, bool(v != 0)) + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -6582,12 +6722,18 @@ func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]bool, 0, elementCount) + m.PackedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { - var v int + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6597,12 +6743,13 @@ func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } - m.PackedField = append(m.PackedField, bool(v != 0)) + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.PackedField = append(m.PackedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) @@ -6632,7 +6779,3169 @@ func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *StringMessage) UnmarshalVT(dAtA []byte) error { +func (m *Sint32Message) UnmarshalVTUnsafe(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Sint32Message: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Sint32Message: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.RequiredField = &v + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.OptionalField = &v + case 3: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.RepeatedField = append(m.RepeatedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedField) == 0 { + m.RepeatedField = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.RepeatedField = append(m.RepeatedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + case 4: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.PackedField = append(m.PackedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedField) == 0 { + m.PackedField = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.PackedField = append(m.PackedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Sint64Message: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Sint64Message: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + v2 := int64(v) + m.RequiredField = &v2 + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + v2 := int64(v) + m.OptionalField = &v2 + case 3: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.RepeatedField = append(m.RepeatedField, int64(v)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedField) == 0 { + m.RepeatedField = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.RepeatedField = append(m.RepeatedField, int64(v)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + case 4: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.PackedField = append(m.PackedField, int64(v)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedField) == 0 { + m.PackedField = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.PackedField = append(m.PackedField, int64(v)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Sint64Message) UnmarshalVTUnsafe(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Sint64Message: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Sint64Message: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + v2 := int64(v) + m.RequiredField = &v2 + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + v2 := int64(v) + m.OptionalField = &v2 + case 3: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.RepeatedField = append(m.RepeatedField, int64(v)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedField) == 0 { + m.RepeatedField = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.RepeatedField = append(m.RepeatedField, int64(v)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + case 4: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.PackedField = append(m.PackedField, int64(v)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedField) == 0 { + m.PackedField = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.PackedField = append(m.PackedField, int64(v)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Fixed32Message: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Fixed32Message: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RequiredField = &v + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.OptionalField = &v + case 3: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedField = append(m.RepeatedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.RepeatedField) == 0 { + m.RepeatedField = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedField = append(m.RepeatedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + case 4: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedField = append(m.PackedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.PackedField) == 0 { + m.PackedField = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedField = append(m.PackedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Fixed32Message) UnmarshalVTUnsafe(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Fixed32Message: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Fixed32Message: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RequiredField = &v + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.OptionalField = &v + case 3: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedField = append(m.RepeatedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.RepeatedField) == 0 { + m.RepeatedField = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedField = append(m.RepeatedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + case 4: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedField = append(m.PackedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.PackedField) == 0 { + m.PackedField = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedField = append(m.PackedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Fixed64Message) UnmarshalVT(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Fixed64Message: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Fixed64Message: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RequiredField = &v + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.OptionalField = &v + case 3: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedField = append(m.RepeatedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.RepeatedField) == 0 { + m.RepeatedField = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedField = append(m.RepeatedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + case 4: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedField = append(m.PackedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.PackedField) == 0 { + m.PackedField = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedField = append(m.PackedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Fixed64Message) UnmarshalVTUnsafe(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Fixed64Message: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Fixed64Message: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RequiredField = &v + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.OptionalField = &v + case 3: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedField = append(m.RepeatedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.RepeatedField) == 0 { + m.RepeatedField = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedField = append(m.RepeatedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + case 4: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedField = append(m.PackedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.PackedField) == 0 { + m.PackedField = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedField = append(m.PackedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Sfixed32Message) UnmarshalVT(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Sfixed32Message: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Sfixed32Message: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RequiredField = &v + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.OptionalField = &v + case 3: + if wireType == 5 { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedField = append(m.RepeatedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.RepeatedField) == 0 { + m.RepeatedField = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedField = append(m.RepeatedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + case 4: + if wireType == 5 { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedField = append(m.PackedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.PackedField) == 0 { + m.PackedField = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedField = append(m.PackedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Sfixed32Message) UnmarshalVTUnsafe(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Sfixed32Message: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Sfixed32Message: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RequiredField = &v + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.OptionalField = &v + case 3: + if wireType == 5 { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedField = append(m.RepeatedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.RepeatedField) == 0 { + m.RepeatedField = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedField = append(m.RepeatedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + case 4: + if wireType == 5 { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedField = append(m.PackedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.PackedField) == 0 { + m.PackedField = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedField = append(m.PackedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Sfixed64Message) UnmarshalVT(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Sfixed64Message: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Sfixed64Message: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RequiredField = &v + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.OptionalField = &v + case 3: + if wireType == 1 { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedField = append(m.RepeatedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.RepeatedField) == 0 { + m.RepeatedField = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedField = append(m.RepeatedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + case 4: + if wireType == 1 { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedField = append(m.PackedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.PackedField) == 0 { + m.PackedField = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedField = append(m.PackedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Sfixed64Message) UnmarshalVTUnsafe(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Sfixed64Message: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Sfixed64Message: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RequiredField = &v + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.OptionalField = &v + case 3: + if wireType == 1 { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedField = append(m.RepeatedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.RepeatedField) == 0 { + m.RepeatedField = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedField = append(m.RepeatedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + case 4: + if wireType == 1 { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedField = append(m.PackedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.PackedField) == 0 { + m.PackedField = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedField = append(m.PackedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: BoolMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BoolMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.RequiredField = &b + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.OptionalField = &b + case 3: + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedField = append(m.RepeatedField, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(m.RepeatedField) == 0 { + m.RepeatedField = make([]bool, 0, elementCount) + } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedField = append(m.RepeatedField, bool(v != 0)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + case 4: + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedField = append(m.PackedField, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(m.PackedField) == 0 { + m.PackedField = make([]bool, 0, elementCount) + } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedField = append(m.PackedField, bool(v != 0)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BoolMessage) UnmarshalVTUnsafe(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: BoolMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BoolMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.RequiredField = &b + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.OptionalField = &b + case 3: + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedField = append(m.RepeatedField, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(m.RepeatedField) == 0 { + m.RepeatedField = make([]bool, 0, elementCount) + } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedField = append(m.RepeatedField, bool(v != 0)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + case 4: + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedField = append(m.PackedField, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(m.PackedField) == 0 { + m.PackedField = make([]bool, 0, elementCount) + } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedField = append(m.PackedField, bool(v != 0)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StringMessage) UnmarshalVT(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: StringMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StringMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.RequiredField = &s + iNdEx = postIndex + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.OptionalField = &s + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedField = append(m.RepeatedField, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StringMessage) UnmarshalVTUnsafe(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: StringMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StringMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.RequiredField = &s + iNdEx = postIndex + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.OptionalField = &s + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedField = append(m.RepeatedField, unsafeBytesToString(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BytesMessage) UnmarshalVT(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: BytesMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BytesMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequiredField = append(m.RequiredField[:0], dAtA[iNdEx:postIndex]...) + if m.RequiredField == nil { + m.RequiredField = []byte{} + } + iNdEx = postIndex + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OptionalField = append(m.OptionalField[:0], dAtA[iNdEx:postIndex]...) + if m.OptionalField == nil { + m.OptionalField = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedField = append(m.RepeatedField, make([]byte, postIndex-iNdEx)) + copy(m.RepeatedField[len(m.RepeatedField)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BytesMessage) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -6656,17 +9965,17 @@ func (m *StringMessage) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: StringMessage: wiretype end group for non-group") + return fmt.Errorf("proto: BytesMessage: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: StringMessage: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: BytesMessage: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6676,31 +9985,32 @@ func (m *StringMessage) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } - s := string(dAtA[iNdEx:postIndex]) - m.RequiredField = &s + m.RequiredField = append(m.RequiredField[:0], dAtA[iNdEx:postIndex]...) + if m.RequiredField == nil { + m.RequiredField = []byte{} + } iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6710,30 +10020,31 @@ func (m *StringMessage) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } - s := string(dAtA[iNdEx:postIndex]) - m.OptionalField = &s + m.OptionalField = append(m.OptionalField[:0], dAtA[iNdEx:postIndex]...) + if m.OptionalField == nil { + m.OptionalField = []byte{} + } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6743,23 +10054,22 @@ func (m *StringMessage) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } - m.RepeatedField = append(m.RepeatedField, string(dAtA[iNdEx:postIndex])) + m.RepeatedField = append(m.RepeatedField, dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -6786,7 +10096,7 @@ func (m *StringMessage) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *BytesMessage) UnmarshalVT(dAtA []byte) error { +func (m *EnumMessage) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -6810,17 +10120,17 @@ func (m *BytesMessage) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: BytesMessage: wiretype end group for non-group") + return fmt.Errorf("proto: EnumMessage: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: BytesMessage: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EnumMessage: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var byteLen int + var v EnumMessage_Num for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6830,32 +10140,18 @@ func (m *BytesMessage) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + v |= EnumMessage_Num(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RequiredField = append(m.RequiredField[:0], dAtA[iNdEx:postIndex]...) - if m.RequiredField == nil { - m.RequiredField = []byte{} - } - iNdEx = postIndex + m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var byteLen int + var v EnumMessage_Num for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6865,58 +10161,150 @@ func (m *BytesMessage) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + v |= EnumMessage_Num(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OptionalField = append(m.OptionalField[:0], dAtA[iNdEx:postIndex]...) - if m.OptionalField == nil { - m.OptionalField = []byte{} - } - iNdEx = postIndex + m.OptionalField = &v case 3: - if wireType != 2 { + if wireType == 0 { + var v EnumMessage_Num + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= EnumMessage_Num(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedField = append(m.RepeatedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + if elementCount != 0 && len(m.RepeatedField) == 0 { + m.RepeatedField = make([]EnumMessage_Num, 0, elementCount) + } + for iNdEx < postIndex { + var v EnumMessage_Num + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= EnumMessage_Num(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedField = append(m.RepeatedField, v) + } + } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow + case 4: + if wireType == 0 { + var v EnumMessage_Num + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= EnumMessage_Num(b&0x7F) << shift + if b < 0x80 { + break + } } - if iNdEx >= l { + m.PackedField = append(m.PackedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break + var elementCount int + if elementCount != 0 && len(m.PackedField) == 0 { + m.PackedField = make([]EnumMessage_Num, 0, elementCount) } + for iNdEx < postIndex { + var v EnumMessage_Num + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= EnumMessage_Num(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedField = append(m.PackedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RepeatedField = append(m.RepeatedField, make([]byte, postIndex-iNdEx)) - copy(m.RepeatedField[len(m.RepeatedField)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -6942,7 +10330,7 @@ func (m *BytesMessage) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *EnumMessage) UnmarshalVT(dAtA []byte) error { +func (m *EnumMessage) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -7261,3 +10649,7 @@ var ( ErrIntOverflow = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") ) + +func unsafeBytesToString(b []byte) string { + return *(*string)(unsafe.Pointer(&b)) +} diff --git a/testproto/proto3opt/opt_vtproto.pb.go b/testproto/proto3opt/opt_vtproto.pb.go index 06c1fa5..0ebaa1a 100644 --- a/testproto/proto3opt/opt_vtproto.pb.go +++ b/testproto/proto3opt/opt_vtproto.pb.go @@ -12,6 +12,7 @@ import ( io "io" math "math" bits "math/bits" + unsafe "unsafe" ) const ( @@ -853,6 +854,356 @@ func (m *OptionalFieldInProto3) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *OptionalFieldInProto3) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: OptionalFieldInProto3: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OptionalFieldInProto3: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalInt32", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptionalInt32 = &v + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalInt64", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptionalInt64 = &v + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalUint32", wireType) + } + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptionalUint32 = &v + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalUint64", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptionalUint64 = &v + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalSint32", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.OptionalSint32 = &v + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalSint64", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + v2 := int64(v) + m.OptionalSint64 = &v2 + case 7: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalFixed32", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.OptionalFixed32 = &v + case 8: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalFixed64", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.OptionalFixed64 = &v + case 9: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalSfixed32", wireType) + } + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.OptionalSfixed32 = &v + case 10: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalSfixed64", wireType) + } + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.OptionalSfixed64 = &v + case 11: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalFloat", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.OptionalFloat = &v2 + case 12: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalDouble", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.OptionalDouble = &v2 + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalBool", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.OptionalBool = &b + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.OptionalString = &s + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalBytes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OptionalBytes = append(m.OptionalBytes[:0], dAtA[iNdEx:postIndex]...) + if m.OptionalBytes == nil { + m.OptionalBytes = []byte{} + } + iNdEx = postIndex + case 16: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalEnum", wireType) + } + var v SimpleEnum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= SimpleEnum(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.OptionalEnum = &v + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skip(dAtA []byte) (n int, err error) { l := len(dAtA) @@ -938,3 +1289,7 @@ var ( ErrIntOverflow = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") ) + +func unsafeBytesToString(b []byte) string { + return *(*string)(unsafe.Pointer(&b)) +} From 67f164c308ae8657446772cc3b1f1d9135e81504 Mon Sep 17 00:00:00 2001 From: Corentin Dupret Date: Fri, 22 Sep 2023 00:32:05 +0200 Subject: [PATCH 02/10] Add test for `UnmarshalVTUnsafe` (wip) --- Makefile | 1 + testproto/unsafe/unsafe.pb.go | 155 ++++++++ testproto/unsafe/unsafe.proto | 9 + testproto/unsafe/unsafe_test.go | 44 +++ testproto/unsafe/unsafe_vtproto.pb.go | 519 ++++++++++++++++++++++++++ 5 files changed, 728 insertions(+) create mode 100644 testproto/unsafe/unsafe.pb.go create mode 100644 testproto/unsafe/unsafe.proto create mode 100644 testproto/unsafe/unsafe_test.go create mode 100644 testproto/unsafe/unsafe_vtproto.pb.go diff --git a/Makefile b/Makefile index 04f2b40..1e25855 100644 --- a/Makefile +++ b/Makefile @@ -45,6 +45,7 @@ gen-testproto: testproto/pool/pool_with_oneof.proto \ testproto/proto3opt/opt.proto \ testproto/proto2/scalars.proto \ + testproto/unsafe/unsafe.proto \ || exit 1; genall: install gen-include gen-conformance gen-testproto diff --git a/testproto/unsafe/unsafe.pb.go b/testproto/unsafe/unsafe.pb.go new file mode 100644 index 0000000..2437de5 --- /dev/null +++ b/testproto/unsafe/unsafe.pb.go @@ -0,0 +1,155 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.21.12 +// source: unsafe/unsafe.proto + +package unsafe + +import ( + _ "github.com/planetscale/vtprotobuf/vtproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type UnsafeTest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Foo1 string `protobuf:"bytes,1,opt,name=foo1,proto3" json:"foo1,omitempty"` + Foo2 []byte `protobuf:"bytes,2,opt,name=foo2,proto3" json:"foo2,omitempty"` +} + +func (x *UnsafeTest) Reset() { + *x = UnsafeTest{} + if protoimpl.UnsafeEnabled { + mi := &file_unsafe_unsafe_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UnsafeTest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnsafeTest) ProtoMessage() {} + +func (x *UnsafeTest) ProtoReflect() protoreflect.Message { + mi := &file_unsafe_unsafe_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnsafeTest.ProtoReflect.Descriptor instead. +func (*UnsafeTest) Descriptor() ([]byte, []int) { + return file_unsafe_unsafe_proto_rawDescGZIP(), []int{0} +} + +func (x *UnsafeTest) GetFoo1() string { + if x != nil { + return x.Foo1 + } + return "" +} + +func (x *UnsafeTest) GetFoo2() []byte { + if x != nil { + return x.Foo2 + } + return nil +} + +var File_unsafe_unsafe_proto protoreflect.FileDescriptor + +var file_unsafe_unsafe_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x75, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x2f, 0x75, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x74, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x74, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x0a, 0x55, 0x6e, + 0x73, 0x61, 0x66, 0x65, 0x54, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6f, 0x6f, 0x31, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6f, 0x6f, 0x31, 0x12, 0x12, 0x0a, 0x04, + 0x66, 0x6f, 0x6f, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x66, 0x6f, 0x6f, 0x32, + 0x42, 0x12, 0x5a, 0x10, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x75, 0x6e, + 0x73, 0x61, 0x66, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_unsafe_unsafe_proto_rawDescOnce sync.Once + file_unsafe_unsafe_proto_rawDescData = file_unsafe_unsafe_proto_rawDesc +) + +func file_unsafe_unsafe_proto_rawDescGZIP() []byte { + file_unsafe_unsafe_proto_rawDescOnce.Do(func() { + file_unsafe_unsafe_proto_rawDescData = protoimpl.X.CompressGZIP(file_unsafe_unsafe_proto_rawDescData) + }) + return file_unsafe_unsafe_proto_rawDescData +} + +var file_unsafe_unsafe_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_unsafe_unsafe_proto_goTypes = []interface{}{ + (*UnsafeTest)(nil), // 0: UnsafeTest +} +var file_unsafe_unsafe_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_unsafe_unsafe_proto_init() } +func file_unsafe_unsafe_proto_init() { + if File_unsafe_unsafe_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_unsafe_unsafe_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UnsafeTest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_unsafe_unsafe_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_unsafe_unsafe_proto_goTypes, + DependencyIndexes: file_unsafe_unsafe_proto_depIdxs, + MessageInfos: file_unsafe_unsafe_proto_msgTypes, + }.Build() + File_unsafe_unsafe_proto = out.File + file_unsafe_unsafe_proto_rawDesc = nil + file_unsafe_unsafe_proto_goTypes = nil + file_unsafe_unsafe_proto_depIdxs = nil +} diff --git a/testproto/unsafe/unsafe.proto b/testproto/unsafe/unsafe.proto new file mode 100644 index 0000000..66aeacc --- /dev/null +++ b/testproto/unsafe/unsafe.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; +option go_package = "testproto/unsafe"; + +import "github.com/planetscale/vtprotobuf/vtproto/ext.proto"; + +message UnsafeTest { + string foo1 = 1; + bytes foo2 = 2; +} diff --git a/testproto/unsafe/unsafe_test.go b/testproto/unsafe/unsafe_test.go new file mode 100644 index 0000000..4dcacb8 --- /dev/null +++ b/testproto/unsafe/unsafe_test.go @@ -0,0 +1,44 @@ +package unsafe + +import ( + "reflect" + "testing" + "unsafe" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func Test_UnmarshalVTUnsafe(t *testing.T) { + t0 := &UnsafeTest{ + // TODO: add more test cases, consider fuzzing + Foo1: "c4c5cVG%$VG$%_KCREÉŠŻ", + Foo2: []byte{1, 2, 3, 4, 5, 6, 7, 8}, + } + + t0Bytes, err := t0.MarshalVT() + require.NoError(t, err) + + t1 := &UnsafeTest{} + require.NoError(t, t1.UnmarshalVTUnsafe(t0Bytes)) + require.NotEqual(t, uintptr(unsafe.Pointer(t0)), uintptr(unsafe.Pointer(t1))) + + t0BytesStart := (*reflect.SliceHeader)(unsafe.Pointer(&t0Bytes)).Data + t0BytesEnd := t0BytesStart + uintptr(t0.SizeVT()) - 1 + + assert.Equal(t, t0.Foo1, t1.Foo1) + hdr0s := (*reflect.StringHeader)(unsafe.Pointer(&t0.Foo1)) + hdr1s := (*reflect.StringHeader)(unsafe.Pointer(&t1.Foo1)) + assert.False(t, hdr0s.Data > t0BytesStart && hdr0s.Data < t0BytesEnd) + // TODO: maybe add something for UnmarshalVT + // the underlying data of Foo1 belongs to t0Bytes because it is unsafe + assert.True(t, hdr1s.Data > t0BytesStart && hdr1s.Data < t0BytesEnd) + + assert.Equal(t, t0.Foo2, t1.Foo2) + hdr0b := (*reflect.SliceHeader)(unsafe.Pointer(&t0.Foo2)) + hdr1b := (*reflect.SliceHeader)(unsafe.Pointer(&t1.Foo2)) + assert.False(t, hdr0b.Data > t0BytesStart && hdr0b.Data < t0BytesEnd) + // the underlying data of Foo2 belongs to t0Bytes because it is unsafe + // TODO: it fails here, there is an issue with bytes + assert.True(t, hdr1b.Data > t0BytesStart && hdr1b.Data < t0BytesEnd) +} diff --git a/testproto/unsafe/unsafe_vtproto.pb.go b/testproto/unsafe/unsafe_vtproto.pb.go new file mode 100644 index 0000000..be8660e --- /dev/null +++ b/testproto/unsafe/unsafe_vtproto.pb.go @@ -0,0 +1,519 @@ +// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. +// protoc-gen-go-vtproto version: (devel) +// source: unsafe/unsafe.proto + +package unsafe + +import ( + fmt "fmt" + proto "google.golang.org/protobuf/proto" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + bits "math/bits" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +func (m *UnsafeTest) CloneVT() *UnsafeTest { + if m == nil { + return (*UnsafeTest)(nil) + } + r := &UnsafeTest{ + Foo1: m.Foo1, + } + if rhs := m.Foo2; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.Foo2 = tmpBytes + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *UnsafeTest) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (this *UnsafeTest) EqualVT(that *UnsafeTest) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Foo1 != that.Foo1 { + return false + } + if string(this.Foo2) != string(that.Foo2) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *UnsafeTest) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*UnsafeTest) + if !ok { + return false + } + return this.EqualVT(that) +} +func (m *UnsafeTest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UnsafeTest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *UnsafeTest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Foo2) > 0 { + i -= len(m.Foo2) + copy(dAtA[i:], m.Foo2) + i = encodeVarint(dAtA, i, uint64(len(m.Foo2))) + i-- + dAtA[i] = 0x12 + } + if len(m.Foo1) > 0 { + i -= len(m.Foo1) + copy(dAtA[i:], m.Foo1) + i = encodeVarint(dAtA, i, uint64(len(m.Foo1))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarint(dAtA []byte, offset int, v uint64) int { + offset -= sov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *UnsafeTest) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UnsafeTest) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *UnsafeTest) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Foo2) > 0 { + i -= len(m.Foo2) + copy(dAtA[i:], m.Foo2) + i = encodeVarint(dAtA, i, uint64(len(m.Foo2))) + i-- + dAtA[i] = 0x12 + } + if len(m.Foo1) > 0 { + i -= len(m.Foo1) + copy(dAtA[i:], m.Foo1) + i = encodeVarint(dAtA, i, uint64(len(m.Foo1))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UnsafeTest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Foo1) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.Foo2) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func sov(x uint64) (n int) { + return (bits.Len64(x|1) + 6) / 7 +} +func soz(x uint64) (n int) { + return sov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *UnsafeTest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: UnsafeTest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnsafeTest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Foo1", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Foo1 = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Foo2", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Foo2 = append(m.Foo2[:0], dAtA[iNdEx:postIndex]...) + if m.Foo2 == nil { + m.Foo2 = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnsafeTest) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: UnsafeTest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnsafeTest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Foo1", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Foo1 = unsafeBytesToString(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Foo2", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Foo2 = append(m.Foo2[:0], dAtA[iNdEx:postIndex]...) + if m.Foo2 == nil { + m.Foo2 = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func skip(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLength + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroup + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLength + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflow = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") +) + +func unsafeBytesToString(b []byte) string { + return *(*string)(unsafe.Pointer(&b)) +} From 776550f8907ba1b76339403bbf05460e50c1f15d Mon Sep 17 00:00:00 2001 From: Corentin Dupret Date: Wed, 4 Oct 2023 11:25:51 +0200 Subject: [PATCH 03/10] Make `unmarshal_unsafe` a feature --- README.md | 4 +- .../conformance/conformance_vtproto.pb.go | 482 +- .../test_messages_proto2_vtproto.pb.go | 2123 ++++----- .../test_messages_proto3_vtproto.pb.go | 656 +-- features/unmarshal/unmarshal.go | 61 +- testproto/pool/pool_vtproto.pb.go | 171 +- .../pool/pool_with_slice_reuse_vtproto.pb.go | 490 +- testproto/proto2/scalars_vtproto.pb.go | 4037 +++++++++-------- testproto/proto3opt/opt_vtproto.pb.go | 171 +- testproto/unsafe/unsafe_vtproto.pb.go | 176 +- testproto/wkt/wkt_vtproto.pb.go | 561 +++ types/known/anypb/any_vtproto.pb.go | 122 + types/known/durationpb/duration_vtproto.pb.go | 94 + types/known/emptypb/empty_vtproto.pb.go | 56 + .../fieldmaskpb/field_mask_vtproto.pb.go | 88 + .../known/timestamppb/timestamp_vtproto.pb.go | 94 + types/known/wrapperspb/wrappers_vtproto.pb.go | 640 +++ 17 files changed, 5743 insertions(+), 4283 deletions(-) diff --git a/README.md b/README.md index 99ddfe3..63afeeb 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,8 @@ The following features can be generated: - `unmarshal`: generates a `func (p *YourProto) UnmarshalVT(data []byte)` that behaves similarly to calling `proto.Unmarshal(data, p)` on the message, except the unmarshalling is performed by unrolled codegen without using reflection and allocating as little memory as possible. If the receiver `p` is **not** fully zeroed-out, the unmarshal call will actually behave like `proto.Merge(data, p)`. This is because the `proto.Unmarshal` in the ProtoBuf API is implemented by resetting the destination message and then calling `proto.Merge` on it. To ensure proper `Unmarshal` semantics, ensure you've called `proto.Reset` on your message before calling `UnmarshalVT`, or that your message has been newly allocated. +- `unmarshal_unsafe` generates a `func (p *YourProto) UnmarshalVTUnsafe(data []byte)` that behaves like `UnmarshalVT`, except it unsafely casts slices of data to `bytes` and `string` fields instead of copying them to newly allocated arrays, so that it performs less allocations. **Data received from the wire has to be left untouched for the lifetime of the message.** Otherwise, the message's `bytes` and `string` fields can be corrupted. + - `pool`: generates the following helper methods - `func (p *YourProto) ResetVT()`: this function behaves similarly to `proto.Reset(p)`, except it keeps as much memory as possible available on the message, so that further calls to `UnmarshalVT` on the same message will need to allocate less memory. This an API meant to be used with memory pools and does not need to be used directly. @@ -221,4 +223,4 @@ plugins: opt: paths=source_relative ``` -Running `buf generate` will now also include the `vtprotobuf` optimized helpers. \ No newline at end of file +Running `buf generate` will now also include the `vtprotobuf` optimized helpers. diff --git a/conformance/internal/conformance/conformance_vtproto.pb.go b/conformance/internal/conformance/conformance_vtproto.pb.go index 8390ced..f9ae57f 100644 --- a/conformance/internal/conformance/conformance_vtproto.pb.go +++ b/conformance/internal/conformance/conformance_vtproto.pb.go @@ -1627,89 +1627,6 @@ func (m *FailureSet) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *FailureSet) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - 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) - if wireType == 4 { - return fmt.Errorf("proto: FailureSet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FailureSet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Failure", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Failure = append(m.Failure, unsafeBytesToString(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *ConformanceRequest) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2016,7 +1933,7 @@ func (m *ConformanceRequest) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2039,17 +1956,17 @@ func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ConformanceRequest: wiretype end group for non-group") + return fmt.Errorf("proto: ConformanceResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ConformanceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ConformanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProtobufPayload", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ParseError", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -2059,27 +1976,27 @@ func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLength } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } - v := dAtA[iNdEx:postIndex] - m.Payload = &ConformanceRequest_ProtobufPayload{ProtobufPayload: v} + m.Result = &ConformanceResponse_ParseError{ParseError: string(dAtA[iNdEx:postIndex])} iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field JsonPayload", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RuntimeError", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2107,13 +2024,13 @@ func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Payload = &ConformanceRequest_JsonPayload{JsonPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} + m.Result = &ConformanceResponse_RuntimeError{RuntimeError: string(dAtA[iNdEx:postIndex])} iNdEx = postIndex case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestedOutputFormat", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProtobufPayload", wireType) } - m.RequestedOutputFormat = 0 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -2123,14 +2040,28 @@ func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.RequestedOutputFormat |= WireFormat(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.Result = &ConformanceResponse_ProtobufPayload{ProtobufPayload: v} + iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MessageType", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field JsonPayload", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2158,13 +2089,13 @@ func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MessageType = unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.Result = &ConformanceResponse_JsonPayload{JsonPayload: string(dAtA[iNdEx:postIndex])} iNdEx = postIndex case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TestCategory", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Skipped", wireType) } - m.TestCategory = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -2174,16 +2105,29 @@ func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TestCategory |= TestCategory(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = &ConformanceResponse_Skipped{Skipped: string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field JspbEncodingOptions", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SerializeError", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -2193,27 +2137,23 @@ func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLength } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } - if m.JspbEncodingOptions == nil { - m.JspbEncodingOptions = &JspbEncodingConfig{} - } - if err := m.JspbEncodingOptions.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Result = &ConformanceResponse_SerializeError{SerializeError: string(dAtA[iNdEx:postIndex])} iNdEx = postIndex case 7: if wireType != 2 { @@ -2245,7 +2185,7 @@ func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Payload = &ConformanceRequest_JspbPayload{JspbPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} + m.Result = &ConformanceResponse_JspbPayload{JspbPayload: string(dAtA[iNdEx:postIndex])} iNdEx = postIndex case 8: if wireType != 2 { @@ -2277,11 +2217,62 @@ func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Payload = &ConformanceRequest_TextPayload{TextPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} + m.Result = &ConformanceResponse_TextPayload{TextPayload: string(dAtA[iNdEx:postIndex])} iNdEx = postIndex - case 9: + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *JspbEncodingConfig) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: JspbEncodingConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: JspbEncodingConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PrintUnknownFields", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UseJspbArrayAnyFormat", wireType) } var v int for shift := uint(0); ; shift += 7 { @@ -2298,7 +2289,7 @@ func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { break } } - m.PrintUnknownFields = bool(v != 0) + m.UseJspbArrayAnyFormat = bool(v != 0) default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -2321,7 +2312,7 @@ func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { +func (m *FailureSet) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2344,15 +2335,15 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ConformanceResponse: wiretype end group for non-group") + return fmt.Errorf("proto: FailureSet: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ConformanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: FailureSet: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParseError", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Failure", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2380,41 +2371,60 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_ParseError{ParseError: string(dAtA[iNdEx:postIndex])} + m.Failure = append(m.Failure, unsafeBytesToString(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RuntimeError", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLength } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - if postIndex > l { + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_RuntimeError{RuntimeError: string(dAtA[iNdEx:postIndex])} - iNdEx = postIndex - case 3: + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConformanceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConformanceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProtobufPayload", wireType) } @@ -2443,11 +2453,10 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := make([]byte, postIndex-iNdEx) - copy(v, dAtA[iNdEx:postIndex]) - m.Result = &ConformanceResponse_ProtobufPayload{ProtobufPayload: v} + v := dAtA[iNdEx:postIndex] + m.Payload = &ConformanceRequest_ProtobufPayload{ProtobufPayload: v} iNdEx = postIndex - case 4: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field JsonPayload", wireType) } @@ -2477,11 +2486,30 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_JsonPayload{JsonPayload: string(dAtA[iNdEx:postIndex])} + m.Payload = &ConformanceRequest_JsonPayload{JsonPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} iNdEx = postIndex - case 5: + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestedOutputFormat", wireType) + } + m.RequestedOutputFormat = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestedOutputFormat |= WireFormat(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Skipped", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MessageType", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2509,13 +2537,32 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_Skipped{Skipped: string(dAtA[iNdEx:postIndex])} + m.MessageType = unsafeBytesToString(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TestCategory", wireType) + } + m.TestCategory = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TestCategory |= TestCategory(b&0x7F) << shift + if b < 0x80 { + break + } + } case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SerializeError", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field JspbEncodingOptions", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -2525,23 +2572,27 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_SerializeError{SerializeError: string(dAtA[iNdEx:postIndex])} + if m.JspbEncodingOptions == nil { + m.JspbEncodingOptions = &JspbEncodingConfig{} + } + if err := m.JspbEncodingOptions.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 7: if wireType != 2 { @@ -2573,7 +2624,7 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_JspbPayload{JspbPayload: string(dAtA[iNdEx:postIndex])} + m.Payload = &ConformanceRequest_JspbPayload{JspbPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} iNdEx = postIndex case 8: if wireType != 2 { @@ -2605,8 +2656,28 @@ func (m *ConformanceResponse) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_TextPayload{TextPayload: string(dAtA[iNdEx:postIndex])} + m.Payload = &ConformanceRequest_TextPayload{TextPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PrintUnknownFields", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PrintUnknownFields = bool(v != 0) default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -2936,77 +3007,6 @@ func (m *ConformanceResponse) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *JspbEncodingConfig) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - 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) - if wireType == 4 { - return fmt.Errorf("proto: JspbEncodingConfig: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: JspbEncodingConfig: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field UseJspbArrayAnyFormat", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.UseJspbArrayAnyFormat = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *JspbEncodingConfig) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/conformance/internal/conformance/test_messages_proto2_vtproto.pb.go b/conformance/internal/conformance/test_messages_proto2_vtproto.pb.go index 3ccd644..dc4952f 100644 --- a/conformance/internal/conformance/test_messages_proto2_vtproto.pb.go +++ b/conformance/internal/conformance/test_messages_proto2_vtproto.pb.go @@ -14088,7 +14088,7 @@ func (m *TestAllTypesProto2) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *TestAllTypesProto2_NestedMessage) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *ForeignMessageProto2) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -14111,15 +14111,15 @@ func (m *TestAllTypesProto2_NestedMessage) UnmarshalVTUnsafe(dAtA []byte) error fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TestAllTypesProto2_NestedMessage: wiretype end group for non-group") + return fmt.Errorf("proto: ForeignMessageProto2: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TestAllTypesProto2_NestedMessage: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ForeignMessageProto2: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field A", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field C", wireType) } var v int32 for shift := uint(0); ; shift += 7 { @@ -14136,43 +14136,7 @@ func (m *TestAllTypesProto2_NestedMessage) UnmarshalVTUnsafe(dAtA []byte) error break } } - m.A = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Corecursive", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Corecursive == nil { - m.Corecursive = &TestAllTypesProto2{} - } - if err := m.Corecursive.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex + m.C = &v default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -14195,7 +14159,7 @@ func (m *TestAllTypesProto2_NestedMessage) UnmarshalVTUnsafe(dAtA []byte) error } return nil } -func (m *TestAllTypesProto2_Data) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *UnknownToTestAllTypes_OptionalGroup) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -14218,15 +14182,15 @@ func (m *TestAllTypesProto2_Data) UnmarshalVTUnsafe(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TestAllTypesProto2_Data: wiretype end group for non-group") + return fmt.Errorf("proto: UnknownToTestAllTypes_OptionalGroup: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TestAllTypesProto2_Data: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: UnknownToTestAllTypes_OptionalGroup: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 202: + case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GroupInt32", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field A", wireType) } var v int32 for shift := uint(0); ; shift += 7 { @@ -14243,27 +14207,7 @@ func (m *TestAllTypesProto2_Data) UnmarshalVTUnsafe(dAtA []byte) error { break } } - m.GroupInt32 = &v - case 203: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GroupUint32", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.GroupUint32 = &v + m.A = &v default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -14286,7 +14230,7 @@ func (m *TestAllTypesProto2_Data) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *TestAllTypesProto2_MessageSetCorrect) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *UnknownToTestAllTypes) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -14309,74 +14253,35 @@ func (m *TestAllTypesProto2_MessageSetCorrect) UnmarshalVTUnsafe(dAtA []byte) er fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrect: wiretype end group for non-group") + return fmt.Errorf("proto: UnknownToTestAllTypes: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrect: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: UnknownToTestAllTypes: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + case 1001: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalInt32", wireType) } - if (fieldNum >= 4) && (fieldNum < 2147483647) { - err = proto.UnmarshalOptions{AllowPartial: true}.Unmarshal(dAtA[iNdEx:iNdEx+skippy], m) - if err != nil { - return err + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break } - iNdEx += skippy - } else { - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TestAllTypesProto2_MessageSetCorrectExtension1) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - 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) - if wireType == 4 { - return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrectExtension1: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrectExtension1: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 25: + m.OptionalInt32 = &v + case 1002: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Str", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OptionalString", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -14404,65 +14309,14 @@ func (m *TestAllTypesProto2_MessageSetCorrectExtension1) UnmarshalVTUnsafe(dAtA if postIndex > l { return io.ErrUnexpectedEOF } - s := unsafeBytesToString(dAtA[iNdEx:postIndex]) - m.Str = &s + s := string(dAtA[iNdEx:postIndex]) + m.OptionalString = &s iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TestAllTypesProto2_MessageSetCorrectExtension2) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - 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) - if wireType == 4 { - return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrectExtension2: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrectExtension2: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field I", wireType) + case 1003: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NestedMessage", wireType) } - var v int32 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -14472,41 +14326,876 @@ func (m *TestAllTypesProto2_MessageSetCorrectExtension2) UnmarshalVTUnsafe(dAtA } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - m.I = &v - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err + if msglen < 0 { + return ErrInvalidLength } - if (skippy < 0) || (iNdEx+skippy) < 0 { + postIndex := iNdEx + msglen + if postIndex < 0 { return ErrInvalidLength } - if (iNdEx + skippy) > l { + if postIndex > l { return io.ErrUnexpectedEOF } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { + if m.NestedMessage == nil { + m.NestedMessage = &ForeignMessageProto2{} + } + if err := m.NestedMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 1004: + if wireType != 3 { + return fmt.Errorf("proto: wrong wireType = %d for field Optionalgroup", wireType) + } + groupStart := iNdEx + for { + maybeGroupEnd := iNdEx + var groupFieldWire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + groupFieldWire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + groupWireType := int(wire & 0x7) + if groupWireType == 4 { + if err := m.Optionalgroup.UnmarshalVT(dAtA[groupStart:maybeGroupEnd]); err != nil { + return err + } + break + } + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + iNdEx += skippy + } + case 1006: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalBool", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.OptionalBool = &b + case 1011: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedInt32 = append(m.RepeatedInt32, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedInt32) == 0 { + m.RepeatedInt32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedInt32 = append(m.RepeatedInt32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedInt32", wireType) + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NullHypothesisProto2) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: NullHypothesisProto2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NullHypothesisProto2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EnumOnlyProto2) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: EnumOnlyProto2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EnumOnlyProto2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OneStringProto2) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: OneStringProto2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OneStringProto2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Data = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func skip(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLength + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroup + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLength + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflow = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") +) + +func (m *TestAllTypesProto2_NestedMessage) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: TestAllTypesProto2_NestedMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TestAllTypesProto2_NestedMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field A", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.A = &v + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Corecursive", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Corecursive == nil { + m.Corecursive = &TestAllTypesProto2{} + } + if err := m.Corecursive.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TestAllTypesProto2_Data) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: TestAllTypesProto2_Data: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TestAllTypesProto2_Data: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 202: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GroupInt32", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.GroupInt32 = &v + case 203: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GroupUint32", wireType) + } + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.GroupUint32 = &v + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TestAllTypesProto2_MessageSetCorrect) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrect: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrect: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + if (fieldNum >= 4) && (fieldNum < 2147483647) { + err = proto.UnmarshalOptions{AllowPartial: true}.Unmarshal(dAtA[iNdEx:iNdEx+skippy], m) + if err != nil { + return err + } + iNdEx += skippy + } else { + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TestAllTypesProto2_MessageSetCorrectExtension1) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrectExtension1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrectExtension1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 25: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Str", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.Str = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TestAllTypesProto2_MessageSetCorrectExtension2) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrectExtension2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TestAllTypesProto2_MessageSetCorrectExtension2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field I", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.I = &v + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow } @@ -20688,252 +21377,13 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { iNdEx++ v |= int32(b&0x7F) << shift if b < 0x80 { - break - } - } - m.Field_Name9 = &v - case 410: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Field_Name10", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Field_Name10 = &v - case 411: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FIELD_NAME11", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FIELD_NAME11 = &v - case 412: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FIELDName12", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FIELDName12 = &v - case 413: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field XFieldName13", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.XFieldName13 = &v - case 414: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field X_FieldName14", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.X_FieldName14 = &v - case 415: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Field_Name15", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Field_Name15 = &v - case 416: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Field__Name16", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Field__Name16 = &v - case 417: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FieldName17__", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FieldName17__ = &v - case 418: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FieldName18__", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FieldName18__ = &v - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - if (fieldNum >= 120) && (fieldNum < 201) { - err = proto.UnmarshalOptions{AllowPartial: true}.Unmarshal(dAtA[iNdEx:iNdEx+skippy], m) - if err != nil { - return err - } - iNdEx += skippy - } else { - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ForeignMessageProto2) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - 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) - if wireType == 4 { - return fmt.Errorf("proto: ForeignMessageProto2: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ForeignMessageProto2: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + break + } + } + m.Field_Name9 = &v + case 410: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field C", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Field_Name10", wireType) } var v int32 for shift := uint(0); ; shift += 7 { @@ -20950,61 +21400,10 @@ func (m *ForeignMessageProto2) UnmarshalVT(dAtA []byte) error { break } } - m.C = &v - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ForeignMessageProto2) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - 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) - if wireType == 4 { - return fmt.Errorf("proto: ForeignMessageProto2: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ForeignMessageProto2: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + m.Field_Name10 = &v + case 411: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field C", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FIELD_NAME11", wireType) } var v int32 for shift := uint(0); ; shift += 7 { @@ -21021,61 +21420,10 @@ func (m *ForeignMessageProto2) UnmarshalVTUnsafe(dAtA []byte) error { break } } - m.C = &v - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UnknownToTestAllTypes_OptionalGroup) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - 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) - if wireType == 4 { - return fmt.Errorf("proto: UnknownToTestAllTypes_OptionalGroup: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UnknownToTestAllTypes_OptionalGroup: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + m.FIELD_NAME11 = &v + case 412: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field A", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FIELDName12", wireType) } var v int32 for shift := uint(0); ; shift += 7 { @@ -21092,61 +21440,50 @@ func (m *UnknownToTestAllTypes_OptionalGroup) UnmarshalVT(dAtA []byte) error { break } } - m.A = &v - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + m.FIELDName12 = &v + case 413: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field XFieldName13", wireType) } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UnknownToTestAllTypes) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - if iNdEx >= l { - return io.ErrUnexpectedEOF + m.XFieldName13 = &v + case 414: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field X_FieldName14", wireType) } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: UnknownToTestAllTypes: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UnknownToTestAllTypes: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1001: + m.X_FieldName14 = &v + case 415: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OptionalInt32", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Field_Name15", wireType) } var v int32 for shift := uint(0); ; shift += 7 { @@ -21163,12 +21500,12 @@ func (m *UnknownToTestAllTypes) UnmarshalVT(dAtA []byte) error { break } } - m.OptionalInt32 = &v - case 1002: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OptionalString", wireType) + m.Field_Name15 = &v + case 416: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Field__Name16", wireType) } - var stringLen uint64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -21178,30 +21515,37 @@ func (m *UnknownToTestAllTypes) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength + m.Field__Name16 = &v + case 417: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldName17__", wireType) } - if postIndex > l { - return io.ErrUnexpectedEOF + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - s := string(dAtA[iNdEx:postIndex]) - m.OptionalString = &s - iNdEx = postIndex - case 1003: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NestedMessage", wireType) + m.FieldName17__ = &v + case 418: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldName18__", wireType) } - var msglen int + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -21211,71 +21555,76 @@ func (m *UnknownToTestAllTypes) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLength + m.FieldName18__ = &v + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + msglen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLength } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - if m.NestedMessage == nil { - m.NestedMessage = &ForeignMessageProto2{} - } - if err := m.NestedMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 1004: - if wireType != 3 { - return fmt.Errorf("proto: wrong wireType = %d for field Optionalgroup", wireType) - } - groupStart := iNdEx - for { - maybeGroupEnd := iNdEx - var groupFieldWire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - groupFieldWire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - groupWireType := int(wire & 0x7) - if groupWireType == 4 { - if err := m.Optionalgroup.UnmarshalVT(dAtA[groupStart:maybeGroupEnd]); err != nil { - return err - } - break - } - skippy, err := skip(dAtA[iNdEx:]) + if (fieldNum >= 120) && (fieldNum < 201) { + err = proto.UnmarshalOptions{AllowPartial: true}.Unmarshal(dAtA[iNdEx:iNdEx+skippy], m) if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } + iNdEx += skippy + } else { + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } - case 1006: + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ForeignMessageProto2) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: ForeignMessageProto2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ForeignMessageProto2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OptionalBool", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field C", wireType) } - var v int + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -21285,89 +21634,12 @@ func (m *UnknownToTestAllTypes) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } - b := bool(v != 0) - m.OptionalBool = &b - case 1011: - if wireType == 0 { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.RepeatedInt32 = append(m.RepeatedInt32, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.RepeatedInt32) == 0 { - m.RepeatedInt32 = make([]int32, 0, elementCount) - } - for iNdEx < postIndex { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.RepeatedInt32 = append(m.RepeatedInt32, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field RepeatedInt32", wireType) - } + m.C = &v default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -21687,84 +21959,33 @@ func (m *UnknownToTestAllTypes) UnmarshalVTUnsafe(dAtA []byte) error { for _, integer := range dAtA[iNdEx:postIndex] { if integer < 128 { count++ - } - } - elementCount = count - if elementCount != 0 && len(m.RepeatedInt32) == 0 { - m.RepeatedInt32 = make([]int32, 0, elementCount) - } - for iNdEx < postIndex { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.RepeatedInt32 = append(m.RepeatedInt32, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field RepeatedInt32", wireType) - } - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NullHypothesisProto2) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + } + } + elementCount = count + if elementCount != 0 && len(m.RepeatedInt32) == 0 { + m.RepeatedInt32 = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedInt32 = append(m.RepeatedInt32, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedInt32", wireType) } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NullHypothesisProto2: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NullHypothesisProto2: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -21838,57 +22059,6 @@ func (m *NullHypothesisProto2) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *EnumOnlyProto2) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - 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) - if wireType == 4 { - return fmt.Errorf("proto: EnumOnlyProto2: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EnumOnlyProto2: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *EnumOnlyProto2) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -21940,90 +22110,6 @@ func (m *EnumOnlyProto2) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *OneStringProto2) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - 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) - if wireType == 4 { - return fmt.Errorf("proto: OneStringProto2: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: OneStringProto2: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Data = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *OneStringProto2) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -22109,91 +22195,6 @@ func (m *OneStringProto2) UnmarshalVTUnsafe(dAtA []byte) error { return nil } -func skip(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLength - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroup - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLength - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflow = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") -) - func unsafeBytesToString(b []byte) string { return *(*string)(unsafe.Pointer(&b)) } diff --git a/conformance/internal/conformance/test_messages_proto3_vtproto.pb.go b/conformance/internal/conformance/test_messages_proto3_vtproto.pb.go index 2b52ca4..3670eeb 100644 --- a/conformance/internal/conformance/test_messages_proto3_vtproto.pb.go +++ b/conformance/internal/conformance/test_messages_proto3_vtproto.pb.go @@ -14921,6 +14921,178 @@ func (m *TestAllTypesProto3) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *ForeignMessage) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: ForeignMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ForeignMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field C", wireType) + } + m.C = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.C |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NullHypothesisProto3) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: NullHypothesisProto3: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NullHypothesisProto3: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EnumOnlyProto3) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: EnumOnlyProto3: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EnumOnlyProto3: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *TestAllTypesProto3_NestedMessage) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -20776,16 +20948,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalBoolWrapper == nil { m.OptionalBoolWrapper = &wrapperspb.BoolValue{} } - if unmarshal, ok := interface{}(m.OptionalBoolWrapper).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalBoolWrapper); err != nil { - return err - } + if err := (*wrapperspb1.BoolValue)(m.OptionalBoolWrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 202: @@ -20820,16 +20984,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalInt32Wrapper == nil { m.OptionalInt32Wrapper = &wrapperspb.Int32Value{} } - if unmarshal, ok := interface{}(m.OptionalInt32Wrapper).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalInt32Wrapper); err != nil { - return err - } + if err := (*wrapperspb1.Int32Value)(m.OptionalInt32Wrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 203: @@ -20864,16 +21020,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalInt64Wrapper == nil { m.OptionalInt64Wrapper = &wrapperspb.Int64Value{} } - if unmarshal, ok := interface{}(m.OptionalInt64Wrapper).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalInt64Wrapper); err != nil { - return err - } + if err := (*wrapperspb1.Int64Value)(m.OptionalInt64Wrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 204: @@ -20908,16 +21056,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalUint32Wrapper == nil { m.OptionalUint32Wrapper = &wrapperspb.UInt32Value{} } - if unmarshal, ok := interface{}(m.OptionalUint32Wrapper).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalUint32Wrapper); err != nil { - return err - } + if err := (*wrapperspb1.UInt32Value)(m.OptionalUint32Wrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 205: @@ -20952,16 +21092,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalUint64Wrapper == nil { m.OptionalUint64Wrapper = &wrapperspb.UInt64Value{} } - if unmarshal, ok := interface{}(m.OptionalUint64Wrapper).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalUint64Wrapper); err != nil { - return err - } + if err := (*wrapperspb1.UInt64Value)(m.OptionalUint64Wrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 206: @@ -20996,16 +21128,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalFloatWrapper == nil { m.OptionalFloatWrapper = &wrapperspb.FloatValue{} } - if unmarshal, ok := interface{}(m.OptionalFloatWrapper).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalFloatWrapper); err != nil { - return err - } + if err := (*wrapperspb1.FloatValue)(m.OptionalFloatWrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 207: @@ -21040,16 +21164,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalDoubleWrapper == nil { m.OptionalDoubleWrapper = &wrapperspb.DoubleValue{} } - if unmarshal, ok := interface{}(m.OptionalDoubleWrapper).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalDoubleWrapper); err != nil { - return err - } + if err := (*wrapperspb1.DoubleValue)(m.OptionalDoubleWrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 208: @@ -21084,16 +21200,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalStringWrapper == nil { m.OptionalStringWrapper = &wrapperspb.StringValue{} } - if unmarshal, ok := interface{}(m.OptionalStringWrapper).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalStringWrapper); err != nil { - return err - } + if err := (*wrapperspb1.StringValue)(m.OptionalStringWrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 209: @@ -21128,16 +21236,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalBytesWrapper == nil { m.OptionalBytesWrapper = &wrapperspb.BytesValue{} } - if unmarshal, ok := interface{}(m.OptionalBytesWrapper).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalBytesWrapper); err != nil { - return err - } + if err := (*wrapperspb1.BytesValue)(m.OptionalBytesWrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 211: @@ -21170,16 +21270,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedBoolWrapper = append(m.RepeatedBoolWrapper, &wrapperspb.BoolValue{}) - if unmarshal, ok := interface{}(m.RepeatedBoolWrapper[len(m.RepeatedBoolWrapper)-1]).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedBoolWrapper[len(m.RepeatedBoolWrapper)-1]); err != nil { - return err - } + if err := (*wrapperspb1.BoolValue)(m.RepeatedBoolWrapper[len(m.RepeatedBoolWrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 212: @@ -21212,16 +21304,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedInt32Wrapper = append(m.RepeatedInt32Wrapper, &wrapperspb.Int32Value{}) - if unmarshal, ok := interface{}(m.RepeatedInt32Wrapper[len(m.RepeatedInt32Wrapper)-1]).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedInt32Wrapper[len(m.RepeatedInt32Wrapper)-1]); err != nil { - return err - } + if err := (*wrapperspb1.Int32Value)(m.RepeatedInt32Wrapper[len(m.RepeatedInt32Wrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 213: @@ -21254,16 +21338,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedInt64Wrapper = append(m.RepeatedInt64Wrapper, &wrapperspb.Int64Value{}) - if unmarshal, ok := interface{}(m.RepeatedInt64Wrapper[len(m.RepeatedInt64Wrapper)-1]).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedInt64Wrapper[len(m.RepeatedInt64Wrapper)-1]); err != nil { - return err - } + if err := (*wrapperspb1.Int64Value)(m.RepeatedInt64Wrapper[len(m.RepeatedInt64Wrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 214: @@ -21296,16 +21372,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedUint32Wrapper = append(m.RepeatedUint32Wrapper, &wrapperspb.UInt32Value{}) - if unmarshal, ok := interface{}(m.RepeatedUint32Wrapper[len(m.RepeatedUint32Wrapper)-1]).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedUint32Wrapper[len(m.RepeatedUint32Wrapper)-1]); err != nil { - return err - } + if err := (*wrapperspb1.UInt32Value)(m.RepeatedUint32Wrapper[len(m.RepeatedUint32Wrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 215: @@ -21338,16 +21406,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedUint64Wrapper = append(m.RepeatedUint64Wrapper, &wrapperspb.UInt64Value{}) - if unmarshal, ok := interface{}(m.RepeatedUint64Wrapper[len(m.RepeatedUint64Wrapper)-1]).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedUint64Wrapper[len(m.RepeatedUint64Wrapper)-1]); err != nil { - return err - } + if err := (*wrapperspb1.UInt64Value)(m.RepeatedUint64Wrapper[len(m.RepeatedUint64Wrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 216: @@ -21380,16 +21440,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedFloatWrapper = append(m.RepeatedFloatWrapper, &wrapperspb.FloatValue{}) - if unmarshal, ok := interface{}(m.RepeatedFloatWrapper[len(m.RepeatedFloatWrapper)-1]).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedFloatWrapper[len(m.RepeatedFloatWrapper)-1]); err != nil { - return err - } + if err := (*wrapperspb1.FloatValue)(m.RepeatedFloatWrapper[len(m.RepeatedFloatWrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 217: @@ -21422,16 +21474,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedDoubleWrapper = append(m.RepeatedDoubleWrapper, &wrapperspb.DoubleValue{}) - if unmarshal, ok := interface{}(m.RepeatedDoubleWrapper[len(m.RepeatedDoubleWrapper)-1]).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedDoubleWrapper[len(m.RepeatedDoubleWrapper)-1]); err != nil { - return err - } + if err := (*wrapperspb1.DoubleValue)(m.RepeatedDoubleWrapper[len(m.RepeatedDoubleWrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 218: @@ -21464,16 +21508,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedStringWrapper = append(m.RepeatedStringWrapper, &wrapperspb.StringValue{}) - if unmarshal, ok := interface{}(m.RepeatedStringWrapper[len(m.RepeatedStringWrapper)-1]).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedStringWrapper[len(m.RepeatedStringWrapper)-1]); err != nil { - return err - } + if err := (*wrapperspb1.StringValue)(m.RepeatedStringWrapper[len(m.RepeatedStringWrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 219: @@ -21506,16 +21542,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedBytesWrapper = append(m.RepeatedBytesWrapper, &wrapperspb.BytesValue{}) - if unmarshal, ok := interface{}(m.RepeatedBytesWrapper[len(m.RepeatedBytesWrapper)-1]).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedBytesWrapper[len(m.RepeatedBytesWrapper)-1]); err != nil { - return err - } + if err := (*wrapperspb1.BytesValue)(m.RepeatedBytesWrapper[len(m.RepeatedBytesWrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 301: @@ -21550,16 +21578,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalDuration == nil { m.OptionalDuration = &durationpb.Duration{} } - if unmarshal, ok := interface{}(m.OptionalDuration).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalDuration); err != nil { - return err - } + if err := (*durationpb1.Duration)(m.OptionalDuration).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 302: @@ -21594,16 +21614,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalTimestamp == nil { m.OptionalTimestamp = ×tamppb.Timestamp{} } - if unmarshal, ok := interface{}(m.OptionalTimestamp).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalTimestamp); err != nil { - return err - } + if err := (*timestamppb1.Timestamp)(m.OptionalTimestamp).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 303: @@ -21638,16 +21650,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalFieldMask == nil { m.OptionalFieldMask = &fieldmaskpb.FieldMask{} } - if unmarshal, ok := interface{}(m.OptionalFieldMask).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalFieldMask); err != nil { - return err - } + if err := (*fieldmaskpb1.FieldMask)(m.OptionalFieldMask).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 304: @@ -21726,16 +21730,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalAny == nil { m.OptionalAny = &anypb.Any{} } - if unmarshal, ok := interface{}(m.OptionalAny).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.OptionalAny); err != nil { - return err - } + if err := (*anypb1.Any)(m.OptionalAny).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 306: @@ -21831,16 +21827,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedDuration = append(m.RepeatedDuration, &durationpb.Duration{}) - if unmarshal, ok := interface{}(m.RepeatedDuration[len(m.RepeatedDuration)-1]).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedDuration[len(m.RepeatedDuration)-1]); err != nil { - return err - } + if err := (*durationpb1.Duration)(m.RepeatedDuration[len(m.RepeatedDuration)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 312: @@ -21873,16 +21861,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedTimestamp = append(m.RepeatedTimestamp, ×tamppb.Timestamp{}) - if unmarshal, ok := interface{}(m.RepeatedTimestamp[len(m.RepeatedTimestamp)-1]).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedTimestamp[len(m.RepeatedTimestamp)-1]); err != nil { - return err - } + if err := (*timestamppb1.Timestamp)(m.RepeatedTimestamp[len(m.RepeatedTimestamp)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 313: @@ -21915,16 +21895,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedFieldmask = append(m.RepeatedFieldmask, &fieldmaskpb.FieldMask{}) - if unmarshal, ok := interface{}(m.RepeatedFieldmask[len(m.RepeatedFieldmask)-1]).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedFieldmask[len(m.RepeatedFieldmask)-1]); err != nil { - return err - } + if err := (*fieldmaskpb1.FieldMask)(m.RepeatedFieldmask[len(m.RepeatedFieldmask)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 315: @@ -21957,16 +21929,8 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedAny = append(m.RepeatedAny, &anypb.Any{}) - if unmarshal, ok := interface{}(m.RepeatedAny[len(m.RepeatedAny)-1]).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.RepeatedAny[len(m.RepeatedAny)-1]); err != nil { - return err - } + if err := (*anypb1.Any)(m.RepeatedAny[len(m.RepeatedAny)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 316: @@ -22459,76 +22423,6 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *ForeignMessage) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - 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) - if wireType == 4 { - return fmt.Errorf("proto: ForeignMessage: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ForeignMessage: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field C", wireType) - } - m.C = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.C |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *ForeignMessage) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -22599,57 +22493,6 @@ func (m *ForeignMessage) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *NullHypothesisProto3) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - 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) - if wireType == 4 { - return fmt.Errorf("proto: NullHypothesisProto3: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NullHypothesisProto3: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *NullHypothesisProto3) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -22701,57 +22544,6 @@ func (m *NullHypothesisProto3) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *EnumOnlyProto3) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - 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) - if wireType == 4 { - return fmt.Errorf("proto: EnumOnlyProto3: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EnumOnlyProto3: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *EnumOnlyProto3) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/features/unmarshal/unmarshal.go b/features/unmarshal/unmarshal.go index 1c5e023..8a46603 100644 --- a/features/unmarshal/unmarshal.go +++ b/features/unmarshal/unmarshal.go @@ -21,11 +21,16 @@ func init() { generator.RegisterFeature("unmarshal", func(gen *generator.GeneratedFile) generator.FeatureGenerator { return &unmarshal{GeneratedFile: gen} }) + + generator.RegisterFeature("unmarshal_unsafe", func(gen *generator.GeneratedFile) generator.FeatureGenerator { + return &unmarshal{GeneratedFile: gen, unsafe: true} + }) } type unmarshal struct { *generator.GeneratedFile - once bool + unsafe bool + once bool } var _ generator.FeatureGenerator = (*unmarshal)(nil) @@ -33,8 +38,7 @@ var _ generator.FeatureGenerator = (*unmarshal)(nil) func (p *unmarshal) GenerateFile(file *protogen.File) bool { proto3 := file.Desc.Syntax() == protoreflect.Proto3 for _, message := range file.Messages { - p.message(proto3, message, false) - p.message(proto3, message, true) + p.message(proto3, message) } return p.once @@ -123,20 +127,23 @@ func (p *unmarshal) GenerateHelpers() { `}`) }) - p.P(` - var ( - ErrInvalidLength = `, p.Ident("fmt", "Errorf"), `("proto: negative length found during unmarshaling") - ErrIntOverflow = `, p.Ident("fmt", "Errorf"), `("proto: integer overflow") - ErrUnexpectedEndOfGroup = `, p.Ident("fmt", "Errorf"), `("proto: unexpected end of group") - ) - `) - - p.Helper("unsafeBytesToString", func(p *generator.GeneratedFile) { + p.Helper("err", func(p *generator.GeneratedFile) { p.P(` - func unsafeBytesToString(b []byte) string { - return *(*string)(`, p.Ident("unsafe", `Pointer`), `(&b)) - }`) + var ( + ErrInvalidLength = `, p.Ident("fmt", "Errorf"), `("proto: negative length found during unmarshaling") + ErrIntOverflow = `, p.Ident("fmt", "Errorf"), `("proto: integer overflow") + ErrUnexpectedEndOfGroup = `, p.Ident("fmt", "Errorf"), `("proto: unexpected end of group") + )`) }) + + if p.unsafe { + p.Helper("unsafeBytesToString", func(p *generator.GeneratedFile) { + p.P(` + func unsafeBytesToString(b []byte) string { + return *(*string)(`, p.Ident("unsafe", `Pointer`), `(&b)) + }`) + }) + } } func (p *unmarshal) decodeMessage(varName, buf string, message *protogen.Message) { @@ -350,7 +357,7 @@ func (p *unmarshal) noStarOrSliceType(field *protogen.Field) string { return typ } -func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message *protogen.Message, proto3 bool, unsafe bool) { +func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message *protogen.Message, proto3 bool) { repeated := field.Desc.Cardinality() == protoreflect.Repeated typ := p.noStarOrSliceType(field) oneof := field.Oneof != nil && !field.Oneof.Desc.IsSynthetic() @@ -499,7 +506,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * p.P(`return `, p.Ident("io", `ErrUnexpectedEOF`)) p.P(`}`) str := "string(dAtA[iNdEx:postIndex])" - if unsafe { + if p.unsafe { str = `unsafeBytesToString(dAtA[iNdEx:postIndex])` } if oneof { @@ -640,7 +647,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * p.P(`return `, p.Ident("io", `ErrUnexpectedEOF`)) p.P(`}`) if oneof { - if unsafe { + if p.unsafe { p.P(`v := dAtA[iNdEx:postIndex]`) } else { p.P(`v := make([]byte, postIndex-iNdEx)`) @@ -648,7 +655,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } p.P(`m.`, fieldname, ` = &`, field.GoIdent, "{", field.GoName, `: v}`) } else if repeated { - if unsafe { + if p.unsafe { p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, dAtA[iNdEx:postIndex])`) } else { p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, make([]byte, postIndex-iNdEx))`) @@ -761,7 +768,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } } -func (p *unmarshal) field(proto3, oneof bool, field *protogen.Field, message *protogen.Message, required protoreflect.FieldNumbers, unsafe bool) { +func (p *unmarshal) field(proto3, oneof bool, field *protogen.Field, message *protogen.Message, required protoreflect.FieldNumbers) { fieldname := field.GoName errFieldname := fieldname if field.Oneof != nil && !field.Oneof.Desc.IsSynthetic() { @@ -772,7 +779,7 @@ func (p *unmarshal) field(proto3, oneof bool, field *protogen.Field, message *pr wireType := generator.ProtoWireType(field.Desc.Kind()) if field.Desc.IsList() && wireType != protowire.BytesType { p.P(`if wireType == `, strconv.Itoa(int(wireType)), `{`) - p.fieldItem(field, fieldname, message, false, unsafe) + p.fieldItem(field, fieldname, message, false) p.P(`} else if wireType == `, strconv.Itoa(int(protowire.BytesType)), `{`) p.P(`var packedLen int`) p.decodeVarint("packedLen", "int") @@ -816,7 +823,7 @@ func (p *unmarshal) field(proto3, oneof bool, field *protogen.Field, message *pr p.P(`}`) p.P(`for iNdEx < postIndex {`) - p.fieldItem(field, fieldname, message, false, unsafe) + p.fieldItem(field, fieldname, message, false) p.P(`}`) p.P(`} else {`) p.P(`return `, p.Ident("fmt", "Errorf"), `("proto: wrong wireType = %d for field `, errFieldname, `", wireType)`) @@ -825,7 +832,7 @@ func (p *unmarshal) field(proto3, oneof bool, field *protogen.Field, message *pr p.P(`if wireType != `, strconv.Itoa(int(wireType)), `{`) p.P(`return `, p.Ident("fmt", "Errorf"), `("proto: wrong wireType = %d for field `, errFieldname, `", wireType)`) p.P(`}`) - p.fieldItem(field, fieldname, message, proto3, unsafe) + p.fieldItem(field, fieldname, message, proto3) } if field.Desc.Cardinality() == protoreflect.Required { @@ -842,9 +849,9 @@ func (p *unmarshal) field(proto3, oneof bool, field *protogen.Field, message *pr } } -func (p *unmarshal) message(proto3 bool, message *protogen.Message, unsafe bool) { +func (p *unmarshal) message(proto3 bool, message *protogen.Message) { for _, nested := range message.Messages { - p.message(proto3, nested, unsafe) + p.message(proto3, nested) } if message.Desc.IsMapEntry() { @@ -855,7 +862,7 @@ func (p *unmarshal) message(proto3 bool, message *protogen.Message, unsafe bool) ccTypeName := message.GoIdent.GoName required := message.Desc.RequiredNumbers() - if unsafe { + if p.unsafe { p.P(`func (m *`, ccTypeName, `) UnmarshalVTUnsafe(dAtA []byte) error {`) } else { p.P(`func (m *`, ccTypeName, `) UnmarshalVT(dAtA []byte) error {`) @@ -879,7 +886,7 @@ func (p *unmarshal) message(proto3 bool, message *protogen.Message, unsafe bool) p.P(`}`) p.P(`switch fieldNum {`) for _, field := range message.Fields { - p.field(proto3, false, field, message, required, unsafe) + p.field(proto3, false, field, message, required) } p.P(`default:`) p.P(`iNdEx=preIndex`) diff --git a/testproto/pool/pool_vtproto.pb.go b/testproto/pool/pool_vtproto.pb.go index 62d862b..7e327f8 100644 --- a/testproto/pool/pool_vtproto.pb.go +++ b/testproto/pool/pool_vtproto.pb.go @@ -307,6 +307,92 @@ func (m *MemoryPoolExtension) UnmarshalVT(dAtA []byte) error { } return nil } + +func skip(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLength + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroup + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLength + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflow = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") +) + func (m *MemoryPoolExtension) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -410,91 +496,6 @@ func (m *MemoryPoolExtension) UnmarshalVTUnsafe(dAtA []byte) error { return nil } -func skip(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLength - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroup - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLength - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflow = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") -) - func unsafeBytesToString(b []byte) string { return *(*string)(unsafe.Pointer(&b)) } diff --git a/testproto/pool/pool_with_slice_reuse_vtproto.pb.go b/testproto/pool/pool_with_slice_reuse_vtproto.pb.go index 31e98e6..546ec6f 100644 --- a/testproto/pool/pool_with_slice_reuse_vtproto.pb.go +++ b/testproto/pool/pool_with_slice_reuse_vtproto.pb.go @@ -873,89 +873,6 @@ func (m *Test1) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Test1) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - 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) - if wireType == 4 { - return fmt.Errorf("proto: Test1: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Test1: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sl", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sl = append(m.Sl, unsafeBytesToString(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *Test2) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1048,98 +965,6 @@ func (m *Test2) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Test2) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - 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) - if wireType == 4 { - return fmt.Errorf("proto: Test2: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Test2: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sl", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if len(m.Sl) == cap(m.Sl) { - m.Sl = append(m.Sl, &Slice2{}) - } else { - m.Sl = m.Sl[:len(m.Sl)+1] - if m.Sl[len(m.Sl)-1] == nil { - m.Sl[len(m.Sl)-1] = &Slice2{} - } - } - if err := m.Sl[len(m.Sl)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *Slice2) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1429,6 +1254,251 @@ func (m *Slice2) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *Element2) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Element2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Element2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field A", wireType) + } + m.A = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.A |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Test1) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Test1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Test1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sl = append(m.Sl, unsafeBytesToString(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Test2) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Test2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Test2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sl", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if len(m.Sl) == cap(m.Sl) { + m.Sl = append(m.Sl, &Slice2{}) + } else { + m.Sl = m.Sl[:len(m.Sl)+1] + if m.Sl[len(m.Sl)-1] == nil { + m.Sl[len(m.Sl)-1] = &Slice2{} + } + } + if err := m.Sl[len(m.Sl)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Slice2) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1718,76 +1788,6 @@ func (m *Slice2) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *Element2) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - 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) - if wireType == 4 { - return fmt.Errorf("proto: Element2: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Element2: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field A", wireType) - } - m.A = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.A |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *Element2) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/testproto/proto2/scalars_vtproto.pb.go b/testproto/proto2/scalars_vtproto.pb.go index 39fd9d5..72d18e3 100644 --- a/testproto/proto2/scalars_vtproto.pb.go +++ b/testproto/proto2/scalars_vtproto.pb.go @@ -3977,7 +3977,7 @@ func (m *DoubleMessage) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *DoubleMessage) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *FloatMessage) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -4001,46 +4001,46 @@ func (m *DoubleMessage) UnmarshalVTUnsafe(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DoubleMessage: wiretype end group for non-group") + return fmt.Errorf("proto: FloatMessage: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DoubleMessage: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: FloatMessage: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 1 { + if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v uint64 - if (iNdEx + 8) > l { + var v uint32 + if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) m.RequiredField = &v2 hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 1 { + if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v uint64 - if (iNdEx + 8) > l { + var v uint32 + if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) m.OptionalField = &v2 case 3: - if wireType == 1 { - var v uint64 - if (iNdEx + 8) > l { + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) m.RepeatedField = append(m.RepeatedField, v2) } else if wireType == 2 { var packedLen int @@ -4069,32 +4069,32 @@ func (m *DoubleMessage) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 8 + elementCount = packedLen / 4 if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]float64, 0, elementCount) + m.RepeatedField = make([]float32, 0, elementCount) } for iNdEx < postIndex { - var v uint64 - if (iNdEx + 8) > l { + var v uint32 + if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) m.RepeatedField = append(m.RepeatedField, v2) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 1 { - var v uint64 - if (iNdEx + 8) > l { + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) m.PackedField = append(m.PackedField, v2) } else if wireType == 2 { var packedLen int @@ -4123,18 +4123,18 @@ func (m *DoubleMessage) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 8 + elementCount = packedLen / 4 if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]float64, 0, elementCount) + m.PackedField = make([]float32, 0, elementCount) } for iNdEx < postIndex { - var v uint64 - if (iNdEx + 8) > l { + var v uint32 + if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) m.PackedField = append(m.PackedField, v2) } } else { @@ -4165,7 +4165,7 @@ func (m *DoubleMessage) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *FloatMessage) UnmarshalVT(dAtA []byte) error { +func (m *Int32Message) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -4189,47 +4189,71 @@ func (m *FloatMessage) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: FloatMessage: wiretype end group for non-group") + return fmt.Errorf("proto: Int32Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: FloatMessage: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Int32Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 5 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) - m.RequiredField = &v2 + m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 5 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) - m.OptionalField = &v2 + m.OptionalField = &v case 3: - if wireType == 5 { - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) - m.RepeatedField = append(m.RepeatedField, v2) + m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -4257,33 +4281,55 @@ func (m *FloatMessage) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 4 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]float32, 0, elementCount) + m.RepeatedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) - m.RepeatedField = append(m.RepeatedField, v2) + m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 5 { - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) - m.PackedField = append(m.PackedField, v2) + m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -4311,19 +4357,33 @@ func (m *FloatMessage) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 4 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]float32, 0, elementCount) + m.PackedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) - m.PackedField = append(m.PackedField, v2) + m.PackedField = append(m.PackedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) @@ -4353,7 +4413,7 @@ func (m *FloatMessage) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *FloatMessage) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *Int64Message) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -4377,47 +4437,71 @@ func (m *FloatMessage) UnmarshalVTUnsafe(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: FloatMessage: wiretype end group for non-group") + return fmt.Errorf("proto: Int64Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: FloatMessage: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Int64Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 5 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) - m.RequiredField = &v2 + m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 5 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) - m.OptionalField = &v2 + m.OptionalField = &v case 3: - if wireType == 5 { - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) - m.RepeatedField = append(m.RepeatedField, v2) + m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -4445,33 +4529,55 @@ func (m *FloatMessage) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 4 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]float32, 0, elementCount) + m.RepeatedField = make([]int64, 0, elementCount) } for iNdEx < postIndex { - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) - m.RepeatedField = append(m.RepeatedField, v2) + m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 5 { - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) - m.PackedField = append(m.PackedField, v2) + m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -4499,19 +4605,33 @@ func (m *FloatMessage) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 4 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]float32, 0, elementCount) + m.PackedField = make([]int64, 0, elementCount) } for iNdEx < postIndex { - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - v2 := float32(math.Float32frombits(v)) - m.PackedField = append(m.PackedField, v2) + m.PackedField = append(m.PackedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) @@ -4541,7 +4661,7 @@ func (m *FloatMessage) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *Int32Message) UnmarshalVT(dAtA []byte) error { +func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -4565,17 +4685,17 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Int32Message: wiretype end group for non-group") + return fmt.Errorf("proto: Uint32Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Int32Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Uint32Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int32 + var v uint32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4585,7 +4705,7 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -4596,7 +4716,7 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int32 + var v uint32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4606,7 +4726,7 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -4614,7 +4734,7 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { m.OptionalField = &v case 3: if wireType == 0 { - var v int32 + var v uint32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4624,7 +4744,7 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -4665,10 +4785,10 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { } elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]int32, 0, elementCount) + m.RepeatedField = make([]uint32, 0, elementCount) } for iNdEx < postIndex { - var v int32 + var v uint32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4678,7 +4798,7 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -4690,7 +4810,7 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { } case 4: if wireType == 0 { - var v int32 + var v uint32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4700,7 +4820,7 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -4741,10 +4861,10 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { } elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]int32, 0, elementCount) + m.PackedField = make([]uint32, 0, elementCount) } for iNdEx < postIndex { - var v int32 + var v uint32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4754,7 +4874,7 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -4789,7 +4909,7 @@ func (m *Int32Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Int32Message) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -4813,17 +4933,17 @@ func (m *Int32Message) UnmarshalVTUnsafe(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Int32Message: wiretype end group for non-group") + return fmt.Errorf("proto: Uint64Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Int32Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Uint64Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int32 + var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4833,7 +4953,7 @@ func (m *Int32Message) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -4844,7 +4964,7 @@ func (m *Int32Message) UnmarshalVTUnsafe(dAtA []byte) error { if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int32 + var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4854,7 +4974,7 @@ func (m *Int32Message) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -4862,7 +4982,7 @@ func (m *Int32Message) UnmarshalVTUnsafe(dAtA []byte) error { m.OptionalField = &v case 3: if wireType == 0 { - var v int32 + var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4872,7 +4992,7 @@ func (m *Int32Message) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -4913,10 +5033,10 @@ func (m *Int32Message) UnmarshalVTUnsafe(dAtA []byte) error { } elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]int32, 0, elementCount) + m.RepeatedField = make([]uint64, 0, elementCount) } for iNdEx < postIndex { - var v int32 + var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4926,7 +5046,7 @@ func (m *Int32Message) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -4938,7 +5058,7 @@ func (m *Int32Message) UnmarshalVTUnsafe(dAtA []byte) error { } case 4: if wireType == 0 { - var v int32 + var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4948,7 +5068,7 @@ func (m *Int32Message) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -4989,10 +5109,10 @@ func (m *Int32Message) UnmarshalVTUnsafe(dAtA []byte) error { } elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]int32, 0, elementCount) + m.PackedField = make([]uint64, 0, elementCount) } for iNdEx < postIndex { - var v int32 + var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5002,7 +5122,7 @@ func (m *Int32Message) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -5037,7 +5157,7 @@ func (m *Int32Message) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *Int64Message) UnmarshalVT(dAtA []byte) error { +func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -5061,17 +5181,17 @@ func (m *Int64Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Int64Message: wiretype end group for non-group") + return fmt.Errorf("proto: Sint32Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Int64Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Sint32Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5081,18 +5201,19 @@ func (m *Int64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5102,15 +5223,16 @@ func (m *Int64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.OptionalField = &v case 3: if wireType == 0 { - var v int64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5120,11 +5242,12 @@ func (m *Int64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int @@ -5161,10 +5284,10 @@ func (m *Int64Message) UnmarshalVT(dAtA []byte) error { } elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]int64, 0, elementCount) + m.RepeatedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { - var v int64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5174,11 +5297,12 @@ func (m *Int64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.RepeatedField = append(m.RepeatedField, v) } } else { @@ -5186,7 +5310,7 @@ func (m *Int64Message) UnmarshalVT(dAtA []byte) error { } case 4: if wireType == 0 { - var v int64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5196,11 +5320,12 @@ func (m *Int64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int @@ -5237,10 +5362,10 @@ func (m *Int64Message) UnmarshalVT(dAtA []byte) error { } elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]int64, 0, elementCount) + m.PackedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { - var v int64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5250,11 +5375,12 @@ func (m *Int64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.PackedField = append(m.PackedField, v) } } else { @@ -5285,7 +5411,7 @@ func (m *Int64Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Int64Message) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -5309,17 +5435,17 @@ func (m *Int64Message) UnmarshalVTUnsafe(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Int64Message: wiretype end group for non-group") + return fmt.Errorf("proto: Sint64Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Int64Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Sint64Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int64 + var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5329,18 +5455,20 @@ func (m *Int64Message) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } } - m.RequiredField = &v + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + v2 := int64(v) + m.RequiredField = &v2 hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int64 + var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5350,15 +5478,17 @@ func (m *Int64Message) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } } - m.OptionalField = &v + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + v2 := int64(v) + m.OptionalField = &v2 case 3: if wireType == 0 { - var v int64 + var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5368,12 +5498,13 @@ func (m *Int64Message) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } } - m.RepeatedField = append(m.RepeatedField, v) + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.RepeatedField = append(m.RepeatedField, int64(v)) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -5412,7 +5543,7 @@ func (m *Int64Message) UnmarshalVTUnsafe(dAtA []byte) error { m.RepeatedField = make([]int64, 0, elementCount) } for iNdEx < postIndex { - var v int64 + var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5422,19 +5553,20 @@ func (m *Int64Message) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } } - m.RepeatedField = append(m.RepeatedField, v) + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.RepeatedField = append(m.RepeatedField, int64(v)) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: if wireType == 0 { - var v int64 + var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5444,12 +5576,13 @@ func (m *Int64Message) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } } - m.PackedField = append(m.PackedField, v) + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.PackedField = append(m.PackedField, int64(v)) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -5488,7 +5621,7 @@ func (m *Int64Message) UnmarshalVTUnsafe(dAtA []byte) error { m.PackedField = make([]int64, 0, elementCount) } for iNdEx < postIndex { - var v int64 + var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5498,12 +5631,13 @@ func (m *Int64Message) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } } - m.PackedField = append(m.PackedField, v) + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.PackedField = append(m.PackedField, int64(v)) } } else { return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) @@ -5533,7 +5667,7 @@ func (m *Int64Message) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { +func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -5557,70 +5691,43 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Uint32Message: wiretype end group for non-group") + return fmt.Errorf("proto: Fixed32Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Uint32Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Fixed32Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 0 { + if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.OptionalField = &v case 3: - if wireType == 0 { + if wireType == 5 { var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int @@ -5649,54 +5756,30 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count + elementCount = packedLen / 4 if elementCount != 0 && len(m.RepeatedField) == 0 { m.RepeatedField = make([]uint32, 0, elementCount) } for iNdEx < postIndex { var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 0 { + if wireType == 5 { var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int @@ -5725,32 +5808,17 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count + elementCount = packedLen / 4 if elementCount != 0 && len(m.PackedField) == 0 { m.PackedField = make([]uint32, 0, elementCount) } for iNdEx < postIndex { var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.PackedField = append(m.PackedField, v) } } else { @@ -5781,7 +5849,7 @@ func (m *Uint32Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Uint32Message) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *Fixed64Message) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -5805,56 +5873,46 @@ func (m *Uint32Message) UnmarshalVTUnsafe(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Uint32Message: wiretype end group for non-group") + return fmt.Errorf("proto: Fixed64Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Uint32Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Fixed64Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 0 { + if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 m.OptionalField = &v case 3: - if wireType == 0 { - var v uint32 + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedField = append(m.RepeatedField, v) + } else if wireType == 2 { + var packedLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -5864,24 +5922,7 @@ func (m *Uint32Message) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.RepeatedField = append(m.RepeatedField, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift + packedLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -5897,54 +5938,30 @@ func (m *Uint32Message) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count + elementCount = packedLen / 8 if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]uint32, 0, elementCount) + m.RepeatedField = make([]uint64, 0, elementCount) } for iNdEx < postIndex { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 0 { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int @@ -5973,32 +5990,17 @@ func (m *Uint32Message) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count + elementCount = packedLen / 8 if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]uint32, 0, elementCount) + m.PackedField = make([]uint64, 0, elementCount) } for iNdEx < postIndex { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 m.PackedField = append(m.PackedField, v) } } else { @@ -6029,7 +6031,7 @@ func (m *Uint32Message) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { +func (m *Sfixed32Message) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -6053,70 +6055,43 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Uint64Message: wiretype end group for non-group") + return fmt.Errorf("proto: Sfixed32Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Uint64Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Sfixed32Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 0 { + if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.OptionalField = &v case 3: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + if wireType == 5 { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int @@ -6145,54 +6120,30 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count + elementCount = packedLen / 4 if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]uint64, 0, elementCount) + m.RepeatedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + if wireType == 5 { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int @@ -6221,32 +6172,17 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count + elementCount = packedLen / 4 if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]uint64, 0, elementCount) + m.PackedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.PackedField = append(m.PackedField, v) } } else { @@ -6277,7 +6213,7 @@ func (m *Uint64Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Uint64Message) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *Sfixed64Message) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -6301,70 +6237,43 @@ func (m *Uint64Message) UnmarshalVTUnsafe(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Uint64Message: wiretype end group for non-group") + return fmt.Errorf("proto: Sfixed64Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Uint64Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Sfixed64Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 0 { + if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 m.OptionalField = &v case 3: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + if wireType == 1 { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int @@ -6393,54 +6302,30 @@ func (m *Uint64Message) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count + elementCount = packedLen / 8 if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]uint64, 0, elementCount) + m.RepeatedField = make([]int64, 0, elementCount) } for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + if wireType == 1 { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int @@ -6469,32 +6354,17 @@ func (m *Uint64Message) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count + elementCount = packedLen / 8 if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]uint64, 0, elementCount) + m.PackedField = make([]int64, 0, elementCount) } for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 m.PackedField = append(m.PackedField, v) } } else { @@ -6525,7 +6395,7 @@ func (m *Uint64Message) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { +func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -6549,17 +6419,17 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Sint32Message: wiretype end group for non-group") + return fmt.Errorf("proto: BoolMessage: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Sint32Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: BoolMessage: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int32 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6569,19 +6439,19 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) - m.RequiredField = &v + b := bool(v != 0) + m.RequiredField = &b hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int32 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6591,16 +6461,16 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) - m.OptionalField = &v + b := bool(v != 0) + m.OptionalField = &b case 3: if wireType == 0 { - var v int32 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6610,13 +6480,12 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) - m.RepeatedField = append(m.RepeatedField, v) + m.RepeatedField = append(m.RepeatedField, bool(v != 0)) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -6644,18 +6513,12 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count + elementCount = packedLen if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]int32, 0, elementCount) + m.RepeatedField = make([]bool, 0, elementCount) } for iNdEx < postIndex { - var v int32 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6665,20 +6528,19 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) - m.RepeatedField = append(m.RepeatedField, v) + m.RepeatedField = append(m.RepeatedField, bool(v != 0)) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: if wireType == 0 { - var v int32 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6688,13 +6550,12 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) - m.PackedField = append(m.PackedField, v) + m.PackedField = append(m.PackedField, bool(v != 0)) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -6722,18 +6583,12 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count + elementCount = packedLen if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]int32, 0, elementCount) + m.PackedField = make([]bool, 0, elementCount) } for iNdEx < postIndex { - var v int32 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6743,13 +6598,12 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) - m.PackedField = append(m.PackedField, v) + m.PackedField = append(m.PackedField, bool(v != 0)) } } else { return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) @@ -6779,7 +6633,7 @@ func (m *Sint32Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Sint32Message) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *StringMessage) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -6803,17 +6657,17 @@ func (m *Sint32Message) UnmarshalVTUnsafe(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Sint32Message: wiretype end group for non-group") + return fmt.Errorf("proto: StringMessage: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Sint32Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: StringMessage: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int32 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6823,19 +6677,31 @@ func (m *Sint32Message) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) - m.RequiredField = &v + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.RequiredField = &s + iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int32 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -6845,169 +6711,213 @@ func (m *Sint32Message) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int32(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) - m.OptionalField = &v + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.OptionalField = &s + iNdEx = postIndex case 3: - if wireType == 0 { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) - m.RepeatedField = append(m.RepeatedField, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } + if iNdEx >= l { + return io.ErrUnexpectedEOF } - if packedLen < 0 { - return ErrInvalidLength + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLength + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedField = append(m.RepeatedField, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return fmt.Errorf("proto: required field required_field not set") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BytesMessage) UnmarshalVT(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: BytesMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BytesMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow } - if postIndex > l { + if iNdEx >= l { return io.ErrUnexpectedEOF } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]int32, 0, elementCount) - } - for iNdEx < postIndex { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) - m.RepeatedField = append(m.RepeatedField, v) + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } - case 4: - if wireType == 0 { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequiredField = append(m.RequiredField[:0], dAtA[iNdEx:postIndex]...) + if m.RequiredField == nil { + m.RequiredField = []byte{} + } + iNdEx = postIndex + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) - m.PackedField = append(m.PackedField, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } + if iNdEx >= l { + return io.ErrUnexpectedEOF } - if packedLen < 0 { - return ErrInvalidLength + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLength + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OptionalField = append(m.OptionalField[:0], dAtA[iNdEx:postIndex]...) + if m.OptionalField == nil { + m.OptionalField = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow } - if postIndex > l { + if iNdEx >= l { return io.ErrUnexpectedEOF } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]int32, 0, elementCount) - } - for iNdEx < postIndex { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) - m.PackedField = append(m.PackedField, v) + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedField = append(m.RepeatedField, make([]byte, postIndex-iNdEx)) + copy(m.RepeatedField[len(m.RepeatedField)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -7033,7 +6943,7 @@ func (m *Sint32Message) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { +func (m *EnumMessage) UnmarshalVT(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -7057,17 +6967,17 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Sint64Message: wiretype end group for non-group") + return fmt.Errorf("proto: EnumMessage: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Sint64Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EnumMessage: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v uint64 + var v EnumMessage_Num for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -7077,20 +6987,18 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= EnumMessage_Num(b&0x7F) << shift if b < 0x80 { break } } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - v2 := int64(v) - m.RequiredField = &v2 + m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v uint64 + var v EnumMessage_Num for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -7100,17 +7008,15 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= EnumMessage_Num(b&0x7F) << shift if b < 0x80 { break } } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - v2 := int64(v) - m.OptionalField = &v2 + m.OptionalField = &v case 3: if wireType == 0 { - var v uint64 + var v EnumMessage_Num for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -7120,13 +7026,12 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= EnumMessage_Num(b&0x7F) << shift if b < 0x80 { break } } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.RepeatedField = append(m.RepeatedField, int64(v)) + m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -7154,18 +7059,11 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]int64, 0, elementCount) + m.RepeatedField = make([]EnumMessage_Num, 0, elementCount) } for iNdEx < postIndex { - var v uint64 + var v EnumMessage_Num for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -7175,20 +7073,19 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= EnumMessage_Num(b&0x7F) << shift if b < 0x80 { break } } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.RepeatedField = append(m.RepeatedField, int64(v)) + m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: if wireType == 0 { - var v uint64 + var v EnumMessage_Num for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -7198,13 +7095,12 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= EnumMessage_Num(b&0x7F) << shift if b < 0x80 { break } } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.PackedField = append(m.PackedField, int64(v)) + m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -7232,18 +7128,11 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]int64, 0, elementCount) + m.PackedField = make([]EnumMessage_Num, 0, elementCount) } for iNdEx < postIndex { - var v uint64 + var v EnumMessage_Num for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -7253,13 +7142,12 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= EnumMessage_Num(b&0x7F) << shift if b < 0x80 { break } } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.PackedField = append(m.PackedField, int64(v)) + m.PackedField = append(m.PackedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) @@ -7287,9 +7175,95 @@ func (m *Sint64Message) UnmarshalVT(dAtA []byte) error { if iNdEx > l { return io.ErrUnexpectedEOF } - return nil + return nil +} + +func skip(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLength + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroup + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLength + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF } -func (m *Sint64Message) UnmarshalVTUnsafe(dAtA []byte) error { + +var ( + ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflow = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") +) + +func (m *DoubleMessage) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -7313,76 +7287,47 @@ func (m *Sint64Message) UnmarshalVTUnsafe(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Sint64Message: wiretype end group for non-group") + return fmt.Errorf("proto: DoubleMessage: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Sint64Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DoubleMessage: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - v2 := int64(v) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) m.RequiredField = &v2 hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 0 { + if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - v2 := int64(v) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) m.OptionalField = &v2 case 3: - if wireType == 0 { + if wireType == 1 { var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.RepeatedField = append(m.RepeatedField, int64(v)) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.RepeatedField = append(m.RepeatedField, v2) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -7410,57 +7355,33 @@ func (m *Sint64Message) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count + elementCount = packedLen / 8 if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]int64, 0, elementCount) + m.RepeatedField = make([]float64, 0, elementCount) } for iNdEx < postIndex { var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.RepeatedField = append(m.RepeatedField, int64(v)) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.RepeatedField = append(m.RepeatedField, v2) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 0 { + if wireType == 1 { var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.PackedField = append(m.PackedField, int64(v)) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.PackedField = append(m.PackedField, v2) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -7488,34 +7409,19 @@ func (m *Sint64Message) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count + elementCount = packedLen / 8 if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]int64, 0, elementCount) + m.PackedField = make([]float64, 0, elementCount) } for iNdEx < postIndex { var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.PackedField = append(m.PackedField, int64(v)) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.PackedField = append(m.PackedField, v2) } } else { return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) @@ -7545,7 +7451,7 @@ func (m *Sint64Message) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { +func (m *FloatMessage) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -7569,10 +7475,10 @@ func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Fixed32Message: wiretype end group for non-group") + return fmt.Errorf("proto: FloatMessage: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Fixed32Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: FloatMessage: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -7585,7 +7491,8 @@ func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { } v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 - m.RequiredField = &v + v2 := float32(math.Float32frombits(v)) + m.RequiredField = &v2 hasFields[0] |= uint64(0x00000001) case 2: if wireType != 5 { @@ -7597,7 +7504,8 @@ func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { } v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 - m.OptionalField = &v + v2 := float32(math.Float32frombits(v)) + m.OptionalField = &v2 case 3: if wireType == 5 { var v uint32 @@ -7606,7 +7514,8 @@ func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { } v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 - m.RepeatedField = append(m.RepeatedField, v) + v2 := float32(math.Float32frombits(v)) + m.RepeatedField = append(m.RepeatedField, v2) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -7636,7 +7545,7 @@ func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { var elementCount int elementCount = packedLen / 4 if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]uint32, 0, elementCount) + m.RepeatedField = make([]float32, 0, elementCount) } for iNdEx < postIndex { var v uint32 @@ -7645,7 +7554,8 @@ func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { } v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 - m.RepeatedField = append(m.RepeatedField, v) + v2 := float32(math.Float32frombits(v)) + m.RepeatedField = append(m.RepeatedField, v2) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) @@ -7658,7 +7568,8 @@ func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { } v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 - m.PackedField = append(m.PackedField, v) + v2 := float32(math.Float32frombits(v)) + m.PackedField = append(m.PackedField, v2) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -7688,7 +7599,7 @@ func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { var elementCount int elementCount = packedLen / 4 if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]uint32, 0, elementCount) + m.PackedField = make([]float32, 0, elementCount) } for iNdEx < postIndex { var v uint32 @@ -7697,7 +7608,8 @@ func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { } v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 - m.PackedField = append(m.PackedField, v) + v2 := float32(math.Float32frombits(v)) + m.PackedField = append(m.PackedField, v2) } } else { return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) @@ -7727,7 +7639,7 @@ func (m *Fixed32Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Fixed32Message) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *Int32Message) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -7751,43 +7663,70 @@ func (m *Fixed32Message) UnmarshalVTUnsafe(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Fixed32Message: wiretype end group for non-group") + return fmt.Errorf("proto: Int32Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Fixed32Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Int32Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 5 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 5 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.OptionalField = &v case 3: - if wireType == 5 { - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int @@ -7816,30 +7755,54 @@ func (m *Fixed32Message) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 4 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]uint32, 0, elementCount) + m.RepeatedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 5 { - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int @@ -7868,17 +7831,32 @@ func (m *Fixed32Message) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 4 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]uint32, 0, elementCount) + m.PackedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.PackedField = append(m.PackedField, v) } } else { @@ -7909,7 +7887,7 @@ func (m *Fixed32Message) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *Fixed64Message) UnmarshalVT(dAtA []byte) error { +func (m *Int64Message) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -7933,43 +7911,70 @@ func (m *Fixed64Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Fixed64Message: wiretype end group for non-group") + return fmt.Errorf("proto: Int64Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Fixed64Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Int64Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 1 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 1 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.OptionalField = &v case 3: - if wireType == 1 { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int @@ -7998,30 +8003,54 @@ func (m *Fixed64Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 8 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]uint64, 0, elementCount) + m.RepeatedField = make([]int64, 0, elementCount) } for iNdEx < postIndex { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 1 { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int @@ -8050,17 +8079,32 @@ func (m *Fixed64Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 8 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]uint64, 0, elementCount) + m.PackedField = make([]int64, 0, elementCount) } for iNdEx < postIndex { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.PackedField = append(m.PackedField, v) } } else { @@ -8091,7 +8135,7 @@ func (m *Fixed64Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Fixed64Message) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *Uint32Message) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -8115,43 +8159,70 @@ func (m *Fixed64Message) UnmarshalVTUnsafe(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Fixed64Message: wiretype end group for non-group") + return fmt.Errorf("proto: Uint32Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Fixed64Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Uint32Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 1 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 1 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.OptionalField = &v case 3: - if wireType == 1 { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int @@ -8180,30 +8251,54 @@ func (m *Fixed64Message) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 8 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]uint64, 0, elementCount) + m.RepeatedField = make([]uint32, 0, elementCount) } for iNdEx < postIndex { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 1 { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int @@ -8232,17 +8327,32 @@ func (m *Fixed64Message) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 8 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]uint64, 0, elementCount) + m.PackedField = make([]uint32, 0, elementCount) } for iNdEx < postIndex { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 m.PackedField = append(m.PackedField, v) } } else { @@ -8273,7 +8383,7 @@ func (m *Fixed64Message) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *Sfixed32Message) UnmarshalVT(dAtA []byte) error { +func (m *Uint64Message) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -8297,43 +8407,70 @@ func (m *Sfixed32Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Sfixed32Message: wiretype end group for non-group") + return fmt.Errorf("proto: Uint64Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Sfixed32Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Uint64Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 5 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 5 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.OptionalField = &v case 3: - if wireType == 5 { - var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int @@ -8362,30 +8499,54 @@ func (m *Sfixed32Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 4 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]int32, 0, elementCount) + m.RepeatedField = make([]uint64, 0, elementCount) } for iNdEx < postIndex { - var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 5 { - var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int @@ -8414,17 +8575,32 @@ func (m *Sfixed32Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 4 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]int32, 0, elementCount) + m.PackedField = make([]uint64, 0, elementCount) } for iNdEx < postIndex { - var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 m.PackedField = append(m.PackedField, v) } } else { @@ -8455,7 +8631,7 @@ func (m *Sfixed32Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Sfixed32Message) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *Sint32Message) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -8479,43 +8655,73 @@ func (m *Sfixed32Message) UnmarshalVTUnsafe(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Sfixed32Message: wiretype end group for non-group") + return fmt.Errorf("proto: Sint32Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Sfixed32Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Sint32Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 5 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 5 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.OptionalField = &v case 3: - if wireType == 5 { + if wireType == 0 { var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int @@ -8544,30 +8750,56 @@ func (m *Sfixed32Message) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 4 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { m.RepeatedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 5 { + if wireType == 0 { var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int @@ -8596,17 +8828,33 @@ func (m *Sfixed32Message) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 4 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { m.PackedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { var v int32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.PackedField = append(m.PackedField, v) } } else { @@ -8637,7 +8885,7 @@ func (m *Sfixed32Message) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *Sfixed64Message) UnmarshalVT(dAtA []byte) error { +func (m *Sint64Message) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -8661,44 +8909,76 @@ func (m *Sfixed64Message) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Sfixed64Message: wiretype end group for non-group") + return fmt.Errorf("proto: Sint64Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Sfixed64Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Sint64Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 1 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.RequiredField = &v + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + v2 := int64(v) + m.RequiredField = &v2 hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 1 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.OptionalField = &v + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + v2 := int64(v) + m.OptionalField = &v2 case 3: - if wireType == 1 { - var v int64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.RepeatedField = append(m.RepeatedField, v) + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.RepeatedField = append(m.RepeatedField, int64(v)) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -8726,31 +9006,57 @@ func (m *Sfixed64Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 8 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.RepeatedField) == 0 { m.RepeatedField = make([]int64, 0, elementCount) } for iNdEx < postIndex { - var v int64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.RepeatedField = append(m.RepeatedField, v) + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.RepeatedField = append(m.RepeatedField, int64(v)) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 1 { - var v int64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.PackedField = append(m.PackedField, v) + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.PackedField = append(m.PackedField, int64(v)) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -8778,18 +9084,34 @@ func (m *Sfixed64Message) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 8 + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count if elementCount != 0 && len(m.PackedField) == 0 { m.PackedField = make([]int64, 0, elementCount) } for iNdEx < postIndex { - var v int64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.PackedField = append(m.PackedField, v) + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.PackedField = append(m.PackedField, int64(v)) } } else { return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) @@ -8819,7 +9141,7 @@ func (m *Sfixed64Message) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *Sfixed64Message) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *Fixed32Message) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -8843,43 +9165,43 @@ func (m *Sfixed64Message) UnmarshalVTUnsafe(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Sfixed64Message: wiretype end group for non-group") + return fmt.Errorf("proto: Fixed32Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Sfixed64Message: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Fixed32Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 1 { + if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int64 - if (iNdEx + 8) > l { + var v uint32 + if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 1 { + if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int64 - if (iNdEx + 8) > l { + var v uint32 + if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.OptionalField = &v case 3: - if wireType == 1 { - var v int64 - if (iNdEx + 8) > l { + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int @@ -8908,30 +9230,30 @@ func (m *Sfixed64Message) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 8 + elementCount = packedLen / 4 if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]int64, 0, elementCount) + m.RepeatedField = make([]uint32, 0, elementCount) } for iNdEx < postIndex { - var v int64 - if (iNdEx + 8) > l { + var v uint32 + if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 1 { - var v int64 - if (iNdEx + 8) > l { + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int @@ -8960,17 +9282,17 @@ func (m *Sfixed64Message) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen / 8 + elementCount = packedLen / 4 if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]int64, 0, elementCount) + m.PackedField = make([]uint32, 0, elementCount) } for iNdEx < postIndex { - var v int64 - if (iNdEx + 8) > l { + var v uint32 + if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } - v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 m.PackedField = append(m.PackedField, v) } } else { @@ -9001,7 +9323,7 @@ func (m *Sfixed64Message) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { +func (m *Fixed64Message) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -9025,73 +9347,44 @@ func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: BoolMessage: wiretype end group for non-group") + return fmt.Errorf("proto: Fixed64Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: BoolMessage: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Fixed64Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } - b := bool(v != 0) - m.RequiredField = &b + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 0 { + if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } - b := bool(v != 0) - m.OptionalField = &b + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.OptionalField = &v case 3: - if wireType == 0 { - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } - m.RepeatedField = append(m.RepeatedField, bool(v != 0)) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -9119,49 +9412,31 @@ func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen + elementCount = packedLen / 8 if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]bool, 0, elementCount) + m.RepeatedField = make([]uint64, 0, elementCount) } for iNdEx < postIndex { - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } - m.RepeatedField = append(m.RepeatedField, bool(v != 0)) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 0 { - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } - m.PackedField = append(m.PackedField, bool(v != 0)) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -9189,27 +9464,18 @@ func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen + elementCount = packedLen / 8 if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]bool, 0, elementCount) + m.PackedField = make([]uint64, 0, elementCount) } for iNdEx < postIndex { - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } - m.PackedField = append(m.PackedField, bool(v != 0)) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedField = append(m.PackedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) @@ -9239,7 +9505,7 @@ func (m *BoolMessage) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *BoolMessage) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *Sfixed32Message) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -9263,73 +9529,44 @@ func (m *BoolMessage) UnmarshalVTUnsafe(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: BoolMessage: wiretype end group for non-group") + return fmt.Errorf("proto: Sfixed32Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: BoolMessage: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Sfixed32Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - b := bool(v != 0) - m.RequiredField = &b + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 0 { + if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - b := bool(v != 0) - m.OptionalField = &b + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.OptionalField = &v case 3: - if wireType == 0 { - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } + if wireType == 5 { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - m.RepeatedField = append(m.RepeatedField, bool(v != 0)) + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedField = append(m.RepeatedField, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -9357,49 +9594,31 @@ func (m *BoolMessage) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen + elementCount = packedLen / 4 if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]bool, 0, elementCount) + m.RepeatedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - m.RepeatedField = append(m.RepeatedField, bool(v != 0)) + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.RepeatedField = append(m.RepeatedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } case 4: - if wireType == 0 { - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } + if wireType == 5 { + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - m.PackedField = append(m.PackedField, bool(v != 0)) + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedField = append(m.PackedField, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { @@ -9427,27 +9646,18 @@ func (m *BoolMessage) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } var elementCount int - elementCount = packedLen + elementCount = packedLen / 4 if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]bool, 0, elementCount) + m.PackedField = make([]int32, 0, elementCount) } for iNdEx < postIndex { - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } + var v int32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF } - m.PackedField = append(m.PackedField, bool(v != 0)) + v = int32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.PackedField = append(m.PackedField, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) @@ -9477,7 +9687,7 @@ func (m *BoolMessage) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *StringMessage) UnmarshalVT(dAtA []byte) error { +func (m *Sfixed64Message) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -9501,111 +9711,139 @@ func (m *StringMessage) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: StringMessage: wiretype end group for non-group") + return fmt.Errorf("proto: Sfixed64Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: StringMessage: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Sfixed64Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { + var v int64 + if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } - s := string(dAtA[iNdEx:postIndex]) - m.RequiredField = &s - iNdEx = postIndex + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RequiredField = &v hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 2 { + if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.OptionalField = &v + case 3: + if wireType == 1 { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedField = append(m.RepeatedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - if iNdEx >= l { + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.RepeatedField) == 0 { + m.RepeatedField = make([]int64, 0, elementCount) } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.OptionalField = &s - iNdEx = postIndex - case 3: - if wireType != 2 { + for iNdEx < postIndex { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.RepeatedField = append(m.RepeatedField, v) + } + } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow + case 4: + if wireType == 1 { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF } - if iNdEx >= l { + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedField = append(m.PackedField, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.PackedField) == 0 { + m.PackedField = make([]int64, 0, elementCount) } + for iNdEx < postIndex { + var v int64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = int64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.PackedField = append(m.PackedField, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RepeatedField = append(m.RepeatedField, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -9631,7 +9869,7 @@ func (m *StringMessage) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *StringMessage) UnmarshalVTUnsafe(dAtA []byte) error { +func (m *BoolMessage) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -9655,17 +9893,17 @@ func (m *StringMessage) UnmarshalVTUnsafe(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: StringMessage: wiretype end group for non-group") + return fmt.Errorf("proto: BoolMessage: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: StringMessage: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: BoolMessage: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var stringLen uint64 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -9675,31 +9913,19 @@ func (m *StringMessage) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := unsafeBytesToString(dAtA[iNdEx:postIndex]) - m.RequiredField = &s - iNdEx = postIndex + b := bool(v != 0) + m.RequiredField = &b hasFields[0] |= uint64(0x00000001) case 2: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var stringLen uint64 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -9709,57 +9935,153 @@ func (m *StringMessage) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := unsafeBytesToString(dAtA[iNdEx:postIndex]) - m.OptionalField = &s - iNdEx = postIndex + b := bool(v != 0) + m.OptionalField = &b case 3: - if wireType != 2 { + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedField = append(m.RepeatedField, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(m.RepeatedField) == 0 { + m.RepeatedField = make([]bool, 0, elementCount) + } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RepeatedField = append(m.RepeatedField, bool(v != 0)) + } + } else { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow + case 4: + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedField = append(m.PackedField, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - if iNdEx >= l { + if packedLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(m.PackedField) == 0 { + m.PackedField = make([]bool, 0, elementCount) } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedField = append(m.PackedField, bool(v != 0)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RepeatedField = append(m.RepeatedField, unsafeBytesToString(dAtA[iNdEx:postIndex])) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -9785,7 +10107,7 @@ func (m *StringMessage) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } -func (m *BytesMessage) UnmarshalVT(dAtA []byte) error { +func (m *StringMessage) UnmarshalVTUnsafe(dAtA []byte) error { var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 @@ -9809,17 +10131,17 @@ func (m *BytesMessage) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: BytesMessage: wiretype end group for non-group") + return fmt.Errorf("proto: StringMessage: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: BytesMessage: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: StringMessage: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -9829,32 +10151,31 @@ func (m *BytesMessage) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLength } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } - m.RequiredField = append(m.RequiredField[:0], dAtA[iNdEx:postIndex]...) - if m.RequiredField == nil { - m.RequiredField = []byte{} - } + s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.RequiredField = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -9864,31 +10185,30 @@ func (m *BytesMessage) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLength } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } - m.OptionalField = append(m.OptionalField[:0], dAtA[iNdEx:postIndex]...) - if m.OptionalField == nil { - m.OptionalField = []byte{} - } + s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.OptionalField = &s iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -9898,23 +10218,23 @@ func (m *BytesMessage) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLength } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } - m.RepeatedField = append(m.RepeatedField, make([]byte, postIndex-iNdEx)) - copy(m.RepeatedField[len(m.RepeatedField)-1], dAtA[iNdEx:postIndex]) + m.RepeatedField = append(m.RepeatedField, unsafeBytesToString(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -10020,291 +10340,57 @@ func (m *BytesMessage) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OptionalField = append(m.OptionalField[:0], dAtA[iNdEx:postIndex]...) - if m.OptionalField == nil { - m.OptionalField = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RepeatedField = append(m.RepeatedField, dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return fmt.Errorf("proto: required field required_field not set") - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EnumMessage) UnmarshalVT(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - 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) - if wireType == 4 { - return fmt.Errorf("proto: EnumMessage: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EnumMessage: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RequiredField", wireType) - } - var v EnumMessage_Num - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= EnumMessage_Num(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.RequiredField = &v - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OptionalField", wireType) - } - var v EnumMessage_Num - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= EnumMessage_Num(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - m.OptionalField = &v + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OptionalField = append(m.OptionalField[:0], dAtA[iNdEx:postIndex]...) + if m.OptionalField == nil { + m.OptionalField = []byte{} + } + iNdEx = postIndex case 3: - if wireType == 0 { - var v EnumMessage_Num - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= EnumMessage_Num(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.RepeatedField = append(m.RepeatedField, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - if elementCount != 0 && len(m.RepeatedField) == 0 { - m.RepeatedField = make([]EnumMessage_Num, 0, elementCount) - } - for iNdEx < postIndex { - var v EnumMessage_Num - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= EnumMessage_Num(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.RepeatedField = append(m.RepeatedField, v) - } - } else { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RepeatedField", wireType) } - case 4: - if wireType == 0 { - var v EnumMessage_Num - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= EnumMessage_Num(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.PackedField = append(m.PackedField, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLength + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow } - if postIndex > l { + if iNdEx >= l { return io.ErrUnexpectedEOF } - var elementCount int - if elementCount != 0 && len(m.PackedField) == 0 { - m.PackedField = make([]EnumMessage_Num, 0, elementCount) - } - for iNdEx < postIndex { - var v EnumMessage_Num - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= EnumMessage_Num(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.PackedField = append(m.PackedField, v) + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field PackedField", wireType) } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepeatedField = append(m.RepeatedField, dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -10565,91 +10651,6 @@ func (m *EnumMessage) UnmarshalVTUnsafe(dAtA []byte) error { return nil } -func skip(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLength - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroup - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLength - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflow = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") -) - func unsafeBytesToString(b []byte) string { return *(*string)(unsafe.Pointer(&b)) } diff --git a/testproto/proto3opt/opt_vtproto.pb.go b/testproto/proto3opt/opt_vtproto.pb.go index c5cc465..d1c57f6 100644 --- a/testproto/proto3opt/opt_vtproto.pb.go +++ b/testproto/proto3opt/opt_vtproto.pb.go @@ -854,6 +854,92 @@ func (m *OptionalFieldInProto3) UnmarshalVT(dAtA []byte) error { } return nil } + +func skip(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLength + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroup + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLength + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflow = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") +) + func (m *OptionalFieldInProto3) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1205,91 +1291,6 @@ func (m *OptionalFieldInProto3) UnmarshalVTUnsafe(dAtA []byte) error { return nil } -func skip(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLength - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroup - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLength - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflow = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") -) - func unsafeBytesToString(b []byte) string { return *(*string)(unsafe.Pointer(&b)) } diff --git a/testproto/unsafe/unsafe_vtproto.pb.go b/testproto/unsafe/unsafe_vtproto.pb.go index be8660e..fe1b74e 100644 --- a/testproto/unsafe/unsafe_vtproto.pb.go +++ b/testproto/unsafe/unsafe_vtproto.pb.go @@ -24,9 +24,8 @@ func (m *UnsafeTest) CloneVT() *UnsafeTest { if m == nil { return (*UnsafeTest)(nil) } - r := &UnsafeTest{ - Foo1: m.Foo1, - } + r := new(UnsafeTest) + r.Foo1 = m.Foo1 if rhs := m.Foo2; rhs != nil { tmpBytes := make([]byte, len(rhs)) copy(tmpBytes, rhs) @@ -311,6 +310,92 @@ func (m *UnsafeTest) UnmarshalVT(dAtA []byte) error { } return nil } + +func skip(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLength + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroup + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLength + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflow = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") +) + func (m *UnsafeTest) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -429,91 +514,6 @@ func (m *UnsafeTest) UnmarshalVTUnsafe(dAtA []byte) error { return nil } -func skip(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLength - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroup - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLength - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflow = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") -) - func unsafeBytesToString(b []byte) string { return *(*string)(unsafe.Pointer(&b)) } diff --git a/testproto/wkt/wkt_vtproto.pb.go b/testproto/wkt/wkt_vtproto.pb.go index 1c422de..48303db 100644 --- a/testproto/wkt/wkt_vtproto.pb.go +++ b/testproto/wkt/wkt_vtproto.pb.go @@ -22,6 +22,7 @@ import ( wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" io "io" bits "math/bits" + unsafe "unsafe" ) const ( @@ -1188,3 +1189,563 @@ var ( ErrIntOverflow = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") ) + +func (m *MessageWithWKT) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: MessageWithWKT: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MessageWithWKT: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Any", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Any == nil { + m.Any = &anypb.Any{} + } + if err := (*anypb1.Any)(m.Any).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Duration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Duration == nil { + m.Duration = &durationpb.Duration{} + } + if err := (*durationpb1.Duration)(m.Duration).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Empty", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Empty == nil { + m.Empty = &emptypb.Empty{} + } + if err := (*emptypb1.Empty)(m.Empty).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldMask", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FieldMask == nil { + m.FieldMask = &fieldmaskpb.FieldMask{} + } + if err := (*fieldmaskpb1.FieldMask)(m.FieldMask).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Timestamp == nil { + m.Timestamp = ×tamppb.Timestamp{} + } + if err := (*timestamppb1.Timestamp)(m.Timestamp).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DoubleValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DoubleValue == nil { + m.DoubleValue = &wrapperspb.DoubleValue{} + } + if err := (*wrapperspb1.DoubleValue)(m.DoubleValue).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FloatValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FloatValue == nil { + m.FloatValue = &wrapperspb.FloatValue{} + } + if err := (*wrapperspb1.FloatValue)(m.FloatValue).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Int64Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Int64Value == nil { + m.Int64Value = &wrapperspb.Int64Value{} + } + if err := (*wrapperspb1.Int64Value)(m.Int64Value).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Uint64Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Uint64Value == nil { + m.Uint64Value = &wrapperspb.UInt64Value{} + } + if err := (*wrapperspb1.UInt64Value)(m.Uint64Value).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Int32Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Int32Value == nil { + m.Int32Value = &wrapperspb.Int32Value{} + } + if err := (*wrapperspb1.Int32Value)(m.Int32Value).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Uint32Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Uint32Value == nil { + m.Uint32Value = &wrapperspb.UInt32Value{} + } + if err := (*wrapperspb1.UInt32Value)(m.Uint32Value).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BoolValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BoolValue == nil { + m.BoolValue = &wrapperspb.BoolValue{} + } + if err := (*wrapperspb1.BoolValue)(m.BoolValue).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StringValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.StringValue == nil { + m.StringValue = &wrapperspb.StringValue{} + } + if err := (*wrapperspb1.StringValue)(m.StringValue).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BytesValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BytesValue == nil { + m.BytesValue = &wrapperspb.BytesValue{} + } + if err := (*wrapperspb1.BytesValue)(m.BytesValue).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func unsafeBytesToString(b []byte) string { + return *(*string)(unsafe.Pointer(&b)) +} diff --git a/types/known/anypb/any_vtproto.pb.go b/types/known/anypb/any_vtproto.pb.go index 6328f82..d673606 100644 --- a/types/known/anypb/any_vtproto.pb.go +++ b/types/known/anypb/any_vtproto.pb.go @@ -10,6 +10,7 @@ import ( anypb "google.golang.org/protobuf/types/known/anypb" io "io" bits "math/bits" + unsafe "unsafe" ) const ( @@ -371,3 +372,124 @@ var ( ErrIntOverflow = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") ) + +func (m *Any) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Any: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Any: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TypeUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TypeUrl = unsafeBytesToString(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func unsafeBytesToString(b []byte) string { + return *(*string)(unsafe.Pointer(&b)) +} diff --git a/types/known/durationpb/duration_vtproto.pb.go b/types/known/durationpb/duration_vtproto.pb.go index abbe887..3d0c8ce 100644 --- a/types/known/durationpb/duration_vtproto.pb.go +++ b/types/known/durationpb/duration_vtproto.pb.go @@ -10,6 +10,7 @@ import ( durationpb "google.golang.org/protobuf/types/known/durationpb" io "io" bits "math/bits" + unsafe "unsafe" ) const ( @@ -329,3 +330,96 @@ var ( ErrIntOverflow = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") ) + +func (m *Duration) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Duration: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Duration: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seconds", wireType) + } + m.Seconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seconds |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nanos", wireType) + } + m.Nanos = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nanos |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func unsafeBytesToString(b []byte) string { + return *(*string)(unsafe.Pointer(&b)) +} diff --git a/types/known/emptypb/empty_vtproto.pb.go b/types/known/emptypb/empty_vtproto.pb.go index 33043a6..dcf9d9e 100644 --- a/types/known/emptypb/empty_vtproto.pb.go +++ b/types/known/emptypb/empty_vtproto.pb.go @@ -10,6 +10,7 @@ import ( emptypb "google.golang.org/protobuf/types/known/emptypb" io "io" bits "math/bits" + unsafe "unsafe" ) const ( @@ -257,3 +258,58 @@ var ( ErrIntOverflow = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") ) + +func (m *Empty) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Empty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Empty: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func unsafeBytesToString(b []byte) string { + return *(*string)(unsafe.Pointer(&b)) +} diff --git a/types/known/fieldmaskpb/field_mask_vtproto.pb.go b/types/known/fieldmaskpb/field_mask_vtproto.pb.go index e466fe4..4fd37b1 100644 --- a/types/known/fieldmaskpb/field_mask_vtproto.pb.go +++ b/types/known/fieldmaskpb/field_mask_vtproto.pb.go @@ -10,6 +10,7 @@ import ( fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" io "io" bits "math/bits" + unsafe "unsafe" ) const ( @@ -327,3 +328,90 @@ var ( ErrIntOverflow = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") ) + +func (m *FieldMask) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: FieldMask: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FieldMask: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Paths", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Paths = append(m.Paths, unsafeBytesToString(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func unsafeBytesToString(b []byte) string { + return *(*string)(unsafe.Pointer(&b)) +} diff --git a/types/known/timestamppb/timestamp_vtproto.pb.go b/types/known/timestamppb/timestamp_vtproto.pb.go index 8bb048a..5e04ed8 100644 --- a/types/known/timestamppb/timestamp_vtproto.pb.go +++ b/types/known/timestamppb/timestamp_vtproto.pb.go @@ -10,6 +10,7 @@ import ( timestamppb "google.golang.org/protobuf/types/known/timestamppb" io "io" bits "math/bits" + unsafe "unsafe" ) const ( @@ -329,3 +330,96 @@ var ( ErrIntOverflow = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") ) + +func (m *Timestamp) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Timestamp: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Timestamp: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seconds", wireType) + } + m.Seconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seconds |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nanos", wireType) + } + m.Nanos = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nanos |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func unsafeBytesToString(b []byte) string { + return *(*string)(unsafe.Pointer(&b)) +} diff --git a/types/known/wrapperspb/wrappers_vtproto.pb.go b/types/known/wrapperspb/wrappers_vtproto.pb.go index ac889d5..9d1b7e3 100644 --- a/types/known/wrapperspb/wrappers_vtproto.pb.go +++ b/types/known/wrapperspb/wrappers_vtproto.pb.go @@ -12,6 +12,7 @@ import ( io "io" math "math" bits "math/bits" + unsafe "unsafe" ) const ( @@ -1704,3 +1705,642 @@ var ( ErrIntOverflow = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") ) + +func (m *DoubleValue) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: DoubleValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DoubleValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Value = float64(math.Float64frombits(v)) + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FloatValue) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: FloatValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FloatValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.Value = float32(math.Float32frombits(v)) + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Int64Value) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Int64Value: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Int64Value: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UInt64Value) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: UInt64Value: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UInt64Value: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Int32Value) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: Int32Value: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Int32Value: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UInt32Value) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: UInt32Value: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UInt32Value: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BoolValue) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: BoolValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BoolValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Value = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StringValue) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: StringValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StringValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = unsafeBytesToString(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BytesValue) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: BytesValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BytesValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func unsafeBytesToString(b []byte) string { + return *(*string)(unsafe.Pointer(&b)) +} From 697df680753aecb1bc40d8e552fab41d50a19320 Mon Sep 17 00:00:00 2001 From: Corentin Dupret Date: Wed, 4 Oct 2023 11:44:41 +0200 Subject: [PATCH 04/10] Fix recursivity, maps, and bytes --- .../conformance/conformance_vtproto.pb.go | 2 +- .../test_messages_proto2_vtproto.pb.go | 53 ++++---- .../test_messages_proto3_vtproto.pb.go | 114 +++++++++--------- features/unmarshal/unmarshal.go | 47 +++++--- testproto/pool/pool_with_oneof_vtproto.pb.go | 14 +-- .../pool/pool_with_slice_reuse_vtproto.pb.go | 4 +- testproto/proto2/scalars_vtproto.pb.go | 10 +- testproto/proto3opt/opt_vtproto.pb.go | 5 +- testproto/unsafe/unsafe_vtproto.pb.go | 5 +- testproto/wkt/wkt_vtproto.pb.go | 28 ++--- types/known/anypb/any_vtproto.pb.go | 5 +- types/known/wrapperspb/wrappers_vtproto.pb.go | 5 +- 12 files changed, 139 insertions(+), 153 deletions(-) diff --git a/conformance/internal/conformance/conformance_vtproto.pb.go b/conformance/internal/conformance/conformance_vtproto.pb.go index f9ae57f..35244e1 100644 --- a/conformance/internal/conformance/conformance_vtproto.pb.go +++ b/conformance/internal/conformance/conformance_vtproto.pb.go @@ -2590,7 +2590,7 @@ func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { if m.JspbEncodingOptions == nil { m.JspbEncodingOptions = &JspbEncodingConfig{} } - if err := m.JspbEncodingOptions.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.JspbEncodingOptions.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/conformance/internal/conformance/test_messages_proto2_vtproto.pb.go b/conformance/internal/conformance/test_messages_proto2_vtproto.pb.go index dc4952f..e8e95d5 100644 --- a/conformance/internal/conformance/test_messages_proto2_vtproto.pb.go +++ b/conformance/internal/conformance/test_messages_proto2_vtproto.pb.go @@ -14858,7 +14858,7 @@ func (m *TestAllTypesProto2_NestedMessage) UnmarshalVTUnsafe(dAtA []byte) error if m.Corecursive == nil { m.Corecursive = &TestAllTypesProto2{} } - if err := m.Corecursive.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Corecursive.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -15492,10 +15492,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OptionalBytes = append(m.OptionalBytes[:0], dAtA[iNdEx:postIndex]...) - if m.OptionalBytes == nil { - m.OptionalBytes = []byte{} - } + m.OptionalBytes = dAtA[iNdEx:postIndex] iNdEx = postIndex case 18: if wireType != 2 { @@ -15529,7 +15526,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalNestedMessage == nil { m.OptionalNestedMessage = &TestAllTypesProto2_NestedMessage{} } - if err := m.OptionalNestedMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.OptionalNestedMessage.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -15565,7 +15562,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalForeignMessage == nil { m.OptionalForeignMessage = &ForeignMessageProto2{} } - if err := m.OptionalForeignMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.OptionalForeignMessage.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -15707,7 +15704,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if m.RecursiveMessage == nil { m.RecursiveMessage = &TestAllTypesProto2{} } - if err := m.RecursiveMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RecursiveMessage.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -16650,7 +16647,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedNestedMessage = append(m.RepeatedNestedMessage, &TestAllTypesProto2_NestedMessage{}) - if err := m.RepeatedNestedMessage[len(m.RepeatedNestedMessage)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RepeatedNestedMessage[len(m.RepeatedNestedMessage)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -16684,7 +16681,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedForeignMessage = append(m.RepeatedForeignMessage, &ForeignMessageProto2{}) - if err := m.RepeatedForeignMessage[len(m.RepeatedForeignMessage)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RepeatedForeignMessage[len(m.RepeatedForeignMessage)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -18186,7 +18183,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var stringLenmapvalue uint64 @@ -18215,7 +18212,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapvalue > l { return io.ErrUnexpectedEOF } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + mapvalue = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapvalue]) iNdEx = postStringIndexmapvalue } else { iNdEx = entryPreIndex @@ -18313,7 +18310,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapbyteLen uint64 @@ -18342,8 +18339,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postbytesIndex > l { return io.ErrUnexpectedEOF } - mapvalue = make([]byte, mapbyteLen) - copy(mapvalue, dAtA[iNdEx:postbytesIndex]) + mapvalue = dAtA[iNdEx:postbytesIndex] iNdEx = postbytesIndex } else { iNdEx = entryPreIndex @@ -18441,7 +18437,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapmsglen int @@ -18470,7 +18466,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } mapvalue = &TestAllTypesProto2_NestedMessage{} - if err := mapvalue.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { + if err := mapvalue.UnmarshalVTUnsafe(dAtA[iNdEx:postmsgIndex]); err != nil { return err } iNdEx = postmsgIndex @@ -18570,7 +18566,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapmsglen int @@ -18599,7 +18595,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } mapvalue = &ForeignMessageProto2{} - if err := mapvalue.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { + if err := mapvalue.UnmarshalVTUnsafe(dAtA[iNdEx:postmsgIndex]); err != nil { return err } iNdEx = postmsgIndex @@ -18699,7 +18695,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { @@ -18812,7 +18808,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { @@ -20726,12 +20722,12 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } if oneof, ok := m.OneofField.(*TestAllTypesProto2_OneofNestedMessage); ok { - if err := oneof.OneofNestedMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := oneof.OneofNestedMessage.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } } else { v := &TestAllTypesProto2_NestedMessage{} - if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := v.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } m.OneofField = &TestAllTypesProto2_OneofNestedMessage{OneofNestedMessage: v} @@ -20908,7 +20904,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { } groupWireType := int(wire & 0x7) if groupWireType == 4 { - if err := m.Data.UnmarshalVT(dAtA[groupStart:maybeGroupEnd]); err != nil { + if err := m.Data.UnmarshalVTUnsafe(dAtA[groupStart:maybeGroupEnd]); err != nil { return err } break @@ -21196,10 +21192,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DefaultBytes = append(m.DefaultBytes[:0], dAtA[iNdEx:postIndex]...) - if m.DefaultBytes == nil { - m.DefaultBytes = []byte{} - } + m.DefaultBytes = dAtA[iNdEx:postIndex] iNdEx = postIndex case 401: if wireType != 0 { @@ -21847,7 +21840,7 @@ func (m *UnknownToTestAllTypes) UnmarshalVTUnsafe(dAtA []byte) error { if m.NestedMessage == nil { m.NestedMessage = &ForeignMessageProto2{} } - if err := m.NestedMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.NestedMessage.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21875,7 +21868,7 @@ func (m *UnknownToTestAllTypes) UnmarshalVTUnsafe(dAtA []byte) error { } groupWireType := int(wire & 0x7) if groupWireType == 4 { - if err := m.Optionalgroup.UnmarshalVT(dAtA[groupStart:maybeGroupEnd]); err != nil { + if err := m.Optionalgroup.UnmarshalVTUnsafe(dAtA[groupStart:maybeGroupEnd]); err != nil { return err } break diff --git a/conformance/internal/conformance/test_messages_proto3_vtproto.pb.go b/conformance/internal/conformance/test_messages_proto3_vtproto.pb.go index 3670eeb..97c49e0 100644 --- a/conformance/internal/conformance/test_messages_proto3_vtproto.pb.go +++ b/conformance/internal/conformance/test_messages_proto3_vtproto.pb.go @@ -15173,7 +15173,7 @@ func (m *TestAllTypesProto3_NestedMessage) UnmarshalVTUnsafe(dAtA []byte) error if m.Corecursive == nil { m.Corecursive = &TestAllTypesProto3{} } - if err := m.Corecursive.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Corecursive.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -15489,10 +15489,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OptionalBytes = append(m.OptionalBytes[:0], dAtA[iNdEx:postIndex]...) - if m.OptionalBytes == nil { - m.OptionalBytes = []byte{} - } + m.OptionalBytes = dAtA[iNdEx:postIndex] iNdEx = postIndex case 18: if wireType != 2 { @@ -15526,7 +15523,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalNestedMessage == nil { m.OptionalNestedMessage = &TestAllTypesProto3_NestedMessage{} } - if err := m.OptionalNestedMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.OptionalNestedMessage.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -15562,7 +15559,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalForeignMessage == nil { m.OptionalForeignMessage = &ForeignMessage{} } - if err := m.OptionalForeignMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.OptionalForeignMessage.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -15719,7 +15716,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.RecursiveMessage == nil { m.RecursiveMessage = &TestAllTypesProto3{} } - if err := m.RecursiveMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RecursiveMessage.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -16662,7 +16659,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedNestedMessage = append(m.RepeatedNestedMessage, &TestAllTypesProto3_NestedMessage{}) - if err := m.RepeatedNestedMessage[len(m.RepeatedNestedMessage)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RepeatedNestedMessage[len(m.RepeatedNestedMessage)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -16696,7 +16693,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedForeignMessage = append(m.RepeatedForeignMessage, &ForeignMessage{}) - if err := m.RepeatedForeignMessage[len(m.RepeatedForeignMessage)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RepeatedForeignMessage[len(m.RepeatedForeignMessage)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -18198,7 +18195,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var stringLenmapvalue uint64 @@ -18227,7 +18224,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapvalue > l { return io.ErrUnexpectedEOF } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + mapvalue = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapvalue]) iNdEx = postStringIndexmapvalue } else { iNdEx = entryPreIndex @@ -18325,7 +18322,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapbyteLen uint64 @@ -18354,8 +18351,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postbytesIndex > l { return io.ErrUnexpectedEOF } - mapvalue = make([]byte, mapbyteLen) - copy(mapvalue, dAtA[iNdEx:postbytesIndex]) + mapvalue = dAtA[iNdEx:postbytesIndex] iNdEx = postbytesIndex } else { iNdEx = entryPreIndex @@ -18453,7 +18449,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapmsglen int @@ -18482,7 +18478,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } mapvalue = &TestAllTypesProto3_NestedMessage{} - if err := mapvalue.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { + if err := mapvalue.UnmarshalVTUnsafe(dAtA[iNdEx:postmsgIndex]); err != nil { return err } iNdEx = postmsgIndex @@ -18582,7 +18578,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapmsglen int @@ -18611,7 +18607,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } mapvalue = &ForeignMessage{} - if err := mapvalue.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { + if err := mapvalue.UnmarshalVTUnsafe(dAtA[iNdEx:postmsgIndex]); err != nil { return err } iNdEx = postmsgIndex @@ -18711,7 +18707,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { @@ -18824,7 +18820,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { @@ -20738,12 +20734,12 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } if oneof, ok := m.OneofField.(*TestAllTypesProto3_OneofNestedMessage); ok { - if err := oneof.OneofNestedMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := oneof.OneofNestedMessage.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } } else { v := &TestAllTypesProto3_NestedMessage{} - if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := v.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } m.OneofField = &TestAllTypesProto3_OneofNestedMessage{OneofNestedMessage: v} @@ -20948,7 +20944,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalBoolWrapper == nil { m.OptionalBoolWrapper = &wrapperspb.BoolValue{} } - if err := (*wrapperspb1.BoolValue)(m.OptionalBoolWrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.BoolValue)(m.OptionalBoolWrapper).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -20984,7 +20980,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalInt32Wrapper == nil { m.OptionalInt32Wrapper = &wrapperspb.Int32Value{} } - if err := (*wrapperspb1.Int32Value)(m.OptionalInt32Wrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.Int32Value)(m.OptionalInt32Wrapper).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21020,7 +21016,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalInt64Wrapper == nil { m.OptionalInt64Wrapper = &wrapperspb.Int64Value{} } - if err := (*wrapperspb1.Int64Value)(m.OptionalInt64Wrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.Int64Value)(m.OptionalInt64Wrapper).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21056,7 +21052,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalUint32Wrapper == nil { m.OptionalUint32Wrapper = &wrapperspb.UInt32Value{} } - if err := (*wrapperspb1.UInt32Value)(m.OptionalUint32Wrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.UInt32Value)(m.OptionalUint32Wrapper).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21092,7 +21088,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalUint64Wrapper == nil { m.OptionalUint64Wrapper = &wrapperspb.UInt64Value{} } - if err := (*wrapperspb1.UInt64Value)(m.OptionalUint64Wrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.UInt64Value)(m.OptionalUint64Wrapper).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21128,7 +21124,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalFloatWrapper == nil { m.OptionalFloatWrapper = &wrapperspb.FloatValue{} } - if err := (*wrapperspb1.FloatValue)(m.OptionalFloatWrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.FloatValue)(m.OptionalFloatWrapper).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21164,7 +21160,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalDoubleWrapper == nil { m.OptionalDoubleWrapper = &wrapperspb.DoubleValue{} } - if err := (*wrapperspb1.DoubleValue)(m.OptionalDoubleWrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.DoubleValue)(m.OptionalDoubleWrapper).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21200,7 +21196,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalStringWrapper == nil { m.OptionalStringWrapper = &wrapperspb.StringValue{} } - if err := (*wrapperspb1.StringValue)(m.OptionalStringWrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.StringValue)(m.OptionalStringWrapper).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21236,7 +21232,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalBytesWrapper == nil { m.OptionalBytesWrapper = &wrapperspb.BytesValue{} } - if err := (*wrapperspb1.BytesValue)(m.OptionalBytesWrapper).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.BytesValue)(m.OptionalBytesWrapper).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21270,7 +21266,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedBoolWrapper = append(m.RepeatedBoolWrapper, &wrapperspb.BoolValue{}) - if err := (*wrapperspb1.BoolValue)(m.RepeatedBoolWrapper[len(m.RepeatedBoolWrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.BoolValue)(m.RepeatedBoolWrapper[len(m.RepeatedBoolWrapper)-1]).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21304,7 +21300,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedInt32Wrapper = append(m.RepeatedInt32Wrapper, &wrapperspb.Int32Value{}) - if err := (*wrapperspb1.Int32Value)(m.RepeatedInt32Wrapper[len(m.RepeatedInt32Wrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.Int32Value)(m.RepeatedInt32Wrapper[len(m.RepeatedInt32Wrapper)-1]).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21338,7 +21334,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedInt64Wrapper = append(m.RepeatedInt64Wrapper, &wrapperspb.Int64Value{}) - if err := (*wrapperspb1.Int64Value)(m.RepeatedInt64Wrapper[len(m.RepeatedInt64Wrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.Int64Value)(m.RepeatedInt64Wrapper[len(m.RepeatedInt64Wrapper)-1]).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21372,7 +21368,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedUint32Wrapper = append(m.RepeatedUint32Wrapper, &wrapperspb.UInt32Value{}) - if err := (*wrapperspb1.UInt32Value)(m.RepeatedUint32Wrapper[len(m.RepeatedUint32Wrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.UInt32Value)(m.RepeatedUint32Wrapper[len(m.RepeatedUint32Wrapper)-1]).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21406,7 +21402,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedUint64Wrapper = append(m.RepeatedUint64Wrapper, &wrapperspb.UInt64Value{}) - if err := (*wrapperspb1.UInt64Value)(m.RepeatedUint64Wrapper[len(m.RepeatedUint64Wrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.UInt64Value)(m.RepeatedUint64Wrapper[len(m.RepeatedUint64Wrapper)-1]).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21440,7 +21436,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedFloatWrapper = append(m.RepeatedFloatWrapper, &wrapperspb.FloatValue{}) - if err := (*wrapperspb1.FloatValue)(m.RepeatedFloatWrapper[len(m.RepeatedFloatWrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.FloatValue)(m.RepeatedFloatWrapper[len(m.RepeatedFloatWrapper)-1]).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21474,7 +21470,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedDoubleWrapper = append(m.RepeatedDoubleWrapper, &wrapperspb.DoubleValue{}) - if err := (*wrapperspb1.DoubleValue)(m.RepeatedDoubleWrapper[len(m.RepeatedDoubleWrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.DoubleValue)(m.RepeatedDoubleWrapper[len(m.RepeatedDoubleWrapper)-1]).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21508,7 +21504,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedStringWrapper = append(m.RepeatedStringWrapper, &wrapperspb.StringValue{}) - if err := (*wrapperspb1.StringValue)(m.RepeatedStringWrapper[len(m.RepeatedStringWrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.StringValue)(m.RepeatedStringWrapper[len(m.RepeatedStringWrapper)-1]).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21542,7 +21538,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedBytesWrapper = append(m.RepeatedBytesWrapper, &wrapperspb.BytesValue{}) - if err := (*wrapperspb1.BytesValue)(m.RepeatedBytesWrapper[len(m.RepeatedBytesWrapper)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.BytesValue)(m.RepeatedBytesWrapper[len(m.RepeatedBytesWrapper)-1]).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21578,7 +21574,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalDuration == nil { m.OptionalDuration = &durationpb.Duration{} } - if err := (*durationpb1.Duration)(m.OptionalDuration).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*durationpb1.Duration)(m.OptionalDuration).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21614,7 +21610,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalTimestamp == nil { m.OptionalTimestamp = ×tamppb.Timestamp{} } - if err := (*timestamppb1.Timestamp)(m.OptionalTimestamp).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*timestamppb1.Timestamp)(m.OptionalTimestamp).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21650,7 +21646,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalFieldMask == nil { m.OptionalFieldMask = &fieldmaskpb.FieldMask{} } - if err := (*fieldmaskpb1.FieldMask)(m.OptionalFieldMask).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*fieldmaskpb1.FieldMask)(m.OptionalFieldMask).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21687,9 +21683,9 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { m.OptionalStruct = &structpb.Struct{} } if unmarshal, ok := interface{}(m.OptionalStruct).(interface { - UnmarshalVT([]byte) error + UnmarshalVTUnsafe([]byte) error }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := unmarshal.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } } else { @@ -21730,7 +21726,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if m.OptionalAny == nil { m.OptionalAny = &anypb.Any{} } - if err := (*anypb1.Any)(m.OptionalAny).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*anypb1.Any)(m.OptionalAny).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21767,9 +21763,9 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { m.OptionalValue = &structpb.Value{} } if unmarshal, ok := interface{}(m.OptionalValue).(interface { - UnmarshalVT([]byte) error + UnmarshalVTUnsafe([]byte) error }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := unmarshal.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } } else { @@ -21827,7 +21823,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedDuration = append(m.RepeatedDuration, &durationpb.Duration{}) - if err := (*durationpb1.Duration)(m.RepeatedDuration[len(m.RepeatedDuration)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*durationpb1.Duration)(m.RepeatedDuration[len(m.RepeatedDuration)-1]).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21861,7 +21857,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedTimestamp = append(m.RepeatedTimestamp, ×tamppb.Timestamp{}) - if err := (*timestamppb1.Timestamp)(m.RepeatedTimestamp[len(m.RepeatedTimestamp)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*timestamppb1.Timestamp)(m.RepeatedTimestamp[len(m.RepeatedTimestamp)-1]).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21895,7 +21891,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedFieldmask = append(m.RepeatedFieldmask, &fieldmaskpb.FieldMask{}) - if err := (*fieldmaskpb1.FieldMask)(m.RepeatedFieldmask[len(m.RepeatedFieldmask)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*fieldmaskpb1.FieldMask)(m.RepeatedFieldmask[len(m.RepeatedFieldmask)-1]).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21929,7 +21925,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } m.RepeatedAny = append(m.RepeatedAny, &anypb.Any{}) - if err := (*anypb1.Any)(m.RepeatedAny[len(m.RepeatedAny)-1]).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*anypb1.Any)(m.RepeatedAny[len(m.RepeatedAny)-1]).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -21964,9 +21960,9 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { } m.RepeatedValue = append(m.RepeatedValue, &structpb.Value{}) if unmarshal, ok := interface{}(m.RepeatedValue[len(m.RepeatedValue)-1]).(interface { - UnmarshalVT([]byte) error + UnmarshalVTUnsafe([]byte) error }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := unmarshal.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } } else { @@ -22006,9 +22002,9 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { } m.RepeatedListValue = append(m.RepeatedListValue, &structpb.ListValue{}) if unmarshal, ok := interface{}(m.RepeatedListValue[len(m.RepeatedListValue)-1]).(interface { - UnmarshalVT([]byte) error + UnmarshalVTUnsafe([]byte) error }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := unmarshal.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } } else { @@ -22048,9 +22044,9 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { } m.RepeatedStruct = append(m.RepeatedStruct, &structpb.Struct{}) if unmarshal, ok := interface{}(m.RepeatedStruct[len(m.RepeatedStruct)-1]).(interface { - UnmarshalVT([]byte) error + UnmarshalVTUnsafe([]byte) error }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := unmarshal.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } } else { diff --git a/features/unmarshal/unmarshal.go b/features/unmarshal/unmarshal.go index 8a46603..ed09147 100644 --- a/features/unmarshal/unmarshal.go +++ b/features/unmarshal/unmarshal.go @@ -146,23 +146,30 @@ func (p *unmarshal) GenerateHelpers() { } } +func (p *unmarshal) methodUnmarshal() string { + if p.unsafe { + return "UnmarshalVTUnsafe" + } + return "UnmarshalVT" +} + func (p *unmarshal) decodeMessage(varName, buf string, message *protogen.Message) { switch { case p.IsLocalMessage(message): - p.P(`if err := `, varName, `.UnmarshalVT(`, buf, `); err != nil {`) + p.P(`if err := `, varName, `.`, p.methodUnmarshal(), `(`, buf, `); err != nil {`) p.P(`return err`) p.P(`}`) case p.IsWellKnownType(message): - p.P(`if err := (*`, p.WellKnownTypeMap(message), `)(`, varName, `).UnmarshalVT(`, buf, `); err != nil {`) + p.P(`if err := (*`, p.WellKnownTypeMap(message), `)(`, varName, `).`, p.methodUnmarshal(), `(`, buf, `); err != nil {`) p.P(`return err`) p.P(`}`) default: p.P(`if unmarshal, ok := interface{}(`, varName, `).(interface{`) - p.P(`UnmarshalVT([]byte) error`) + p.P(p.methodUnmarshal(), `([]byte) error`) p.P(`}); ok{`) - p.P(`if err := unmarshal.UnmarshalVT(`, buf, `); err != nil {`) + p.P(`if err := unmarshal.`, p.methodUnmarshal(), `(`, buf, `); err != nil {`) p.P(`return err`) p.P(`}`) p.P(`} else {`) @@ -288,7 +295,11 @@ func (p *unmarshal) mapField(varName string, field *protogen.Field) { p.P(`if postStringIndex`, varName, ` > l {`) p.P(`return `, p.Ident("io", `ErrUnexpectedEOF`)) p.P(`}`) - p.P(varName, ` = `, "string", `(dAtA[iNdEx:postStringIndex`, varName, `])`) + if p.unsafe { + p.P(varName, ` = `, "unsafeBytesToString", `(dAtA[iNdEx:postStringIndex`, varName, `])`) + } else { + p.P(varName, ` = `, "string", `(dAtA[iNdEx:postStringIndex`, varName, `])`) + } p.P(`iNdEx = postStringIndex`, varName) case protoreflect.MessageKind: p.P(`var mapmsglen int`) @@ -321,8 +332,12 @@ func (p *unmarshal) mapField(varName string, field *protogen.Field) { p.P(`if postbytesIndex > l {`) p.P(`return `, p.Ident("io", `ErrUnexpectedEOF`)) p.P(`}`) - p.P(varName, ` = make([]byte, mapbyteLen)`) - p.P(`copy(`, varName, `, dAtA[iNdEx:postbytesIndex])`) + if p.unsafe { + p.P(varName, ` = dAtA[iNdEx:postbytesIndex]`) + } else { + p.P(varName, ` = make([]byte, mapbyteLen)`) + p.P(`copy(`, varName, `, dAtA[iNdEx:postbytesIndex])`) + } p.P(`iNdEx = postbytesIndex`) case protoreflect.Uint32Kind: p.decodeVarint(varName, "uint32") @@ -662,10 +677,14 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * p.P(`copy(m.`, fieldname, `[len(m.`, fieldname, `)-1], dAtA[iNdEx:postIndex])`) } } else { - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `[:0] , dAtA[iNdEx:postIndex]...)`) - p.P(`if m.`, fieldname, ` == nil {`) - p.P(`m.`, fieldname, ` = []byte{}`) - p.P(`}`) + if p.unsafe { + p.P(`m.`, fieldname, ` = dAtA[iNdEx:postIndex]`) + } else { + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `[:0] , dAtA[iNdEx:postIndex]...)`) + p.P(`if m.`, fieldname, ` == nil {`) + p.P(`m.`, fieldname, ` = []byte{}`) + p.P(`}`) + } } p.P(`iNdEx = postIndex`) case protoreflect.Uint32Kind: @@ -862,11 +881,7 @@ func (p *unmarshal) message(proto3 bool, message *protogen.Message) { ccTypeName := message.GoIdent.GoName required := message.Desc.RequiredNumbers() - if p.unsafe { - p.P(`func (m *`, ccTypeName, `) UnmarshalVTUnsafe(dAtA []byte) error {`) - } else { - p.P(`func (m *`, ccTypeName, `) UnmarshalVT(dAtA []byte) error {`) - } + p.P(`func (m *`, ccTypeName, `) `, p.methodUnmarshal(), `(dAtA []byte) error {`) if required.Len() > 0 { p.P(`var hasFields [`, strconv.Itoa(1+(required.Len()-1)/64), `]uint64`) } diff --git a/testproto/pool/pool_with_oneof_vtproto.pb.go b/testproto/pool/pool_with_oneof_vtproto.pb.go index 03af013..5b6d9ec 100644 --- a/testproto/pool/pool_with_oneof_vtproto.pb.go +++ b/testproto/pool/pool_with_oneof_vtproto.pb.go @@ -1842,7 +1842,7 @@ func (m *OneofTest_Test3) UnmarshalVTUnsafe(dAtA []byte) error { if m.C == nil { m.C = OneofTest_Test3_Element2FromVTPool() } - if err := m.C.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.C.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1927,12 +1927,12 @@ func (m *OneofTest) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } if oneof, ok := m.Test.(*OneofTest_Test1_); ok { - if err := oneof.Test1.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := oneof.Test1.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } } else { v := OneofTest_Test1FromVTPool() - if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := v.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } m.Test = &OneofTest_Test1_{Test1: v} @@ -1968,12 +1968,12 @@ func (m *OneofTest) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } if oneof, ok := m.Test.(*OneofTest_Test2_); ok { - if err := oneof.Test2.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := oneof.Test2.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } } else { v := OneofTest_Test2FromVTPool() - if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := v.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } m.Test = &OneofTest_Test2_{Test2: v} @@ -2009,12 +2009,12 @@ func (m *OneofTest) UnmarshalVTUnsafe(dAtA []byte) error { return io.ErrUnexpectedEOF } if oneof, ok := m.Test.(*OneofTest_Test3_); ok { - if err := oneof.Test3.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := oneof.Test3.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } } else { v := OneofTest_Test3FromVTPool() - if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := v.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } m.Test = &OneofTest_Test3_{Test3: v} diff --git a/testproto/pool/pool_with_slice_reuse_vtproto.pb.go b/testproto/pool/pool_with_slice_reuse_vtproto.pb.go index 546ec6f..18bd75d 100644 --- a/testproto/pool/pool_with_slice_reuse_vtproto.pb.go +++ b/testproto/pool/pool_with_slice_reuse_vtproto.pb.go @@ -1473,7 +1473,7 @@ func (m *Test2) UnmarshalVTUnsafe(dAtA []byte) error { m.Sl[len(m.Sl)-1] = &Slice2{} } } - if err := m.Sl[len(m.Sl)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Sl[len(m.Sl)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1711,7 +1711,7 @@ func (m *Slice2) UnmarshalVTUnsafe(dAtA []byte) error { if m.D == nil { m.D = &Element2{} } - if err := m.D.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := m.D.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/testproto/proto2/scalars_vtproto.pb.go b/testproto/proto2/scalars_vtproto.pb.go index 72d18e3..019ee86 100644 --- a/testproto/proto2/scalars_vtproto.pb.go +++ b/testproto/proto2/scalars_vtproto.pb.go @@ -10320,10 +10320,7 @@ func (m *BytesMessage) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RequiredField = append(m.RequiredField[:0], dAtA[iNdEx:postIndex]...) - if m.RequiredField == nil { - m.RequiredField = []byte{} - } + m.RequiredField = dAtA[iNdEx:postIndex] iNdEx = postIndex hasFields[0] |= uint64(0x00000001) case 2: @@ -10355,10 +10352,7 @@ func (m *BytesMessage) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OptionalField = append(m.OptionalField[:0], dAtA[iNdEx:postIndex]...) - if m.OptionalField == nil { - m.OptionalField = []byte{} - } + m.OptionalField = dAtA[iNdEx:postIndex] iNdEx = postIndex case 3: if wireType != 2 { diff --git a/testproto/proto3opt/opt_vtproto.pb.go b/testproto/proto3opt/opt_vtproto.pb.go index d1c57f6..0b4c2bd 100644 --- a/testproto/proto3opt/opt_vtproto.pb.go +++ b/testproto/proto3opt/opt_vtproto.pb.go @@ -1243,10 +1243,7 @@ func (m *OptionalFieldInProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OptionalBytes = append(m.OptionalBytes[:0], dAtA[iNdEx:postIndex]...) - if m.OptionalBytes == nil { - m.OptionalBytes = []byte{} - } + m.OptionalBytes = dAtA[iNdEx:postIndex] iNdEx = postIndex case 16: if wireType != 0 { diff --git a/testproto/unsafe/unsafe_vtproto.pb.go b/testproto/unsafe/unsafe_vtproto.pb.go index fe1b74e..a54079b 100644 --- a/testproto/unsafe/unsafe_vtproto.pb.go +++ b/testproto/unsafe/unsafe_vtproto.pb.go @@ -486,10 +486,7 @@ func (m *UnsafeTest) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Foo2 = append(m.Foo2[:0], dAtA[iNdEx:postIndex]...) - if m.Foo2 == nil { - m.Foo2 = []byte{} - } + m.Foo2 = dAtA[iNdEx:postIndex] iNdEx = postIndex default: iNdEx = preIndex diff --git a/testproto/wkt/wkt_vtproto.pb.go b/testproto/wkt/wkt_vtproto.pb.go index 48303db..e32cd95 100644 --- a/testproto/wkt/wkt_vtproto.pb.go +++ b/testproto/wkt/wkt_vtproto.pb.go @@ -1251,7 +1251,7 @@ func (m *MessageWithWKT) UnmarshalVTUnsafe(dAtA []byte) error { if m.Any == nil { m.Any = &anypb.Any{} } - if err := (*anypb1.Any)(m.Any).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*anypb1.Any)(m.Any).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1287,7 +1287,7 @@ func (m *MessageWithWKT) UnmarshalVTUnsafe(dAtA []byte) error { if m.Duration == nil { m.Duration = &durationpb.Duration{} } - if err := (*durationpb1.Duration)(m.Duration).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*durationpb1.Duration)(m.Duration).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1323,7 +1323,7 @@ func (m *MessageWithWKT) UnmarshalVTUnsafe(dAtA []byte) error { if m.Empty == nil { m.Empty = &emptypb.Empty{} } - if err := (*emptypb1.Empty)(m.Empty).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*emptypb1.Empty)(m.Empty).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1359,7 +1359,7 @@ func (m *MessageWithWKT) UnmarshalVTUnsafe(dAtA []byte) error { if m.FieldMask == nil { m.FieldMask = &fieldmaskpb.FieldMask{} } - if err := (*fieldmaskpb1.FieldMask)(m.FieldMask).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*fieldmaskpb1.FieldMask)(m.FieldMask).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1395,7 +1395,7 @@ func (m *MessageWithWKT) UnmarshalVTUnsafe(dAtA []byte) error { if m.Timestamp == nil { m.Timestamp = ×tamppb.Timestamp{} } - if err := (*timestamppb1.Timestamp)(m.Timestamp).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*timestamppb1.Timestamp)(m.Timestamp).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1431,7 +1431,7 @@ func (m *MessageWithWKT) UnmarshalVTUnsafe(dAtA []byte) error { if m.DoubleValue == nil { m.DoubleValue = &wrapperspb.DoubleValue{} } - if err := (*wrapperspb1.DoubleValue)(m.DoubleValue).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.DoubleValue)(m.DoubleValue).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1467,7 +1467,7 @@ func (m *MessageWithWKT) UnmarshalVTUnsafe(dAtA []byte) error { if m.FloatValue == nil { m.FloatValue = &wrapperspb.FloatValue{} } - if err := (*wrapperspb1.FloatValue)(m.FloatValue).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.FloatValue)(m.FloatValue).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1503,7 +1503,7 @@ func (m *MessageWithWKT) UnmarshalVTUnsafe(dAtA []byte) error { if m.Int64Value == nil { m.Int64Value = &wrapperspb.Int64Value{} } - if err := (*wrapperspb1.Int64Value)(m.Int64Value).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.Int64Value)(m.Int64Value).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1539,7 +1539,7 @@ func (m *MessageWithWKT) UnmarshalVTUnsafe(dAtA []byte) error { if m.Uint64Value == nil { m.Uint64Value = &wrapperspb.UInt64Value{} } - if err := (*wrapperspb1.UInt64Value)(m.Uint64Value).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.UInt64Value)(m.Uint64Value).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1575,7 +1575,7 @@ func (m *MessageWithWKT) UnmarshalVTUnsafe(dAtA []byte) error { if m.Int32Value == nil { m.Int32Value = &wrapperspb.Int32Value{} } - if err := (*wrapperspb1.Int32Value)(m.Int32Value).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.Int32Value)(m.Int32Value).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1611,7 +1611,7 @@ func (m *MessageWithWKT) UnmarshalVTUnsafe(dAtA []byte) error { if m.Uint32Value == nil { m.Uint32Value = &wrapperspb.UInt32Value{} } - if err := (*wrapperspb1.UInt32Value)(m.Uint32Value).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.UInt32Value)(m.Uint32Value).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1647,7 +1647,7 @@ func (m *MessageWithWKT) UnmarshalVTUnsafe(dAtA []byte) error { if m.BoolValue == nil { m.BoolValue = &wrapperspb.BoolValue{} } - if err := (*wrapperspb1.BoolValue)(m.BoolValue).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.BoolValue)(m.BoolValue).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1683,7 +1683,7 @@ func (m *MessageWithWKT) UnmarshalVTUnsafe(dAtA []byte) error { if m.StringValue == nil { m.StringValue = &wrapperspb.StringValue{} } - if err := (*wrapperspb1.StringValue)(m.StringValue).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.StringValue)(m.StringValue).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1719,7 +1719,7 @@ func (m *MessageWithWKT) UnmarshalVTUnsafe(dAtA []byte) error { if m.BytesValue == nil { m.BytesValue = &wrapperspb.BytesValue{} } - if err := (*wrapperspb1.BytesValue)(m.BytesValue).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + if err := (*wrapperspb1.BytesValue)(m.BytesValue).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/types/known/anypb/any_vtproto.pb.go b/types/known/anypb/any_vtproto.pb.go index d673606..31da324 100644 --- a/types/known/anypb/any_vtproto.pb.go +++ b/types/known/anypb/any_vtproto.pb.go @@ -463,10 +463,7 @@ func (m *Any) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } + m.Value = dAtA[iNdEx:postIndex] iNdEx = postIndex default: iNdEx = preIndex diff --git a/types/known/wrapperspb/wrappers_vtproto.pb.go b/types/known/wrapperspb/wrappers_vtproto.pb.go index 9d1b7e3..e130e3f 100644 --- a/types/known/wrapperspb/wrappers_vtproto.pb.go +++ b/types/known/wrapperspb/wrappers_vtproto.pb.go @@ -2314,10 +2314,7 @@ func (m *BytesValue) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } + m.Value = dAtA[iNdEx:postIndex] iNdEx = postIndex default: iNdEx = preIndex From 2d484724a3cc53d3ffe4d16552816357381322d6 Mon Sep 17 00:00:00 2001 From: Corentin Dupret Date: Wed, 4 Oct 2023 13:39:47 +0200 Subject: [PATCH 05/10] Update unsafe test and factor it --- testproto/unsafe/unsafe_test.go | 56 ++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/testproto/unsafe/unsafe_test.go b/testproto/unsafe/unsafe_test.go index 4dcacb8..7c46077 100644 --- a/testproto/unsafe/unsafe_test.go +++ b/testproto/unsafe/unsafe_test.go @@ -11,34 +11,46 @@ import ( func Test_UnmarshalVTUnsafe(t *testing.T) { t0 := &UnsafeTest{ - // TODO: add more test cases, consider fuzzing - Foo1: "c4c5cVG%$VG$%_KCREÉŠŻ", - Foo2: []byte{1, 2, 3, 4, 5, 6, 7, 8}, + Foo1: "⚡速いA6@wdkyAiX!7Ls7Tp9_NÉŠŻ⚡", + Foo2: []byte{8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8}, } t0Bytes, err := t0.MarshalVT() require.NoError(t, err) - t1 := &UnsafeTest{} - require.NoError(t, t1.UnmarshalVTUnsafe(t0Bytes)) - require.NotEqual(t, uintptr(unsafe.Pointer(t0)), uintptr(unsafe.Pointer(t1))) - + // Note: this test performs checks on the Data uintptr of headers. It works as long as the garbage collector doesn't + // move memory. To provide guarantee that this test works, consider using https://pkg.go.dev/runtime#Pinner when + // upgrading Go to >= 1.21. t0BytesStart := (*reflect.SliceHeader)(unsafe.Pointer(&t0Bytes)).Data t0BytesEnd := t0BytesStart + uintptr(t0.SizeVT()) - 1 - assert.Equal(t, t0.Foo1, t1.Foo1) - hdr0s := (*reflect.StringHeader)(unsafe.Pointer(&t0.Foo1)) - hdr1s := (*reflect.StringHeader)(unsafe.Pointer(&t1.Foo1)) - assert.False(t, hdr0s.Data > t0BytesStart && hdr0s.Data < t0BytesEnd) - // TODO: maybe add something for UnmarshalVT - // the underlying data of Foo1 belongs to t0Bytes because it is unsafe - assert.True(t, hdr1s.Data > t0BytesStart && hdr1s.Data < t0BytesEnd) - - assert.Equal(t, t0.Foo2, t1.Foo2) - hdr0b := (*reflect.SliceHeader)(unsafe.Pointer(&t0.Foo2)) - hdr1b := (*reflect.SliceHeader)(unsafe.Pointer(&t1.Foo2)) - assert.False(t, hdr0b.Data > t0BytesStart && hdr0b.Data < t0BytesEnd) - // the underlying data of Foo2 belongs to t0Bytes because it is unsafe - // TODO: it fails here, there is an issue with bytes - assert.True(t, hdr1b.Data > t0BytesStart && hdr1b.Data < t0BytesEnd) + // Helper functions to check that the underlying array belongs to t0Bytes + assertStringBelongs := func(s string, belongs bool) { + hdr := (*reflect.StringHeader)(unsafe.Pointer(&s)) + start := hdr.Data + end := start + uintptr(len(s)) - 1 + assert.Equal(t, belongs, start >= t0BytesStart && start < t0BytesEnd) + assert.Equal(t, belongs, end > t0BytesStart && end <= t0BytesEnd) + } + assertBytesBelongs := func(s []byte, belongs bool) { + hdr := (*reflect.SliceHeader)(unsafe.Pointer(&s)) + start := hdr.Data + end := start + uintptr(len(s)) - 1 + assert.Equal(t, belongs, start >= t0BytesStart && start < t0BytesEnd) + assert.Equal(t, belongs, end > t0BytesStart && end <= t0BytesEnd) + } + + t1Safe := &UnsafeTest{} + require.NoError(t, t1Safe.UnmarshalVT(t0Bytes)) + require.NotEqual(t, uintptr(unsafe.Pointer(t0)), uintptr(unsafe.Pointer(t1Safe))) + + assertStringBelongs(t1Safe.Foo1, false) + assertBytesBelongs(t1Safe.Foo2, false) + + t1Unsafe := &UnsafeTest{} + require.NoError(t, t1Unsafe.UnmarshalVTUnsafe(t0Bytes)) + require.NotEqual(t, uintptr(unsafe.Pointer(t0)), uintptr(unsafe.Pointer(t1Unsafe))) + + assertStringBelongs(t1Unsafe.Foo1, true) + assertBytesBelongs(t1Unsafe.Foo2, true) } From b917c4b6cd9a83fb4ec6d3fe9a12ff16d040d7a4 Mon Sep 17 00:00:00 2001 From: Corentin Dupret Date: Wed, 4 Oct 2023 13:49:08 +0200 Subject: [PATCH 06/10] Improve naming in `Test_UnmarshalVTUnsafe` --- testproto/unsafe/unsafe_test.go | 35 +++++++++++++++------------------ 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/testproto/unsafe/unsafe_test.go b/testproto/unsafe/unsafe_test.go index 7c46077..162c1f9 100644 --- a/testproto/unsafe/unsafe_test.go +++ b/testproto/unsafe/unsafe_test.go @@ -14,43 +14,40 @@ func Test_UnmarshalVTUnsafe(t *testing.T) { Foo1: "⚡速いA6@wdkyAiX!7Ls7Tp9_NÉŠŻ⚡", Foo2: []byte{8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8}, } - - t0Bytes, err := t0.MarshalVT() + originalData, err := t0.MarshalVT() require.NoError(t, err) // Note: this test performs checks on the Data uintptr of headers. It works as long as the garbage collector doesn't // move memory. To provide guarantee that this test works, consider using https://pkg.go.dev/runtime#Pinner when // upgrading Go to >= 1.21. - t0BytesStart := (*reflect.SliceHeader)(unsafe.Pointer(&t0Bytes)).Data - t0BytesEnd := t0BytesStart + uintptr(t0.SizeVT()) - 1 + originalStart := (*reflect.SliceHeader)(unsafe.Pointer(&originalData)).Data + originalEnd := originalStart + uintptr(len(originalData)) - 1 - // Helper functions to check that the underlying array belongs to t0Bytes - assertStringBelongs := func(s string, belongs bool) { + // Helper functions to check whether the underlying array belongs to originalData + assertStringIsOriginal := func(s string, isOriginal bool) { hdr := (*reflect.StringHeader)(unsafe.Pointer(&s)) start := hdr.Data end := start + uintptr(len(s)) - 1 - assert.Equal(t, belongs, start >= t0BytesStart && start < t0BytesEnd) - assert.Equal(t, belongs, end > t0BytesStart && end <= t0BytesEnd) + assert.Equal(t, isOriginal, start >= originalStart && start < originalEnd) + assert.Equal(t, isOriginal, end > originalStart && end <= originalEnd) } - assertBytesBelongs := func(s []byte, belongs bool) { + assertBytesIsOriginal := func(s []byte, isOriginal bool) { hdr := (*reflect.SliceHeader)(unsafe.Pointer(&s)) start := hdr.Data end := start + uintptr(len(s)) - 1 - assert.Equal(t, belongs, start >= t0BytesStart && start < t0BytesEnd) - assert.Equal(t, belongs, end > t0BytesStart && end <= t0BytesEnd) + assert.Equal(t, isOriginal, start >= originalStart && start < originalEnd) + assert.Equal(t, isOriginal, end > originalStart && end <= originalEnd) } t1Safe := &UnsafeTest{} - require.NoError(t, t1Safe.UnmarshalVT(t0Bytes)) - require.NotEqual(t, uintptr(unsafe.Pointer(t0)), uintptr(unsafe.Pointer(t1Safe))) + require.NoError(t, t1Safe.UnmarshalVT(originalData)) - assertStringBelongs(t1Safe.Foo1, false) - assertBytesBelongs(t1Safe.Foo2, false) + assertStringIsOriginal(t1Safe.Foo1, false) + assertBytesIsOriginal(t1Safe.Foo2, false) t1Unsafe := &UnsafeTest{} - require.NoError(t, t1Unsafe.UnmarshalVTUnsafe(t0Bytes)) - require.NotEqual(t, uintptr(unsafe.Pointer(t0)), uintptr(unsafe.Pointer(t1Unsafe))) + require.NoError(t, t1Unsafe.UnmarshalVTUnsafe(originalData)) - assertStringBelongs(t1Unsafe.Foo1, true) - assertBytesBelongs(t1Unsafe.Foo2, true) + assertStringIsOriginal(t1Unsafe.Foo1, true) + assertBytesIsOriginal(t1Unsafe.Foo2, true) } From bc970185cce4d1a4285f4b9b964a40ea778f82cd Mon Sep 17 00:00:00 2001 From: Corentin Dupret Date: Wed, 4 Oct 2023 14:47:40 +0200 Subject: [PATCH 07/10] Add more test cases to `Test_UnmarshalVTUnsafe` --- testproto/unsafe/unsafe.pb.go | 422 +++- testproto/unsafe/unsafe.proto | 29 +- testproto/unsafe/unsafe_test.go | 178 +- testproto/unsafe/unsafe_vtproto.pb.go | 2620 +++++++++++++++++++++++-- 4 files changed, 3082 insertions(+), 167 deletions(-) diff --git a/testproto/unsafe/unsafe.pb.go b/testproto/unsafe/unsafe.pb.go index 2437de5..146b98b 100644 --- a/testproto/unsafe/unsafe.pb.go +++ b/testproto/unsafe/unsafe.pb.go @@ -26,8 +26,13 @@ type UnsafeTest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Foo1 string `protobuf:"bytes,1,opt,name=foo1,proto3" json:"foo1,omitempty"` - Foo2 []byte `protobuf:"bytes,2,opt,name=foo2,proto3" json:"foo2,omitempty"` + // Types that are assignable to Sub: + // + // *UnsafeTest_Sub1_ + // *UnsafeTest_Sub2_ + // *UnsafeTest_Sub3_ + // *UnsafeTest_Sub4_ + Sub isUnsafeTest_Sub `protobuf_oneof:"sub"` } func (x *UnsafeTest) Reset() { @@ -62,20 +67,307 @@ func (*UnsafeTest) Descriptor() ([]byte, []int) { return file_unsafe_unsafe_proto_rawDescGZIP(), []int{0} } -func (x *UnsafeTest) GetFoo1() string { +func (m *UnsafeTest) GetSub() isUnsafeTest_Sub { + if m != nil { + return m.Sub + } + return nil +} + +func (x *UnsafeTest) GetSub1() *UnsafeTest_Sub1 { + if x, ok := x.GetSub().(*UnsafeTest_Sub1_); ok { + return x.Sub1 + } + return nil +} + +func (x *UnsafeTest) GetSub2() *UnsafeTest_Sub2 { + if x, ok := x.GetSub().(*UnsafeTest_Sub2_); ok { + return x.Sub2 + } + return nil +} + +func (x *UnsafeTest) GetSub3() *UnsafeTest_Sub3 { + if x, ok := x.GetSub().(*UnsafeTest_Sub3_); ok { + return x.Sub3 + } + return nil +} + +func (x *UnsafeTest) GetSub4() *UnsafeTest_Sub4 { + if x, ok := x.GetSub().(*UnsafeTest_Sub4_); ok { + return x.Sub4 + } + return nil +} + +type isUnsafeTest_Sub interface { + isUnsafeTest_Sub() +} + +type UnsafeTest_Sub1_ struct { + Sub1 *UnsafeTest_Sub1 `protobuf:"bytes,1,opt,name=sub1,proto3,oneof"` +} + +type UnsafeTest_Sub2_ struct { + Sub2 *UnsafeTest_Sub2 `protobuf:"bytes,2,opt,name=sub2,proto3,oneof"` +} + +type UnsafeTest_Sub3_ struct { + Sub3 *UnsafeTest_Sub3 `protobuf:"bytes,3,opt,name=sub3,proto3,oneof"` +} + +type UnsafeTest_Sub4_ struct { + Sub4 *UnsafeTest_Sub4 `protobuf:"bytes,4,opt,name=sub4,proto3,oneof"` +} + +func (*UnsafeTest_Sub1_) isUnsafeTest_Sub() {} + +func (*UnsafeTest_Sub2_) isUnsafeTest_Sub() {} + +func (*UnsafeTest_Sub3_) isUnsafeTest_Sub() {} + +func (*UnsafeTest_Sub4_) isUnsafeTest_Sub() {} + +type UnsafeTest_Sub1 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + S string `protobuf:"bytes,1,opt,name=s,proto3" json:"s,omitempty"` + B []byte `protobuf:"bytes,2,opt,name=b,proto3" json:"b,omitempty"` +} + +func (x *UnsafeTest_Sub1) Reset() { + *x = UnsafeTest_Sub1{} + if protoimpl.UnsafeEnabled { + mi := &file_unsafe_unsafe_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UnsafeTest_Sub1) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnsafeTest_Sub1) ProtoMessage() {} + +func (x *UnsafeTest_Sub1) ProtoReflect() protoreflect.Message { + mi := &file_unsafe_unsafe_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnsafeTest_Sub1.ProtoReflect.Descriptor instead. +func (*UnsafeTest_Sub1) Descriptor() ([]byte, []int) { + return file_unsafe_unsafe_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *UnsafeTest_Sub1) GetS() string { if x != nil { - return x.Foo1 + return x.S } return "" } -func (x *UnsafeTest) GetFoo2() []byte { +func (x *UnsafeTest_Sub1) GetB() []byte { + if x != nil { + return x.B + } + return nil +} + +type UnsafeTest_Sub2 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + S []string `protobuf:"bytes,1,rep,name=s,proto3" json:"s,omitempty"` + B [][]byte `protobuf:"bytes,2,rep,name=b,proto3" json:"b,omitempty"` +} + +func (x *UnsafeTest_Sub2) Reset() { + *x = UnsafeTest_Sub2{} + if protoimpl.UnsafeEnabled { + mi := &file_unsafe_unsafe_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UnsafeTest_Sub2) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnsafeTest_Sub2) ProtoMessage() {} + +func (x *UnsafeTest_Sub2) ProtoReflect() protoreflect.Message { + mi := &file_unsafe_unsafe_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnsafeTest_Sub2.ProtoReflect.Descriptor instead. +func (*UnsafeTest_Sub2) Descriptor() ([]byte, []int) { + return file_unsafe_unsafe_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *UnsafeTest_Sub2) GetS() []string { + if x != nil { + return x.S + } + return nil +} + +func (x *UnsafeTest_Sub2) GetB() [][]byte { if x != nil { - return x.Foo2 + return x.B } return nil } +type UnsafeTest_Sub3 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Foo map[string][]byte `protobuf:"bytes,1,rep,name=foo,proto3" json:"foo,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *UnsafeTest_Sub3) Reset() { + *x = UnsafeTest_Sub3{} + if protoimpl.UnsafeEnabled { + mi := &file_unsafe_unsafe_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UnsafeTest_Sub3) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnsafeTest_Sub3) ProtoMessage() {} + +func (x *UnsafeTest_Sub3) ProtoReflect() protoreflect.Message { + mi := &file_unsafe_unsafe_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnsafeTest_Sub3.ProtoReflect.Descriptor instead. +func (*UnsafeTest_Sub3) Descriptor() ([]byte, []int) { + return file_unsafe_unsafe_proto_rawDescGZIP(), []int{0, 2} +} + +func (x *UnsafeTest_Sub3) GetFoo() map[string][]byte { + if x != nil { + return x.Foo + } + return nil +} + +type UnsafeTest_Sub4 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Foo: + // + // *UnsafeTest_Sub4_S + // *UnsafeTest_Sub4_B + Foo isUnsafeTest_Sub4_Foo `protobuf_oneof:"foo"` +} + +func (x *UnsafeTest_Sub4) Reset() { + *x = UnsafeTest_Sub4{} + if protoimpl.UnsafeEnabled { + mi := &file_unsafe_unsafe_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UnsafeTest_Sub4) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnsafeTest_Sub4) ProtoMessage() {} + +func (x *UnsafeTest_Sub4) ProtoReflect() protoreflect.Message { + mi := &file_unsafe_unsafe_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnsafeTest_Sub4.ProtoReflect.Descriptor instead. +func (*UnsafeTest_Sub4) Descriptor() ([]byte, []int) { + return file_unsafe_unsafe_proto_rawDescGZIP(), []int{0, 3} +} + +func (m *UnsafeTest_Sub4) GetFoo() isUnsafeTest_Sub4_Foo { + if m != nil { + return m.Foo + } + return nil +} + +func (x *UnsafeTest_Sub4) GetS() string { + if x, ok := x.GetFoo().(*UnsafeTest_Sub4_S); ok { + return x.S + } + return "" +} + +func (x *UnsafeTest_Sub4) GetB() []byte { + if x, ok := x.GetFoo().(*UnsafeTest_Sub4_B); ok { + return x.B + } + return nil +} + +type isUnsafeTest_Sub4_Foo interface { + isUnsafeTest_Sub4_Foo() +} + +type UnsafeTest_Sub4_S struct { + S string `protobuf:"bytes,1,opt,name=s,proto3,oneof"` +} + +type UnsafeTest_Sub4_B struct { + B []byte `protobuf:"bytes,2,opt,name=b,proto3,oneof"` +} + +func (*UnsafeTest_Sub4_S) isUnsafeTest_Sub4_Foo() {} + +func (*UnsafeTest_Sub4_B) isUnsafeTest_Sub4_Foo() {} + var File_unsafe_unsafe_proto protoreflect.FileDescriptor var file_unsafe_unsafe_proto_rawDesc = []byte{ @@ -83,12 +375,34 @@ var file_unsafe_unsafe_proto_rawDesc = []byte{ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x74, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x0a, 0x55, 0x6e, - 0x73, 0x61, 0x66, 0x65, 0x54, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6f, 0x6f, 0x31, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6f, 0x6f, 0x31, 0x12, 0x12, 0x0a, 0x04, - 0x66, 0x6f, 0x6f, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x66, 0x6f, 0x6f, 0x32, - 0x42, 0x12, 0x5a, 0x10, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x75, 0x6e, - 0x73, 0x61, 0x66, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2f, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x97, 0x03, 0x0a, 0x0a, 0x55, + 0x6e, 0x73, 0x61, 0x66, 0x65, 0x54, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x75, 0x62, + 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, + 0x54, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x75, 0x62, 0x31, 0x48, 0x00, 0x52, 0x04, 0x73, 0x75, 0x62, + 0x31, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x75, 0x62, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x10, 0x2e, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x54, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x75, 0x62, + 0x32, 0x48, 0x00, 0x52, 0x04, 0x73, 0x75, 0x62, 0x32, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x75, 0x62, + 0x33, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, + 0x54, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x75, 0x62, 0x33, 0x48, 0x00, 0x52, 0x04, 0x73, 0x75, 0x62, + 0x33, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x75, 0x62, 0x34, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x10, 0x2e, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x54, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x75, 0x62, + 0x34, 0x48, 0x00, 0x52, 0x04, 0x73, 0x75, 0x62, 0x34, 0x1a, 0x22, 0x0a, 0x04, 0x53, 0x75, 0x62, + 0x31, 0x12, 0x0c, 0x0a, 0x01, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x73, 0x12, + 0x0c, 0x0a, 0x01, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x01, 0x62, 0x1a, 0x22, 0x0a, + 0x04, 0x53, 0x75, 0x62, 0x32, 0x12, 0x0c, 0x0a, 0x01, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x01, 0x73, 0x12, 0x0c, 0x0a, 0x01, 0x62, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x01, + 0x62, 0x1a, 0x6b, 0x0a, 0x04, 0x53, 0x75, 0x62, 0x33, 0x12, 0x2b, 0x0a, 0x03, 0x66, 0x6f, 0x6f, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x54, + 0x65, 0x73, 0x74, 0x2e, 0x53, 0x75, 0x62, 0x33, 0x2e, 0x46, 0x6f, 0x6f, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x03, 0x66, 0x6f, 0x6f, 0x1a, 0x36, 0x0a, 0x08, 0x46, 0x6f, 0x6f, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x2d, + 0x0a, 0x04, 0x53, 0x75, 0x62, 0x34, 0x12, 0x0e, 0x0a, 0x01, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x01, 0x73, 0x12, 0x0e, 0x0a, 0x01, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x48, 0x00, 0x52, 0x01, 0x62, 0x42, 0x05, 0x0a, 0x03, 0x66, 0x6f, 0x6f, 0x42, 0x05, 0x0a, + 0x03, 0x73, 0x75, 0x62, 0x42, 0x12, 0x5a, 0x10, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x75, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -103,16 +417,26 @@ func file_unsafe_unsafe_proto_rawDescGZIP() []byte { return file_unsafe_unsafe_proto_rawDescData } -var file_unsafe_unsafe_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_unsafe_unsafe_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_unsafe_unsafe_proto_goTypes = []interface{}{ - (*UnsafeTest)(nil), // 0: UnsafeTest + (*UnsafeTest)(nil), // 0: UnsafeTest + (*UnsafeTest_Sub1)(nil), // 1: UnsafeTest.Sub1 + (*UnsafeTest_Sub2)(nil), // 2: UnsafeTest.Sub2 + (*UnsafeTest_Sub3)(nil), // 3: UnsafeTest.Sub3 + (*UnsafeTest_Sub4)(nil), // 4: UnsafeTest.Sub4 + nil, // 5: UnsafeTest.Sub3.FooEntry } var file_unsafe_unsafe_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 1, // 0: UnsafeTest.sub1:type_name -> UnsafeTest.Sub1 + 2, // 1: UnsafeTest.sub2:type_name -> UnsafeTest.Sub2 + 3, // 2: UnsafeTest.sub3:type_name -> UnsafeTest.Sub3 + 4, // 3: UnsafeTest.sub4:type_name -> UnsafeTest.Sub4 + 5, // 4: UnsafeTest.Sub3.foo:type_name -> UnsafeTest.Sub3.FooEntry + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_unsafe_unsafe_proto_init() } @@ -133,6 +457,64 @@ func file_unsafe_unsafe_proto_init() { return nil } } + file_unsafe_unsafe_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UnsafeTest_Sub1); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_unsafe_unsafe_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UnsafeTest_Sub2); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_unsafe_unsafe_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UnsafeTest_Sub3); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_unsafe_unsafe_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UnsafeTest_Sub4); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_unsafe_unsafe_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*UnsafeTest_Sub1_)(nil), + (*UnsafeTest_Sub2_)(nil), + (*UnsafeTest_Sub3_)(nil), + (*UnsafeTest_Sub4_)(nil), + } + file_unsafe_unsafe_proto_msgTypes[4].OneofWrappers = []interface{}{ + (*UnsafeTest_Sub4_S)(nil), + (*UnsafeTest_Sub4_B)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -140,7 +522,7 @@ func file_unsafe_unsafe_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_unsafe_unsafe_proto_rawDesc, NumEnums: 0, - NumMessages: 1, + NumMessages: 6, NumExtensions: 0, NumServices: 0, }, diff --git a/testproto/unsafe/unsafe.proto b/testproto/unsafe/unsafe.proto index 66aeacc..4bd7003 100644 --- a/testproto/unsafe/unsafe.proto +++ b/testproto/unsafe/unsafe.proto @@ -4,6 +4,31 @@ option go_package = "testproto/unsafe"; import "github.com/planetscale/vtprotobuf/vtproto/ext.proto"; message UnsafeTest { - string foo1 = 1; - bytes foo2 = 2; + message Sub1 { + string s = 1; + bytes b = 2; + } + + message Sub2 { + repeated string s = 1; + repeated bytes b = 2; + } + + message Sub3 { + map foo = 1; + } + + message Sub4 { + oneof foo { + string s = 1; + bytes b = 2; + } + } + + oneof sub { + Sub1 sub1 = 1; + Sub2 sub2 = 2; + Sub3 sub3 = 3; + Sub4 sub4 = 4; + } } diff --git a/testproto/unsafe/unsafe_test.go b/testproto/unsafe/unsafe_test.go index 162c1f9..3ae4fb4 100644 --- a/testproto/unsafe/unsafe_test.go +++ b/testproto/unsafe/unsafe_test.go @@ -9,45 +9,163 @@ import ( "github.com/stretchr/testify/require" ) +// assertStringIsOriginal asserts whether the underlying array of s belongs to originalData. +// +// Note: performing checks on the Data uintptr of headers works as long as the garbage collector +// doesn't move memory. To provide guarantee that this test works, consider using +// https://pkg.go.dev/runtime#Pinner when upgrading Go to >= 1.21. +func assertStringIsOriginal(t *testing.T, s string, belongs bool, originalData []byte) { + originalStart := (*reflect.SliceHeader)(unsafe.Pointer(&originalData)).Data + originalEnd := originalStart + uintptr(len(originalData)) - 1 + + hdr := (*reflect.StringHeader)(unsafe.Pointer(&s)) + start := hdr.Data + end := start + uintptr(len(s)) - 1 + assert.Equal(t, belongs, start >= originalStart && start < originalEnd) + assert.Equal(t, belongs, end > originalStart && end <= originalEnd) +} + +// assertBytesAreOriginal is the same as assertStringIsOriginal for a []byte. +func assertBytesAreOriginal(t *testing.T, b []byte, belongs bool, originalData []byte) { + originalStart := (*reflect.SliceHeader)(unsafe.Pointer(&originalData)).Data + originalEnd := originalStart + uintptr(len(originalData)) - 1 + + hdr := (*reflect.SliceHeader)(unsafe.Pointer(&b)) + start := hdr.Data + end := start + uintptr(len(b)) - 1 + assert.Equal(t, belongs, start >= originalStart && start < originalEnd) + assert.Equal(t, belongs, end > originalStart && end <= originalEnd) +} + func Test_UnmarshalVTUnsafe(t *testing.T) { - t0 := &UnsafeTest{ - Foo1: "⚡速いA6@wdkyAiX!7Ls7Tp9_NÉŠŻ⚡", - Foo2: []byte{8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8}, + testString := "⚡速いA6@wdkyAiX!7Ls7Tp9_NÉŠŻ⚡" + testBytes := []byte{8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8} + + // simple case + t1Orig := &UnsafeTest{ + Sub: &UnsafeTest_Sub1_{ + Sub1: &UnsafeTest_Sub1{ + S: testString, + B: testBytes, + }, + }, } - originalData, err := t0.MarshalVT() + originalData1, err := t1Orig.MarshalVT() require.NoError(t, err) - // Note: this test performs checks on the Data uintptr of headers. It works as long as the garbage collector doesn't - // move memory. To provide guarantee that this test works, consider using https://pkg.go.dev/runtime#Pinner when - // upgrading Go to >= 1.21. - originalStart := (*reflect.SliceHeader)(unsafe.Pointer(&originalData)).Data - originalEnd := originalStart + uintptr(len(originalData)) - 1 + t1Safe := &UnsafeTest{} + require.NoError(t, t1Safe.UnmarshalVT(originalData1)) + assert.Equal(t, (t1Orig.Sub).(*UnsafeTest_Sub1_).Sub1.S, (t1Safe.Sub).(*UnsafeTest_Sub1_).Sub1.S) + assert.Equal(t, (t1Orig.Sub).(*UnsafeTest_Sub1_).Sub1.B, (t1Safe.Sub).(*UnsafeTest_Sub1_).Sub1.B) + assertStringIsOriginal(t, (t1Safe.Sub).(*UnsafeTest_Sub1_).Sub1.S, false, originalData1) + assertBytesAreOriginal(t, (t1Safe.Sub).(*UnsafeTest_Sub1_).Sub1.B, false, originalData1) - // Helper functions to check whether the underlying array belongs to originalData - assertStringIsOriginal := func(s string, isOriginal bool) { - hdr := (*reflect.StringHeader)(unsafe.Pointer(&s)) - start := hdr.Data - end := start + uintptr(len(s)) - 1 - assert.Equal(t, isOriginal, start >= originalStart && start < originalEnd) - assert.Equal(t, isOriginal, end > originalStart && end <= originalEnd) + t1Unsafe := &UnsafeTest{} + require.NoError(t, t1Unsafe.UnmarshalVTUnsafe(originalData1)) + assert.Equal(t, (t1Orig.Sub).(*UnsafeTest_Sub1_).Sub1.S, (t1Unsafe.Sub).(*UnsafeTest_Sub1_).Sub1.S) + assert.Equal(t, (t1Orig.Sub).(*UnsafeTest_Sub1_).Sub1.B, (t1Unsafe.Sub).(*UnsafeTest_Sub1_).Sub1.B) + assertStringIsOriginal(t, (t1Unsafe.Sub).(*UnsafeTest_Sub1_).Sub1.S, true, originalData1) + assertBytesAreOriginal(t, (t1Unsafe.Sub).(*UnsafeTest_Sub1_).Sub1.B, true, originalData1) + + // repeated field + t2Orig := &UnsafeTest{ + Sub: &UnsafeTest_Sub2_{ + Sub2: &UnsafeTest_Sub2{ + S: []string{testString, testString, testString}, + B: [][]byte{testBytes, testBytes, testBytes}, + }, + }, } - assertBytesIsOriginal := func(s []byte, isOriginal bool) { - hdr := (*reflect.SliceHeader)(unsafe.Pointer(&s)) - start := hdr.Data - end := start + uintptr(len(s)) - 1 - assert.Equal(t, isOriginal, start >= originalStart && start < originalEnd) - assert.Equal(t, isOriginal, end > originalStart && end <= originalEnd) + originalData2, err := t2Orig.MarshalVT() + require.NoError(t, err) + + t2Safe := &UnsafeTest{} + require.NoError(t, t2Safe.UnmarshalVT(originalData2)) + assert.Equal(t, (t2Orig.Sub).(*UnsafeTest_Sub2_).Sub2.S, (t2Safe.Sub).(*UnsafeTest_Sub2_).Sub2.S) + assert.Equal(t, (t2Orig.Sub).(*UnsafeTest_Sub2_).Sub2.B, (t2Safe.Sub).(*UnsafeTest_Sub2_).Sub2.B) + for i := 0; i < 3; i++ { + assertStringIsOriginal(t, (t2Safe.Sub).(*UnsafeTest_Sub2_).Sub2.S[i], false, originalData2) + assertBytesAreOriginal(t, (t2Safe.Sub).(*UnsafeTest_Sub2_).Sub2.B[i], false, originalData2) } - t1Safe := &UnsafeTest{} - require.NoError(t, t1Safe.UnmarshalVT(originalData)) + t2Unsafe := &UnsafeTest{} + require.NoError(t, t2Unsafe.UnmarshalVTUnsafe(originalData2)) + assert.Equal(t, (t2Orig.Sub).(*UnsafeTest_Sub2_).Sub2.S, (t2Unsafe.Sub).(*UnsafeTest_Sub2_).Sub2.S) + assert.Equal(t, (t2Orig.Sub).(*UnsafeTest_Sub2_).Sub2.B, (t2Unsafe.Sub).(*UnsafeTest_Sub2_).Sub2.B) + for i := 0; i < 3; i++ { + assertStringIsOriginal(t, (t2Unsafe.Sub).(*UnsafeTest_Sub2_).Sub2.S[i], true, originalData2) + assertBytesAreOriginal(t, (t2Unsafe.Sub).(*UnsafeTest_Sub2_).Sub2.B[i], true, originalData2) + } - assertStringIsOriginal(t1Safe.Foo1, false) - assertBytesIsOriginal(t1Safe.Foo2, false) + // map field + t3Orig := &UnsafeTest{ + Sub: &UnsafeTest_Sub3_{ + Sub3: &UnsafeTest_Sub3{ + Foo: map[string][]byte{testString: testBytes}, + }, + }, + } + originalData3, err := t3Orig.MarshalVT() + require.NoError(t, err) - t1Unsafe := &UnsafeTest{} - require.NoError(t, t1Unsafe.UnmarshalVTUnsafe(originalData)) + t3Safe := &UnsafeTest{} + require.NoError(t, t3Safe.UnmarshalVT(originalData3)) + assert.Equal(t, (t3Orig.Sub).(*UnsafeTest_Sub3_).Sub3.Foo, (t3Safe.Sub).(*UnsafeTest_Sub3_).Sub3.Foo) + for k, v := range (t3Safe.Sub).(*UnsafeTest_Sub3_).Sub3.Foo { + assertStringIsOriginal(t, k, false, originalData3) + assertBytesAreOriginal(t, v, false, originalData3) + } + + t3Unsafe := &UnsafeTest{} + require.NoError(t, t3Unsafe.UnmarshalVTUnsafe(originalData3)) + assert.Equal(t, (t3Orig.Sub).(*UnsafeTest_Sub3_).Sub3.Foo, (t3Unsafe.Sub).(*UnsafeTest_Sub3_).Sub3.Foo) + for k, v := range (t3Unsafe.Sub).(*UnsafeTest_Sub3_).Sub3.Foo { + assertStringIsOriginal(t, k, true, originalData3) + assertBytesAreOriginal(t, v, true, originalData3) + } + + // oneof field + t4OrigS := &UnsafeTest{ + Sub: &UnsafeTest_Sub4_{ + Sub4: &UnsafeTest_Sub4{ + Foo: &UnsafeTest_Sub4_S{ + S: testString, + }, + }, + }, + } + originalData4S, err := t4OrigS.MarshalVT() + require.NoError(t, err) + + t4SafeS := &UnsafeTest{} + require.NoError(t, t4SafeS.UnmarshalVT(originalData4S)) + assert.Equal(t, (t4OrigS.Sub).(*UnsafeTest_Sub4_).Sub4.Foo.(*UnsafeTest_Sub4_S).S, (t4SafeS.Sub).(*UnsafeTest_Sub4_).Sub4.Foo.(*UnsafeTest_Sub4_S).S) + assertStringIsOriginal(t, (t4SafeS.Sub).(*UnsafeTest_Sub4_).Sub4.Foo.(*UnsafeTest_Sub4_S).S, false, originalData4S) + + t4UnsafeS := &UnsafeTest{} + require.NoError(t, t4UnsafeS.UnmarshalVTUnsafe(originalData4S)) + assert.Equal(t, (t4OrigS.Sub).(*UnsafeTest_Sub4_).Sub4.Foo.(*UnsafeTest_Sub4_S).S, (t4UnsafeS.Sub).(*UnsafeTest_Sub4_).Sub4.Foo.(*UnsafeTest_Sub4_S).S) + assertStringIsOriginal(t, (t4UnsafeS.Sub).(*UnsafeTest_Sub4_).Sub4.Foo.(*UnsafeTest_Sub4_S).S, true, originalData4S) + + t4OrigB := &UnsafeTest{ + Sub: &UnsafeTest_Sub4_{ + Sub4: &UnsafeTest_Sub4{ + Foo: &UnsafeTest_Sub4_B{ + B: testBytes, + }, + }, + }, + } + originalData4B, err := t4OrigB.MarshalVT() + require.NoError(t, err) + + t4SafeB := &UnsafeTest{} + require.NoError(t, t4SafeB.UnmarshalVT(originalData4B)) + assert.Equal(t, (t4OrigB.Sub).(*UnsafeTest_Sub4_).Sub4.Foo.(*UnsafeTest_Sub4_B).B, (t4SafeB.Sub).(*UnsafeTest_Sub4_).Sub4.Foo.(*UnsafeTest_Sub4_B).B) + assertBytesAreOriginal(t, (t4SafeB.Sub).(*UnsafeTest_Sub4_).Sub4.Foo.(*UnsafeTest_Sub4_B).B, false, originalData4B) - assertStringIsOriginal(t1Unsafe.Foo1, true) - assertBytesIsOriginal(t1Unsafe.Foo2, true) + t4UnsafeB := &UnsafeTest{} + require.NoError(t, t4UnsafeB.UnmarshalVTUnsafe(originalData4B)) + assert.Equal(t, (t4OrigB.Sub).(*UnsafeTest_Sub4_).Sub4.Foo.(*UnsafeTest_Sub4_B).B, (t4UnsafeB.Sub).(*UnsafeTest_Sub4_).Sub4.Foo.(*UnsafeTest_Sub4_B).B) + assertBytesAreOriginal(t, (t4UnsafeB.Sub).(*UnsafeTest_Sub4_).Sub4.Foo.(*UnsafeTest_Sub4_B).B, true, originalData4B) } diff --git a/testproto/unsafe/unsafe_vtproto.pb.go b/testproto/unsafe/unsafe_vtproto.pb.go index a54079b..20aefe3 100644 --- a/testproto/unsafe/unsafe_vtproto.pb.go +++ b/testproto/unsafe/unsafe_vtproto.pb.go @@ -20,16 +20,131 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +func (m *UnsafeTest_Sub1) CloneVT() *UnsafeTest_Sub1 { + if m == nil { + return (*UnsafeTest_Sub1)(nil) + } + r := new(UnsafeTest_Sub1) + r.S = m.S + if rhs := m.B; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.B = tmpBytes + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *UnsafeTest_Sub1) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *UnsafeTest_Sub2) CloneVT() *UnsafeTest_Sub2 { + if m == nil { + return (*UnsafeTest_Sub2)(nil) + } + r := new(UnsafeTest_Sub2) + if rhs := m.S; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.S = tmpContainer + } + if rhs := m.B; rhs != nil { + tmpContainer := make([][]byte, len(rhs)) + for k, v := range rhs { + tmpBytes := make([]byte, len(v)) + copy(tmpBytes, v) + tmpContainer[k] = tmpBytes + } + r.B = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *UnsafeTest_Sub2) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *UnsafeTest_Sub3) CloneVT() *UnsafeTest_Sub3 { + if m == nil { + return (*UnsafeTest_Sub3)(nil) + } + r := new(UnsafeTest_Sub3) + if rhs := m.Foo; rhs != nil { + tmpContainer := make(map[string][]byte, len(rhs)) + for k, v := range rhs { + tmpBytes := make([]byte, len(v)) + copy(tmpBytes, v) + tmpContainer[k] = tmpBytes + } + r.Foo = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *UnsafeTest_Sub3) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *UnsafeTest_Sub4) CloneVT() *UnsafeTest_Sub4 { + if m == nil { + return (*UnsafeTest_Sub4)(nil) + } + r := new(UnsafeTest_Sub4) + if m.Foo != nil { + r.Foo = m.Foo.(interface{ CloneVT() isUnsafeTest_Sub4_Foo }).CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *UnsafeTest_Sub4) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *UnsafeTest_Sub4_S) CloneVT() isUnsafeTest_Sub4_Foo { + if m == nil { + return (*UnsafeTest_Sub4_S)(nil) + } + r := new(UnsafeTest_Sub4_S) + r.S = m.S + return r +} + +func (m *UnsafeTest_Sub4_B) CloneVT() isUnsafeTest_Sub4_Foo { + if m == nil { + return (*UnsafeTest_Sub4_B)(nil) + } + r := new(UnsafeTest_Sub4_B) + if rhs := m.B; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.B = tmpBytes + } + return r +} + func (m *UnsafeTest) CloneVT() *UnsafeTest { if m == nil { return (*UnsafeTest)(nil) } r := new(UnsafeTest) - r.Foo1 = m.Foo1 - if rhs := m.Foo2; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.Foo2 = tmpBytes + if m.Sub != nil { + r.Sub = m.Sub.(interface{ CloneVT() isUnsafeTest_Sub }).CloneVT() } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) @@ -42,17 +157,203 @@ func (m *UnsafeTest) CloneMessageVT() proto.Message { return m.CloneVT() } -func (this *UnsafeTest) EqualVT(that *UnsafeTest) bool { +func (m *UnsafeTest_Sub1_) CloneVT() isUnsafeTest_Sub { + if m == nil { + return (*UnsafeTest_Sub1_)(nil) + } + r := new(UnsafeTest_Sub1_) + r.Sub1 = m.Sub1.CloneVT() + return r +} + +func (m *UnsafeTest_Sub2_) CloneVT() isUnsafeTest_Sub { + if m == nil { + return (*UnsafeTest_Sub2_)(nil) + } + r := new(UnsafeTest_Sub2_) + r.Sub2 = m.Sub2.CloneVT() + return r +} + +func (m *UnsafeTest_Sub3_) CloneVT() isUnsafeTest_Sub { + if m == nil { + return (*UnsafeTest_Sub3_)(nil) + } + r := new(UnsafeTest_Sub3_) + r.Sub3 = m.Sub3.CloneVT() + return r +} + +func (m *UnsafeTest_Sub4_) CloneVT() isUnsafeTest_Sub { + if m == nil { + return (*UnsafeTest_Sub4_)(nil) + } + r := new(UnsafeTest_Sub4_) + r.Sub4 = m.Sub4.CloneVT() + return r +} + +func (this *UnsafeTest_Sub1) EqualVT(that *UnsafeTest_Sub1) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.S != that.S { + return false + } + if string(this.B) != string(that.B) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *UnsafeTest_Sub1) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*UnsafeTest_Sub1) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *UnsafeTest_Sub2) EqualVT(that *UnsafeTest_Sub2) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if len(this.S) != len(that.S) { + return false + } + for i, vx := range this.S { + vy := that.S[i] + if vx != vy { + return false + } + } + if len(this.B) != len(that.B) { + return false + } + for i, vx := range this.B { + vy := that.B[i] + if string(vx) != string(vy) { + return false + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *UnsafeTest_Sub2) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*UnsafeTest_Sub2) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *UnsafeTest_Sub3) EqualVT(that *UnsafeTest_Sub3) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if len(this.Foo) != len(that.Foo) { + return false + } + for i, vx := range this.Foo { + vy, ok := that.Foo[i] + if !ok { + return false + } + if string(vx) != string(vy) { + return false + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *UnsafeTest_Sub3) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*UnsafeTest_Sub3) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *UnsafeTest_Sub4) EqualVT(that *UnsafeTest_Sub4) bool { if this == that { return true } else if this == nil || that == nil { return false } - if this.Foo1 != that.Foo1 { + if this.Foo == nil && that.Foo != nil { + return false + } else if this.Foo != nil { + if that.Foo == nil { + return false + } + if !this.Foo.(interface { + EqualVT(isUnsafeTest_Sub4_Foo) bool + }).EqualVT(that.Foo) { + return false + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *UnsafeTest_Sub4) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*UnsafeTest_Sub4) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *UnsafeTest_Sub4_S) EqualVT(thatIface isUnsafeTest_Sub4_Foo) bool { + that, ok := thatIface.(*UnsafeTest_Sub4_S) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if this.S != that.S { + return false + } + return true +} + +func (this *UnsafeTest_Sub4_B) EqualVT(thatIface isUnsafeTest_Sub4_Foo) bool { + that, ok := thatIface.(*UnsafeTest_Sub4_B) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if string(this.B) != string(that.B) { + return false + } + return true +} + +func (this *UnsafeTest) EqualVT(that *UnsafeTest) bool { + if this == that { + return true + } else if this == nil || that == nil { return false } - if string(this.Foo2) != string(that.Foo2) { + if this.Sub == nil && that.Sub != nil { return false + } else if this.Sub != nil { + if that.Sub == nil { + return false + } + if !this.Sub.(interface{ EqualVT(isUnsafeTest_Sub) bool }).EqualVT(that.Sub) { + return false + } } return string(this.unknownFields) == string(that.unknownFields) } @@ -64,7 +365,107 @@ func (this *UnsafeTest) EqualMessageVT(thatMsg proto.Message) bool { } return this.EqualVT(that) } -func (m *UnsafeTest) MarshalVT() (dAtA []byte, err error) { +func (this *UnsafeTest_Sub1_) EqualVT(thatIface isUnsafeTest_Sub) bool { + that, ok := thatIface.(*UnsafeTest_Sub1_) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if p, q := this.Sub1, that.Sub1; p != q { + if p == nil { + p = &UnsafeTest_Sub1{} + } + if q == nil { + q = &UnsafeTest_Sub1{} + } + if !p.EqualVT(q) { + return false + } + } + return true +} + +func (this *UnsafeTest_Sub2_) EqualVT(thatIface isUnsafeTest_Sub) bool { + that, ok := thatIface.(*UnsafeTest_Sub2_) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if p, q := this.Sub2, that.Sub2; p != q { + if p == nil { + p = &UnsafeTest_Sub2{} + } + if q == nil { + q = &UnsafeTest_Sub2{} + } + if !p.EqualVT(q) { + return false + } + } + return true +} + +func (this *UnsafeTest_Sub3_) EqualVT(thatIface isUnsafeTest_Sub) bool { + that, ok := thatIface.(*UnsafeTest_Sub3_) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if p, q := this.Sub3, that.Sub3; p != q { + if p == nil { + p = &UnsafeTest_Sub3{} + } + if q == nil { + q = &UnsafeTest_Sub3{} + } + if !p.EqualVT(q) { + return false + } + } + return true +} + +func (this *UnsafeTest_Sub4_) EqualVT(thatIface isUnsafeTest_Sub) bool { + that, ok := thatIface.(*UnsafeTest_Sub4_) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if p, q := this.Sub4, that.Sub4; p != q { + if p == nil { + p = &UnsafeTest_Sub4{} + } + if q == nil { + q = &UnsafeTest_Sub4{} + } + if !p.EqualVT(q) { + return false + } + } + return true +} + +func (m *UnsafeTest_Sub1) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil } @@ -77,12 +478,12 @@ func (m *UnsafeTest) MarshalVT() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *UnsafeTest) MarshalToVT(dAtA []byte) (int, error) { +func (m *UnsafeTest_Sub1) MarshalToVT(dAtA []byte) (int, error) { size := m.SizeVT() return m.MarshalToSizedBufferVT(dAtA[:size]) } -func (m *UnsafeTest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { +func (m *UnsafeTest_Sub1) MarshalToSizedBufferVT(dAtA []byte) (int, error) { if m == nil { return 0, nil } @@ -94,35 +495,326 @@ func (m *UnsafeTest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if len(m.Foo2) > 0 { - i -= len(m.Foo2) - copy(dAtA[i:], m.Foo2) - i = encodeVarint(dAtA, i, uint64(len(m.Foo2))) + if len(m.B) > 0 { + i -= len(m.B) + copy(dAtA[i:], m.B) + i = encodeVarint(dAtA, i, uint64(len(m.B))) i-- dAtA[i] = 0x12 } - if len(m.Foo1) > 0 { - i -= len(m.Foo1) - copy(dAtA[i:], m.Foo1) - i = encodeVarint(dAtA, i, uint64(len(m.Foo1))) + if len(m.S) > 0 { + i -= len(m.S) + copy(dAtA[i:], m.S) + i = encodeVarint(dAtA, i, uint64(len(m.S))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func encodeVarint(dAtA []byte, offset int, v uint64) int { - offset -= sov(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 +func (m *UnsafeTest_Sub2) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UnsafeTest_Sub2) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *UnsafeTest_Sub2) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.B) > 0 { + for iNdEx := len(m.B) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.B[iNdEx]) + copy(dAtA[i:], m.B[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.B[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.S) > 0 { + for iNdEx := len(m.S) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.S[iNdEx]) + copy(dAtA[i:], m.S[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.S[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *UnsafeTest_Sub3) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UnsafeTest_Sub3) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *UnsafeTest_Sub3) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Foo) > 0 { + for k := range m.Foo { + v := m.Foo[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarint(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *UnsafeTest_Sub4) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UnsafeTest_Sub4) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *UnsafeTest_Sub4) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if vtmsg, ok := m.Foo.(interface { + MarshalToSizedBufferVT([]byte) (int, error) + }); ok { + size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + return len(dAtA) - i, nil +} + +func (m *UnsafeTest_Sub4_S) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *UnsafeTest_Sub4_S) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.S) + copy(dAtA[i:], m.S) + i = encodeVarint(dAtA, i, uint64(len(m.S))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} +func (m *UnsafeTest_Sub4_B) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *UnsafeTest_Sub4_B) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.B) + copy(dAtA[i:], m.B) + i = encodeVarint(dAtA, i, uint64(len(m.B))) + i-- + dAtA[i] = 0x12 + return len(dAtA) - i, nil +} +func (m *UnsafeTest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UnsafeTest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *UnsafeTest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if vtmsg, ok := m.Sub.(interface { + MarshalToSizedBufferVT([]byte) (int, error) + }); ok { + size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + return len(dAtA) - i, nil +} + +func (m *UnsafeTest_Sub1_) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *UnsafeTest_Sub1_) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Sub1 != nil { + size, err := m.Sub1.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *UnsafeTest_Sub2_) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *UnsafeTest_Sub2_) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Sub2 != nil { + size, err := m.Sub2.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *UnsafeTest_Sub3_) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *UnsafeTest_Sub3_) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Sub3 != nil { + size, err := m.Sub3.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} +func (m *UnsafeTest_Sub4_) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *UnsafeTest_Sub4_) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Sub4 != nil { + size, err := m.Sub4.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } + return len(dAtA) - i, nil +} +func encodeVarint(dAtA []byte, offset int, v uint64) int { + offset -= sov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 offset++ } dAtA[offset] = uint8(v) return base } -func (m *UnsafeTest) MarshalVTStrict() (dAtA []byte, err error) { +func (m *UnsafeTest_Sub1) MarshalVTStrict() (dAtA []byte, err error) { if m == nil { return nil, nil } @@ -135,12 +827,12 @@ func (m *UnsafeTest) MarshalVTStrict() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *UnsafeTest) MarshalToVTStrict(dAtA []byte) (int, error) { +func (m *UnsafeTest_Sub1) MarshalToVTStrict(dAtA []byte) (int, error) { size := m.SizeVT() return m.MarshalToSizedBufferVTStrict(dAtA[:size]) } -func (m *UnsafeTest) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { +func (m *UnsafeTest_Sub1) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { if m == nil { return 0, nil } @@ -152,48 +844,1441 @@ func (m *UnsafeTest) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if len(m.Foo2) > 0 { - i -= len(m.Foo2) - copy(dAtA[i:], m.Foo2) - i = encodeVarint(dAtA, i, uint64(len(m.Foo2))) + if len(m.B) > 0 { + i -= len(m.B) + copy(dAtA[i:], m.B) + i = encodeVarint(dAtA, i, uint64(len(m.B))) i-- dAtA[i] = 0x12 } - if len(m.Foo1) > 0 { - i -= len(m.Foo1) - copy(dAtA[i:], m.Foo1) - i = encodeVarint(dAtA, i, uint64(len(m.Foo1))) + if len(m.S) > 0 { + i -= len(m.S) + copy(dAtA[i:], m.S) + i = encodeVarint(dAtA, i, uint64(len(m.S))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *UnsafeTest) SizeVT() (n int) { +func (m *UnsafeTest_Sub2) MarshalVTStrict() (dAtA []byte, err error) { if m == nil { - return 0 + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UnsafeTest_Sub2) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *UnsafeTest_Sub2) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil } + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Foo1) - if l > 0 { - n += 1 + l + sov(uint64(l)) + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) } - l = len(m.Foo2) - if l > 0 { - n += 1 + l + sov(uint64(l)) + if len(m.B) > 0 { + for iNdEx := len(m.B) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.B[iNdEx]) + copy(dAtA[i:], m.B[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.B[iNdEx]))) + i-- + dAtA[i] = 0x12 + } } - n += len(m.unknownFields) - return n + if len(m.S) > 0 { + for iNdEx := len(m.S) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.S[iNdEx]) + copy(dAtA[i:], m.S[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.S[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil } -func sov(x uint64) (n int) { - return (bits.Len64(x|1) + 6) / 7 +func (m *UnsafeTest_Sub3) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -func soz(x uint64) (n int) { - return sov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + +func (m *UnsafeTest_Sub3) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) } -func (m *UnsafeTest) UnmarshalVT(dAtA []byte) error { + +func (m *UnsafeTest_Sub3) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Foo) > 0 { + for k := range m.Foo { + v := m.Foo[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarint(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *UnsafeTest_Sub4) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UnsafeTest_Sub4) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *UnsafeTest_Sub4) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if msg, ok := m.Foo.(*UnsafeTest_Sub4_B); ok { + size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + if msg, ok := m.Foo.(*UnsafeTest_Sub4_S); ok { + size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + return len(dAtA) - i, nil +} + +func (m *UnsafeTest_Sub4_S) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *UnsafeTest_Sub4_S) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.S) + copy(dAtA[i:], m.S) + i = encodeVarint(dAtA, i, uint64(len(m.S))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} +func (m *UnsafeTest_Sub4_B) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *UnsafeTest_Sub4_B) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.B) + copy(dAtA[i:], m.B) + i = encodeVarint(dAtA, i, uint64(len(m.B))) + i-- + dAtA[i] = 0x12 + return len(dAtA) - i, nil +} +func (m *UnsafeTest) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UnsafeTest) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *UnsafeTest) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if msg, ok := m.Sub.(*UnsafeTest_Sub4_); ok { + size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + if msg, ok := m.Sub.(*UnsafeTest_Sub3_); ok { + size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + if msg, ok := m.Sub.(*UnsafeTest_Sub2_); ok { + size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + if msg, ok := m.Sub.(*UnsafeTest_Sub1_); ok { + size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + return len(dAtA) - i, nil +} + +func (m *UnsafeTest_Sub1_) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *UnsafeTest_Sub1_) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Sub1 != nil { + size, err := m.Sub1.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *UnsafeTest_Sub2_) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *UnsafeTest_Sub2_) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Sub2 != nil { + size, err := m.Sub2.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *UnsafeTest_Sub3_) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *UnsafeTest_Sub3_) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Sub3 != nil { + size, err := m.Sub3.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} +func (m *UnsafeTest_Sub4_) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *UnsafeTest_Sub4_) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Sub4 != nil { + size, err := m.Sub4.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } + return len(dAtA) - i, nil +} +func (m *UnsafeTest_Sub1) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.S) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.B) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *UnsafeTest_Sub2) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.S) > 0 { + for _, s := range m.S { + l = len(s) + n += 1 + l + sov(uint64(l)) + } + } + if len(m.B) > 0 { + for _, b := range m.B { + l = len(b) + n += 1 + l + sov(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *UnsafeTest_Sub3) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Foo) > 0 { + for k, v := range m.Foo { + _ = k + _ = v + l = 1 + len(v) + sov(uint64(len(v))) + mapEntrySize := 1 + len(k) + sov(uint64(len(k))) + l + n += mapEntrySize + 1 + sov(uint64(mapEntrySize)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *UnsafeTest_Sub4) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if vtmsg, ok := m.Foo.(interface{ SizeVT() int }); ok { + n += vtmsg.SizeVT() + } + n += len(m.unknownFields) + return n +} + +func (m *UnsafeTest_Sub4_S) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.S) + n += 1 + l + sov(uint64(l)) + return n +} +func (m *UnsafeTest_Sub4_B) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.B) + n += 1 + l + sov(uint64(l)) + return n +} +func (m *UnsafeTest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if vtmsg, ok := m.Sub.(interface{ SizeVT() int }); ok { + n += vtmsg.SizeVT() + } + n += len(m.unknownFields) + return n +} + +func (m *UnsafeTest_Sub1_) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sub1 != nil { + l = m.Sub1.SizeVT() + n += 1 + l + sov(uint64(l)) + } + return n +} +func (m *UnsafeTest_Sub2_) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sub2 != nil { + l = m.Sub2.SizeVT() + n += 1 + l + sov(uint64(l)) + } + return n +} +func (m *UnsafeTest_Sub3_) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sub3 != nil { + l = m.Sub3.SizeVT() + n += 1 + l + sov(uint64(l)) + } + return n +} +func (m *UnsafeTest_Sub4_) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sub4 != nil { + l = m.Sub4.SizeVT() + n += 1 + l + sov(uint64(l)) + } + return n +} + +func sov(x uint64) (n int) { + return (bits.Len64(x|1) + 6) / 7 +} +func soz(x uint64) (n int) { + return sov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *UnsafeTest_Sub1) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: UnsafeTest_Sub1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnsafeTest_Sub1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field S", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.S = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field B", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.B = append(m.B[:0], dAtA[iNdEx:postIndex]...) + if m.B == nil { + m.B = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnsafeTest_Sub2) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: UnsafeTest_Sub2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnsafeTest_Sub2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field S", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.S = append(m.S, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field B", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.B = append(m.B, make([]byte, postIndex-iNdEx)) + copy(m.B[len(m.B)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnsafeTest_Sub3) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: UnsafeTest_Sub3: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnsafeTest_Sub3: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Foo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Foo == nil { + m.Foo = make(map[string][]byte) + } + var mapkey string + var mapvalue []byte + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapbyteLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapbyteLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intMapbyteLen := int(mapbyteLen) + if intMapbyteLen < 0 { + return ErrInvalidLength + } + postbytesIndex := iNdEx + intMapbyteLen + if postbytesIndex < 0 { + return ErrInvalidLength + } + if postbytesIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = make([]byte, mapbyteLen) + copy(mapvalue, dAtA[iNdEx:postbytesIndex]) + iNdEx = postbytesIndex + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Foo[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnsafeTest_Sub4) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: UnsafeTest_Sub4: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnsafeTest_Sub4: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field S", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Foo = &UnsafeTest_Sub4_S{S: string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field B", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.Foo = &UnsafeTest_Sub4_B{B: v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnsafeTest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: UnsafeTest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnsafeTest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sub1", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Sub.(*UnsafeTest_Sub1_); ok { + if err := oneof.Sub1.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &UnsafeTest_Sub1{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sub = &UnsafeTest_Sub1_{Sub1: v} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sub2", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Sub.(*UnsafeTest_Sub2_); ok { + if err := oneof.Sub2.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &UnsafeTest_Sub2{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sub = &UnsafeTest_Sub2_{Sub2: v} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sub3", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Sub.(*UnsafeTest_Sub3_); ok { + if err := oneof.Sub3.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &UnsafeTest_Sub3{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sub = &UnsafeTest_Sub3_{Sub3: v} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sub4", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Sub.(*UnsafeTest_Sub4_); ok { + if err := oneof.Sub4.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &UnsafeTest_Sub4{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sub = &UnsafeTest_Sub4_{Sub4: v} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func skip(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLength + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroup + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLength + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflow = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") +) + +func (m *UnsafeTest_Sub1) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: UnsafeTest_Sub1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnsafeTest_Sub1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field S", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.S = unsafeBytesToString(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field B", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.B = dAtA[iNdEx:postIndex] + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnsafeTest_Sub2) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -216,15 +2301,15 @@ func (m *UnsafeTest) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: UnsafeTest: wiretype end group for non-group") + return fmt.Errorf("proto: UnsafeTest_Sub2: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: UnsafeTest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: UnsafeTest_Sub2: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Foo1", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field S", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -252,11 +2337,11 @@ func (m *UnsafeTest) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Foo1 = string(dAtA[iNdEx:postIndex]) + m.S = append(m.S, unsafeBytesToString(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Foo2", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field B", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -283,10 +2368,7 @@ func (m *UnsafeTest) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Foo2 = append(m.Foo2[:0], dAtA[iNdEx:postIndex]...) - if m.Foo2 == nil { - m.Foo2 = []byte{} - } + m.B = append(m.B, dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -310,92 +2392,299 @@ func (m *UnsafeTest) UnmarshalVT(dAtA []byte) error { } return nil } - -func skip(dAtA []byte) (n int, err error) { +func (m *UnsafeTest_Sub3) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 - depth := 0 for iNdEx < l { + preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflow + return ErrIntOverflow } if iNdEx >= l { - return 0, io.ErrUnexpectedEOF + return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } + fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) - switch wireType { - case 0: + if wireType == 4 { + return fmt.Errorf("proto: UnsafeTest_Sub3: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnsafeTest_Sub3: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Foo", wireType) + } + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflow + return ErrIntOverflow } if iNdEx >= l { - return 0, io.ErrUnexpectedEOF + return io.ErrUnexpectedEOF } + b := dAtA[iNdEx] iNdEx++ - if dAtA[iNdEx-1] < 0x80 { + msglen |= int(b&0x7F) << shift + if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Foo == nil { + m.Foo = make(map[string][]byte) + } + var mapkey string + var mapvalue []byte + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapbyteLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapbyteLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intMapbyteLen := int(mapbyteLen) + if intMapbyteLen < 0 { + return ErrInvalidLength + } + postbytesIndex := iNdEx + intMapbyteLen + if postbytesIndex < 0 { + return ErrInvalidLength + } + if postbytesIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = dAtA[iNdEx:postbytesIndex] + iNdEx = postbytesIndex + } else { + iNdEx = entryPreIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Foo[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnsafeTest_Sub4) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + 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) + if wireType == 4 { + return fmt.Errorf("proto: UnsafeTest_Sub4: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnsafeTest_Sub4: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { case 1: - iNdEx += 8 + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field S", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Foo = &UnsafeTest_Sub4_S{S: unsafeBytesToString(dAtA[iNdEx:postIndex])} + iNdEx = postIndex case 2: - var length int + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field B", wireType) + } + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflow + return ErrIntOverflow } if iNdEx >= l { - return 0, io.ErrUnexpectedEOF + return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ - length |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if length < 0 { - return 0, ErrInvalidLength + if byteLen < 0 { + return ErrInvalidLength } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroup + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength } - depth-- - case 5: - iNdEx += 4 + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := dAtA[iNdEx:postIndex] + m.Foo = &UnsafeTest_Sub4_B{B: v} + iNdEx = postIndex default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLength - } - if depth == 0 { - return iNdEx, nil + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy } } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflow = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") -) + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *UnsafeTest) UnmarshalVTUnsafe(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -427,9 +2716,9 @@ func (m *UnsafeTest) UnmarshalVTUnsafe(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Foo1", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sub1", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -439,29 +2728,38 @@ func (m *UnsafeTest) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } - m.Foo1 = unsafeBytesToString(dAtA[iNdEx:postIndex]) + if oneof, ok := m.Sub.(*UnsafeTest_Sub1_); ok { + if err := oneof.Sub1.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &UnsafeTest_Sub1{} + if err := v.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sub = &UnsafeTest_Sub1_{Sub1: v} + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Foo2", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sub2", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -471,22 +2769,114 @@ func (m *UnsafeTest) UnmarshalVTUnsafe(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLength } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Sub.(*UnsafeTest_Sub2_); ok { + if err := oneof.Sub2.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &UnsafeTest_Sub2{} + if err := v.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sub = &UnsafeTest_Sub2_{Sub2: v} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sub3", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Sub.(*UnsafeTest_Sub3_); ok { + if err := oneof.Sub3.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &UnsafeTest_Sub3{} + if err := v.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sub = &UnsafeTest_Sub3_{Sub3: v} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sub4", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } - m.Foo2 = dAtA[iNdEx:postIndex] + if oneof, ok := m.Sub.(*UnsafeTest_Sub4_); ok { + if err := oneof.Sub4.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &UnsafeTest_Sub4{} + if err := v.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sub = &UnsafeTest_Sub4_{Sub4: v} + } iNdEx = postIndex default: iNdEx = preIndex From 99f9e24ba14eac96f9ff5b23a0d0730dc3a879fb Mon Sep 17 00:00:00 2001 From: Corentin Dupret Date: Wed, 4 Oct 2023 15:04:38 +0200 Subject: [PATCH 08/10] Remove unused import --- testproto/unsafe/unsafe.pb.go | 60 ++++++++++++++++------------------- testproto/unsafe/unsafe.proto | 2 -- 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/testproto/unsafe/unsafe.pb.go b/testproto/unsafe/unsafe.pb.go index 146b98b..e17dc00 100644 --- a/testproto/unsafe/unsafe.pb.go +++ b/testproto/unsafe/unsafe.pb.go @@ -7,7 +7,6 @@ package unsafe import ( - _ "github.com/planetscale/vtprotobuf/vtproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -372,37 +371,34 @@ var File_unsafe_unsafe_proto protoreflect.FileDescriptor var file_unsafe_unsafe_proto_rawDesc = []byte{ 0x0a, 0x13, 0x75, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x2f, 0x75, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x74, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x74, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x97, 0x03, 0x0a, 0x0a, 0x55, - 0x6e, 0x73, 0x61, 0x66, 0x65, 0x54, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x75, 0x62, - 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, - 0x54, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x75, 0x62, 0x31, 0x48, 0x00, 0x52, 0x04, 0x73, 0x75, 0x62, - 0x31, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x75, 0x62, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x10, 0x2e, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x54, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x75, 0x62, - 0x32, 0x48, 0x00, 0x52, 0x04, 0x73, 0x75, 0x62, 0x32, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x75, 0x62, - 0x33, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, - 0x54, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x75, 0x62, 0x33, 0x48, 0x00, 0x52, 0x04, 0x73, 0x75, 0x62, - 0x33, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x75, 0x62, 0x34, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x10, 0x2e, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x54, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x75, 0x62, - 0x34, 0x48, 0x00, 0x52, 0x04, 0x73, 0x75, 0x62, 0x34, 0x1a, 0x22, 0x0a, 0x04, 0x53, 0x75, 0x62, - 0x31, 0x12, 0x0c, 0x0a, 0x01, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x73, 0x12, - 0x0c, 0x0a, 0x01, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x01, 0x62, 0x1a, 0x22, 0x0a, - 0x04, 0x53, 0x75, 0x62, 0x32, 0x12, 0x0c, 0x0a, 0x01, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x01, 0x73, 0x12, 0x0c, 0x0a, 0x01, 0x62, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x01, - 0x62, 0x1a, 0x6b, 0x0a, 0x04, 0x53, 0x75, 0x62, 0x33, 0x12, 0x2b, 0x0a, 0x03, 0x66, 0x6f, 0x6f, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x54, - 0x65, 0x73, 0x74, 0x2e, 0x53, 0x75, 0x62, 0x33, 0x2e, 0x46, 0x6f, 0x6f, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x52, 0x03, 0x66, 0x6f, 0x6f, 0x1a, 0x36, 0x0a, 0x08, 0x46, 0x6f, 0x6f, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x2d, - 0x0a, 0x04, 0x53, 0x75, 0x62, 0x34, 0x12, 0x0e, 0x0a, 0x01, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x01, 0x73, 0x12, 0x0e, 0x0a, 0x01, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0c, 0x48, 0x00, 0x52, 0x01, 0x62, 0x42, 0x05, 0x0a, 0x03, 0x66, 0x6f, 0x6f, 0x42, 0x05, 0x0a, - 0x03, 0x73, 0x75, 0x62, 0x42, 0x12, 0x5a, 0x10, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2f, 0x75, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x97, 0x03, 0x0a, 0x0a, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, + 0x54, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x75, 0x62, 0x31, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x54, 0x65, 0x73, 0x74, 0x2e, + 0x53, 0x75, 0x62, 0x31, 0x48, 0x00, 0x52, 0x04, 0x73, 0x75, 0x62, 0x31, 0x12, 0x26, 0x0a, 0x04, + 0x73, 0x75, 0x62, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x55, 0x6e, 0x73, + 0x61, 0x66, 0x65, 0x54, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x75, 0x62, 0x32, 0x48, 0x00, 0x52, 0x04, + 0x73, 0x75, 0x62, 0x32, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x75, 0x62, 0x33, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x54, 0x65, 0x73, 0x74, 0x2e, + 0x53, 0x75, 0x62, 0x33, 0x48, 0x00, 0x52, 0x04, 0x73, 0x75, 0x62, 0x33, 0x12, 0x26, 0x0a, 0x04, + 0x73, 0x75, 0x62, 0x34, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x55, 0x6e, 0x73, + 0x61, 0x66, 0x65, 0x54, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x75, 0x62, 0x34, 0x48, 0x00, 0x52, 0x04, + 0x73, 0x75, 0x62, 0x34, 0x1a, 0x22, 0x0a, 0x04, 0x53, 0x75, 0x62, 0x31, 0x12, 0x0c, 0x0a, 0x01, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x73, 0x12, 0x0c, 0x0a, 0x01, 0x62, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x01, 0x62, 0x1a, 0x22, 0x0a, 0x04, 0x53, 0x75, 0x62, 0x32, + 0x12, 0x0c, 0x0a, 0x01, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x01, 0x73, 0x12, 0x0c, + 0x0a, 0x01, 0x62, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x01, 0x62, 0x1a, 0x6b, 0x0a, 0x04, + 0x53, 0x75, 0x62, 0x33, 0x12, 0x2b, 0x0a, 0x03, 0x66, 0x6f, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x54, 0x65, 0x73, 0x74, 0x2e, 0x53, + 0x75, 0x62, 0x33, 0x2e, 0x46, 0x6f, 0x6f, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x03, 0x66, 0x6f, + 0x6f, 0x1a, 0x36, 0x0a, 0x08, 0x46, 0x6f, 0x6f, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x2d, 0x0a, 0x04, 0x53, 0x75, 0x62, + 0x34, 0x12, 0x0e, 0x0a, 0x01, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x01, + 0x73, 0x12, 0x0e, 0x0a, 0x01, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x01, + 0x62, 0x42, 0x05, 0x0a, 0x03, 0x66, 0x6f, 0x6f, 0x42, 0x05, 0x0a, 0x03, 0x73, 0x75, 0x62, 0x42, + 0x12, 0x5a, 0x10, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x75, 0x6e, 0x73, + 0x61, 0x66, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/testproto/unsafe/unsafe.proto b/testproto/unsafe/unsafe.proto index 4bd7003..3150189 100644 --- a/testproto/unsafe/unsafe.proto +++ b/testproto/unsafe/unsafe.proto @@ -1,8 +1,6 @@ syntax = "proto3"; option go_package = "testproto/unsafe"; -import "github.com/planetscale/vtprotobuf/vtproto/ext.proto"; - message UnsafeTest { message Sub1 { string s = 1; From b366c923fd89ac37963f78eda1e01194cc941eaf Mon Sep 17 00:00:00 2001 From: Corentin Dupret Date: Wed, 4 Oct 2023 18:12:23 +0200 Subject: [PATCH 09/10] Bump vtprotobuf to require at least Go 1.20 --- go.mod | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index da5caf1..a4491c1 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,15 @@ module github.com/planetscale/vtprotobuf -go 1.16 +go 1.20 require ( github.com/stretchr/testify v1.7.1 - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/protobuf v1.26.0 ) + +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) From 6a7e8af003d6096480a9ec07b15f729426f8de8c Mon Sep 17 00:00:00 2001 From: Corentin Dupret Date: Wed, 4 Oct 2023 18:14:46 +0200 Subject: [PATCH 10/10] Replace `unsafeBytesToString` by `unsafe.String` --- .../conformance/conformance_vtproto.pb.go | 25 ++++++------ .../test_messages_proto2_vtproto.pb.go | 40 +++++++++---------- .../test_messages_proto3_vtproto.pb.go | 29 +++++++------- features/unmarshal/unmarshal.go | 13 +----- testproto/pool/pool_vtproto.pb.go | 6 +-- testproto/pool/pool_with_oneof_vtproto.pb.go | 3 +- .../pool/pool_with_slice_reuse_vtproto.pb.go | 7 ++-- testproto/proto2/scalars_vtproto.pb.go | 10 ++--- testproto/proto3opt/opt_vtproto.pb.go | 6 +-- testproto/unsafe/unsafe_test.go | 15 +++---- testproto/unsafe/unsafe_vtproto.pb.go | 12 ++---- testproto/wkt/wkt_vtproto.pb.go | 5 --- types/known/anypb/any_vtproto.pb.go | 6 +-- types/known/durationpb/duration_vtproto.pb.go | 5 --- types/known/emptypb/empty_vtproto.pb.go | 5 --- .../fieldmaskpb/field_mask_vtproto.pb.go | 6 +-- .../known/timestamppb/timestamp_vtproto.pb.go | 5 --- types/known/wrapperspb/wrappers_vtproto.pb.go | 6 +-- 18 files changed, 72 insertions(+), 132 deletions(-) diff --git a/conformance/internal/conformance/conformance_vtproto.pb.go b/conformance/internal/conformance/conformance_vtproto.pb.go index 35244e1..837109b 100644 --- a/conformance/internal/conformance/conformance_vtproto.pb.go +++ b/conformance/internal/conformance/conformance_vtproto.pb.go @@ -9,6 +9,7 @@ import ( proto "google.golang.org/protobuf/proto" protoimpl "google.golang.org/protobuf/runtime/protoimpl" io "io" + unsafe "unsafe" ) const ( @@ -2371,7 +2372,7 @@ func (m *FailureSet) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Failure = append(m.Failure, unsafeBytesToString(dAtA[iNdEx:postIndex])) + m.Failure = append(m.Failure, unsafe.String(&dAtA[iNdEx], intStringLen)) iNdEx = postIndex default: iNdEx = preIndex @@ -2486,7 +2487,7 @@ func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Payload = &ConformanceRequest_JsonPayload{JsonPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} + m.Payload = &ConformanceRequest_JsonPayload{JsonPayload: unsafe.String(&dAtA[iNdEx], intStringLen)} iNdEx = postIndex case 3: if wireType != 0 { @@ -2537,7 +2538,7 @@ func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MessageType = unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.MessageType = unsafe.String(&dAtA[iNdEx], intStringLen) iNdEx = postIndex case 5: if wireType != 0 { @@ -2624,7 +2625,7 @@ func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Payload = &ConformanceRequest_JspbPayload{JspbPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} + m.Payload = &ConformanceRequest_JspbPayload{JspbPayload: unsafe.String(&dAtA[iNdEx], intStringLen)} iNdEx = postIndex case 8: if wireType != 2 { @@ -2656,7 +2657,7 @@ func (m *ConformanceRequest) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Payload = &ConformanceRequest_TextPayload{TextPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} + m.Payload = &ConformanceRequest_TextPayload{TextPayload: unsafe.String(&dAtA[iNdEx], intStringLen)} iNdEx = postIndex case 9: if wireType != 0 { @@ -2759,7 +2760,7 @@ func (m *ConformanceResponse) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_ParseError{ParseError: unsafeBytesToString(dAtA[iNdEx:postIndex])} + m.Result = &ConformanceResponse_ParseError{ParseError: unsafe.String(&dAtA[iNdEx], intStringLen)} iNdEx = postIndex case 2: if wireType != 2 { @@ -2791,7 +2792,7 @@ func (m *ConformanceResponse) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_RuntimeError{RuntimeError: unsafeBytesToString(dAtA[iNdEx:postIndex])} + m.Result = &ConformanceResponse_RuntimeError{RuntimeError: unsafe.String(&dAtA[iNdEx], intStringLen)} iNdEx = postIndex case 3: if wireType != 2 { @@ -2855,7 +2856,7 @@ func (m *ConformanceResponse) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_JsonPayload{JsonPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} + m.Result = &ConformanceResponse_JsonPayload{JsonPayload: unsafe.String(&dAtA[iNdEx], intStringLen)} iNdEx = postIndex case 5: if wireType != 2 { @@ -2887,7 +2888,7 @@ func (m *ConformanceResponse) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_Skipped{Skipped: unsafeBytesToString(dAtA[iNdEx:postIndex])} + m.Result = &ConformanceResponse_Skipped{Skipped: unsafe.String(&dAtA[iNdEx], intStringLen)} iNdEx = postIndex case 6: if wireType != 2 { @@ -2919,7 +2920,7 @@ func (m *ConformanceResponse) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_SerializeError{SerializeError: unsafeBytesToString(dAtA[iNdEx:postIndex])} + m.Result = &ConformanceResponse_SerializeError{SerializeError: unsafe.String(&dAtA[iNdEx], intStringLen)} iNdEx = postIndex case 7: if wireType != 2 { @@ -2951,7 +2952,7 @@ func (m *ConformanceResponse) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_JspbPayload{JspbPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} + m.Result = &ConformanceResponse_JspbPayload{JspbPayload: unsafe.String(&dAtA[iNdEx], intStringLen)} iNdEx = postIndex case 8: if wireType != 2 { @@ -2983,7 +2984,7 @@ func (m *ConformanceResponse) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &ConformanceResponse_TextPayload{TextPayload: unsafeBytesToString(dAtA[iNdEx:postIndex])} + m.Result = &ConformanceResponse_TextPayload{TextPayload: unsafe.String(&dAtA[iNdEx], intStringLen)} iNdEx = postIndex default: iNdEx = preIndex diff --git a/conformance/internal/conformance/test_messages_proto2_vtproto.pb.go b/conformance/internal/conformance/test_messages_proto2_vtproto.pb.go index e8e95d5..0cd390d 100644 --- a/conformance/internal/conformance/test_messages_proto2_vtproto.pb.go +++ b/conformance/internal/conformance/test_messages_proto2_vtproto.pb.go @@ -15093,7 +15093,7 @@ func (m *TestAllTypesProto2_MessageSetCorrectExtension1) UnmarshalVTUnsafe(dAtA if postIndex > l { return io.ErrUnexpectedEOF } - s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + s := unsafe.String(&dAtA[iNdEx], intStringLen) m.Str = &s iNdEx = postIndex default: @@ -15460,7 +15460,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + s := unsafe.String(&dAtA[iNdEx], intStringLen) m.OptionalString = &s iNdEx = postIndex case 15: @@ -15636,7 +15636,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + s := unsafe.String(&dAtA[iNdEx], intStringLen) m.OptionalStringPiece = &s iNdEx = postIndex case 25: @@ -15669,7 +15669,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + s := unsafe.String(&dAtA[iNdEx], intStringLen) m.OptionalCord = &s iNdEx = postIndex case 27: @@ -16584,7 +16584,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RepeatedString = append(m.RepeatedString, unsafeBytesToString(dAtA[iNdEx:postIndex])) + m.RepeatedString = append(m.RepeatedString, unsafe.String(&dAtA[iNdEx], intStringLen)) iNdEx = postIndex case 45: if wireType != 2 { @@ -16853,7 +16853,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RepeatedStringPiece = append(m.RepeatedStringPiece, unsafeBytesToString(dAtA[iNdEx:postIndex])) + m.RepeatedStringPiece = append(m.RepeatedStringPiece, unsafe.String(&dAtA[iNdEx], intStringLen)) iNdEx = postIndex case 55: if wireType != 2 { @@ -16885,7 +16885,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RepeatedCord = append(m.RepeatedCord, unsafeBytesToString(dAtA[iNdEx:postIndex])) + m.RepeatedCord = append(m.RepeatedCord, unsafe.String(&dAtA[iNdEx], intStringLen)) iNdEx = postIndex case 56: if wireType != 2 { @@ -18183,7 +18183,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var stringLenmapvalue uint64 @@ -18212,7 +18212,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapvalue > l { return io.ErrUnexpectedEOF } - mapvalue = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapvalue]) + mapvalue = unsafe.String(&dAtA[iNdEx], intStringLenmapvalue) iNdEx = postStringIndexmapvalue } else { iNdEx = entryPreIndex @@ -18310,7 +18310,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapbyteLen uint64 @@ -18437,7 +18437,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapmsglen int @@ -18566,7 +18566,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapmsglen int @@ -18695,7 +18695,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { @@ -18808,7 +18808,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { @@ -20763,7 +20763,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OneofField = &TestAllTypesProto2_OneofString{OneofString: unsafeBytesToString(dAtA[iNdEx:postIndex])} + m.OneofField = &TestAllTypesProto2_OneofString{OneofString: unsafe.String(&dAtA[iNdEx], intStringLen)} iNdEx = postIndex case 114: if wireType != 2 { @@ -21160,7 +21160,7 @@ func (m *TestAllTypesProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + s := unsafe.String(&dAtA[iNdEx], intStringLen) m.DefaultString = &s iNdEx = postIndex case 255: @@ -21805,7 +21805,7 @@ func (m *UnknownToTestAllTypes) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + s := unsafe.String(&dAtA[iNdEx], intStringLen) m.OptionalString = &s iNdEx = postIndex case 1003: @@ -22162,7 +22162,7 @@ func (m *OneStringProto2) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + s := unsafe.String(&dAtA[iNdEx], intStringLen) m.Data = &s iNdEx = postIndex default: @@ -22187,7 +22187,3 @@ func (m *OneStringProto2) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } - -func unsafeBytesToString(b []byte) string { - return *(*string)(unsafe.Pointer(&b)) -} diff --git a/conformance/internal/conformance/test_messages_proto3_vtproto.pb.go b/conformance/internal/conformance/test_messages_proto3_vtproto.pb.go index 97c49e0..112590c 100644 --- a/conformance/internal/conformance/test_messages_proto3_vtproto.pb.go +++ b/conformance/internal/conformance/test_messages_proto3_vtproto.pb.go @@ -22,6 +22,7 @@ import ( wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" io "io" math "math" + unsafe "unsafe" ) const ( @@ -15458,7 +15459,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OptionalString = unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.OptionalString = unsafe.String(&dAtA[iNdEx], intStringLen) iNdEx = postIndex case 15: if wireType != 2 { @@ -15650,7 +15651,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OptionalStringPiece = unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.OptionalStringPiece = unsafe.String(&dAtA[iNdEx], intStringLen) iNdEx = postIndex case 25: if wireType != 2 { @@ -15682,7 +15683,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OptionalCord = unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.OptionalCord = unsafe.String(&dAtA[iNdEx], intStringLen) iNdEx = postIndex case 27: if wireType != 2 { @@ -16596,7 +16597,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RepeatedString = append(m.RepeatedString, unsafeBytesToString(dAtA[iNdEx:postIndex])) + m.RepeatedString = append(m.RepeatedString, unsafe.String(&dAtA[iNdEx], intStringLen)) iNdEx = postIndex case 45: if wireType != 2 { @@ -16865,7 +16866,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RepeatedStringPiece = append(m.RepeatedStringPiece, unsafeBytesToString(dAtA[iNdEx:postIndex])) + m.RepeatedStringPiece = append(m.RepeatedStringPiece, unsafe.String(&dAtA[iNdEx], intStringLen)) iNdEx = postIndex case 55: if wireType != 2 { @@ -16897,7 +16898,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RepeatedCord = append(m.RepeatedCord, unsafeBytesToString(dAtA[iNdEx:postIndex])) + m.RepeatedCord = append(m.RepeatedCord, unsafe.String(&dAtA[iNdEx], intStringLen)) iNdEx = postIndex case 56: if wireType != 2 { @@ -18195,7 +18196,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var stringLenmapvalue uint64 @@ -18224,7 +18225,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapvalue > l { return io.ErrUnexpectedEOF } - mapvalue = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapvalue]) + mapvalue = unsafe.String(&dAtA[iNdEx], intStringLenmapvalue) iNdEx = postStringIndexmapvalue } else { iNdEx = entryPreIndex @@ -18322,7 +18323,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapbyteLen uint64 @@ -18449,7 +18450,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapmsglen int @@ -18578,7 +18579,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapmsglen int @@ -18707,7 +18708,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { @@ -18820,7 +18821,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { @@ -20775,7 +20776,7 @@ func (m *TestAllTypesProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OneofField = &TestAllTypesProto3_OneofString{OneofString: unsafeBytesToString(dAtA[iNdEx:postIndex])} + m.OneofField = &TestAllTypesProto3_OneofString{OneofString: unsafe.String(&dAtA[iNdEx], intStringLen)} iNdEx = postIndex case 114: if wireType != 2 { diff --git a/features/unmarshal/unmarshal.go b/features/unmarshal/unmarshal.go index ed09147..77d65dc 100644 --- a/features/unmarshal/unmarshal.go +++ b/features/unmarshal/unmarshal.go @@ -135,15 +135,6 @@ func (p *unmarshal) GenerateHelpers() { ErrUnexpectedEndOfGroup = `, p.Ident("fmt", "Errorf"), `("proto: unexpected end of group") )`) }) - - if p.unsafe { - p.Helper("unsafeBytesToString", func(p *generator.GeneratedFile) { - p.P(` - func unsafeBytesToString(b []byte) string { - return *(*string)(`, p.Ident("unsafe", `Pointer`), `(&b)) - }`) - }) - } } func (p *unmarshal) methodUnmarshal() string { @@ -296,7 +287,7 @@ func (p *unmarshal) mapField(varName string, field *protogen.Field) { p.P(`return `, p.Ident("io", `ErrUnexpectedEOF`)) p.P(`}`) if p.unsafe { - p.P(varName, ` = `, "unsafeBytesToString", `(dAtA[iNdEx:postStringIndex`, varName, `])`) + p.P(varName, ` = `, p.Ident("unsafe", `String`), `(&dAtA[iNdEx], intStringLen`, varName, `)`) } else { p.P(varName, ` = `, "string", `(dAtA[iNdEx:postStringIndex`, varName, `])`) } @@ -522,7 +513,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * p.P(`}`) str := "string(dAtA[iNdEx:postIndex])" if p.unsafe { - str = `unsafeBytesToString(dAtA[iNdEx:postIndex])` + str = p.Ident("unsafe", `String`) + `(&dAtA[iNdEx], intStringLen)` } if oneof { p.P(`m.`, fieldname, ` = &`, field.GoIdent, `{`, field.GoName, ": ", str, `}`) diff --git a/testproto/pool/pool_vtproto.pb.go b/testproto/pool/pool_vtproto.pb.go index 7e327f8..317363c 100644 --- a/testproto/pool/pool_vtproto.pb.go +++ b/testproto/pool/pool_vtproto.pb.go @@ -452,7 +452,7 @@ func (m *MemoryPoolExtension) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Foo1 = unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.Foo1 = unsafe.String(&dAtA[iNdEx], intStringLen) iNdEx = postIndex case 2: if wireType != 0 { @@ -495,7 +495,3 @@ func (m *MemoryPoolExtension) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } - -func unsafeBytesToString(b []byte) string { - return *(*string)(unsafe.Pointer(&b)) -} diff --git a/testproto/pool/pool_with_oneof_vtproto.pb.go b/testproto/pool/pool_with_oneof_vtproto.pb.go index 5b6d9ec..dc5a1db 100644 --- a/testproto/pool/pool_with_oneof_vtproto.pb.go +++ b/testproto/pool/pool_with_oneof_vtproto.pb.go @@ -10,6 +10,7 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" io "io" sync "sync" + unsafe "unsafe" ) const ( @@ -1687,7 +1688,7 @@ func (m *OneofTest_Test2) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.B = append(m.B, unsafeBytesToString(dAtA[iNdEx:postIndex])) + m.B = append(m.B, unsafe.String(&dAtA[iNdEx], intStringLen)) iNdEx = postIndex default: iNdEx = preIndex diff --git a/testproto/pool/pool_with_slice_reuse_vtproto.pb.go b/testproto/pool/pool_with_slice_reuse_vtproto.pb.go index 18bd75d..441933b 100644 --- a/testproto/pool/pool_with_slice_reuse_vtproto.pb.go +++ b/testproto/pool/pool_with_slice_reuse_vtproto.pb.go @@ -10,6 +10,7 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" io "io" sync "sync" + unsafe "unsafe" ) const ( @@ -1383,7 +1384,7 @@ func (m *Test1) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Sl = append(m.Sl, unsafeBytesToString(dAtA[iNdEx:postIndex])) + m.Sl = append(m.Sl, unsafe.String(&dAtA[iNdEx], intStringLen)) iNdEx = postIndex default: iNdEx = preIndex @@ -1677,7 +1678,7 @@ func (m *Slice2) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.C = append(m.C, unsafeBytesToString(dAtA[iNdEx:postIndex])) + m.C = append(m.C, unsafe.String(&dAtA[iNdEx], intStringLen)) iNdEx = postIndex case 4: if wireType != 2 { @@ -1745,7 +1746,7 @@ func (m *Slice2) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.E = unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.E = unsafe.String(&dAtA[iNdEx], intStringLen) iNdEx = postIndex case 6: if wireType != 0 { diff --git a/testproto/proto2/scalars_vtproto.pb.go b/testproto/proto2/scalars_vtproto.pb.go index 019ee86..7d390c5 100644 --- a/testproto/proto2/scalars_vtproto.pb.go +++ b/testproto/proto2/scalars_vtproto.pb.go @@ -10167,7 +10167,7 @@ func (m *StringMessage) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + s := unsafe.String(&dAtA[iNdEx], intStringLen) m.RequiredField = &s iNdEx = postIndex hasFields[0] |= uint64(0x00000001) @@ -10201,7 +10201,7 @@ func (m *StringMessage) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + s := unsafe.String(&dAtA[iNdEx], intStringLen) m.OptionalField = &s iNdEx = postIndex case 3: @@ -10234,7 +10234,7 @@ func (m *StringMessage) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RepeatedField = append(m.RepeatedField, unsafeBytesToString(dAtA[iNdEx:postIndex])) + m.RepeatedField = append(m.RepeatedField, unsafe.String(&dAtA[iNdEx], intStringLen)) iNdEx = postIndex default: iNdEx = preIndex @@ -10644,7 +10644,3 @@ func (m *EnumMessage) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } - -func unsafeBytesToString(b []byte) string { - return *(*string)(unsafe.Pointer(&b)) -} diff --git a/testproto/proto3opt/opt_vtproto.pb.go b/testproto/proto3opt/opt_vtproto.pb.go index 0b4c2bd..7ccb0d7 100644 --- a/testproto/proto3opt/opt_vtproto.pb.go +++ b/testproto/proto3opt/opt_vtproto.pb.go @@ -1211,7 +1211,7 @@ func (m *OptionalFieldInProto3) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := unsafeBytesToString(dAtA[iNdEx:postIndex]) + s := unsafe.String(&dAtA[iNdEx], intStringLen) m.OptionalString = &s iNdEx = postIndex case 15: @@ -1287,7 +1287,3 @@ func (m *OptionalFieldInProto3) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } - -func unsafeBytesToString(b []byte) string { - return *(*string)(unsafe.Pointer(&b)) -} diff --git a/testproto/unsafe/unsafe_test.go b/testproto/unsafe/unsafe_test.go index 3ae4fb4..179faed 100644 --- a/testproto/unsafe/unsafe_test.go +++ b/testproto/unsafe/unsafe_test.go @@ -1,7 +1,6 @@ package unsafe import ( - "reflect" "testing" "unsafe" @@ -11,15 +10,14 @@ import ( // assertStringIsOriginal asserts whether the underlying array of s belongs to originalData. // -// Note: performing checks on the Data uintptr of headers works as long as the garbage collector -// doesn't move memory. To provide guarantee that this test works, consider using +// Note: performing checks on the uintptr to the underlying arrays works as long as the garbage +// collector doesn't move memory. To provide guarantee that this test works, consider using // https://pkg.go.dev/runtime#Pinner when upgrading Go to >= 1.21. func assertStringIsOriginal(t *testing.T, s string, belongs bool, originalData []byte) { - originalStart := (*reflect.SliceHeader)(unsafe.Pointer(&originalData)).Data + originalStart := uintptr(unsafe.Pointer(unsafe.SliceData(originalData))) originalEnd := originalStart + uintptr(len(originalData)) - 1 - hdr := (*reflect.StringHeader)(unsafe.Pointer(&s)) - start := hdr.Data + start := uintptr(unsafe.Pointer(unsafe.StringData(s))) end := start + uintptr(len(s)) - 1 assert.Equal(t, belongs, start >= originalStart && start < originalEnd) assert.Equal(t, belongs, end > originalStart && end <= originalEnd) @@ -27,11 +25,10 @@ func assertStringIsOriginal(t *testing.T, s string, belongs bool, originalData [ // assertBytesAreOriginal is the same as assertStringIsOriginal for a []byte. func assertBytesAreOriginal(t *testing.T, b []byte, belongs bool, originalData []byte) { - originalStart := (*reflect.SliceHeader)(unsafe.Pointer(&originalData)).Data + originalStart := uintptr(unsafe.Pointer(unsafe.SliceData(originalData))) originalEnd := originalStart + uintptr(len(originalData)) - 1 - hdr := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - start := hdr.Data + start := uintptr(unsafe.Pointer(unsafe.SliceData(b))) end := start + uintptr(len(b)) - 1 assert.Equal(t, belongs, start >= originalStart && start < originalEnd) assert.Equal(t, belongs, end > originalStart && end <= originalEnd) diff --git a/testproto/unsafe/unsafe_vtproto.pb.go b/testproto/unsafe/unsafe_vtproto.pb.go index 20aefe3..9534758 100644 --- a/testproto/unsafe/unsafe_vtproto.pb.go +++ b/testproto/unsafe/unsafe_vtproto.pb.go @@ -2223,7 +2223,7 @@ func (m *UnsafeTest_Sub1) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.S = unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.S = unsafe.String(&dAtA[iNdEx], intStringLen) iNdEx = postIndex case 2: if wireType != 2 { @@ -2337,7 +2337,7 @@ func (m *UnsafeTest_Sub2) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.S = append(m.S, unsafeBytesToString(dAtA[iNdEx:postIndex])) + m.S = append(m.S, unsafe.String(&dAtA[iNdEx], intStringLen)) iNdEx = postIndex case 2: if wireType != 2 { @@ -2500,7 +2500,7 @@ func (m *UnsafeTest_Sub3) UnmarshalVTUnsafe(dAtA []byte) error { if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - mapkey = unsafeBytesToString(dAtA[iNdEx:postStringIndexmapkey]) + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapbyteLen uint64 @@ -2629,7 +2629,7 @@ func (m *UnsafeTest_Sub4) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Foo = &UnsafeTest_Sub4_S{S: unsafeBytesToString(dAtA[iNdEx:postIndex])} + m.Foo = &UnsafeTest_Sub4_S{S: unsafe.String(&dAtA[iNdEx], intStringLen)} iNdEx = postIndex case 2: if wireType != 2 { @@ -2900,7 +2900,3 @@ func (m *UnsafeTest) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } - -func unsafeBytesToString(b []byte) string { - return *(*string)(unsafe.Pointer(&b)) -} diff --git a/testproto/wkt/wkt_vtproto.pb.go b/testproto/wkt/wkt_vtproto.pb.go index e32cd95..7f83b5f 100644 --- a/testproto/wkt/wkt_vtproto.pb.go +++ b/testproto/wkt/wkt_vtproto.pb.go @@ -22,7 +22,6 @@ import ( wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" io "io" bits "math/bits" - unsafe "unsafe" ) const ( @@ -1745,7 +1744,3 @@ func (m *MessageWithWKT) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } - -func unsafeBytesToString(b []byte) string { - return *(*string)(unsafe.Pointer(&b)) -} diff --git a/types/known/anypb/any_vtproto.pb.go b/types/known/anypb/any_vtproto.pb.go index 31da324..aa49968 100644 --- a/types/known/anypb/any_vtproto.pb.go +++ b/types/known/anypb/any_vtproto.pb.go @@ -432,7 +432,7 @@ func (m *Any) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TypeUrl = unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.TypeUrl = unsafe.String(&dAtA[iNdEx], intStringLen) iNdEx = postIndex case 2: if wireType != 2 { @@ -486,7 +486,3 @@ func (m *Any) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } - -func unsafeBytesToString(b []byte) string { - return *(*string)(unsafe.Pointer(&b)) -} diff --git a/types/known/durationpb/duration_vtproto.pb.go b/types/known/durationpb/duration_vtproto.pb.go index 3d0c8ce..349e70f 100644 --- a/types/known/durationpb/duration_vtproto.pb.go +++ b/types/known/durationpb/duration_vtproto.pb.go @@ -10,7 +10,6 @@ import ( durationpb "google.golang.org/protobuf/types/known/durationpb" io "io" bits "math/bits" - unsafe "unsafe" ) const ( @@ -419,7 +418,3 @@ func (m *Duration) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } - -func unsafeBytesToString(b []byte) string { - return *(*string)(unsafe.Pointer(&b)) -} diff --git a/types/known/emptypb/empty_vtproto.pb.go b/types/known/emptypb/empty_vtproto.pb.go index dcf9d9e..07f7ac7 100644 --- a/types/known/emptypb/empty_vtproto.pb.go +++ b/types/known/emptypb/empty_vtproto.pb.go @@ -10,7 +10,6 @@ import ( emptypb "google.golang.org/protobuf/types/known/emptypb" io "io" bits "math/bits" - unsafe "unsafe" ) const ( @@ -309,7 +308,3 @@ func (m *Empty) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } - -func unsafeBytesToString(b []byte) string { - return *(*string)(unsafe.Pointer(&b)) -} diff --git a/types/known/fieldmaskpb/field_mask_vtproto.pb.go b/types/known/fieldmaskpb/field_mask_vtproto.pb.go index 4fd37b1..759b021 100644 --- a/types/known/fieldmaskpb/field_mask_vtproto.pb.go +++ b/types/known/fieldmaskpb/field_mask_vtproto.pb.go @@ -388,7 +388,7 @@ func (m *FieldMask) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Paths = append(m.Paths, unsafeBytesToString(dAtA[iNdEx:postIndex])) + m.Paths = append(m.Paths, unsafe.String(&dAtA[iNdEx], intStringLen)) iNdEx = postIndex default: iNdEx = preIndex @@ -411,7 +411,3 @@ func (m *FieldMask) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } - -func unsafeBytesToString(b []byte) string { - return *(*string)(unsafe.Pointer(&b)) -} diff --git a/types/known/timestamppb/timestamp_vtproto.pb.go b/types/known/timestamppb/timestamp_vtproto.pb.go index 5e04ed8..231bc65 100644 --- a/types/known/timestamppb/timestamp_vtproto.pb.go +++ b/types/known/timestamppb/timestamp_vtproto.pb.go @@ -10,7 +10,6 @@ import ( timestamppb "google.golang.org/protobuf/types/known/timestamppb" io "io" bits "math/bits" - unsafe "unsafe" ) const ( @@ -419,7 +418,3 @@ func (m *Timestamp) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } - -func unsafeBytesToString(b []byte) string { - return *(*string)(unsafe.Pointer(&b)) -} diff --git a/types/known/wrapperspb/wrappers_vtproto.pb.go b/types/known/wrapperspb/wrappers_vtproto.pb.go index e130e3f..8942b43 100644 --- a/types/known/wrapperspb/wrappers_vtproto.pb.go +++ b/types/known/wrapperspb/wrappers_vtproto.pb.go @@ -2233,7 +2233,7 @@ func (m *StringValue) UnmarshalVTUnsafe(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Value = unsafeBytesToString(dAtA[iNdEx:postIndex]) + m.Value = unsafe.String(&dAtA[iNdEx], intStringLen) iNdEx = postIndex default: iNdEx = preIndex @@ -2337,7 +2337,3 @@ func (m *BytesValue) UnmarshalVTUnsafe(dAtA []byte) error { } return nil } - -func unsafeBytesToString(b []byte) string { - return *(*string)(unsafe.Pointer(&b)) -}