Browse Source

Fixed some pedantic warnings.

tags/2021-05-28
jules 12 years ago
parent
commit
fc772941d6
15 changed files with 30 additions and 55 deletions
  1. +1
    -1
      extras/Introjucer/Source/Application/jucer_AppearanceSettings.cpp
  2. +1
    -4
      extras/Introjucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.cpp
  3. +1
    -1
      extras/Introjucer/Source/ComponentEditor/jucer_BinaryResources.cpp
  4. +3
    -3
      extras/Introjucer/Source/ComponentEditor/paintelements/jucer_FillType.h
  5. +1
    -1
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h
  6. +2
    -2
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h
  7. +6
    -6
      extras/Introjucer/Source/Utility/jucer_CodeHelpers.cpp
  8. +1
    -1
      extras/JuceDemo/Source/demos/TreeViewDemo.cpp
  9. +5
    -8
      modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp
  10. +2
    -21
      modules/juce_core/misc/juce_Uuid.cpp
  11. +1
    -1
      modules/juce_core/text/juce_String.cpp
  12. +1
    -1
      modules/juce_graphics/geometry/juce_EdgeTable.cpp
  13. +1
    -1
      modules/juce_graphics/image_formats/juce_JPEGLoader.cpp
  14. +3
    -3
      modules/juce_graphics/image_formats/juce_PNGLoader.cpp
  15. +1
    -1
      modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm

+ 1
- 1
extras/Introjucer/Source/Application/jucer_AppearanceSettings.cpp View File

@@ -30,7 +30,7 @@ namespace AppearanceColours
struct ColourInfo
{
const char* name;
uint32 colourID;
int colourID;
bool mustBeOpaque;
bool applyToEditorOnly;
};


+ 1
- 4
extras/Introjucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.cpp View File

@@ -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;


+ 1
- 1
extras/Introjucer/Source/ComponentEditor/jucer_BinaryResources.cpp View File

@@ -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);
}


+ 3
- 3
extras/Introjucer/Source/ComponentEditor/paintelements/jucer_FillType.h View File

@@ -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")
{


+ 1
- 1
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h View File

@@ -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);


+ 2
- 2
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h View File

@@ -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;
}


+ 6
- 6
extras/Introjucer/Source/Utility/jucer_CodeHelpers.cpp View File

@@ -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;
}


+ 1
- 1
extras/JuceDemo/Source/demos/TreeViewDemo.cpp View File

@@ -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);


+ 5
- 8
modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp View File

@@ -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
{


+ 2
- 21
modules/juce_core/misc/juce_Uuid.cpp View File

@@ -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 {}


+ 1
- 1
modules/juce_core/text/juce_String.cpp View File

@@ -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();
}
}


+ 1
- 1
modules/juce_graphics/geometry/juce_EdgeTable.cpp View File

@@ -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;


+ 1
- 1
modules/juce_graphics/image_formats/juce_JPEGLoader.cpp View File

@@ -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)


+ 3
- 3
modules/juce_graphics/image_formats/juce_PNGLoader.cpp View File

@@ -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


+ 1
- 1
modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm View File

@@ -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…
Cancel
Save