size_t memory_read(void *ptr, size_t size, size_t nmemb, void *src)
{
MemorySource &memsrc = *reinterpret_cast<MemorySource *>(src);
- unsigned len = min(size*nmemb, memsrc.length-memsrc.pos);
+ unsigned len = min<unsigned>(size*nmemb, memsrc.length-memsrc.pos);
memcpy(ptr, reinterpret_cast<const char *>(memsrc.data)+memsrc.pos, len);
memsrc.pos += len;
unsigned freq = snd->get_frequency();
unsigned chunk_size = freq&~0xF;
unsigned queued = src.get_buffers_queued();
+ vector<char> data(chunk_size);
for(unsigned i=queued; i<4; ++i)
{
- char data[chunk_size];
unsigned pos = 0;
while(pos<chunk_size)
{
- unsigned len = snd->read(data+pos, chunk_size-pos);
+ unsigned len = snd->read(&data[0]+pos, chunk_size-pos);
if(len==0)
break;
pos += len;
if(pos)
{
Buffer *buf = new Buffer;
- buf->data(snd->get_format(), data, pos, freq);
+ buf->data(snd->get_format(), &data[0], pos, freq);
src.queue_buffer(*buf);
buffers.push_back(buf);
}