...

Source file src/github.com/gogo/protobuf/types/field_mask.pb.go

Documentation: github.com/gogo/protobuf/types

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: google/protobuf/field_mask.proto
     3  
     4  package types
     5  
     6  import (
     7  	bytes "bytes"
     8  	fmt "fmt"
     9  	proto "github.com/gogo/protobuf/proto"
    10  	io "io"
    11  	math "math"
    12  	math_bits "math/bits"
    13  	reflect "reflect"
    14  	strings "strings"
    15  )
    16  
    17  // Reference imports to suppress errors if they are not otherwise used.
    18  var _ = proto.Marshal
    19  var _ = fmt.Errorf
    20  var _ = math.Inf
    21  
    22  // This is a compile-time assertion to ensure that this generated file
    23  // is compatible with the proto package it is being compiled against.
    24  // A compilation error at this line likely means your copy of the
    25  // proto package needs to be updated.
    26  const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
    27  
    28  // `FieldMask` represents a set of symbolic field paths, for example:
    29  //
    30  //     paths: "f.a"
    31  //     paths: "f.b.d"
    32  //
    33  // Here `f` represents a field in some root message, `a` and `b`
    34  // fields in the message found in `f`, and `d` a field found in the
    35  // message in `f.b`.
    36  //
    37  // Field masks are used to specify a subset of fields that should be
    38  // returned by a get operation or modified by an update operation.
    39  // Field masks also have a custom JSON encoding (see below).
    40  //
    41  // # Field Masks in Projections
    42  //
    43  // When used in the context of a projection, a response message or
    44  // sub-message is filtered by the API to only contain those fields as
    45  // specified in the mask. For example, if the mask in the previous
    46  // example is applied to a response message as follows:
    47  //
    48  //     f {
    49  //       a : 22
    50  //       b {
    51  //         d : 1
    52  //         x : 2
    53  //       }
    54  //       y : 13
    55  //     }
    56  //     z: 8
    57  //
    58  // The result will not contain specific values for fields x,y and z
    59  // (their value will be set to the default, and omitted in proto text
    60  // output):
    61  //
    62  //
    63  //     f {
    64  //       a : 22
    65  //       b {
    66  //         d : 1
    67  //       }
    68  //     }
    69  //
    70  // A repeated field is not allowed except at the last position of a
    71  // paths string.
    72  //
    73  // If a FieldMask object is not present in a get operation, the
    74  // operation applies to all fields (as if a FieldMask of all fields
    75  // had been specified).
    76  //
    77  // Note that a field mask does not necessarily apply to the
    78  // top-level response message. In case of a REST get operation, the
    79  // field mask applies directly to the response, but in case of a REST
    80  // list operation, the mask instead applies to each individual message
    81  // in the returned resource list. In case of a REST custom method,
    82  // other definitions may be used. Where the mask applies will be
    83  // clearly documented together with its declaration in the API.  In
    84  // any case, the effect on the returned resource/resources is required
    85  // behavior for APIs.
    86  //
    87  // # Field Masks in Update Operations
    88  //
    89  // A field mask in update operations specifies which fields of the
    90  // targeted resource are going to be updated. The API is required
    91  // to only change the values of the fields as specified in the mask
    92  // and leave the others untouched. If a resource is passed in to
    93  // describe the updated values, the API ignores the values of all
    94  // fields not covered by the mask.
    95  //
    96  // If a repeated field is specified for an update operation, new values will
    97  // be appended to the existing repeated field in the target resource. Note that
    98  // a repeated field is only allowed in the last position of a `paths` string.
    99  //
   100  // If a sub-message is specified in the last position of the field mask for an
   101  // update operation, then new value will be merged into the existing sub-message
   102  // in the target resource.
   103  //
   104  // For example, given the target message:
   105  //
   106  //     f {
   107  //       b {
   108  //         d: 1
   109  //         x: 2
   110  //       }
   111  //       c: [1]
   112  //     }
   113  //
   114  // And an update message:
   115  //
   116  //     f {
   117  //       b {
   118  //         d: 10
   119  //       }
   120  //       c: [2]
   121  //     }
   122  //
   123  // then if the field mask is:
   124  //
   125  //  paths: ["f.b", "f.c"]
   126  //
   127  // then the result will be:
   128  //
   129  //     f {
   130  //       b {
   131  //         d: 10
   132  //         x: 2
   133  //       }
   134  //       c: [1, 2]
   135  //     }
   136  //
   137  // An implementation may provide options to override this default behavior for
   138  // repeated and message fields.
   139  //
   140  // In order to reset a field's value to the default, the field must
   141  // be in the mask and set to the default value in the provided resource.
   142  // Hence, in order to reset all fields of a resource, provide a default
   143  // instance of the resource and set all fields in the mask, or do
   144  // not provide a mask as described below.
   145  //
   146  // If a field mask is not present on update, the operation applies to
   147  // all fields (as if a field mask of all fields has been specified).
   148  // Note that in the presence of schema evolution, this may mean that
   149  // fields the client does not know and has therefore not filled into
   150  // the request will be reset to their default. If this is unwanted
   151  // behavior, a specific service may require a client to always specify
   152  // a field mask, producing an error if not.
   153  //
   154  // As with get operations, the location of the resource which
   155  // describes the updated values in the request message depends on the
   156  // operation kind. In any case, the effect of the field mask is
   157  // required to be honored by the API.
   158  //
   159  // ## Considerations for HTTP REST
   160  //
   161  // The HTTP kind of an update operation which uses a field mask must
   162  // be set to PATCH instead of PUT in order to satisfy HTTP semantics
   163  // (PUT must only be used for full updates).
   164  //
   165  // # JSON Encoding of Field Masks
   166  //
   167  // In JSON, a field mask is encoded as a single string where paths are
   168  // separated by a comma. Fields name in each path are converted
   169  // to/from lower-camel naming conventions.
   170  //
   171  // As an example, consider the following message declarations:
   172  //
   173  //     message Profile {
   174  //       User user = 1;
   175  //       Photo photo = 2;
   176  //     }
   177  //     message User {
   178  //       string display_name = 1;
   179  //       string address = 2;
   180  //     }
   181  //
   182  // In proto a field mask for `Profile` may look as such:
   183  //
   184  //     mask {
   185  //       paths: "user.display_name"
   186  //       paths: "photo"
   187  //     }
   188  //
   189  // In JSON, the same mask is represented as below:
   190  //
   191  //     {
   192  //       mask: "user.displayName,photo"
   193  //     }
   194  //
   195  // # Field Masks and Oneof Fields
   196  //
   197  // Field masks treat fields in oneofs just as regular fields. Consider the
   198  // following message:
   199  //
   200  //     message SampleMessage {
   201  //       oneof test_oneof {
   202  //         string name = 4;
   203  //         SubMessage sub_message = 9;
   204  //       }
   205  //     }
   206  //
   207  // The field mask can be:
   208  //
   209  //     mask {
   210  //       paths: "name"
   211  //     }
   212  //
   213  // Or:
   214  //
   215  //     mask {
   216  //       paths: "sub_message"
   217  //     }
   218  //
   219  // Note that oneof type names ("test_oneof" in this case) cannot be used in
   220  // paths.
   221  //
   222  // ## Field Mask Verification
   223  //
   224  // The implementation of any API method which has a FieldMask type field in the
   225  // request should verify the included field paths, and return an
   226  // `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
   227  type FieldMask struct {
   228  	// The set of field mask paths.
   229  	Paths                []string `protobuf:"bytes,1,rep,name=paths,proto3" json:"paths,omitempty"`
   230  	XXX_NoUnkeyedLiteral struct{} `json:"-"`
   231  	XXX_unrecognized     []byte   `json:"-"`
   232  	XXX_sizecache        int32    `json:"-"`
   233  }
   234  
   235  func (m *FieldMask) Reset()      { *m = FieldMask{} }
   236  func (*FieldMask) ProtoMessage() {}
   237  func (*FieldMask) Descriptor() ([]byte, []int) {
   238  	return fileDescriptor_5158202634f0da48, []int{0}
   239  }
   240  func (m *FieldMask) XXX_Unmarshal(b []byte) error {
   241  	return m.Unmarshal(b)
   242  }
   243  func (m *FieldMask) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
   244  	if deterministic {
   245  		return xxx_messageInfo_FieldMask.Marshal(b, m, deterministic)
   246  	} else {
   247  		b = b[:cap(b)]
   248  		n, err := m.MarshalToSizedBuffer(b)
   249  		if err != nil {
   250  			return nil, err
   251  		}
   252  		return b[:n], nil
   253  	}
   254  }
   255  func (m *FieldMask) XXX_Merge(src proto.Message) {
   256  	xxx_messageInfo_FieldMask.Merge(m, src)
   257  }
   258  func (m *FieldMask) XXX_Size() int {
   259  	return m.Size()
   260  }
   261  func (m *FieldMask) XXX_DiscardUnknown() {
   262  	xxx_messageInfo_FieldMask.DiscardUnknown(m)
   263  }
   264  
   265  var xxx_messageInfo_FieldMask proto.InternalMessageInfo
   266  
   267  func (m *FieldMask) GetPaths() []string {
   268  	if m != nil {
   269  		return m.Paths
   270  	}
   271  	return nil
   272  }
   273  
   274  func (*FieldMask) XXX_MessageName() string {
   275  	return "google.protobuf.FieldMask"
   276  }
   277  func init() {
   278  	proto.RegisterType((*FieldMask)(nil), "google.protobuf.FieldMask")
   279  }
   280  
   281  func init() { proto.RegisterFile("google/protobuf/field_mask.proto", fileDescriptor_5158202634f0da48) }
   282  
   283  var fileDescriptor_5158202634f0da48 = []byte{
   284  	// 203 bytes of a gzipped FileDescriptorProto
   285  	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xcf, 0xcf, 0x4f,
   286  	0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcb, 0x4c, 0xcd,
   287  	0x49, 0x89, 0xcf, 0x4d, 0x2c, 0xce, 0xd6, 0x03, 0x8b, 0x09, 0xf1, 0x43, 0x54, 0xe8, 0xc1, 0x54,
   288  	0x28, 0x29, 0x72, 0x71, 0xba, 0x81, 0x14, 0xf9, 0x26, 0x16, 0x67, 0x0b, 0x89, 0x70, 0xb1, 0x16,
   289  	0x24, 0x96, 0x64, 0x14, 0x4b, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x06, 0x41, 0x38, 0x4e, 0x1d, 0x8c,
   290  	0x37, 0x1e, 0xca, 0x31, 0x7c, 0x78, 0x28, 0xc7, 0xf8, 0xe3, 0xa1, 0x1c, 0x63, 0xc3, 0x23, 0x39,
   291  	0xc6, 0x15, 0x8f, 0xe4, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23,
   292  	0x39, 0xc6, 0x17, 0x8f, 0xe4, 0x18, 0x3e, 0x80, 0xc4, 0x1f, 0xcb, 0x31, 0x9e, 0x78, 0x2c, 0xc7,
   293  	0xc8, 0x25, 0x9c, 0x9c, 0x9f, 0xab, 0x87, 0x66, 0x95, 0x13, 0x1f, 0xdc, 0xa2, 0x00, 0x90, 0x50,
   294  	0x00, 0x63, 0x14, 0x6b, 0x49, 0x65, 0x41, 0x6a, 0xf1, 0x0f, 0x46, 0xc6, 0x45, 0x4c, 0xcc, 0xee,
   295  	0x01, 0x4e, 0xab, 0x98, 0xe4, 0xdc, 0x21, 0x7a, 0x02, 0xa0, 0x7a, 0xf4, 0xc2, 0x53, 0x73, 0x72,
   296  	0xbc, 0xf3, 0xf2, 0xcb, 0xf3, 0x42, 0x40, 0x2a, 0x93, 0xd8, 0xc0, 0x86, 0x19, 0x03, 0x02, 0x00,
   297  	0x00, 0xff, 0xff, 0x43, 0xa0, 0x83, 0xd0, 0xe9, 0x00, 0x00, 0x00,
   298  }
   299  
   300  func (this *FieldMask) Compare(that interface{}) int {
   301  	if that == nil {
   302  		if this == nil {
   303  			return 0
   304  		}
   305  		return 1
   306  	}
   307  
   308  	that1, ok := that.(*FieldMask)
   309  	if !ok {
   310  		that2, ok := that.(FieldMask)
   311  		if ok {
   312  			that1 = &that2
   313  		} else {
   314  			return 1
   315  		}
   316  	}
   317  	if that1 == nil {
   318  		if this == nil {
   319  			return 0
   320  		}
   321  		return 1
   322  	} else if this == nil {
   323  		return -1
   324  	}
   325  	if len(this.Paths) != len(that1.Paths) {
   326  		if len(this.Paths) < len(that1.Paths) {
   327  			return -1
   328  		}
   329  		return 1
   330  	}
   331  	for i := range this.Paths {
   332  		if this.Paths[i] != that1.Paths[i] {
   333  			if this.Paths[i] < that1.Paths[i] {
   334  				return -1
   335  			}
   336  			return 1
   337  		}
   338  	}
   339  	if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 {
   340  		return c
   341  	}
   342  	return 0
   343  }
   344  func (this *FieldMask) Equal(that interface{}) bool {
   345  	if that == nil {
   346  		return this == nil
   347  	}
   348  
   349  	that1, ok := that.(*FieldMask)
   350  	if !ok {
   351  		that2, ok := that.(FieldMask)
   352  		if ok {
   353  			that1 = &that2
   354  		} else {
   355  			return false
   356  		}
   357  	}
   358  	if that1 == nil {
   359  		return this == nil
   360  	} else if this == nil {
   361  		return false
   362  	}
   363  	if len(this.Paths) != len(that1.Paths) {
   364  		return false
   365  	}
   366  	for i := range this.Paths {
   367  		if this.Paths[i] != that1.Paths[i] {
   368  			return false
   369  		}
   370  	}
   371  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   372  		return false
   373  	}
   374  	return true
   375  }
   376  func (this *FieldMask) GoString() string {
   377  	if this == nil {
   378  		return "nil"
   379  	}
   380  	s := make([]string, 0, 5)
   381  	s = append(s, "&types.FieldMask{")
   382  	s = append(s, "Paths: "+fmt.Sprintf("%#v", this.Paths)+",\n")
   383  	if this.XXX_unrecognized != nil {
   384  		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
   385  	}
   386  	s = append(s, "}")
   387  	return strings.Join(s, "")
   388  }
   389  func valueToGoStringFieldMask(v interface{}, typ string) string {
   390  	rv := reflect.ValueOf(v)
   391  	if rv.IsNil() {
   392  		return "nil"
   393  	}
   394  	pv := reflect.Indirect(rv).Interface()
   395  	return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
   396  }
   397  func (m *FieldMask) Marshal() (dAtA []byte, err error) {
   398  	size := m.Size()
   399  	dAtA = make([]byte, size)
   400  	n, err := m.MarshalToSizedBuffer(dAtA[:size])
   401  	if err != nil {
   402  		return nil, err
   403  	}
   404  	return dAtA[:n], nil
   405  }
   406  
   407  func (m *FieldMask) MarshalTo(dAtA []byte) (int, error) {
   408  	size := m.Size()
   409  	return m.MarshalToSizedBuffer(dAtA[:size])
   410  }
   411  
   412  func (m *FieldMask) MarshalToSizedBuffer(dAtA []byte) (int, error) {
   413  	i := len(dAtA)
   414  	_ = i
   415  	var l int
   416  	_ = l
   417  	if m.XXX_unrecognized != nil {
   418  		i -= len(m.XXX_unrecognized)
   419  		copy(dAtA[i:], m.XXX_unrecognized)
   420  	}
   421  	if len(m.Paths) > 0 {
   422  		for iNdEx := len(m.Paths) - 1; iNdEx >= 0; iNdEx-- {
   423  			i -= len(m.Paths[iNdEx])
   424  			copy(dAtA[i:], m.Paths[iNdEx])
   425  			i = encodeVarintFieldMask(dAtA, i, uint64(len(m.Paths[iNdEx])))
   426  			i--
   427  			dAtA[i] = 0xa
   428  		}
   429  	}
   430  	return len(dAtA) - i, nil
   431  }
   432  
   433  func encodeVarintFieldMask(dAtA []byte, offset int, v uint64) int {
   434  	offset -= sovFieldMask(v)
   435  	base := offset
   436  	for v >= 1<<7 {
   437  		dAtA[offset] = uint8(v&0x7f | 0x80)
   438  		v >>= 7
   439  		offset++
   440  	}
   441  	dAtA[offset] = uint8(v)
   442  	return base
   443  }
   444  func NewPopulatedFieldMask(r randyFieldMask, easy bool) *FieldMask {
   445  	this := &FieldMask{}
   446  	v1 := r.Intn(10)
   447  	this.Paths = make([]string, v1)
   448  	for i := 0; i < v1; i++ {
   449  		this.Paths[i] = string(randStringFieldMask(r))
   450  	}
   451  	if !easy && r.Intn(10) != 0 {
   452  		this.XXX_unrecognized = randUnrecognizedFieldMask(r, 2)
   453  	}
   454  	return this
   455  }
   456  
   457  type randyFieldMask interface {
   458  	Float32() float32
   459  	Float64() float64
   460  	Int63() int64
   461  	Int31() int32
   462  	Uint32() uint32
   463  	Intn(n int) int
   464  }
   465  
   466  func randUTF8RuneFieldMask(r randyFieldMask) rune {
   467  	ru := r.Intn(62)
   468  	if ru < 10 {
   469  		return rune(ru + 48)
   470  	} else if ru < 36 {
   471  		return rune(ru + 55)
   472  	}
   473  	return rune(ru + 61)
   474  }
   475  func randStringFieldMask(r randyFieldMask) string {
   476  	v2 := r.Intn(100)
   477  	tmps := make([]rune, v2)
   478  	for i := 0; i < v2; i++ {
   479  		tmps[i] = randUTF8RuneFieldMask(r)
   480  	}
   481  	return string(tmps)
   482  }
   483  func randUnrecognizedFieldMask(r randyFieldMask, maxFieldNumber int) (dAtA []byte) {
   484  	l := r.Intn(5)
   485  	for i := 0; i < l; i++ {
   486  		wire := r.Intn(4)
   487  		if wire == 3 {
   488  			wire = 5
   489  		}
   490  		fieldNumber := maxFieldNumber + r.Intn(100)
   491  		dAtA = randFieldFieldMask(dAtA, r, fieldNumber, wire)
   492  	}
   493  	return dAtA
   494  }
   495  func randFieldFieldMask(dAtA []byte, r randyFieldMask, fieldNumber int, wire int) []byte {
   496  	key := uint32(fieldNumber)<<3 | uint32(wire)
   497  	switch wire {
   498  	case 0:
   499  		dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(key))
   500  		v3 := r.Int63()
   501  		if r.Intn(2) == 0 {
   502  			v3 *= -1
   503  		}
   504  		dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(v3))
   505  	case 1:
   506  		dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(key))
   507  		dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
   508  	case 2:
   509  		dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(key))
   510  		ll := r.Intn(100)
   511  		dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(ll))
   512  		for j := 0; j < ll; j++ {
   513  			dAtA = append(dAtA, byte(r.Intn(256)))
   514  		}
   515  	default:
   516  		dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(key))
   517  		dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
   518  	}
   519  	return dAtA
   520  }
   521  func encodeVarintPopulateFieldMask(dAtA []byte, v uint64) []byte {
   522  	for v >= 1<<7 {
   523  		dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
   524  		v >>= 7
   525  	}
   526  	dAtA = append(dAtA, uint8(v))
   527  	return dAtA
   528  }
   529  func (m *FieldMask) Size() (n int) {
   530  	if m == nil {
   531  		return 0
   532  	}
   533  	var l int
   534  	_ = l
   535  	if len(m.Paths) > 0 {
   536  		for _, s := range m.Paths {
   537  			l = len(s)
   538  			n += 1 + l + sovFieldMask(uint64(l))
   539  		}
   540  	}
   541  	if m.XXX_unrecognized != nil {
   542  		n += len(m.XXX_unrecognized)
   543  	}
   544  	return n
   545  }
   546  
   547  func sovFieldMask(x uint64) (n int) {
   548  	return (math_bits.Len64(x|1) + 6) / 7
   549  }
   550  func sozFieldMask(x uint64) (n int) {
   551  	return sovFieldMask(uint64((x << 1) ^ uint64((int64(x) >> 63))))
   552  }
   553  func (this *FieldMask) String() string {
   554  	if this == nil {
   555  		return "nil"
   556  	}
   557  	s := strings.Join([]string{`&FieldMask{`,
   558  		`Paths:` + fmt.Sprintf("%v", this.Paths) + `,`,
   559  		`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
   560  		`}`,
   561  	}, "")
   562  	return s
   563  }
   564  func valueToStringFieldMask(v interface{}) string {
   565  	rv := reflect.ValueOf(v)
   566  	if rv.IsNil() {
   567  		return "nil"
   568  	}
   569  	pv := reflect.Indirect(rv).Interface()
   570  	return fmt.Sprintf("*%v", pv)
   571  }
   572  func (m *FieldMask) Unmarshal(dAtA []byte) error {
   573  	l := len(dAtA)
   574  	iNdEx := 0
   575  	for iNdEx < l {
   576  		preIndex := iNdEx
   577  		var wire uint64
   578  		for shift := uint(0); ; shift += 7 {
   579  			if shift >= 64 {
   580  				return ErrIntOverflowFieldMask
   581  			}
   582  			if iNdEx >= l {
   583  				return io.ErrUnexpectedEOF
   584  			}
   585  			b := dAtA[iNdEx]
   586  			iNdEx++
   587  			wire |= uint64(b&0x7F) << shift
   588  			if b < 0x80 {
   589  				break
   590  			}
   591  		}
   592  		fieldNum := int32(wire >> 3)
   593  		wireType := int(wire & 0x7)
   594  		if wireType == 4 {
   595  			return fmt.Errorf("proto: FieldMask: wiretype end group for non-group")
   596  		}
   597  		if fieldNum <= 0 {
   598  			return fmt.Errorf("proto: FieldMask: illegal tag %d (wire type %d)", fieldNum, wire)
   599  		}
   600  		switch fieldNum {
   601  		case 1:
   602  			if wireType != 2 {
   603  				return fmt.Errorf("proto: wrong wireType = %d for field Paths", wireType)
   604  			}
   605  			var stringLen uint64
   606  			for shift := uint(0); ; shift += 7 {
   607  				if shift >= 64 {
   608  					return ErrIntOverflowFieldMask
   609  				}
   610  				if iNdEx >= l {
   611  					return io.ErrUnexpectedEOF
   612  				}
   613  				b := dAtA[iNdEx]
   614  				iNdEx++
   615  				stringLen |= uint64(b&0x7F) << shift
   616  				if b < 0x80 {
   617  					break
   618  				}
   619  			}
   620  			intStringLen := int(stringLen)
   621  			if intStringLen < 0 {
   622  				return ErrInvalidLengthFieldMask
   623  			}
   624  			postIndex := iNdEx + intStringLen
   625  			if postIndex < 0 {
   626  				return ErrInvalidLengthFieldMask
   627  			}
   628  			if postIndex > l {
   629  				return io.ErrUnexpectedEOF
   630  			}
   631  			m.Paths = append(m.Paths, string(dAtA[iNdEx:postIndex]))
   632  			iNdEx = postIndex
   633  		default:
   634  			iNdEx = preIndex
   635  			skippy, err := skipFieldMask(dAtA[iNdEx:])
   636  			if err != nil {
   637  				return err
   638  			}
   639  			if (skippy < 0) || (iNdEx+skippy) < 0 {
   640  				return ErrInvalidLengthFieldMask
   641  			}
   642  			if (iNdEx + skippy) > l {
   643  				return io.ErrUnexpectedEOF
   644  			}
   645  			m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
   646  			iNdEx += skippy
   647  		}
   648  	}
   649  
   650  	if iNdEx > l {
   651  		return io.ErrUnexpectedEOF
   652  	}
   653  	return nil
   654  }
   655  func skipFieldMask(dAtA []byte) (n int, err error) {
   656  	l := len(dAtA)
   657  	iNdEx := 0
   658  	depth := 0
   659  	for iNdEx < l {
   660  		var wire uint64
   661  		for shift := uint(0); ; shift += 7 {
   662  			if shift >= 64 {
   663  				return 0, ErrIntOverflowFieldMask
   664  			}
   665  			if iNdEx >= l {
   666  				return 0, io.ErrUnexpectedEOF
   667  			}
   668  			b := dAtA[iNdEx]
   669  			iNdEx++
   670  			wire |= (uint64(b) & 0x7F) << shift
   671  			if b < 0x80 {
   672  				break
   673  			}
   674  		}
   675  		wireType := int(wire & 0x7)
   676  		switch wireType {
   677  		case 0:
   678  			for shift := uint(0); ; shift += 7 {
   679  				if shift >= 64 {
   680  					return 0, ErrIntOverflowFieldMask
   681  				}
   682  				if iNdEx >= l {
   683  					return 0, io.ErrUnexpectedEOF
   684  				}
   685  				iNdEx++
   686  				if dAtA[iNdEx-1] < 0x80 {
   687  					break
   688  				}
   689  			}
   690  		case 1:
   691  			iNdEx += 8
   692  		case 2:
   693  			var length int
   694  			for shift := uint(0); ; shift += 7 {
   695  				if shift >= 64 {
   696  					return 0, ErrIntOverflowFieldMask
   697  				}
   698  				if iNdEx >= l {
   699  					return 0, io.ErrUnexpectedEOF
   700  				}
   701  				b := dAtA[iNdEx]
   702  				iNdEx++
   703  				length |= (int(b) & 0x7F) << shift
   704  				if b < 0x80 {
   705  					break
   706  				}
   707  			}
   708  			if length < 0 {
   709  				return 0, ErrInvalidLengthFieldMask
   710  			}
   711  			iNdEx += length
   712  		case 3:
   713  			depth++
   714  		case 4:
   715  			if depth == 0 {
   716  				return 0, ErrUnexpectedEndOfGroupFieldMask
   717  			}
   718  			depth--
   719  		case 5:
   720  			iNdEx += 4
   721  		default:
   722  			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
   723  		}
   724  		if iNdEx < 0 {
   725  			return 0, ErrInvalidLengthFieldMask
   726  		}
   727  		if depth == 0 {
   728  			return iNdEx, nil
   729  		}
   730  	}
   731  	return 0, io.ErrUnexpectedEOF
   732  }
   733  
   734  var (
   735  	ErrInvalidLengthFieldMask        = fmt.Errorf("proto: negative length found during unmarshaling")
   736  	ErrIntOverflowFieldMask          = fmt.Errorf("proto: integer overflow")
   737  	ErrUnexpectedEndOfGroupFieldMask = fmt.Errorf("proto: unexpected end of group")
   738  )
   739  

View as plain text