From 9b687968dba7496f80bc50de374665ad5c41faf4 Mon Sep 17 00:00:00 2001 From: tpoole Date: Tue, 29 Aug 2017 14:47:04 +0100 Subject: [PATCH] Fixed some g++ compiler warnings --- .../buffers/juce_AudioDataConverters.cpp | 4 +- .../buffers/juce_AudioSampleBuffer.h | 2 +- .../buffers/juce_FloatVectorOperations.cpp | 4 +- .../midi/juce_MidiBuffer.cpp | 2 +- .../audio_io/juce_AudioDeviceManager.cpp | 2 +- .../native/juce_linux_Midi.cpp | 2 +- .../sources/juce_AudioTransportSource.cpp | 10 +- .../juce_audio_formats/codecs/flac/compat.h | 334 +++++++++--------- .../codecs/juce_WavAudioFormat.cpp | 2 +- .../juce_audio_plugin_client_Standalone.cpp | 2 +- .../format_types/juce_VSTPluginFormat.cpp | 79 ----- .../juce_core/misc/juce_StdFunctionCompat.cpp | 4 +- .../juce_core/text/juce_CharacterFunctions.h | 6 +- .../juce_dsp/native/juce_avx_SIMDNativeOps.h | 8 +- .../juce_gui_basics/layout/juce_FlexBox.cpp | 4 +- .../misc/juce_JUCESplashScreen.cpp | 2 +- .../geometry/juce_Draggable3DOrientation.h | 4 +- modules/juce_osc/osc/juce_OSCTimeTag.cpp | 3 - .../in_app_purchases/juce_InAppPurchases.cpp | 4 +- 19 files changed, 198 insertions(+), 280 deletions(-) diff --git a/modules/juce_audio_basics/buffers/juce_AudioDataConverters.cpp b/modules/juce_audio_basics/buffers/juce_AudioDataConverters.cpp index de705a8d36..e46de33503 100644 --- a/modules/juce_audio_basics/buffers/juce_AudioDataConverters.cpp +++ b/modules/juce_audio_basics/buffers/juce_AudioDataConverters.cpp @@ -309,7 +309,7 @@ void AudioDataConverters::convertInt24BEToFloat (const void* const source, float void AudioDataConverters::convertInt32LEToFloat (const void* const source, float* const dest, int numSamples, const int srcBytesPerSample) { - const float scale = 1.0f / 0x7fffffff; + const auto scale = 1.0f / (float) 0x7fffffff; const char* intData = static_cast (source); if (source != (void*) dest || srcBytesPerSample >= 4) @@ -334,7 +334,7 @@ void AudioDataConverters::convertInt32LEToFloat (const void* const source, float void AudioDataConverters::convertInt32BEToFloat (const void* const source, float* const dest, int numSamples, const int srcBytesPerSample) { - const float scale = 1.0f / 0x7fffffff; + const auto scale = 1.0f / (float) 0x7fffffff; const char* intData = static_cast (source); if (source != (void*) dest || srcBytesPerSample >= 4) diff --git a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h index 7702b6e70d..dc78d7b2ec 100644 --- a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h +++ b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h @@ -629,7 +629,7 @@ public: jassert (isPositiveAndBelow (channel, numChannels)); jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); - const auto increment = (endGain - startGain) / numSamples; + const auto increment = (endGain - startGain) / (float) numSamples; auto* d = channels[channel] + startSample; while (--numSamples >= 0) diff --git a/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp b/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp index cbf6fb2554..5ec378ab49 100644 --- a/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp +++ b/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp @@ -874,7 +874,7 @@ void JUCE_CALLTYPE FloatVectorOperations::convertFixedToFloat (float* dest, cons vmulq_n_f32 (vcvtq_f32_s32 (vld1q_s32 (src)), multiplier), JUCE_LOAD_NONE, JUCE_INCREMENT_SRC_DEST, ) #else - JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = src[i] * multiplier, + JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = (float) src[i] * multiplier, Mode::mul (mult, _mm_cvtepi32_ps (_mm_loadu_si128 ((const __m128i*) src))), JUCE_LOAD_NONE, JUCE_INCREMENT_SRC_DEST, const Mode::ParallelType mult = Mode::load1 (multiplier);) @@ -1158,7 +1158,7 @@ public: static void convertFixed (float* d, const int* s, ValueType multiplier, int num) { while (--num >= 0) - *d++ = *s++ * multiplier; + *d++ = (float) *s++ * multiplier; } static bool areAllValuesEqual (const ValueType* d, int num, ValueType target) diff --git a/modules/juce_audio_basics/midi/juce_MidiBuffer.cpp b/modules/juce_audio_basics/midi/juce_MidiBuffer.cpp index cc71ff0bc8..8795756c70 100644 --- a/modules/juce_audio_basics/midi/juce_MidiBuffer.cpp +++ b/modules/juce_audio_basics/midi/juce_MidiBuffer.cpp @@ -34,7 +34,7 @@ namespace MidiBufferHelpers inline uint16 getEventTotalSize (const void* const d) noexcept { - return getEventDataSize (d) + sizeof (int32) + sizeof (uint16); + return (uint16) (getEventDataSize (d) + sizeof (int32) + sizeof (uint16)); } static int findActualEventLength (const uint8* const data, const int maxBytes) noexcept diff --git a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp index 32108d48d2..a6e74c570f 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp +++ b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp @@ -929,7 +929,7 @@ void AudioDeviceManager::LevelMeter::updateLevel (const float* const* channelDat for (int i = 0; i < numChannels; ++i) s += std::abs (channelData[i][j]); - s /= numChannels; + s /= (float) numChannels; const double decayFactor = 0.99992; diff --git a/modules/juce_audio_devices/native/juce_linux_Midi.cpp b/modules/juce_audio_devices/native/juce_linux_Midi.cpp index 74bbe4131b..260fcc95d0 100644 --- a/modules/juce_audio_devices/native/juce_linux_Midi.cpp +++ b/modules/juce_audio_devices/native/juce_linux_Midi.cpp @@ -137,7 +137,7 @@ public: numBytes -= numSent; data += numSent; - snd_seq_ev_set_source (&event, portId); + snd_seq_ev_set_source (&event, (unsigned char) portId); snd_seq_ev_set_subs (&event); snd_seq_ev_set_direct (&event); diff --git a/modules/juce_audio_devices/sources/juce_AudioTransportSource.cpp b/modules/juce_audio_devices/sources/juce_AudioTransportSource.cpp index 31610633b0..7d59f13c76 100644 --- a/modules/juce_audio_devices/sources/juce_AudioTransportSource.cpp +++ b/modules/juce_audio_devices/sources/juce_AudioTransportSource.cpp @@ -159,7 +159,7 @@ void AudioTransportSource::setPosition (double newPosition) double AudioTransportSource::getCurrentPosition() const { if (sampleRate > 0.0) - return getNextReadPosition() / sampleRate; + return (double) getNextReadPosition() / sampleRate; return 0.0; } @@ -167,7 +167,7 @@ double AudioTransportSource::getCurrentPosition() const double AudioTransportSource::getLengthInSeconds() const { if (sampleRate > 0.0) - return getTotalLength() / sampleRate; + return (double) getTotalLength() / sampleRate; return 0.0; } @@ -177,7 +177,7 @@ void AudioTransportSource::setNextReadPosition (int64 newPosition) if (positionableSource != nullptr) { if (sampleRate > 0 && sourceSampleRate > 0) - newPosition = (int64) (newPosition * sourceSampleRate / sampleRate); + newPosition = (int64) ((double) newPosition * sourceSampleRate / sampleRate); positionableSource->setNextReadPosition (newPosition); @@ -193,7 +193,7 @@ int64 AudioTransportSource::getNextReadPosition() const if (positionableSource != nullptr) { const double ratio = (sampleRate > 0 && sourceSampleRate > 0) ? sampleRate / sourceSampleRate : 1.0; - return (int64) (positionableSource->getNextReadPosition() * ratio); + return (int64) ((double) positionableSource->getNextReadPosition() * ratio); } return 0; @@ -206,7 +206,7 @@ int64 AudioTransportSource::getTotalLength() const if (positionableSource != nullptr) { const double ratio = (sampleRate > 0 && sourceSampleRate > 0) ? sampleRate / sourceSampleRate : 1.0; - return (int64) (positionableSource->getTotalLength() * ratio); + return (int64) ((double) positionableSource->getTotalLength() * ratio); } return 0; diff --git a/modules/juce_audio_formats/codecs/flac/compat.h b/modules/juce_audio_formats/codecs/flac/compat.h index 543f49e83a..6c26491411 100644 --- a/modules/juce_audio_formats/codecs/flac/compat.h +++ b/modules/juce_audio_formats/codecs/flac/compat.h @@ -1,167 +1,167 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2012-2014 Xiph.org Foundation - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * - Neither the name of the Xiph.org Foundation nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* This is the prefered location of all CPP hackery to make $random_compiler - * work like something approaching a C99 (or maybe more accurately GNU99) - * compiler. - * - * It is assumed that this header will be included after "config.h". - */ - -#ifndef FLAC__SHARE__COMPAT_H -#define FLAC__SHARE__COMPAT_H - -#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ -#define FLAC__off_t __int64 /* use this instead of off_t to fix the 2 GB limit */ -#if !defined __MINGW32__ -#define fseeko _fseeki64 -#define ftello _ftelli64 -#else /* MinGW */ -#if !defined(HAVE_FSEEKO) -#define fseeko fseeko64 -#define ftello ftello64 -#endif -#endif -#else -#define FLAC__off_t off_t -#endif - -#if defined(_MSC_VER) -#define strtoll _strtoi64 -#define strtoull _strtoui64 -#endif - -#if defined(_MSC_VER) -#define inline __inline -#endif - -#if defined __INTEL_COMPILER || (defined _MSC_VER && defined _WIN64) -/* MSVS generates VERY slow 32-bit code with __restrict */ -#define flac_restrict __restrict -#elif defined __GNUC__ -#define flac_restrict __restrict__ -#else -#define flac_restrict -#endif - -#define FLAC__U64L(x) x##ULL - -#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ -#define FLAC__STRCASECMP stricmp -#define FLAC__STRNCASECMP strnicmp -#else -#define FLAC__STRCASECMP strcasecmp -#define FLAC__STRNCASECMP strncasecmp -#endif - -#if defined _MSC_VER -# if _MSC_VER >= 1600 -/* Visual Studio 2010 has decent C99 support */ -# define PRIu64 "llu" -# define PRId64 "lld" -# define PRIx64 "llx" -# else -# ifndef UINT32_MAX -# define UINT32_MAX _UI32_MAX -# endif - typedef unsigned __int64 uint64_t; - typedef unsigned __int32 uint32_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int8 uint8_t; - typedef __int64 int64_t; - typedef __int32 int32_t; - typedef __int16 int16_t; - typedef __int8 int8_t; -# define PRIu64 "I64u" -# define PRId64 "I64d" -# define PRIx64 "I64x" -# endif -#endif /* defined _MSC_VER */ - -#ifdef _WIN32 -/* All char* strings are in UTF-8 format. Added to support Unicode files on Windows */ -#include "win_utf8_io.h" - -#define flac_printf printf_utf8 -#define flac_fprintf fprintf_utf8 -#define flac_vfprintf vfprintf_utf8 -#define flac_fopen fopen_utf8 -#define flac_chmod chmod_utf8 -#define flac_utime utime_utf8 -#define flac_unlink unlink_utf8 -#define flac_rename rename_utf8 -#define flac_stat _stat64_utf8 - -#else - -#define flac_printf printf -#define flac_fprintf fprintf -#define flac_vfprintf vfprintf -#define flac_fopen fopen -#define flac_chmod chmod -#define flac_utime utime -#define flac_unlink unlink -#define flac_rename rename -#define flac_stat stat - -#endif - -#ifdef _WIN32 -#define flac_stat_s __stat64 /* stat struct */ -#define flac_fstat _fstat64 -#else -#define flac_stat_s stat /* stat struct */ -#define flac_fstat fstat -#endif - -#ifndef M_LN2 -#define M_LN2 0.69314718055994530942 -#endif -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -/* FLAC needs to compile and work correctly on systems with a normal ISO C99 - * snprintf as well as Microsoft Visual Studio which has an non-standards - * conformant snprint_s function. - * - * This function wraps the MS version to behave more like the the ISO version. - */ -#ifdef __cplusplus -extern "C" { -#endif -int flac_snprintf(char *str, size_t size, const char *fmt, ...); -int flac_vsnprintf(char *str, size_t size, const char *fmt, va_list va); -#ifdef __cplusplus -}; -#endif - -#endif /* FLAC__SHARE__COMPAT_H */ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2012-2014 Xiph.org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* This is the prefered location of all CPP hackery to make $random_compiler + * work like something approaching a C99 (or maybe more accurately GNU99) + * compiler. + * + * It is assumed that this header will be included after "config.h". + */ + +#ifndef FLAC__SHARE__COMPAT_H +#define FLAC__SHARE__COMPAT_H + +#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ +#define FLAC__off_t __int64 /* use this instead of off_t to fix the 2 GB limit */ +#if !defined __MINGW32__ +#define fseeko _fseeki64 +#define ftello _ftelli64 +#else /* MinGW */ +#if !defined(HAVE_FSEEKO) +#define fseeko fseeko64 +#define ftello ftello64 +#endif +#endif +#else +#define FLAC__off_t off_t +#endif + +#if defined(_MSC_VER) +#define strtoll _strtoi64 +#define strtoull _strtoui64 +#endif + +#if defined(_MSC_VER) +#define inline __inline +#endif + +#if defined __INTEL_COMPILER || (defined _MSC_VER && defined _WIN64) +/* MSVS generates VERY slow 32-bit code with __restrict */ +#define flac_restrict __restrict +#elif defined __GNUC__ +#define flac_restrict __restrict__ +#else +#define flac_restrict +#endif + +#define FLAC__U64L(x) x##ULL + +#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ +#define FLAC__STRCASECMP stricmp +#define FLAC__STRNCASECMP strnicmp +#else +#define FLAC__STRCASECMP strcasecmp +#define FLAC__STRNCASECMP strncasecmp +#endif + +#if defined _MSC_VER +# if _MSC_VER >= 1600 +/* Visual Studio 2010 has decent C99 support */ +# define PRIu64 "llu" +# define PRId64 "lld" +# define PRIx64 "llx" +# else +# ifndef UINT32_MAX +# define UINT32_MAX _UI32_MAX +# endif + typedef unsigned __int64 uint64_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int8 uint8_t; + typedef __int64 int64_t; + typedef __int32 int32_t; + typedef __int16 int16_t; + typedef __int8 int8_t; +# define PRIu64 "I64u" +# define PRId64 "I64d" +# define PRIx64 "I64x" +# endif +#endif /* defined _MSC_VER */ + +#ifdef _WIN32 +/* All char* strings are in UTF-8 format. Added to support Unicode files on Windows */ +#include "win_utf8_io.h" + +#define flac_printf printf_utf8 +#define flac_fprintf fprintf_utf8 +#define flac_vfprintf vfprintf_utf8 +#define flac_fopen fopen_utf8 +#define flac_chmod chmod_utf8 +#define flac_utime utime_utf8 +#define flac_unlink unlink_utf8 +#define flac_rename rename_utf8 +#define flac_stat _stat64_utf8 + +#else + +#define flac_printf printf +#define flac_fprintf fprintf +#define flac_vfprintf vfprintf +#define flac_fopen fopen +#define flac_chmod chmod +#define flac_utime utime +#define flac_unlink unlink +#define flac_rename rename +#define flac_stat stat + +#endif + +#ifdef _WIN32 +#define flac_stat_s __stat64 /* stat struct */ +#define flac_fstat _fstat64 +#else +#define flac_stat_s stat /* stat struct */ +#define flac_fstat fstat +#endif + +#ifndef M_LN2 +#define M_LN2 0.69314718055994530942 +#endif +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +/* FLAC needs to compile and work correctly on systems with a normal ISO C99 + * snprintf as well as Microsoft Visual Studio which has an non-standards + * conformant snprint_s function. + * + * This function wraps the MS version to behave more like the the ISO version. + */ +#ifdef __cplusplus +extern "C" { +#endif +int flac_snprintf(char *str, size_t size, const char *fmt, ...); +int flac_vsnprintf(char *str, size_t size, const char *fmt, va_list va); +#ifdef __cplusplus +} +#endif + +#endif /* FLAC__SHARE__COMPAT_H */ diff --git a/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp index 9021d68142..d54bdc6f78 100644 --- a/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp @@ -892,7 +892,7 @@ namespace WavFileHelpers return xml.getMemoryBlock(); } - }; + } //============================================================================== struct ExtensibleWavSubFormat diff --git a/modules/juce_audio_plugin_client/juce_audio_plugin_client_Standalone.cpp b/modules/juce_audio_plugin_client/juce_audio_plugin_client_Standalone.cpp index 614cdbe52c..e5bf500d87 100644 --- a/modules/juce_audio_plugin_client/juce_audio_plugin_client_Standalone.cpp +++ b/modules/juce_audio_plugin_client/juce_audio_plugin_client_Standalone.cpp @@ -38,7 +38,7 @@ #endif #else - JUCE_CREATE_APPLICATION_DEFINE(StandaloneFilterApp); + JUCE_CREATE_APPLICATION_DEFINE(StandaloneFilterApp) #endif JUCE_MAIN_FUNCTION_DEFINITION diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index 11e311d684..0b1dcb5e41 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -228,38 +228,8 @@ static pointer_sized_int VSTINTERFACECALL audioMaster (VstEffectInterface*, int3 namespace { - static bool xErrorTriggered = false; - - static int temporaryErrorHandler (::Display*, XErrorEvent*) - { - xErrorTriggered = true; - return 0; - } - typedef void (*EventProcPtr) (XEvent* ev); - static EventProcPtr getPropertyFromXWindow (Window handle, Atom atom) - { - XErrorHandler oldErrorHandler = XSetErrorHandler (temporaryErrorHandler); - xErrorTriggered = false; - - int userSize; - unsigned long bytes, userCount; - unsigned char* data; - Atom userType; - - { - ScopedXDisplay xDisplay; - - XGetWindowProperty (xDisplay.display, handle, atom, 0, 1, false, AnyPropertyType, - &userType, &userSize, &userCount, &bytes, &data); - } - - XSetErrorHandler (oldErrorHandler); - - return (userCount == 1 && ! xErrorTriggered) ? *reinterpret_cast (data) : nullptr; - } - Window getChildWindow (Window windowToCheck) { Window rootWindow, parentWindow; @@ -276,55 +246,6 @@ namespace return 0; } - - static void translateJuceToXButtonModifiers (const MouseEvent& e, XEvent& ev) noexcept - { - if (e.mods.isLeftButtonDown()) - { - ev.xbutton.button = Button1; - ev.xbutton.state |= Button1Mask; - } - else if (e.mods.isRightButtonDown()) - { - ev.xbutton.button = Button3; - ev.xbutton.state |= Button3Mask; - } - else if (e.mods.isMiddleButtonDown()) - { - ev.xbutton.button = Button2; - ev.xbutton.state |= Button2Mask; - } - } - - static void translateJuceToXMotionModifiers (const MouseEvent& e, XEvent& ev) noexcept - { - if (e.mods.isLeftButtonDown()) ev.xmotion.state |= Button1Mask; - else if (e.mods.isRightButtonDown()) ev.xmotion.state |= Button3Mask; - else if (e.mods.isMiddleButtonDown()) ev.xmotion.state |= Button2Mask; - } - - static void translateJuceToXCrossingModifiers (const MouseEvent& e, XEvent& ev) noexcept - { - if (e.mods.isLeftButtonDown()) ev.xcrossing.state |= Button1Mask; - else if (e.mods.isRightButtonDown()) ev.xcrossing.state |= Button3Mask; - else if (e.mods.isMiddleButtonDown()) ev.xcrossing.state |= Button2Mask; - } - - static void translateJuceToXMouseWheelModifiers (const MouseEvent& e, const float increment, XEvent& ev) noexcept - { - ignoreUnused (e); - - if (increment < 0) - { - ev.xbutton.button = Button5; - ev.xbutton.state |= Button5Mask; - } - else if (increment > 0) - { - ev.xbutton.button = Button4; - ev.xbutton.state |= Button4Mask; - } - } } #endif diff --git a/modules/juce_core/misc/juce_StdFunctionCompat.cpp b/modules/juce_core/misc/juce_StdFunctionCompat.cpp index cf548ef609..ec56e2255e 100644 --- a/modules/juce_core/misc/juce_StdFunctionCompat.cpp +++ b/modules/juce_core/misc/juce_StdFunctionCompat.cpp @@ -32,8 +32,8 @@ namespace FunctionTestsHelpers { - void incrementArgument (int& x) { x++; }; - double multiply (double x, double a) noexcept { return a * x; }; + void incrementArgument (int& x) { x++; } + double multiply (double x, double a) noexcept { return a * x; } struct BigData { diff --git a/modules/juce_core/text/juce_CharacterFunctions.h b/modules/juce_core/text/juce_CharacterFunctions.h index 6cdfca9c03..bfdf54d15b 100644 --- a/modules/juce_core/text/juce_CharacterFunctions.h +++ b/modules/juce_core/text/juce_CharacterFunctions.h @@ -71,7 +71,7 @@ namespace internal template <> struct make_unsigned { typedef unsigned int type; }; template <> struct make_unsigned { typedef unsigned long type; }; template <> struct make_unsigned { typedef unsigned long long type; }; -}; +} //============================================================================== /** @@ -181,7 +181,7 @@ public: || ((numSigFigs == 0 && (! decimalPointFound)) && digit == 0)) continue; - *currentCharacter++ = '0' + (char) digit; + *currentCharacter++ = (char) ('0' + (char) digit); numSigFigs++; } else if ((! decimalPointFound) && *text == '.') @@ -219,7 +219,7 @@ public: if (digit != 0 || exponentMagnitude != 0) { - *currentCharacter++ = '0' + (char) digit; + *currentCharacter++ = (char) ('0' + (char) digit); exponentMagnitude = (exponentMagnitude * 10) + digit; } } diff --git a/modules/juce_dsp/native/juce_avx_SIMDNativeOps.h b/modules/juce_dsp/native/juce_avx_SIMDNativeOps.h index cdeda72596..c3f6506e95 100644 --- a/modules/juce_dsp/native/juce_avx_SIMDNativeOps.h +++ b/modules/juce_dsp/native/juce_avx_SIMDNativeOps.h @@ -198,7 +198,7 @@ struct SIMDNativeOps const int8_t* lo_ptr = reinterpret_cast (&lo); const int8_t* hi_ptr = reinterpret_cast (&hi); - return lo_ptr[0] + hi_ptr[0] + lo_ptr[16] + hi_ptr[16]; + return (int8_t) (lo_ptr[0] + hi_ptr[0] + lo_ptr[16] + hi_ptr[16]); } static forcedinline __m256i JUCE_VECTOR_CALLTYPE mul (__m256i a, __m256i b) @@ -257,7 +257,7 @@ struct SIMDNativeOps const uint8_t* lo_ptr = reinterpret_cast (&lo); const uint8_t* hi_ptr = reinterpret_cast (&hi); - return lo_ptr[0] + hi_ptr[0] + lo_ptr[16] + hi_ptr[16]; + return (uint8_t) (lo_ptr[0] + hi_ptr[0] + lo_ptr[16] + hi_ptr[16]); } static forcedinline __m256i JUCE_VECTOR_CALLTYPE mul (__m256i a, __m256i b) @@ -308,7 +308,7 @@ struct SIMDNativeOps tmp = _mm256_hadd_epi16 (tmp, tmp); tmp = _mm256_hadd_epi16 (tmp, tmp); int16_t* ptr = reinterpret_cast (&tmp); - return ptr[0] + ptr[8]; + return (int16_t) (ptr[0] + ptr[8]); } }; @@ -351,7 +351,7 @@ struct SIMDNativeOps tmp = _mm256_hadd_epi16 (tmp, tmp); tmp = _mm256_hadd_epi16 (tmp, tmp); uint16_t* ptr = reinterpret_cast (&tmp); - return ptr[0] + ptr[8]; + return (uint16_t) (ptr[0] + ptr[8]); } }; diff --git a/modules/juce_gui_basics/layout/juce_FlexBox.cpp b/modules/juce_gui_basics/layout/juce_FlexBox.cpp index bdaaea8060..fb042d3727 100644 --- a/modules/juce_gui_basics/layout/juce_FlexBox.cpp +++ b/modules/juce_gui_basics/layout/juce_FlexBox.cpp @@ -844,8 +844,8 @@ FlexItem FlexItem::withWidth (float newWidth) const noexcept { auto fi = FlexItem FlexItem::withMinWidth (float newMinWidth) const noexcept { auto fi = *this; fi.minWidth = newMinWidth; return fi; } FlexItem FlexItem::withMaxWidth (float newMaxWidth) const noexcept { auto fi = *this; fi.maxWidth = newMaxWidth; return fi; } -FlexItem FlexItem::withMinHeight (float newMinHeight) const noexcept { auto fi = *this; fi.minHeight = newMinHeight; return fi; }; -FlexItem FlexItem::withMaxHeight (float newMaxHeight) const noexcept { auto fi = *this; fi.maxHeight = newMaxHeight; return fi; }; +FlexItem FlexItem::withMinHeight (float newMinHeight) const noexcept { auto fi = *this; fi.minHeight = newMinHeight; return fi; } +FlexItem FlexItem::withMaxHeight (float newMaxHeight) const noexcept { auto fi = *this; fi.maxHeight = newMaxHeight; return fi; } FlexItem FlexItem::withHeight (float newHeight) const noexcept { auto fi = *this; fi.height = newHeight; return fi; } FlexItem FlexItem::withMargin (Margin m) const noexcept { auto fi = *this; fi.margin = m; return fi; } diff --git a/modules/juce_gui_basics/misc/juce_JUCESplashScreen.cpp b/modules/juce_gui_basics/misc/juce_JUCESplashScreen.cpp index 103266104a..387c481283 100644 --- a/modules/juce_gui_basics/misc/juce_JUCESplashScreen.cpp +++ b/modules/juce_gui_basics/misc/juce_JUCESplashScreen.cpp @@ -77,7 +77,7 @@ struct ReportingThreadContainer : public ChangeListener, juce_DeclareSingleton_SingleThreaded_Minimal (ReportingThreadContainer) }; -juce_ImplementSingleton_SingleThreaded (ReportingThreadContainer); +juce_ImplementSingleton_SingleThreaded (ReportingThreadContainer) //============================================================================== struct ReportingThread : public Thread, diff --git a/modules/juce_opengl/geometry/juce_Draggable3DOrientation.h b/modules/juce_opengl/geometry/juce_Draggable3DOrientation.h index cbc9093def..125f65f429 100644 --- a/modules/juce_opengl/geometry/juce_Draggable3DOrientation.h +++ b/modules/juce_opengl/geometry/juce_Draggable3DOrientation.h @@ -128,8 +128,8 @@ private: // calling any of the mouse input methods! jassert (scale > 0); - return Point ((mousePos.x - area.getCentreX()) / scale, - (area.getCentreY() - mousePos.y) / scale); + return Point ((mousePos.x - (float) area.getCentreX()) / (float) scale, + ((float) area.getCentreY() - mousePos.y) / (float) scale); } VectorType projectOnSphere (const Point pos) const noexcept diff --git a/modules/juce_osc/osc/juce_OSCTimeTag.cpp b/modules/juce_osc/osc/juce_OSCTimeTag.cpp index 35021a2ec8..cfc7c95203 100644 --- a/modules/juce_osc/osc/juce_OSCTimeTag.cpp +++ b/modules/juce_osc/osc/juce_OSCTimeTag.cpp @@ -42,9 +42,6 @@ OSCTimeTag::OSCTimeTag (Time time) noexcept { const uint64 milliseconds = (uint64) time.toMilliseconds() + millisecondsBetweenOscAndJuceEpochs; - // something went seriously wrong if the line above didn't render the time nonnegative! - jassert (milliseconds >= 0); - uint64 seconds = milliseconds / 1000; uint32 fractionalPart = uint32 (4294967.296 * (milliseconds % 1000)); diff --git a/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp b/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp index 341ba1a0ad..39a8cb17f8 100644 --- a/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp +++ b/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp @@ -48,7 +48,7 @@ void InAppPurchases::getProductsInformation (const StringArray& productIdentifie #else Array products; for (auto productId : productIdentifiers) - products.add (Product {productId}); + products.add (Product { productId, {}, {}, {}, {} }); listeners.call (&Listener::productsInfoReturned, products); #endif @@ -63,7 +63,7 @@ void InAppPurchases::purchaseProduct (const String& productIdentifier, pimpl->purchaseProduct (productIdentifier, isSubscription, upgradeProductIdentifiers, creditForUnusedSubscription); #else - Listener::PurchaseInfo purchaseInfo { Purchase {"", productIdentifier}, {} }; + Listener::PurchaseInfo purchaseInfo { Purchase { "", productIdentifier, {}, {}, {} }, {} }; listeners.call (&Listener::productPurchaseFinished, purchaseInfo, false, "In-app purchases unavailable"); ignoreUnused (isSubscription, upgradeProductIdentifiers, creditForUnusedSubscription);