// LoadWAVRW loads a WAVE from the data source, automatically freeing that source if freeSrc is true.
// (https://wiki.libsdl.org/SDL_LoadWAV_RW)
519631
func LoadWAVRW(src *RWops, freeSrc bool) ([]byte, *AudioSpec) {
	var _audioBuf *C.Uint8
	var _audioLen C.Uint32
	audioSpec := (*AudioSpec)(unsafe.Pointer(C.SDL_LoadWAV_RW(src.cptr(), C.int(Btoi(freeSrc)), (&AudioSpec{}).cptr(), &_audioBuf, &_audioLen)))

	var b []byte
	sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&b))
	sliceHeader.Len = (int)(_audioLen)
	sliceHeader.Cap = (int)(_audioLen)
	sliceHeader.Data = uintptr(unsafe.Pointer(_audioBuf))
	return b, audioSpec
}
1323883
func LoadConf(confPath string) (ConfYaml, error) {
	var conf ConfYaml

	viper.SetConfigType("yaml")
	viper.AutomaticEnv()         // read in environment variables that match
	viper.SetEnvPrefix("gorush") // will be uppercased automatically
	viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))

	if confPath != "" {
		content, err := ioutil.ReadFile(confPath)

		if err != nil {
			return conf, err
		}

		if err := viper.ReadConfig(bytes.NewBuffer(content)); err != nil {
			return conf, err
		}
	} else {
		// Search config in home directory with name ".gorush" (without extension).
		viper.AddConfigPath("/etc/gorush/")
		viper.AddConfigPath("$HOME/.gorush")
		viper.AddConfigPath(".")
		viper.SetConfigName("config")

		// If a config file is found, read it in.
		if err := viper.ReadInConfig(); err == nil {
			fmt.Println("Using config file:", viper.ConfigFileUsed())
		} else {
			// load default config
			if err := viper.ReadConfig(bytes.NewBuffer(defaultConf)); err != nil {
				return conf, err
			}
		}
	}

	// Core
	conf.Core.Address = viper.GetString("core.address")
	conf.Core.Port = viper.GetString("core.port")
	conf.Core.Enabled = viper.GetBool("core.enabled")
	conf.Core.WorkerNum = int64(viper.GetInt("core.worker_num"))
	conf.Core.QueueNum = int64(viper.GetInt("core.queue_num"))
	conf.Core.Mode = viper.GetString("core.mode")
	conf.Core.Sync = viper.GetBool("core.sync")
	conf.Core.SSL = viper.GetBool("core.ssl")
	conf.Core.CertPath = viper.GetString("core.cert_path")
	conf.Core.KeyPath = viper.GetString("core.key_path")
	conf.Core.CertBase64 = viper.GetString("core.cert_base64")
	conf.Core.KeyBase64 = viper.GetString("core.key_base64")
	conf.Core.MaxNotification = int64(viper.GetInt("core.max_notification"))
	conf.Core.HTTPProxy = viper.GetString("core.http_proxy")
	conf.Core.PID.Enabled = viper.GetBool("core.pid.enabled")
	conf.Core.PID.Path = viper.GetString("core.pid.path")
	conf.Core.PID.Override = viper.GetBool("core.pid.override")
	conf.Core.AutoTLS.Enabled = viper.GetBool("core.auto_tls.enabled")
	conf.Core.AutoTLS.Folder = viper.GetString("core.auto_tls.folder")
	conf.Core.AutoTLS.Host = viper.GetString("core.auto_tls.host")

	// Api
	conf.API.PushURI = viper.GetString("api.push_uri")
	conf.API.StatGoURI = viper.GetString("api.stat_go_uri")
	conf.API.StatAppURI = viper.GetString("api.stat_app_uri")
	conf.API.ConfigURI = viper.GetString("api.config_uri")
	conf.API.SysStatURI = viper.GetString("api.sys_stat_uri")
	conf.API.MetricURI = viper.GetString("api.metric_uri")
	conf.API.HealthURI = viper.GetString("api.health_uri")

	// Android
	conf.Android.Enabled = viper.GetBool("android.enabled")
	conf.Android.APIKey = viper.GetString("android.apikey")
	conf.Android.MaxRetry = viper.GetInt("android.max_retry")

	// iOS
	conf.Ios.Enabled = viper.GetBool("ios.enabled")
	conf.Ios.KeyPath = viper.GetString("ios.key_path")
	conf.Ios.KeyBase64 = viper.GetString("ios.key_base64")
	conf.Ios.KeyType = viper.GetString("ios.key_type")
	conf.Ios.Password = viper.GetString("ios.password")
	conf.Ios.Production = viper.GetBool("ios.production")
	conf.Ios.MaxRetry = viper.GetInt("ios.max_retry")
	conf.Ios.KeyID = viper.GetString("ios.key_id")
	conf.Ios.TeamID = viper.GetString("ios.team_id")

	// log
	conf.Log.Format = viper.GetString("log.format")
	conf.Log.AccessLog = viper.GetString("log.access_log")
	conf.Log.AccessLevel = viper.GetString("log.access_level")
	conf.Log.ErrorLog = viper.GetString("log.error_log")
	conf.Log.ErrorLevel = viper.GetString("log.error_level")
	conf.Log.HideToken = viper.GetBool("log.hide_token")

	// Stat Engine
	conf.Stat.Engine = viper.GetString("stat.engine")
	conf.Stat.Redis.Addr = viper.GetString("stat.redis.addr")
	conf.Stat.Redis.Password = viper.GetString("stat.redis.password")
	conf.Stat.Redis.DB = viper.GetInt("stat.redis.db")
	conf.Stat.BoltDB.Path = viper.GetString("stat.boltdb.path")
	conf.Stat.BoltDB.Bucket = viper.GetString("stat.boltdb.bucket")
	conf.Stat.BuntDB.Path = viper.GetString("stat.buntdb.path")
	conf.Stat.LevelDB.Path = viper.GetString("stat.leveldb.path")

	// gRPC Server
	conf.GRPC.Enabled = viper.GetBool("grpc.enabled")
	conf.GRPC.Port = viper.GetString("grpc.port")

	if conf.Core.WorkerNum == int64(0) {
		conf.Core.WorkerNum = int64(runtime.NumCPU())
	}

	if conf.Core.QueueNum == int64(0) {
		conf.Core.QueueNum = int64(8192)
	}

	return conf, nil
}
318110
func LoadMUSRW(src *sdl.RWops, freesrc int) (mus *Music, err error) {
	_src := (*C.SDL_RWops)(unsafe.Pointer(src))
	_freesrc := (C.int)(freesrc)
	mus = (*Music)(unsafe.Pointer(C.Mix_LoadMUS_RW(_src, _freesrc)))
	if mus == nil {
		err = sdl.GetError()
	}
	return
}
218798
func LoadXCFRW(src *sdl.RWops) (*sdl.Surface, error) {
	_src := (*C.SDL_RWops)(unsafe.Pointer(src))
	_surface := C.IMG_LoadXCF_RW(_src)
	if _surface == nil {
		return nil, GetError()
	}
	return (*sdl.Surface)(unsafe.Pointer(_surface)), nil
}
243672
func LoadWEBPRW(src *sdl.RWops) (*sdl.Surface, error) {
	_src := (*C.SDL_RWops)(unsafe.Pointer(src))
	_surface := C.IMG_LoadWEBP_RW(_src)
	if _surface == nil {
		return nil, GetError()
	}
	return (*sdl.Surface)(unsafe.Pointer(_surface)), nil
}
586210
func (s *Service) NewSRV(name string, weight uint16) *dns.SRV {
	host := dns.Fqdn(s.Host)
	if s.TargetStrip > 0 {
		host = targetStrip(host, s.TargetStrip)
	}

	return &dns.SRV{Hdr: dns.RR_Header{Name: name, Rrtype: dns.TypeSRV, Class: dns.ClassINET, Ttl: s.TTL},
		Priority: uint16(s.Priority), Weight: weight, Port: uint16(s.Port), Target: host}
}
888772
func LoadWhisperMessage(serialized []byte) (*WhisperMessage, error) {
	version := highBitsToInt(serialized[0])
	message := serialized[1 : len(serialized)-macLength]

	if version != currentVersion {
		return nil, UnsupportedVersionError{version}
	}
	pwm := &protobuf.WhisperMessage{}
	err := proto.Unmarshal(message, pwm)
	if err != nil {
		return nil, err
	}

	if pwm.GetCiphertext() == nil || pwm.GetRatchetKey() == nil {
		return nil, ErrIncompleteWhisperMessage
	}

	wm := &WhisperMessage{
		Version:         version,
		Counter:         pwm.GetCounter(),
		PreviousCounter: pwm.GetPreviousCounter(),
		RatchetKey:      NewECPublicKey(pwm.GetRatchetKey()[1:]),
		Ciphertext:      pwm.GetCiphertext(),
		serialized:      serialized,
	}

	return wm, nil
}
240867
func LoadYAML(yamlContent []byte) (*Dataset, error) {
	var input []map[string]interface{}
	if err := yaml.Unmarshal(yamlContent, &input); err != nil {
		return nil, err
	}

	return internalLoadFromDict(input)
}
691450
func loadChannelFwdPkgs(tx *bbolt.Tx, source lnwire.ShortChannelID) ([]*FwdPkg, error) {
	fwdPkgBkt := tx.Bucket(fwdPackagesKey)
	if fwdPkgBkt == nil {
		return nil, nil
	}

	sourceKey := makeLogKey(source.ToUint64())
	sourceBkt := fwdPkgBkt.Bucket(sourceKey[:])
	if sourceBkt == nil {
		return nil, nil
	}

	var heights []uint64
	if err := sourceBkt.ForEach(func(k, _ []byte) error {
		if len(k) != 8 {
			return ErrCorruptedFwdPkg
		}

		heights = append(heights, byteOrder.Uint64(k))

		return nil
	}); err != nil {
		return nil, err
	}

	// Load the forwarding package for each retrieved height.
	fwdPkgs := make([]*FwdPkg, 0, len(heights))
	for _, height := range heights {
		fwdPkg, err := loadFwdPkg(fwdPkgBkt, source, height)
		if err != nil {
			return nil, err
		}

		fwdPkgs = append(fwdPkgs, fwdPkg)
	}

	return fwdPkgs, nil
}
232410
func (d *domainClient) LoadSnapshot(ctx context.Context, args *LoadSnapshotArgs) (reply *LoadSnapshotReply, err error) {
	reply = new(LoadSnapshotReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "LayerTree.loadSnapshot", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "LayerTree.loadSnapshot", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "LayerTree", Op: "LoadSnapshot", Err: err}
	}
	return
}
847994
func LoadEnd(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "loadend", Listener: listener}
}
75608
func (c *Config) LoadToDepth(ctx context.Context, qs graph.QuadStore, dst interface{}, depth int, ids ...quad.Value) error {
	if dst == nil {
		return fmt.Errorf("nil destination object")
	}
	var it graph.Iterator
	if len(ids) != 0 {
		fixed := iterator.NewFixed()
		for _, id := range ids {
			fixed.Add(qs.ValueOf(id))
		}
		it = fixed
	}
	var rv reflect.Value
	if v, ok := dst.(reflect.Value); ok {
		rv = v
	} else {
		rv = reflect.ValueOf(dst)
	}
	return c.LoadIteratorToDepth(ctx, qs, rv, depth, it)
}
399967
func (c *ClientConn) LoadShared(key *Key) error {
	requestMap := &map[string]interface{}{}

	err := ConvertToGeneral(key, requestMap)

	if err != nil {
		return fmt.Errorf("error creating request: %v", err)
	}

	msg, err := c.Request("load-shared", *requestMap)
	if msg["success"] != "yes" {
		return fmt.Errorf("unsuccessful loadSharedKey: %v", msg["errmsg"])
	}

	return nil
}
705373
func (handle SharedObject) LoadFunction(name string) unsafe.Pointer {
	_name := C.CString(name)
	defer C.free(unsafe.Pointer(_name))
	return (unsafe.Pointer)(C.SDL_LoadFunction((unsafe.Pointer)(handle), _name))
}
1201161
func (c *ResourceConfig) GetRaw(k string) (interface{}, bool) {
	return c.get(k, c.Raw)
}
601570
func LoadTGARW(src *sdl.RWops) (*sdl.Surface, error) {
	_src := (*C.SDL_RWops)(unsafe.Pointer(src))
	_surface := C.IMG_LoadTGA_RW(_src)
	if _surface == nil {
		return nil, GetError()
	}
	return (*sdl.Surface)(unsafe.Pointer(_surface)), nil
}
907711
func loadOpenvswitchModule() {
	if triedLoadOpenvswitchModule {
		return
	}

	// netdev ioctls don't seem to work on netlink sockets, so we
	// need a new socket for this purpose.
	s, err := syscall.Socket(syscall.AF_INET, syscall.SOCK_DGRAM, 0)
	if err != nil {
		triedLoadOpenvswitchModule = true
		return
	}

	defer syscall.Close(s)

	var req ifreqIfindex
	copy(req.name[:], []byte("openvswitch"))
	syscall.Syscall(syscall.SYS_IOCTL, uintptr(s),
		syscall.SIOCGIFINDEX, uintptr(unsafe.Pointer(&req)))
	triedLoadOpenvswitchModule = true
}