1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Clang: Fix build errors when using a recent clang-cl

This commit is contained in:
reuk 2020-06-29 11:54:41 +01:00
parent ab6c407b9f
commit ac2d7ee272
7 changed files with 15 additions and 7 deletions

View file

@ -248,10 +248,10 @@ namespace build_tools
auto r = writeHeader (mo);
if (r.failed())
return { r };
return { r, {} };
if (! overwriteFileWithNewDataIfDifferent (headerFile, mo))
return { Result::fail ("Can't write to file: " + headerFile.getFullPathName()) };
return { Result::fail ("Can't write to file: " + headerFile.getFullPathName()), {} };
filesCreated.add (headerFile);
}

View file

@ -46,7 +46,8 @@ namespace OggVorbisNamespace
"-Wzero-as-null-pointer-constant",
"-Wsign-conversion",
"-Wswitch-default",
"-Wredundant-decls")
"-Wredundant-decls",
"-Wmisleading-indentation")
#include "oggvorbis/vorbisenc.h"
#include "oggvorbis/codec.h"

View file

@ -38,9 +38,11 @@ AudioFormatReader::~AudioFormatReader()
static void convertFixedToFloat (int* const* channels, int numChannels, int numSamples)
{
constexpr auto scaleFactor = 1.0f / static_cast<float> (0x7fffffff);
for (int i = 0; i < numChannels; ++i)
if (auto d = channels[i])
FloatVectorOperations::convertFixedToFloat (reinterpret_cast<float*> (d), d, 1.0f / 0x7fffffff, numSamples);
FloatVectorOperations::convertFixedToFloat (reinterpret_cast<float*> (d), d, scaleFactor, numSamples);
}
bool AudioFormatReader::read (float* const* destChannels, int numDestChannels,

View file

@ -108,8 +108,10 @@ bool AudioFormatWriter::writeFromAudioReader (AudioFormatReader& reader,
{
void* const b = *bufferChan++;
constexpr auto scaleFactor = 1.0f / static_cast<float> (0x7fffffff);
if (isFloatingPoint())
FloatVectorOperations::convertFixedToFloat ((float*) b, (int*) b, 1.0f / 0x7fffffff, numToDo);
FloatVectorOperations::convertFixedToFloat ((float*) b, (int*) b, scaleFactor, numToDo);
else
convertFloatsToInts ((int*) b, (float*) b, numToDo);
}

View file

@ -52,6 +52,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wnon-virtual-dtor",
"-Wignored-qualifiers",
"-Wmissing-field-initializers",
"-Wformat=",
"-Wformat",
"-Wpedantic",
"-Wextra",
"-Wclass-memaccess")

View file

@ -521,7 +521,8 @@ template <typename FloatType>
unsigned int truncatePositiveToUnsignedInt (FloatType value) noexcept
{
jassert (value >= static_cast<FloatType> (0));
jassert (static_cast<FloatType> (value) <= std::numeric_limits<unsigned int>::max());
jassert (static_cast<FloatType> (value)
<= static_cast<FloatType> (std::numeric_limits<unsigned int>::max()));
return static_cast<unsigned int> (value);
}

View file

@ -105,7 +105,8 @@ bool Random::nextBool() noexcept
float Random::nextFloat() noexcept
{
auto result = static_cast<uint32> (nextInt()) / (std::numeric_limits<uint32>::max() + 1.0f);
auto result = static_cast<uint32> (nextInt())
/ (static_cast<float> (std::numeric_limits<uint32>::max()) + 1.0f);
return result == 1.0f ? 1.0f - std::numeric_limits<float>::epsilon() : result;
}