]> git.sesse.net Git - mlt/commitdiff
rtaudio/RtAudio.h: initialize variables
authorMikko Rapeli <mikko.rapeli@iki.fi>
Tue, 31 Jul 2012 12:11:13 +0000 (14:11 +0200)
committerMikko Rapeli <mikko.rapeli@iki.fi>
Mon, 6 Aug 2012 16:37:28 +0000 (18:37 +0200)
Fixes Coverity CID 710878: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member ""bufferSize"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""channelOffset"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""deviceFormat"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""deviceInterleaved"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""doByteSwap"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""doConvertBuffer"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""latency"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""mode"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""nBuffers"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""nDeviceChannels"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""nUserChannels"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""sampleRate"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""state"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""streamTime"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""userBuffer"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""userFormat"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""userInterleaved"" is not initialized in this constructor nor in any functions that it calls.
654      :apiHandle(0), deviceBuffer(0) { device[0] = 11111; device[1] = 11111; }

src/modules/rtaudio/RtAudio.h

index 96a9b5c1a4f1e2d4dafd9d9af1b38dc74cd55286..aa8904a7aed7dea8defcac78b5e063c0c512aeb3 100644 (file)
@@ -47,6 +47,7 @@
 #ifndef __RTAUDIO_H
 #define __RTAUDIO_H
 
+#include <string.h>
 #include <string>
 #include <vector>
 #include "RtError.h"
@@ -651,7 +652,29 @@ protected:
 #endif
 
     RtApiStream()
-      :apiHandle(0), deviceBuffer(0) { device[0] = 11111; device[1] = 11111; }
+       :apiHandle(0),
+       mode(OUTPUT),
+       state(STREAM_STOPPED),
+       deviceBuffer(0),
+       userInterleaved(0),
+       sampleRate(0),
+       bufferSize(0),
+       nBuffers(0),
+       streamTime(0)
+    {
+       device[0] = 11111;
+       device[1] = 11111;
+       memset( &channelOffset, 0, sizeof( channelOffset ) );
+       memset( &deviceFormat, 0, sizeof( deviceFormat ) );
+       memset( &deviceInterleaved, 0, sizeof( deviceInterleaved ) );
+       memset( &doByteSwap, 0, sizeof( doByteSwap ) );
+       memset( &doConvertBuffer, 0, sizeof( doConvertBuffer ) );
+       memset( &latency, 0, sizeof( latency ) );
+       memset( &nDeviceChannels, 0, sizeof( nDeviceChannels ) );
+       memset( &nUserChannels, 0, sizeof( nUserChannels ) );
+       memset( &userBuffer, 0, sizeof( userBuffer ) );
+       memset( &userFormat, 0, sizeof( userFormat ) );
+    }
   };
 
   typedef signed short Int16;