Browse Source

Minor tweaks to MidiMessage, Label. Removed some intel compiler warnings.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
0a9cbd36c4
24 changed files with 207 additions and 240 deletions
  1. +102
    -118
      juce_amalgamated.cpp
  2. +3
    -3
      juce_amalgamated.h
  3. +2
    -2
      src/audio/audio_file_formats/juce_FlacAudioFormat.cpp
  4. +0
    -3
      src/audio/midi/juce_MidiFile.cpp
  5. +28
    -32
      src/audio/midi/juce_MidiMessage.cpp
  6. +1
    -1
      src/audio/midi/juce_MidiMessage.h
  7. +1
    -1
      src/audio/plugins/formats/juce_VSTPluginFormat.cpp
  8. +2
    -12
      src/events/juce_InterprocessConnection.cpp
  9. +10
    -11
      src/gui/components/controls/juce_Label.cpp
  10. +1
    -1
      src/gui/components/controls/juce_Label.h
  11. +1
    -1
      src/gui/components/positioning/juce_RelativeCoordinatePositioner.cpp
  12. +2
    -2
      src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp
  13. +1
    -1
      src/gui/graphics/drawables/juce_DrawableShape.cpp
  14. +1
    -1
      src/gui/graphics/drawables/juce_DrawableShape.h
  15. +1
    -1
      src/gui/graphics/geometry/juce_Path.cpp
  16. +3
    -0
      src/gui/graphics/imaging/image_file_formats/juce_PNGLoader.cpp
  17. +30
    -25
      src/maths/juce_Expression.cpp
  18. +0
    -6
      src/memory/juce_MemoryBlock.cpp
  19. +4
    -4
      src/native/windows/juce_win32_DirectSound.cpp
  20. +1
    -1
      src/native/windows/juce_win32_Fonts.cpp
  21. +4
    -5
      src/native/windows/juce_win32_Network.cpp
  22. +2
    -2
      src/native/windows/juce_win32_OpenGLComponent.cpp
  23. +3
    -3
      src/native/windows/juce_win32_WASAPI.cpp
  24. +4
    -4
      src/native/windows/juce_win32_Windowing.cpp

+ 102
- 118
juce_amalgamated.cpp View File

@@ -3586,12 +3586,6 @@ void MemoryBlock::copyTo (void* const dst, int offset, size_t num) const throw()


void MemoryBlock::removeSection (size_t startByte, size_t numBytesToRemove) void MemoryBlock::removeSection (size_t startByte, size_t numBytesToRemove)
{ {
if (startByte < 0)
{
numBytesToRemove += startByte;
startByte = 0;
}

if (startByte + numBytesToRemove >= size) if (startByte + numBytesToRemove >= size)
{ {
setSize (startByte); setSize (startByte);
@@ -5271,25 +5265,17 @@ public:
text = textString; text = textString;
} }


const TermPtr readExpression()
const TermPtr readUpToComma()
{ {
TermPtr lhs (readMultiplyOrDivideExpression());
if (textString.isEmpty())
return new Constant (0.0, false);


char opType;
while (lhs != 0 && readOperator ("+-", &opType))
{
TermPtr rhs (readMultiplyOrDivideExpression());

if (rhs == 0)
throw ParseError ("Expected expression after \"" + String::charToString (opType) + "\"");
const TermPtr e (readExpression());


if (opType == '+')
lhs = new Add (lhs, rhs);
else
lhs = new Subtract (lhs, rhs);
}
if (e == 0 || ((! readOperator (",")) && text [textIndex] != 0))
throw ParseError ("Syntax error: \"" + textString.substring (textIndex) + "\"");


return lhs;
return e;
} }


private: private:
@@ -5431,6 +5417,27 @@ public:
return new Constant (String (text + start, i - start).getDoubleValue(), isResolutionTarget); return new Constant (String (text + start, i - start).getDoubleValue(), isResolutionTarget);
} }


const TermPtr readExpression()
{
TermPtr lhs (readMultiplyOrDivideExpression());

char opType;
while (lhs != 0 && readOperator ("+-", &opType))
{
TermPtr rhs (readMultiplyOrDivideExpression());

if (rhs == 0)
throw ParseError ("Expected expression after \"" + String::charToString (opType) + "\"");

if (opType == '+')
lhs = new Add (lhs, rhs);
else
lhs = new Subtract (lhs, rhs);
}

return lhs;
}

const TermPtr readMultiplyOrDivideExpression() const TermPtr readMultiplyOrDivideExpression()
{ {
TermPtr lhs (readUnaryExpression()); TermPtr lhs (readUnaryExpression());
@@ -5594,21 +5601,13 @@ Expression::Expression (const String& stringToParse)
{ {
int i = 0; int i = 0;
Helpers::Parser parser (stringToParse, i); Helpers::Parser parser (stringToParse, i);
term = parser.readExpression();

if (term == 0)
term = new Helpers::Constant (0, false);
term = parser.readUpToComma();
} }


const Expression Expression::parse (const String& stringToParse, int& textIndexToStartFrom) const Expression Expression::parse (const String& stringToParse, int& textIndexToStartFrom)
{ {
Helpers::Parser parser (stringToParse, textIndexToStartFrom); Helpers::Parser parser (stringToParse, textIndexToStartFrom);
const Helpers::TermPtr term (parser.readExpression());

if (term != 0)
return Expression (term);

return Expression();
return Expression (parser.readUpToComma());
} }


double Expression::evaluate() const double Expression::evaluate() const
@@ -28419,9 +28418,6 @@ bool MidiFile::readFrom (InputStream& sourceStream)
if (chunkSize <= 0) if (chunkSize <= 0)
break; break;


if (size < 0)
return false;

if (chunkType == (int) ByteOrder::bigEndianInt ("MTrk")) if (chunkType == (int) ByteOrder::bigEndianInt ("MTrk"))
{ {
readNextTrack (d, chunkSize); readNextTrack (d, chunkSize);
@@ -28733,6 +28729,19 @@ END_JUCE_NAMESPACE
/*** Start of inlined file: juce_MidiMessage.cpp ***/ /*** Start of inlined file: juce_MidiMessage.cpp ***/
BEGIN_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE


namespace MidiHelpers
{
inline uint8 initialByte (const int type, const int channel) throw()
{
return (uint8) (type | jlimit (0, 15, channel - 1));
}

inline uint8 validVelocity (const int v) throw()
{
return (uint8) jlimit (0, 127, v);
}
}

int MidiMessage::readVariableLengthVal (const uint8* data, int& numBytesUsed) throw() int MidiMessage::readVariableLengthVal (const uint8* data, int& numBytesUsed) throw()
{ {
numBytesUsed = 0; numBytesUsed = 0;
@@ -29036,7 +29045,7 @@ int MidiMessage::getNoteNumber() const throw()
void MidiMessage::setNoteNumber (const int newNoteNumber) throw() void MidiMessage::setNoteNumber (const int newNoteNumber) throw()
{ {
if (isNoteOnOrOff()) if (isNoteOnOrOff())
data[1] = (uint8) jlimit (0, 127, newNoteNumber);
data[1] = newNoteNumber & 127;
} }


uint8 MidiMessage::getVelocity() const throw() uint8 MidiMessage::getVelocity() const throw()
@@ -29055,13 +29064,13 @@ float MidiMessage::getFloatVelocity() const throw()
void MidiMessage::setVelocity (const float newVelocity) throw() void MidiMessage::setVelocity (const float newVelocity) throw()
{ {
if (isNoteOnOrOff()) if (isNoteOnOrOff())
data[2] = (uint8) jlimit (0, 0x7f, roundToInt (newVelocity * 127.0f));
data[2] = MidiHelpers::validVelocity (roundToInt (newVelocity * 127.0f));
} }


void MidiMessage::multiplyVelocity (const float scaleFactor) throw() void MidiMessage::multiplyVelocity (const float scaleFactor) throw()
{ {
if (isNoteOnOrOff()) if (isNoteOnOrOff())
data[2] = (uint8) jlimit (0, 0x7f, roundToInt (scaleFactor * data[2]));
data[2] = MidiHelpers::validVelocity (roundToInt (scaleFactor * data[2]));
} }


bool MidiMessage::isAftertouch() const throw() bool MidiMessage::isAftertouch() const throw()
@@ -29082,7 +29091,7 @@ const MidiMessage MidiMessage::aftertouchChange (const int channel,
jassert (isPositiveAndBelow (noteNum, (int) 128)); jassert (isPositiveAndBelow (noteNum, (int) 128));
jassert (isPositiveAndBelow (aftertouchValue, (int) 128)); jassert (isPositiveAndBelow (aftertouchValue, (int) 128));


return MidiMessage (0xa0 | jlimit (0, 15, channel - 1),
return MidiMessage (MidiHelpers::initialByte (0xa0, channel),
noteNum & 0x7f, noteNum & 0x7f,
aftertouchValue & 0x7f); aftertouchValue & 0x7f);
} }
@@ -29105,8 +29114,7 @@ const MidiMessage MidiMessage::channelPressureChange (const int channel,
jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
jassert (isPositiveAndBelow (pressure, (int) 128)); jassert (isPositiveAndBelow (pressure, (int) 128));


return MidiMessage (0xd0 | jlimit (0, 15, channel - 1),
pressure & 0x7f);
return MidiMessage (MidiHelpers::initialByte (0xd0, channel), pressure & 0x7f);
} }


bool MidiMessage::isProgramChange() const throw() bool MidiMessage::isProgramChange() const throw()
@@ -29124,8 +29132,7 @@ const MidiMessage MidiMessage::programChange (const int channel,
{ {
jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16


return MidiMessage (0xc0 | jlimit (0, 15, channel - 1),
programNumber & 0x7f);
return MidiMessage (MidiHelpers::initialByte (0xc0, channel), programNumber & 0x7f);
} }


bool MidiMessage::isPitchWheel() const throw() bool MidiMessage::isPitchWheel() const throw()
@@ -29144,9 +29151,7 @@ const MidiMessage MidiMessage::pitchWheel (const int channel,
jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
jassert (isPositiveAndBelow (position, (int) 0x4000)); jassert (isPositiveAndBelow (position, (int) 0x4000));


return MidiMessage (0xe0 | jlimit (0, 15, channel - 1),
position & 127,
(position >> 7) & 127);
return MidiMessage (MidiHelpers::initialByte (0xe0, channel), position & 127, (position >> 7) & 127);
} }


bool MidiMessage::isController() const throw() bool MidiMessage::isController() const throw()
@@ -29168,44 +29173,33 @@ int MidiMessage::getControllerValue() const throw()
return data[2]; return data[2];
} }


const MidiMessage MidiMessage::controllerEvent (const int channel,
const int controllerType,
const int value) throw()
const MidiMessage MidiMessage::controllerEvent (const int channel, const int controllerType, const int value) throw()
{ {
// the channel must be between 1 and 16 inclusive // the channel must be between 1 and 16 inclusive
jassert (channel > 0 && channel <= 16); jassert (channel > 0 && channel <= 16);


return MidiMessage (0xb0 | jlimit (0, 15, channel - 1),
controllerType & 127,
value & 127);
return MidiMessage (MidiHelpers::initialByte (0xb0, channel), controllerType & 127, value & 127);
} }


const MidiMessage MidiMessage::noteOn (const int channel,
const int noteNumber,
const float velocity) throw()
const MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, const float velocity) throw()
{ {
return noteOn (channel, noteNumber, (uint8)(velocity * 127.0f)); return noteOn (channel, noteNumber, (uint8)(velocity * 127.0f));
} }


const MidiMessage MidiMessage::noteOn (const int channel,
const int noteNumber,
const uint8 velocity) throw()
const MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, const uint8 velocity) throw()
{ {
jassert (channel > 0 && channel <= 16); jassert (channel > 0 && channel <= 16);
jassert (isPositiveAndBelow (noteNumber, (int) 128)); jassert (isPositiveAndBelow (noteNumber, (int) 128));


return MidiMessage (0x90 | jlimit (0, 15, channel - 1),
noteNumber & 127,
jlimit (0, 127, roundToInt (velocity)));
return MidiMessage (MidiHelpers::initialByte (0x90, channel), noteNumber & 127, MidiHelpers::validVelocity (velocity));
} }


const MidiMessage MidiMessage::noteOff (const int channel,
const int noteNumber) throw()
const MidiMessage MidiMessage::noteOff (const int channel, const int noteNumber, uint8 velocity) throw()
{ {
jassert (channel > 0 && channel <= 16); jassert (channel > 0 && channel <= 16);
jassert (isPositiveAndBelow (noteNumber, (int) 128)); jassert (isPositiveAndBelow (noteNumber, (int) 128));


return MidiMessage (0x80 | jlimit (0, 15, channel - 1), noteNumber & 127, 0);
return MidiMessage (MidiHelpers::initialByte (0x80, channel), noteNumber & 127, MidiHelpers::validVelocity (velocity));
} }


const MidiMessage MidiMessage::allNotesOff (const int channel) throw() const MidiMessage MidiMessage::allNotesOff (const int channel) throw()
@@ -29257,8 +29251,7 @@ bool MidiMessage::isSysEx() const throw()


const MidiMessage MidiMessage::createSysExMessage (const uint8* sysexData, const int dataSize) const MidiMessage MidiMessage::createSysExMessage (const uint8* sysexData, const int dataSize)
{ {
MemoryBlock mm (dataSize + 2);
uint8* const m = static_cast <uint8*> (mm.getData());
HeapBlock<uint8> m (dataSize + 2);


m[0] = 0xf0; m[0] = 0xf0;
memcpy (m + 1, sysexData, dataSize); memcpy (m + 1, sysexData, dataSize);
@@ -32820,7 +32813,7 @@ END_JUCE_NAMESPACE
#define STRICT #define STRICT
#include <windows.h> #include <windows.h>
#include <float.h> #include <float.h>
#pragma warning (disable : 4312 4355)
#pragma warning (disable : 4312 4355 1899)
#elif JUCE_LINUX #elif JUCE_LINUX
#include <float.h> #include <float.h>
#include <sys/time.h> #include <sys/time.h>
@@ -38621,26 +38614,16 @@ bool InterprocessConnection::sendMessage (const MemoryBlock& message)
messageData.copyFrom (messageHeader, 0, sizeof (messageHeader)); messageData.copyFrom (messageHeader, 0, sizeof (messageHeader));
messageData.copyFrom (message.getData(), sizeof (messageHeader), message.getSize()); messageData.copyFrom (message.getData(), sizeof (messageHeader), message.getSize());


size_t bytesWritten = 0;
int bytesWritten = 0;


const ScopedLock sl (pipeAndSocketLock); const ScopedLock sl (pipeAndSocketLock);


if (socket != 0) if (socket != 0)
{
bytesWritten = socket->write (messageData.getData(), (int) messageData.getSize()); bytesWritten = socket->write (messageData.getData(), (int) messageData.getSize());
}
else if (pipe != 0) else if (pipe != 0)
{
bytesWritten = pipe->write (messageData.getData(), (int) messageData.getSize()); bytesWritten = pipe->write (messageData.getData(), (int) messageData.getSize());
}

if (bytesWritten < 0)
{
// error..
return false;
}


return (bytesWritten == messageData.getSize());
return bytesWritten == (int) messageData.getSize();
} }


void InterprocessConnection::initialiseWithSocket (StreamingSocket* const socket_) void InterprocessConnection::initialiseWithSocket (StreamingSocket* const socket_)
@@ -48259,18 +48242,17 @@ void Label::showEditor()
} }
} }


void Label::editorShown (TextEditor* /*editorComponent*/)
void Label::editorShown (TextEditor*)
{ {
} }


void Label::editorAboutToBeHidden (TextEditor* /*editorComponent*/)
void Label::editorAboutToBeHidden (TextEditor*)
{ {
} }


bool Label::updateFromTextEditorContents()
bool Label::updateFromTextEditorContents (TextEditor& ed)
{ {
jassert (editor != 0);
const String newText (editor->getText());
const String newText (ed.getText());


if (textValue.toString() != newText) if (textValue.toString() != newText)
{ {
@@ -48295,12 +48277,13 @@ void Label::hideEditor (const bool discardCurrentEditorContents)
{ {
WeakReference<Component> deletionChecker (this); WeakReference<Component> deletionChecker (this);


editorAboutToBeHidden (editor);
ScopedPointer<TextEditor> outgoingEditor (editor);


const bool changed = (! discardCurrentEditorContents)
&& updateFromTextEditorContents();
editorAboutToBeHidden (outgoingEditor);


editor = 0;
const bool changed = (! discardCurrentEditorContents)
&& updateFromTextEditorContents (*outgoingEditor);
outgoingEditor = 0;
repaint(); repaint();


if (changed) if (changed)
@@ -48466,9 +48449,8 @@ void Label::textEditorReturnKeyPressed (TextEditor& ed)
if (editor != 0) if (editor != 0)
{ {
jassert (&ed == editor); jassert (&ed == editor);
(void) ed;


const bool changed = updateFromTextEditorContents();
const bool changed = updateFromTextEditorContents (ed);
hideEditor (true); hideEditor (true);


if (changed) if (changed)
@@ -61221,7 +61203,7 @@ public:
component->setVisible (! useProxyComponent); component->setVisible (! useProxyComponent);
} }


int useTimeslice (const int elapsed)
bool useTimeslice (const int elapsed)
{ {
Component* const c = proxy != 0 ? static_cast <Component*> (proxy) Component* const c = proxy != 0 ? static_cast <Component*> (proxy)
: static_cast <Component*> (component); : static_cast <Component*> (component);
@@ -61269,13 +61251,13 @@ public:
} }


if (stillBusy) if (stillBusy)
return 0;
return true;
} }
} }
} }


moveToFinalDestination(); moveToFinalDestination();
return -1;
return false;
} }


void moveToFinalDestination() void moveToFinalDestination()
@@ -80302,7 +80284,7 @@ void RelativeCoordinatePositionerBase::ComponentScope::visitRelativeScope (const


const String RelativeCoordinatePositionerBase::ComponentScope::getScopeUID() const const String RelativeCoordinatePositionerBase::ComponentScope::getScopeUID() const
{ {
return String::toHexString ((pointer_sized_int) (void*) &component);
return String::toHexString ((int) (pointer_sized_int) (void*) &component);
} }


Component* RelativeCoordinatePositionerBase::ComponentScope::findSiblingComponent (const String& componentID) const Component* RelativeCoordinatePositionerBase::ComponentScope::findSiblingComponent (const String& componentID) const
@@ -84066,7 +84048,7 @@ private:
SrcPixelType* sourceLineStart; SrcPixelType* sourceLineStart;


template <class PixelType1, class PixelType2> template <class PixelType1, class PixelType2>
forcedinline static void copyRow (PixelType1* dest, PixelType2* src, int width) throw()
static forcedinline void copyRow (PixelType1* dest, PixelType2* src, int width) throw()
{ {
do do
{ {
@@ -84074,7 +84056,7 @@ private:
} while (--width > 0); } while (--width > 0);
} }


forcedinline static void copyRow (PixelRGB* dest, PixelRGB* src, int width) throw()
static forcedinline void copyRow (PixelRGB* dest, PixelRGB* src, int width) throw()
{ {
memcpy (dest, src, width * sizeof (PixelRGB)); memcpy (dest, src, width * sizeof (PixelRGB));
} }
@@ -86520,7 +86502,7 @@ const Rectangle<float> DrawableShape::getDrawableBounds() const
return path.getBounds(); return path.getBounds();
} }


bool DrawableShape::hitTest (int x, int y) const
bool DrawableShape::hitTest (int x, int y)
{ {
const float globalX = (float) (x - originRelativeToComponent.getX()); const float globalX = (float) (x - originRelativeToComponent.getX());
const float globalY = (float) (y - originRelativeToComponent.getY()); const float globalY = (float) (y - originRelativeToComponent.getY());
@@ -92255,7 +92237,7 @@ void Path::closeSubPath()


const Point<float> Path::getCurrentPosition() const const Point<float> Path::getCurrentPosition() const
{ {
size_t i = numElements - 1;
int i = (int) numElements - 1;


if (i > 0 && data.elements[i] == closeSubPathMarker) if (i > 0 && data.elements[i] == closeSubPathMarker)
{ {
@@ -105773,8 +105755,8 @@ namespace FlacNamespace
{ {
#if JUCE_INCLUDE_FLAC_CODE #if JUCE_INCLUDE_FLAC_CODE
#if JUCE_MSVC #if JUCE_MSVC
#pragma warning (disable : 4505) // (unreferenced static function removal warning)
#endif
#pragma warning (disable: 4505 181 111)
#endif


#define FLAC__NO_DLL 1 #define FLAC__NO_DLL 1


@@ -211698,6 +211680,9 @@ END_JUCE_NAMESPACE
#if JUCE_MSVC #if JUCE_MSVC
#pragma warning (push) #pragma warning (push)
#pragma warning (disable: 4390 4611) #pragma warning (disable: 4390 4611)
#ifdef __INTEL_COMPILER
#pragma warning (disable: 2544 2545)
#endif
#endif #endif


namespace zlibNamespace namespace zlibNamespace
@@ -239184,8 +239169,6 @@ void NamedPipe::cancelPendingReads()
#define INTERNET_OPTION_DISABLE_AUTODIAL 70 #define INTERNET_OPTION_DISABLE_AUTODIAL 70
#endif #endif


static HINTERNET sessionHandle = 0;

#ifndef WORKAROUND_TIMEOUT_BUG #ifndef WORKAROUND_TIMEOUT_BUG
//#define WORKAROUND_TIMEOUT_BUG 1 //#define WORKAROUND_TIMEOUT_BUG 1
#endif #endif
@@ -239195,8 +239178,8 @@ static HINTERNET sessionHandle = 0;
class InternetConnectThread : public Thread class InternetConnectThread : public Thread
{ {
public: public:
InternetConnectThread (URL_COMPONENTS& uc_, HINTERNET& connection_, const bool isFtp_)
: Thread ("Internet"), uc (uc_), connection (connection_), isFtp (isFtp_)
InternetConnectThread (URL_COMPONENTS& uc_, HINTERNET sessionHandle_, HINTERNET& connection_, const bool isFtp_)
: Thread ("Internet"), uc (uc_), sessionHandle (sessionHandle_), connection (connection_), isFtp (isFtp_)
{ {
startThread(); startThread();
} }
@@ -239218,6 +239201,7 @@ public:


private: private:
URL_COMPONENTS& uc; URL_COMPONENTS& uc;
HINTERNET sessionHandle;
HINTERNET& connection; HINTERNET& connection;
const bool isFtp; const bool isFtp;


@@ -239398,7 +239382,7 @@ private:
connection = 0; connection = 0;


{ {
InternetConnectThread connectThread (uc, connection, isFtp);
InternetConnectThread connectThread (uc, sessionHandle, connection, isFtp);
connectThread.wait (timeOutMs); connectThread.wait (timeOutMs);


if (connection == 0) if (connection == 0)
@@ -240224,7 +240208,7 @@ class FontDCHolder : private DeletedAtShutdown
public: public:


FontDCHolder() FontDCHolder()
: dc (0), fontH (0), previousFontH (0), numKPs (0), size (0),
: fontH (0), previousFontH (0), dc (0), numKPs (0), size (0),
bold (false), italic (false) bold (false), italic (false)
{ {
} }
@@ -241817,8 +241801,8 @@ public:
constrainerIsResizing (false), constrainerIsResizing (false),
currentWindowIcon (0), currentWindowIcon (0),
dropTarget (0), dropTarget (0),
updateLayeredWindowAlpha (255),
parentToAddTo (parentToAddTo_)
parentToAddTo (parentToAddTo_),
updateLayeredWindowAlpha (255)
{ {
callFunctionIfNotLocked (&createWindowCallback, this); callFunctionIfNotLocked (&createWindowCallback, this);


@@ -243218,7 +243202,7 @@ private:


if (pDropFiles->fWide) if (pDropFiles->fWide)
{ {
const WCHAR* const fname = (WCHAR*) (((const char*) pDropFiles) + sizeof (DROPFILES));
const WCHAR* const fname = (WCHAR*) addBytesToPointer (pDropFiles, sizeof (DROPFILES));


for (;;) for (;;)
{ {
@@ -243235,7 +243219,7 @@ private:
} }
else else
{ {
const char* const fname = ((const char*) pDropFiles) + sizeof (DROPFILES);
const char* const fname = (const char*) addBytesToPointer (pDropFiles, sizeof (DROPFILES));


for (;;) for (;;)
{ {
@@ -245807,8 +245791,8 @@ public:
HGLRC contextToShareWith, HGLRC contextToShareWith,
const OpenGLPixelFormat& pixelFormat) const OpenGLPixelFormat& pixelFormat)
: renderContext (0), : renderContext (0),
dc (0),
component (component_)
component (component_),
dc (0)
{ {
jassert (component != 0); jassert (component != 0);


@@ -251056,16 +251040,16 @@ public:
const int inputDeviceIndex_) const int inputDeviceIndex_)
: AudioIODevice (deviceName, "DirectSound"), : AudioIODevice (deviceName, "DirectSound"),
Thread ("Juce DSound"), Thread ("Juce DSound"),
isOpen_ (false),
isStarted (false),
outputDeviceIndex (outputDeviceIndex_), outputDeviceIndex (outputDeviceIndex_),
inputDeviceIndex (inputDeviceIndex_), inputDeviceIndex (inputDeviceIndex_),
isOpen_ (false),
isStarted (false),
bufferSizeSamples (0),
totalSamplesOut (0), totalSamplesOut (0),
sampleRate (0.0), sampleRate (0.0),
inputBuffers (1, 1), inputBuffers (1, 1),
outputBuffers (1, 1), outputBuffers (1, 1),
callback (0),
bufferSizeSamples (0)
callback (0)
{ {
if (outputDeviceIndex_ >= 0) if (outputDeviceIndex_ >= 0)
{ {
@@ -251750,9 +251734,9 @@ public:
WASAPIDeviceBase (const ComSmartPtr <IMMDevice>& device_, const bool useExclusiveMode_) WASAPIDeviceBase (const ComSmartPtr <IMMDevice>& device_, const bool useExclusiveMode_)
: device (device_), : device (device_),
sampleRate (0), sampleRate (0),
defaultSampleRate (0),
numChannels (0), numChannels (0),
actualNumChannels (0), actualNumChannels (0),
defaultSampleRate (0),
minBufferSize (0), minBufferSize (0),
defaultBufferSize (0), defaultBufferSize (0),
latencySamples (0), latencySamples (0),
@@ -252162,11 +252146,11 @@ public:
const bool useExclusiveMode_) const bool useExclusiveMode_)
: AudioIODevice (deviceName, "Windows Audio"), : AudioIODevice (deviceName, "Windows Audio"),
Thread ("Juce WASAPI"), Thread ("Juce WASAPI"),
isOpen_ (false),
isStarted (false),
outputDeviceId (outputDeviceId_), outputDeviceId (outputDeviceId_),
inputDeviceId (inputDeviceId_), inputDeviceId (inputDeviceId_),
useExclusiveMode (useExclusiveMode_), useExclusiveMode (useExclusiveMode_),
isOpen_ (false),
isStarted (false),
currentBufferSizeSamples (0), currentBufferSizeSamples (0),
currentSampleRate (0), currentSampleRate (0),
callback (0) callback (0)


+ 3
- 3
juce_amalgamated.h View File

@@ -35743,7 +35743,7 @@ public:
@param noteNumber the key number, 0 to 127 @param noteNumber the key number, 0 to 127
@see isNoteOff @see isNoteOff
*/ */
static const MidiMessage noteOff (int channel, int noteNumber) throw();
static const MidiMessage noteOff (int channel, int noteNumber, uint8 velocity = 0) throw();


/** Returns true if this message is a 'key-down' or 'key-up' event. /** Returns true if this message is a 'key-down' or 'key-up' event.


@@ -39463,7 +39463,7 @@ private:
bool lossOfFocusDiscardsChanges : 1; bool lossOfFocusDiscardsChanges : 1;
bool leftOfOwnerComp : 1; bool leftOfOwnerComp : 1;


bool updateFromTextEditorContents();
bool updateFromTextEditorContents (TextEditor&);
void callChangeListeners(); void callChangeListeners();


JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Label); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Label);
@@ -62185,7 +62185,7 @@ public:
/** @internal */ /** @internal */
void paint (Graphics& g); void paint (Graphics& g);
/** @internal */ /** @internal */
bool hitTest (int x, int y) const;
bool hitTest (int x, int y);


protected: protected:




+ 2
- 2
src/audio/audio_file_formats/juce_FlacAudioFormat.cpp View File

@@ -38,8 +38,8 @@ namespace FlacNamespace
{ {
#if JUCE_INCLUDE_FLAC_CODE #if JUCE_INCLUDE_FLAC_CODE
#if JUCE_MSVC #if JUCE_MSVC
#pragma warning (disable : 4505) // (unreferenced static function removal warning)
#endif
#pragma warning (disable: 4505 181 111)
#endif
#define FLAC__NO_DLL 1 #define FLAC__NO_DLL 1


+ 0
- 3
src/audio/midi/juce_MidiFile.cpp View File

@@ -309,9 +309,6 @@ bool MidiFile::readFrom (InputStream& sourceStream)
if (chunkSize <= 0) if (chunkSize <= 0)
break; break;
if (size < 0)
return false;
if (chunkType == (int) ByteOrder::bigEndianInt ("MTrk")) if (chunkType == (int) ByteOrder::bigEndianInt ("MTrk"))
{ {
readNextTrack (d, chunkSize); readNextTrack (d, chunkSize);


+ 28
- 32
src/audio/midi/juce_MidiMessage.cpp View File

@@ -28,8 +28,20 @@
BEGIN_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE
#include "juce_MidiMessage.h" #include "juce_MidiMessage.h"
#include "../../memory/juce_MemoryBlock.h"
#include "../../memory/juce_HeapBlock.h"
namespace MidiHelpers
{
inline uint8 initialByte (const int type, const int channel) throw()
{
return (uint8) (type | jlimit (0, 15, channel - 1));
}
inline uint8 validVelocity (const int v) throw()
{
return (uint8) jlimit (0, 127, v);
}
}
//============================================================================== //==============================================================================
int MidiMessage::readVariableLengthVal (const uint8* data, int& numBytesUsed) throw() int MidiMessage::readVariableLengthVal (const uint8* data, int& numBytesUsed) throw()
@@ -336,7 +348,7 @@ int MidiMessage::getNoteNumber() const throw()
void MidiMessage::setNoteNumber (const int newNoteNumber) throw() void MidiMessage::setNoteNumber (const int newNoteNumber) throw()
{ {
if (isNoteOnOrOff()) if (isNoteOnOrOff())
data[1] = (uint8) jlimit (0, 127, newNoteNumber);
data[1] = newNoteNumber & 127;
} }
uint8 MidiMessage::getVelocity() const throw() uint8 MidiMessage::getVelocity() const throw()
@@ -355,13 +367,13 @@ float MidiMessage::getFloatVelocity() const throw()
void MidiMessage::setVelocity (const float newVelocity) throw() void MidiMessage::setVelocity (const float newVelocity) throw()
{ {
if (isNoteOnOrOff()) if (isNoteOnOrOff())
data[2] = (uint8) jlimit (0, 0x7f, roundToInt (newVelocity * 127.0f));
data[2] = MidiHelpers::validVelocity (roundToInt (newVelocity * 127.0f));
} }
void MidiMessage::multiplyVelocity (const float scaleFactor) throw() void MidiMessage::multiplyVelocity (const float scaleFactor) throw()
{ {
if (isNoteOnOrOff()) if (isNoteOnOrOff())
data[2] = (uint8) jlimit (0, 0x7f, roundToInt (scaleFactor * data[2]));
data[2] = MidiHelpers::validVelocity (roundToInt (scaleFactor * data[2]));
} }
bool MidiMessage::isAftertouch() const throw() bool MidiMessage::isAftertouch() const throw()
@@ -382,7 +394,7 @@ const MidiMessage MidiMessage::aftertouchChange (const int channel,
jassert (isPositiveAndBelow (noteNum, (int) 128)); jassert (isPositiveAndBelow (noteNum, (int) 128));
jassert (isPositiveAndBelow (aftertouchValue, (int) 128)); jassert (isPositiveAndBelow (aftertouchValue, (int) 128));
return MidiMessage (0xa0 | jlimit (0, 15, channel - 1),
return MidiMessage (MidiHelpers::initialByte (0xa0, channel),
noteNum & 0x7f, noteNum & 0x7f,
aftertouchValue & 0x7f); aftertouchValue & 0x7f);
} }
@@ -405,8 +417,7 @@ const MidiMessage MidiMessage::channelPressureChange (const int channel,
jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
jassert (isPositiveAndBelow (pressure, (int) 128)); jassert (isPositiveAndBelow (pressure, (int) 128));
return MidiMessage (0xd0 | jlimit (0, 15, channel - 1),
pressure & 0x7f);
return MidiMessage (MidiHelpers::initialByte (0xd0, channel), pressure & 0x7f);
} }
bool MidiMessage::isProgramChange() const throw() bool MidiMessage::isProgramChange() const throw()
@@ -424,8 +435,7 @@ const MidiMessage MidiMessage::programChange (const int channel,
{ {
jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
return MidiMessage (0xc0 | jlimit (0, 15, channel - 1),
programNumber & 0x7f);
return MidiMessage (MidiHelpers::initialByte (0xc0, channel), programNumber & 0x7f);
} }
bool MidiMessage::isPitchWheel() const throw() bool MidiMessage::isPitchWheel() const throw()
@@ -444,9 +454,7 @@ const MidiMessage MidiMessage::pitchWheel (const int channel,
jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
jassert (isPositiveAndBelow (position, (int) 0x4000)); jassert (isPositiveAndBelow (position, (int) 0x4000));
return MidiMessage (0xe0 | jlimit (0, 15, channel - 1),
position & 127,
(position >> 7) & 127);
return MidiMessage (MidiHelpers::initialByte (0xe0, channel), position & 127, (position >> 7) & 127);
} }
bool MidiMessage::isController() const throw() bool MidiMessage::isController() const throw()
@@ -468,44 +476,33 @@ int MidiMessage::getControllerValue() const throw()
return data[2]; return data[2];
} }
const MidiMessage MidiMessage::controllerEvent (const int channel,
const int controllerType,
const int value) throw()
const MidiMessage MidiMessage::controllerEvent (const int channel, const int controllerType, const int value) throw()
{ {
// the channel must be between 1 and 16 inclusive // the channel must be between 1 and 16 inclusive
jassert (channel > 0 && channel <= 16); jassert (channel > 0 && channel <= 16);
return MidiMessage (0xb0 | jlimit (0, 15, channel - 1),
controllerType & 127,
value & 127);
return MidiMessage (MidiHelpers::initialByte (0xb0, channel), controllerType & 127, value & 127);
} }
const MidiMessage MidiMessage::noteOn (const int channel,
const int noteNumber,
const float velocity) throw()
const MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, const float velocity) throw()
{ {
return noteOn (channel, noteNumber, (uint8)(velocity * 127.0f)); return noteOn (channel, noteNumber, (uint8)(velocity * 127.0f));
} }
const MidiMessage MidiMessage::noteOn (const int channel,
const int noteNumber,
const uint8 velocity) throw()
const MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, const uint8 velocity) throw()
{ {
jassert (channel > 0 && channel <= 16); jassert (channel > 0 && channel <= 16);
jassert (isPositiveAndBelow (noteNumber, (int) 128)); jassert (isPositiveAndBelow (noteNumber, (int) 128));
return MidiMessage (0x90 | jlimit (0, 15, channel - 1),
noteNumber & 127,
jlimit (0, 127, roundToInt (velocity)));
return MidiMessage (MidiHelpers::initialByte (0x90, channel), noteNumber & 127, MidiHelpers::validVelocity (velocity));
} }
const MidiMessage MidiMessage::noteOff (const int channel,
const int noteNumber) throw()
const MidiMessage MidiMessage::noteOff (const int channel, const int noteNumber, uint8 velocity) throw()
{ {
jassert (channel > 0 && channel <= 16); jassert (channel > 0 && channel <= 16);
jassert (isPositiveAndBelow (noteNumber, (int) 128)); jassert (isPositiveAndBelow (noteNumber, (int) 128));
return MidiMessage (0x80 | jlimit (0, 15, channel - 1), noteNumber & 127, 0);
return MidiMessage (MidiHelpers::initialByte (0x80, channel), noteNumber & 127, MidiHelpers::validVelocity (velocity));
} }
const MidiMessage MidiMessage::allNotesOff (const int channel) throw() const MidiMessage MidiMessage::allNotesOff (const int channel) throw()
@@ -558,8 +555,7 @@ bool MidiMessage::isSysEx() const throw()
const MidiMessage MidiMessage::createSysExMessage (const uint8* sysexData, const int dataSize) const MidiMessage MidiMessage::createSysExMessage (const uint8* sysexData, const int dataSize)
{ {
MemoryBlock mm (dataSize + 2);
uint8* const m = static_cast <uint8*> (mm.getData());
HeapBlock<uint8> m (dataSize + 2);
m[0] = 0xf0; m[0] = 0xf0;
memcpy (m + 1, sysexData, dataSize); memcpy (m + 1, sysexData, dataSize);


+ 1
- 1
src/audio/midi/juce_MidiMessage.h View File

@@ -245,7 +245,7 @@ public:
@param noteNumber the key number, 0 to 127 @param noteNumber the key number, 0 to 127
@see isNoteOff @see isNoteOff
*/ */
static const MidiMessage noteOff (int channel, int noteNumber) throw();
static const MidiMessage noteOff (int channel, int noteNumber, uint8 velocity = 0) throw();
/** Returns true if this message is a 'key-down' or 'key-up' event. /** Returns true if this message is a 'key-down' or 'key-up' event.


+ 1
- 1
src/audio/plugins/formats/juce_VSTPluginFormat.cpp View File

@@ -35,7 +35,7 @@
#define STRICT #define STRICT
#include <windows.h> #include <windows.h>
#include <float.h> #include <float.h>
#pragma warning (disable : 4312 4355)
#pragma warning (disable : 4312 4355 1899)
#elif JUCE_LINUX #elif JUCE_LINUX
#include <float.h> #include <float.h>
#include <sys/time.h> #include <sys/time.h>


+ 2
- 12
src/events/juce_InterprocessConnection.cpp View File

@@ -168,26 +168,16 @@ bool InterprocessConnection::sendMessage (const MemoryBlock& message)
messageData.copyFrom (messageHeader, 0, sizeof (messageHeader)); messageData.copyFrom (messageHeader, 0, sizeof (messageHeader));
messageData.copyFrom (message.getData(), sizeof (messageHeader), message.getSize()); messageData.copyFrom (message.getData(), sizeof (messageHeader), message.getSize());
size_t bytesWritten = 0;
int bytesWritten = 0;
const ScopedLock sl (pipeAndSocketLock); const ScopedLock sl (pipeAndSocketLock);
if (socket != 0) if (socket != 0)
{
bytesWritten = socket->write (messageData.getData(), (int) messageData.getSize()); bytesWritten = socket->write (messageData.getData(), (int) messageData.getSize());
}
else if (pipe != 0) else if (pipe != 0)
{
bytesWritten = pipe->write (messageData.getData(), (int) messageData.getSize()); bytesWritten = pipe->write (messageData.getData(), (int) messageData.getSize());
}
if (bytesWritten < 0)
{
// error..
return false;
}
return (bytesWritten == messageData.getSize());
return bytesWritten == (int) messageData.getSize();
} }
//============================================================================== //==============================================================================


+ 10
- 11
src/gui/components/controls/juce_Label.cpp View File

@@ -230,18 +230,17 @@ void Label::showEditor()
} }
} }
void Label::editorShown (TextEditor* /*editorComponent*/)
void Label::editorShown (TextEditor*)
{ {
} }
void Label::editorAboutToBeHidden (TextEditor* /*editorComponent*/)
void Label::editorAboutToBeHidden (TextEditor*)
{ {
} }
bool Label::updateFromTextEditorContents()
bool Label::updateFromTextEditorContents (TextEditor& ed)
{ {
jassert (editor != 0);
const String newText (editor->getText());
const String newText (ed.getText());
if (textValue.toString() != newText) if (textValue.toString() != newText)
{ {
@@ -266,12 +265,13 @@ void Label::hideEditor (const bool discardCurrentEditorContents)
{ {
WeakReference<Component> deletionChecker (this); WeakReference<Component> deletionChecker (this);
editorAboutToBeHidden (editor);
ScopedPointer<TextEditor> outgoingEditor (editor);
const bool changed = (! discardCurrentEditorContents)
&& updateFromTextEditorContents();
editorAboutToBeHidden (outgoingEditor);
editor = 0;
const bool changed = (! discardCurrentEditorContents)
&& updateFromTextEditorContents (*outgoingEditor);
outgoingEditor = 0;
repaint(); repaint();
if (changed) if (changed)
@@ -441,9 +441,8 @@ void Label::textEditorReturnKeyPressed (TextEditor& ed)
if (editor != 0) if (editor != 0)
{ {
jassert (&ed == editor); jassert (&ed == editor);
(void) ed;
const bool changed = updateFromTextEditorContents();
const bool changed = updateFromTextEditorContents (ed);
hideEditor (true); hideEditor (true);
if (changed) if (changed)


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

@@ -327,7 +327,7 @@ private:
bool lossOfFocusDiscardsChanges : 1; bool lossOfFocusDiscardsChanges : 1;
bool leftOfOwnerComp : 1; bool leftOfOwnerComp : 1;
bool updateFromTextEditorContents();
bool updateFromTextEditorContents (TextEditor&);
void callChangeListeners(); void callChangeListeners();
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Label); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Label);


+ 1
- 1
src/gui/components/positioning/juce_RelativeCoordinatePositioner.cpp View File

@@ -75,7 +75,7 @@ void RelativeCoordinatePositionerBase::ComponentScope::visitRelativeScope (const
const String RelativeCoordinatePositionerBase::ComponentScope::getScopeUID() const const String RelativeCoordinatePositionerBase::ComponentScope::getScopeUID() const
{ {
return String::toHexString ((pointer_sized_int) (void*) &component);
return String::toHexString ((int) (pointer_sized_int) (void*) &component);
} }
Component* RelativeCoordinatePositionerBase::ComponentScope::findSiblingComponent (const String& componentID) const Component* RelativeCoordinatePositionerBase::ComponentScope::findSiblingComponent (const String& componentID) const


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

@@ -543,7 +543,7 @@ private:
SrcPixelType* sourceLineStart; SrcPixelType* sourceLineStart;
template <class PixelType1, class PixelType2> template <class PixelType1, class PixelType2>
forcedinline static void copyRow (PixelType1* dest, PixelType2* src, int width) throw()
static forcedinline void copyRow (PixelType1* dest, PixelType2* src, int width) throw()
{ {
do do
{ {
@@ -551,7 +551,7 @@ private:
} while (--width > 0); } while (--width > 0);
} }
forcedinline static void copyRow (PixelRGB* dest, PixelRGB* src, int width) throw()
static forcedinline void copyRow (PixelRGB* dest, PixelRGB* src, int width) throw()
{ {
memcpy (dest, src, width * sizeof (PixelRGB)); memcpy (dest, src, width * sizeof (PixelRGB));
} }


+ 1
- 1
src/gui/graphics/drawables/juce_DrawableShape.cpp View File

@@ -196,7 +196,7 @@ const Rectangle<float> DrawableShape::getDrawableBounds() const
return path.getBounds(); return path.getBounds();
} }
bool DrawableShape::hitTest (int x, int y) const
bool DrawableShape::hitTest (int x, int y)
{ {
const float globalX = (float) (x - originRelativeToComponent.getX()); const float globalX = (float) (x - originRelativeToComponent.getX());
const float globalY = (float) (y - originRelativeToComponent.getY()); const float globalY = (float) (y - originRelativeToComponent.getY());


+ 1
- 1
src/gui/graphics/drawables/juce_DrawableShape.h View File

@@ -152,7 +152,7 @@ public:
/** @internal */ /** @internal */
void paint (Graphics& g); void paint (Graphics& g);
/** @internal */ /** @internal */
bool hitTest (int x, int y) const;
bool hitTest (int x, int y);
protected: protected:
//============================================================================== //==============================================================================


+ 1
- 1
src/gui/graphics/geometry/juce_Path.cpp View File

@@ -337,7 +337,7 @@ void Path::closeSubPath()
const Point<float> Path::getCurrentPosition() const const Point<float> Path::getCurrentPosition() const
{ {
size_t i = numElements - 1;
int i = (int) numElements - 1;
if (i > 0 && data.elements[i] == closeSubPathMarker) if (i > 0 && data.elements[i] == closeSubPathMarker)
{ {


+ 3
- 0
src/gui/graphics/imaging/image_file_formats/juce_PNGLoader.cpp View File

@@ -28,6 +28,9 @@
#if JUCE_MSVC #if JUCE_MSVC
#pragma warning (push) #pragma warning (push)
#pragma warning (disable: 4390 4611) #pragma warning (disable: 4390 4611)
#ifdef __INTEL_COMPILER
#pragma warning (disable: 2544 2545)
#endif
#endif #endif
namespace zlibNamespace namespace zlibNamespace


+ 30
- 25
src/maths/juce_Expression.cpp View File

@@ -656,25 +656,17 @@ public:
text = textString; text = textString;
} }
const TermPtr readExpression()
const TermPtr readUpToComma()
{ {
TermPtr lhs (readMultiplyOrDivideExpression());
if (textString.isEmpty())
return new Constant (0.0, false);
char opType;
while (lhs != 0 && readOperator ("+-", &opType))
{
TermPtr rhs (readMultiplyOrDivideExpression());
const TermPtr e (readExpression());
if (rhs == 0)
throw ParseError ("Expected expression after \"" + String::charToString (opType) + "\"");
if (e == 0 || ((! readOperator (",")) && text [textIndex] != 0))
throw ParseError ("Syntax error: \"" + textString.substring (textIndex) + "\"");
if (opType == '+')
lhs = new Add (lhs, rhs);
else
lhs = new Subtract (lhs, rhs);
}
return lhs;
return e;
} }
private: private:
@@ -817,6 +809,27 @@ public:
return new Constant (String (text + start, i - start).getDoubleValue(), isResolutionTarget); return new Constant (String (text + start, i - start).getDoubleValue(), isResolutionTarget);
} }
const TermPtr readExpression()
{
TermPtr lhs (readMultiplyOrDivideExpression());
char opType;
while (lhs != 0 && readOperator ("+-", &opType))
{
TermPtr rhs (readMultiplyOrDivideExpression());
if (rhs == 0)
throw ParseError ("Expected expression after \"" + String::charToString (opType) + "\"");
if (opType == '+')
lhs = new Add (lhs, rhs);
else
lhs = new Subtract (lhs, rhs);
}
return lhs;
}
const TermPtr readMultiplyOrDivideExpression() const TermPtr readMultiplyOrDivideExpression()
{ {
TermPtr lhs (readUnaryExpression()); TermPtr lhs (readUnaryExpression());
@@ -981,21 +994,13 @@ Expression::Expression (const String& stringToParse)
{ {
int i = 0; int i = 0;
Helpers::Parser parser (stringToParse, i); Helpers::Parser parser (stringToParse, i);
term = parser.readExpression();
if (term == 0)
term = new Helpers::Constant (0, false);
term = parser.readUpToComma();
} }
const Expression Expression::parse (const String& stringToParse, int& textIndexToStartFrom) const Expression Expression::parse (const String& stringToParse, int& textIndexToStartFrom)
{ {
Helpers::Parser parser (stringToParse, textIndexToStartFrom); Helpers::Parser parser (stringToParse, textIndexToStartFrom);
const Helpers::TermPtr term (parser.readExpression());
if (term != 0)
return Expression (term);
return Expression();
return Expression (parser.readUpToComma());
} }
double Expression::evaluate() const double Expression::evaluate() const


+ 0
- 6
src/memory/juce_MemoryBlock.cpp View File

@@ -212,12 +212,6 @@ void MemoryBlock::copyTo (void* const dst, int offset, size_t num) const throw()
void MemoryBlock::removeSection (size_t startByte, size_t numBytesToRemove) void MemoryBlock::removeSection (size_t startByte, size_t numBytesToRemove)
{ {
if (startByte < 0)
{
numBytesToRemove += startByte;
startByte = 0;
}
if (startByte + numBytesToRemove >= size) if (startByte + numBytesToRemove >= size)
{ {
setSize (startByte); setSize (startByte);


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

@@ -801,16 +801,16 @@ public:
const int inputDeviceIndex_) const int inputDeviceIndex_)
: AudioIODevice (deviceName, "DirectSound"), : AudioIODevice (deviceName, "DirectSound"),
Thread ("Juce DSound"), Thread ("Juce DSound"),
isOpen_ (false),
isStarted (false),
outputDeviceIndex (outputDeviceIndex_), outputDeviceIndex (outputDeviceIndex_),
inputDeviceIndex (inputDeviceIndex_), inputDeviceIndex (inputDeviceIndex_),
isOpen_ (false),
isStarted (false),
bufferSizeSamples (0),
totalSamplesOut (0), totalSamplesOut (0),
sampleRate (0.0), sampleRate (0.0),
inputBuffers (1, 1), inputBuffers (1, 1),
outputBuffers (1, 1), outputBuffers (1, 1),
callback (0),
bufferSizeSamples (0)
callback (0)
{ {
if (outputDeviceIndex_ >= 0) if (outputDeviceIndex_ >= 0)
{ {


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

@@ -129,7 +129,7 @@ class FontDCHolder : private DeletedAtShutdown
public: public:
//============================================================================== //==============================================================================
FontDCHolder() FontDCHolder()
: dc (0), fontH (0), previousFontH (0), numKPs (0), size (0),
: fontH (0), previousFontH (0), dc (0), numKPs (0), size (0),
bold (false), italic (false) bold (false), italic (false)
{ {
} }


+ 4
- 5
src/native/windows/juce_win32_Network.cpp View File

@@ -37,8 +37,6 @@
#endif #endif
//============================================================================== //==============================================================================
static HINTERNET sessionHandle = 0;
#ifndef WORKAROUND_TIMEOUT_BUG #ifndef WORKAROUND_TIMEOUT_BUG
//#define WORKAROUND_TIMEOUT_BUG 1 //#define WORKAROUND_TIMEOUT_BUG 1
#endif #endif
@@ -48,8 +46,8 @@ static HINTERNET sessionHandle = 0;
class InternetConnectThread : public Thread class InternetConnectThread : public Thread
{ {
public: public:
InternetConnectThread (URL_COMPONENTS& uc_, HINTERNET& connection_, const bool isFtp_)
: Thread ("Internet"), uc (uc_), connection (connection_), isFtp (isFtp_)
InternetConnectThread (URL_COMPONENTS& uc_, HINTERNET sessionHandle_, HINTERNET& connection_, const bool isFtp_)
: Thread ("Internet"), uc (uc_), sessionHandle (sessionHandle_), connection (connection_), isFtp (isFtp_)
{ {
startThread(); startThread();
} }
@@ -71,6 +69,7 @@ public:
private: private:
URL_COMPONENTS& uc; URL_COMPONENTS& uc;
HINTERNET sessionHandle;
HINTERNET& connection; HINTERNET& connection;
const bool isFtp; const bool isFtp;
@@ -254,7 +253,7 @@ private:
connection = 0; connection = 0;
{ {
InternetConnectThread connectThread (uc, connection, isFtp);
InternetConnectThread connectThread (uc, sessionHandle, connection, isFtp);
connectThread.wait (timeOutMs); connectThread.wait (timeOutMs);
if (connection == 0) if (connection == 0)


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

@@ -81,8 +81,8 @@ public:
HGLRC contextToShareWith, HGLRC contextToShareWith,
const OpenGLPixelFormat& pixelFormat) const OpenGLPixelFormat& pixelFormat)
: renderContext (0), : renderContext (0),
dc (0),
component (component_)
component (component_),
dc (0)
{ {
jassert (component != 0); jassert (component != 0);


+ 3
- 3
src/native/windows/juce_win32_WASAPI.cpp View File

@@ -133,9 +133,9 @@ public:
WASAPIDeviceBase (const ComSmartPtr <IMMDevice>& device_, const bool useExclusiveMode_) WASAPIDeviceBase (const ComSmartPtr <IMMDevice>& device_, const bool useExclusiveMode_)
: device (device_), : device (device_),
sampleRate (0), sampleRate (0),
defaultSampleRate (0),
numChannels (0), numChannels (0),
actualNumChannels (0), actualNumChannels (0),
defaultSampleRate (0),
minBufferSize (0), minBufferSize (0),
defaultBufferSize (0), defaultBufferSize (0),
latencySamples (0), latencySamples (0),
@@ -548,11 +548,11 @@ public:
const bool useExclusiveMode_) const bool useExclusiveMode_)
: AudioIODevice (deviceName, "Windows Audio"), : AudioIODevice (deviceName, "Windows Audio"),
Thread ("Juce WASAPI"), Thread ("Juce WASAPI"),
isOpen_ (false),
isStarted (false),
outputDeviceId (outputDeviceId_), outputDeviceId (outputDeviceId_),
inputDeviceId (inputDeviceId_), inputDeviceId (inputDeviceId_),
useExclusiveMode (useExclusiveMode_), useExclusiveMode (useExclusiveMode_),
isOpen_ (false),
isStarted (false),
currentBufferSizeSamples (0), currentBufferSizeSamples (0),
currentSampleRate (0), currentSampleRate (0),
callback (0) callback (0)


+ 4
- 4
src/native/windows/juce_win32_Windowing.cpp View File

@@ -476,8 +476,8 @@ public:
constrainerIsResizing (false), constrainerIsResizing (false),
currentWindowIcon (0), currentWindowIcon (0),
dropTarget (0), dropTarget (0),
updateLayeredWindowAlpha (255),
parentToAddTo (parentToAddTo_)
parentToAddTo (parentToAddTo_),
updateLayeredWindowAlpha (255)
{ {
callFunctionIfNotLocked (&createWindowCallback, this); callFunctionIfNotLocked (&createWindowCallback, this);
@@ -1893,7 +1893,7 @@ private:
if (pDropFiles->fWide) if (pDropFiles->fWide)
{ {
const WCHAR* const fname = (WCHAR*) (((const char*) pDropFiles) + sizeof (DROPFILES));
const WCHAR* const fname = (WCHAR*) addBytesToPointer (pDropFiles, sizeof (DROPFILES));
for (;;) for (;;)
{ {
@@ -1910,7 +1910,7 @@ private:
} }
else else
{ {
const char* const fname = ((const char*) pDropFiles) + sizeof (DROPFILES);
const char* const fname = (const char*) addBytesToPointer (pDropFiles, sizeof (DROPFILES));
for (;;) for (;;)
{ {


Loading…
Cancel
Save