Undef SearchPath where needed as it is defined via windows.h
[ardour.git] / libs / pbd / pbd / ringbuffer.h
index d98601461e684eea5e5bf2d478877e8cd33ee3c1..f14fa7185184356d154f40da1a134446d0200bb0 100644 (file)
@@ -20,6 +20,7 @@
 #ifndef ringbuffer_h
 #define ringbuffer_h
 
+#include <cstring>
 #include <glib.h>
 
 template<class T>
@@ -29,14 +30,13 @@ class RingBuffer
        RingBuffer (guint sz) {
 //     size = ffs(sz); /* find first [bit] set is a single inlined assembly instruction. But it looks like the API rounds up so... */
        guint power_of_two;
-       for (power_of_two = 1; 1U<<power_of_two < sz; power_of_two++);
-               size = 1<<power_of_two;
-               size_mask = size;
-               size_mask -= 1;
-               buf = new T[size];
-               reset ();
-
-       };
+       for (power_of_two = 1; 1U<<power_of_two < sz; power_of_two++) {}
+       size = 1<<power_of_two;
+       size_mask = size;
+       size_mask -= 1;
+       buf = new T[size];
+       reset ();
+       }
        
        virtual ~RingBuffer() {
                delete [] buf;
@@ -55,7 +55,7 @@ class RingBuffer
        }
        
        guint read  (T *dest, guint cnt);
-       guint  write (T *src, guint cnt);
+       guint write (T const * src,  guint cnt);
 
        struct rw_vector {
            T *buf[2];
@@ -158,7 +158,7 @@ RingBuffer<T>::read (T *dest, guint cnt)
 }
 
 template<class T> guint
-RingBuffer<T>::write (T *src, guint cnt)
+RingBuffer<T>::write (T const *src, guint cnt)
 
 {
         guint free_cnt;