// BytesDefault reads bytes from config file with default value
543223
func (r *Reader) BytesDefault(name string, def []byte) []byte {
	b, err := r.r.Read(name)
	if err != nil {
		return def
	}
	return b
}
779006
func (r *Store) GetUint32Default(key string, def uint32) uint32 {
	if v, err := r.GetUint32(key); err == nil {
		return v
	}

	return def
}
368976
func DefaultDecode(data []byte, value interface{}) error {
	var buff bytes.Buffer
	de := gob.NewDecoder(&buff)

	_, err := buff.Write(data)
	if err != nil {
		return err
	}

	return de.Decode(value)
}
130670
func ConfigDefaults(providerDefaults schema.Defaults) schema.Defaults {
	defaults := schema.Defaults{
		JujuApplicationPath: JujuDefaultApplicationPath,
	}
	for key, value := range providerDefaults {
		if value == schema.Omit {
			continue
		}
		defaults[key] = value
	}
	return defaults
}
433955
func (l *Label) GetDefault() bool {
	if l == nil || l.Default == nil {
		return false
	}
	return *l.Default
}
491503
func (r *Store) GetStringDefault(key string, def string) string {
	v := r.GetEntry(key)
	if v == nil {
		return def
	}

	return v.StringDefault(def)
}
573905
func (e Entry) UintDefault(def uint) (uint, error) {
	v := e.ValueRaw
	if v == nil {
		return def, errFindParse.Format("uint", e.Key)
	}

	x64 := strconv.IntSize == 64
	var maxValue uint64 = math.MaxUint32
	if x64 {
		maxValue = math.MaxUint64
	}

	switch vv := v.(type) {
	case string:
		val, err := strconv.ParseUint(vv, 10, strconv.IntSize)
		if err != nil {
			return def, err
		}
		if val > uint64(maxValue) {
			return def, errFindParse.Format("uint", e.Key)
		}
		return uint(val), nil
	case uint:
		return vv, nil
	case uint8:
		return uint(vv), nil
	case uint16:
		return uint(vv), nil
	case uint32:
		return uint(vv), nil
	case uint64:
		if vv > uint64(maxValue) {
			return def, errFindParse.Format("uint", e.Key)
		}
		return uint(vv), nil
	case int:
		if vv < 0 || vv > int(maxValue) {
			return def, errFindParse.Format("uint", e.Key)
		}
		return uint(vv), nil
	}

	return def, errFindParse.Format("uint", e.Key)
}
426147
func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) {
	var canHaveDefault bool
	switch ft.Kind() {
	case reflect.Ptr:
		if ft.Elem().Kind() == reflect.Struct {
			nestedMessage = true
		} else {
			canHaveDefault = true // proto2 scalar field
		}

	case reflect.Slice:
		switch ft.Elem().Kind() {
		case reflect.Ptr:
			nestedMessage = true // repeated message
		case reflect.Uint8:
			canHaveDefault = true // bytes field
		}

	case reflect.Map:
		if ft.Elem().Kind() == reflect.Ptr {
			nestedMessage = true // map with message values
		}
	}

	if !canHaveDefault {
		if nestedMessage {
			return nil, true, nil
		}
		return nil, false, nil
	}

	// We now know that ft is a pointer or slice.
	sf = &scalarField{kind: ft.Elem().Kind()}

	// scalar fields without defaults
	if !prop.HasDefault {
		return sf, false, nil
	}

	// a scalar field: either *T or []byte
	switch ft.Elem().Kind() {
	case reflect.Bool:
		x, err := strconv.ParseBool(prop.Default)
		if err != nil {
			return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err)
		}
		sf.value = x
	case reflect.Float32:
		x, err := strconv.ParseFloat(prop.Default, 32)
		if err != nil {
			return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err)
		}
		sf.value = float32(x)
	case reflect.Float64:
		x, err := strconv.ParseFloat(prop.Default, 64)
		if err != nil {
			return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err)
		}
		sf.value = x
	case reflect.Int32:
		x, err := strconv.ParseInt(prop.Default, 10, 32)
		if err != nil {
			return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err)
		}
		sf.value = int32(x)
	case reflect.Int64:
		x, err := strconv.ParseInt(prop.Default, 10, 64)
		if err != nil {
			return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err)
		}
		sf.value = x
	case reflect.String:
		sf.value = prop.Default
	case reflect.Uint8:
		// []byte (not *uint8)
		sf.value = []byte(prop.Default)
	case reflect.Uint32:
		x, err := strconv.ParseUint(prop.Default, 10, 32)
		if err != nil {
			return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err)
		}
		sf.value = uint32(x)
	case reflect.Uint64:
		x, err := strconv.ParseUint(prop.Default, 10, 64)
		if err != nil {
			return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err)
		}
		sf.value = x
	default:
		return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind())
	}

	return sf, false, nil
}
47534
func (e Entry) Int8Default(def int8) (int8, error) {
	v := e.ValueRaw
	if v == nil {
		return def, errFindParse.Format("int8", e.Key)
	}

	switch vv := v.(type) {
	case string:
		val, err := strconv.ParseInt(vv, 10, 8)
		if err != nil {
			return def, err
		}
		return int8(val), nil
	case int:
		return int8(vv), nil
	case int8:
		return vv, nil
	case int16:
		return int8(vv), nil
	case int32:
		return int8(vv), nil
	case int64:
		return int8(vv), nil
	}

	return def, errFindParse.Format("int8", e.Key)
}
83157
func SetDefault(newDefaultSuite core.CryptoSuite) error {
	if atomic.LoadInt32(&initialized) > 0 {
		return errors.New("default crypto suite is already set")
	}
	return initSuite(newDefaultSuite)
}
865679
func (m ModuleInstance) ProviderConfigDefault(name string) AbsProviderConfig {
	return AbsProviderConfig{
		Module: m,
		ProviderConfig: ProviderConfig{
			Type: name,
		},
	}
}
120889
func NewDefaultConfig() Config {
	return Config{
		URL:             "http://127.0.0.1:8080",
		EventsTransport: EventsTransportCallback,
		EventsPort:      10001,
		EventsInterface: "eth0",
		LogOutput:       ioutil.Discard,
		PollingWaitTime: defaultPollingWaitTime,
	}
}
1072026
func NewDefault(cfg config.Provider) *Fs {
	fs := &afero.OsFs{}
	return newFs(fs, cfg)
}
685699
func (s *Profile) SetIsDefault(v bool) *Profile {
	s.IsDefault = &v
	return s
}
732455
func (s *Block) GetWordDefault(address rune, def float64) (res float64) {
	res, err := s.GetWord(address)
	if err != nil {
		return def
	}
	return res
}
397989
func (e Entry) StringDefault(def string) string {
	v := e.ValueRaw
	if v == nil {
		return def
	}

	if vString, ok := v.(string); ok {
		return vString
	}

	val := fmt.Sprintf("%v", v)
	if val != "" {
		return val
	}

	return def
}
159436
func (e Entry) Uint64Default(def uint64) (uint64, error) {
	v := e.ValueRaw
	if v == nil {
		return def, errFindParse.Format("uint64", e.Key)
	}

	switch vv := v.(type) {
	case string:
		val, err := strconv.ParseUint(vv, 10, 64)
		if err != nil {
			return def, err
		}
		if val > math.MaxUint64 {
			return def, errFindParse.Format("uint64", e.Key)
		}
		return uint64(val), nil
	case uint8:
		return uint64(vv), nil
	case uint16:
		return uint64(vv), nil
	case uint32:
		return uint64(vv), nil
	case uint64:
		return vv, nil
	case int64:
		return uint64(vv), nil
	case int:
		return uint64(vv), nil
	}

	return def, errFindParse.Format("uint64", e.Key)
}