]> git.tdb.fi Git - libs/al.git/commitdiff
Fix compilation with recent gcc
authorMikko Rasa <tdb@tdb.fi>
Sat, 17 Nov 2012 21:30:14 +0000 (23:30 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 17 Nov 2012 21:30:14 +0000 (23:30 +0200)
source/sound.cpp
source/streamer.cpp

index f43948e65030b9d5041881ec8966171ca9eb08d9..c4a00efdedec278fa91c931b08e4054b12a487fe 100644 (file)
@@ -18,7 +18,7 @@ struct MemorySource
 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;
 
index 2c2619bbed8667a93fd54959b0a246733da680e5..b90a9d1c73ab3f78b50384c805348ff40b960699 100644 (file)
@@ -54,13 +54,13 @@ void Streamer::tick()
        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;
@@ -69,7 +69,7 @@ void Streamer::tick()
                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);
                }