...

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

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

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: vanity.proto
     3  
     4  package vanity
     5  
     6  import (
     7  	fmt "fmt"
     8  	github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
     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 A struct {
    27  	Strings string `protobuf:"bytes,1,opt,name=Strings" json:"Strings"`
    28  	Int     int64  `protobuf:"varint,2,req,name=Int" json:"Int"`
    29  }
    30  
    31  func (m *A) Reset()         { *m = A{} }
    32  func (m *A) String() string { return proto.CompactTextString(m) }
    33  func (*A) ProtoMessage()    {}
    34  func (*A) Descriptor() ([]byte, []int) {
    35  	return fileDescriptor_d4f40d14cd1329d6, []int{0}
    36  }
    37  func (m *A) XXX_Unmarshal(b []byte) error {
    38  	return m.Unmarshal(b)
    39  }
    40  func (m *A) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    41  	if deterministic {
    42  		return xxx_messageInfo_A.Marshal(b, m, deterministic)
    43  	} else {
    44  		b = b[:cap(b)]
    45  		n, err := m.MarshalToSizedBuffer(b)
    46  		if err != nil {
    47  			return nil, err
    48  		}
    49  		return b[:n], nil
    50  	}
    51  }
    52  func (m *A) XXX_Merge(src proto.Message) {
    53  	xxx_messageInfo_A.Merge(m, src)
    54  }
    55  func (m *A) XXX_Size() int {
    56  	return m.Size()
    57  }
    58  func (m *A) XXX_DiscardUnknown() {
    59  	xxx_messageInfo_A.DiscardUnknown(m)
    60  }
    61  
    62  var xxx_messageInfo_A proto.InternalMessageInfo
    63  
    64  func (m *A) GetStrings() string {
    65  	if m != nil {
    66  		return m.Strings
    67  	}
    68  	return ""
    69  }
    70  
    71  func (m *A) GetInt() int64 {
    72  	if m != nil {
    73  		return m.Int
    74  	}
    75  	return 0
    76  }
    77  
    78  func init() {
    79  	proto.RegisterType((*A)(nil), "vanity.A")
    80  }
    81  
    82  func init() { proto.RegisterFile("vanity.proto", fileDescriptor_d4f40d14cd1329d6) }
    83  
    84  var fileDescriptor_d4f40d14cd1329d6 = []byte{
    85  	// 117 bytes of a gzipped FileDescriptorProto
    86  	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x4b, 0xcc, 0xcb,
    87  	0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, 0x94, 0xac, 0xb9, 0x18,
    88  	0x1d, 0x85, 0xe4, 0xb8, 0xd8, 0x83, 0x4b, 0x8a, 0x32, 0xf3, 0xd2, 0x8b, 0x25, 0x18, 0x15, 0x18,
    89  	0x35, 0x38, 0x9d, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0x09, 0x0a, 0x89, 0x71, 0x31, 0x7b,
    90  	0xe6, 0x95, 0x48, 0x30, 0x29, 0x30, 0x69, 0x30, 0x43, 0xe5, 0x40, 0x02, 0x4e, 0x12, 0x27, 0x1e,
    91  	0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17,
    92  	0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x00, 0x08, 0x00, 0x00, 0xff, 0xff, 0x8b, 0x2e, 0x6a,
    93  	0x0c, 0x6d, 0x00, 0x00, 0x00,
    94  }
    95  
    96  func (m *A) Marshal() (dAtA []byte, err error) {
    97  	size := m.Size()
    98  	dAtA = make([]byte, size)
    99  	n, err := m.MarshalToSizedBuffer(dAtA[:size])
   100  	if err != nil {
   101  		return nil, err
   102  	}
   103  	return dAtA[:n], nil
   104  }
   105  
   106  func (m *A) MarshalTo(dAtA []byte) (int, error) {
   107  	size := m.Size()
   108  	return m.MarshalToSizedBuffer(dAtA[:size])
   109  }
   110  
   111  func (m *A) MarshalToSizedBuffer(dAtA []byte) (int, error) {
   112  	i := len(dAtA)
   113  	_ = i
   114  	var l int
   115  	_ = l
   116  	i = encodeVarintVanity(dAtA, i, uint64(m.Int))
   117  	i--
   118  	dAtA[i] = 0x10
   119  	i -= len(m.Strings)
   120  	copy(dAtA[i:], m.Strings)
   121  	i = encodeVarintVanity(dAtA, i, uint64(len(m.Strings)))
   122  	i--
   123  	dAtA[i] = 0xa
   124  	return len(dAtA) - i, nil
   125  }
   126  
   127  func encodeVarintVanity(dAtA []byte, offset int, v uint64) int {
   128  	offset -= sovVanity(v)
   129  	base := offset
   130  	for v >= 1<<7 {
   131  		dAtA[offset] = uint8(v&0x7f | 0x80)
   132  		v >>= 7
   133  		offset++
   134  	}
   135  	dAtA[offset] = uint8(v)
   136  	return base
   137  }
   138  func (m *A) Size() (n int) {
   139  	if m == nil {
   140  		return 0
   141  	}
   142  	var l int
   143  	_ = l
   144  	l = len(m.Strings)
   145  	n += 1 + l + sovVanity(uint64(l))
   146  	n += 1 + sovVanity(uint64(m.Int))
   147  	return n
   148  }
   149  
   150  func sovVanity(x uint64) (n int) {
   151  	return (math_bits.Len64(x|1) + 6) / 7
   152  }
   153  func sozVanity(x uint64) (n int) {
   154  	return sovVanity(uint64((x << 1) ^ uint64((int64(x) >> 63))))
   155  }
   156  func (m *A) Unmarshal(dAtA []byte) error {
   157  	var hasFields [1]uint64
   158  	l := len(dAtA)
   159  	iNdEx := 0
   160  	for iNdEx < l {
   161  		preIndex := iNdEx
   162  		var wire uint64
   163  		for shift := uint(0); ; shift += 7 {
   164  			if shift >= 64 {
   165  				return ErrIntOverflowVanity
   166  			}
   167  			if iNdEx >= l {
   168  				return io.ErrUnexpectedEOF
   169  			}
   170  			b := dAtA[iNdEx]
   171  			iNdEx++
   172  			wire |= uint64(b&0x7F) << shift
   173  			if b < 0x80 {
   174  				break
   175  			}
   176  		}
   177  		fieldNum := int32(wire >> 3)
   178  		wireType := int(wire & 0x7)
   179  		if wireType == 4 {
   180  			return fmt.Errorf("proto: A: wiretype end group for non-group")
   181  		}
   182  		if fieldNum <= 0 {
   183  			return fmt.Errorf("proto: A: illegal tag %d (wire type %d)", fieldNum, wire)
   184  		}
   185  		switch fieldNum {
   186  		case 1:
   187  			if wireType != 2 {
   188  				return fmt.Errorf("proto: wrong wireType = %d for field Strings", wireType)
   189  			}
   190  			var stringLen uint64
   191  			for shift := uint(0); ; shift += 7 {
   192  				if shift >= 64 {
   193  					return ErrIntOverflowVanity
   194  				}
   195  				if iNdEx >= l {
   196  					return io.ErrUnexpectedEOF
   197  				}
   198  				b := dAtA[iNdEx]
   199  				iNdEx++
   200  				stringLen |= uint64(b&0x7F) << shift
   201  				if b < 0x80 {
   202  					break
   203  				}
   204  			}
   205  			intStringLen := int(stringLen)
   206  			if intStringLen < 0 {
   207  				return ErrInvalidLengthVanity
   208  			}
   209  			postIndex := iNdEx + intStringLen
   210  			if postIndex < 0 {
   211  				return ErrInvalidLengthVanity
   212  			}
   213  			if postIndex > l {
   214  				return io.ErrUnexpectedEOF
   215  			}
   216  			m.Strings = string(dAtA[iNdEx:postIndex])
   217  			iNdEx = postIndex
   218  		case 2:
   219  			if wireType != 0 {
   220  				return fmt.Errorf("proto: wrong wireType = %d for field Int", wireType)
   221  			}
   222  			m.Int = 0
   223  			for shift := uint(0); ; shift += 7 {
   224  				if shift >= 64 {
   225  					return ErrIntOverflowVanity
   226  				}
   227  				if iNdEx >= l {
   228  					return io.ErrUnexpectedEOF
   229  				}
   230  				b := dAtA[iNdEx]
   231  				iNdEx++
   232  				m.Int |= int64(b&0x7F) << shift
   233  				if b < 0x80 {
   234  					break
   235  				}
   236  			}
   237  			hasFields[0] |= uint64(0x00000001)
   238  		default:
   239  			iNdEx = preIndex
   240  			skippy, err := skipVanity(dAtA[iNdEx:])
   241  			if err != nil {
   242  				return err
   243  			}
   244  			if (skippy < 0) || (iNdEx+skippy) < 0 {
   245  				return ErrInvalidLengthVanity
   246  			}
   247  			if (iNdEx + skippy) > l {
   248  				return io.ErrUnexpectedEOF
   249  			}
   250  			iNdEx += skippy
   251  		}
   252  	}
   253  	if hasFields[0]&uint64(0x00000001) == 0 {
   254  		return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Int")
   255  	}
   256  
   257  	if iNdEx > l {
   258  		return io.ErrUnexpectedEOF
   259  	}
   260  	return nil
   261  }
   262  func skipVanity(dAtA []byte) (n int, err error) {
   263  	l := len(dAtA)
   264  	iNdEx := 0
   265  	depth := 0
   266  	for iNdEx < l {
   267  		var wire uint64
   268  		for shift := uint(0); ; shift += 7 {
   269  			if shift >= 64 {
   270  				return 0, ErrIntOverflowVanity
   271  			}
   272  			if iNdEx >= l {
   273  				return 0, io.ErrUnexpectedEOF
   274  			}
   275  			b := dAtA[iNdEx]
   276  			iNdEx++
   277  			wire |= (uint64(b) & 0x7F) << shift
   278  			if b < 0x80 {
   279  				break
   280  			}
   281  		}
   282  		wireType := int(wire & 0x7)
   283  		switch wireType {
   284  		case 0:
   285  			for shift := uint(0); ; shift += 7 {
   286  				if shift >= 64 {
   287  					return 0, ErrIntOverflowVanity
   288  				}
   289  				if iNdEx >= l {
   290  					return 0, io.ErrUnexpectedEOF
   291  				}
   292  				iNdEx++
   293  				if dAtA[iNdEx-1] < 0x80 {
   294  					break
   295  				}
   296  			}
   297  		case 1:
   298  			iNdEx += 8
   299  		case 2:
   300  			var length int
   301  			for shift := uint(0); ; shift += 7 {
   302  				if shift >= 64 {
   303  					return 0, ErrIntOverflowVanity
   304  				}
   305  				if iNdEx >= l {
   306  					return 0, io.ErrUnexpectedEOF
   307  				}
   308  				b := dAtA[iNdEx]
   309  				iNdEx++
   310  				length |= (int(b) & 0x7F) << shift
   311  				if b < 0x80 {
   312  					break
   313  				}
   314  			}
   315  			if length < 0 {
   316  				return 0, ErrInvalidLengthVanity
   317  			}
   318  			iNdEx += length
   319  		case 3:
   320  			depth++
   321  		case 4:
   322  			if depth == 0 {
   323  				return 0, ErrUnexpectedEndOfGroupVanity
   324  			}
   325  			depth--
   326  		case 5:
   327  			iNdEx += 4
   328  		default:
   329  			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
   330  		}
   331  		if iNdEx < 0 {
   332  			return 0, ErrInvalidLengthVanity
   333  		}
   334  		if depth == 0 {
   335  			return iNdEx, nil
   336  		}
   337  	}
   338  	return 0, io.ErrUnexpectedEOF
   339  }
   340  
   341  var (
   342  	ErrInvalidLengthVanity        = fmt.Errorf("proto: negative length found during unmarshaling")
   343  	ErrIntOverflowVanity          = fmt.Errorf("proto: integer overflow")
   344  	ErrUnexpectedEndOfGroupVanity = fmt.Errorf("proto: unexpected end of group")
   345  )
   346  

View as plain text