mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fixed some pedantic warnings.
This commit is contained in:
parent
3ab3c79589
commit
fc772941d6
15 changed files with 30 additions and 55 deletions
|
|
@ -30,7 +30,7 @@ namespace AppearanceColours
|
|||
struct ColourInfo
|
||||
{
|
||||
const char* name;
|
||||
uint32 colourID;
|
||||
int colourID;
|
||||
bool mustBeOpaque;
|
||||
bool applyToEditorOnly;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,32 +26,13 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
namespace
|
||||
{
|
||||
int64 getRandomSeedFromMACAddresses()
|
||||
{
|
||||
Array<MACAddress> 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 {}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 <uint8> tempBuffer (height * lineStride);
|
||||
HeapBlock<uint8> tempBuffer (height * lineStride);
|
||||
|
||||
HeapBlock <png_bytep> rows (height);
|
||||
for (int y = (int) height; --y >= 0;)
|
||||
HeapBlock<png_bytep> rows (height);
|
||||
for (size_t y = 0; y < height; ++y)
|
||||
rows[y] = (png_bytep) (tempBuffer + lineStride * y);
|
||||
|
||||
try
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@ void CoreGraphicsContext::drawLine (const Line<float>& line)
|
|||
|
||||
void CoreGraphicsContext::fillRectList (const RectangleList<float>& list)
|
||||
{
|
||||
HeapBlock<CGRect> rects (list.getNumRectangles());
|
||||
HeapBlock<CGRect> rects ((size_t) list.getNumRectangles());
|
||||
|
||||
size_t num = 0;
|
||||
for (const Rectangle<float>* r = list.begin(), * const e = list.end(); r != e; ++r)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue