| @@ -880,7 +880,7 @@ const char* getNamedResource (const char* resourceNameUTF8, int& numBytes) throw | |||||
| unsigned int hash = 0; | unsigned int hash = 0; | ||||
| if (resourceNameUTF8 != 0) | if (resourceNameUTF8 != 0) | ||||
| while (*resourceNameUTF8 != 0) | while (*resourceNameUTF8 != 0) | ||||
| hash = 31 * hash + *resourceNameUTF8++; | |||||
| hash = 31 * hash + (unsigned int) *resourceNameUTF8++; | |||||
| switch (hash) | switch (hash) | ||||
| { | { | ||||
| @@ -343,7 +343,7 @@ namespace CodeHelpers | |||||
| const char* t = s.toUTF8(); | const char* t = s.toUTF8(); | ||||
| unsigned int hash = 0; | unsigned int hash = 0; | ||||
| while (*t != 0) | while (*t != 0) | ||||
| hash = hashMultiplier * hash + *t++; | |||||
| hash = hashMultiplier * hash + (unsigned int) *t++; | |||||
| return hash; | return hash; | ||||
| } | } | ||||
| @@ -387,7 +387,7 @@ namespace CodeHelpers | |||||
| out << indent << "unsigned int hash = 0;" << newLine | out << indent << "unsigned int hash = 0;" << newLine | ||||
| << indent << "if (" << utf8PointerVariable << " != 0)" << newLine | << indent << "if (" << utf8PointerVariable << " != 0)" << newLine | ||||
| << indent << " while (*" << utf8PointerVariable << " != 0)" << newLine | << indent << " while (*" << utf8PointerVariable << " != 0)" << newLine | ||||
| << indent << " hash = " << hashMultiplier << " * hash + *" << utf8PointerVariable << "++;" << newLine | |||||
| << indent << " hash = " << hashMultiplier << " * hash + (unsigned int) *" << utf8PointerVariable << "++;" << newLine | |||||
| << newLine | << newLine | ||||
| << indent << "switch (hash)" << newLine | << indent << "switch (hash)" << newLine | ||||
| << indent << "{" << newLine; | << indent << "{" << newLine; | ||||
| @@ -2147,7 +2147,7 @@ const char* getNamedResource (const char* resourceNameUTF8, int& numBytes) throw | |||||
| unsigned int hash = 0; | unsigned int hash = 0; | ||||
| if (resourceNameUTF8 != 0) | if (resourceNameUTF8 != 0) | ||||
| while (*resourceNameUTF8 != 0) | while (*resourceNameUTF8 != 0) | ||||
| hash = 31 * hash + *resourceNameUTF8++; | |||||
| hash = 31 * hash + (unsigned int) *resourceNameUTF8++; | |||||
| switch (hash) | switch (hash) | ||||
| { | { | ||||
| @@ -152,7 +152,7 @@ public: | |||||
| // We need to clear the output buffers, in case they're full of junk.. | // We need to clear the output buffers, in case they're full of junk.. | ||||
| for (int i = 0; i < numOutputChannels; ++i) | for (int i = 0; i < numOutputChannels; ++i) | ||||
| if (outputChannelData[i] != 0) | if (outputChannelData[i] != 0) | ||||
| zeromem (outputChannelData[i], sizeof (float) * numSamples); | |||||
| zeromem (outputChannelData[i], sizeof (float) * (size_t) numSamples); | |||||
| } | } | ||||
| } | } | ||||
| @@ -105,7 +105,7 @@ void LiveAudioInputDisplayComp::audioDeviceIOCallback (const float** inputChanne | |||||
| // We need to clear the output buffers, in case they're full of junk.. | // We need to clear the output buffers, in case they're full of junk.. | ||||
| for (int i = 0; i < numOutputChannels; ++i) | for (int i = 0; i < numOutputChannels; ++i) | ||||
| if (outputChannelData[i] != 0) | if (outputChannelData[i] != 0) | ||||
| zeromem (outputChannelData[i], sizeof (float) * numSamples); | |||||
| zeromem (outputChannelData[i], sizeof (float) * (size_t) numSamples); | |||||
| } | } | ||||
| //[/MiscUserDefs] | //[/MiscUserDefs] | ||||
| @@ -112,7 +112,7 @@ public: | |||||
| // The send button has been pressed, so write out the contents of the | // The send button has been pressed, so write out the contents of the | ||||
| // text box to the socket or pipe, depending on which is active. | // text box to the socket or pipe, depending on which is active. | ||||
| const String text (sendText.getText()); | const String text (sendText.getText()); | ||||
| MemoryBlock messageData (text.toUTF8(), text.getNumBytesAsUTF8()); | |||||
| MemoryBlock messageData (text.toUTF8(), (size_t) text.getNumBytesAsUTF8()); | |||||
| for (int i = activeConnections.size(); --i >= 0;) | for (int i = activeConnections.size(); --i >= 0;) | ||||
| { | { | ||||
| @@ -514,7 +514,7 @@ const char* getNamedResource (const char* resourceNameUTF8, int& numBytes) throw | |||||
| unsigned int hash = 0; | unsigned int hash = 0; | ||||
| if (resourceNameUTF8 != 0) | if (resourceNameUTF8 != 0) | ||||
| while (*resourceNameUTF8 != 0) | while (*resourceNameUTF8 != 0) | ||||
| hash = 31 * hash + *resourceNameUTF8++; | |||||
| hash = 31 * hash + (unsigned int) *resourceNameUTF8++; | |||||
| switch (hash) | switch (hash) | ||||
| { | { | ||||
| @@ -370,7 +370,7 @@ void MidiOutput::sendMessageNow (const MidiMessage& message) | |||||
| const int maxPacketSize = 256; | const int maxPacketSize = 256; | ||||
| int pos = 0, bytesLeft = (int) dataSize; | int pos = 0, bytesLeft = (int) dataSize; | ||||
| const int numPackets = (bytesLeft + maxPacketSize - 1) / maxPacketSize; | const int numPackets = (bytesLeft + maxPacketSize - 1) / maxPacketSize; | ||||
| allocatedPackets.malloc ((size_t) (32 * numPackets + dataSize), 1); | |||||
| allocatedPackets.malloc ((size_t) (32 * (size_t) numPackets + dataSize), 1); | |||||
| packetToSend = allocatedPackets; | packetToSend = allocatedPackets; | ||||
| packetToSend->numPackets = (UInt32) numPackets; | packetToSend->numPackets = (UInt32) numPackets; | ||||
| @@ -37,11 +37,11 @@ namespace OggVorbisNamespace | |||||
| #pragma warning (disable: 4267 4127 4244 4996 4100 4701 4702 4013 4133 4206 4305 4189 4706 4995 4365) | #pragma warning (disable: 4267 4127 4244 4996 4100 4701 4702 4013 4133 4206 4305 4189 4706 4995 4365) | ||||
| #endif | #endif | ||||
| #if JUCE_CLANG | |||||
| #pragma clang diagnostic push | |||||
| #pragma clang diagnostic ignored "-Wconversion" | |||||
| #pragma clang diagnostic ignored "-Wshadow" | |||||
| #endif | |||||
| #if JUCE_CLANG | |||||
| #pragma clang diagnostic push | |||||
| #pragma clang diagnostic ignored "-Wconversion" | |||||
| #pragma clang diagnostic ignored "-Wshadow" | |||||
| #endif | |||||
| #include "oggvorbis/vorbisenc.h" | #include "oggvorbis/vorbisenc.h" | ||||
| #include "oggvorbis/codec.h" | #include "oggvorbis/codec.h" | ||||
| @@ -149,7 +149,7 @@ public: | |||||
| if (destSamples[i] != nullptr) | if (destSamples[i] != nullptr) | ||||
| memcpy (destSamples[i] + startOffsetInDestBuffer, | memcpy (destSamples[i] + startOffsetInDestBuffer, | ||||
| reservoir.getSampleData (i, (int) (startSampleInFile - reservoirStart)), | reservoir.getSampleData (i, (int) (startSampleInFile - reservoirStart)), | ||||
| sizeof (float) * numToUse); | |||||
| sizeof (float) * (size_t) numToUse); | |||||
| startSampleInFile += numToUse; | startSampleInFile += numToUse; | ||||
| numSamples -= numToUse; | numSamples -= numToUse; | ||||
| @@ -188,7 +188,7 @@ public: | |||||
| { | { | ||||
| memcpy (reservoir.getSampleData (i, offset), | memcpy (reservoir.getSampleData (i, offset), | ||||
| dataIn[i], | dataIn[i], | ||||
| sizeof (float) * samps); | |||||
| sizeof (float) * (size_t) samps); | |||||
| } | } | ||||
| numToRead -= samps; | numToRead -= samps; | ||||
| @@ -204,7 +204,7 @@ public: | |||||
| { | { | ||||
| for (int i = numDestChannels; --i >= 0;) | for (int i = numDestChannels; --i >= 0;) | ||||
| if (destSamples[i] != nullptr) | if (destSamples[i] != nullptr) | ||||
| zeromem (destSamples[i] + startOffsetInDestBuffer, sizeof (int) * numSamples); | |||||
| zeromem (destSamples[i] + startOffsetInDestBuffer, sizeof (int) * (size_t) numSamples); | |||||
| } | } | ||||
| return true; | return true; | ||||
| @@ -213,7 +213,7 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| static size_t oggReadCallback (void* ptr, size_t size, size_t nmemb, void* datasource) | static size_t oggReadCallback (void* ptr, size_t size, size_t nmemb, void* datasource) | ||||
| { | { | ||||
| return (size_t) (static_cast <InputStream*> (datasource)->read (ptr, (int) (size * nmemb)) / size); | |||||
| return (size_t) (static_cast <InputStream*> (datasource)->read (ptr, (int) (size * nmemb))) / size; | |||||
| } | } | ||||
| static int oggSeekCallback (void* datasource, OggVorbisNamespace::ogg_int64_t offset, int whence) | static int oggSeekCallback (void* datasource, OggVorbisNamespace::ogg_int64_t offset, int whence) | ||||
| @@ -199,7 +199,7 @@ void AudioFormatReader::readMaxLevels (int64 startSampleInFile, int64 numSamples | |||||
| } | } | ||||
| const int bufferSize = (int) jmin (numSamples, (int64) 4096); | const int bufferSize = (int) jmin (numSamples, (int64) 4096); | ||||
| AudioSampleBuffer tempSampleBuffer (numChannels, bufferSize); | |||||
| AudioSampleBuffer tempSampleBuffer ((int) numChannels, bufferSize); | |||||
| float** const floatBuffer = tempSampleBuffer.getArrayOfChannels(); | float** const floatBuffer = tempSampleBuffer.getArrayOfChannels(); | ||||
| int* const* intBuffer = reinterpret_cast<int* const*> (floatBuffer); | int* const* intBuffer = reinterpret_cast<int* const*> (floatBuffer); | ||||
| @@ -219,7 +219,7 @@ void AudioFormatReader::readMaxLevels (int64 startSampleInFile, int64 numSamples | |||||
| numSamples -= numToDo; | numSamples -= numToDo; | ||||
| startSampleInFile += numToDo; | startSampleInFile += numToDo; | ||||
| getStereoMinAndMax (floatBuffer, numChannels, numToDo, lmin, lmax, rmin, rmax); | |||||
| getStereoMinAndMax (floatBuffer, (int) numChannels, numToDo, lmin, lmax, rmin, rmax); | |||||
| } | } | ||||
| lowestLeft = lmin; | lowestLeft = lmin; | ||||
| @@ -242,7 +242,7 @@ void AudioFormatReader::readMaxLevels (int64 startSampleInFile, int64 numSamples | |||||
| numSamples -= numToDo; | numSamples -= numToDo; | ||||
| startSampleInFile += numToDo; | startSampleInFile += numToDo; | ||||
| getStereoMinAndMax (intBuffer, numChannels, numToDo, lmin, lmax, rmin, rmax); | |||||
| getStereoMinAndMax (intBuffer, (int) numChannels, numToDo, lmin, lmax, rmin, rmax); | |||||
| } | } | ||||
| lowestLeft = lmin / (float) std::numeric_limits<int>::max(); | lowestLeft = lmin / (float) std::numeric_limits<int>::max(); | ||||
| @@ -317,7 +317,7 @@ public: | |||||
| if (isPositiveAndBelow (indexToInsertAt, numUsed)) | if (isPositiveAndBelow (indexToInsertAt, numUsed)) | ||||
| { | { | ||||
| insertPos += indexToInsertAt; | insertPos += indexToInsertAt; | ||||
| const int numberToMove = numUsed - indexToInsertAt; | |||||
| const size_t numberToMove = (size_t) (numUsed - indexToInsertAt); | |||||
| memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ObjectClass*)); | memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ObjectClass*)); | ||||
| } | } | ||||
| else | else | ||||
| @@ -46,8 +46,8 @@ inline void deleteAndZero (Type& pointer) { delete poi | |||||
| This can be useful to avoid casting pointers to a char* and back when you want to move them by | 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, | a specific number of bytes, | ||||
| */ | */ | ||||
| template <typename Type> | |||||
| inline Type* addBytesToPointer (Type* pointer, int bytes) noexcept { return (Type*) (((char*) pointer) + bytes); } | |||||
| template <typename Type, typename IntegerType> | |||||
| inline Type* addBytesToPointer (Type* pointer, IntegerType bytes) noexcept { return (Type*) (((char*) pointer) + bytes); } | |||||
| /** A handy function which returns the difference between any two pointers, in bytes. | /** A handy function which returns the difference between any two pointers, in bytes. | ||||
| The address of the second pointer is subtracted from the first, and the difference in bytes is returned. | The address of the second pointer is subtracted from the first, and the difference in bytes is returned. | ||||
| @@ -233,7 +233,7 @@ File File::getSpecialLocation (const SpecialLocationType type) | |||||
| buffer.calloc (size + 8); | buffer.calloc (size + 8); | ||||
| _NSGetExecutablePath (buffer.getData(), &size); | _NSGetExecutablePath (buffer.getData(), &size); | ||||
| return String::fromUTF8 (buffer, size); | |||||
| return String::fromUTF8 (buffer, (int) size); | |||||
| } | } | ||||
| default: | default: | ||||
| @@ -160,8 +160,8 @@ public: | |||||
| if (available > 0) | if (available > 0) | ||||
| { | { | ||||
| const ScopedLock sl (dataLock); | const ScopedLock sl (dataLock); | ||||
| [data getBytes: dest length: available]; | |||||
| [data replaceBytesInRange: NSMakeRange (0, available) withBytes: nil length: 0]; | |||||
| [data getBytes: dest length: (NSUInteger) available]; | |||||
| [data replaceBytesInRange: NSMakeRange (0, (NSUInteger) available) withBytes: nil length: 0]; | |||||
| numDone += available; | numDone += available; | ||||
| numBytes -= available; | numBytes -= available; | ||||
| @@ -29,7 +29,7 @@ String String::fromCFString (CFStringRef cfString) | |||||
| return String::empty; | return String::empty; | ||||
| CFRange range = { 0, CFStringGetLength (cfString) }; | CFRange range = { 0, CFStringGetLength (cfString) }; | ||||
| HeapBlock <UniChar> u (range.length + 1); | |||||
| HeapBlock <UniChar> u ((size_t) range.length + 1); | |||||
| CFStringGetCharacters (cfString, range, u); | CFStringGetCharacters (cfString, range, u); | ||||
| u[range.length] = 0; | u[range.length] = 0; | ||||
| @@ -39,7 +39,7 @@ String String::fromCFString (CFStringRef cfString) | |||||
| CFStringRef String::toCFString() const | CFStringRef String::toCFString() const | ||||
| { | { | ||||
| CharPointer_UTF16 utf16 (toUTF16()); | CharPointer_UTF16 utf16 (toUTF16()); | ||||
| return CFStringCreateWithCharacters (kCFAllocatorDefault, (const UniChar*) utf16.getAddress(), utf16.length()); | |||||
| return CFStringCreateWithCharacters (kCFAllocatorDefault, (const UniChar*) utf16.getAddress(), (CFIndex) utf16.length()); | |||||
| } | } | ||||
| String String::convertToPrecomposedUnicode() const | String String::convertToPrecomposedUnicode() const | ||||
| @@ -65,7 +65,7 @@ String String::convertToPrecomposedUnicode() const | |||||
| if (CreateUnicodeToTextInfo (&map, &conversionInfo) == noErr) | if (CreateUnicodeToTextInfo (&map, &conversionInfo) == noErr) | ||||
| { | { | ||||
| const int bytesNeeded = CharPointer_UTF16::getBytesRequiredFor (getCharPointer()); | |||||
| const size_t bytesNeeded = CharPointer_UTF16::getBytesRequiredFor (getCharPointer()); | |||||
| HeapBlock <char> tempOut; | HeapBlock <char> tempOut; | ||||
| tempOut.calloc (bytesNeeded + 4); | tempOut.calloc (bytesNeeded + 4); | ||||
| @@ -68,10 +68,10 @@ SystemStats::CPUFlags::CPUFlags() | |||||
| uint32 familyModel = 0, extFeatures = 0, features = 0, dummy = 0; | uint32 familyModel = 0, extFeatures = 0, features = 0, dummy = 0; | ||||
| SystemStatsHelpers::doCPUID (familyModel, extFeatures, dummy, features, 1); | SystemStatsHelpers::doCPUID (familyModel, extFeatures, dummy, features, 1); | ||||
| hasMMX = (features & (1 << 23)) != 0; | |||||
| hasSSE = (features & (1 << 25)) != 0; | |||||
| hasSSE2 = (features & (1 << 26)) != 0; | |||||
| has3DNow = (extFeatures & (1 << 31)) != 0; | |||||
| hasMMX = (features & (1u << 23)) != 0; | |||||
| hasSSE = (features & (1u << 25)) != 0; | |||||
| hasSSE2 = (features & (1u << 26)) != 0; | |||||
| has3DNow = (extFeatures & (1u << 31)) != 0; | |||||
| #else | #else | ||||
| hasMMX = false; | hasMMX = false; | ||||
| hasSSE = false; | hasSSE = false; | ||||
| @@ -235,10 +235,10 @@ public: | |||||
| else | else | ||||
| { | { | ||||
| numerator = timebase.numer; | numerator = timebase.numer; | ||||
| denominator = timebase.denom * (int64) 1000000; | |||||
| denominator = timebase.denom * (uint64) 1000000; | |||||
| } | } | ||||
| highResTimerFrequency = (timebase.denom * (int64) 1000000000) / timebase.numer; | |||||
| highResTimerFrequency = (timebase.denom * (uint64) 1000000000) / timebase.numer; | |||||
| highResTimerToMillisecRatio = numerator / (double) denominator; | highResTimerToMillisecRatio = numerator / (double) denominator; | ||||
| } | } | ||||
| @@ -255,7 +255,7 @@ public: | |||||
| int64 highResTimerFrequency; | int64 highResTimerFrequency; | ||||
| private: | private: | ||||
| int64 numerator, denominator; | |||||
| uint64 numerator, denominator; | |||||
| double highResTimerToMillisecRatio; | double highResTimerToMillisecRatio; | ||||
| }; | }; | ||||
| @@ -97,7 +97,7 @@ public: | |||||
| while (bytesRead < maxBytesToRead) | while (bytesRead < maxBytesToRead) | ||||
| { | { | ||||
| const int bytesThisTime = maxBytesToRead - bytesRead; | const int bytesThisTime = maxBytesToRead - bytesRead; | ||||
| const int numRead = (int) ::read (pipeIn, destBuffer, bytesThisTime); | |||||
| const int numRead = (int) ::read (pipeIn, destBuffer, (size_t) bytesThisTime); | |||||
| if (numRead <= 0) | if (numRead <= 0) | ||||
| { | { | ||||
| @@ -140,7 +140,7 @@ public: | |||||
| while (bytesWritten < numBytesToWrite && ! hasExpired (timeoutEnd)) | while (bytesWritten < numBytesToWrite && ! hasExpired (timeoutEnd)) | ||||
| { | { | ||||
| const int bytesThisTime = numBytesToWrite - bytesWritten; | const int bytesThisTime = numBytesToWrite - bytesWritten; | ||||
| const int numWritten = (int) ::write (pipeOut, sourceBuffer, bytesThisTime); | |||||
| const int numWritten = (int) ::write (pipeOut, sourceBuffer, (size_t) bytesThisTime); | |||||
| if (numWritten <= 0) | if (numWritten <= 0) | ||||
| { | { | ||||
| @@ -172,7 +172,7 @@ private: | |||||
| static uint32 getTimeoutEnd (const int timeOutMilliseconds) | static uint32 getTimeoutEnd (const int timeOutMilliseconds) | ||||
| { | { | ||||
| return timeOutMilliseconds >= 0 ? Time::getMillisecondCounter() + timeOutMilliseconds : 0; | |||||
| return timeOutMilliseconds >= 0 ? Time::getMillisecondCounter() + (uint32) timeOutMilliseconds : 0; | |||||
| } | } | ||||
| static bool hasExpired (const uint32 timeoutEnd) | static bool hasExpired (const uint32 timeoutEnd) | ||||
| @@ -205,7 +205,7 @@ File File::getCurrentWorkingDirectory() | |||||
| char localBuffer [1024]; | char localBuffer [1024]; | ||||
| char* cwd = getcwd (localBuffer, sizeof (localBuffer) - 1); | char* cwd = getcwd (localBuffer, sizeof (localBuffer) - 1); | ||||
| int bufferSize = 4096; | |||||
| size_t bufferSize = 4096; | |||||
| while (cwd == nullptr && errno == ERANGE) | while (cwd == nullptr && errno == ERANGE) | ||||
| { | { | ||||
| @@ -500,7 +500,7 @@ int FileOutputStream::writeInternal (const void* const data, const int numBytes) | |||||
| if (fileHandle != 0) | if (fileHandle != 0) | ||||
| { | { | ||||
| result = ::write (getFD (fileHandle), data, numBytes); | |||||
| result = ::write (getFD (fileHandle), data, (size_t) numBytes); | |||||
| if (result == -1) | if (result == -1) | ||||
| status = getResultForErrno(); | status = getResultForErrno(); | ||||
| @@ -1046,7 +1046,7 @@ public: | |||||
| readHandle = fdopen (pipeHandle, "r"); | readHandle = fdopen (pipeHandle, "r"); | ||||
| if (readHandle != 0) | if (readHandle != 0) | ||||
| return fread (dest, 1, numBytes, readHandle); | |||||
| return (int) fread (dest, 1, (size_t) numBytes, readHandle); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -97,7 +97,7 @@ namespace SocketHelpers | |||||
| #if JUCE_WINDOWS | #if JUCE_WINDOWS | ||||
| bytesThisTime = recv (handle, static_cast<char*> (destBuffer) + bytesRead, maxBytesToRead - bytesRead, 0); | bytesThisTime = recv (handle, static_cast<char*> (destBuffer) + bytesRead, maxBytesToRead - bytesRead, 0); | ||||
| #else | #else | ||||
| while ((bytesThisTime = (int) ::read (handle, addBytesToPointer (destBuffer, bytesRead), maxBytesToRead - bytesRead)) < 0 | |||||
| while ((bytesThisTime = (int) ::read (handle, addBytesToPointer (destBuffer, bytesRead), (size_t) (maxBytesToRead - bytesRead))) < 0 | |||||
| && errno == EINTR | && errno == EINTR | ||||
| && connected) | && connected) | ||||
| { | { | ||||
| @@ -230,7 +230,7 @@ namespace SocketHelpers | |||||
| } | } | ||||
| setSocketBlockingState (handle, false); | setSocketBlockingState (handle, false); | ||||
| const int result = ::connect (handle, info->ai_addr, (int) info->ai_addrlen); | |||||
| const int result = ::connect (handle, info->ai_addr, (socklen_t) info->ai_addrlen); | |||||
| freeaddrinfo (info); | freeaddrinfo (info); | ||||
| if (result < 0) | if (result < 0) | ||||
| @@ -301,7 +301,7 @@ int StreamingSocket::write (const void* sourceBuffer, const int numBytesToWrite) | |||||
| #else | #else | ||||
| int result; | int result; | ||||
| while ((result = (int) ::write (handle, sourceBuffer, numBytesToWrite)) < 0 | |||||
| while ((result = (int) ::write (handle, sourceBuffer, (size_t) numBytesToWrite)) < 0 | |||||
| && errno == EINTR) | && errno == EINTR) | ||||
| { | { | ||||
| } | } | ||||
| @@ -564,7 +564,7 @@ int DatagramSocket::write (const void* sourceBuffer, const int numBytesToWrite) | |||||
| jassert (serverAddress != nullptr && connected); | jassert (serverAddress != nullptr && connected); | ||||
| return connected ? (int) sendto (handle, (const char*) sourceBuffer, | return connected ? (int) sendto (handle, (const char*) sourceBuffer, | ||||
| numBytesToWrite, 0, | |||||
| (size_t) numBytesToWrite, 0, | |||||
| static_cast <const struct addrinfo*> (serverAddress)->ai_addr, | static_cast <const struct addrinfo*> (serverAddress)->ai_addr, | ||||
| static_cast <const struct addrinfo*> (serverAddress)->ai_addrlen) | static_cast <const struct addrinfo*> (serverAddress)->ai_addrlen) | ||||
| : -1; | : -1; | ||||
| @@ -69,7 +69,7 @@ int MemoryInputStream::read (void* const buffer, const int howMany) | |||||
| return 0; | return 0; | ||||
| memcpy (buffer, addBytesToPointer (data, position), (size_t) num); | memcpy (buffer, addBytesToPointer (data, position), (size_t) num); | ||||
| position += num; | |||||
| position += (unsigned int) num; | |||||
| return num; | return num; | ||||
| } | } | ||||
| @@ -70,10 +70,11 @@ void MemoryOutputStream::reset() noexcept | |||||
| void MemoryOutputStream::prepareToWrite (int numBytes) | void MemoryOutputStream::prepareToWrite (int numBytes) | ||||
| { | { | ||||
| const size_t storageNeeded = position + numBytes; | |||||
| jassert (numBytes >= 0); | |||||
| size_t storageNeeded = position + (size_t) numBytes; | |||||
| if (storageNeeded >= data.getSize()) | if (storageNeeded >= data.getSize()) | ||||
| data.ensureSize ((storageNeeded + jmin ((int) (storageNeeded / 2), 1024 * 1024) + 32) & ~31); | |||||
| data.ensureSize ((storageNeeded + jmin (storageNeeded / 2, (size_t) (1024 * 1024)) + 32) & ~31u); | |||||
| } | } | ||||
| bool MemoryOutputStream::write (const void* const buffer, int howMany) | bool MemoryOutputStream::write (const void* const buffer, int howMany) | ||||
| @@ -84,7 +85,7 @@ bool MemoryOutputStream::write (const void* const buffer, int howMany) | |||||
| { | { | ||||
| prepareToWrite (howMany); | prepareToWrite (howMany); | ||||
| memcpy (static_cast<char*> (data.getData()) + position, buffer, (size_t) howMany); | memcpy (static_cast<char*> (data.getData()) + position, buffer, (size_t) howMany); | ||||
| position += howMany; | |||||
| position += (size_t) howMany; | |||||
| size = jmax (size, position); | size = jmax (size, position); | ||||
| } | } | ||||
| @@ -97,7 +98,7 @@ void MemoryOutputStream::writeRepeatedByte (uint8 byte, int howMany) | |||||
| { | { | ||||
| prepareToWrite (howMany); | prepareToWrite (howMany); | ||||
| memset (static_cast<char*> (data.getData()) + position, byte, (size_t) howMany); | memset (static_cast<char*> (data.getData()) + position, byte, (size_t) howMany); | ||||
| position += howMany; | |||||
| position += (size_t) howMany; | |||||
| size = jmax (size, position); | size = jmax (size, position); | ||||
| } | } | ||||
| } | } | ||||
| @@ -107,7 +107,7 @@ bool CharacterFunctions::isLetterOrDigit (const juce_wchar character) noexcept | |||||
| int CharacterFunctions::getHexDigitValue (const juce_wchar digit) noexcept | int CharacterFunctions::getHexDigitValue (const juce_wchar digit) noexcept | ||||
| { | { | ||||
| unsigned int d = digit - '0'; | |||||
| unsigned int d = (unsigned int) digit - '0'; | |||||
| if (d < (unsigned int) 10) | if (d < (unsigned int) 10) | ||||
| return (int) d; | return (int) d; | ||||
| @@ -343,7 +343,7 @@ public: | |||||
| dest.writeNull(); | dest.writeNull(); | ||||
| return (int) (getAddressDifference (dest.getAddress(), startAddress) + sizeof (typename DestCharPointerType::CharType)); | |||||
| return (int) ((size_t) getAddressDifference (dest.getAddress(), startAddress) + sizeof (typename DestCharPointerType::CharType)); | |||||
| } | } | ||||
| /** Copies characters from one string to another, up to a null terminator | /** Copies characters from one string to another, up to a null terminator | ||||
| @@ -133,7 +133,7 @@ public: | |||||
| if (start.getAddress() == nullptr || start.isEmpty()) | if (start.getAddress() == nullptr || start.isEmpty()) | ||||
| return getEmpty(); | return getEmpty(); | ||||
| const size_t numBytes = end.getAddress() - start.getAddress(); | |||||
| const size_t numBytes = (size_t) (end.getAddress() - start.getAddress()); | |||||
| const CharPointerType dest (createUninitialisedBytes (numBytes + 1)); | const CharPointerType dest (createUninitialisedBytes (numBytes + 1)); | ||||
| memcpy (dest.getAddress(), start, numBytes); | memcpy (dest.getAddress(), start, numBytes); | ||||
| dest.getAddress()[numBytes] = 0; | dest.getAddress()[numBytes] = 0; | ||||
| @@ -683,7 +683,7 @@ String& String::operator+= (const int number) | |||||
| { | { | ||||
| const size_t byteOffsetOfNull = getByteOffsetOfEnd(); | const size_t byteOffsetOfNull = getByteOffsetOfEnd(); | ||||
| const size_t newBytesNeeded = sizeof (CharPointerType::CharType) + byteOffsetOfNull | const size_t newBytesNeeded = sizeof (CharPointerType::CharType) + byteOffsetOfNull | ||||
| + sizeof (CharPointerType::CharType) * numExtraChars; | |||||
| + sizeof (CharPointerType::CharType) * (size_t) numExtraChars; | |||||
| text = StringHolder::makeUniqueWithByteSize (text, newBytesNeeded); | text = StringHolder::makeUniqueWithByteSize (text, newBytesNeeded); | ||||
| @@ -1051,7 +1051,7 @@ String String::repeatedString (const String& stringToRepeat, int numberOfTimesTo | |||||
| if (numberOfTimesToRepeat <= 0) | if (numberOfTimesToRepeat <= 0) | ||||
| return empty; | return empty; | ||||
| String result (PreallocationBytes (stringToRepeat.getByteOffsetOfEnd() * numberOfTimesToRepeat)); | |||||
| String result (PreallocationBytes (stringToRepeat.getByteOffsetOfEnd() * (size_t) numberOfTimesToRepeat)); | |||||
| CharPointerType n (result.text); | CharPointerType n (result.text); | ||||
| while (--numberOfTimesToRepeat >= 0) | while (--numberOfTimesToRepeat >= 0) | ||||
| @@ -1077,7 +1077,7 @@ String String::paddedLeft (const juce_wchar padCharacter, int minimumLength) con | |||||
| return *this; | return *this; | ||||
| const size_t currentByteSize = (size_t) (((char*) end.getAddress()) - (char*) text.getAddress()); | const size_t currentByteSize = (size_t) (((char*) end.getAddress()) - (char*) text.getAddress()); | ||||
| String result (PreallocationBytes (currentByteSize + extraChars * CharPointerType::getBytesRequiredFor (padCharacter))); | |||||
| String result (PreallocationBytes (currentByteSize + (size_t) extraChars * CharPointerType::getBytesRequiredFor (padCharacter))); | |||||
| CharPointerType n (result.text); | CharPointerType n (result.text); | ||||
| while (--extraChars >= 0) | while (--extraChars >= 0) | ||||
| @@ -1104,7 +1104,7 @@ String String::paddedRight (const juce_wchar padCharacter, int minimumLength) co | |||||
| return *this; | return *this; | ||||
| const size_t currentByteSize = (size_t) (((char*) end.getAddress()) - (char*) text.getAddress()); | const size_t currentByteSize = (size_t) (((char*) end.getAddress()) - (char*) text.getAddress()); | ||||
| String result (PreallocationBytes (currentByteSize + extraChars * CharPointerType::getBytesRequiredFor (padCharacter))); | |||||
| String result (PreallocationBytes (currentByteSize + (size_t) extraChars * CharPointerType::getBytesRequiredFor (padCharacter))); | |||||
| CharPointerType n (result.text); | CharPointerType n (result.text); | ||||
| n.writeAll (text); | n.writeAll (text); | ||||
| @@ -1985,7 +1985,7 @@ struct StringEncodingConverter | |||||
| CharPointerType_Src text (source.getCharPointer()); | CharPointerType_Src text (source.getCharPointer()); | ||||
| const size_t extraBytesNeeded = CharPointerType_Dest::getBytesRequiredFor (text); | const size_t extraBytesNeeded = CharPointerType_Dest::getBytesRequiredFor (text); | ||||
| const size_t endOffset = (text.sizeInBytes() + 3) & ~3; // the new string must be word-aligned or many Windows | |||||
| const size_t endOffset = (text.sizeInBytes() + 3) & ~3u; // the new string must be word-aligned or many Windows | |||||
| // functions will fail to read it correctly! | // functions will fail to read it correctly! | ||||
| source.preallocateBytes (endOffset + extraBytesNeeded); | source.preallocateBytes (endOffset + extraBytesNeeded); | ||||
| text = source.getCharPointer(); | text = source.getCharPointer(); | ||||
| @@ -1994,8 +1994,8 @@ struct StringEncodingConverter | |||||
| const CharPointerType_Dest extraSpace (static_cast <DestChar*> (newSpace)); | const CharPointerType_Dest extraSpace (static_cast <DestChar*> (newSpace)); | ||||
| #if JUCE_DEBUG // (This just avoids spurious warnings from valgrind about the uninitialised bytes at the end of the buffer..) | #if JUCE_DEBUG // (This just avoids spurious warnings from valgrind about the uninitialised bytes at the end of the buffer..) | ||||
| const int bytesToClear = jmin ((int) extraBytesNeeded, 4); | |||||
| zeromem (addBytesToPointer (newSpace, (int) (extraBytesNeeded - bytesToClear)), (size_t) bytesToClear); | |||||
| const size_t bytesToClear = (size_t) jmin ((int) extraBytesNeeded, 4); | |||||
| zeromem (addBytesToPointer (newSpace, extraBytesNeeded - bytesToClear), bytesToClear); | |||||
| #endif | #endif | ||||
| CharPointerType_Dest (extraSpace).writeAll (text); | CharPointerType_Dest (extraSpace).writeAll (text); | ||||
| @@ -2113,7 +2113,7 @@ public: | |||||
| CharPointerType (buffer).writeAll (s.toUTF8()); | CharPointerType (buffer).writeAll (s.toUTF8()); | ||||
| test.expectEquals (String (CharPointerType (buffer)), s); | test.expectEquals (String (CharPointerType (buffer)), s); | ||||
| test.expect (CharPointerType::isValidString (buffer, strlen ((const char*) buffer))); | |||||
| test.expect (CharPointerType::isValidString (buffer, (int) strlen ((const char*) buffer))); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -328,7 +328,7 @@ String StringArray::joinIntoString (const String& separator, int start, int numb | |||||
| return strings.getReference (start); | return strings.getReference (start); | ||||
| const size_t separatorBytes = separator.getCharPointer().sizeInBytes() - sizeof (String::CharPointerType::CharType); | const size_t separatorBytes = separator.getCharPointer().sizeInBytes() - sizeof (String::CharPointerType::CharType); | ||||
| size_t bytesNeeded = separatorBytes * (last - start - 1); | |||||
| size_t bytesNeeded = separatorBytes * (size_t) (last - start - 1); | |||||
| for (int i = start; i < last; ++i) | for (int i = start; i < last; ++i) | ||||
| bytesNeeded += strings.getReference(i).getCharPointer().sizeInBytes() - sizeof (String::CharPointerType::CharType); | bytesNeeded += strings.getReference(i).getCharPointer().sizeInBytes() - sizeof (String::CharPointerType::CharType); | ||||
| @@ -42,7 +42,7 @@ struct TextDiffHelpers | |||||
| static void addInsertion (TextDiff& td, const String::CharPointerType& text, int index, int length) | static void addInsertion (TextDiff& td, const String::CharPointerType& text, int index, int length) | ||||
| { | { | ||||
| TextDiff::Change c; | TextDiff::Change c; | ||||
| c.insertedText = String (text, length); | |||||
| c.insertedText = String (text, (size_t) length); | |||||
| c.start = index; | c.start = index; | ||||
| c.length = length; | c.length = length; | ||||
| td.changes.add (c); | td.changes.add (c); | ||||
| @@ -84,7 +84,7 @@ struct TextDiffHelpers | |||||
| { | { | ||||
| jassert (indexA >= 0 && indexA <= a.length); | jassert (indexA >= 0 && indexA <= a.length); | ||||
| jassert (indexB >= 0 && indexB <= b.length); | jassert (indexB >= 0 && indexB <= b.length); | ||||
| jassert (String (a.text + indexA, len) == String (b.text + indexB, len)); | |||||
| jassert (String (a.text + indexA, (size_t) len) == String (b.text + indexB, (size_t) len)); | |||||
| if (indexA > 0 && indexB > 0) | if (indexA > 0 && indexB > 0) | ||||
| diffSkippingCommonStart (td, StringRegion (a.text, a.start, indexA), | diffSkippingCommonStart (td, StringRegion (a.text, a.start, indexA), | ||||
| @@ -112,7 +112,7 @@ struct TextDiffHelpers | |||||
| return 0; | return 0; | ||||
| HeapBlock<int> lines; | HeapBlock<int> lines; | ||||
| lines.calloc (lenB * 2 + 2); | |||||
| lines.calloc (2 + 2 * (size_t) lenB); | |||||
| int* l0 = lines; | int* l0 = lines; | ||||
| int* l1 = l0 + lenB + 1; | int* l1 = l0 + lenB + 1; | ||||
| @@ -28,7 +28,7 @@ ChildProcess::~ChildProcess() {} | |||||
| bool ChildProcess::waitForProcessToFinish (const int timeoutMs) const | bool ChildProcess::waitForProcessToFinish (const int timeoutMs) const | ||||
| { | { | ||||
| const int64 timeoutTime = Time::getMillisecondCounter() + timeoutMs; | |||||
| const uint32 timeoutTime = Time::getMillisecondCounter() + (uint32) timeoutMs; | |||||
| do | do | ||||
| { | { | ||||
| @@ -156,7 +156,7 @@ bool Thread::waitForThreadToExit (const int timeOutMilliseconds) const | |||||
| // Doh! So how exactly do you expect this thread to wait for itself to stop?? | // Doh! So how exactly do you expect this thread to wait for itself to stop?? | ||||
| jassert (getThreadId() != getCurrentThreadId() || getCurrentThreadId() == 0); | jassert (getThreadId() != getCurrentThreadId() || getCurrentThreadId() == 0); | ||||
| const uint32 timeoutEnd = Time::getMillisecondCounter() + timeOutMilliseconds; | |||||
| const uint32 timeoutEnd = Time::getMillisecondCounter() + (uint32) timeOutMilliseconds; | |||||
| while (isThreadRunning()) | while (isThreadRunning()) | ||||
| { | { | ||||
| @@ -170,7 +170,7 @@ bool ThreadPool::waitForJobToFinish (const ThreadPoolJob* const job, | |||||
| while (contains (job)) | while (contains (job)) | ||||
| { | { | ||||
| if (timeOutMs >= 0 && Time::getMillisecondCounter() >= start + timeOutMs) | |||||
| if (timeOutMs >= 0 && Time::getMillisecondCounter() >= start + (uint32) timeOutMs) | |||||
| return false; | return false; | ||||
| jobFinishedSignal.wait (2); | jobFinishedSignal.wait (2); | ||||
| @@ -260,7 +260,7 @@ bool ThreadPool::removeAllJobs (const bool interruptRunningJobs, const int timeO | |||||
| if (jobsToWaitFor.size() == 0) | if (jobsToWaitFor.size() == 0) | ||||
| break; | break; | ||||
| if (timeOutMs >= 0 && Time::getMillisecondCounter() >= start + timeOutMs) | |||||
| if (timeOutMs >= 0 && Time::getMillisecondCounter() >= start + (uint32) timeOutMs) | |||||
| return false; | return false; | ||||
| jobFinishedSignal.wait (20); | jobFinishedSignal.wait (20); | ||||
| @@ -46,7 +46,7 @@ public: | |||||
| zlibNamespace::deflateEnd (&stream); | zlibNamespace::deflateEnd (&stream); | ||||
| } | } | ||||
| bool write (const uint8* data, int dataSize, OutputStream& out) | |||||
| bool write (const uint8* data, unsigned int dataSize, OutputStream& out) | |||||
| { | { | ||||
| // When you call flush() on a gzip stream, the stream is closed, and you can | // When you call flush() on a gzip stream, the stream is closed, and you can | ||||
| // no longer continue to write data to it! | // no longer continue to write data to it! | ||||
| @@ -62,7 +62,7 @@ public: | |||||
| void finish (OutputStream& out) | void finish (OutputStream& out) | ||||
| { | { | ||||
| const uint8* data = nullptr; | const uint8* data = nullptr; | ||||
| int dataSize = 0; | |||||
| unsigned int dataSize = 0; | |||||
| while (! finished) | while (! finished) | ||||
| doNextBlock (data, dataSize, out, Z_FINISH); | doNextBlock (data, dataSize, out, Z_FINISH); | ||||
| @@ -76,7 +76,7 @@ private: | |||||
| bool isFirstDeflate, streamIsValid, finished; | bool isFirstDeflate, streamIsValid, finished; | ||||
| zlibNamespace::Bytef buffer[32768]; | zlibNamespace::Bytef buffer[32768]; | ||||
| bool doNextBlock (const uint8*& data, int& dataSize, OutputStream& out, const int flushMode) | |||||
| bool doNextBlock (const uint8*& data, unsigned int& dataSize, OutputStream& out, const int flushMode) | |||||
| { | { | ||||
| using namespace zlibNamespace; | using namespace zlibNamespace; | ||||
| if (streamIsValid) | if (streamIsValid) | ||||
| @@ -98,7 +98,7 @@ private: | |||||
| case Z_OK: | case Z_OK: | ||||
| { | { | ||||
| data += dataSize - stream.avail_in; | data += dataSize - stream.avail_in; | ||||
| dataSize = (int) stream.avail_in; | |||||
| dataSize = stream.avail_in; | |||||
| const int bytesDone = ((int) sizeof (buffer)) - (int) stream.avail_out; | const int bytesDone = ((int) sizeof (buffer)) - (int) stream.avail_out; | ||||
| return bytesDone <= 0 || out.write (buffer, bytesDone); | return bytesDone <= 0 || out.write (buffer, bytesDone); | ||||
| } | } | ||||
| @@ -140,7 +140,8 @@ bool GZIPCompressorOutputStream::write (const void* destBuffer, int howMany) | |||||
| { | { | ||||
| jassert (destBuffer != nullptr && howMany >= 0); | jassert (destBuffer != nullptr && howMany >= 0); | ||||
| return helper->write (static_cast <const uint8*> (destBuffer), howMany, *destStream); | |||||
| return helper->write (static_cast <const uint8*> (destBuffer), | |||||
| (unsigned int) howMany, *destStream); | |||||
| } | } | ||||
| int64 GZIPCompressorOutputStream::getPosition() | int64 GZIPCompressorOutputStream::getPosition() | ||||
| @@ -176,7 +177,7 @@ public: | |||||
| for (int j = rng.nextInt (100); --j >= 0;) | for (int j = rng.nextInt (100); --j >= 0;) | ||||
| { | { | ||||
| MemoryBlock data (rng.nextInt (2000) + 1); | |||||
| MemoryBlock data ((unsigned int) (rng.nextInt (2000) + 1)); | |||||
| for (int k = (int) data.getSize(); --k >= 0;) | for (int k = (int) data.getSize(); --k >= 0;) | ||||
| data[k] = (char) rng.nextInt (255); | data[k] = (char) rng.nextInt (255); | ||||
| @@ -109,7 +109,7 @@ public: | |||||
| dataSize = size; | dataSize = size; | ||||
| } | } | ||||
| int doNextBlock (uint8* const dest, const int destSize) | |||||
| int doNextBlock (uint8* const dest, const unsigned int destSize) | |||||
| { | { | ||||
| using namespace zlibNamespace; | using namespace zlibNamespace; | ||||
| if (streamIsValid && data != nullptr && ! finished) | if (streamIsValid && data != nullptr && ! finished) | ||||
| @@ -209,7 +209,7 @@ int GZIPDecompressorInputStream::read (void* destBuffer, int howMany) | |||||
| while (! helper->error) | while (! helper->error) | ||||
| { | { | ||||
| const int n = helper->doNextBlock (d, howMany); | |||||
| const int n = helper->doNextBlock (d, (unsigned int) howMany); | |||||
| currentPos += n; | currentPos += n; | ||||
| if (n == 0) | if (n == 0) | ||||
| @@ -89,7 +89,7 @@ public: | |||||
| } | } | ||||
| int replaceIndex = 0; | int replaceIndex = 0; | ||||
| size_t bestLastUsageCount = std::numeric_limits<int>::max(); | |||||
| size_t bestLastUsageCount = std::numeric_limits<size_t>::max(); | |||||
| for (int i = faces.size(); --i >= 0;) | for (int i = faces.size(); --i >= 0;) | ||||
| { | { | ||||
| @@ -391,7 +391,7 @@ bool JPEGImageFormat::writeImageToStream (const Image& image, OutputStream& out) | |||||
| jpeg_start_compress (&jpegCompStruct, TRUE); | jpeg_start_compress (&jpegCompStruct, TRUE); | ||||
| const int strideBytes = (int) (jpegCompStruct.image_width * jpegCompStruct.input_components); | |||||
| const int strideBytes = (int) (jpegCompStruct.image_width * (unsigned int) jpegCompStruct.input_components); | |||||
| JSAMPARRAY buffer = (*jpegCompStruct.mem->alloc_sarray) ((j_common_ptr) &jpegCompStruct, | JSAMPARRAY buffer = (*jpegCompStruct.mem->alloc_sarray) ((j_common_ptr) &jpegCompStruct, | ||||
| JPOOL_IMAGE, (JDIMENSION) strideBytes, 1); | JPOOL_IMAGE, (JDIMENSION) strideBytes, 1); | ||||
| @@ -55,6 +55,11 @@ namespace pnglibNamespace | |||||
| using std::free; | using std::free; | ||||
| #endif | #endif | ||||
| #if JUCE_CLANG | |||||
| #pragma clang diagnostic push | |||||
| #pragma clang diagnostic ignored "-Wsign-conversion" | |||||
| #endif | |||||
| using std::abs; | using std::abs; | ||||
| #define PNG_INTERNAL | #define PNG_INTERNAL | ||||
| #define NO_DUMMY_DECL | #define NO_DUMMY_DECL | ||||
| @@ -79,6 +84,10 @@ namespace pnglibNamespace | |||||
| #include "pnglib/pngwrite.c" | #include "pnglib/pngwrite.c" | ||||
| #include "pnglib/pngwtran.c" | #include "pnglib/pngwtran.c" | ||||
| #include "pnglib/pngwutil.c" | #include "pnglib/pngwutil.c" | ||||
| #if JUCE_CLANG | |||||
| #pragma clang diagnostic pop | |||||
| #endif | |||||
| #else | #else | ||||
| extern "C" | extern "C" | ||||
| { | { | ||||
| @@ -51,7 +51,7 @@ Image ImageType::convert (const Image& source) const | |||||
| jassert (src.pixelStride == dest.pixelStride && src.pixelFormat == dest.pixelFormat); | jassert (src.pixelStride == dest.pixelStride && src.pixelFormat == dest.pixelFormat); | ||||
| for (int y = 0; y < dest.height; ++y) | for (int y = 0; y < dest.height; ++y) | ||||
| memcpy (dest.getLinePointer (y), src.getLinePointer (y), dest.lineStride); | |||||
| memcpy (dest.getLinePointer (y), src.getLinePointer (y), (size_t) dest.lineStride); | |||||
| return newImage; | return newImage; | ||||
| } | } | ||||
| @@ -101,7 +101,7 @@ public: | |||||
| uint32 lastUseTime; | uint32 lastUseTime; | ||||
| }; | }; | ||||
| int cacheTimeout; | |||||
| unsigned int cacheTimeout; | |||||
| juce_DeclareSingleton_SingleThreaded_Minimal (ImageCache::Pimpl); | juce_DeclareSingleton_SingleThreaded_Minimal (ImageCache::Pimpl); | ||||
| @@ -159,5 +159,6 @@ Image ImageCache::getFromMemory (const void* imageData, const int dataSize) | |||||
| void ImageCache::setCacheTimeout (const int millisecs) | void ImageCache::setCacheTimeout (const int millisecs) | ||||
| { | { | ||||
| Pimpl::getInstance()->cacheTimeout = millisecs; | |||||
| jassert (millisecs >= 0); | |||||
| Pimpl::getInstance()->cacheTimeout = (unsigned int) millisecs; | |||||
| } | } | ||||
| @@ -130,7 +130,7 @@ namespace CoreTextTypeLayout | |||||
| { | { | ||||
| if (advances == nullptr) | if (advances == nullptr) | ||||
| { | { | ||||
| local.malloc (numGlyphs); | |||||
| local.malloc ((size_t) numGlyphs); | |||||
| CTRunGetAdvances (run, CFRangeMake (0, 0), local); | CTRunGetAdvances (run, CFRangeMake (0, 0), local); | ||||
| advances = local; | advances = local; | ||||
| } | } | ||||
| @@ -142,7 +142,7 @@ namespace CoreTextTypeLayout | |||||
| struct Glyphs | struct Glyphs | ||||
| { | { | ||||
| Glyphs (CTRunRef run, const int numGlyphs) | |||||
| Glyphs (CTRunRef run, const size_t numGlyphs) | |||||
| : glyphs (CTRunGetGlyphsPtr (run)) | : glyphs (CTRunGetGlyphsPtr (run)) | ||||
| { | { | ||||
| if (glyphs == nullptr) | if (glyphs == nullptr) | ||||
| @@ -159,7 +159,7 @@ namespace CoreTextTypeLayout | |||||
| struct Positions | struct Positions | ||||
| { | { | ||||
| Positions (CTRunRef run, const int numGlyphs) | |||||
| Positions (CTRunRef run, const size_t numGlyphs) | |||||
| : points (CTRunGetPositionsPtr (run)) | : points (CTRunGetPositionsPtr (run)) | ||||
| { | { | ||||
| if (points == nullptr) | if (points == nullptr) | ||||
| @@ -383,9 +383,9 @@ namespace CoreTextTypeLayout | |||||
| glyphRun->colour = Colour::fromFloatRGBA (components[0], components[1], components[2], components[3]); | glyphRun->colour = Colour::fromFloatRGBA (components[0], components[1], components[2], components[3]); | ||||
| } | } | ||||
| const CoreTextTypeLayout::Glyphs glyphs (run, numGlyphs); | |||||
| const CoreTextTypeLayout::Glyphs glyphs (run, (size_t) numGlyphs); | |||||
| const CoreTextTypeLayout::Advances advances (run, numGlyphs); | const CoreTextTypeLayout::Advances advances (run, numGlyphs); | ||||
| const CoreTextTypeLayout::Positions positions (run, numGlyphs); | |||||
| const CoreTextTypeLayout::Positions positions (run, (size_t) numGlyphs); | |||||
| for (CFIndex k = 0; k < numGlyphs; ++k) | for (CFIndex k = 0; k < numGlyphs; ++k) | ||||
| glyphRun->glyphs.add (TextLayout::Glyph (glyphs.glyphs[k], Point<float> (positions.points[k].x, | glyphRun->glyphs.add (TextLayout::Glyph (glyphs.glyphs[k], Point<float> (positions.points[k].x, | ||||
| @@ -511,7 +511,7 @@ public: | |||||
| CFIndex length = CTRunGetGlyphCount (run); | CFIndex length = CTRunGetGlyphCount (run); | ||||
| const CoreTextTypeLayout::Advances advances (run, length); | const CoreTextTypeLayout::Advances advances (run, length); | ||||
| const CoreTextTypeLayout::Glyphs glyphs (run, length); | |||||
| const CoreTextTypeLayout::Glyphs glyphs (run, (size_t) length); | |||||
| for (int j = 0; j < length; ++j) | for (int j = 0; j < length; ++j) | ||||
| { | { | ||||
| @@ -211,7 +211,7 @@ LookAndFeel::LookAndFeel() | |||||
| }; | }; | ||||
| for (int i = 0; i < numElementsInArray (standardColours); i += 2) | for (int i = 0; i < numElementsInArray (standardColours); i += 2) | ||||
| setColour (standardColours [i], Colour ((uint32) standardColours [i + 1])); | |||||
| setColour ((int) standardColours [i], Colour ((uint32) standardColours [i + 1])); | |||||
| juce_getTypefaceForFont = LookAndFeelHelpers::getTypefaceForFontFromLookAndFeel; | juce_getTypefaceForFont = LookAndFeelHelpers::getTypefaceForFontFromLookAndFeel; | ||||
| } | } | ||||
| @@ -233,7 +233,7 @@ public: | |||||
| [item setState: iter.isTicked ? NSOnState : NSOffState]; | [item setState: iter.isTicked ? NSOnState : NSOffState]; | ||||
| [item setTarget: (id) callback]; | [item setTarget: (id) callback]; | ||||
| NSMutableArray* info = [NSMutableArray arrayWithObject: [NSNumber numberWithUnsignedLongLong: (pointer_sized_int) (void*) iter.commandManager]]; | |||||
| NSMutableArray* info = [NSMutableArray arrayWithObject: [NSNumber numberWithUnsignedLongLong: (pointer_sized_uint) (void*) iter.commandManager]]; | |||||
| [info addObject: [NSNumber numberWithInt: topLevelIndex]]; | [info addObject: [NSNumber numberWithInt: topLevelIndex]]; | ||||
| [item setRepresentedObject: info]; | [item setRepresentedObject: info]; | ||||
| @@ -1506,7 +1506,7 @@ private: | |||||
| static NSRange markedRange (id self, SEL) | static NSRange markedRange (id self, SEL) | ||||
| { | { | ||||
| NSViewComponentPeer* const owner = getOwner (self); | NSViewComponentPeer* const owner = getOwner (self); | ||||
| return owner->stringBeingComposed.isNotEmpty() ? NSMakeRange (0, owner->stringBeingComposed.length()) | |||||
| return owner->stringBeingComposed.isNotEmpty() ? NSMakeRange (0, (NSUInteger) owner->stringBeingComposed.length()) | |||||
| : NSMakeRange (NSNotFound, 0); | : NSMakeRange (NSNotFound, 0); | ||||
| } | } | ||||
| @@ -1519,7 +1519,8 @@ private: | |||||
| const Range<int> highlight (target->getHighlightedRegion()); | const Range<int> highlight (target->getHighlightedRegion()); | ||||
| if (! highlight.isEmpty()) | if (! highlight.isEmpty()) | ||||
| return NSMakeRange (highlight.getStart(), highlight.getLength()); | |||||
| return NSMakeRange ((NSUInteger) highlight.getStart(), | |||||
| (NSUInteger) highlight.getLength()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -183,7 +183,7 @@ void TooltipWindow::timerCallback() | |||||
| // appear after a timeout.. | // appear after a timeout.. | ||||
| if (newTip.isNotEmpty() | if (newTip.isNotEmpty() | ||||
| && newTip != tipShowing | && newTip != tipShowing | ||||
| && now > lastCompChangeTime + millisecondsBeforeTipAppears) | |||||
| && now > lastCompChangeTime + (unsigned int) millisecondsBeforeTipAppears) | |||||
| { | { | ||||
| showFor (newTip); | showFor (newTip); | ||||
| } | } | ||||
| @@ -60,7 +60,7 @@ CodeEditorComponent::ColourScheme CPlusPlusCodeTokeniser::getDefaultColourScheme | |||||
| CodeEditorComponent::ColourScheme cs; | CodeEditorComponent::ColourScheme cs; | ||||
| for (int i = 0; i < sizeof (types) / sizeof (types[0]); ++i) // (NB: numElementsInArray doesn't work here in GCC4.2) | |||||
| for (unsigned int i = 0; i < sizeof (types) / sizeof (types[0]); ++i) // (NB: numElementsInArray doesn't work here in GCC4.2) | |||||
| cs.set (types[i].name, Colour (types[i].colour)); | cs.set (types[i].name, Colour (types[i].colour)); | ||||
| return cs; | return cs; | ||||
| @@ -69,7 +69,7 @@ void BubbleMessageComponent::init (const int numMillisecondsBeforeRemoving, | |||||
| deleteAfterUse = deleteSelfAfterUse; | deleteAfterUse = deleteSelfAfterUse; | ||||
| expiryTime = numMillisecondsBeforeRemoving > 0 | expiryTime = numMillisecondsBeforeRemoving > 0 | ||||
| ? (Time::getMillisecondCounter() + numMillisecondsBeforeRemoving) : 0; | |||||
| ? (Time::getMillisecondCounter() + (uint32) numMillisecondsBeforeRemoving) : 0; | |||||
| mouseClickCounter = Desktop::getInstance().getMouseButtonClickCounter(); | mouseClickCounter = Desktop::getInstance().getMouseButtonClickCounter(); | ||||
| @@ -100,8 +100,8 @@ class OpenGLContext::NativeContext | |||||
| { | { | ||||
| public: | public: | ||||
| NativeContext (Component& component, | NativeContext (Component& component, | ||||
| const OpenGLPixelFormat& pixelFormat, | |||||
| void* contextToShareWith) | |||||
| const OpenGLPixelFormat& pixFormat, | |||||
| void* contextToShare) | |||||
| { | { | ||||
| NSOpenGLPixelFormatAttribute attribs[] = | NSOpenGLPixelFormatAttribute attribs[] = | ||||
| { | { | ||||
| @@ -109,14 +109,14 @@ public: | |||||
| NSOpenGLPFAMPSafe, | NSOpenGLPFAMPSafe, | ||||
| NSOpenGLPFAClosestPolicy, | NSOpenGLPFAClosestPolicy, | ||||
| NSOpenGLPFANoRecovery, | NSOpenGLPFANoRecovery, | ||||
| NSOpenGLPFAColorSize, (NSOpenGLPixelFormatAttribute) (pixelFormat.redBits + pixelFormat.greenBits + pixelFormat.blueBits), | |||||
| NSOpenGLPFAAlphaSize, (NSOpenGLPixelFormatAttribute) pixelFormat.alphaBits, | |||||
| NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute) pixelFormat.depthBufferBits, | |||||
| NSOpenGLPFAStencilSize, (NSOpenGLPixelFormatAttribute) pixelFormat.stencilBufferBits, | |||||
| NSOpenGLPFAAccumSize, (NSOpenGLPixelFormatAttribute) (pixelFormat.accumulationBufferRedBits + pixelFormat.accumulationBufferGreenBits | |||||
| + pixelFormat.accumulationBufferBlueBits + pixelFormat.accumulationBufferAlphaBits), | |||||
| pixelFormat.multisamplingLevel > 0 ? NSOpenGLPFASamples : (NSOpenGLPixelFormatAttribute) 0, | |||||
| (NSOpenGLPixelFormatAttribute) pixelFormat.multisamplingLevel, | |||||
| NSOpenGLPFAColorSize, (NSOpenGLPixelFormatAttribute) (pixFormat.redBits + pixFormat.greenBits + pixFormat.blueBits), | |||||
| NSOpenGLPFAAlphaSize, (NSOpenGLPixelFormatAttribute) pixFormat.alphaBits, | |||||
| NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute) pixFormat.depthBufferBits, | |||||
| NSOpenGLPFAStencilSize, (NSOpenGLPixelFormatAttribute) pixFormat.stencilBufferBits, | |||||
| NSOpenGLPFAAccumSize, (NSOpenGLPixelFormatAttribute) (pixFormat.accumulationBufferRedBits + pixFormat.accumulationBufferGreenBits | |||||
| + pixFormat.accumulationBufferBlueBits + pixFormat.accumulationBufferAlphaBits), | |||||
| pixFormat.multisamplingLevel > 0 ? NSOpenGLPFASamples : (NSOpenGLPixelFormatAttribute) 0, | |||||
| (NSOpenGLPixelFormatAttribute) pixFormat.multisamplingLevel, | |||||
| 0 | 0 | ||||
| }; | }; | ||||
| @@ -133,7 +133,7 @@ public: | |||||
| object: view]; | object: view]; | ||||
| renderContext = [[[NSOpenGLContext alloc] initWithFormat: format | renderContext = [[[NSOpenGLContext alloc] initWithFormat: format | ||||
| shareContext: (NSOpenGLContext*) contextToShareWith] autorelease]; | |||||
| shareContext: (NSOpenGLContext*) contextToShare] autorelease]; | |||||
| setSwapInterval (1); | setSwapInterval (1); | ||||
| @@ -150,7 +150,7 @@ class OpenGLFrameBuffer::SavedState | |||||
| public: | public: | ||||
| SavedState (OpenGLFrameBuffer& buffer, const int w, const int h) | SavedState (OpenGLFrameBuffer& buffer, const int w, const int h) | ||||
| : width (w), height (h), | : width (w), height (h), | ||||
| data (w * h) | |||||
| data ((size_t) (w * h)) | |||||
| { | { | ||||
| buffer.readPixels (data, Rectangle<int> (w, h)); | buffer.readPixels (data, Rectangle<int> (w, h)); | ||||
| } | } | ||||
| @@ -62,9 +62,9 @@ bool OpenGLShaderProgram::addShader (const char* const code, GLenum type) | |||||
| if (status == GL_FALSE) | if (status == GL_FALSE) | ||||
| { | { | ||||
| GLchar infoLog [16384]; | GLchar infoLog [16384]; | ||||
| GLsizei infologLength = 0; | |||||
| context.extensions.glGetShaderInfoLog (shaderID, sizeof (infoLog), &infologLength, infoLog); | |||||
| errorLog = String (infoLog, infologLength); | |||||
| GLsizei infoLogLength = 0; | |||||
| context.extensions.glGetShaderInfoLog (shaderID, sizeof (infoLog), &infoLogLength, infoLog); | |||||
| errorLog = String (infoLog, (size_t) infoLogLength); | |||||
| #if JUCE_DEBUG | #if JUCE_DEBUG | ||||
| DBG (errorLog); | DBG (errorLog); | ||||
| @@ -90,9 +90,9 @@ bool OpenGLShaderProgram::link() noexcept | |||||
| if (status == GL_FALSE) | if (status == GL_FALSE) | ||||
| { | { | ||||
| GLchar infoLog [16384]; | GLchar infoLog [16384]; | ||||
| GLsizei infologLength = 0; | |||||
| context.extensions.glGetProgramInfoLog (programID, sizeof (infoLog), &infologLength, infoLog); | |||||
| errorLog = String (infoLog, infologLength); | |||||
| GLsizei infoLogLength = 0; | |||||
| context.extensions.glGetProgramInfoLog (programID, sizeof (infoLog), &infoLogLength, infoLog); | |||||
| errorLog = String (infoLog, (size_t) infoLogLength); | |||||
| #if JUCE_DEBUG | #if JUCE_DEBUG | ||||
| DBG (errorLog); | DBG (errorLog); | ||||
| @@ -79,7 +79,7 @@ struct Flipper | |||||
| static void flip (HeapBlock<PixelARGB>& dataCopy, const uint8* srcData, const int lineStride, | static void flip (HeapBlock<PixelARGB>& dataCopy, const uint8* srcData, const int lineStride, | ||||
| const int w, const int h, const int textureW, const int textureH) | const int w, const int h, const int textureW, const int textureH) | ||||
| { | { | ||||
| dataCopy.malloc (textureW * textureH); | |||||
| dataCopy.malloc ((size_t) (textureW * textureH)); | |||||
| for (int y = 0; y < h; ++y) | for (int y = 0; y < h; ++y) | ||||
| { | { | ||||