diff options
author | Chris Robinson <[email protected]> | 2018-11-24 16:58:49 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-24 16:58:49 -0800 |
commit | 9e10f632c7a5d66b0f896753e197970eec3ab7cf (patch) | |
tree | e8370fd4a8ebffa3fc110aaffe4aab218ac284ec | |
parent | 16a60dc371254ba4936f4f5c13c32d060b9911ac (diff) |
Replace remaining uses of std::vector with al::vector
Which uses a custom allocator that uses our allocation functions.
-rw-r--r-- | Alc/alc.cpp | 4 | ||||
-rw-r--r-- | Alc/alconfig.cpp | 2 | ||||
-rw-r--r-- | Alc/backends/alsa.cpp | 14 | ||||
-rw-r--r-- | Alc/backends/dsound.cpp | 8 | ||||
-rw-r--r-- | Alc/backends/oss.cpp | 14 | ||||
-rw-r--r-- | Alc/backends/pulseaudio.cpp | 6 | ||||
-rw-r--r-- | Alc/backends/wasapi.cpp | 12 | ||||
-rw-r--r-- | Alc/backends/wave.cpp | 2 | ||||
-rw-r--r-- | Alc/backends/winmm.cpp | 6 | ||||
-rw-r--r-- | Alc/helpers.cpp | 18 | ||||
-rw-r--r-- | Alc/hrtf.cpp | 28 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 2 | ||||
-rw-r--r-- | OpenAL32/alBuffer.cpp | 2 | ||||
-rw-r--r-- | OpenAL32/alEffect.cpp | 2 | ||||
-rw-r--r-- | OpenAL32/alFilter.cpp | 2 |
15 files changed, 61 insertions, 61 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index 40bf25b4..434e4660 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -3362,7 +3362,7 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, alcSetError(dev.get(), ALC_INVALID_VALUE); else if(!dev || dev->Type == Capture) { - std::vector<ALCint> ivals(size); + al::vector<ALCint> ivals(size); size = GetIntegerv(dev.get(), pname, size, ivals.data()); std::copy(ivals.begin(), ivals.begin()+size, values); } @@ -3482,7 +3482,7 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, break; default: - std::vector<ALCint> ivals(size); + al::vector<ALCint> ivals(size); size = GetIntegerv(dev.get(), pname, size, ivals.data()); std::copy(ivals.begin(), ivals.begin()+size, values); break; diff --git a/Alc/alconfig.cpp b/Alc/alconfig.cpp index 73ea0458..a6304ce7 100644 --- a/Alc/alconfig.cpp +++ b/Alc/alconfig.cpp @@ -59,7 +59,7 @@ struct ConfigEntry { : key{std::forward<T0>(key_)}, value{std::forward<T1>(val_)} { } }; -std::vector<ConfigEntry> ConfOpts; +al::vector<ConfigEntry> ConfOpts; std::string &lstrip(std::string &line) diff --git a/Alc/backends/alsa.cpp b/Alc/backends/alsa.cpp index 35c1f834..1a048fc7 100644 --- a/Alc/backends/alsa.cpp +++ b/Alc/backends/alsa.cpp @@ -253,8 +253,8 @@ struct DevMap { { } }; -std::vector<DevMap> PlaybackDevices; -std::vector<DevMap> CaptureDevices; +al::vector<DevMap> PlaybackDevices; +al::vector<DevMap> CaptureDevices; const char *prefix_name(snd_pcm_stream_t stream) @@ -263,9 +263,9 @@ const char *prefix_name(snd_pcm_stream_t stream) return (stream==SND_PCM_STREAM_PLAYBACK) ? "device-prefix" : "capture-prefix"; } -std::vector<DevMap> probe_devices(snd_pcm_stream_t stream) +al::vector<DevMap> probe_devices(snd_pcm_stream_t stream) { - std::vector<DevMap> devlist; + al::vector<DevMap> devlist; snd_ctl_card_info_t *info; snd_ctl_card_info_malloc(&info); @@ -425,7 +425,7 @@ int verify_state(snd_pcm_t *handle) struct ALCplaybackAlsa final : public ALCbackend { snd_pcm_t *pcmHandle{nullptr}; - std::vector<char> buffer; + al::vector<char> buffer; std::atomic<ALenum> killNow{AL_TRUE}; std::thread thread; @@ -926,7 +926,7 @@ ClockLatency ALCplaybackAlsa_getClockLatency(ALCplaybackAlsa *self) struct ALCcaptureAlsa final : public ALCbackend { snd_pcm_t *pcmHandle{nullptr}; - std::vector<char> buffer; + al::vector<char> buffer; bool doCapture{false}; ll_ringbuffer_t *ring{nullptr}; @@ -1129,7 +1129,7 @@ void ALCcaptureAlsa_stop(ALCcaptureAlsa *self) { /* The ring buffer implicitly captures when checking availability. * Direct access needs to explicitly capture it into temp storage. */ - std::vector<char> temp(snd_pcm_frames_to_bytes(self->pcmHandle, avail)); + al::vector<char> temp(snd_pcm_frames_to_bytes(self->pcmHandle, avail)); ALCcaptureAlsa_captureSamples(self, temp.data(), avail); self->buffer = std::move(temp); } diff --git a/Alc/backends/dsound.cpp b/Alc/backends/dsound.cpp index 085dab90..4f1186ee 100644 --- a/Alc/backends/dsound.cpp +++ b/Alc/backends/dsound.cpp @@ -142,10 +142,10 @@ struct DevMap { { } }; -std::vector<DevMap> PlaybackDevices; -std::vector<DevMap> CaptureDevices; +al::vector<DevMap> PlaybackDevices; +al::vector<DevMap> CaptureDevices; -bool checkName(const std::vector<DevMap> &list, const std::string &name) +bool checkName(const al::vector<DevMap> &list, const std::string &name) { return std::find_if(list.cbegin(), list.cend(), [&name](const DevMap &entry) -> bool @@ -158,7 +158,7 @@ BOOL CALLBACK DSoundEnumDevices(GUID *guid, const WCHAR *desc, const WCHAR* UNUS if(!guid) return TRUE; - auto& devices = *reinterpret_cast<std::vector<DevMap>*>(data); + auto& devices = *reinterpret_cast<al::vector<DevMap>*>(data); const std::string basename{DEVNAME_HEAD + wstr_to_utf8(desc)}; int count{1}; diff --git a/Alc/backends/oss.cpp b/Alc/backends/oss.cpp index 3985cd27..7b8d234a 100644 --- a/Alc/backends/oss.cpp +++ b/Alc/backends/oss.cpp @@ -91,7 +91,7 @@ struct DevMap { { } }; -bool checkName(const std::vector<DevMap> &list, const std::string &name) +bool checkName(const al::vector<DevMap> &list, const std::string &name) { return std::find_if(list.cbegin(), list.cend(), [&name](const DevMap &entry) -> bool @@ -99,22 +99,22 @@ bool checkName(const std::vector<DevMap> &list, const std::string &name) ) != list.cend(); } -std::vector<DevMap> PlaybackDevices; -std::vector<DevMap> CaptureDevices; +al::vector<DevMap> PlaybackDevices; +al::vector<DevMap> CaptureDevices; #ifdef ALC_OSS_COMPAT #define DSP_CAP_OUTPUT 0x00020000 #define DSP_CAP_INPUT 0x00010000 -void ALCossListPopulate(std::vector<DevMap> *devlist, int type) +void ALCossListPopulate(al::vector<DevMap> *devlist, int type) { devlist->emplace_back(DefaultName, (type==DSP_CAP_INPUT) ? DefaultCapture : DefaultPlayback); } #else -void ALCossListAppend(std::vector<DevMap> *list, const char *handle, size_t hlen, const char *path, size_t plen) +void ALCossListAppend(al::vector<DevMap> *list, const char *handle, size_t hlen, const char *path, size_t plen) { #ifdef ALC_OSS_DEVNODE_TRUC for(size_t i{0};i < plen;i++) @@ -160,7 +160,7 @@ void ALCossListAppend(std::vector<DevMap> *list, const char *handle, size_t hlen TRACE("Got device \"%s\", \"%s\"\n", entry.name.c_str(), entry.device_name.c_str()); } -void ALCossListPopulate(std::vector<DevMap> *devlist, int type_flag) +void ALCossListPopulate(al::vector<DevMap> *devlist, int type_flag) { int fd{open("/dev/mixer", O_RDONLY)}; if(fd < 0) @@ -243,7 +243,7 @@ int log2i(ALCuint x) struct ALCplaybackOSS final : public ALCbackend { int fd{-1}; - std::vector<ALubyte> mix_data; + al::vector<ALubyte> mix_data; std::atomic<ALenum> killNow{AL_TRUE}; std::thread thread; diff --git a/Alc/backends/pulseaudio.cpp b/Alc/backends/pulseaudio.cpp index 9563cdd4..c64c3ed7 100644 --- a/Alc/backends/pulseaudio.cpp +++ b/Alc/backends/pulseaudio.cpp @@ -511,7 +511,7 @@ struct DevMap { { } }; -bool checkName(const std::vector<DevMap> &list, const std::string &name) +bool checkName(const al::vector<DevMap> &list, const std::string &name) { return std::find_if(list.cbegin(), list.cend(), [&name](const DevMap &entry) -> bool @@ -519,8 +519,8 @@ bool checkName(const std::vector<DevMap> &list, const std::string &name) ) != list.cend(); } -std::vector<DevMap> PlaybackDevices; -std::vector<DevMap> CaptureDevices; +al::vector<DevMap> PlaybackDevices; +al::vector<DevMap> CaptureDevices; struct PulsePlayback final : public ALCbackend { diff --git a/Alc/backends/wasapi.cpp b/Alc/backends/wasapi.cpp index 52f324f7..3d6c3e8c 100644 --- a/Alc/backends/wasapi.cpp +++ b/Alc/backends/wasapi.cpp @@ -123,7 +123,7 @@ struct DevMap { { } }; -bool checkName(const std::vector<DevMap> &list, const std::string &name) +bool checkName(const al::vector<DevMap> &list, const std::string &name) { return std::find_if(list.cbegin(), list.cend(), [&name](const DevMap &entry) -> bool @@ -131,8 +131,8 @@ bool checkName(const std::vector<DevMap> &list, const std::string &name) ) != list.cend(); } -std::vector<DevMap> PlaybackDevices; -std::vector<DevMap> CaptureDevices; +al::vector<DevMap> PlaybackDevices; +al::vector<DevMap> CaptureDevices; HANDLE ThreadHdl; @@ -251,7 +251,7 @@ void get_device_formfactor(IMMDevice *device, EndpointFormFactor *formfactor) } -void add_device(IMMDevice *device, const WCHAR *devid, std::vector<DevMap> &list) +void add_device(IMMDevice *device, const WCHAR *devid, al::vector<DevMap> &list) { std::string basename, guidstr; std::tie(basename, guidstr) = get_device_name_and_guid(device); @@ -285,7 +285,7 @@ WCHAR *get_device_id(IMMDevice *device) return devid; } -HRESULT probe_devices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, std::vector<DevMap> &list) +HRESULT probe_devices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, al::vector<DevMap> &list) { IMMDeviceCollection *coll; HRESULT hr = devenum->EnumAudioEndpoints(flowdir, DEVICE_STATE_ACTIVE, &coll); @@ -1248,7 +1248,7 @@ FORCE_ALIGN int ALCwasapiCapture_recordProc(ALCwasapiCapture *self) althrd_setname(RECORD_THREAD_NAME); - std::vector<float> samples; + al::vector<float> samples; while(!self->mKillNow.load(std::memory_order_relaxed)) { UINT32 avail; diff --git a/Alc/backends/wave.cpp b/Alc/backends/wave.cpp index d1356338..d9219336 100644 --- a/Alc/backends/wave.cpp +++ b/Alc/backends/wave.cpp @@ -82,7 +82,7 @@ struct ALCwaveBackend final : public ALCbackend { FILE *mFile; long mDataStart; - std::vector<ALbyte> mBuffer; + al::vector<ALbyte> mBuffer; ATOMIC(ALenum) killNow; std::thread thread; diff --git a/Alc/backends/winmm.cpp b/Alc/backends/winmm.cpp index f17b5d1f..f1aee5b3 100644 --- a/Alc/backends/winmm.cpp +++ b/Alc/backends/winmm.cpp @@ -51,10 +51,10 @@ namespace { #define DEVNAME_HEAD "OpenAL Soft on " -std::vector<std::string> PlaybackDevices; -std::vector<std::string> CaptureDevices; +al::vector<std::string> PlaybackDevices; +al::vector<std::string> CaptureDevices; -bool checkName(const std::vector<std::string> &list, const std::string &name) +bool checkName(const al::vector<std::string> &list, const std::string &name) { return std::find(list.cbegin(), list.cend(), name) != list.cend(); } void ProbePlaybackDevices(void) diff --git a/Alc/helpers.cpp b/Alc/helpers.cpp index 658c7d09..d06a4807 100644 --- a/Alc/helpers.cpp +++ b/Alc/helpers.cpp @@ -315,7 +315,7 @@ PathNamePair GetProcBinary() { PathNamePair ret; - std::vector<WCHAR> fullpath(256); + al::vector<WCHAR> fullpath(256); DWORD len; while((len=GetModuleFileNameW(nullptr, fullpath.data(), fullpath.size())) == fullpath.size()) fullpath.resize(fullpath.size() << 1); @@ -379,7 +379,7 @@ void al_print(const char *type, const char *func, const char *fmt, ...) static inline int is_slash(int c) { return (c == '\\' || c == '/'); } -static void DirectorySearch(const char *path, const char *ext, std::vector<std::string> *const results) +static void DirectorySearch(const char *path, const char *ext, al::vector<std::string> *const results) { std::string pathstr{path}; pathstr += "\\*"; @@ -406,13 +406,13 @@ static void DirectorySearch(const char *path, const char *ext, std::vector<std:: } } -std::vector<std::string> SearchDataFiles(const char *ext, const char *subdir) +al::vector<std::string> SearchDataFiles(const char *ext, const char *subdir) { static std::mutex search_lock; std::lock_guard<std::mutex> _{search_lock}; /* If the path is absolute, use it directly. */ - std::vector<std::string> results; + al::vector<std::string> results; if(isalpha(subdir[0]) && subdir[1] == ':' && is_slash(subdir[2])) { std::string path{subdir}; @@ -481,7 +481,7 @@ void SetRTPriority(void) PathNamePair GetProcBinary() { PathNamePair ret; - std::vector<char> pathname; + al::vector<char> pathname; #ifdef __FreeBSD__ size_t pathlen; @@ -598,7 +598,7 @@ void al_print(const char *type, const char *func, const char *fmt, ...) } -static void DirectorySearch(const char *path, const char *ext, std::vector<std::string> *const results) +static void DirectorySearch(const char *path, const char *ext, al::vector<std::string> *const results) { TRACE("Searching %s for *%s\n", path, ext); DIR *dir{opendir(path)}; @@ -632,12 +632,12 @@ static void DirectorySearch(const char *path, const char *ext, std::vector<std:: } } -std::vector<std::string> SearchDataFiles(const char *ext, const char *subdir) +al::vector<std::string> SearchDataFiles(const char *ext, const char *subdir) { static std::mutex search_lock; std::lock_guard<std::mutex> _{search_lock}; - std::vector<std::string> results; + al::vector<std::string> results; if(subdir[0] == '/') { DirectorySearch(subdir, ext, &results); @@ -650,7 +650,7 @@ std::vector<std::string> SearchDataFiles(const char *ext, const char *subdir) DirectorySearch(str, ext, &results); else { - std::vector<char> cwdbuf(256); + al::vector<char> cwdbuf(256); while(!getcwd(cwdbuf.data(), cwdbuf.size())) { if(errno != ERANGE) diff --git a/Alc/hrtf.cpp b/Alc/hrtf.cpp index 034d5a49..19919717 100644 --- a/Alc/hrtf.cpp +++ b/Alc/hrtf.cpp @@ -281,7 +281,7 @@ void BuildBFormatHrtf(const struct Hrtf *Hrtf, DirectHrtfState *state, ALsizei N #define NUM_BANDS 2 ALsizei min_delay{HRTF_HISTORY_LENGTH}; ALsizei max_delay{0}; - std::vector<ALsizei> idx(AmbiCount); + al::vector<ALsizei> idx(AmbiCount); for(ALsizei c{0};c < AmbiCount;c++) { ALuint evidx, azidx; @@ -305,7 +305,7 @@ void BuildBFormatHrtf(const struct Hrtf *Hrtf, DirectHrtfState *state, ALsizei N max_delay = maxi(max_delay, maxi(Hrtf->delays[idx[c]][0], Hrtf->delays[idx[c]][1])); } - std::vector<std::array<std::array<ALdouble,2>,HRIR_LENGTH>> tmpres(NumChannels); + al::vector<std::array<std::array<ALdouble,2>,HRIR_LENGTH>> tmpres(NumChannels); ALfloat temps[3][HRIR_LENGTH]{}; BandSplitter splitter; @@ -549,7 +549,7 @@ struct Hrtf *LoadHrtf00(std::istream &data, const char *filename) if(failed) return nullptr; - std::vector<ALushort> evOffset(evCount); + al::vector<ALushort> evOffset(evCount); for(auto &val : evOffset) val = GetLE_ALushort(data); if(!data || data.eof()) @@ -575,7 +575,7 @@ struct Hrtf *LoadHrtf00(std::istream &data, const char *filename) if(failed) return nullptr; - std::vector<ALubyte> azCount(evCount); + al::vector<ALubyte> azCount(evCount); for(ALsizei i{1};i < evCount;i++) { azCount[i-1] = evOffset[i] - evOffset[i-1]; @@ -596,8 +596,8 @@ struct Hrtf *LoadHrtf00(std::istream &data, const char *filename) if(failed) return nullptr; - std::vector<std::array<ALfloat,2>> coeffs(irSize*irCount); - std::vector<std::array<ALubyte,2>> delays(irCount); + al::vector<std::array<ALfloat,2>> coeffs(irSize*irCount); + al::vector<std::array<ALubyte,2>> delays(irCount); for(auto &val : coeffs) val[0] = GetLE_ALshort(data) / 32768.0f; for(auto &val : delays) @@ -666,7 +666,7 @@ struct Hrtf *LoadHrtf01(std::istream &data, const char *filename) if(failed) return nullptr; - std::vector<ALubyte> azCount(evCount); + al::vector<ALubyte> azCount(evCount); data.read(reinterpret_cast<char*>(azCount.data()), evCount); if(!data || data.eof() || data.gcount() < evCount) { @@ -685,7 +685,7 @@ struct Hrtf *LoadHrtf01(std::istream &data, const char *filename) if(failed) return nullptr; - std::vector<ALushort> evOffset(evCount); + al::vector<ALushort> evOffset(evCount); evOffset[0] = 0; ALushort irCount{azCount[0]}; for(ALsizei i{1};i < evCount;i++) @@ -694,8 +694,8 @@ struct Hrtf *LoadHrtf01(std::istream &data, const char *filename) irCount += azCount[i]; } - std::vector<std::array<ALfloat,2>> coeffs(irSize*irCount); - std::vector<std::array<ALubyte,2>> delays(irCount); + al::vector<std::array<ALfloat,2>> coeffs(irSize*irCount); + al::vector<std::array<ALubyte,2>> delays(irCount); for(auto &val : coeffs) val[0] = GetLE_ALshort(data) / 32768.0f; for(auto &val : delays) @@ -785,7 +785,7 @@ struct Hrtf *LoadHrtf02(std::istream &data, const char *filename) ALushort distance{}; ALubyte evCount{}; - std::vector<ALubyte> azCount; + al::vector<ALubyte> azCount; for(ALsizei i{0};i < fdCount;i++) { distance = GetLE_ALushort(data); @@ -832,7 +832,7 @@ struct Hrtf *LoadHrtf02(std::istream &data, const char *filename) return nullptr; } - std::vector<ALushort> evOffset(evCount); + al::vector<ALushort> evOffset(evCount); evOffset[0] = 0; ALushort irCount{azCount[0]}; for(ALsizei i{1};i < evCount;++i) @@ -841,8 +841,8 @@ struct Hrtf *LoadHrtf02(std::istream &data, const char *filename) irCount += azCount[i]; } - std::vector<std::array<ALfloat,2>> coeffs(irSize*irCount); - std::vector<std::array<ALubyte,2>> delays(irCount); + al::vector<std::array<ALfloat,2>> coeffs(irSize*irCount); + al::vector<std::array<ALubyte,2>> delays(irCount); if(channelType == CHANTYPE_LEFTONLY) { if(sampleType == SAMPLETYPE_S16) diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 1a2f7d8d..21aa1e89 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -853,6 +853,6 @@ void StartEventThrd(ALCcontext *ctx); void StopEventThrd(ALCcontext *ctx); -std::vector<std::string> SearchDataFiles(const char *match, const char *subdir); +al::vector<std::string> SearchDataFiles(const char *match, const char *subdir); #endif diff --git a/OpenAL32/alBuffer.cpp b/OpenAL32/alBuffer.cpp index 0580b33a..5c40a27e 100644 --- a/OpenAL32/alBuffer.cpp +++ b/OpenAL32/alBuffer.cpp @@ -439,7 +439,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) /* Store the allocated buffer IDs in a separate local list, to avoid * modifying the user storage in case of failure. */ - std::vector<ALuint> ids; + al::vector<ALuint> ids; ids.reserve(n); do { ALbuffer *buffer = AllocBuffer(context.get()); diff --git a/OpenAL32/alEffect.cpp b/OpenAL32/alEffect.cpp index e25e2007..2bc60e24 100644 --- a/OpenAL32/alEffect.cpp +++ b/OpenAL32/alEffect.cpp @@ -312,7 +312,7 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) /* Store the allocated buffer IDs in a separate local list, to avoid * modifying the user storage in case of failure. */ - std::vector<ALuint> ids; + al::vector<ALuint> ids; ids.reserve(n); do { ALeffect *effect = AllocEffect(context.get()); diff --git a/OpenAL32/alFilter.cpp b/OpenAL32/alFilter.cpp index bda03fae..5b15e7e0 100644 --- a/OpenAL32/alFilter.cpp +++ b/OpenAL32/alFilter.cpp @@ -373,7 +373,7 @@ AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) /* Store the allocated buffer IDs in a separate local list, to avoid * modifying the user storage in case of failure. */ - std::vector<ALuint> ids; + al::vector<ALuint> ids; ids.reserve(n); do { ALfilter *filter = AllocFilter(context.get()); |