| @@ -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) | |||
| { | |||
| if (startByte < 0) | |||
| { | |||
| numBytesToRemove += startByte; | |||
| startByte = 0; | |||
| } | |||
| if (startByte + numBytesToRemove >= size) | |||
| { | |||
| setSize (startByte); | |||
| @@ -5271,25 +5265,17 @@ public: | |||
| 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: | |||
| @@ -5431,6 +5417,27 @@ public: | |||
| 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() | |||
| { | |||
| TermPtr lhs (readUnaryExpression()); | |||
| @@ -5594,21 +5601,13 @@ Expression::Expression (const String& stringToParse) | |||
| { | |||
| int i = 0; | |||
| 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) | |||
| { | |||
| 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 | |||
| @@ -28419,9 +28418,6 @@ bool MidiFile::readFrom (InputStream& sourceStream) | |||
| if (chunkSize <= 0) | |||
| break; | |||
| if (size < 0) | |||
| return false; | |||
| if (chunkType == (int) ByteOrder::bigEndianInt ("MTrk")) | |||
| { | |||
| readNextTrack (d, chunkSize); | |||
| @@ -28733,6 +28729,19 @@ END_JUCE_NAMESPACE | |||
| /*** Start of inlined file: juce_MidiMessage.cpp ***/ | |||
| 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() | |||
| { | |||
| numBytesUsed = 0; | |||
| @@ -29036,7 +29045,7 @@ int MidiMessage::getNoteNumber() const throw() | |||
| void MidiMessage::setNoteNumber (const int newNoteNumber) throw() | |||
| { | |||
| if (isNoteOnOrOff()) | |||
| data[1] = (uint8) jlimit (0, 127, newNoteNumber); | |||
| data[1] = newNoteNumber & 127; | |||
| } | |||
| uint8 MidiMessage::getVelocity() const throw() | |||
| @@ -29055,13 +29064,13 @@ float MidiMessage::getFloatVelocity() const throw() | |||
| void MidiMessage::setVelocity (const float newVelocity) throw() | |||
| { | |||
| 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() | |||
| { | |||
| 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() | |||
| @@ -29082,7 +29091,7 @@ const MidiMessage MidiMessage::aftertouchChange (const int channel, | |||
| jassert (isPositiveAndBelow (noteNum, (int) 128)); | |||
| jassert (isPositiveAndBelow (aftertouchValue, (int) 128)); | |||
| return MidiMessage (0xa0 | jlimit (0, 15, channel - 1), | |||
| return MidiMessage (MidiHelpers::initialByte (0xa0, channel), | |||
| noteNum & 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 (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() | |||
| @@ -29124,8 +29132,7 @@ const MidiMessage MidiMessage::programChange (const int channel, | |||
| { | |||
| 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() | |||
| @@ -29144,9 +29151,7 @@ const MidiMessage MidiMessage::pitchWheel (const int channel, | |||
| jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 | |||
| 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() | |||
| @@ -29168,44 +29173,33 @@ int MidiMessage::getControllerValue() const throw() | |||
| 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 | |||
| 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)); | |||
| } | |||
| 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 (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 (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() | |||
| @@ -29257,8 +29251,7 @@ bool MidiMessage::isSysEx() const throw() | |||
| 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; | |||
| memcpy (m + 1, sysexData, dataSize); | |||
| @@ -32820,7 +32813,7 @@ END_JUCE_NAMESPACE | |||
| #define STRICT | |||
| #include <windows.h> | |||
| #include <float.h> | |||
| #pragma warning (disable : 4312 4355) | |||
| #pragma warning (disable : 4312 4355 1899) | |||
| #elif JUCE_LINUX | |||
| #include <float.h> | |||
| #include <sys/time.h> | |||
| @@ -38621,26 +38614,16 @@ bool InterprocessConnection::sendMessage (const MemoryBlock& message) | |||
| messageData.copyFrom (messageHeader, 0, sizeof (messageHeader)); | |||
| messageData.copyFrom (message.getData(), sizeof (messageHeader), message.getSize()); | |||
| size_t bytesWritten = 0; | |||
| int bytesWritten = 0; | |||
| const ScopedLock sl (pipeAndSocketLock); | |||
| if (socket != 0) | |||
| { | |||
| bytesWritten = socket->write (messageData.getData(), (int) messageData.getSize()); | |||
| } | |||
| else if (pipe != 0) | |||
| { | |||
| 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_) | |||
| @@ -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) | |||
| { | |||
| @@ -48295,12 +48277,13 @@ void Label::hideEditor (const bool discardCurrentEditorContents) | |||
| { | |||
| 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(); | |||
| if (changed) | |||
| @@ -48466,9 +48449,8 @@ void Label::textEditorReturnKeyPressed (TextEditor& ed) | |||
| if (editor != 0) | |||
| { | |||
| jassert (&ed == editor); | |||
| (void) ed; | |||
| const bool changed = updateFromTextEditorContents(); | |||
| const bool changed = updateFromTextEditorContents (ed); | |||
| hideEditor (true); | |||
| if (changed) | |||
| @@ -61221,7 +61203,7 @@ public: | |||
| component->setVisible (! useProxyComponent); | |||
| } | |||
| int useTimeslice (const int elapsed) | |||
| bool useTimeslice (const int elapsed) | |||
| { | |||
| Component* const c = proxy != 0 ? static_cast <Component*> (proxy) | |||
| : static_cast <Component*> (component); | |||
| @@ -61269,13 +61251,13 @@ public: | |||
| } | |||
| if (stillBusy) | |||
| return 0; | |||
| return true; | |||
| } | |||
| } | |||
| } | |||
| moveToFinalDestination(); | |||
| return -1; | |||
| return false; | |||
| } | |||
| void moveToFinalDestination() | |||
| @@ -80302,7 +80284,7 @@ void RelativeCoordinatePositionerBase::ComponentScope::visitRelativeScope (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 | |||
| @@ -84066,7 +84048,7 @@ private: | |||
| SrcPixelType* sourceLineStart; | |||
| 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 | |||
| { | |||
| @@ -84074,7 +84056,7 @@ private: | |||
| } 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)); | |||
| } | |||
| @@ -86520,7 +86502,7 @@ const Rectangle<float> DrawableShape::getDrawableBounds() const | |||
| 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 globalY = (float) (y - originRelativeToComponent.getY()); | |||
| @@ -92255,7 +92237,7 @@ void Path::closeSubPath() | |||
| const Point<float> Path::getCurrentPosition() const | |||
| { | |||
| size_t i = numElements - 1; | |||
| int i = (int) numElements - 1; | |||
| if (i > 0 && data.elements[i] == closeSubPathMarker) | |||
| { | |||
| @@ -105773,8 +105755,8 @@ namespace FlacNamespace | |||
| { | |||
| #if JUCE_INCLUDE_FLAC_CODE | |||
| #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 | |||
| @@ -211698,6 +211680,9 @@ END_JUCE_NAMESPACE | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4390 4611) | |||
| #ifdef __INTEL_COMPILER | |||
| #pragma warning (disable: 2544 2545) | |||
| #endif | |||
| #endif | |||
| namespace zlibNamespace | |||
| @@ -239184,8 +239169,6 @@ void NamedPipe::cancelPendingReads() | |||
| #define INTERNET_OPTION_DISABLE_AUTODIAL 70 | |||
| #endif | |||
| static HINTERNET sessionHandle = 0; | |||
| #ifndef WORKAROUND_TIMEOUT_BUG | |||
| //#define WORKAROUND_TIMEOUT_BUG 1 | |||
| #endif | |||
| @@ -239195,8 +239178,8 @@ static HINTERNET sessionHandle = 0; | |||
| class InternetConnectThread : public Thread | |||
| { | |||
| 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(); | |||
| } | |||
| @@ -239218,6 +239201,7 @@ public: | |||
| private: | |||
| URL_COMPONENTS& uc; | |||
| HINTERNET sessionHandle; | |||
| HINTERNET& connection; | |||
| const bool isFtp; | |||
| @@ -239398,7 +239382,7 @@ private: | |||
| connection = 0; | |||
| { | |||
| InternetConnectThread connectThread (uc, connection, isFtp); | |||
| InternetConnectThread connectThread (uc, sessionHandle, connection, isFtp); | |||
| connectThread.wait (timeOutMs); | |||
| if (connection == 0) | |||
| @@ -240224,7 +240208,7 @@ class FontDCHolder : private DeletedAtShutdown | |||
| public: | |||
| 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) | |||
| { | |||
| } | |||
| @@ -241817,8 +241801,8 @@ public: | |||
| constrainerIsResizing (false), | |||
| currentWindowIcon (0), | |||
| dropTarget (0), | |||
| updateLayeredWindowAlpha (255), | |||
| parentToAddTo (parentToAddTo_) | |||
| parentToAddTo (parentToAddTo_), | |||
| updateLayeredWindowAlpha (255) | |||
| { | |||
| callFunctionIfNotLocked (&createWindowCallback, this); | |||
| @@ -243218,7 +243202,7 @@ private: | |||
| if (pDropFiles->fWide) | |||
| { | |||
| const WCHAR* const fname = (WCHAR*) (((const char*) pDropFiles) + sizeof (DROPFILES)); | |||
| const WCHAR* const fname = (WCHAR*) addBytesToPointer (pDropFiles, sizeof (DROPFILES)); | |||
| for (;;) | |||
| { | |||
| @@ -243235,7 +243219,7 @@ private: | |||
| } | |||
| else | |||
| { | |||
| const char* const fname = ((const char*) pDropFiles) + sizeof (DROPFILES); | |||
| const char* const fname = (const char*) addBytesToPointer (pDropFiles, sizeof (DROPFILES)); | |||
| for (;;) | |||
| { | |||
| @@ -245807,8 +245791,8 @@ public: | |||
| HGLRC contextToShareWith, | |||
| const OpenGLPixelFormat& pixelFormat) | |||
| : renderContext (0), | |||
| dc (0), | |||
| component (component_) | |||
| component (component_), | |||
| dc (0) | |||
| { | |||
| jassert (component != 0); | |||
| @@ -251056,16 +251040,16 @@ public: | |||
| const int inputDeviceIndex_) | |||
| : AudioIODevice (deviceName, "DirectSound"), | |||
| Thread ("Juce DSound"), | |||
| isOpen_ (false), | |||
| isStarted (false), | |||
| outputDeviceIndex (outputDeviceIndex_), | |||
| inputDeviceIndex (inputDeviceIndex_), | |||
| isOpen_ (false), | |||
| isStarted (false), | |||
| bufferSizeSamples (0), | |||
| totalSamplesOut (0), | |||
| sampleRate (0.0), | |||
| inputBuffers (1, 1), | |||
| outputBuffers (1, 1), | |||
| callback (0), | |||
| bufferSizeSamples (0) | |||
| callback (0) | |||
| { | |||
| if (outputDeviceIndex_ >= 0) | |||
| { | |||
| @@ -251750,9 +251734,9 @@ public: | |||
| WASAPIDeviceBase (const ComSmartPtr <IMMDevice>& device_, const bool useExclusiveMode_) | |||
| : device (device_), | |||
| sampleRate (0), | |||
| defaultSampleRate (0), | |||
| numChannels (0), | |||
| actualNumChannels (0), | |||
| defaultSampleRate (0), | |||
| minBufferSize (0), | |||
| defaultBufferSize (0), | |||
| latencySamples (0), | |||
| @@ -252162,11 +252146,11 @@ public: | |||
| const bool useExclusiveMode_) | |||
| : AudioIODevice (deviceName, "Windows Audio"), | |||
| Thread ("Juce WASAPI"), | |||
| isOpen_ (false), | |||
| isStarted (false), | |||
| outputDeviceId (outputDeviceId_), | |||
| inputDeviceId (inputDeviceId_), | |||
| useExclusiveMode (useExclusiveMode_), | |||
| isOpen_ (false), | |||
| isStarted (false), | |||
| currentBufferSizeSamples (0), | |||
| currentSampleRate (0), | |||
| callback (0) | |||
| @@ -35743,7 +35743,7 @@ public: | |||
| @param noteNumber the key number, 0 to 127 | |||
| @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. | |||
| @@ -39463,7 +39463,7 @@ private: | |||
| bool lossOfFocusDiscardsChanges : 1; | |||
| bool leftOfOwnerComp : 1; | |||
| bool updateFromTextEditorContents(); | |||
| bool updateFromTextEditorContents (TextEditor&); | |||
| void callChangeListeners(); | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Label); | |||
| @@ -62185,7 +62185,7 @@ public: | |||
| /** @internal */ | |||
| void paint (Graphics& g); | |||
| /** @internal */ | |||
| bool hitTest (int x, int y) const; | |||
| bool hitTest (int x, int y); | |||
| protected: | |||
| @@ -38,8 +38,8 @@ namespace FlacNamespace | |||
| { | |||
| #if JUCE_INCLUDE_FLAC_CODE | |||
| #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 | |||
| @@ -309,9 +309,6 @@ bool MidiFile::readFrom (InputStream& sourceStream) | |||
| if (chunkSize <= 0) | |||
| break; | |||
| if (size < 0) | |||
| return false; | |||
| if (chunkType == (int) ByteOrder::bigEndianInt ("MTrk")) | |||
| { | |||
| readNextTrack (d, chunkSize); | |||
| @@ -28,8 +28,20 @@ | |||
| BEGIN_JUCE_NAMESPACE | |||
| #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() | |||
| @@ -336,7 +348,7 @@ int MidiMessage::getNoteNumber() const throw() | |||
| void MidiMessage::setNoteNumber (const int newNoteNumber) throw() | |||
| { | |||
| if (isNoteOnOrOff()) | |||
| data[1] = (uint8) jlimit (0, 127, newNoteNumber); | |||
| data[1] = newNoteNumber & 127; | |||
| } | |||
| uint8 MidiMessage::getVelocity() const throw() | |||
| @@ -355,13 +367,13 @@ float MidiMessage::getFloatVelocity() const throw() | |||
| void MidiMessage::setVelocity (const float newVelocity) throw() | |||
| { | |||
| 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() | |||
| { | |||
| 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() | |||
| @@ -382,7 +394,7 @@ const MidiMessage MidiMessage::aftertouchChange (const int channel, | |||
| jassert (isPositiveAndBelow (noteNum, (int) 128)); | |||
| jassert (isPositiveAndBelow (aftertouchValue, (int) 128)); | |||
| return MidiMessage (0xa0 | jlimit (0, 15, channel - 1), | |||
| return MidiMessage (MidiHelpers::initialByte (0xa0, channel), | |||
| noteNum & 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 (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() | |||
| @@ -424,8 +435,7 @@ const MidiMessage MidiMessage::programChange (const int channel, | |||
| { | |||
| 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() | |||
| @@ -444,9 +454,7 @@ const MidiMessage MidiMessage::pitchWheel (const int channel, | |||
| jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 | |||
| 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() | |||
| @@ -468,44 +476,33 @@ int MidiMessage::getControllerValue() const throw() | |||
| 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 | |||
| 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)); | |||
| } | |||
| 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 (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 (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() | |||
| @@ -558,8 +555,7 @@ bool MidiMessage::isSysEx() const throw() | |||
| 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; | |||
| memcpy (m + 1, sysexData, dataSize); | |||
| @@ -245,7 +245,7 @@ public: | |||
| @param noteNumber the key number, 0 to 127 | |||
| @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. | |||
| @@ -35,7 +35,7 @@ | |||
| #define STRICT | |||
| #include <windows.h> | |||
| #include <float.h> | |||
| #pragma warning (disable : 4312 4355) | |||
| #pragma warning (disable : 4312 4355 1899) | |||
| #elif JUCE_LINUX | |||
| #include <float.h> | |||
| #include <sys/time.h> | |||
| @@ -168,26 +168,16 @@ bool InterprocessConnection::sendMessage (const MemoryBlock& message) | |||
| messageData.copyFrom (messageHeader, 0, sizeof (messageHeader)); | |||
| messageData.copyFrom (message.getData(), sizeof (messageHeader), message.getSize()); | |||
| size_t bytesWritten = 0; | |||
| int bytesWritten = 0; | |||
| const ScopedLock sl (pipeAndSocketLock); | |||
| if (socket != 0) | |||
| { | |||
| bytesWritten = socket->write (messageData.getData(), (int) messageData.getSize()); | |||
| } | |||
| else if (pipe != 0) | |||
| { | |||
| bytesWritten = pipe->write (messageData.getData(), (int) messageData.getSize()); | |||
| } | |||
| if (bytesWritten < 0) | |||
| { | |||
| // error.. | |||
| return false; | |||
| } | |||
| return (bytesWritten == messageData.getSize()); | |||
| return bytesWritten == (int) messageData.getSize(); | |||
| } | |||
| //============================================================================== | |||
| @@ -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) | |||
| { | |||
| @@ -266,12 +265,13 @@ void Label::hideEditor (const bool discardCurrentEditorContents) | |||
| { | |||
| 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(); | |||
| if (changed) | |||
| @@ -441,9 +441,8 @@ void Label::textEditorReturnKeyPressed (TextEditor& ed) | |||
| if (editor != 0) | |||
| { | |||
| jassert (&ed == editor); | |||
| (void) ed; | |||
| const bool changed = updateFromTextEditorContents(); | |||
| const bool changed = updateFromTextEditorContents (ed); | |||
| hideEditor (true); | |||
| if (changed) | |||
| @@ -327,7 +327,7 @@ private: | |||
| bool lossOfFocusDiscardsChanges : 1; | |||
| bool leftOfOwnerComp : 1; | |||
| bool updateFromTextEditorContents(); | |||
| bool updateFromTextEditorContents (TextEditor&); | |||
| void callChangeListeners(); | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Label); | |||
| @@ -75,7 +75,7 @@ void RelativeCoordinatePositionerBase::ComponentScope::visitRelativeScope (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 | |||
| @@ -543,7 +543,7 @@ private: | |||
| SrcPixelType* sourceLineStart; | |||
| 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 | |||
| { | |||
| @@ -551,7 +551,7 @@ private: | |||
| } 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)); | |||
| } | |||
| @@ -196,7 +196,7 @@ const Rectangle<float> DrawableShape::getDrawableBounds() const | |||
| 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 globalY = (float) (y - originRelativeToComponent.getY()); | |||
| @@ -152,7 +152,7 @@ public: | |||
| /** @internal */ | |||
| void paint (Graphics& g); | |||
| /** @internal */ | |||
| bool hitTest (int x, int y) const; | |||
| bool hitTest (int x, int y); | |||
| protected: | |||
| //============================================================================== | |||
| @@ -337,7 +337,7 @@ void Path::closeSubPath() | |||
| const Point<float> Path::getCurrentPosition() const | |||
| { | |||
| size_t i = numElements - 1; | |||
| int i = (int) numElements - 1; | |||
| if (i > 0 && data.elements[i] == closeSubPathMarker) | |||
| { | |||
| @@ -28,6 +28,9 @@ | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4390 4611) | |||
| #ifdef __INTEL_COMPILER | |||
| #pragma warning (disable: 2544 2545) | |||
| #endif | |||
| #endif | |||
| namespace zlibNamespace | |||
| @@ -656,25 +656,17 @@ public: | |||
| 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: | |||
| @@ -817,6 +809,27 @@ public: | |||
| 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() | |||
| { | |||
| TermPtr lhs (readUnaryExpression()); | |||
| @@ -981,21 +994,13 @@ Expression::Expression (const String& stringToParse) | |||
| { | |||
| int i = 0; | |||
| 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) | |||
| { | |||
| 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 | |||
| @@ -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) | |||
| { | |||
| if (startByte < 0) | |||
| { | |||
| numBytesToRemove += startByte; | |||
| startByte = 0; | |||
| } | |||
| if (startByte + numBytesToRemove >= size) | |||
| { | |||
| setSize (startByte); | |||
| @@ -801,16 +801,16 @@ public: | |||
| const int inputDeviceIndex_) | |||
| : AudioIODevice (deviceName, "DirectSound"), | |||
| Thread ("Juce DSound"), | |||
| isOpen_ (false), | |||
| isStarted (false), | |||
| outputDeviceIndex (outputDeviceIndex_), | |||
| inputDeviceIndex (inputDeviceIndex_), | |||
| isOpen_ (false), | |||
| isStarted (false), | |||
| bufferSizeSamples (0), | |||
| totalSamplesOut (0), | |||
| sampleRate (0.0), | |||
| inputBuffers (1, 1), | |||
| outputBuffers (1, 1), | |||
| callback (0), | |||
| bufferSizeSamples (0) | |||
| callback (0) | |||
| { | |||
| if (outputDeviceIndex_ >= 0) | |||
| { | |||
| @@ -129,7 +129,7 @@ class FontDCHolder : private DeletedAtShutdown | |||
| public: | |||
| //============================================================================== | |||
| 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) | |||
| { | |||
| } | |||
| @@ -37,8 +37,6 @@ | |||
| #endif | |||
| //============================================================================== | |||
| static HINTERNET sessionHandle = 0; | |||
| #ifndef WORKAROUND_TIMEOUT_BUG | |||
| //#define WORKAROUND_TIMEOUT_BUG 1 | |||
| #endif | |||
| @@ -48,8 +46,8 @@ static HINTERNET sessionHandle = 0; | |||
| class InternetConnectThread : public Thread | |||
| { | |||
| 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(); | |||
| } | |||
| @@ -71,6 +69,7 @@ public: | |||
| private: | |||
| URL_COMPONENTS& uc; | |||
| HINTERNET sessionHandle; | |||
| HINTERNET& connection; | |||
| const bool isFtp; | |||
| @@ -254,7 +253,7 @@ private: | |||
| connection = 0; | |||
| { | |||
| InternetConnectThread connectThread (uc, connection, isFtp); | |||
| InternetConnectThread connectThread (uc, sessionHandle, connection, isFtp); | |||
| connectThread.wait (timeOutMs); | |||
| if (connection == 0) | |||
| @@ -81,8 +81,8 @@ public: | |||
| HGLRC contextToShareWith, | |||
| const OpenGLPixelFormat& pixelFormat) | |||
| : renderContext (0), | |||
| dc (0), | |||
| component (component_) | |||
| component (component_), | |||
| dc (0) | |||
| { | |||
| jassert (component != 0); | |||
| @@ -133,9 +133,9 @@ public: | |||
| WASAPIDeviceBase (const ComSmartPtr <IMMDevice>& device_, const bool useExclusiveMode_) | |||
| : device (device_), | |||
| sampleRate (0), | |||
| defaultSampleRate (0), | |||
| numChannels (0), | |||
| actualNumChannels (0), | |||
| defaultSampleRate (0), | |||
| minBufferSize (0), | |||
| defaultBufferSize (0), | |||
| latencySamples (0), | |||
| @@ -548,11 +548,11 @@ public: | |||
| const bool useExclusiveMode_) | |||
| : AudioIODevice (deviceName, "Windows Audio"), | |||
| Thread ("Juce WASAPI"), | |||
| isOpen_ (false), | |||
| isStarted (false), | |||
| outputDeviceId (outputDeviceId_), | |||
| inputDeviceId (inputDeviceId_), | |||
| useExclusiveMode (useExclusiveMode_), | |||
| isOpen_ (false), | |||
| isStarted (false), | |||
| currentBufferSizeSamples (0), | |||
| currentSampleRate (0), | |||
| callback (0) | |||
| @@ -476,8 +476,8 @@ public: | |||
| constrainerIsResizing (false), | |||
| currentWindowIcon (0), | |||
| dropTarget (0), | |||
| updateLayeredWindowAlpha (255), | |||
| parentToAddTo (parentToAddTo_) | |||
| parentToAddTo (parentToAddTo_), | |||
| updateLayeredWindowAlpha (255) | |||
| { | |||
| callFunctionIfNotLocked (&createWindowCallback, this); | |||
| @@ -1893,7 +1893,7 @@ private: | |||
| if (pDropFiles->fWide) | |||
| { | |||
| const WCHAR* const fname = (WCHAR*) (((const char*) pDropFiles) + sizeof (DROPFILES)); | |||
| const WCHAR* const fname = (WCHAR*) addBytesToPointer (pDropFiles, sizeof (DROPFILES)); | |||
| for (;;) | |||
| { | |||
| @@ -1910,7 +1910,7 @@ private: | |||
| } | |||
| else | |||
| { | |||
| const char* const fname = ((const char*) pDropFiles) + sizeof (DROPFILES); | |||
| const char* const fname = (const char*) addBytesToPointer (pDropFiles, sizeof (DROPFILES)); | |||
| for (;;) | |||
| { | |||