diff --git a/extras/Introjucer/Source/Application/jucer_AppearanceSettings.cpp b/extras/Introjucer/Source/Application/jucer_AppearanceSettings.cpp index da2e6a7fd6..6753f030a6 100644 --- a/extras/Introjucer/Source/Application/jucer_AppearanceSettings.cpp +++ b/extras/Introjucer/Source/Application/jucer_AppearanceSettings.cpp @@ -30,7 +30,7 @@ namespace AppearanceColours struct ColourInfo { const char* name; - uint32 colourID; + int colourID; bool mustBeOpaque; bool applyToEditorOnly; }; diff --git a/extras/Introjucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.cpp b/extras/Introjucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.cpp index c67598b7d0..e922f0d5c7 100644 --- a/extras/Introjucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.cpp +++ b/extras/Introjucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.cpp @@ -200,10 +200,7 @@ bool ComponentTypeHandler::restoreFromXml (const XmlElement& xml, const String col (xml.getStringAttribute (colours[i]->xmlTagName, String::empty)); if (col.isNotEmpty()) - { - comp->setColour (colours[i]->colourId, - Colour (col.getHexValue32())); - } + comp->setColour (colours[i]->colourId, Colour::fromString (col)); } return true; diff --git a/extras/Introjucer/Source/ComponentEditor/jucer_BinaryResources.cpp b/extras/Introjucer/Source/ComponentEditor/jucer_BinaryResources.cpp index 40e25ca2f5..37ddf2b46b 100644 --- a/extras/Introjucer/Source/ComponentEditor/jucer_BinaryResources.cpp +++ b/extras/Introjucer/Source/ComponentEditor/jucer_BinaryResources.cpp @@ -263,7 +263,7 @@ void BinaryResources::loadFromCpp (const File& cppFileLocation, const String& cp jassert (size < (int) out.getDataSize() && size > (int) out.getDataSize() - 2); MemoryBlock mb (out.getData(), out.getDataSize()); - mb.setSize (size); + mb.setSize ((size_t) size); add (resourceName, originalFileName, mb); } diff --git a/extras/Introjucer/Source/ComponentEditor/paintelements/jucer_FillType.h b/extras/Introjucer/Source/ComponentEditor/paintelements/jucer_FillType.h index 0754bc6605..7d6feff19f 100644 --- a/extras/Introjucer/Source/ComponentEditor/paintelements/jucer_FillType.h +++ b/extras/Introjucer/Source/ComponentEditor/paintelements/jucer_FillType.h @@ -218,7 +218,7 @@ public: if (toks[0] == "solid") { mode = solidColour; - colour = Colour (toks[1].getHexValue32()); + colour = Colour::fromString (toks[1]); } else if (toks[0] == "linear" || toks[0] == "radial") @@ -230,8 +230,8 @@ public: gradPos2 = RelativePositionedRectangle(); gradPos2.rect = PositionedRectangle (toks[2]); - gradCol1 = Colour (toks[3].fromFirstOccurrenceOf ("=", false, false).getHexValue32()); - gradCol2 = Colour (toks[4].fromFirstOccurrenceOf ("=", false, false).getHexValue32()); + gradCol1 = Colour::fromString (toks[3].fromFirstOccurrenceOf ("=", false, false)); + gradCol2 = Colour::fromString (toks[4].fromFirstOccurrenceOf ("=", false, false)); } else if (toks[0] == "image") { diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h index fadbf52753..c3e60d98f3 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h @@ -434,7 +434,7 @@ protected: out.writeShort (1); // colour planes out.writeShort (32); // bits per pixel out.writeInt ((int) (dataBlock.getDataSize() - oldDataSize)); - out.writeInt (dataBlockStart + oldDataSize); + out.writeInt (dataBlockStart + (int) oldDataSize); } jassert (out.getPosition() == dataBlockStart); diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h index a0d399496e..1f084e1d24 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h @@ -428,7 +428,7 @@ private: pngFormat.writeImageToStream (image, pngData); out.write (type, 4); - out.writeIntBigEndian (8 + pngData.getDataSize()); + out.writeIntBigEndian (8 + (int) pngData.getDataSize()); out << pngData; } @@ -457,7 +457,7 @@ private: jassert (data.getDataSize() > 0); // no suitable sized images? out.write ("icns", 4); - out.writeIntBigEndian (data.getDataSize() + 8); + out.writeIntBigEndian ((int) data.getDataSize() + 8); out << data; } diff --git a/extras/Introjucer/Source/Utility/jucer_CodeHelpers.cpp b/extras/Introjucer/Source/Utility/jucer_CodeHelpers.cpp index 504d8078f0..fd58970235 100644 --- a/extras/Introjucer/Source/Utility/jucer_CodeHelpers.cpp +++ b/extras/Introjucer/Source/Utility/jucer_CodeHelpers.cpp @@ -401,7 +401,7 @@ namespace CodeHelpers } //============================================================================== - static unsigned int calculateHash (const String& s, const int hashMultiplier) + static unsigned int calculateHash (const String& s, const unsigned int hashMultiplier) { const char* t = s.toUTF8(); unsigned int hash = 0; @@ -411,9 +411,9 @@ namespace CodeHelpers return hash; } - static int findBestHashMultiplier (const StringArray& strings) + static unsigned int findBestHashMultiplier (const StringArray& strings) { - int v = 31; + unsigned int v = 31; for (;;) { @@ -445,19 +445,19 @@ namespace CodeHelpers { jassert (strings.size() == codeToExecute.size()); const String indent (String::repeatedString (" ", indentLevel)); - const int hashMultiplier = findBestHashMultiplier (strings); + const unsigned int hashMultiplier = findBestHashMultiplier (strings); out << indent << "unsigned int hash = 0;" << newLine << indent << "if (" << utf8PointerVariable << " != 0)" << newLine << indent << " while (*" << utf8PointerVariable << " != 0)" << newLine - << indent << " hash = " << hashMultiplier << " * hash + (unsigned int) *" << utf8PointerVariable << "++;" << newLine + << indent << " hash = " << (int) hashMultiplier << " * hash + (unsigned int) *" << utf8PointerVariable << "++;" << newLine << newLine << indent << "switch (hash)" << newLine << indent << "{" << newLine; for (int i = 0; i < strings.size(); ++i) { - out << indent << " case 0x" << hexString8Digits (calculateHash (strings[i], hashMultiplier)) + out << indent << " case 0x" << hexString8Digits ((int) calculateHash (strings[i], hashMultiplier)) << ": " << codeToExecute[i] << newLine; } diff --git a/extras/JuceDemo/Source/demos/TreeViewDemo.cpp b/extras/JuceDemo/Source/demos/TreeViewDemo.cpp index 287b470819..552b594105 100644 --- a/extras/JuceDemo/Source/demos/TreeViewDemo.cpp +++ b/extras/JuceDemo/Source/demos/TreeViewDemo.cpp @@ -56,7 +56,7 @@ public: g.fillAll (Colours::blue.withAlpha (0.3f)); // use a "colour" attribute in the xml tag for this node to set the text colour.. - g.setColour (Colour ((uint32) xml.getStringAttribute ("colour", "ff000000").getHexValue32())); + g.setColour (Colour::fromString (xml.getStringAttribute ("colour", "ff000000"))); g.setFont (height * 0.7f); diff --git a/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp index b7f1885d2a..f40e84aa06 100644 --- a/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp @@ -753,7 +753,7 @@ public: else if (chunkType == chunkName ("axml")) { MemoryBlock axml; - input->readIntoMemoryBlock (axml, (size_t) length); + input->readIntoMemoryBlock (axml, (ssize_t) length); AXMLChunk::addToMetadata (metadataValues, axml.toString()); } else if (chunkType == chunkName ("LIST")) @@ -967,13 +967,10 @@ public: writeFailed = true; return false; } - else - { - bytesWritten += bytes; - lengthInSamples += (uint64) numSamples; - return true; - } + bytesWritten += bytes; + lengthInSamples += (uint64) numSamples; + return true; } private: @@ -1107,7 +1104,7 @@ private: usesFloatingPointData = (bitsPerSample == 32); } - static int chunkSize (const MemoryBlock& data) noexcept { return data.getSize() > 0 ? (8 + data.getSize()) : 0; } + static size_t chunkSize (const MemoryBlock& data) noexcept { return data.getSize() > 0 ? (8 + data.getSize()) : 0; } void writeChunkHeader (int chunkType, int size) const { diff --git a/modules/juce_core/misc/juce_Uuid.cpp b/modules/juce_core/misc/juce_Uuid.cpp index 9df787f4a1..ce134b69b1 100644 --- a/modules/juce_core/misc/juce_Uuid.cpp +++ b/modules/juce_core/misc/juce_Uuid.cpp @@ -26,32 +26,13 @@ ============================================================================== */ -namespace -{ - int64 getRandomSeedFromMACAddresses() - { - Array result; - MACAddress::findAllAddresses (result); - - Random r; - for (int i = 0; i < result.size(); ++i) - r.combineSeed (result[i].toInt64()); - return r.nextInt64(); - } -} - -//============================================================================== Uuid::Uuid() { - // The normal random seeding is pretty good, but we'll throw some MAC addresses - // into the mix too, to make it very very unlikely that two UUIDs will ever be the same.. - - static Random r1 (getRandomSeedFromMACAddresses()); - Random r2; + Random r; for (size_t i = 0; i < sizeof (uuid); ++i) - uuid[i] = (uint8) (r1.nextInt() ^ r2.nextInt()); + uuid[i] = (uint8) (r.nextInt (256)); } Uuid::~Uuid() noexcept {} diff --git a/modules/juce_core/text/juce_String.cpp b/modules/juce_core/text/juce_String.cpp index 139c2bb4b2..d62ce3b0d4 100644 --- a/modules/juce_core/text/juce_String.cpp +++ b/modules/juce_core/text/juce_String.cpp @@ -637,7 +637,7 @@ void String::appendCharPointer (const CharPointerType startOfTextToAppend, preallocateBytes (byteOffsetOfNull + (size_t) extraBytesNeeded); CharPointerType::CharType* const newStringStart = addBytesToPointer (text.getAddress(), (int) byteOffsetOfNull); - memcpy (newStringStart, startOfTextToAppend.getAddress(), extraBytesNeeded); + memcpy (newStringStart, startOfTextToAppend.getAddress(), (size_t) extraBytesNeeded); CharPointerType (addBytesToPointer (newStringStart, extraBytesNeeded)).writeNull(); } } diff --git a/modules/juce_graphics/geometry/juce_EdgeTable.cpp b/modules/juce_graphics/geometry/juce_EdgeTable.cpp index 4776a639c9..c3846f582c 100644 --- a/modules/juce_graphics/geometry/juce_EdgeTable.cpp +++ b/modules/juce_graphics/geometry/juce_EdgeTable.cpp @@ -336,7 +336,7 @@ void EdgeTable::sanitiseLevels (const bool useNonZeroWinding) noexcept if (items[i].x == items[i + 1].x) { items[i].level += items[i + 1].level; - memmove (items + i + 1, items + i + 2, (num - i - 2) * sizeof (LineItem)); + memmove (items + i + 1, items + i + 2, (size_t) (num - i - 2) * sizeof (LineItem)); --num; --lineStart[0]; --i; diff --git a/modules/juce_graphics/image_formats/juce_JPEGLoader.cpp b/modules/juce_graphics/image_formats/juce_JPEGLoader.cpp index 2d2a6a4879..5788c2c1da 100644 --- a/modules/juce_graphics/image_formats/juce_JPEGLoader.cpp +++ b/modules/juce_graphics/image_formats/juce_JPEGLoader.cpp @@ -166,7 +166,7 @@ namespace JPEGHelpers decompStruct->src->next_input_byte += num; num = jmin (num, (long) decompStruct->src->bytes_in_buffer); - decompStruct->src->bytes_in_buffer -= num; + decompStruct->src->bytes_in_buffer -= (size_t) num; } static boolean jpegFill (j_decompress_ptr) diff --git a/modules/juce_graphics/image_formats/juce_PNGLoader.cpp b/modules/juce_graphics/image_formats/juce_PNGLoader.cpp index 36fb799a1c..4ee36abaae 100644 --- a/modules/juce_graphics/image_formats/juce_PNGLoader.cpp +++ b/modules/juce_graphics/image_formats/juce_PNGLoader.cpp @@ -401,10 +401,10 @@ Image PNGImageFormat::decodeImage (InputStream& in) // Load the image into a temp buffer in the pnglib format.. const size_t lineStride = width * 4; - HeapBlock tempBuffer (height * lineStride); + HeapBlock tempBuffer (height * lineStride); - HeapBlock rows (height); - for (int y = (int) height; --y >= 0;) + HeapBlock rows (height); + for (size_t y = 0; y < height; ++y) rows[y] = (png_bytep) (tempBuffer + lineStride * y); try diff --git a/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm b/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm index 407f32f938..6bdd835697 100644 --- a/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm +++ b/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm @@ -527,7 +527,7 @@ void CoreGraphicsContext::drawLine (const Line& line) void CoreGraphicsContext::fillRectList (const RectangleList& list) { - HeapBlock rects (list.getNumRectangles()); + HeapBlock rects ((size_t) list.getNumRectangles()); size_t num = 0; for (const Rectangle* r = list.begin(), * const e = list.end(); r != e; ++r)