@@ -32,7 +32,7 @@ void AudioDataConverters::convertFloatToInt16LE (const float* source, void* dest | |||
{ | |||
for (int i = 0; i < numSamples; ++i) | |||
{ | |||
*reinterpret_cast<uint16*> (intData) = ByteOrder::swapIfBigEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
*unalignedPointerCast<uint16*> (intData) = ByteOrder::swapIfBigEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
intData += destBytesPerSample; | |||
} | |||
} | |||
@@ -43,7 +43,7 @@ void AudioDataConverters::convertFloatToInt16LE (const float* source, void* dest | |||
for (int i = numSamples; --i >= 0;) | |||
{ | |||
intData -= destBytesPerSample; | |||
*reinterpret_cast<uint16*> (intData) = ByteOrder::swapIfBigEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
*unalignedPointerCast<uint16*> (intData) = ByteOrder::swapIfBigEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
} | |||
} | |||
} | |||
@@ -57,7 +57,7 @@ void AudioDataConverters::convertFloatToInt16BE (const float* source, void* dest | |||
{ | |||
for (int i = 0; i < numSamples; ++i) | |||
{ | |||
*reinterpret_cast<uint16*> (intData) = ByteOrder::swapIfLittleEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
*unalignedPointerCast<uint16*> (intData) = ByteOrder::swapIfLittleEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
intData += destBytesPerSample; | |||
} | |||
} | |||
@@ -68,7 +68,7 @@ void AudioDataConverters::convertFloatToInt16BE (const float* source, void* dest | |||
for (int i = numSamples; --i >= 0;) | |||
{ | |||
intData -= destBytesPerSample; | |||
*reinterpret_cast<uint16*> (intData) = ByteOrder::swapIfLittleEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
*unalignedPointerCast<uint16*> (intData) = ByteOrder::swapIfLittleEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
} | |||
} | |||
} | |||
@@ -132,7 +132,7 @@ void AudioDataConverters::convertFloatToInt32LE (const float* source, void* dest | |||
{ | |||
for (int i = 0; i < numSamples; ++i) | |||
{ | |||
*reinterpret_cast<uint32*> (intData) = ByteOrder::swapIfBigEndian ((uint32) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
*unalignedPointerCast<uint32*> (intData) = ByteOrder::swapIfBigEndian ((uint32) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
intData += destBytesPerSample; | |||
} | |||
} | |||
@@ -143,7 +143,7 @@ void AudioDataConverters::convertFloatToInt32LE (const float* source, void* dest | |||
for (int i = numSamples; --i >= 0;) | |||
{ | |||
intData -= destBytesPerSample; | |||
*reinterpret_cast<uint32*> (intData) = ByteOrder::swapIfBigEndian ((uint32) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
*unalignedPointerCast<uint32*> (intData) = ByteOrder::swapIfBigEndian ((uint32) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
} | |||
} | |||
} | |||
@@ -157,7 +157,7 @@ void AudioDataConverters::convertFloatToInt32BE (const float* source, void* dest | |||
{ | |||
for (int i = 0; i < numSamples; ++i) | |||
{ | |||
*reinterpret_cast<uint32*> (intData) = ByteOrder::swapIfLittleEndian ((uint32) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
*unalignedPointerCast<uint32*> (intData) = ByteOrder::swapIfLittleEndian ((uint32) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
intData += destBytesPerSample; | |||
} | |||
} | |||
@@ -168,7 +168,7 @@ void AudioDataConverters::convertFloatToInt32BE (const float* source, void* dest | |||
for (int i = numSamples; --i >= 0;) | |||
{ | |||
intData -= destBytesPerSample; | |||
*reinterpret_cast<uint32*> (intData) = ByteOrder::swapIfLittleEndian ((uint32) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
*unalignedPointerCast<uint32*> (intData) = ByteOrder::swapIfLittleEndian ((uint32) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i]))); | |||
} | |||
} | |||
} | |||
@@ -181,10 +181,10 @@ void AudioDataConverters::convertFloatToFloat32LE (const float* source, void* de | |||
for (int i = 0; i < numSamples; ++i) | |||
{ | |||
*reinterpret_cast<float*> (d) = source[i]; | |||
*unalignedPointerCast<float*> (d) = source[i]; | |||
#if JUCE_BIG_ENDIAN | |||
*reinterpret_cast<uint32*> (d) = ByteOrder::swap (*reinterpret_cast<uint32*> (d)); | |||
*unalignedPointerCast<uint32*> (d) = ByteOrder::swap (*unalignedPointerCast<uint32*> (d)); | |||
#endif | |||
d += destBytesPerSample; | |||
@@ -199,10 +199,10 @@ void AudioDataConverters::convertFloatToFloat32BE (const float* source, void* de | |||
for (int i = 0; i < numSamples; ++i) | |||
{ | |||
*reinterpret_cast<float*> (d) = source[i]; | |||
*unalignedPointerCast<float*> (d) = source[i]; | |||
#if JUCE_LITTLE_ENDIAN | |||
*reinterpret_cast<uint32*> (d) = ByteOrder::swap (*reinterpret_cast<uint32*> (d)); | |||
*unalignedPointerCast<uint32*> (d) = ByteOrder::swap (*unalignedPointerCast<uint32*> (d)); | |||
#endif | |||
d += destBytesPerSample; | |||
@@ -219,7 +219,7 @@ void AudioDataConverters::convertInt16LEToFloat (const void* source, float* dest | |||
{ | |||
for (int i = 0; i < numSamples; ++i) | |||
{ | |||
dest[i] = scale * (short) ByteOrder::swapIfBigEndian (*reinterpret_cast<const uint16*> (intData)); | |||
dest[i] = scale * (short) ByteOrder::swapIfBigEndian (*unalignedPointerCast<const uint16*> (intData)); | |||
intData += srcBytesPerSample; | |||
} | |||
} | |||
@@ -230,7 +230,7 @@ void AudioDataConverters::convertInt16LEToFloat (const void* source, float* dest | |||
for (int i = numSamples; --i >= 0;) | |||
{ | |||
intData -= srcBytesPerSample; | |||
dest[i] = scale * (short) ByteOrder::swapIfBigEndian (*reinterpret_cast<const uint16*> (intData)); | |||
dest[i] = scale * (short) ByteOrder::swapIfBigEndian (*unalignedPointerCast<const uint16*> (intData)); | |||
} | |||
} | |||
} | |||
@@ -244,7 +244,7 @@ void AudioDataConverters::convertInt16BEToFloat (const void* source, float* dest | |||
{ | |||
for (int i = 0; i < numSamples; ++i) | |||
{ | |||
dest[i] = scale * (short) ByteOrder::swapIfLittleEndian (*reinterpret_cast<const uint16*> (intData)); | |||
dest[i] = scale * (short) ByteOrder::swapIfLittleEndian (*unalignedPointerCast<const uint16*> (intData)); | |||
intData += srcBytesPerSample; | |||
} | |||
} | |||
@@ -255,7 +255,7 @@ void AudioDataConverters::convertInt16BEToFloat (const void* source, float* dest | |||
for (int i = numSamples; --i >= 0;) | |||
{ | |||
intData -= srcBytesPerSample; | |||
dest[i] = scale * (short) ByteOrder::swapIfLittleEndian (*reinterpret_cast<const uint16*> (intData)); | |||
dest[i] = scale * (short) ByteOrder::swapIfLittleEndian (*unalignedPointerCast<const uint16*> (intData)); | |||
} | |||
} | |||
} | |||
@@ -319,7 +319,7 @@ void AudioDataConverters::convertInt32LEToFloat (const void* source, float* dest | |||
{ | |||
for (int i = 0; i < numSamples; ++i) | |||
{ | |||
dest[i] = scale * (float) ByteOrder::swapIfBigEndian (*reinterpret_cast<const uint32*> (intData)); | |||
dest[i] = scale * (float) ByteOrder::swapIfBigEndian (*unalignedPointerCast<const uint32*> (intData)); | |||
intData += srcBytesPerSample; | |||
} | |||
} | |||
@@ -330,7 +330,7 @@ void AudioDataConverters::convertInt32LEToFloat (const void* source, float* dest | |||
for (int i = numSamples; --i >= 0;) | |||
{ | |||
intData -= srcBytesPerSample; | |||
dest[i] = scale * (float) ByteOrder::swapIfBigEndian (*reinterpret_cast<const uint32*> (intData)); | |||
dest[i] = scale * (float) ByteOrder::swapIfBigEndian (*unalignedPointerCast<const uint32*> (intData)); | |||
} | |||
} | |||
} | |||
@@ -344,7 +344,7 @@ void AudioDataConverters::convertInt32BEToFloat (const void* source, float* dest | |||
{ | |||
for (int i = 0; i < numSamples; ++i) | |||
{ | |||
dest[i] = scale * (float) ByteOrder::swapIfLittleEndian (*reinterpret_cast<const uint32*> (intData)); | |||
dest[i] = scale * (float) ByteOrder::swapIfLittleEndian (*unalignedPointerCast<const uint32*> (intData)); | |||
intData += srcBytesPerSample; | |||
} | |||
} | |||
@@ -355,7 +355,7 @@ void AudioDataConverters::convertInt32BEToFloat (const void* source, float* dest | |||
for (int i = numSamples; --i >= 0;) | |||
{ | |||
intData -= srcBytesPerSample; | |||
dest[i] = scale * (float) ByteOrder::swapIfLittleEndian (*reinterpret_cast<const uint32*> (intData)); | |||
dest[i] = scale * (float) ByteOrder::swapIfLittleEndian (*unalignedPointerCast<const uint32*> (intData)); | |||
} | |||
} | |||
} | |||
@@ -366,10 +366,10 @@ void AudioDataConverters::convertFloat32LEToFloat (const void* source, float* de | |||
for (int i = 0; i < numSamples; ++i) | |||
{ | |||
dest[i] = *reinterpret_cast<const float*> (s); | |||
dest[i] = *unalignedPointerCast<const float*> (s); | |||
#if JUCE_BIG_ENDIAN | |||
auto d = reinterpret_cast<uint32*> (dest + i); | |||
auto d = unalignedPointerCast<uint32*> (dest + i); | |||
*d = ByteOrder::swap (*d); | |||
#endif | |||
@@ -383,10 +383,10 @@ void AudioDataConverters::convertFloat32BEToFloat (const void* source, float* de | |||
for (int i = 0; i < numSamples; ++i) | |||
{ | |||
dest[i] = *reinterpret_cast<const float*> (s); | |||
dest[i] = *unalignedPointerCast<const float*> (s); | |||
#if JUCE_LITTLE_ENDIAN | |||
auto d = reinterpret_cast<uint32*> (dest + i); | |||
auto d = unalignedPointerCast<uint32*> (dest + i); | |||
*d = ByteOrder::swap (*d); | |||
#endif | |||
@@ -404,8 +404,8 @@ public: | |||
auto numSamplesToCopy = (size_t) jmin (newNumSamples, size); | |||
auto newChannels = reinterpret_cast<Type**> (newData.get()); | |||
auto newChan = reinterpret_cast<Type*> (newData + channelListSize); | |||
auto newChannels = unalignedPointerCast<Type**> (newData.get()); | |||
auto newChan = unalignedPointerCast<Type*> (newData + channelListSize); | |||
for (int j = 0; j < newNumChannels; ++j) | |||
{ | |||
@@ -437,10 +437,10 @@ public: | |||
{ | |||
allocatedBytes = newTotalBytes; | |||
allocatedData.allocate (newTotalBytes, clearExtraSpace || isClear); | |||
channels = reinterpret_cast<Type**> (allocatedData.get()); | |||
channels = unalignedPointerCast<Type**> (allocatedData.get()); | |||
} | |||
auto* chan = reinterpret_cast<Type*> (allocatedData + channelListSize); | |||
auto* chan = unalignedPointerCast<Type*> (allocatedData + channelListSize); | |||
for (int i = 0; i < newNumChannels; ++i) | |||
{ | |||
@@ -1137,8 +1137,8 @@ private: | |||
allocatedBytes = (size_t) numChannels * (size_t) size * sizeof (Type) + channelListSize + 32; | |||
allocatedData.malloc (allocatedBytes); | |||
channels = reinterpret_cast<Type**> (allocatedData.get()); | |||
auto chan = reinterpret_cast<Type*> (allocatedData + channelListSize); | |||
channels = unalignedPointerCast<Type**> (allocatedData.get()); | |||
auto chan = unalignedPointerCast<Type*> (allocatedData + channelListSize); | |||
for (int i = 0; i < numChannels; ++i) | |||
{ | |||
@@ -1162,7 +1162,7 @@ private: | |||
else | |||
{ | |||
allocatedData.malloc (numChannels + 1, sizeof (Type*)); | |||
channels = reinterpret_cast<Type**> (allocatedData.get()); | |||
channels = unalignedPointerCast<Type**> (allocatedData.get()); | |||
} | |||
for (int i = 0; i < numChannels; ++i) | |||
@@ -48,7 +48,8 @@ namespace OggVorbisNamespace | |||
"-Wswitch-default", | |||
"-Wredundant-decls", | |||
"-Wmisleading-indentation", | |||
"-Wmissing-prototypes") | |||
"-Wmissing-prototypes", | |||
"-Wcast-align") | |||
#include "oggvorbis/vorbisenc.h" | |||
#include "oggvorbis/codec.h" | |||
@@ -56,7 +56,8 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wnon-virtual-dtor", | |||
"-Wpedantic", | |||
"-Wextra", | |||
"-Wclass-memaccess", | |||
"-Wmissing-prototypes") | |||
"-Wmissing-prototypes", | |||
"-Wtype-limits") | |||
#undef DEVELOPMENT | |||
#define DEVELOPMENT 0 // This avoids a Clang warning in Steinberg code about unused values | |||
@@ -257,8 +257,8 @@ public: | |||
} | |||
private: | |||
static const String* getString (const ValueUnion& data) noexcept { return reinterpret_cast<const String*> (data.stringValue); } | |||
static String* getString (ValueUnion& data) noexcept { return reinterpret_cast<String*> (data.stringValue); } | |||
static const String* getString (const ValueUnion& data) noexcept { return unalignedPointerCast<const String*> (data.stringValue); } | |||
static String* getString (ValueUnion& data) noexcept { return unalignedPointerCast<String*> (data.stringValue); } | |||
}; | |||
//============================================================================== | |||
@@ -39,13 +39,6 @@ inline void zerostruct (Type& structure) noexcept { memset ((v | |||
template <typename Type> | |||
inline void deleteAndZero (Type& pointer) { delete pointer; pointer = nullptr; } | |||
/** A handy function which adds a number of bytes to any type of pointer and returns the result. | |||
This can be useful to avoid casting pointers to a char* and back when you want to move them by | |||
a specific number of bytes, | |||
*/ | |||
template <typename Type, typename IntegerType> | |||
inline Type* addBytesToPointer (Type* basePointer, IntegerType bytes) noexcept { return reinterpret_cast<Type*> (const_cast<char*> (reinterpret_cast<const char*> (basePointer)) + bytes); } | |||
/** A handy function to round up a pointer to the nearest multiple of a given number of bytes. | |||
alignmentBytes must be a power of two. */ | |||
template <typename Type, typename IntegerType> | |||
@@ -83,6 +76,53 @@ inline void writeUnaligned (void* dstPtr, Type value) noexcept | |||
memcpy (dstPtr, &value, sizeof (Type)); | |||
} | |||
//============================================================================== | |||
/** Casts a pointer to another type via `void*`, which suppresses the cast-align | |||
warning which sometimes arises when casting pointers to types with different | |||
alignment. | |||
You should only use this when you know for a fact that the input pointer points | |||
to a region that has suitable alignment for `Type`, e.g. regions returned from | |||
malloc/calloc that should be suitable for any non-over-aligned type. | |||
*/ | |||
template <typename Type, typename std::enable_if<std::is_pointer<Type>::value, int>::type = 0> | |||
inline Type unalignedPointerCast (void* ptr) noexcept | |||
{ | |||
return reinterpret_cast<Type> (ptr); | |||
} | |||
/** Casts a pointer to another type via `void*`, which suppresses the cast-align | |||
warning which sometimes arises when casting pointers to types with different | |||
alignment. | |||
You should only use this when you know for a fact that the input pointer points | |||
to a region that has suitable alignment for `Type`, e.g. regions returned from | |||
malloc/calloc that should be suitable for any non-over-aligned type. | |||
*/ | |||
template <typename Type, typename std::enable_if<std::is_pointer<Type>::value, int>::type = 0> | |||
inline Type unalignedPointerCast (const void* ptr) noexcept | |||
{ | |||
return reinterpret_cast<Type> (ptr); | |||
} | |||
/** A handy function which adds a number of bytes to any type of pointer and returns the result. | |||
This can be useful to avoid casting pointers to a char* and back when you want to move them by | |||
a specific number of bytes, | |||
*/ | |||
template <typename Type, typename IntegerType> | |||
inline Type* addBytesToPointer (Type* basePointer, IntegerType bytes) noexcept | |||
{ | |||
return unalignedPointerCast<Type*> (reinterpret_cast<char*> (basePointer) + bytes); | |||
} | |||
/** A handy function which adds a number of bytes to any type of pointer and returns the result. | |||
This can be useful to avoid casting pointers to a char* and back when you want to move them by | |||
a specific number of bytes, | |||
*/ | |||
template <typename Type, typename IntegerType> | |||
inline const Type* addBytesToPointer (const Type* basePointer, IntegerType bytes) noexcept | |||
{ | |||
return unalignedPointerCast<const Type*> (reinterpret_cast<const char*> (basePointer) + bytes); | |||
} | |||
//============================================================================== | |||
#if JUCE_MAC || JUCE_IOS || DOXYGEN | |||
@@ -71,8 +71,8 @@ namespace | |||
{ | |||
if (ifa->ifa_addr->sa_family == AF_INET) | |||
{ | |||
auto interfaceAddressInfo = reinterpret_cast<sockaddr_in*> (ifa->ifa_addr); | |||
auto broadcastAddressInfo = reinterpret_cast<sockaddr_in*> (ifa->ifa_dstaddr); | |||
auto interfaceAddressInfo = unalignedPointerCast<sockaddr_in*> (ifa->ifa_addr); | |||
auto broadcastAddressInfo = unalignedPointerCast<sockaddr_in*> (ifa->ifa_dstaddr); | |||
if (interfaceAddressInfo->sin_addr.s_addr != INADDR_NONE) | |||
{ | |||
@@ -83,8 +83,8 @@ namespace | |||
} | |||
else if (ifa->ifa_addr->sa_family == AF_INET6) | |||
{ | |||
interfaceInfo.interfaceAddress = makeAddress (reinterpret_cast<sockaddr_in6*> (ifa->ifa_addr)); | |||
interfaceInfo.broadcastAddress = makeAddress (reinterpret_cast<sockaddr_in6*> (ifa->ifa_dstaddr)); | |||
interfaceInfo.interfaceAddress = makeAddress (unalignedPointerCast<sockaddr_in6*> (ifa->ifa_addr)); | |||
interfaceInfo.broadcastAddress = makeAddress (unalignedPointerCast<sockaddr_in6*> (ifa->ifa_dstaddr)); | |||
return true; | |||
} | |||
} | |||
@@ -68,7 +68,7 @@ public: | |||
static CharPointerType createUninitialisedBytes (size_t numBytes) | |||
{ | |||
numBytes = (numBytes + 3) & ~(size_t) 3; | |||
auto s = reinterpret_cast<StringHolder*> (new char [sizeof (StringHolder) - sizeof (CharType) + numBytes]); | |||
auto s = unalignedPointerCast<StringHolder*> (new char [sizeof (StringHolder) - sizeof (CharType) + numBytes]); | |||
s->refCount.value = 0; | |||
s->allocatedNumBytes = numBytes; | |||
return CharPointerType (s->text); | |||
@@ -210,7 +210,7 @@ private: | |||
static StringHolder* bufferFromText (const CharPointerType text) noexcept | |||
{ | |||
// (Can't use offsetof() here because of warnings about this not being a POD) | |||
return reinterpret_cast<StringHolder*> (reinterpret_cast<char*> (text.getAddress()) | |||
return unalignedPointerCast<StringHolder*> (reinterpret_cast<char*> (text.getAddress()) | |||
- (reinterpret_cast<size_t> (reinterpret_cast<StringHolder*> (128)->text) - 128)); | |||
} | |||
@@ -1991,7 +1991,7 @@ String String::createStringFromData (const void* const unknownData, int size) | |||
StringCreationHelper builder ((size_t) numChars); | |||
auto src = reinterpret_cast<const uint16*> (data + 2); | |||
auto src = unalignedPointerCast<const uint16*> (data + 2); | |||
if (CharPointer_UTF16::isByteOrderMarkBigEndian (data)) | |||
{ | |||
@@ -2061,19 +2061,19 @@ struct StringEncodingConverter | |||
template <> | |||
struct StringEncodingConverter<CharPointer_UTF8, CharPointer_UTF8> | |||
{ | |||
static CharPointer_UTF8 convert (const String& source) noexcept { return CharPointer_UTF8 (reinterpret_cast<CharPointer_UTF8::CharType*> (source.getCharPointer().getAddress())); } | |||
static CharPointer_UTF8 convert (const String& source) noexcept { return CharPointer_UTF8 (unalignedPointerCast<CharPointer_UTF8::CharType*> (source.getCharPointer().getAddress())); } | |||
}; | |||
template <> | |||
struct StringEncodingConverter<CharPointer_UTF16, CharPointer_UTF16> | |||
{ | |||
static CharPointer_UTF16 convert (const String& source) noexcept { return CharPointer_UTF16 (reinterpret_cast<CharPointer_UTF16::CharType*> (source.getCharPointer().getAddress())); } | |||
static CharPointer_UTF16 convert (const String& source) noexcept { return CharPointer_UTF16 (unalignedPointerCast<CharPointer_UTF16::CharType*> (source.getCharPointer().getAddress())); } | |||
}; | |||
template <> | |||
struct StringEncodingConverter<CharPointer_UTF32, CharPointer_UTF32> | |||
{ | |||
static CharPointer_UTF32 convert (const String& source) noexcept { return CharPointer_UTF32 (reinterpret_cast<CharPointer_UTF32::CharType*> (source.getCharPointer().getAddress())); } | |||
static CharPointer_UTF32 convert (const String& source) noexcept { return CharPointer_UTF32 (unalignedPointerCast<CharPointer_UTF32::CharType*> (source.getCharPointer().getAddress())); } | |||
}; | |||
CharPointer_UTF8 String::toUTF8() const { return StringEncodingConverter<CharPointerType, CharPointer_UTF8 >::convert (*this); } | |||
@@ -124,10 +124,10 @@ public: | |||
heapBlockToUseForAllocation.malloc (channelListBytes + extraBytes + channelSize * numberOfChannels); | |||
auto* chanArray = reinterpret_cast<SampleType**> (heapBlockToUseForAllocation.getData()); | |||
auto* chanArray = unalignedPointerCast<SampleType**> (heapBlockToUseForAllocation.getData()); | |||
channels = chanArray; | |||
auto* data = reinterpret_cast<SampleType*> (addBytesToPointer (chanArray, channelListBytes)); | |||
auto* data = unalignedPointerCast<SampleType*> (addBytesToPointer (chanArray, channelListBytes)); | |||
data = snapPointerToAlignment (data, alignmentInBytes); | |||
for (ChannelCountType i = 0; i < numChannels; ++i) | |||
@@ -140,7 +140,7 @@ struct FFTFallback : public FFT::Instance | |||
else | |||
{ | |||
HeapBlock<char> heapSpace (scratchSize); | |||
performRealOnlyForwardTransform (reinterpret_cast<Complex<float>*> (heapSpace.getData()), d); | |||
performRealOnlyForwardTransform (unalignedPointerCast<Complex<float>*> (heapSpace.getData()), d); | |||
} | |||
} | |||
@@ -158,7 +158,7 @@ struct FFTFallback : public FFT::Instance | |||
else | |||
{ | |||
HeapBlock<char> heapSpace (scratchSize); | |||
performRealOnlyInverseTransform (reinterpret_cast<Complex<float>*> (heapSpace.getData()), d); | |||
performRealOnlyInverseTransform (unalignedPointerCast<Complex<float>*> (heapSpace.getData()), d); | |||
} | |||
} | |||
@@ -1165,7 +1165,7 @@ namespace ClipboardHelpers | |||
numDataItems = 2; | |||
propertyFormat = 32; // atoms are 32-bit | |||
data.calloc (numDataItems * 4); | |||
Atom* atoms = reinterpret_cast<Atom*> (data.getData()); | |||
Atom* atoms = unalignedPointerCast<Atom*> (data.getData()); | |||
atoms[0] = XWindowSystem::getInstance()->getAtoms().utf8String; | |||
atoms[1] = XA_STRING; | |||
@@ -1224,7 +1224,7 @@ ComponentPeer* getPeerFor (::Window windowH) | |||
X11Symbols::getInstance()->xFindContext (display, (XID) windowH, windowHandleXContext, &peer); | |||
} | |||
return reinterpret_cast<ComponentPeer*> (peer); | |||
return unalignedPointerCast<ComponentPeer*> (peer); | |||
} | |||
//============================================================================== | |||
@@ -2998,7 +2998,7 @@ void XWindowSystem::handleKeyPressEvent (LinuxComponentPeer<::Window>* peer, XKe | |||
if (sym >= XK_F1 && sym <= XK_F35) | |||
{ | |||
keyPressed = true; | |||
keyCode = (sym & 0xff) | Keys::extendedKeyModifier; | |||
keyCode = static_cast<int> ((sym & 0xff) | Keys::extendedKeyModifier); | |||
} | |||
break; | |||
} | |||