...

Source file src/github.com/gogo/protobuf/vanity/test/faster/gogovanity.pb.go

Documentation: github.com/gogo/protobuf/vanity/test/faster

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: gogovanity.proto
     3  
     4  package vanity
     5  
     6  import (
     7  	fmt "fmt"
     8  	_ "github.com/gogo/protobuf/gogoproto"
     9  	proto "github.com/gogo/protobuf/proto"
    10  	io "io"
    11  	math "math"
    12  	math_bits "math/bits"
    13  )
    14  
    15  // Reference imports to suppress errors if they are not otherwise used.
    16  var _ = proto.Marshal
    17  var _ = fmt.Errorf
    18  var _ = math.Inf
    19  
    20  // This is a compile-time assertion to ensure that this generated file
    21  // is compatible with the proto package it is being compiled against.
    22  // A compilation error at this line likely means your copy of the
    23  // proto package needs to be updated.
    24  const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
    25  
    26  type B struct {
    27  	String_ *string `protobuf:"bytes,1,opt,name=String" json:"String,omitempty"`
    28  	Int64   int64   `protobuf:"varint,2,opt,name=Int64" json:"Int64"`
    29  	Int32   *int32  `protobuf:"varint,3,opt,name=Int32,def=1234" json:"Int32,omitempty"`
    30  }
    31  
    32  func (m *B) Reset()         { *m = B{} }
    33  func (m *B) String() string { return proto.CompactTextString(m) }
    34  func (*B) ProtoMessage()    {}
    35  func (*B) Descriptor() ([]byte, []int) {
    36  	return fileDescriptor_f8c9b51615339d8e, []int{0}
    37  }
    38  func (m *B) XXX_Unmarshal(b []byte) error {
    39  	return m.Unmarshal(b)
    40  }
    41  func (m *B) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    42  	if deterministic {
    43  		return xxx_messageInfo_B.Marshal(b, m, deterministic)
    44  	} else {
    45  		b = b[:cap(b)]
    46  		n, err := m.MarshalToSizedBuffer(b)
    47  		if err != nil {
    48  			return nil, err
    49  		}
    50  		return b[:n], nil
    51  	}
    52  }
    53  func (m *B) XXX_Merge(src proto.Message) {
    54  	xxx_messageInfo_B.Merge(m, src)
    55  }
    56  func (m *B) XXX_Size() int {
    57  	return m.Size()
    58  }
    59  func (m *B) XXX_DiscardUnknown() {
    60  	xxx_messageInfo_B.DiscardUnknown(m)
    61  }
    62  
    63  var xxx_messageInfo_B proto.InternalMessageInfo
    64  
    65  const Default_B_Int32 int32 = 1234
    66  
    67  func (m *B) GetString_() string {
    68  	if m != nil && m.String_ != nil {
    69  		return *m.String_
    70  	}
    71  	return ""
    72  }
    73  
    74  func (m *B) GetInt64() int64 {
    75  	if m != nil {
    76  		return m.Int64
    77  	}
    78  	return 0
    79  }
    80  
    81  func (m *B) GetInt32() int32 {
    82  	if m != nil && m.Int32 != nil {
    83  		return *m.Int32
    84  	}
    85  	return Default_B_Int32
    86  }
    87  
    88  func init() {
    89  	proto.RegisterType((*B)(nil), "vanity.B")
    90  }
    91  
    92  func init() { proto.RegisterFile("gogovanity.proto", fileDescriptor_f8c9b51615339d8e) }
    93  
    94  var fileDescriptor_f8c9b51615339d8e = []byte{
    95  	// 171 bytes of a gzipped FileDescriptorProto
    96  	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x48, 0xcf, 0x4f, 0xcf,
    97  	0x2f, 0x4b, 0xcc, 0xcb, 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0,
    98  	0xa4, 0x74, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x8a, 0xf4,
    99  	0xc1, 0xd2, 0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xb4, 0x29, 0x45, 0x72, 0x31,
   100  	0x3a, 0x09, 0xc9, 0x70, 0xb1, 0x05, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x4b, 0x30, 0x2a, 0x30, 0x6a,
   101  	0x70, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x18, 0x04, 0x15, 0x13, 0x92, 0xe2, 0x62, 0xf5, 0xcc,
   102  	0x2b, 0x31, 0x33, 0x91, 0x60, 0x52, 0x60, 0xd4, 0x60, 0x06, 0x4b, 0x32, 0x04, 0x41, 0x84, 0xa0,
   103  	0x72, 0xc6, 0x46, 0x12, 0xcc, 0x0a, 0x8c, 0x1a, 0xac, 0x56, 0x2c, 0x86, 0x46, 0xc6, 0x26, 0x41,
   104  	0x10, 0x21, 0x27, 0x89, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e,
   105  	0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x00, 0x04, 0x00,
   106  	0x00, 0xff, 0xff, 0xbf, 0xbb, 0x2c, 0x28, 0xbe, 0x00, 0x00, 0x00,
   107  }
   108  
   109  func (m *B) Marshal() (dAtA []byte, err error) {
   110  	size := m.Size()
   111  	dAtA = make([]byte, size)
   112  	n, err := m.MarshalToSizedBuffer(dAtA[:size])
   113  	if err != nil {
   114  		return nil, err
   115  	}
   116  	return dAtA[:n], nil
   117  }
   118  
   119  func (m *B) MarshalTo(dAtA []byte) (int, error) {
   120  	size := m.Size()
   121  	return m.MarshalToSizedBuffer(dAtA[:size])
   122  }
   123  
   124  func (m *B) MarshalToSizedBuffer(dAtA []byte) (int, error) {
   125  	i := len(dAtA)
   126  	_ = i
   127  	var l int
   128  	_ = l
   129  	if m.Int32 != nil {
   130  		i = encodeVarintGogovanity(dAtA, i, uint64(*m.Int32))
   131  		i--
   132  		dAtA[i] = 0x18
   133  	}
   134  	i = encodeVarintGogovanity(dAtA, i, uint64(m.Int64))
   135  	i--
   136  	dAtA[i] = 0x10
   137  	if m.String_ != nil {
   138  		i -= len(*m.String_)
   139  		copy(dAtA[i:], *m.String_)
   140  		i = encodeVarintGogovanity(dAtA, i, uint64(len(*m.String_)))
   141  		i--
   142  		dAtA[i] = 0xa
   143  	}
   144  	return len(dAtA) - i, nil
   145  }
   146  
   147  func encodeVarintGogovanity(dAtA []byte, offset int, v uint64) int {
   148  	offset -= sovGogovanity(v)
   149  	base := offset
   150  	for v >= 1<<7 {
   151  		dAtA[offset] = uint8(v&0x7f | 0x80)
   152  		v >>= 7
   153  		offset++
   154  	}
   155  	dAtA[offset] = uint8(v)
   156  	return base
   157  }
   158  func (m *B) Size() (n int) {
   159  	if m == nil {
   160  		return 0
   161  	}
   162  	var l int
   163  	_ = l
   164  	if m.String_ != nil {
   165  		l = len(*m.String_)
   166  		n += 1 + l + sovGogovanity(uint64(l))
   167  	}
   168  	n += 1 + sovGogovanity(uint64(m.Int64))
   169  	if m.Int32 != nil {
   170  		n += 1 + sovGogovanity(uint64(*m.Int32))
   171  	}
   172  	return n
   173  }
   174  
   175  func sovGogovanity(x uint64) (n int) {
   176  	return (math_bits.Len64(x|1) + 6) / 7
   177  }
   178  func sozGogovanity(x uint64) (n int) {
   179  	return sovGogovanity(uint64((x << 1) ^ uint64((int64(x) >> 63))))
   180  }
   181  func (m *B) Unmarshal(dAtA []byte) error {
   182  	l := len(dAtA)
   183  	iNdEx := 0
   184  	for iNdEx < l {
   185  		preIndex := iNdEx
   186  		var wire uint64
   187  		for shift := uint(0); ; shift += 7 {
   188  			if shift >= 64 {
   189  				return ErrIntOverflowGogovanity
   190  			}
   191  			if iNdEx >= l {
   192  				return io.ErrUnexpectedEOF
   193  			}
   194  			b := dAtA[iNdEx]
   195  			iNdEx++
   196  			wire |= uint64(b&0x7F) << shift
   197  			if b < 0x80 {
   198  				break
   199  			}
   200  		}
   201  		fieldNum := int32(wire >> 3)
   202  		wireType := int(wire & 0x7)
   203  		if wireType == 4 {
   204  			return fmt.Errorf("proto: B: wiretype end group for non-group")
   205  		}
   206  		if fieldNum <= 0 {
   207  			return fmt.Errorf("proto: B: illegal tag %d (wire type %d)", fieldNum, wire)
   208  		}
   209  		switch fieldNum {
   210  		case 1:
   211  			if wireType != 2 {
   212  				return fmt.Errorf("proto: wrong wireType = %d for field String_", wireType)
   213  			}
   214  			var stringLen uint64
   215  			for shift := uint(0); ; shift += 7 {
   216  				if shift >= 64 {
   217  					return ErrIntOverflowGogovanity
   218  				}
   219  				if iNdEx >= l {
   220  					return io.ErrUnexpectedEOF
   221  				}
   222  				b := dAtA[iNdEx]
   223  				iNdEx++
   224  				stringLen |= uint64(b&0x7F) << shift
   225  				if b < 0x80 {
   226  					break
   227  				}
   228  			}
   229  			intStringLen := int(stringLen)
   230  			if intStringLen < 0 {
   231  				return ErrInvalidLengthGogovanity
   232  			}
   233  			postIndex := iNdEx + intStringLen
   234  			if postIndex < 0 {
   235  				return ErrInvalidLengthGogovanity
   236  			}
   237  			if postIndex > l {
   238  				return io.ErrUnexpectedEOF
   239  			}
   240  			s := string(dAtA[iNdEx:postIndex])
   241  			m.String_ = &s
   242  			iNdEx = postIndex
   243  		case 2:
   244  			if wireType != 0 {
   245  				return fmt.Errorf("proto: wrong wireType = %d for field Int64", wireType)
   246  			}
   247  			m.Int64 = 0
   248  			for shift := uint(0); ; shift += 7 {
   249  				if shift >= 64 {
   250  					return ErrIntOverflowGogovanity
   251  				}
   252  				if iNdEx >= l {
   253  					return io.ErrUnexpectedEOF
   254  				}
   255  				b := dAtA[iNdEx]
   256  				iNdEx++
   257  				m.Int64 |= int64(b&0x7F) << shift
   258  				if b < 0x80 {
   259  					break
   260  				}
   261  			}
   262  		case 3:
   263  			if wireType != 0 {
   264  				return fmt.Errorf("proto: wrong wireType = %d for field Int32", wireType)
   265  			}
   266  			var v int32
   267  			for shift := uint(0); ; shift += 7 {
   268  				if shift >= 64 {
   269  					return ErrIntOverflowGogovanity
   270  				}
   271  				if iNdEx >= l {
   272  					return io.ErrUnexpectedEOF
   273  				}
   274  				b := dAtA[iNdEx]
   275  				iNdEx++
   276  				v |= int32(b&0x7F) << shift
   277  				if b < 0x80 {
   278  					break
   279  				}
   280  			}
   281  			m.Int32 = &v
   282  		default:
   283  			iNdEx = preIndex
   284  			skippy, err := skipGogovanity(dAtA[iNdEx:])
   285  			if err != nil {
   286  				return err
   287  			}
   288  			if (skippy < 0) || (iNdEx+skippy) < 0 {
   289  				return ErrInvalidLengthGogovanity
   290  			}
   291  			if (iNdEx + skippy) > l {
   292  				return io.ErrUnexpectedEOF
   293  			}
   294  			iNdEx += skippy
   295  		}
   296  	}
   297  
   298  	if iNdEx > l {
   299  		return io.ErrUnexpectedEOF
   300  	}
   301  	return nil
   302  }
   303  func skipGogovanity(dAtA []byte) (n int, err error) {
   304  	l := len(dAtA)
   305  	iNdEx := 0
   306  	depth := 0
   307  	for iNdEx < l {
   308  		var wire uint64
   309  		for shift := uint(0); ; shift += 7 {
   310  			if shift >= 64 {
   311  				return 0, ErrIntOverflowGogovanity
   312  			}
   313  			if iNdEx >= l {
   314  				return 0, io.ErrUnexpectedEOF
   315  			}
   316  			b := dAtA[iNdEx]
   317  			iNdEx++
   318  			wire |= (uint64(b) & 0x7F) << shift
   319  			if b < 0x80 {
   320  				break
   321  			}
   322  		}
   323  		wireType := int(wire & 0x7)
   324  		switch wireType {
   325  		case 0:
   326  			for shift := uint(0); ; shift += 7 {
   327  				if shift >= 64 {
   328  					return 0, ErrIntOverflowGogovanity
   329  				}
   330  				if iNdEx >= l {
   331  					return 0, io.ErrUnexpectedEOF
   332  				}
   333  				iNdEx++
   334  				if dAtA[iNdEx-1] < 0x80 {
   335  					break
   336  				}
   337  			}
   338  		case 1:
   339  			iNdEx += 8
   340  		case 2:
   341  			var length int
   342  			for shift := uint(0); ; shift += 7 {
   343  				if shift >= 64 {
   344  					return 0, ErrIntOverflowGogovanity
   345  				}
   346  				if iNdEx >= l {
   347  					return 0, io.ErrUnexpectedEOF
   348  				}
   349  				b := dAtA[iNdEx]
   350  				iNdEx++
   351  				length |= (int(b) & 0x7F) << shift
   352  				if b < 0x80 {
   353  					break
   354  				}
   355  			}
   356  			if length < 0 {
   357  				return 0, ErrInvalidLengthGogovanity
   358  			}
   359  			iNdEx += length
   360  		case 3:
   361  			depth++
   362  		case 4:
   363  			if depth == 0 {
   364  				return 0, ErrUnexpectedEndOfGroupGogovanity
   365  			}
   366  			depth--
   367  		case 5:
   368  			iNdEx += 4
   369  		default:
   370  			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
   371  		}
   372  		if iNdEx < 0 {
   373  			return 0, ErrInvalidLengthGogovanity
   374  		}
   375  		if depth == 0 {
   376  			return iNdEx, nil
   377  		}
   378  	}
   379  	return 0, io.ErrUnexpectedEOF
   380  }
   381  
   382  var (
   383  	ErrInvalidLengthGogovanity        = fmt.Errorf("proto: negative length found during unmarshaling")
   384  	ErrIntOverflowGogovanity          = fmt.Errorf("proto: integer overflow")
   385  	ErrUnexpectedEndOfGroupGogovanity = fmt.Errorf("proto: unexpected end of group")
   386  )
   387  

View as plain text