// Retrieves requested field as a string, allowSet provides input sanitization. If an
// error occurs, returns either a `MissingFieldError` or an `UnsafeFieldError`.
199593
func GetStringFieldSafe(r *http.Request, fieldName string, allowSet AllowSet) (string, error) {
	if _, ok := r.Form[fieldName]; !ok {
		return "", MissingFieldError{fieldName}
	}

	fieldValue := r.FormValue(fieldName)
	err := allowSet.IsSafe(fieldValue)
	if err != nil {
		return "", UnsafeFieldError{fieldName, err.Error()}
	}

	return fieldValue, nil
}
1270042
func (f *Form) GetField(name string) *Field {
	for _, field := range f.Fields {
		if field.Name == name {
			return field
		}
	}
	return nil
}
186783
func (ai *AtomicInt) GetAndSet(newValue int) int {
	res := int(atomic.SwapInt64(&ai.val, int64(newValue)))
	return res
}
862270
func (i *InteractionRestriction) GetLimit() string {
	if i == nil || i.Limit == nil {
		return ""
	}
	return *i.Limit
}
526006
func (enc *ltsvEncoder) safeAddString(s string) {
	for i := 0; i < len(s); {
		if enc.tryAddRuneSelf(s[i]) {
			i++
			continue
		}
		r, size := utf8.DecodeRuneInString(s[i:])
		if enc.tryAddRuneError(r, size) {
			i++
			continue
		}
		enc.buf.AppendString(s[i : i+size])
		i += size
	}
}
1323055
func isSafeString(value interface{}) bool {
	if _, ok := value.(SafeString); ok {
		return true
	}
	return false
}
110974
func EnsureString(value interface{}) (string, error) {
	v := reflect.ValueOf(value)
	if v.Kind() == reflect.String {
		return v.String(), nil
	}
	if v.Type() == bytesType {
		return string(v.Interface().([]byte)), nil
	}
	return "", errors.New("must be either a string or byte slice")
}
384089
func GetIntField(r *http.Request, fieldName string) (int, error) {
	stringField, err := GetStringField(r, fieldName)
	if err != nil {
		return 0, err
	}
	intField, err := strconv.Atoi(stringField)
	if err != nil {
		return 0, InvalidFormatError{fieldName, stringField}
	}
	return intField, nil
}
936590
func (e UnverifiableTlfUpdateError) Error() string {
	return fmt.Sprintf("%s was last written by an unknown device claiming "+
		"to belong to user %s.  The device has possibly been revoked by the "+
		"user.  Use `keybase log send` to file an issue with the Keybase "+
		"admins.", e.Tlf, e.User)
}
1306400
func (l *AllowedLevel) Set(s string) error {
	switch s {
	case "debug":
		l.o = level.AllowDebug()
	case "info":
		l.o = level.AllowInfo()
	case "warn":
		l.o = level.AllowWarn()
	case "error":
		l.o = level.AllowError()
	default:
		return errors.Errorf("unrecognized log level %q", s)
	}
	l.s = s
	return nil
}
123901
func (i *InverseBloomFilter) getAndSet(index uint32, data []byte) []byte {
	indexPtr := (*unsafe.Pointer)(unsafe.Pointer(&i.array[index]))
	keyUnsafe := unsafe.Pointer(&data)
	var oldKey []byte
	for {
		oldKeyUnsafe := atomic.LoadPointer(indexPtr)
		if atomic.CompareAndSwapPointer(indexPtr, oldKeyUnsafe, keyUnsafe) {
			oldKeyPtr := (*[]byte)(oldKeyUnsafe)
			if oldKeyPtr != nil {
				oldKey = *oldKeyPtr
			}
			break
		}
	}
	return oldKey
}
550685
func (c *GetConfigSetsCall) ConfigSet(configSet string) *GetConfigSetsCall {
	c.urlParams_.Set("config_set", configSet)
	return c
}
1199060
func (s *Set) Allow(pubKeyHashes ...string) error {
	for _, pubKeyHash := range pubKeyHashes {
		parts := strings.Split(pubKeyHash, ":")
		if len(parts) != 2 {
			return errors.New("invalid public key hash, expected \"format:value\"")
		}
		format, value := parts[0], parts[1]

		switch strings.ToLower(format) {
		case "sha256":
			return s.allowSHA256(value)
		default:
			return errors.Errorf("unknown hash format %q", format)
		}
	}
	return nil
}
336943
func (q *QueryStringQuery) AllowLeadingWildcard(allowLeadingWildcard bool) *QueryStringQuery {
	q.allowLeadingWildcard = &allowLeadingWildcard
	return q
}
978446
func (s *PluginConstraints) Allows(v Version) bool {
	return s.Versions.Allows(v)
}
833922
func (b *BitSet) safeSet() []uint64 {
	if b.set == nil {
		b.set = make([]uint64, wordsNeeded(0))
	}
	return b.set
}
1195851
func (r *Response) GetAttribute(name string) string {
	for _, attr := range r.Assertion.AttributeStatement.Attributes {
		if attr.Name == name || attr.FriendlyName == name {
			return attr.AttributeValues[0].Value
		}
	}
	return ""
}