Signed-off-by: falkTX <falktx@falktx.com>tags/v2.1-rc1
| @@ -180,7 +180,9 @@ BASE_FLAGS += -Wmissing-declarations -Wredundant-decls | |||
| BASE_FLAGS += -Wshadow -Wundef -Wuninitialized -Wunused | |||
| BASE_FLAGS += -Wstrict-aliasing -fstrict-aliasing | |||
| BASE_FLAGS += -Wstrict-overflow -fstrict-overflow | |||
| BASE_FLAGS += -Wduplicated-branches -Wduplicated-cond -Wnull-dereference | |||
| BASE_FLAGS += -Wduplicated-branches -Wduplicated-cond -Wnull-dereference | |||
| BASE_FLAGS += -Wformat-truncation=2 -Wformat-overflow=2 | |||
| BASE_FLAGS += -Wstringop-overflow=4 -Wstringop-truncation | |||
| CFLAGS += -Winit-self -Wjump-misses-init -Wmissing-prototypes -Wnested-externs -Wstrict-prototypes -Wwrite-strings | |||
| CXXFLAGS += -Wc++0x-compat -Wc++11-compat | |||
| CXXFLAGS += -Wnon-virtual-dtor -Woverloaded-virtual | |||
| @@ -427,7 +427,7 @@ protected: | |||
| { | |||
| const CarlaScopedLocale csl; | |||
| std::snprintf(tmpBuf, STR_MAX, "%f\n", newSampleRate); | |||
| std::snprintf(tmpBuf, STR_MAX, "%.12g\n", newSampleRate); | |||
| } | |||
| if (fUiServer.writeMessage(tmpBuf)) | |||
| @@ -537,7 +537,7 @@ protected: | |||
| std::snprintf(tmpBuf, STR_MAX, "PARAMVAL_%u:%i\n", pluginId, i); | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| std::snprintf(tmpBuf, STR_MAX, "%f\n", static_cast<double>(plugin->getInternalParameterValue(i))); | |||
| std::snprintf(tmpBuf, STR_MAX, "%.12g\n", static_cast<double>(plugin->getInternalParameterValue(i))); | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| fUiServer.flushMessages(); | |||
| @@ -589,7 +589,7 @@ protected: | |||
| std::snprintf(tmpBuf, STR_MAX, "PARAMETER_RANGES_%i:%i\n", pluginId, i); | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| std::snprintf(tmpBuf, STR_MAX, "%f:%f:%f:%f:%f:%f\n", | |||
| std::snprintf(tmpBuf, STR_MAX, "%.12g:%.12g:%.12g:%.12g:%.12g:%.12g\n", | |||
| static_cast<double>(paramRanges.def), | |||
| static_cast<double>(paramRanges.min), | |||
| static_cast<double>(paramRanges.max), | |||
| @@ -601,7 +601,7 @@ protected: | |||
| std::snprintf(tmpBuf, STR_MAX, "PARAMVAL_%u:%u\n", pluginId, i); | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| std::snprintf(tmpBuf, STR_MAX, "%f\n", static_cast<double>(plugin->getParameterValue(i))); | |||
| std::snprintf(tmpBuf, STR_MAX, "%.12g\n", static_cast<double>(plugin->getParameterValue(i))); | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| } | |||
| @@ -780,7 +780,7 @@ protected: | |||
| { | |||
| const CarlaScopedLocale csl; | |||
| std::snprintf(tmpBuf, STR_MAX, "%f\n", static_cast<double>(valuef)); | |||
| std::snprintf(tmpBuf, STR_MAX, "%.12g\n", static_cast<double>(valuef)); | |||
| } | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| @@ -837,7 +837,7 @@ protected: | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage("sample-rate\n"),); | |||
| { | |||
| const CarlaScopedLocale csl; | |||
| std::snprintf(tmpBuf, STR_MAX, "%f\n", pData->sampleRate); | |||
| std::snprintf(tmpBuf, STR_MAX, "%.12g\n", pData->sampleRate); | |||
| } | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| @@ -1380,7 +1380,7 @@ protected: | |||
| // send engine info | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeAndFixMessage("runtime-info"),); | |||
| std::snprintf(tmpBuf, STR_MAX, "%f:0\n", static_cast<double>(getDSPLoad())); | |||
| std::snprintf(tmpBuf, STR_MAX, "%.12g:0\n", static_cast<double>(getDSPLoad())); | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| fUiServer.flushMessages(); | |||
| @@ -1398,7 +1398,7 @@ protected: | |||
| timeInfo.bbt.beat, | |||
| static_cast<int>(timeInfo.bbt.tick + 0.5)); | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| std::snprintf(tmpBuf, STR_MAX, "%f\n", timeInfo.bbt.beatsPerMinute); | |||
| std::snprintf(tmpBuf, STR_MAX, "%.12g\n", timeInfo.bbt.beatsPerMinute); | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| } | |||
| else | |||
| @@ -1420,7 +1420,7 @@ protected: | |||
| std::snprintf(tmpBuf, STR_MAX, "PEAKS_%i\n", i); | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| std::snprintf(tmpBuf, STR_MAX, "%f:%f:%f:%f\n", | |||
| std::snprintf(tmpBuf, STR_MAX, "%.12g:%.12g:%.12g:%.12g\n", | |||
| static_cast<double>(plugData.peaks[0]), | |||
| static_cast<double>(plugData.peaks[1]), | |||
| static_cast<double>(plugData.peaks[2]), | |||
| @@ -1436,7 +1436,7 @@ protected: | |||
| std::snprintf(tmpBuf, STR_MAX, "PARAMVAL_%u:%u\n", i, j); | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| std::snprintf(tmpBuf, STR_MAX, "%f\n", static_cast<double>(plugin->getParameterValue(j))); | |||
| std::snprintf(tmpBuf, STR_MAX, "%.12g\n", static_cast<double>(plugin->getParameterValue(j))); | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| fUiServer.flushMessages(); | |||
| @@ -102,8 +102,8 @@ void CarlaEngineCVPort::setRange(const float min, const float max) noexcept | |||
| { | |||
| const CarlaScopedLocale csl; | |||
| std::snprintf(strBufMin, STR_MAX-1, "%f", static_cast<double>(min)); | |||
| std::snprintf(strBufMax, STR_MAX-1, "%f", static_cast<double>(max)); | |||
| std::snprintf(strBufMin, STR_MAX-1, "%.12g", static_cast<double>(min)); | |||
| std::snprintf(strBufMax, STR_MAX-1, "%.12g", static_cast<double>(max)); | |||
| } | |||
| setMetaData(LV2_CORE__minimum, strBufMin, ""); | |||
| @@ -1771,7 +1771,7 @@ void CarlaPlugin::setParameterMappedRange(const uint32_t parameterId, const floa | |||
| char strBuf[STR_MAX+1]; | |||
| carla_zeroChars(strBuf, STR_MAX+1); | |||
| std::snprintf(strBuf, STR_MAX, "%f:%f", static_cast<double>(minimum), static_cast<double>(maximum)); | |||
| std::snprintf(strBuf, STR_MAX, "%.12g:%.12g", static_cast<double>(minimum), static_cast<double>(maximum)); | |||
| #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | |||
| pData->engine->callback(sendCallback, sendOsc, | |||
| @@ -583,7 +583,7 @@ public: | |||
| if (waitForParameterText()) | |||
| return true; | |||
| std::snprintf(strBuf, STR_MAX, "%f", static_cast<double>(fParams[parameterId].value)); | |||
| std::snprintf(strBuf, STR_MAX, "%.12g", static_cast<double>(fParams[parameterId].value)); | |||
| return false; | |||
| } | |||
| @@ -3111,25 +3111,25 @@ private: | |||
| static bool _getSeparatedParameterNameOrUnitImpl(const char* const paramName, char* const strBuf, | |||
| const bool wantName, const bool useBracket) noexcept | |||
| { | |||
| const char* const sepBracketStart(std::strstr(paramName, useBracket ? " [" : " (")); | |||
| const char* const sepBracketStart = std::strstr(paramName, useBracket ? " [" : " ("); | |||
| if (sepBracketStart == nullptr) | |||
| return false; | |||
| const char* const sepBracketEnd(std::strstr(sepBracketStart, useBracket ? "]" : ")")); | |||
| const char* const sepBracketEnd = std::strstr(sepBracketStart, useBracket ? "]" : ")"); | |||
| if (sepBracketEnd == nullptr) | |||
| return false; | |||
| const std::size_t unitSize(static_cast<std::size_t>(sepBracketEnd-sepBracketStart-2)); | |||
| const std::size_t unitSize = static_cast<std::size_t>(sepBracketEnd-sepBracketStart-2); | |||
| if (unitSize > 7) // very unlikely to have such big unit | |||
| return false; | |||
| const std::size_t sepIndex(std::strlen(paramName)-unitSize-3); | |||
| const std::size_t sepIndex = std::strlen(paramName)-unitSize-3; | |||
| // just in case | |||
| if (sepIndex+2 >= STR_MAX) | |||
| if (sepIndex > STR_MAX-3) | |||
| return false; | |||
| if (wantName) | |||
| @@ -478,7 +478,7 @@ public: | |||
| char sampleRateStr[32]; | |||
| { | |||
| const CarlaScopedLocale csl; | |||
| std::snprintf(sampleRateStr, 31, "%f", kEngine->getSampleRate()); | |||
| std::snprintf(sampleRateStr, 31, "%.12g", kEngine->getSampleRate()); | |||
| } | |||
| sampleRateStr[31] = '\0'; | |||
| @@ -1580,7 +1580,7 @@ public: | |||
| if (! fPipeServer.writeMessage(tmpBuf)) | |||
| return; | |||
| std::snprintf(tmpBuf, 0xff, "%f\n", static_cast<double>(pData->engine->getOptions().uiScale)); | |||
| std::snprintf(tmpBuf, 0xff, "%.12g\n", static_cast<double>(pData->engine->getOptions().uiScale)); | |||
| if (! fPipeServer.writeMessage(tmpBuf)) | |||
| return; | |||
| @@ -1611,7 +1611,7 @@ public: | |||
| if (! fPipeServer.writeMessage(tmpBuf)) | |||
| return; | |||
| std::snprintf(tmpBuf, 0xff, "%f\n", static_cast<double>(getParameterValue(i))); | |||
| std::snprintf(tmpBuf, 0xff, "%.12g\n", static_cast<double>(getParameterValue(i))); | |||
| if (! fPipeServer.writeMessage(tmpBuf)) | |||
| return; | |||
| } | |||
| @@ -339,7 +339,7 @@ public: | |||
| dispatcher(effGetParamDisplay, static_cast<int32_t>(parameterId), 0, strBuf); | |||
| if (strBuf[0] == '\0') | |||
| std::snprintf(strBuf, STR_MAX, "%f", static_cast<double>(getParameterValue(parameterId))); | |||
| std::snprintf(strBuf, STR_MAX, "%.12g", static_cast<double>(getParameterValue(parameterId))); | |||
| return true; | |||
| } | |||
| @@ -113,7 +113,7 @@ static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/mi | |||
| open the input and/or output stream device(s) for exclusive use. | |||
| Note that this is not possible with all supported audio APIs. | |||
| If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt | |||
| If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt | |||
| to select realtime scheduling (round-robin) for the callback thread. | |||
| If the RTAUDIO_ALSA_USE_DEFAULT flag is set, RtAudio will attempt to | |||
| @@ -347,7 +347,7 @@ class RTAUDIO_DLL_PUBLIC RtAudio | |||
| open the input and/or output stream device(s) for exclusive use. | |||
| Note that this is not possible with all supported audio APIs. | |||
| If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt | |||
| If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt | |||
| to select realtime scheduling (round-robin) for the callback thread. | |||
| The \c priority parameter will only be used if the RTAUDIO_SCHEDULE_REALTIME | |||
| flag is set. It defines the thread's realtime priority. | |||
| @@ -416,7 +416,7 @@ class RTAUDIO_DLL_PUBLIC RtAudio | |||
| /*! | |||
| This function performs a system query of available devices each time it | |||
| is called, thus supporting devices connected \e after instantiation. If | |||
| a system error occurs during processing, a warning will be issued. | |||
| a system error occurs during processing, a warning will be issued. | |||
| */ | |||
| unsigned int getDeviceCount( void ); | |||
| @@ -483,7 +483,7 @@ class RTAUDIO_DLL_PUBLIC RtAudio | |||
| from within the callback function. | |||
| \param options An optional pointer to a structure containing various | |||
| global stream options, including a list of OR'ed RtAudioStreamFlags | |||
| and a suggested number of stream buffers that can be used to | |||
| and a suggested number of stream buffers that can be used to | |||
| control stream latency. More buffers typically result in more | |||
| robust performance, though at a cost of greater latency. If a | |||
| value of zero is specified, a system-specific median value is | |||
| @@ -658,7 +658,9 @@ class S24 { | |||
| return *this; | |||
| } | |||
| #if defined(__GNUC__) && __GNUC__ < 8 | |||
| S24( const S24& v ) { *this = v; } | |||
| #endif | |||
| S24( const double& d ) { *this = (int) d; } | |||
| S24( const float& f ) { *this = (int) f; } | |||
| S24( const signed short& s ) { *this = (int) s; } | |||
| @@ -792,7 +794,7 @@ protected: | |||
| "warning" message is reported and FAILURE is returned. A | |||
| successful probe is indicated by a return value of SUCCESS. | |||
| */ | |||
| virtual bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, | |||
| virtual bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, | |||
| unsigned int firstChannel, unsigned int sampleRate, | |||
| RtAudioFormat format, unsigned int *bufferSize, | |||
| RtAudio::StreamOptions *options ); | |||
| @@ -884,7 +886,7 @@ public: | |||
| private: | |||
| bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, | |||
| bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, | |||
| unsigned int firstChannel, unsigned int sampleRate, | |||
| RtAudioFormat format, unsigned int *bufferSize, | |||
| RtAudio::StreamOptions *options ); | |||
| @@ -921,7 +923,7 @@ public: | |||
| private: | |||
| bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, | |||
| bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, | |||
| unsigned int firstChannel, unsigned int sampleRate, | |||
| RtAudioFormat format, unsigned int *bufferSize, | |||
| RtAudio::StreamOptions *options ); | |||
| @@ -959,7 +961,7 @@ public: | |||
| std::vector<RtAudio::DeviceInfo> devices_; | |||
| void saveDeviceInfo( void ); | |||
| bool coInitialized_; | |||
| bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, | |||
| bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, | |||
| unsigned int firstChannel, unsigned int sampleRate, | |||
| RtAudioFormat format, unsigned int *bufferSize, | |||
| RtAudio::StreamOptions *options ); | |||
| @@ -998,7 +1000,7 @@ public: | |||
| bool buffersRolling; | |||
| long duplexPrerollBytes; | |||
| std::vector<struct DsDevice> dsDevices; | |||
| bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, | |||
| bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, | |||
| unsigned int firstChannel, unsigned int sampleRate, | |||
| RtAudioFormat format, unsigned int *bufferSize, | |||
| RtAudio::StreamOptions *options ); | |||
| @@ -1069,7 +1071,7 @@ public: | |||
| std::vector<RtAudio::DeviceInfo> devices_; | |||
| void saveDeviceInfo( void ); | |||
| bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, | |||
| bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, | |||
| unsigned int firstChannel, unsigned int sampleRate, | |||
| RtAudioFormat format, unsigned int *bufferSize, | |||
| RtAudio::StreamOptions *options ); | |||
| @@ -1133,7 +1135,7 @@ public: | |||
| private: | |||
| bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, | |||
| bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, | |||
| unsigned int firstChannel, unsigned int sampleRate, | |||
| RtAudioFormat format, unsigned int *bufferSize, | |||
| RtAudio::StreamOptions *options ); | |||
| @@ -1158,7 +1160,7 @@ public: | |||
| private: | |||
| bool probeDeviceOpen( unsigned int /*device*/, StreamMode /*mode*/, unsigned int /*channels*/, | |||
| bool probeDeviceOpen( unsigned int /*device*/, StreamMode /*mode*/, unsigned int /*channels*/, | |||
| unsigned int /*firstChannel*/, unsigned int /*sampleRate*/, | |||
| RtAudioFormat /*format*/, unsigned int * /*bufferSize*/, | |||
| RtAudio::StreamOptions * /*options*/ ) { return false; } | |||
| @@ -302,7 +302,7 @@ public: | |||
| const RawMidiEvent* const rawMidiEvent(it.getValue(nullptr)); | |||
| CARLA_SAFE_ASSERT_CONTINUE(rawMidiEvent != nullptr); | |||
| wrtn = std::snprintf(dataWrtn, maxTimeSize+4, P_INT64 ":%i:", rawMidiEvent->time, rawMidiEvent->size); | |||
| wrtn = std::snprintf(dataWrtn, maxTimeSize+6, P_UINT64 ":%u:", rawMidiEvent->time, rawMidiEvent->size); | |||
| CARLA_SAFE_ASSERT_BREAK(wrtn > 0); | |||
| dataWrtn += wrtn; | |||
| @@ -312,7 +312,7 @@ protected: | |||
| { | |||
| const CarlaScopedLocale csl; | |||
| std::snprintf(strBuf, 0xff, "%f\n", beatsPerMinute); | |||
| std::snprintf(strBuf, 0xff, "%.12g\n", beatsPerMinute); | |||
| } | |||
| CARLA_SAFE_ASSERT_RETURN(writeMessage(strBuf),); | |||
| @@ -139,7 +139,7 @@ public: | |||
| { | |||
| const CarlaScopedLocale csl; | |||
| std::snprintf(msg, 127, "control %u %f", portIndex, static_cast<double>(*valuePtr)); | |||
| std::snprintf(msg, 127, "control %u %.12g", portIndex, static_cast<double>(*valuePtr)); | |||
| } | |||
| msg[127] = '\0'; | |||
| @@ -984,7 +984,7 @@ void CarlaPipeCommon::writeControlMessage(const uint32_t index, const float valu | |||
| { | |||
| const CarlaScopedLocale csl; | |||
| std::snprintf(tmpBuf, 0xff, "%f\n", static_cast<double>(value)); | |||
| std::snprintf(tmpBuf, 0xff, "%.12g\n", static_cast<double>(value)); | |||
| } | |||
| if (! _writeMsgBuffer(tmpBuf, std::strlen(tmpBuf))) | |||
| @@ -179,7 +179,7 @@ public: | |||
| { | |||
| const CarlaScopedLocale csl; | |||
| std::snprintf(strBuf, 0xff, "%f", static_cast<double>(value)); | |||
| std::snprintf(strBuf, 0xff, "%.12g", static_cast<double>(value)); | |||
| } | |||
| strBuf[0xff] = '\0'; | |||
| @@ -199,7 +199,7 @@ public: | |||
| { | |||
| const CarlaScopedLocale csl; | |||
| std::snprintf(strBuf, 0xff, "%f", value); | |||
| std::snprintf(strBuf, 0xff, "%.24g", value); | |||
| } | |||
| strBuf[0xff] = '\0'; | |||