Browse Source

Updated VC6 project. Removed some unsafe templated casts from MemoryBlock and HeapBlock.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
bc5a7a6b7e
44 changed files with 438 additions and 253 deletions
  1. +64
    -8
      build/win32/vc6/JUCE.dsp
  2. +3
    -0
      extras/audio plugins/wrapper/juce_IncludeCharacteristics.h
  3. +131
    -86
      juce_amalgamated.cpp
  4. +45
    -27
      juce_amalgamated.h
  5. +8
    -8
      src/audio/dsp/juce_AudioSampleBuffer.cpp
  6. +16
    -16
      src/audio/midi/juce_MidiBuffer.cpp
  7. +1
    -0
      src/audio/midi/juce_MidiBuffer.h
  8. +14
    -7
      src/containers/juce_HeapBlock.h
  9. +7
    -7
      src/containers/juce_MemoryBlock.cpp
  10. +0
    -8
      src/containers/juce_MemoryBlock.h
  11. +22
    -15
      src/containers/juce_ScopedPointer.h
  12. +1
    -1
      src/containers/juce_Variant.cpp
  13. +5
    -1
      src/core/juce_StandardHeader.h
  14. +2
    -0
      src/events/juce_MessageManager.h
  15. +1
    -0
      src/gui/components/buttons/juce_Button.h
  16. +9
    -3
      src/gui/components/controls/juce_Slider.cpp
  17. +15
    -6
      src/gui/components/controls/juce_TextEditor.cpp
  18. +1
    -0
      src/gui/components/controls/juce_TextEditor.h
  19. +1
    -1
      src/gui/components/juce_Component.cpp
  20. +2
    -2
      src/gui/components/layout/juce_TabbedComponent.cpp
  21. +2
    -2
      src/gui/components/mouse/juce_DragAndDropContainer.cpp
  22. +2
    -2
      src/gui/components/mouse/juce_MouseInputSource.cpp
  23. +1
    -1
      src/gui/components/mouse/juce_MouseInputSource.h
  24. +1
    -0
      src/gui/components/special/juce_OpenGLComponent.h
  25. +1
    -1
      src/gui/graphics/contexts/juce_EdgeTable.cpp
  26. +1
    -1
      src/gui/graphics/contexts/juce_EdgeTable.h
  27. +2
    -2
      src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp
  28. +7
    -2
      src/gui/graphics/drawables/juce_DrawableComposite.cpp
  29. +1
    -1
      src/gui/graphics/geometry/juce_PathIterator.h
  30. +11
    -5
      src/gui/graphics/geometry/juce_Rectangle.h
  31. +16
    -4
      src/gui/graphics/imaging/juce_ImageConvolutionKernel.cpp
  32. +5
    -11
      src/gui/graphics/imaging/juce_ImageConvolutionKernel.h
  33. +3
    -0
      src/io/files/juce_ZipFile.h
  34. +2
    -2
      src/io/network/juce_URL.cpp
  35. +1
    -0
      src/native/juce_mac_NativeCode.mm
  36. +2
    -2
      src/native/linux/juce_linux_Audio.cpp
  37. +4
    -3
      src/native/linux/juce_linux_Clipboard.cpp
  38. +1
    -1
      src/native/linux/juce_linux_JackAudio.cpp
  39. +13
    -6
      src/native/linux/juce_linux_Windowing.cpp
  40. +2
    -2
      src/native/mac/juce_mac_CoreAudio.cpp
  41. +6
    -5
      src/native/mac/juce_mac_Fonts.mm
  42. +1
    -1
      src/native/windows/juce_win32_DirectSound.cpp
  43. +2
    -2
      src/native/windows/juce_win32_Fonts.cpp
  44. +3
    -1
      src/text/juce_XmlElement.cpp

+ 64
- 8
build/win32/vc6/JUCE.dsp View File

@@ -887,10 +887,6 @@ SOURCE=..\..\..\src\gui\graphics\geometry\juce_PathStrokeType.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\src\gui\graphics\geometry\juce_Point.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\gui\graphics\geometry\juce_Point.h SOURCE=..\..\..\src\gui\graphics\geometry\juce_Point.h
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -903,10 +899,6 @@ SOURCE=..\..\..\src\gui\graphics\geometry\juce_PositionedRectangle.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\src\gui\graphics\geometry\juce_Rectangle.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\gui\graphics\geometry\juce_Rectangle.h SOURCE=..\..\..\src\gui\graphics\geometry\juce_Rectangle.h
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -1518,6 +1510,14 @@ SOURCE=..\..\..\src\gui\components\mouse\juce_MouseHoverDetector.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\src\gui\components\mouse\juce_MouseInputSource.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\gui\components\mouse\juce_MouseInputSource.h
# End Source File
# Begin Source File
SOURCE=..\..\..\src\gui\components\mouse\juce_MouseListener.cpp SOURCE=..\..\..\src\gui\components\mouse\juce_MouseListener.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -1861,6 +1861,38 @@ SOURCE=..\..\..\src\gui\components\properties\juce_TextPropertyComponent.cpp
SOURCE=..\..\..\src\gui\components\properties\juce_TextPropertyComponent.h SOURCE=..\..\..\src\gui\components\properties\juce_TextPropertyComponent.h
# End Source File # End Source File
# End Group # End Group
# Begin Group "codeeditor"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\src\gui\components\code_editor\juce_CodeDocument.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\gui\components\code_editor\juce_CodeDocument.h
# End Source File
# Begin Source File
SOURCE=..\..\..\src\gui\components\code_editor\juce_CodeEditorComponent.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\gui\components\code_editor\juce_CodeEditorComponent.h
# End Source File
# Begin Source File
SOURCE=..\..\..\src\gui\components\code_editor\juce_CodeTokeniser.h
# End Source File
# Begin Source File
SOURCE=..\..\..\src\gui\components\code_editor\juce_CPlusPlusCodeTokeniser.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\gui\components\code_editor\juce_CPlusPlusCodeTokeniser.h
# End Source File
# End Group
# Begin Source File # Begin Source File
SOURCE=..\..\..\src\gui\components\juce_Component.cpp SOURCE=..\..\..\src\gui\components\juce_Component.cpp
@@ -2092,6 +2124,14 @@ SOURCE=..\..\..\src\containers\juce_MemoryBlock.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\src\containers\juce_NamedValueSet.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\containers\juce_NamedValueSet.h
# End Source File
# Begin Source File
SOURCE=..\..\..\src\containers\juce_OwnedArray.h SOURCE=..\..\..\src\containers\juce_OwnedArray.h
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -2120,6 +2160,14 @@ SOURCE=..\..\..\src\containers\juce_SparseSet.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\src\containers\juce_Value.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\containers\juce_Value.h
# End Source File
# Begin Source File
SOURCE=..\..\..\src\containers\juce_ValueTree.cpp SOURCE=..\..\..\src\containers\juce_ValueTree.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -2195,6 +2243,14 @@ SOURCE=..\..\..\src\io\files\juce_NamedPipe.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\src\io\files\juce_TemporaryFile.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\io\files\juce_TemporaryFile.h
# End Source File
# Begin Source File
SOURCE=..\..\..\src\io\files\juce_ZipFile.cpp SOURCE=..\..\..\src\io\files\juce_ZipFile.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File


+ 3
- 0
extras/audio plugins/wrapper/juce_IncludeCharacteristics.h View File

@@ -106,5 +106,8 @@
#error "You need to define the JucePlugin_AUCocoaViewClassName value in your JucePluginCharacteristics.h file!" #error "You need to define the JucePlugin_AUCocoaViewClassName value in your JucePluginCharacteristics.h file!"
#endif #endif
#if ! defined (JUCE_ObjCExtraSuffix)
#error "To avoid objective-C name clashes with other plugins, you need to define the JUCE_ObjCExtraSuffix value in your JucePluginCharacteristics.h file!"
#endif
#endif // __JUCE_INCLUDECHARACTERISTICS_JUCEHEADER__ #endif // __JUCE_INCLUDECHARACTERISTICS_JUCEHEADER__

+ 131
- 86
juce_amalgamated.cpp View File

@@ -3066,7 +3066,7 @@ void MemoryBlock::append (const void* const srcData,


void MemoryBlock::copyFrom (const void* const src, int offset, size_t num) throw() void MemoryBlock::copyFrom (const void* const src, int offset, size_t num) throw()
{ {
const char* d = (const char*) src;
const char* d = static_cast<const char*> (src);


if (offset < 0) if (offset < 0)
{ {
@@ -3084,7 +3084,7 @@ void MemoryBlock::copyFrom (const void* const src, int offset, size_t num) throw


void MemoryBlock::copyTo (void* const dst, int offset, size_t num) const throw() void MemoryBlock::copyTo (void* const dst, int offset, size_t num) const throw()
{ {
char* d = (char*) dst;
char* d = static_cast<char*> (dst);


if (offset < 0) if (offset < 0)
{ {
@@ -3161,16 +3161,16 @@ void MemoryBlock::setBitRange (const size_t bitRangeStart, size_t numBits, int b
{ {
size_t byte = bitRangeStart >> 3; size_t byte = bitRangeStart >> 3;
int offsetInByte = bitRangeStart & 7; int offsetInByte = bitRangeStart & 7;
unsigned int mask = ~((((unsigned int)0xffffffff) << (32 - numBits)) >> (32 - numBits));
unsigned int mask = ~((((unsigned int) 0xffffffff) << (32 - numBits)) >> (32 - numBits));


while (numBits > 0 && (size_t) byte < size) while (numBits > 0 && (size_t) byte < size)
{ {
const int bitsThisTime = jmin ((int) numBits, 8 - offsetInByte); const int bitsThisTime = jmin ((int) numBits, 8 - offsetInByte);


const unsigned int tempMask = (mask << offsetInByte) | ~((((unsigned int)0xffffffff) >> offsetInByte) << offsetInByte);
const unsigned int tempMask = (mask << offsetInByte) | ~((((unsigned int) 0xffffffff) >> offsetInByte) << offsetInByte);
const unsigned int tempBits = bitsToSet << offsetInByte; const unsigned int tempBits = bitsToSet << offsetInByte;


data[byte] = (char)((data[byte] & tempMask) | tempBits);
data[byte] = (char) ((data[byte] & tempMask) | tempBits);


++byte; ++byte;
numBits -= bitsThisTime; numBits -= bitsThisTime;
@@ -3196,7 +3196,7 @@ void MemoryBlock::loadFromHexString (const String& hex) throw()


for (;;) for (;;)
{ {
const tchar c = hex [i++];
const juce_wchar c = hex [i++];


if (c >= T('0') && c <= T('9')) if (c >= T('0') && c <= T('9'))
{ {
@@ -3215,7 +3215,7 @@ void MemoryBlock::loadFromHexString (const String& hex) throw()
} }
else if (c == 0) else if (c == 0)
{ {
setSize ((int) (dest - data));
setSize (static_cast <size_t> (dest - data));
return; return;
} }
} }
@@ -3713,7 +3713,7 @@ void var::writeToStream (OutputStream& output) const
const int len = value.stringValue->getNumBytesAsUTF8() + 1; const int len = value.stringValue->getNumBytesAsUTF8() + 1;
output.writeCompressedInt (len + 1); output.writeCompressedInt (len + 1);
output.writeByte (5); output.writeByte (5);
HeapBlock <uint8> temp (len);
HeapBlock<char> temp (len);
value.stringValue->copyToUTF8 (temp, len); value.stringValue->copyToUTF8 (temp, len);
output.write (temp, len); output.write (temp, len);
break; break;
@@ -8393,8 +8393,8 @@ const StringPairArray& URL::getMimeTypesOfUploadFiles() const
const String URL::removeEscapeChars (const String& s) const String URL::removeEscapeChars (const String& s)
{ {
const int len = s.length(); const int len = s.length();
HeapBlock <uint8> resultUTF8 (len * 4);
uint8* r = resultUTF8;
HeapBlock <char> resultUTF8 (len * 4);
char* r = resultUTF8;


for (int i = 0; i < len; ++i) for (int i = 0; i < len; ++i)
{ {
@@ -14041,6 +14041,9 @@ XmlElement::XmlElement (const String& tagName_) throw()
{ {
// the tag name mustn't be empty, or it'll look like a text element! // the tag name mustn't be empty, or it'll look like a text element!
jassert (tagName_.containsNonWhitespaceChars()) jassert (tagName_.containsNonWhitespaceChars())

// The tag can't contain spaces or other characters that would create invalid XML!
jassert (! tagName_.containsAnyOf (T(" <>/&")));
} }


XmlElement::XmlElement (int /*dummy*/) throw() XmlElement::XmlElement (int /*dummy*/) throw()
@@ -25671,7 +25674,7 @@ void AudioSampleBuffer::allocateData()
const size_t channelListSize = (numChannels + 1) * sizeof (float*); const size_t channelListSize = (numChannels + 1) * sizeof (float*);
allocatedBytes = (int) (numChannels * size * sizeof (float) + channelListSize + 32); allocatedBytes = (int) (numChannels * size * sizeof (float) + channelListSize + 32);
allocatedData.malloc (allocatedBytes); allocatedData.malloc (allocatedBytes);
channels = (float**) allocatedData;
channels = reinterpret_cast <float**> (allocatedData.getData());


float* chan = (float*) (allocatedData + channelListSize); float* chan = (float*) (allocatedData + channelListSize);
for (int i = 0; i < numChannels; ++i) for (int i = 0; i < numChannels; ++i)
@@ -25714,12 +25717,12 @@ void AudioSampleBuffer::allocateChannels (float** const dataToReferTo)
// (try to avoid doing a malloc here, as that'll blow up things like Pro-Tools) // (try to avoid doing a malloc here, as that'll blow up things like Pro-Tools)
if (numChannels < numElementsInArray (preallocatedChannelSpace)) if (numChannels < numElementsInArray (preallocatedChannelSpace))
{ {
channels = (float**) preallocatedChannelSpace;
channels = static_cast <float**> (preallocatedChannelSpace);
} }
else else
{ {
allocatedData.malloc (numChannels + 1, sizeof (float*)); allocatedData.malloc (numChannels + 1, sizeof (float*));
channels = (float**) allocatedData;
channels = reinterpret_cast <float**> (allocatedData.getData());
} }


for (int i = 0; i < numChannels; ++i) for (int i = 0; i < numChannels; ++i)
@@ -25773,8 +25776,8 @@ void AudioSampleBuffer::setSize (const int newNumChannels,
const int numChansToCopy = jmin (numChannels, newNumChannels); const int numChansToCopy = jmin (numChannels, newNumChannels);
const size_t numBytesToCopy = sizeof (float) * jmin (newNumSamples, size); const size_t numBytesToCopy = sizeof (float) * jmin (newNumSamples, size);


float** const newChannels = (float**) newData;
float* newChan = (float*) (newData + channelListSize);
float** const newChannels = reinterpret_cast <float**> (newData.getData());
float* newChan = reinterpret_cast <float*> (newData + channelListSize);
for (int i = 0; i < numChansToCopy; ++i) for (int i = 0; i < numChansToCopy; ++i)
{ {
memcpy (newChan, channels[i], numBytesToCopy); memcpy (newChan, channels[i], numBytesToCopy);
@@ -25784,7 +25787,7 @@ void AudioSampleBuffer::setSize (const int newNumChannels,


allocatedData.swapWith (newData); allocatedData.swapWith (newData);
allocatedBytes = (int) newTotalBytes; allocatedBytes = (int) newTotalBytes;
channels = (float**) allocatedData;
channels = newChannels;
} }
else else
{ {
@@ -25797,10 +25800,10 @@ void AudioSampleBuffer::setSize (const int newNumChannels,
{ {
allocatedBytes = newTotalBytes; allocatedBytes = newTotalBytes;
allocatedData.allocate (newTotalBytes, clearExtraSpace); allocatedData.allocate (newTotalBytes, clearExtraSpace);
channels = (float**) allocatedData;
channels = reinterpret_cast <float**> (allocatedData.getData());
} }


float* chan = (float*) (allocatedData + channelListSize);
float* chan = reinterpret_cast <float*> (allocatedData + channelListSize);
for (int i = 0; i < newNumChannels; ++i) for (int i = 0; i < newNumChannels; ++i)
{ {
channels[i] = chan; channels[i] = chan;
@@ -26583,12 +26586,12 @@ void MidiBuffer::clear() throw()
void MidiBuffer::clear (const int startSample, void MidiBuffer::clear (const int startSample,
const int numSamples) throw() const int numSamples) throw()
{ {
uint8* const start = findEventAfter (data, startSample - 1);
uint8* const start = findEventAfter (getData(), startSample - 1);
uint8* const end = findEventAfter (start, startSample + numSamples - 1); uint8* const end = findEventAfter (start, startSample + numSamples - 1);


if (end > start) if (end > start)
{ {
const size_t bytesToMove = (size_t) (bytesUsed - (end - (uint8*) data.getData()));
const size_t bytesToMove = (size_t) (bytesUsed - (end - getData()));


if (bytesToMove > 0) if (bytesToMove > 0)
memmove (start, end, bytesToMove); memmove (start, end, bytesToMove);
@@ -26645,8 +26648,8 @@ void MidiBuffer::addEvent (const uint8* const newData,
int spaceNeeded = bytesUsed + numBytes + 6; int spaceNeeded = bytesUsed + numBytes + 6;
data.ensureSize ((spaceNeeded + spaceNeeded / 2 + 8) & ~7); data.ensureSize ((spaceNeeded + spaceNeeded / 2 + 8) & ~7);


uint8* d = findEventAfter ((uint8*) data.getData(), sampleNumber);
const size_t bytesToMove = (size_t) (bytesUsed - (d - (uint8*) data.getData()));
uint8* d = findEventAfter (getData(), sampleNumber);
const size_t bytesToMove = (size_t) (bytesUsed - (d - getData()));


if (bytesToMove > 0) if (bytesToMove > 0)
memmove (d + numBytes + 6, memmove (d + numBytes + 6,
@@ -26690,7 +26693,7 @@ bool MidiBuffer::isEmpty() const throw()
int MidiBuffer::getNumEvents() const throw() int MidiBuffer::getNumEvents() const throw()
{ {
int n = 0; int n = 0;
const uint8* d = (uint8*) data.getData();
const uint8* d = getData();
const uint8* const end = d + bytesUsed; const uint8* const end = d + bytesUsed;


while (d < end) while (d < end)
@@ -26705,7 +26708,7 @@ int MidiBuffer::getNumEvents() const throw()


int MidiBuffer::getFirstEventTime() const throw() int MidiBuffer::getFirstEventTime() const throw()
{ {
return (bytesUsed > 0) ? *(const int*) data.getData() : 0;
return (bytesUsed > 0) ? *reinterpret_cast <const int*> (data.getData()) : 0;
} }


int MidiBuffer::getLastEventTime() const throw() int MidiBuffer::getLastEventTime() const throw()
@@ -26713,7 +26716,7 @@ int MidiBuffer::getLastEventTime() const throw()
if (bytesUsed == 0) if (bytesUsed == 0)
return 0; return 0;


const uint8* d = (uint8*) data.getData();
const uint8* d = getData();
const uint8* const endData = d + bytesUsed; const uint8* const endData = d + bytesUsed;


for (;;) for (;;)
@@ -26729,7 +26732,7 @@ int MidiBuffer::getLastEventTime() const throw()


uint8* MidiBuffer::findEventAfter (uint8* d, const int samplePosition) const throw() uint8* MidiBuffer::findEventAfter (uint8* d, const int samplePosition) const throw()
{ {
const uint8* const endData = ((uint8*) data.getData()) + bytesUsed;
const uint8* const endData = getData() + bytesUsed;


while (d < endData && *(int*) d <= samplePosition) while (d < endData && *(int*) d <= samplePosition)
{ {
@@ -26742,7 +26745,7 @@ uint8* MidiBuffer::findEventAfter (uint8* d, const int samplePosition) const thr


MidiBuffer::Iterator::Iterator (const MidiBuffer& buffer_) throw() MidiBuffer::Iterator::Iterator (const MidiBuffer& buffer_) throw()
: buffer (buffer_), : buffer (buffer_),
data ((uint8*) buffer_.data.getData())
data (buffer_.getData())
{ {
} }


@@ -26752,10 +26755,10 @@ MidiBuffer::Iterator::~Iterator() throw()


void MidiBuffer::Iterator::setNextSamplePosition (const int samplePosition) throw() void MidiBuffer::Iterator::setNextSamplePosition (const int samplePosition) throw()
{ {
data = buffer.data;
const uint8* dataEnd = ((uint8*) buffer.data.getData()) + buffer.bytesUsed;
data = buffer.getData();
const uint8* dataEnd = data + buffer.bytesUsed;


while (data < dataEnd && *(int*) data < samplePosition)
while (data < dataEnd && *reinterpret_cast<const int*> (data) < samplePosition)
{ {
data += 4; data += 4;
data += 2 + *(uint16*) data; data += 2 + *(uint16*) data;
@@ -26766,7 +26769,7 @@ bool MidiBuffer::Iterator::getNextEvent (const uint8* &midiData,
int& numBytes, int& numBytes,
int& samplePosition) throw() int& samplePosition) throw()
{ {
if (data >= ((uint8*) buffer.data.getData()) + buffer.bytesUsed)
if (data >= buffer.getData() + buffer.bytesUsed)
return false; return false;


samplePosition = *(int*) data; samplePosition = *(int*) data;
@@ -26782,12 +26785,12 @@ bool MidiBuffer::Iterator::getNextEvent (const uint8* &midiData,
bool MidiBuffer::Iterator::getNextEvent (MidiMessage& result, bool MidiBuffer::Iterator::getNextEvent (MidiMessage& result,
int& samplePosition) throw() int& samplePosition) throw()
{ {
if (data >= ((uint8*) buffer.data.getData()) + buffer.bytesUsed)
if (data >= buffer.getData() + buffer.bytesUsed)
return false; return false;


samplePosition = *(int*) data;
samplePosition = *reinterpret_cast <const int*> (data);
data += 4; data += 4;
const int numBytes = *(uint16*) data;
const int numBytes = *reinterpret_cast <const uint16*> (data);
data += 2; data += 2;
result = MidiMessage (data, numBytes, samplePosition); result = MidiMessage (data, numBytes, samplePosition);
data += numBytes; data += numBytes;
@@ -40259,7 +40262,7 @@ static const var::identifier getColourPropertyId (const int colourId)
{ {
String s; String s;
s.preallocateStorage (18); s.preallocateStorage (18);
s << T("jcclr_") << colourId;
s << T("jcclr_") << String::toHexString (colourId);
return s; return s;
} }


@@ -48786,7 +48789,9 @@ void Slider::setValue (double newValue,


if (popupDisplay != 0) if (popupDisplay != 0)
{ {
((SliderPopupDisplayComponent*) popupDisplay)->updatePosition (getTextFromValue (newValue));
static_cast <SliderPopupDisplayComponent*> (static_cast <Component*> (popupDisplay))
->updatePosition (getTextFromValue (newValue));

popupDisplay->repaint(); popupDisplay->repaint();
} }


@@ -48844,7 +48849,9 @@ void Slider::setMinValue (double newValue, const bool sendUpdateMessage, const b


if (popupDisplay != 0) if (popupDisplay != 0)
{ {
((SliderPopupDisplayComponent*) popupDisplay)->updatePosition (getTextFromValue (newValue));
static_cast <SliderPopupDisplayComponent*> (static_cast <Component*> (popupDisplay))
->updatePosition (getTextFromValue (newValue));

popupDisplay->repaint(); popupDisplay->repaint();
} }


@@ -48884,7 +48891,9 @@ void Slider::setMaxValue (double newValue, const bool sendUpdateMessage, const b


if (popupDisplay != 0) if (popupDisplay != 0)
{ {
((SliderPopupDisplayComponent*) popupDisplay)->updatePosition (getTextFromValue (valueMax.getValue()));
static_cast <SliderPopupDisplayComponent*> (static_cast <Component*> (popupDisplay))
->updatePosition (getTextFromValue (valueMax.getValue()));

popupDisplay->repaint(); popupDisplay->repaint();
} }


@@ -49667,7 +49676,7 @@ void Slider::mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float w
&& style != TwoValueHorizontal && style != TwoValueHorizontal
&& style != TwoValueVertical) && style != TwoValueVertical)
{ {
if (maximum > minimum && ! isMouseButtonDownAnywhere())
if (maximum > minimum && ! e.mods.isAnyMouseButtonDown())
{ {
if (valueBox != 0) if (valueBox != 0)
valueBox->hideEditor (false); valueBox->hideEditor (false);
@@ -52109,8 +52118,8 @@ void TextEditor::doUndoRedo (const bool isRedo)
{ {
if (! isReadOnly()) if (! isReadOnly())
{ {
if ((isRedo) ? undoManager.redo()
: undoManager.undo())
if (isRedo ? undoManager.redo()
: undoManager.undo())
{ {
scrollToMakeSureCursorIsVisible(); scrollToMakeSureCursorIsVisible();
repaint(); repaint();
@@ -52674,7 +52683,7 @@ void TextEditor::insertTextAtCaret (const String& newText_)
const int newCaretPos = selection.getStart() + newText.length(); const int newCaretPos = selection.getStart() + newText.length();
const int insertIndex = selection.getStart(); const int insertIndex = selection.getStart();


remove (selection, &undoManager,
remove (selection, getUndoManager(),
newText.isNotEmpty() ? newCaretPos - 1 : newCaretPos); newText.isNotEmpty() ? newCaretPos - 1 : newCaretPos);


if (maxTextLength > 0) if (maxTextLength > 0)
@@ -52685,7 +52694,7 @@ void TextEditor::insertTextAtCaret (const String& newText_)
insertIndex, insertIndex,
currentFont, currentFont,
findColour (textColourId), findColour (textColourId),
&undoManager,
getUndoManager(),
newCaretPos); newCaretPos);


textChanged(); textChanged();
@@ -53137,8 +53146,12 @@ void TextEditor::addPopupMenuItems (PopupMenu& m, const MouseEvent*)
m.addSeparator(); m.addSeparator();
m.addItem (baseMenuItemID + 5, TRANS("select all")); m.addItem (baseMenuItemID + 5, TRANS("select all"));
m.addSeparator(); m.addSeparator();
m.addItem (baseMenuItemID + 6, TRANS("undo"), undoManager.canUndo());
m.addItem (baseMenuItemID + 7, TRANS("redo"), undoManager.canRedo());

if (getUndoManager() != 0)
{
m.addItem (baseMenuItemID + 6, TRANS("undo"), undoManager.canUndo());
m.addItem (baseMenuItemID + 7, TRANS("redo"), undoManager.canRedo());
}
} }


void TextEditor::performPopupMenuAction (const int menuItemID) void TextEditor::performPopupMenuAction (const int menuItemID)
@@ -53277,6 +53290,11 @@ void TextEditor::enablementChanged()
repaint(); repaint();
} }


UndoManager* TextEditor::getUndoManager() throw()
{
return isReadOnly() ? &undoManager : 0;
}

void TextEditor::clearInternal (UndoManager* const um) void TextEditor::clearInternal (UndoManager* const um)
{ {
remove (Range<int> (0, getTotalNumChars()), um, caretPosition); remove (Range<int> (0, getTotalNumChars()), um, caretPosition);
@@ -63224,7 +63242,7 @@ void TabbedComponent::clearTabs()
// be careful not to delete these components until they've been removed from the tab component // be careful not to delete these components until they've been removed from the tab component
jassert (c == 0 || c->isValidComponent()); jassert (c == 0 || c->isValidComponent());


if (c != 0 && c->getProperties() ["deleteByTabComp_"])
if (c != 0 && (bool) c->getProperties() ["deleteByTabComp_"])
delete c; delete c;
} }


@@ -63255,7 +63273,7 @@ void TabbedComponent::removeTab (const int tabIndex)
{ {
Component* const c = contentComponents [tabIndex]; Component* const c = contentComponents [tabIndex];


if (c != 0 && c->getProperties() ["deleteByTabComp_"])
if (c != 0 && (bool) c->getProperties() ["deleteByTabComp_"])
{ {
if (c == panelComponent) if (c == panelComponent)
panelComponent = 0; panelComponent = 0;
@@ -69644,7 +69662,7 @@ public:


~DragImageComponent() ~DragImageComponent()
{ {
if ((DragImageComponent*) owner->dragImageComponent == this)
if (owner->dragImageComponent == this)
owner->dragImageComponent.release(); owner->dragImageComponent.release();


if (! mouseDragSourceWatcher->hasBeenDeleted()) if (! mouseDragSourceWatcher->hasBeenDeleted())
@@ -69982,7 +70000,7 @@ void DragAndDropContainer::startDragging (const String& sourceDescription,
else else
thisComp->addChildComponent (dragImageComponent); thisComp->addChildComponent (dragImageComponent);


((DragImageComponent*) dragImageComponent)->updateLocation (false, lastMouseDown);
static_cast <DragImageComponent*> (static_cast <Component*> (dragImageComponent))->updateLocation (false, lastMouseDown);
dragImageComponent->setVisible (true); dragImageComponent->setVisible (true);
} }
else else
@@ -80030,7 +80048,7 @@ void EdgeTable::clipToEdgeTable (const EdgeTable& other)
} }
} }


void EdgeTable::clipLineToMask (int x, int y, uint8* mask, int maskStride, int numPixels) throw()
void EdgeTable::clipLineToMask (int x, int y, const uint8* mask, int maskStride, int numPixels) throw()
{ {
y -= bounds.getY(); y -= bounds.getY();


@@ -82024,10 +82042,10 @@ public:
scratchBuffer.malloc (scratchSize); scratchBuffer.malloc (scratchSize);
} }


uint8* mask = (uint8*) scratchBuffer;
y = y_; y = y_;
generate ((SrcPixelType*) mask, x, width);
generate (scratchBuffer, x, width);


const uint8* mask = reinterpret_cast <uint8*> (scratchBuffer.getData());
if (sizeof (SrcPixelType) == sizeof (PixelARGB)) if (sizeof (SrcPixelType) == sizeof (PixelARGB))
mask += PixelARGB::indexA; mask += PixelARGB::indexA;


@@ -83410,8 +83428,13 @@ const Rectangle<float> DrawableComposite::getBounds() const
const Drawable* const d = drawables.getUnchecked(i); const Drawable* const d = drawables.getUnchecked(i);
const AffineTransform* const t = transforms.getUnchecked(i); const AffineTransform* const t = transforms.getUnchecked(i);


bounds = bounds.getUnion (t == 0 ? d->getBounds()
: d->getBounds().transformed (*t));
const Rectangle<float> childBounds (t == 0 ? d->getBounds()
: d->getBounds().transformed (*t));

if (bounds.isEmpty())
bounds = childBounds;
else if (! childBounds.isEmpty())
bounds = bounds.getUnion (childBounds);
} }


return bounds; return bounds;
@@ -91922,9 +91945,21 @@ ImageConvolutionKernel::~ImageConvolutionKernel()
{ {
} }


void ImageConvolutionKernel::setKernelValue (const int x,
const int y,
const float value)
float ImageConvolutionKernel::getKernelValue (const int x, const int y) const throw()
{
if (((unsigned int) x) < (unsigned int) size
&& ((unsigned int) y) < (unsigned int) size)
{
return values [x + y * size];
}
else
{
jassertfalse;
return 0;
}
}

void ImageConvolutionKernel::setKernelValue (const int x, const int y, const float value) throw()
{ {
if (((unsigned int) x) < (unsigned int) size if (((unsigned int) x) < (unsigned int) size
&& ((unsigned int) y) < (unsigned int) size) && ((unsigned int) y) < (unsigned int) size)
@@ -91933,7 +91968,7 @@ void ImageConvolutionKernel::setKernelValue (const int x,
} }
else else
{ {
jassertfalse
jassertfalse;
} }
} }


@@ -217451,12 +217486,12 @@ public:


if (bufSize > 0) if (bufSize > 0)
{ {
HeapBlock <char> data (bufSize);
HeapBlock<char> data (bufSize);


GetGlyphOutline (dc, character, GGO_NATIVE, &gm, GetGlyphOutline (dc, character, GGO_NATIVE, &gm,
bufSize, data, &identityMatrix); bufSize, data, &identityMatrix);


const TTPOLYGONHEADER* pheader = (TTPOLYGONHEADER*) data;
const TTPOLYGONHEADER* pheader = reinterpret_cast<TTPOLYGONHEADER*> (data.getData());


const float scaleX = 1.0f / height; const float scaleX = 1.0f / height;
const float scaleY = -1.0f / height; const float scaleY = -1.0f / height;
@@ -225948,7 +225983,7 @@ public:
{ {
JUCE_TRY JUCE_TRY
{ {
callback->audioDeviceIOCallback ((const float**) inputBuffers,
callback->audioDeviceIOCallback (const_cast <const float**> (inputBuffers.getData()),
numInputBuffers, numInputBuffers,
outputBuffers, outputBuffers,
numOutputBuffers, numOutputBuffers,
@@ -230363,8 +230398,9 @@ void juce_handleSelectionRequest (XSelectionRequestEvent &evt)
numDataItems = 2; numDataItems = 2;
propertyFormat = 32; // atoms are 32-bit propertyFormat = 32; // atoms are 32-bit
data.calloc (numDataItems * 4); data.calloc (numDataItems * 4);
((Atom*) data)[0] = atom_UTF8_STRING;
((Atom*) data)[1] = XA_STRING;
Atom* atoms = reinterpret_cast<Atom*> (data.getData());
atoms[0] = atom_UTF8_STRING;
atoms[1] = XA_STRING;
} }
} }
else else
@@ -230382,7 +230418,7 @@ void juce_handleSelectionRequest (XSelectionRequestEvent &evt)
XChangeProperty (evt.display, evt.requestor, XChangeProperty (evt.display, evt.requestor,
evt.property, evt.target, evt.property, evt.target,
propertyFormat /* 8 or 32 */, PropModeReplace, propertyFormat /* 8 or 32 */, PropModeReplace,
(const unsigned char*) data, numDataItems);
reinterpret_cast<const unsigned char*> (data.getData()), numDataItems);
reply.property = evt.property; // " == success" reply.property = evt.property; // " == success"
} }
} }
@@ -232338,7 +232374,8 @@ public:
colour[index++] = image.getPixelAt (x, y).getARGB(); colour[index++] = image.getPixelAt (x, y).getARGB();


XImage* ximage = XCreateImage (display, CopyFromParent, 24, ZPixmap, XImage* ximage = XCreateImage (display, CopyFromParent, 24, ZPixmap,
0, (char*) colour, width, height, 32, 0);
0, reinterpret_cast<char*> (colour.getData()),
width, height, 32, 0);


Pixmap pixmap = XCreatePixmap (display, DefaultRootWindow (display), Pixmap pixmap = XCreatePixmap (display, DefaultRootWindow (display),
width, height, 24); width, height, 24);
@@ -232374,7 +232411,7 @@ public:
} }


return XCreatePixmapFromBitmapData (display, DefaultRootWindow (display), return XCreatePixmapFromBitmapData (display, DefaultRootWindow (display),
(char*) mask, width, height, 1, 0, 1);
reinterpret_cast<char*> (mask.getData()), width, height, 1, 0, 1);
} }


void setIcon (const Image& newIcon) void setIcon (const Image& newIcon)
@@ -232394,7 +232431,7 @@ public:
XChangeProperty (display, windowH, XChangeProperty (display, windowH,
XInternAtom (display, "_NET_WM_ICON", False), XInternAtom (display, "_NET_WM_ICON", False),
XA_CARDINAL, 32, PropModeReplace, XA_CARDINAL, 32, PropModeReplace,
(unsigned char*) data, dataSize);
reinterpret_cast<unsigned char*> (data.getData()), dataSize);


deleteIconPixmaps(); deleteIconPixmaps();


@@ -232450,7 +232487,13 @@ public:
char utf8 [64]; char utf8 [64];
zeromem (utf8, sizeof (utf8)); zeromem (utf8, sizeof (utf8));
KeySym sym; KeySym sym;
XLookupString (keyEvent, utf8, sizeof (utf8), &sym, 0);

{
const char* oldLocale = ::setlocale (LC_ALL, 0);
::setlocale (LC_ALL, "");
XLookupString (keyEvent, utf8, sizeof (utf8), &sym, 0);
::setlocale (LC_ALL, oldLocale);
}


const juce_wchar unicodeChar = *(const juce_wchar*) String::fromUTF8 (utf8, sizeof (utf8) - 1); const juce_wchar unicodeChar = *(const juce_wchar*) String::fromUTF8 (utf8, sizeof (utf8) - 1);
int keyCode = (int) unicodeChar; int keyCode = (int) unicodeChar;
@@ -234197,8 +234240,8 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot
} }
} }


Pixmap sourcePixmap = XCreatePixmapFromBitmapData (display, root, (char*) sourcePlane, cursorW, cursorH, 0xffff, 0, 1);
Pixmap maskPixmap = XCreatePixmapFromBitmapData (display, root, (char*) maskPlane, cursorW, cursorH, 0xffff, 0, 1);
Pixmap sourcePixmap = XCreatePixmapFromBitmapData (display, root, reinterpret_cast <char*> (sourcePlane.getData()), cursorW, cursorH, 0xffff, 0, 1);
Pixmap maskPixmap = XCreatePixmapFromBitmapData (display, root, reinterpret_cast <char*> (maskPlane.getData()), cursorW, cursorH, 0xffff, 0, 1);


XColor white, black; XColor white, black;
black.red = black.green = black.blue = 0; black.red = black.green = black.blue = 0;
@@ -234870,7 +234913,7 @@ public:
if (isInterleaved) if (isInterleaved)
{ {
scratch.ensureSize (sizeof (float) * numSamples * numChannelsRunning, false); scratch.ensureSize (sizeof (float) * numSamples * numChannelsRunning, false);
float* interleaved = (float*) scratch;
float* interleaved = reinterpret_cast <float*> (scratch.getData());


AudioDataConverters::interleaveSamples ((const float**) data, interleaved, numSamples, numChannelsRunning); AudioDataConverters::interleaveSamples ((const float**) data, interleaved, numSamples, numChannelsRunning);
AudioDataConverters::convertFloatToFormat (sampleFormat, interleaved, interleaved, numSamples * numChannelsRunning); AudioDataConverters::convertFloatToFormat (sampleFormat, interleaved, interleaved, numSamples * numChannelsRunning);
@@ -234908,7 +234951,7 @@ public:
if (isInterleaved) if (isInterleaved)
{ {
scratch.ensureSize (sizeof (float) * numSamples * numChannelsRunning, false); scratch.ensureSize (sizeof (float) * numSamples * numChannelsRunning, false);
float* interleaved = (float*) scratch;
float* interleaved = reinterpret_cast <float*> (scratch.getData());


snd_pcm_sframes_t num = snd_pcm_readi (handle, (void*) interleaved, numSamples); snd_pcm_sframes_t num = snd_pcm_readi (handle, (void*) interleaved, numSamples);


@@ -235989,7 +236032,7 @@ private:


if (callback != 0) if (callback != 0)
{ {
callback->audioDeviceIOCallback ((const float**) inChans, numActiveInChans,
callback->audioDeviceIOCallback (const_cast<const float**> (inChans.getData()), numActiveInChans,
outChans, numActiveOutChans, numSamples); outChans, numActiveOutChans, numSamples);
} }
else else
@@ -239619,7 +239662,7 @@ public:
if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE) if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE)
{ {
HeapBlock <NSSize> advances (length); HeapBlock <NSSize> advances (length);
[nsFont getAdvancements: advances forGlyphs: (NSGlyph*) glyphs count: length];
[nsFont getAdvancements: advances forGlyphs: reinterpret_cast<NSGlyph*> (glyphs.getData()) count: length];


for (int i = 0; i < length; ++i) for (int i = 0; i < length; ++i)
x += advances[i].width; x += advances[i].width;
@@ -239666,14 +239709,15 @@ public:
if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE) if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE)
{ {
HeapBlock <NSSize> advances (length); HeapBlock <NSSize> advances (length);
[nsFont getAdvancements: advances forGlyphs: (NSGlyph*) glyphs count: length];
NSGlyph* const nsGlyphs = reinterpret_cast<NSGlyph*> (glyphs.getData());
[nsFont getAdvancements: advances forGlyphs: nsGlyphs count: length];


float x = 0; float x = 0;
for (int i = 0; i < length; ++i) for (int i = 0; i < length; ++i)
{ {
x += advances[i].width; x += advances[i].width;
xOffsets.add (x * unitsToHeightScaleFactor); xOffsets.add (x * unitsToHeightScaleFactor);
resultGlyphs.add (((NSGlyph*) glyphs)[i]);
resultGlyphs.add (nsGlyphs[i]);
} }
} }
else else
@@ -239765,10 +239809,10 @@ private:
#endif #endif
{ {
glyphs.malloc (sizeof (NSGlyph) * length, 1); glyphs.malloc (sizeof (NSGlyph) * length, 1);
NSGlyph* const g = (NSGlyph*) glyphs;
NSGlyph* const nsGlyphs = reinterpret_cast<NSGlyph*> (glyphs.getData());


for (int i = 0; i < length; ++i) for (int i = 0; i < length; ++i)
g[i] = (NSGlyph) [nsFont _defaultGlyphForChar: text[i]];
nsGlyphs[i] = (NSGlyph) [nsFont _defaultGlyphForChar: text[i]];


return; return;
} }
@@ -244020,7 +244064,7 @@ public:
if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE) if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE)
{ {
HeapBlock <NSSize> advances (length); HeapBlock <NSSize> advances (length);
[nsFont getAdvancements: advances forGlyphs: (NSGlyph*) glyphs count: length];
[nsFont getAdvancements: advances forGlyphs: reinterpret_cast<NSGlyph*> (glyphs.getData()) count: length];


for (int i = 0; i < length; ++i) for (int i = 0; i < length; ++i)
x += advances[i].width; x += advances[i].width;
@@ -244067,14 +244111,15 @@ public:
if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE) if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE)
{ {
HeapBlock <NSSize> advances (length); HeapBlock <NSSize> advances (length);
[nsFont getAdvancements: advances forGlyphs: (NSGlyph*) glyphs count: length];
NSGlyph* const nsGlyphs = reinterpret_cast<NSGlyph*> (glyphs.getData());
[nsFont getAdvancements: advances forGlyphs: nsGlyphs count: length];


float x = 0; float x = 0;
for (int i = 0; i < length; ++i) for (int i = 0; i < length; ++i)
{ {
x += advances[i].width; x += advances[i].width;
xOffsets.add (x * unitsToHeightScaleFactor); xOffsets.add (x * unitsToHeightScaleFactor);
resultGlyphs.add (((NSGlyph*) glyphs)[i]);
resultGlyphs.add (nsGlyphs[i]);
} }
} }
else else
@@ -244166,10 +244211,10 @@ private:
#endif #endif
{ {
glyphs.malloc (sizeof (NSGlyph) * length, 1); glyphs.malloc (sizeof (NSGlyph) * length, 1);
NSGlyph* const g = (NSGlyph*) glyphs;
NSGlyph* const nsGlyphs = reinterpret_cast<NSGlyph*> (glyphs.getData());


for (int i = 0; i < length; ++i) for (int i = 0; i < length; ++i)
g[i] = (NSGlyph) [nsFont _defaultGlyphForChar: text[i]];
nsGlyphs[i] = (NSGlyph) [nsFont _defaultGlyphForChar: text[i]];


return; return;
} }
@@ -249341,7 +249386,7 @@ static bool isEventBlockedByModalComps (NSEvent* e)
case NSRightMouseUp: case NSRightMouseUp:
case NSOtherMouseUp: case NSOtherMouseUp:
case NSOtherMouseDragged: case NSOtherMouseDragged:
if (Desktop::getInstance().getMainMouseSource().isDragging() != 0)
if (Desktop::getInstance().getMainMouseSource().isDragging())
return false; return false;
break; break;


@@ -250397,7 +250442,7 @@ public:
{ {
if (inputDevice == 0) if (inputDevice == 0)
{ {
callback->audioDeviceIOCallback ((const float**) tempInputBuffers,
callback->audioDeviceIOCallback (const_cast<const float**> (inputDevice->tempInputBuffers.getData()),
numInputChans, numInputChans,
tempOutputBuffers, tempOutputBuffers,
numOutputChans, numOutputChans,
@@ -250412,7 +250457,7 @@ public:
// changed while inside our callback.. // changed while inside our callback..
const ScopedLock sl2 (inputDevice->callbackLock); const ScopedLock sl2 (inputDevice->callbackLock);


callback->audioDeviceIOCallback ((const float**) inputDevice->tempInputBuffers,
callback->audioDeviceIOCallback (const_cast<const float**> (inputDevice->tempInputBuffers.getData()),
inputDevice->numInputChans, inputDevice->numInputChans,
tempOutputBuffers, tempOutputBuffers,
numOutputChans, numOutputChans,


+ 45
- 27
juce_amalgamated.h View File

@@ -43,7 +43,7 @@


#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 51 #define JUCE_MINOR_VERSION 51
#define JUCE_BUILDNUMBER 4
#define JUCE_BUILDNUMBER 5


#define JUCE_VERSION ((JUCE_MAJOR_VERSION << 16) + (JUCE_MINOR_VERSION << 8) + JUCE_BUILDNUMBER) #define JUCE_VERSION ((JUCE_MAJOR_VERSION << 16) + (JUCE_MINOR_VERSION << 8) + JUCE_BUILDNUMBER)


@@ -491,6 +491,10 @@


// Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace). // Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace).
#if JUCE_MSVC #if JUCE_MSVC
#if (defined(_MSC_VER) && (_MSC_VER <= 1200))
#pragma warning (disable: 4284) // (spurious VC6 warning)
#endif

#pragma warning (push) #pragma warning (push)
#pragma warning (disable: 4514 4245 4100) #pragma warning (disable: 4514 4245 4100)
#endif #endif
@@ -1515,12 +1519,11 @@ public:


inline operator ElementType*() const throw() { return data; } inline operator ElementType*() const throw() { return data; }


inline operator void*() const throw() { return (void*) data; }
inline ElementType* getData() const throw() { return data; }


inline ElementType* operator->() const throw() { return data; }
inline operator void*() const throw() { return static_cast <void*> (data); }


template <class CastType>
inline operator CastType*() const throw() { return (CastType*) data; }
inline ElementType* operator->() const throw() { return data; }


template <typename IndexType> template <typename IndexType>
inline ElementType& operator[] (IndexType index) const throw() { return data [index]; } inline ElementType& operator[] (IndexType index) const throw() { return data [index]; }
@@ -1528,7 +1531,9 @@ public:
template <typename IndexType> template <typename IndexType>
inline ElementType* operator+ (IndexType index) const throw() { return data + index; } inline ElementType* operator+ (IndexType index) const throw() { return data + index; }


inline ElementType** operator&() const throw() { return (ElementType**) &data; }
inline ElementType* const* operator&() const throw() { return static_cast <ElementType* const*> (&data); }

inline ElementType** operator&() throw() { return static_cast <ElementType**> (&data); }


inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; } inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; }


@@ -2673,9 +2678,6 @@ public:


bool matches (const void* data, size_t dataSize) const throw(); bool matches (const void* data, size_t dataSize) const throw();


template <class DataType>
operator DataType*() const throw() { return (DataType*) data; }

void* getData() const throw() { return data; } void* getData() const throw() { return data; }


template <typename Type> template <typename Type>
@@ -3371,17 +3373,12 @@ public:


inline ObjectType* operator->() const throw() { return object; } inline ObjectType* operator->() const throw() { return object; }


template <class CastType>
inline operator CastType*() const throw() { return static_cast <CastType*> (object); }
inline ObjectType* const* operator&() const throw() { return static_cast <ObjectType* const*> (&object); }


inline ObjectType** operator&() const throw() { return (ObjectType**) &object; }
inline ObjectType** operator&() throw() { return static_cast <ObjectType**> (&object); }


ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; } ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }


inline bool operator== (const ObjectType* const otherPointer) const throw() { return otherPointer == object; }

inline bool operator!= (const ObjectType* const otherPointer) const throw() { return otherPointer != object; }

void swapWith (ScopedPointer <ObjectType>& other) throw() void swapWith (ScopedPointer <ObjectType>& other) throw()
{ {
// Two ScopedPointers should never be able to refer to the same object - if // Two ScopedPointers should never be able to refer to the same object - if
@@ -3399,6 +3396,18 @@ private:
const ScopedPointer* getAddress() const throw() { return this; } const ScopedPointer* getAddress() const throw() { return this; }
}; };


template <class ObjectType>
inline bool operator== (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
{
return static_cast <ObjectType*> (pointer1) == pointer2;
}

template <class ObjectType>
inline bool operator!= (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
{
return static_cast <ObjectType*> (pointer1) != pointer2;
}

#endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__ #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__
/*** End of inlined file: juce_ScopedPointer.h ***/ /*** End of inlined file: juce_ScopedPointer.h ***/


@@ -7680,6 +7689,9 @@ private:
class ZipInputStream; class ZipInputStream;
class ZipFilenameComparator; class ZipFilenameComparator;
class ZipEntryInfo; class ZipEntryInfo;
friend class ZipInputStream;
friend class ZipFilenameComparator;
friend class ZipEntryInfo;


OwnedArray <ZipEntryInfo> entries; OwnedArray <ZipEntryInfo> entries;
CriticalSection lock; CriticalSection lock;
@@ -9555,6 +9567,8 @@ public:


~Rectangle() throw() {} ~Rectangle() throw() {}


bool isEmpty() const throw() { return w <= 0 || h <= 0; }

inline ValueType getX() const throw() { return x; } inline ValueType getX() const throw() { return x; }


inline ValueType getY() const throw() { return y; } inline ValueType getY() const throw() { return y; }
@@ -9567,13 +9581,13 @@ public:


inline ValueType getBottom() const throw() { return y + h; } inline ValueType getBottom() const throw() { return y + h; }


inline ValueType getCentreX() const throw() { return x + w / (ValueType) 2; }
ValueType getCentreX() const throw() { return x + w / (ValueType) 2; }


inline ValueType getCentreY() const throw() { return y + h / (ValueType) 2; }
ValueType getCentreY() const throw() { return y + h / (ValueType) 2; }


inline const Point<ValueType> getCentre() const throw() { return Point<ValueType> (x + w / (ValueType) 2, y + h / (ValueType) 2); }
const Point<ValueType> getCentre() const throw() { return Point<ValueType> (x + w / (ValueType) 2, y + h / (ValueType) 2); }


bool isEmpty() const throw() { return w <= 0 || h <= 0; }
ValueType getAspectRatio (const bool widthOverHeight = true) const throw() { return widthOverHeight ? w / h : h / w; }


const Point<ValueType> getPosition() const throw() { return Point<ValueType> (x, y); } const Point<ValueType> getPosition() const throw() { return Point<ValueType> (x, y); }


@@ -9978,7 +9992,7 @@ public:
void clipToRectangle (const Rectangle<int>& r) throw(); void clipToRectangle (const Rectangle<int>& r) throw();
void excludeRectangle (const Rectangle<int>& r) throw(); void excludeRectangle (const Rectangle<int>& r) throw();
void clipToEdgeTable (const EdgeTable& other); void clipToEdgeTable (const EdgeTable& other);
void clipLineToMask (int x, int y, uint8* mask, int maskStride, int numPixels) throw();
void clipLineToMask (int x, int y, const uint8* mask, int maskStride, int numPixels) throw();
bool isEmpty() throw(); bool isEmpty() throw();
const Rectangle<int>& getMaximumBounds() const throw() { return bounds; } const Rectangle<int>& getMaximumBounds() const throw() { return bounds; }
void translate (float dx, int dy) throw(); void translate (float dx, int dy) throw();
@@ -15528,6 +15542,7 @@ private:
MemoryBlock data; MemoryBlock data;
int bytesUsed; int bytesUsed;


uint8* getData() const throw() { return reinterpret_cast <uint8*> (data.getData()); }
uint8* findEventAfter (uint8* d, const int samplePosition) const throw(); uint8* findEventAfter (uint8* d, const int samplePosition) const throw();
}; };


@@ -15891,6 +15906,7 @@ private:
SortedSet <void*> buttonListeners; SortedSet <void*> buttonListeners;


class RepeatTimer; class RepeatTimer;
friend class RepeatTimer;
friend class ScopedPointer <RepeatTimer>; friend class ScopedPointer <RepeatTimer>;
ScopedPointer <RepeatTimer> repeatTimer; ScopedPointer <RepeatTimer> repeatTimer;
uint32 buttonPressTime, lastTimeCallbackTime; uint32 buttonPressTime, lastTimeCallbackTime;
@@ -16583,6 +16599,7 @@ private:
void timerCallbackInt(); void timerCallbackInt();
void repaintCaret(); void repaintCaret();
void repaintText (const Range<int>& range); void repaintText (const Range<int>& range);
UndoManager* getUndoManager() throw();


TextEditor (const TextEditor&); TextEditor (const TextEditor&);
TextEditor& operator= (const TextEditor&); TextEditor& operator= (const TextEditor&);
@@ -19590,6 +19607,8 @@ public:
private: private:
class SharedEvents; class SharedEvents;
class BlockingMessage; class BlockingMessage;
friend class SharedEvents;
friend class BlockingMessage;
SharedEvents* sharedEvents; SharedEvents* sharedEvents;
bool locked; bool locked;


@@ -26650,6 +26669,7 @@ public:


private: private:
class OpenGLComponentWatcher; class OpenGLComponentWatcher;
friend class OpenGLComponentWatcher;
friend class ScopedPointer <OpenGLComponentWatcher>; friend class ScopedPointer <OpenGLComponentWatcher>;
ScopedPointer <OpenGLComponentWatcher> componentWatcher; ScopedPointer <OpenGLComponentWatcher> componentWatcher;


@@ -27664,7 +27684,7 @@ public:


int subPathIndex; int subPathIndex;


bool isLastInSubpath() const { return stackPos == stackBase
bool isLastInSubpath() const { return stackPos == stackBase.getData()
&& (index >= path.numElements && (index >= path.numElements
|| points [index] == Path::moveMarker); } || points [index] == Path::moveMarker); }


@@ -27966,9 +27986,9 @@ public:


void clear(); void clear();


void setKernelValue (const int x,
const int y,
const float value);
float getKernelValue (int x, int y) const throw();
void setKernelValue (int x, int y, float value) throw();


void setOverallSum (const float desiredTotalSum); void setOverallSum (const float desiredTotalSum);


@@ -27978,8 +27998,6 @@ public:


int getKernelSize() const { return size; } int getKernelSize() const { return size; }


float** getValues() const { return values; }

void applyToImage (Image& destImage, void applyToImage (Image& destImage,
const Image* sourceImage, const Image* sourceImage,
int x, int x,


+ 8
- 8
src/audio/dsp/juce_AudioSampleBuffer.cpp View File

@@ -60,7 +60,7 @@ void AudioSampleBuffer::allocateData()
const size_t channelListSize = (numChannels + 1) * sizeof (float*); const size_t channelListSize = (numChannels + 1) * sizeof (float*);
allocatedBytes = (int) (numChannels * size * sizeof (float) + channelListSize + 32); allocatedBytes = (int) (numChannels * size * sizeof (float) + channelListSize + 32);
allocatedData.malloc (allocatedBytes); allocatedData.malloc (allocatedBytes);
channels = (float**) allocatedData;
channels = reinterpret_cast <float**> (allocatedData.getData());
float* chan = (float*) (allocatedData + channelListSize); float* chan = (float*) (allocatedData + channelListSize);
for (int i = 0; i < numChannels; ++i) for (int i = 0; i < numChannels; ++i)
@@ -103,12 +103,12 @@ void AudioSampleBuffer::allocateChannels (float** const dataToReferTo)
// (try to avoid doing a malloc here, as that'll blow up things like Pro-Tools) // (try to avoid doing a malloc here, as that'll blow up things like Pro-Tools)
if (numChannels < numElementsInArray (preallocatedChannelSpace)) if (numChannels < numElementsInArray (preallocatedChannelSpace))
{ {
channels = (float**) preallocatedChannelSpace;
channels = static_cast <float**> (preallocatedChannelSpace);
} }
else else
{ {
allocatedData.malloc (numChannels + 1, sizeof (float*)); allocatedData.malloc (numChannels + 1, sizeof (float*));
channels = (float**) allocatedData;
channels = reinterpret_cast <float**> (allocatedData.getData());
} }
for (int i = 0; i < numChannels; ++i) for (int i = 0; i < numChannels; ++i)
@@ -162,8 +162,8 @@ void AudioSampleBuffer::setSize (const int newNumChannels,
const int numChansToCopy = jmin (numChannels, newNumChannels); const int numChansToCopy = jmin (numChannels, newNumChannels);
const size_t numBytesToCopy = sizeof (float) * jmin (newNumSamples, size); const size_t numBytesToCopy = sizeof (float) * jmin (newNumSamples, size);
float** const newChannels = (float**) newData;
float* newChan = (float*) (newData + channelListSize);
float** const newChannels = reinterpret_cast <float**> (newData.getData());
float* newChan = reinterpret_cast <float*> (newData + channelListSize);
for (int i = 0; i < numChansToCopy; ++i) for (int i = 0; i < numChansToCopy; ++i)
{ {
memcpy (newChan, channels[i], numBytesToCopy); memcpy (newChan, channels[i], numBytesToCopy);
@@ -173,7 +173,7 @@ void AudioSampleBuffer::setSize (const int newNumChannels,
allocatedData.swapWith (newData); allocatedData.swapWith (newData);
allocatedBytes = (int) newTotalBytes; allocatedBytes = (int) newTotalBytes;
channels = (float**) allocatedData;
channels = newChannels;
} }
else else
{ {
@@ -186,10 +186,10 @@ void AudioSampleBuffer::setSize (const int newNumChannels,
{ {
allocatedBytes = newTotalBytes; allocatedBytes = newTotalBytes;
allocatedData.allocate (newTotalBytes, clearExtraSpace); allocatedData.allocate (newTotalBytes, clearExtraSpace);
channels = (float**) allocatedData;
channels = reinterpret_cast <float**> (allocatedData.getData());
} }
float* chan = (float*) (allocatedData + channelListSize);
float* chan = reinterpret_cast <float*> (allocatedData + channelListSize);
for (int i = 0; i < newNumChannels; ++i) for (int i = 0; i < newNumChannels; ++i)
{ {
channels[i] = chan; channels[i] = chan;


+ 16
- 16
src/audio/midi/juce_MidiBuffer.cpp View File

@@ -74,12 +74,12 @@ void MidiBuffer::clear() throw()
void MidiBuffer::clear (const int startSample, void MidiBuffer::clear (const int startSample,
const int numSamples) throw() const int numSamples) throw()
{ {
uint8* const start = findEventAfter (data, startSample - 1);
uint8* const start = findEventAfter (getData(), startSample - 1);
uint8* const end = findEventAfter (start, startSample + numSamples - 1); uint8* const end = findEventAfter (start, startSample + numSamples - 1);
if (end > start) if (end > start)
{ {
const size_t bytesToMove = (size_t) (bytesUsed - (end - (uint8*) data.getData()));
const size_t bytesToMove = (size_t) (bytesUsed - (end - getData()));
if (bytesToMove > 0) if (bytesToMove > 0)
memmove (start, end, bytesToMove); memmove (start, end, bytesToMove);
@@ -136,8 +136,8 @@ void MidiBuffer::addEvent (const uint8* const newData,
int spaceNeeded = bytesUsed + numBytes + 6; int spaceNeeded = bytesUsed + numBytes + 6;
data.ensureSize ((spaceNeeded + spaceNeeded / 2 + 8) & ~7); data.ensureSize ((spaceNeeded + spaceNeeded / 2 + 8) & ~7);
uint8* d = findEventAfter ((uint8*) data.getData(), sampleNumber);
const size_t bytesToMove = (size_t) (bytesUsed - (d - (uint8*) data.getData()));
uint8* d = findEventAfter (getData(), sampleNumber);
const size_t bytesToMove = (size_t) (bytesUsed - (d - getData()));
if (bytesToMove > 0) if (bytesToMove > 0)
memmove (d + numBytes + 6, memmove (d + numBytes + 6,
@@ -181,7 +181,7 @@ bool MidiBuffer::isEmpty() const throw()
int MidiBuffer::getNumEvents() const throw() int MidiBuffer::getNumEvents() const throw()
{ {
int n = 0; int n = 0;
const uint8* d = (uint8*) data.getData();
const uint8* d = getData();
const uint8* const end = d + bytesUsed; const uint8* const end = d + bytesUsed;
while (d < end) while (d < end)
@@ -196,7 +196,7 @@ int MidiBuffer::getNumEvents() const throw()
int MidiBuffer::getFirstEventTime() const throw() int MidiBuffer::getFirstEventTime() const throw()
{ {
return (bytesUsed > 0) ? *(const int*) data.getData() : 0;
return (bytesUsed > 0) ? *reinterpret_cast <const int*> (data.getData()) : 0;
} }
int MidiBuffer::getLastEventTime() const throw() int MidiBuffer::getLastEventTime() const throw()
@@ -204,7 +204,7 @@ int MidiBuffer::getLastEventTime() const throw()
if (bytesUsed == 0) if (bytesUsed == 0)
return 0; return 0;
const uint8* d = (uint8*) data.getData();
const uint8* d = getData();
const uint8* const endData = d + bytesUsed; const uint8* const endData = d + bytesUsed;
for (;;) for (;;)
@@ -220,7 +220,7 @@ int MidiBuffer::getLastEventTime() const throw()
uint8* MidiBuffer::findEventAfter (uint8* d, const int samplePosition) const throw() uint8* MidiBuffer::findEventAfter (uint8* d, const int samplePosition) const throw()
{ {
const uint8* const endData = ((uint8*) data.getData()) + bytesUsed;
const uint8* const endData = getData() + bytesUsed;
while (d < endData && *(int*) d <= samplePosition) while (d < endData && *(int*) d <= samplePosition)
{ {
@@ -234,7 +234,7 @@ uint8* MidiBuffer::findEventAfter (uint8* d, const int samplePosition) const thr
//============================================================================== //==============================================================================
MidiBuffer::Iterator::Iterator (const MidiBuffer& buffer_) throw() MidiBuffer::Iterator::Iterator (const MidiBuffer& buffer_) throw()
: buffer (buffer_), : buffer (buffer_),
data ((uint8*) buffer_.data.getData())
data (buffer_.getData())
{ {
} }
@@ -245,10 +245,10 @@ MidiBuffer::Iterator::~Iterator() throw()
//============================================================================== //==============================================================================
void MidiBuffer::Iterator::setNextSamplePosition (const int samplePosition) throw() void MidiBuffer::Iterator::setNextSamplePosition (const int samplePosition) throw()
{ {
data = buffer.data;
const uint8* dataEnd = ((uint8*) buffer.data.getData()) + buffer.bytesUsed;
data = buffer.getData();
const uint8* dataEnd = data + buffer.bytesUsed;
while (data < dataEnd && *(int*) data < samplePosition)
while (data < dataEnd && *reinterpret_cast<const int*> (data) < samplePosition)
{ {
data += 4; data += 4;
data += 2 + *(uint16*) data; data += 2 + *(uint16*) data;
@@ -259,7 +259,7 @@ bool MidiBuffer::Iterator::getNextEvent (const uint8* &midiData,
int& numBytes, int& numBytes,
int& samplePosition) throw() int& samplePosition) throw()
{ {
if (data >= ((uint8*) buffer.data.getData()) + buffer.bytesUsed)
if (data >= buffer.getData() + buffer.bytesUsed)
return false; return false;
samplePosition = *(int*) data; samplePosition = *(int*) data;
@@ -275,12 +275,12 @@ bool MidiBuffer::Iterator::getNextEvent (const uint8* &midiData,
bool MidiBuffer::Iterator::getNextEvent (MidiMessage& result, bool MidiBuffer::Iterator::getNextEvent (MidiMessage& result,
int& samplePosition) throw() int& samplePosition) throw()
{ {
if (data >= ((uint8*) buffer.data.getData()) + buffer.bytesUsed)
if (data >= buffer.getData() + buffer.bytesUsed)
return false; return false;
samplePosition = *(int*) data;
samplePosition = *reinterpret_cast <const int*> (data);
data += 4; data += 4;
const int numBytes = *(uint16*) data;
const int numBytes = *reinterpret_cast <const uint16*> (data);
data += 2; data += 2;
result = MidiMessage (data, numBytes, samplePosition); result = MidiMessage (data, numBytes, samplePosition);
data += numBytes; data += numBytes;


+ 1
- 0
src/audio/midi/juce_MidiBuffer.h View File

@@ -229,6 +229,7 @@ private:
MemoryBlock data; MemoryBlock data;
int bytesUsed; int bytesUsed;
uint8* getData() const throw() { return reinterpret_cast <uint8*> (data.getData()); }
uint8* findEventAfter (uint8* d, const int samplePosition) const throw(); uint8* findEventAfter (uint8* d, const int samplePosition) const throw();
}; };


+ 14
- 7
src/containers/juce_HeapBlock.h View File

@@ -110,11 +110,17 @@ public:
*/ */
inline operator ElementType*() const throw() { return data; } inline operator ElementType*() const throw() { return data; }
/** Returns a raw pointer to the allocated data.
This may be a null pointer if the data hasn't yet been allocated, or if it has been
freed by calling the free() method.
*/
inline ElementType* getData() const throw() { return data; }
/** Returns a void pointer to the allocated data. /** Returns a void pointer to the allocated data.
This may be a null pointer if the data hasn't yet been allocated, or if it has been This may be a null pointer if the data hasn't yet been allocated, or if it has been
freed by calling the free() method. freed by calling the free() method.
*/ */
inline operator void*() const throw() { return (void*) data; }
inline operator void*() const throw() { return static_cast <void*> (data); }
/** Lets you use indirect calls to the first element in the array. /** Lets you use indirect calls to the first element in the array.
Obviously this will cause problems if the array hasn't been initialised, because it'll Obviously this will cause problems if the array hasn't been initialised, because it'll
@@ -122,11 +128,6 @@ public:
*/ */
inline ElementType* operator->() const throw() { return data; } inline ElementType* operator->() const throw() { return data; }
/** Returns a pointer to the data by casting it to any type you need.
*/
template <class CastType>
inline operator CastType*() const throw() { return (CastType*) data; }
/** Returns a reference to one of the data elements. /** Returns a reference to one of the data elements.
Obviously there's no bounds-checking here, as this object is just a dumb pointer and Obviously there's no bounds-checking here, as this object is just a dumb pointer and
has no idea of the size it currently has allocated. has no idea of the size it currently has allocated.
@@ -144,7 +145,13 @@ public:
Beware that the pointer returned here will become invalid as soon as you call Beware that the pointer returned here will become invalid as soon as you call
any of the allocator methods on this object! any of the allocator methods on this object!
*/ */
inline ElementType** operator&() const throw() { return (ElementType**) &data; }
inline ElementType* const* operator&() const throw() { return static_cast <ElementType* const*> (&data); }
/** Returns a reference to the raw data pointer.
Beware that the pointer returned here will become invalid as soon as you call
any of the allocator methods on this object!
*/
inline ElementType** operator&() throw() { return static_cast <ElementType**> (&data); }
//============================================================================== //==============================================================================
/** Compares the pointer with another pointer. /** Compares the pointer with another pointer.


+ 7
- 7
src/containers/juce_MemoryBlock.cpp View File

@@ -175,7 +175,7 @@ void MemoryBlock::append (const void* const srcData,
void MemoryBlock::copyFrom (const void* const src, int offset, size_t num) throw() void MemoryBlock::copyFrom (const void* const src, int offset, size_t num) throw()
{ {
const char* d = (const char*) src;
const char* d = static_cast<const char*> (src);
if (offset < 0) if (offset < 0)
{ {
@@ -193,7 +193,7 @@ void MemoryBlock::copyFrom (const void* const src, int offset, size_t num) throw
void MemoryBlock::copyTo (void* const dst, int offset, size_t num) const throw() void MemoryBlock::copyTo (void* const dst, int offset, size_t num) const throw()
{ {
char* d = (char*) dst;
char* d = static_cast<char*> (dst);
if (offset < 0) if (offset < 0)
{ {
@@ -271,16 +271,16 @@ void MemoryBlock::setBitRange (const size_t bitRangeStart, size_t numBits, int b
{ {
size_t byte = bitRangeStart >> 3; size_t byte = bitRangeStart >> 3;
int offsetInByte = bitRangeStart & 7; int offsetInByte = bitRangeStart & 7;
unsigned int mask = ~((((unsigned int)0xffffffff) << (32 - numBits)) >> (32 - numBits));
unsigned int mask = ~((((unsigned int) 0xffffffff) << (32 - numBits)) >> (32 - numBits));
while (numBits > 0 && (size_t) byte < size) while (numBits > 0 && (size_t) byte < size)
{ {
const int bitsThisTime = jmin ((int) numBits, 8 - offsetInByte); const int bitsThisTime = jmin ((int) numBits, 8 - offsetInByte);
const unsigned int tempMask = (mask << offsetInByte) | ~((((unsigned int)0xffffffff) >> offsetInByte) << offsetInByte);
const unsigned int tempMask = (mask << offsetInByte) | ~((((unsigned int) 0xffffffff) >> offsetInByte) << offsetInByte);
const unsigned int tempBits = bitsToSet << offsetInByte; const unsigned int tempBits = bitsToSet << offsetInByte;
data[byte] = (char)((data[byte] & tempMask) | tempBits);
data[byte] = (char) ((data[byte] & tempMask) | tempBits);
++byte; ++byte;
numBits -= bitsThisTime; numBits -= bitsThisTime;
@@ -307,7 +307,7 @@ void MemoryBlock::loadFromHexString (const String& hex) throw()
for (;;) for (;;)
{ {
const tchar c = hex [i++];
const juce_wchar c = hex [i++];
if (c >= T('0') && c <= T('9')) if (c >= T('0') && c <= T('9'))
{ {
@@ -326,7 +326,7 @@ void MemoryBlock::loadFromHexString (const String& hex) throw()
} }
else if (c == 0) else if (c == 0)
{ {
setSize ((int) (dest - data));
setSize (static_cast <size_t> (dest - data));
return; return;
} }
} }


+ 0
- 8
src/containers/juce_MemoryBlock.h View File

@@ -88,14 +88,6 @@ public:
bool matches (const void* data, size_t dataSize) const throw(); bool matches (const void* data, size_t dataSize) const throw();
//============================================================================== //==============================================================================
/** Returns a pointer to the data, casting it to any type of primitive data required.
Note that the pointer returned will probably become invalid when the
block is resized.
*/
template <class DataType>
operator DataType*() const throw() { return (DataType*) data; }
/** Returns a void pointer to the data. /** Returns a void pointer to the data.
Note that the pointer returned will probably become invalid when the Note that the pointer returned will probably become invalid when the


+ 22
- 15
src/containers/juce_ScopedPointer.h View File

@@ -134,12 +134,11 @@ public:
/** Lets you access methods and properties of the object that this ScopedPointer refers to. */ /** Lets you access methods and properties of the object that this ScopedPointer refers to. */
inline ObjectType* operator->() const throw() { return object; } inline ObjectType* operator->() const throw() { return object; }
/** Returns a pointer to the object by casting it to whatever type you need. */
template <class CastType>
inline operator CastType*() const throw() { return static_cast <CastType*> (object); }
/** Returns a reference to the address of the object that this ScopedPointer refers to. */
inline ObjectType* const* operator&() const throw() { return static_cast <ObjectType* const*> (&object); }
/** Returns a reference to the address of the object that this ScopedPointer refers to. */ /** Returns a reference to the address of the object that this ScopedPointer refers to. */
inline ObjectType** operator&() const throw() { return (ObjectType**) &object; }
inline ObjectType** operator&() throw() { return static_cast <ObjectType**> (&object); }
//============================================================================== //==============================================================================
/** Removes the current object from this ScopedPointer without deleting it. /** Removes the current object from this ScopedPointer without deleting it.
@@ -148,17 +147,6 @@ public:
*/ */
ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; } ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }
//==============================================================================
/** Compares the pointer with another pointer.
This can be handy for checking whether this is a null pointer.
*/
inline bool operator== (const ObjectType* const otherPointer) const throw() { return otherPointer == object; }
/** Compares the pointer with another pointer.
This can be handy for checking whether this is a null pointer.
*/
inline bool operator!= (const ObjectType* const otherPointer) const throw() { return otherPointer != object; }
//============================================================================== //==============================================================================
/** Swaps this object with that of another ScopedPointer. /** Swaps this object with that of another ScopedPointer.
The two objects simply exchange their pointers. The two objects simply exchange their pointers.
@@ -180,5 +168,24 @@ private:
const ScopedPointer* getAddress() const throw() { return this; } const ScopedPointer* getAddress() const throw() { return this; }
}; };
//==============================================================================
/** Compares a ScopedPointer with another pointer.
This can be handy for checking whether this is a null pointer.
*/
template <class ObjectType>
inline bool operator== (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
{
return static_cast <ObjectType*> (pointer1) == pointer2;
}
/** Compares a ScopedPointer with another pointer.
This can be handy for checking whether this is a null pointer.
*/
template <class ObjectType>
inline bool operator!= (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
{
return static_cast <ObjectType*> (pointer1) != pointer2;
}
#endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__ #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__

+ 1
- 1
src/containers/juce_Variant.cpp View File

@@ -246,7 +246,7 @@ void var::writeToStream (OutputStream& output) const
const int len = value.stringValue->getNumBytesAsUTF8() + 1; const int len = value.stringValue->getNumBytesAsUTF8() + 1;
output.writeCompressedInt (len + 1); output.writeCompressedInt (len + 1);
output.writeByte (5); output.writeByte (5);
HeapBlock <uint8> temp (len);
HeapBlock<char> temp (len);
value.stringValue->copyToUTF8 (temp, len); value.stringValue->copyToUTF8 (temp, len);
output.write (temp, len); output.write (temp, len);
break; break;


+ 5
- 1
src/core/juce_StandardHeader.h View File

@@ -33,7 +33,7 @@
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 51 #define JUCE_MINOR_VERSION 51
#define JUCE_BUILDNUMBER 4
#define JUCE_BUILDNUMBER 5
/** Current Juce version number. /** Current Juce version number.
@@ -65,6 +65,10 @@
// Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace). // Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace).
#if JUCE_MSVC #if JUCE_MSVC
#if (defined(_MSC_VER) && (_MSC_VER <= 1200))
#pragma warning (disable: 4284) // (spurious VC6 warning)
#endif
#pragma warning (push) #pragma warning (push)
#pragma warning (disable: 4514 4245 4100) #pragma warning (disable: 4514 4245 4100)
#endif #endif


+ 2
- 0
src/events/juce_MessageManager.h View File

@@ -307,6 +307,8 @@ public:
private: private:
class SharedEvents; class SharedEvents;
class BlockingMessage; class BlockingMessage;
friend class SharedEvents;
friend class BlockingMessage;
SharedEvents* sharedEvents; SharedEvents* sharedEvents;
bool locked; bool locked;


+ 1
- 0
src/gui/components/buttons/juce_Button.h View File

@@ -474,6 +474,7 @@ private:
SortedSet <void*> buttonListeners; SortedSet <void*> buttonListeners;
class RepeatTimer; class RepeatTimer;
friend class RepeatTimer;
friend class ScopedPointer <RepeatTimer>; friend class ScopedPointer <RepeatTimer>;
ScopedPointer <RepeatTimer> repeatTimer; ScopedPointer <RepeatTimer> repeatTimer;
uint32 buttonPressTime, lastTimeCallbackTime; uint32 buttonPressTime, lastTimeCallbackTime;


+ 9
- 3
src/gui/components/controls/juce_Slider.cpp View File

@@ -502,7 +502,9 @@ void Slider::setValue (double newValue,
if (popupDisplay != 0) if (popupDisplay != 0)
{ {
((SliderPopupDisplayComponent*) popupDisplay)->updatePosition (getTextFromValue (newValue));
static_cast <SliderPopupDisplayComponent*> (static_cast <Component*> (popupDisplay))
->updatePosition (getTextFromValue (newValue));
popupDisplay->repaint(); popupDisplay->repaint();
} }
@@ -560,7 +562,9 @@ void Slider::setMinValue (double newValue, const bool sendUpdateMessage, const b
if (popupDisplay != 0) if (popupDisplay != 0)
{ {
((SliderPopupDisplayComponent*) popupDisplay)->updatePosition (getTextFromValue (newValue));
static_cast <SliderPopupDisplayComponent*> (static_cast <Component*> (popupDisplay))
->updatePosition (getTextFromValue (newValue));
popupDisplay->repaint(); popupDisplay->repaint();
} }
@@ -600,7 +604,9 @@ void Slider::setMaxValue (double newValue, const bool sendUpdateMessage, const b
if (popupDisplay != 0) if (popupDisplay != 0)
{ {
((SliderPopupDisplayComponent*) popupDisplay)->updatePosition (getTextFromValue (valueMax.getValue()));
static_cast <SliderPopupDisplayComponent*> (static_cast <Component*> (popupDisplay))
->updatePosition (getTextFromValue (valueMax.getValue()));
popupDisplay->repaint(); popupDisplay->repaint();
} }


+ 15
- 6
src/gui/components/controls/juce_TextEditor.cpp View File

@@ -1022,8 +1022,8 @@ void TextEditor::doUndoRedo (const bool isRedo)
{ {
if (! isReadOnly()) if (! isReadOnly())
{ {
if ((isRedo) ? undoManager.redo()
: undoManager.undo())
if (isRedo ? undoManager.redo()
: undoManager.undo())
{ {
scrollToMakeSureCursorIsVisible(); scrollToMakeSureCursorIsVisible();
repaint(); repaint();
@@ -1595,7 +1595,7 @@ void TextEditor::insertTextAtCaret (const String& newText_)
const int newCaretPos = selection.getStart() + newText.length(); const int newCaretPos = selection.getStart() + newText.length();
const int insertIndex = selection.getStart(); const int insertIndex = selection.getStart();
remove (selection, &undoManager,
remove (selection, getUndoManager(),
newText.isNotEmpty() ? newCaretPos - 1 : newCaretPos); newText.isNotEmpty() ? newCaretPos - 1 : newCaretPos);
if (maxTextLength > 0) if (maxTextLength > 0)
@@ -1606,7 +1606,7 @@ void TextEditor::insertTextAtCaret (const String& newText_)
insertIndex, insertIndex,
currentFont, currentFont,
findColour (textColourId), findColour (textColourId),
&undoManager,
getUndoManager(),
newCaretPos); newCaretPos);
textChanged(); textChanged();
@@ -2063,8 +2063,12 @@ void TextEditor::addPopupMenuItems (PopupMenu& m, const MouseEvent*)
m.addSeparator(); m.addSeparator();
m.addItem (baseMenuItemID + 5, TRANS("select all")); m.addItem (baseMenuItemID + 5, TRANS("select all"));
m.addSeparator(); m.addSeparator();
m.addItem (baseMenuItemID + 6, TRANS("undo"), undoManager.canUndo());
m.addItem (baseMenuItemID + 7, TRANS("redo"), undoManager.canRedo());
if (getUndoManager() != 0)
{
m.addItem (baseMenuItemID + 6, TRANS("undo"), undoManager.canUndo());
m.addItem (baseMenuItemID + 7, TRANS("redo"), undoManager.canRedo());
}
} }
void TextEditor::performPopupMenuAction (const int menuItemID) void TextEditor::performPopupMenuAction (const int menuItemID)
@@ -2206,6 +2210,11 @@ void TextEditor::enablementChanged()
} }
//============================================================================== //==============================================================================
UndoManager* TextEditor::getUndoManager() throw()
{
return isReadOnly() ? &undoManager : 0;
}
void TextEditor::clearInternal (UndoManager* const um) void TextEditor::clearInternal (UndoManager* const um)
{ {
remove (Range<int> (0, getTotalNumChars()), um, caretPosition); remove (Range<int> (0, getTotalNumChars()), um, caretPosition);


+ 1
- 0
src/gui/components/controls/juce_TextEditor.h View File

@@ -698,6 +698,7 @@ private:
void timerCallbackInt(); void timerCallbackInt();
void repaintCaret(); void repaintCaret();
void repaintText (const Range<int>& range); void repaintText (const Range<int>& range);
UndoManager* getUndoManager() throw();
TextEditor (const TextEditor&); TextEditor (const TextEditor&);
TextEditor& operator= (const TextEditor&); TextEditor& operator= (const TextEditor&);


+ 1
- 1
src/gui/components/juce_Component.cpp View File

@@ -1841,7 +1841,7 @@ static const var::identifier getColourPropertyId (const int colourId)
{ {
String s; String s;
s.preallocateStorage (18); s.preallocateStorage (18);
s << T("jcclr_") << colourId;
s << T("jcclr_") << String::toHexString (colourId);
return s; return s;
} }


+ 2
- 2
src/gui/components/layout/juce_TabbedComponent.cpp View File

@@ -138,7 +138,7 @@ void TabbedComponent::clearTabs()
// be careful not to delete these components until they've been removed from the tab component // be careful not to delete these components until they've been removed from the tab component
jassert (c == 0 || c->isValidComponent()); jassert (c == 0 || c->isValidComponent());
if (c != 0 && c->getProperties() ["deleteByTabComp_"])
if (c != 0 && (bool) c->getProperties() ["deleteByTabComp_"])
delete c; delete c;
} }
@@ -169,7 +169,7 @@ void TabbedComponent::removeTab (const int tabIndex)
{ {
Component* const c = contentComponents [tabIndex]; Component* const c = contentComponents [tabIndex];
if (c != 0 && c->getProperties() ["deleteByTabComp_"])
if (c != 0 && (bool) c->getProperties() ["deleteByTabComp_"])
{ {
if (c == panelComponent) if (c == panelComponent)
panelComponent = 0; panelComponent = 0;


+ 2
- 2
src/gui/components/mouse/juce_DragAndDropContainer.cpp View File

@@ -79,7 +79,7 @@ public:
~DragImageComponent() ~DragImageComponent()
{ {
if ((DragImageComponent*) owner->dragImageComponent == this)
if (owner->dragImageComponent == this)
owner->dragImageComponent.release(); owner->dragImageComponent.release();
if (! mouseDragSourceWatcher->hasBeenDeleted()) if (! mouseDragSourceWatcher->hasBeenDeleted())
@@ -419,7 +419,7 @@ void DragAndDropContainer::startDragging (const String& sourceDescription,
else else
thisComp->addChildComponent (dragImageComponent); thisComp->addChildComponent (dragImageComponent);
((DragImageComponent*) dragImageComponent)->updateLocation (false, lastMouseDown);
static_cast <DragImageComponent*> (static_cast <Component*> (dragImageComponent))->updateLocation (false, lastMouseDown);
dragImageComponent->setVisible (true); dragImageComponent->setVisible (true);
} }
else else


+ 2
- 2
src/gui/components/mouse/juce_MouseInputSource.cpp View File

@@ -116,7 +116,7 @@ public:
if (current != 0) if (current != 0)
current->internalMouseUp (source, current->globalPositionToRelative (screenPos + unboundedMouseOffset), current->internalMouseUp (source, current->globalPositionToRelative (screenPos + unboundedMouseOffset),
time, getCurrentModifiers()); time, getCurrentModifiers());
enableUnboundedMouseMovement (false, false); enableUnboundedMouseMovement (false, false);
} }
@@ -408,7 +408,7 @@ private:
MouseInputSource& source; MouseInputSource& source;
ScopedPointer<ComponentDeletionWatcher> componentUnderMouse; ScopedPointer<ComponentDeletionWatcher> componentUnderMouse;
ComponentPeer* lastPeer; ComponentPeer* lastPeer;
Point<int> unboundedMouseOffset; Point<int> unboundedMouseOffset;
bool isUnboundedMouseModeOn, isCursorVisibleUntilOffscreen; bool isUnboundedMouseModeOn, isCursorVisibleUntilOffscreen;
void* currentCursorHandle; void* currentCursorHandle;


+ 1
- 1
src/gui/components/mouse/juce_MouseInputSource.h View File

@@ -138,7 +138,7 @@ public:
void revealCursor(); void revealCursor();
bool canDoUnboundedMovement() const throw(); bool canDoUnboundedMovement() const throw();
/** Allows the mouse to move beyond the edges of the screen. /** Allows the mouse to move beyond the edges of the screen.
Calling this method when the mouse button is currently pressed will remove the cursor Calling this method when the mouse button is currently pressed will remove the cursor


+ 1
- 0
src/gui/components/special/juce_OpenGLComponent.h View File

@@ -332,6 +332,7 @@ public:
private: private:
class OpenGLComponentWatcher; class OpenGLComponentWatcher;
friend class OpenGLComponentWatcher;
friend class ScopedPointer <OpenGLComponentWatcher>; friend class ScopedPointer <OpenGLComponentWatcher>;
ScopedPointer <OpenGLComponentWatcher> componentWatcher; ScopedPointer <OpenGLComponentWatcher> componentWatcher;


+ 1
- 1
src/gui/graphics/contexts/juce_EdgeTable.cpp View File

@@ -687,7 +687,7 @@ void EdgeTable::clipToEdgeTable (const EdgeTable& other)
} }
} }
void EdgeTable::clipLineToMask (int x, int y, uint8* mask, int maskStride, int numPixels) throw()
void EdgeTable::clipLineToMask (int x, int y, const uint8* mask, int maskStride, int numPixels) throw()
{ {
y -= bounds.getY(); y -= bounds.getY();


+ 1
- 1
src/gui/graphics/contexts/juce_EdgeTable.h View File

@@ -83,7 +83,7 @@ public:
void clipToRectangle (const Rectangle<int>& r) throw(); void clipToRectangle (const Rectangle<int>& r) throw();
void excludeRectangle (const Rectangle<int>& r) throw(); void excludeRectangle (const Rectangle<int>& r) throw();
void clipToEdgeTable (const EdgeTable& other); void clipToEdgeTable (const EdgeTable& other);
void clipLineToMask (int x, int y, uint8* mask, int maskStride, int numPixels) throw();
void clipLineToMask (int x, int y, const uint8* mask, int maskStride, int numPixels) throw();
bool isEmpty() throw(); bool isEmpty() throw();
const Rectangle<int>& getMaximumBounds() const throw() { return bounds; } const Rectangle<int>& getMaximumBounds() const throw() { return bounds; }
void translate (float dx, int dy) throw(); void translate (float dx, int dy) throw();


+ 2
- 2
src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp View File

@@ -583,10 +583,10 @@ public:
scratchBuffer.malloc (scratchSize); scratchBuffer.malloc (scratchSize);
} }
uint8* mask = (uint8*) scratchBuffer;
y = y_; y = y_;
generate ((SrcPixelType*) mask, x, width);
generate (scratchBuffer, x, width);
const uint8* mask = reinterpret_cast <uint8*> (scratchBuffer.getData());
if (sizeof (SrcPixelType) == sizeof (PixelARGB)) if (sizeof (SrcPixelType) == sizeof (PixelARGB))
mask += PixelARGB::indexA; mask += PixelARGB::indexA;


+ 7
- 2
src/gui/graphics/drawables/juce_DrawableComposite.cpp View File

@@ -136,8 +136,13 @@ const Rectangle<float> DrawableComposite::getBounds() const
const Drawable* const d = drawables.getUnchecked(i); const Drawable* const d = drawables.getUnchecked(i);
const AffineTransform* const t = transforms.getUnchecked(i); const AffineTransform* const t = transforms.getUnchecked(i);
bounds = bounds.getUnion (t == 0 ? d->getBounds()
: d->getBounds().transformed (*t));
const Rectangle<float> childBounds (t == 0 ? d->getBounds()
: d->getBounds().transformed (*t));
if (bounds.isEmpty())
bounds = childBounds;
else if (! childBounds.isEmpty())
bounds = bounds.getUnion (childBounds);
} }
return bounds; return bounds;


+ 1
- 1
src/gui/graphics/geometry/juce_PathIterator.h View File

@@ -95,7 +95,7 @@ public:
int subPathIndex; int subPathIndex;
/** Returns true if the current segment is the last in the current sub-path. */ /** Returns true if the current segment is the last in the current sub-path. */
bool isLastInSubpath() const { return stackPos == stackBase
bool isLastInSubpath() const { return stackPos == stackBase.getData()
&& (index >= path.numElements && (index >= path.numElements
|| points [index] == Path::moveMarker); } || points [index] == Path::moveMarker); }


+ 11
- 5
src/gui/graphics/geometry/juce_Rectangle.h View File

@@ -83,6 +83,9 @@ public:
~Rectangle() throw() {} ~Rectangle() throw() {}
//============================================================================== //==============================================================================
/** Returns true if the rectangle's width and height are both zero or less */
bool isEmpty() const throw() { return w <= 0 || h <= 0; }
/** Returns the x co-ordinate of the rectangle's left-hand-side. */ /** Returns the x co-ordinate of the rectangle's left-hand-side. */
inline ValueType getX() const throw() { return x; } inline ValueType getX() const throw() { return x; }
@@ -102,15 +105,18 @@ public:
inline ValueType getBottom() const throw() { return y + h; } inline ValueType getBottom() const throw() { return y + h; }
/** Returns the x co-ordinate of the rectangle's centre. */ /** Returns the x co-ordinate of the rectangle's centre. */
inline ValueType getCentreX() const throw() { return x + w / (ValueType) 2; }
ValueType getCentreX() const throw() { return x + w / (ValueType) 2; }
/** Returns the y co-ordinate of the rectangle's centre. */ /** Returns the y co-ordinate of the rectangle's centre. */
inline ValueType getCentreY() const throw() { return y + h / (ValueType) 2; }
ValueType getCentreY() const throw() { return y + h / (ValueType) 2; }
inline const Point<ValueType> getCentre() const throw() { return Point<ValueType> (x + w / (ValueType) 2, y + h / (ValueType) 2); }
/** Returns the centre point of the rectangle. */
const Point<ValueType> getCentre() const throw() { return Point<ValueType> (x + w / (ValueType) 2, y + h / (ValueType) 2); }
/** Returns true if the rectangle's width and height are both zero or less */
bool isEmpty() const throw() { return w <= 0 || h <= 0; }
/** Returns the aspect ratio of the rectangle's width / height.
If widthOverHeight is true, it returns width / height; if widthOverHeight is false,
it returns height / width. */
ValueType getAspectRatio (const bool widthOverHeight = true) const throw() { return widthOverHeight ? w / h : h / w; }
//============================================================================== //==============================================================================
/** Returns the rectangle's top-left position as a Point. */ /** Returns the rectangle's top-left position as a Point. */


+ 16
- 4
src/gui/graphics/imaging/juce_ImageConvolutionKernel.cpp View File

@@ -43,9 +43,21 @@ ImageConvolutionKernel::~ImageConvolutionKernel()
} }
//============================================================================== //==============================================================================
void ImageConvolutionKernel::setKernelValue (const int x,
const int y,
const float value)
float ImageConvolutionKernel::getKernelValue (const int x, const int y) const throw()
{
if (((unsigned int) x) < (unsigned int) size
&& ((unsigned int) y) < (unsigned int) size)
{
return values [x + y * size];
}
else
{
jassertfalse;
return 0;
}
}
void ImageConvolutionKernel::setKernelValue (const int x, const int y, const float value) throw()
{ {
if (((unsigned int) x) < (unsigned int) size if (((unsigned int) x) < (unsigned int) size
&& ((unsigned int) y) < (unsigned int) size) && ((unsigned int) y) < (unsigned int) size)
@@ -54,7 +66,7 @@ void ImageConvolutionKernel::setKernelValue (const int x,
} }
else else
{ {
jassertfalse
jassertfalse;
} }
} }


+ 5
- 11
src/gui/graphics/imaging/juce_ImageConvolutionKernel.h View File

@@ -50,19 +50,19 @@ public:
~ImageConvolutionKernel(); ~ImageConvolutionKernel();
//============================================================================== //==============================================================================
/** Resets all values in the kernel to zero.
*/
/** Resets all values in the kernel to zero. */
void clear(); void clear();
/** Returns one of the kernel values. */
float getKernelValue (int x, int y) const throw();
/** Sets the value of a specific cell in the kernel. /** Sets the value of a specific cell in the kernel.
The x and y parameters must be in the range 0 < x < getKernelSize(). The x and y parameters must be in the range 0 < x < getKernelSize().
@see setOverallSum @see setOverallSum
*/ */
void setKernelValue (const int x,
const int y,
const float value);
void setKernelValue (int x, int y, float value) throw();
/** Rescales all values in the kernel to make the total add up to a fixed value. /** Rescales all values in the kernel to make the total add up to a fixed value.
@@ -89,12 +89,6 @@ public:
*/ */
int getKernelSize() const { return size; } int getKernelSize() const { return size; }
/** Returns a 2-dimensional array of the kernel's values.
The size of each dimension of the array will be getKernelSize().
*/
float** getValues() const { return values; }
//============================================================================== //==============================================================================
/** Applies the kernel to an image. /** Applies the kernel to an image.


+ 3
- 0
src/io/files/juce_ZipFile.h View File

@@ -149,6 +149,9 @@ private:
class ZipInputStream; class ZipInputStream;
class ZipFilenameComparator; class ZipFilenameComparator;
class ZipEntryInfo; class ZipEntryInfo;
friend class ZipInputStream;
friend class ZipFilenameComparator;
friend class ZipEntryInfo;
OwnedArray <ZipEntryInfo> entries; OwnedArray <ZipEntryInfo> entries;
CriticalSection lock; CriticalSection lock;


+ 2
- 2
src/io/network/juce_URL.cpp View File

@@ -538,8 +538,8 @@ const StringPairArray& URL::getMimeTypesOfUploadFiles() const
const String URL::removeEscapeChars (const String& s) const String URL::removeEscapeChars (const String& s)
{ {
const int len = s.length(); const int len = s.length();
HeapBlock <uint8> resultUTF8 (len * 4);
uint8* r = resultUTF8;
HeapBlock <char> resultUTF8 (len * 4);
char* r = resultUTF8;
for (int i = 0; i < len; ++i) for (int i = 0; i < len; ++i)
{ {


+ 1
- 0
src/native/juce_mac_NativeCode.mm View File

@@ -60,6 +60,7 @@ BEGIN_JUCE_NAMESPACE
#include "../gui/components/special/juce_QuickTimeMovieComponent.h" #include "../gui/components/special/juce_QuickTimeMovieComponent.h"
#include "../gui/components/mouse/juce_DragAndDropContainer.h" #include "../gui/components/mouse/juce_DragAndDropContainer.h"
#include "../gui/components/mouse/juce_MouseEvent.h" #include "../gui/components/mouse/juce_MouseEvent.h"
#include "../gui/components/mouse/juce_MouseInputSource.h"
#include "../gui/components/keyboard/juce_KeyPressMappingSet.h" #include "../gui/components/keyboard/juce_KeyPressMappingSet.h"
#include "../gui/components/special/juce_NSViewComponent.h" #include "../gui/components/special/juce_NSViewComponent.h"
#include "../gui/components/layout/juce_ComponentMovementWatcher.h" #include "../gui/components/layout/juce_ComponentMovementWatcher.h"


+ 2
- 2
src/native/linux/juce_linux_Audio.cpp View File

@@ -234,7 +234,7 @@ public:
if (isInterleaved) if (isInterleaved)
{ {
scratch.ensureSize (sizeof (float) * numSamples * numChannelsRunning, false); scratch.ensureSize (sizeof (float) * numSamples * numChannelsRunning, false);
float* interleaved = (float*) scratch;
float* interleaved = reinterpret_cast <float*> (scratch.getData());
AudioDataConverters::interleaveSamples ((const float**) data, interleaved, numSamples, numChannelsRunning); AudioDataConverters::interleaveSamples ((const float**) data, interleaved, numSamples, numChannelsRunning);
AudioDataConverters::convertFloatToFormat (sampleFormat, interleaved, interleaved, numSamples * numChannelsRunning); AudioDataConverters::convertFloatToFormat (sampleFormat, interleaved, interleaved, numSamples * numChannelsRunning);
@@ -272,7 +272,7 @@ public:
if (isInterleaved) if (isInterleaved)
{ {
scratch.ensureSize (sizeof (float) * numSamples * numChannelsRunning, false); scratch.ensureSize (sizeof (float) * numSamples * numChannelsRunning, false);
float* interleaved = (float*) scratch;
float* interleaved = reinterpret_cast <float*> (scratch.getData());
snd_pcm_sframes_t num = snd_pcm_readi (handle, (void*) interleaved, numSamples); snd_pcm_sframes_t num = snd_pcm_readi (handle, (void*) interleaved, numSamples);


+ 4
- 3
src/native/linux/juce_linux_Clipboard.cpp View File

@@ -181,8 +181,9 @@ void juce_handleSelectionRequest (XSelectionRequestEvent &evt)
numDataItems = 2; numDataItems = 2;
propertyFormat = 32; // atoms are 32-bit propertyFormat = 32; // atoms are 32-bit
data.calloc (numDataItems * 4); data.calloc (numDataItems * 4);
((Atom*) data)[0] = atom_UTF8_STRING;
((Atom*) data)[1] = XA_STRING;
Atom* atoms = reinterpret_cast<Atom*> (data.getData());
atoms[0] = atom_UTF8_STRING;
atoms[1] = XA_STRING;
} }
} }
else else
@@ -200,7 +201,7 @@ void juce_handleSelectionRequest (XSelectionRequestEvent &evt)
XChangeProperty (evt.display, evt.requestor, XChangeProperty (evt.display, evt.requestor,
evt.property, evt.target, evt.property, evt.target,
propertyFormat /* 8 or 32 */, PropModeReplace, propertyFormat /* 8 or 32 */, PropModeReplace,
(const unsigned char*) data, numDataItems);
reinterpret_cast<const unsigned char*> (data.getData()), numDataItems);
reply.property = evt.property; // " == success" reply.property = evt.property; // " == success"
} }
} }


+ 1
- 1
src/native/linux/juce_linux_JackAudio.cpp View File

@@ -395,7 +395,7 @@ private:
if (callback != 0) if (callback != 0)
{ {
callback->audioDeviceIOCallback ((const float**) inChans, numActiveInChans,
callback->audioDeviceIOCallback (const_cast<const float**> (inChans.getData()), numActiveInChans,
outChans, numActiveOutChans, numSamples); outChans, numActiveOutChans, numSamples);
} }
else else


+ 13
- 6
src/native/linux/juce_linux_Windowing.cpp View File

@@ -902,7 +902,8 @@ public:
colour[index++] = image.getPixelAt (x, y).getARGB(); colour[index++] = image.getPixelAt (x, y).getARGB();
XImage* ximage = XCreateImage (display, CopyFromParent, 24, ZPixmap, XImage* ximage = XCreateImage (display, CopyFromParent, 24, ZPixmap,
0, (char*) colour, width, height, 32, 0);
0, reinterpret_cast<char*> (colour.getData()),
width, height, 32, 0);
Pixmap pixmap = XCreatePixmap (display, DefaultRootWindow (display), Pixmap pixmap = XCreatePixmap (display, DefaultRootWindow (display),
width, height, 24); width, height, 24);
@@ -938,7 +939,7 @@ public:
} }
return XCreatePixmapFromBitmapData (display, DefaultRootWindow (display), return XCreatePixmapFromBitmapData (display, DefaultRootWindow (display),
(char*) mask, width, height, 1, 0, 1);
reinterpret_cast<char*> (mask.getData()), width, height, 1, 0, 1);
} }
void setIcon (const Image& newIcon) void setIcon (const Image& newIcon)
@@ -958,7 +959,7 @@ public:
XChangeProperty (display, windowH, XChangeProperty (display, windowH,
XInternAtom (display, "_NET_WM_ICON", False), XInternAtom (display, "_NET_WM_ICON", False),
XA_CARDINAL, 32, PropModeReplace, XA_CARDINAL, 32, PropModeReplace,
(unsigned char*) data, dataSize);
reinterpret_cast<unsigned char*> (data.getData()), dataSize);
deleteIconPixmaps(); deleteIconPixmaps();
@@ -1015,7 +1016,13 @@ public:
char utf8 [64]; char utf8 [64];
zeromem (utf8, sizeof (utf8)); zeromem (utf8, sizeof (utf8));
KeySym sym; KeySym sym;
XLookupString (keyEvent, utf8, sizeof (utf8), &sym, 0);
{
const char* oldLocale = ::setlocale (LC_ALL, 0);
::setlocale (LC_ALL, "");
XLookupString (keyEvent, utf8, sizeof (utf8), &sym, 0);
::setlocale (LC_ALL, oldLocale);
}
const juce_wchar unicodeChar = *(const juce_wchar*) String::fromUTF8 (utf8, sizeof (utf8) - 1); const juce_wchar unicodeChar = *(const juce_wchar*) String::fromUTF8 (utf8, sizeof (utf8) - 1);
int keyCode = (int) unicodeChar; int keyCode = (int) unicodeChar;
@@ -2777,8 +2784,8 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot
} }
} }
Pixmap sourcePixmap = XCreatePixmapFromBitmapData (display, root, (char*) sourcePlane, cursorW, cursorH, 0xffff, 0, 1);
Pixmap maskPixmap = XCreatePixmapFromBitmapData (display, root, (char*) maskPlane, cursorW, cursorH, 0xffff, 0, 1);
Pixmap sourcePixmap = XCreatePixmapFromBitmapData (display, root, reinterpret_cast <char*> (sourcePlane.getData()), cursorW, cursorH, 0xffff, 0, 1);
Pixmap maskPixmap = XCreatePixmapFromBitmapData (display, root, reinterpret_cast <char*> (maskPlane.getData()), cursorW, cursorH, 0xffff, 0, 1);
XColor white, black; XColor white, black;
black.red = black.green = black.blue = 0; black.red = black.green = black.blue = 0;


+ 2
- 2
src/native/mac/juce_mac_CoreAudio.cpp View File

@@ -628,7 +628,7 @@ public:
{ {
if (inputDevice == 0) if (inputDevice == 0)
{ {
callback->audioDeviceIOCallback ((const float**) tempInputBuffers,
callback->audioDeviceIOCallback (const_cast<const float**> (inputDevice->tempInputBuffers.getData()),
numInputChans, numInputChans,
tempOutputBuffers, tempOutputBuffers,
numOutputChans, numOutputChans,
@@ -643,7 +643,7 @@ public:
// changed while inside our callback.. // changed while inside our callback..
const ScopedLock sl2 (inputDevice->callbackLock); const ScopedLock sl2 (inputDevice->callbackLock);
callback->audioDeviceIOCallback ((const float**) inputDevice->tempInputBuffers,
callback->audioDeviceIOCallback (const_cast<const float**> (inputDevice->tempInputBuffers.getData()),
inputDevice->numInputChans, inputDevice->numInputChans,
tempOutputBuffers, tempOutputBuffers,
numOutputChans, numOutputChans,


+ 6
- 5
src/native/mac/juce_mac_Fonts.mm View File

@@ -210,7 +210,7 @@ public:
if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE) if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE)
{ {
HeapBlock <NSSize> advances (length); HeapBlock <NSSize> advances (length);
[nsFont getAdvancements: advances forGlyphs: (NSGlyph*) glyphs count: length];
[nsFont getAdvancements: advances forGlyphs: reinterpret_cast<NSGlyph*> (glyphs.getData()) count: length];
for (int i = 0; i < length; ++i) for (int i = 0; i < length; ++i)
x += advances[i].width; x += advances[i].width;
@@ -257,14 +257,15 @@ public:
if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE) if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE)
{ {
HeapBlock <NSSize> advances (length); HeapBlock <NSSize> advances (length);
[nsFont getAdvancements: advances forGlyphs: (NSGlyph*) glyphs count: length];
NSGlyph* const nsGlyphs = reinterpret_cast<NSGlyph*> (glyphs.getData());
[nsFont getAdvancements: advances forGlyphs: nsGlyphs count: length];
float x = 0; float x = 0;
for (int i = 0; i < length; ++i) for (int i = 0; i < length; ++i)
{ {
x += advances[i].width; x += advances[i].width;
xOffsets.add (x * unitsToHeightScaleFactor); xOffsets.add (x * unitsToHeightScaleFactor);
resultGlyphs.add (((NSGlyph*) glyphs)[i]);
resultGlyphs.add (nsGlyphs[i]);
} }
} }
else else
@@ -357,10 +358,10 @@ private:
#endif #endif
{ {
glyphs.malloc (sizeof (NSGlyph) * length, 1); glyphs.malloc (sizeof (NSGlyph) * length, 1);
NSGlyph* const g = (NSGlyph*) glyphs;
NSGlyph* const nsGlyphs = reinterpret_cast<NSGlyph*> (glyphs.getData());
for (int i = 0; i < length; ++i) for (int i = 0; i < length; ++i)
g[i] = (NSGlyph) [nsFont _defaultGlyphForChar: text[i]];
nsGlyphs[i] = (NSGlyph) [nsFont _defaultGlyphForChar: text[i]];
return; return;
} }


+ 1
- 1
src/native/windows/juce_win32_DirectSound.cpp View File

@@ -1307,7 +1307,7 @@ public:
{ {
JUCE_TRY JUCE_TRY
{ {
callback->audioDeviceIOCallback ((const float**) inputBuffers,
callback->audioDeviceIOCallback (const_cast <const float**> (inputBuffers.getData()),
numInputBuffers, numInputBuffers,
outputBuffers, outputBuffers,
numOutputBuffers, numOutputBuffers,


+ 2
- 2
src/native/windows/juce_win32_Fonts.cpp View File

@@ -302,12 +302,12 @@ public:
if (bufSize > 0) if (bufSize > 0)
{ {
HeapBlock <char> data (bufSize);
HeapBlock<char> data (bufSize);
GetGlyphOutline (dc, character, GGO_NATIVE, &gm, GetGlyphOutline (dc, character, GGO_NATIVE, &gm,
bufSize, data, &identityMatrix); bufSize, data, &identityMatrix);
const TTPOLYGONHEADER* pheader = (TTPOLYGONHEADER*) data;
const TTPOLYGONHEADER* pheader = reinterpret_cast<TTPOLYGONHEADER*> (data.getData());
const float scaleX = 1.0f / height; const float scaleX = 1.0f / height;
const float scaleY = -1.0f / height; const float scaleY = -1.0f / height;


+ 3
- 1
src/text/juce_XmlElement.cpp View File

@@ -60,6 +60,9 @@ XmlElement::XmlElement (const String& tagName_) throw()
{ {
// the tag name mustn't be empty, or it'll look like a text element! // the tag name mustn't be empty, or it'll look like a text element!
jassert (tagName_.containsNonWhitespaceChars()) jassert (tagName_.containsNonWhitespaceChars())
// The tag can't contain spaces or other characters that would create invalid XML!
jassert (! tagName_.containsAnyOf (T(" <>/&")));
} }
XmlElement::XmlElement (int /*dummy*/) throw() XmlElement::XmlElement (int /*dummy*/) throw()
@@ -474,7 +477,6 @@ XmlElement* XmlElement::getNextElementWithTagName (const String& requiredTagName
return e; return e;
} }
//============================================================================== //==============================================================================
int XmlElement::getNumAttributes() const throw() int XmlElement::getNumAttributes() const throw()
{ {


Loading…
Cancel
Save