diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-04-12 08:25:39 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-04-12 08:25:39 +0200 |
commit | 94b6e63ef94e55fd026eec97bb50a7b50b19f2f3 (patch) | |
tree | e65e998bcd0f44e0b22a8f23517724f9e1d11c7e /src/cachemanager.cc | |
parent | abf3b22cde970af44b28e97c2fc1be12e7570740 (diff) |
Fix bad buffer pointers.
Diffstat (limited to 'src/cachemanager.cc')
-rw-r--r-- | src/cachemanager.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/cachemanager.cc b/src/cachemanager.cc index 9288ed1..0f84f8c 100644 --- a/src/cachemanager.cc +++ b/src/cachemanager.cc @@ -116,7 +116,7 @@ sample_t *CacheManager::open(AudioFile *file, size_t initial_samples_needed, int localcache[id] = c.front; if(initial_samples_needed < file->size) { - event_t e = createLoadNextEvent(id, c.pos, &c.back); + event_t e = createLoadNextEvent(id, c.pos, &id2cache[id].back); pushEvent(e); } @@ -144,12 +144,13 @@ void CacheManager::close(cacheid_t id) CacheManager::cache_t CacheManager::getNextCache(cacheid_t id) { MutexAutolock l(m_caches); - cache_t c = id2cache[id]; + cache_t &c = id2cache[id]; - sample_t *tmp = id2cache[id].front; - id2cache[id].front = c.back; - id2cache[id].back = tmp; - id2cache[id].pos += CHUNKSIZE; + sample_t *tmp = c.front; + c.front = c.back; + c.back = tmp; + + c.pos += CHUNKSIZE; return c; } @@ -173,7 +174,7 @@ sample_t *CacheManager::next(cacheid_t id, size_t &size) localcache[id] = c.front; if(c.pos < c.file->size) { - event_t e = createLoadNextEvent(id, c.pos + CHUNKSIZE, &c.back); + event_t e = createLoadNextEvent(id, c.pos + CHUNKSIZE, &id2cache[id].back); pushEvent(e); } |