From 9c719306c9815678c0c327106fb0d748378ba108 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 28 Feb 2012 19:51:22 +0000 Subject: [PATCH] Added -ldl to linux builds. Tidied up a few warnings. --- extras/Introjucer/Builds/Linux/Makefile | 4 ++-- .../Source/Project Saving/jucer_ProjectExport_Make.h | 2 +- extras/JuceDemo/Builds/Linux/Makefile | 4 ++-- extras/audio plugin demo/Builds/Linux/Makefile | 4 ++-- extras/audio plugin host/Builds/Linux/Makefile | 4 ++-- extras/binarybuilder/Builds/Linux/Makefile | 4 ++-- extras/example projects/Builds/Linux/Makefile | 4 ++-- extras/the jucer/Builds/Linux/Makefile | 4 ++-- .../audio_io/juce_AudioDeviceManager.cpp | 2 +- .../sources/juce_AudioSourcePlayer.cpp | 10 +++++----- modules/juce_core/containers/juce_HashMap.h | 2 +- modules/juce_core/memory/juce_ScopedPointer.h | 4 ++++ modules/juce_core/text/juce_CharPointer_UTF16.h | 4 ++-- modules/juce_core/text/juce_CharPointer_UTF8.h | 2 +- modules/juce_core/xml/juce_XmlElement.h | 2 +- modules/juce_cryptography/encryption/juce_Primes.cpp | 10 +++++----- modules/juce_cryptography/hashing/juce_MD5.cpp | 8 ++++---- modules/juce_cryptography/hashing/juce_SHA256.cpp | 4 ++-- modules/juce_graphics/colour/juce_PixelFormats.h | 6 +++--- 19 files changed, 44 insertions(+), 40 deletions(-) diff --git a/extras/Introjucer/Builds/Linux/Makefile b/extras/Introjucer/Builds/Linux/Makefile index f71dda5964..55cf3c5dd5 100644 --- a/extras/Introjucer/Builds/Linux/Makefile +++ b/extras/Introjucer/Builds/Linux/Makefile @@ -20,7 +20,7 @@ ifeq ($(CONFIG),Debug) CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 CXXFLAGS += $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -ldl -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext LDDEPS := RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode TARGET := Introjucer @@ -35,7 +35,7 @@ ifeq ($(CONFIG),Release) CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -O3 CXXFLAGS += $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -ldl -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext LDDEPS := RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode TARGET := Introjucer diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h index c649a5fc9e..3337a6a61b 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h @@ -182,7 +182,7 @@ private: out << config.getGCCLibraryPathFlags(); - const char* defaultLibs[] = { "freetype", "pthread", "rt", "X11", "GL", "GLU", "Xinerama", "asound", "Xext", 0 }; + const char* defaultLibs[] = { "dl", "freetype", "pthread", "rt", "X11", "GL", "GLU", "Xinerama", "asound", "Xext", 0 }; StringArray libs (defaultLibs); for (int i = 0; i < libs.size(); ++i) diff --git a/extras/JuceDemo/Builds/Linux/Makefile b/extras/JuceDemo/Builds/Linux/Makefile index 28cf3d0b92..f69b199c5a 100644 --- a/extras/JuceDemo/Builds/Linux/Makefile +++ b/extras/JuceDemo/Builds/Linux/Makefile @@ -20,7 +20,7 @@ ifeq ($(CONFIG),Debug) CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCE_UNIT_TESTS=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 CXXFLAGS += $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -ldl -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext LDDEPS := RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCE_UNIT_TESTS=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode TARGET := JuceDemo @@ -35,7 +35,7 @@ ifeq ($(CONFIG),Release) CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -D "JUCE_UNIT_TESTS=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -Os CXXFLAGS += $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -ldl -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext LDDEPS := RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -D "JUCE_UNIT_TESTS=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode TARGET := JuceDemo diff --git a/extras/audio plugin demo/Builds/Linux/Makefile b/extras/audio plugin demo/Builds/Linux/Makefile index 119e35f9a7..ab5bb3ae62 100644 --- a/extras/audio plugin demo/Builds/Linux/Makefile +++ b/extras/audio plugin demo/Builds/Linux/Makefile @@ -20,7 +20,7 @@ ifeq ($(CONFIG),Debug) CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ~/SDKs/vstsdk2.4 -I ../../JuceLibraryCode CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -ggdb -fPIC -O0 CXXFLAGS += $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -shared -L/usr/X11R6/lib/ -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -shared -L/usr/X11R6/lib/ -ldl -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext LDDEPS := RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ~/SDKs/vstsdk2.4 -I ../../JuceLibraryCode TARGET := JuceDemoPlugin.so @@ -35,7 +35,7 @@ ifeq ($(CONFIG),Release) CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ~/SDKs/vstsdk2.4 -I ../../JuceLibraryCode CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -fPIC -Os CXXFLAGS += $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -shared -L/usr/X11R6/lib/ -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -shared -L/usr/X11R6/lib/ -ldl -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext LDDEPS := RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ~/SDKs/vstsdk2.4 -I ../../JuceLibraryCode TARGET := JuceDemoPlugin.so diff --git a/extras/audio plugin host/Builds/Linux/Makefile b/extras/audio plugin host/Builds/Linux/Makefile index d4f3a44dc4..7977093d50 100644 --- a/extras/audio plugin host/Builds/Linux/Makefile +++ b/extras/audio plugin host/Builds/Linux/Makefile @@ -20,7 +20,7 @@ ifeq ($(CONFIG),Debug) CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ~/SDKs/vstsdk2.4 -I ../../JuceLibraryCode CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 CXXFLAGS += $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -ldl -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext LDDEPS := RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ~/SDKs/vstsdk2.4 -I ../../JuceLibraryCode TARGET := Plugin\ Host @@ -35,7 +35,7 @@ ifeq ($(CONFIG),Release) CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ~/SDKs/vstsdk2.4 -I ../../JuceLibraryCode CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -Os CXXFLAGS += $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -ldl -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext LDDEPS := RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ~/SDKs/vstsdk2.4 -I ../../JuceLibraryCode TARGET := Plugin\ Host diff --git a/extras/binarybuilder/Builds/Linux/Makefile b/extras/binarybuilder/Builds/Linux/Makefile index 887507fe38..522aee0119 100644 --- a/extras/binarybuilder/Builds/Linux/Makefile +++ b/extras/binarybuilder/Builds/Linux/Makefile @@ -20,7 +20,7 @@ ifeq ($(CONFIG),Debug) CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 CXXFLAGS += $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -ldl -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext LDDEPS := RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode TARGET := BinaryBuilder @@ -35,7 +35,7 @@ ifeq ($(CONFIG),Release) CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -Os CXXFLAGS += $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -ldl -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext LDDEPS := RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode TARGET := BinaryBuilder diff --git a/extras/example projects/Builds/Linux/Makefile b/extras/example projects/Builds/Linux/Makefile index c3470b8e02..84ebacc153 100644 --- a/extras/example projects/Builds/Linux/Makefile +++ b/extras/example projects/Builds/Linux/Makefile @@ -20,7 +20,7 @@ ifeq ($(CONFIG),Debug) CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 CXXFLAGS += $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -ldl -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext LDDEPS := RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode TARGET := HelloWorld @@ -35,7 +35,7 @@ ifeq ($(CONFIG),Release) CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -Os CXXFLAGS += $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -ldl -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext LDDEPS := RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode TARGET := HelloWorld diff --git a/extras/the jucer/Builds/Linux/Makefile b/extras/the jucer/Builds/Linux/Makefile index 95f167e06c..11fede5042 100644 --- a/extras/the jucer/Builds/Linux/Makefile +++ b/extras/the jucer/Builds/Linux/Makefile @@ -20,7 +20,7 @@ ifeq ($(CONFIG),Debug) CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 CXXFLAGS += $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -ldl -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext LDDEPS := RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode TARGET := Jucer @@ -35,7 +35,7 @@ ifeq ($(CONFIG),Release) CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -Os CXXFLAGS += $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -ldl -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -lXext LDDEPS := RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode TARGET := Jucer diff --git a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp index 9c461fcb41..6bdafab088 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp +++ b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp @@ -665,7 +665,7 @@ void AudioDeviceManager::audioDeviceIOCallbackInt (const float** inputChannelDat else { for (int i = 0; i < numOutputChannels; ++i) - zeromem (outputChannelData[i], sizeof (float) * numSamples); + zeromem (outputChannelData[i], sizeof (float) * (size_t) numSamples); } if (testSound != nullptr) diff --git a/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp b/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp index 159b7df51f..401de367c1 100644 --- a/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp +++ b/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp @@ -112,14 +112,14 @@ void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData, for (i = 0; i < numOutputs; ++i) { channels[numActiveChans] = outputChans[i]; - memcpy (channels[numActiveChans], inputChans[i], sizeof (float) * numSamples); + memcpy (channels[numActiveChans], inputChans[i], sizeof (float) * (size_t) numSamples); ++numActiveChans; } for (i = numOutputs; i < numInputs; ++i) { channels[numActiveChans] = tempBuffer.getSampleData (i - numOutputs, 0); - memcpy (channels[numActiveChans], inputChans[i], sizeof (float) * numSamples); + memcpy (channels[numActiveChans], inputChans[i], sizeof (float) * (size_t) numSamples); ++numActiveChans; } } @@ -128,14 +128,14 @@ void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData, for (i = 0; i < numInputs; ++i) { channels[numActiveChans] = outputChans[i]; - memcpy (channels[numActiveChans], inputChans[i], sizeof (float) * numSamples); + memcpy (channels[numActiveChans], inputChans[i], sizeof (float) * (size_t) numSamples); ++numActiveChans; } for (i = numInputs; i < numOutputs; ++i) { channels[numActiveChans] = outputChans[i]; - zeromem (channels[numActiveChans], sizeof (float) * numSamples); + zeromem (channels[numActiveChans], sizeof (float) * (size_t) numSamples); ++numActiveChans; } } @@ -157,7 +157,7 @@ void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData, { for (int i = 0; i < totalNumOutputChannels; ++i) if (outputChannelData[i] != nullptr) - zeromem (outputChannelData[i], sizeof (float) * numSamples); + zeromem (outputChannelData[i], sizeof (float) * (size_t) numSamples); } } diff --git a/modules/juce_core/containers/juce_HashMap.h b/modules/juce_core/containers/juce_HashMap.h index b422a4d00e..5ff8c59662 100644 --- a/modules/juce_core/containers/juce_HashMap.h +++ b/modules/juce_core/containers/juce_HashMap.h @@ -43,7 +43,7 @@ public: /** Generates a simple hash from an integer. */ static int generateHash (const int key, const int upperLimit) noexcept { return std::abs (key) % upperLimit; } /** Generates a simple hash from a string. */ - static int generateHash (const String& key, const int upperLimit) noexcept { return (int) (((uint32) key.hashCode()) % upperLimit); } + static int generateHash (const String& key, const int upperLimit) noexcept { return (int) (((uint32) key.hashCode()) % (uint32) upperLimit); } /** Generates a simple hash from a variant. */ static int generateHash (const var& key, const int upperLimit) noexcept { return generateHash (key.toString(), upperLimit); } }; diff --git a/modules/juce_core/memory/juce_ScopedPointer.h b/modules/juce_core/memory/juce_ScopedPointer.h index 38c06768f4..40d0626959 100644 --- a/modules/juce_core/memory/juce_ScopedPointer.h +++ b/modules/juce_core/memory/juce_ScopedPointer.h @@ -40,6 +40,10 @@ to an object. If you use the assignment operator to assign a different object to a ScopedPointer, the old one will be automatically deleted. + Important note: The class is designed to hold a pointer to an object, NOT to an array! + It calls delete on its payload, not delete[], so do not give it an array to hold! For + that kind of purpose, you should be using HeapBlock or Array instead. + A const ScopedPointer is guaranteed not to lose ownership of its object or change the object to which it points during its lifetime. This means that making a copy of a const ScopedPointer is impossible, as that would involve the new copy taking ownership from the diff --git a/modules/juce_core/text/juce_CharPointer_UTF16.h b/modules/juce_core/text/juce_CharPointer_UTF16.h index 8dbfb23417..c44fb8ea2c 100644 --- a/modules/juce_core/text/juce_CharPointer_UTF16.h +++ b/modules/juce_core/text/juce_CharPointer_UTF16.h @@ -483,9 +483,9 @@ public: private: CharType* data; - static int findNullIndex (const CharType* const t) noexcept + static unsigned int findNullIndex (const CharType* const t) noexcept { - int n = 0; + unsigned int n = 0; while (t[n] != 0) ++n; diff --git a/modules/juce_core/text/juce_CharPointer_UTF8.h b/modules/juce_core/text/juce_CharPointer_UTF8.h index 504b90b78d..6df77e15e7 100644 --- a/modules/juce_core/text/juce_CharPointer_UTF8.h +++ b/modules/juce_core/text/juce_CharPointer_UTF8.h @@ -352,7 +352,7 @@ public: ++numExtraBytes; } - *data++ = (CharType) ((0xff << (7 - numExtraBytes)) | (c >> (numExtraBytes * 6))); + *data++ = (CharType) ((uint32) (0xff << (7 - numExtraBytes)) | (c >> (numExtraBytes * 6))); while (--numExtraBytes >= 0) *data++ = (CharType) (0x80 | (0x3f & (c >> (numExtraBytes * 6)))); diff --git a/modules/juce_core/xml/juce_XmlElement.h b/modules/juce_core/xml/juce_XmlElement.h index 0e1e60df06..2d79ce6527 100644 --- a/modules/juce_core/xml/juce_XmlElement.h +++ b/modules/juce_core/xml/juce_XmlElement.h @@ -605,7 +605,7 @@ public: if (num > 1) { - HeapBlock elems (num); + HeapBlock elems ((size_t) num); getChildElementsAsArray (elems); sortArray (comparator, (XmlElement**) elems, 0, num - 1, retainOrderOfEquivalentItems); reorderChildElements (elems, num); diff --git a/modules/juce_cryptography/encryption/juce_Primes.cpp b/modules/juce_cryptography/encryption/juce_Primes.cpp index 559b9cb0ad..2802b535ea 100644 --- a/modules/juce_cryptography/encryption/juce_Primes.cpp +++ b/modules/juce_cryptography/encryption/juce_Primes.cpp @@ -56,12 +56,12 @@ namespace PrimesHelpers do { - const int prime = (index << 1) + 1; + const unsigned int prime = ((unsigned int) index << 1) + 1; BigInteger r (base), remainder; r.divideBy (prime, remainder); - int i = prime - remainder.getBitRangeAsInt (0, 32); + unsigned int i = prime - remainder.getBitRangeAsInt (0, 32); if (r.isZero()) i += prime; @@ -73,7 +73,7 @@ namespace PrimesHelpers while (i < numBits) { - result.setBit (i); + result.setBit ((int) i); i += prime; } @@ -222,9 +222,9 @@ bool Primes::isProbablyPrime (const BigInteger& number, const int certainty) if (number.getHighestBit() <= 10) { - const int num = number.getBitRangeAsInt (0, 10); + const unsigned int num = number.getBitRangeAsInt (0, 10); - for (int i = num / 2; --i > 1;) + for (unsigned int i = num / 2; --i > 1;) if (num % i == 0) return false; diff --git a/modules/juce_cryptography/hashing/juce_MD5.cpp b/modules/juce_cryptography/hashing/juce_MD5.cpp index 6a06a3ec38..55075e857a 100644 --- a/modules/juce_cryptography/hashing/juce_MD5.cpp +++ b/modules/juce_cryptography/hashing/juce_MD5.cpp @@ -49,7 +49,7 @@ public: count[1] += (uint32) (dataSize >> 29); - const size_t spaceLeft = 64 - bufferPos; + const size_t spaceLeft = 64 - (size_t) bufferPos; size_t i = 0; if (dataSize >= spaceLeft) @@ -132,13 +132,13 @@ public: encode (encodedLength, count, 8); // Pad out to 56 mod 64. - const int index = (uint32) ((count[0] >> 3) & 0x3f); + const int index = (count[0] >> 3) & 0x3f; const int paddingLength = (index < 56) ? (56 - index) : (120 - index); uint8 paddingBuffer[64] = { 0x80 }; // first byte is 0x80, remaining bytes are zero. - processBlock (paddingBuffer, paddingLength); + processBlock (paddingBuffer, (size_t) paddingLength); processBlock (encodedLength, 8); @@ -279,7 +279,7 @@ void MD5::processStream (InputStream& input, int64 numBytesToRead) break; numBytesToRead -= bytesRead; - generator.processBlock (tempBuffer, bytesRead); + generator.processBlock (tempBuffer, (size_t) bytesRead); } generator.finish (result); diff --git a/modules/juce_cryptography/hashing/juce_SHA256.cpp b/modules/juce_cryptography/hashing/juce_SHA256.cpp index ca62066a79..c0f71e19f6 100644 --- a/modules/juce_cryptography/hashing/juce_SHA256.cpp +++ b/modules/juce_cryptography/hashing/juce_SHA256.cpp @@ -77,7 +77,7 @@ public: length += 64; } - void processFinalBlock (const void* const data, int numBytes) noexcept + void processFinalBlock (const void* const data, unsigned int numBytes) noexcept { jassert (numBytes < 64); @@ -126,7 +126,7 @@ public: if (bytesRead < sizeof (buffer)) { - processFinalBlock (buffer, bytesRead); + processFinalBlock (buffer, (unsigned int) bytesRead); break; } diff --git a/modules/juce_graphics/colour/juce_PixelFormats.h b/modules/juce_graphics/colour/juce_PixelFormats.h index c560881ec6..6cf54d89af 100644 --- a/modules/juce_graphics/colour/juce_PixelFormats.h +++ b/modules/juce_graphics/colour/juce_PixelFormats.h @@ -170,8 +170,8 @@ public: { ++multiplier; - argb = ((multiplier * getAG()) & 0xff00ff00) - | (((multiplier * getRB()) >> 8) & 0x00ff00ff); + argb = ((((uint32) multiplier) * getAG()) & 0xff00ff00) + | (((((uint32) multiplier) * getRB()) >> 8) & 0x00ff00ff); } forcedinline void multiplyAlpha (const float multiplier) noexcept @@ -315,7 +315,7 @@ public: b = (uint8) (argb); } - forcedinline uint32 getARGB() const noexcept { return 0xff000000 | b | (g << 8) | (r << 16); } + forcedinline uint32 getARGB() const noexcept { return 0xff000000 | b | (((uint32) g) << 8) | (((uint32) r) << 16); } forcedinline uint32 getUnpremultipliedARGB() const noexcept { return getARGB(); } forcedinline uint32 getRB() const noexcept { return b | (uint32) (r << 16); }