diff --git a/src/juce_appframework/gui/components/controls/juce_Slider.cpp b/src/juce_appframework/gui/components/controls/juce_Slider.cpp index df18a1d412..3f59acbae3 100644 --- a/src/juce_appframework/gui/components/controls/juce_Slider.cpp +++ b/src/juce_appframework/gui/components/controls/juce_Slider.cpp @@ -1261,7 +1261,7 @@ void Slider::mouseDrag (const MouseEvent& e) if (sliderBeingDragged == 0) { setValue (snapValue (valueWhenLastDragged, true), - ! sendChangeOnlyOnRelease, false); + ! sendChangeOnlyOnRelease, true); } else if (sliderBeingDragged == 1) { diff --git a/src/juce_appframework/gui/components/controls/juce_Toolbar.cpp b/src/juce_appframework/gui/components/controls/juce_Toolbar.cpp index eb60786c08..c99d322d9b 100644 --- a/src/juce_appframework/gui/components/controls/juce_Toolbar.cpp +++ b/src/juce_appframework/gui/components/controls/juce_Toolbar.cpp @@ -597,7 +597,8 @@ void Toolbar::buttonClicked (Button*) } //============================================================================== -bool Toolbar::isInterestedInDragSource (const String& sourceDescription) +bool Toolbar::isInterestedInDragSource (const String& sourceDescription, + Component* /*sourceComponent*/) { return sourceDescription == toolbarDragDescriptor && isEditingActive; } diff --git a/src/juce_appframework/gui/components/controls/juce_Toolbar.h b/src/juce_appframework/gui/components/controls/juce_Toolbar.h index 80fd0e12bb..8124723086 100644 --- a/src/juce_appframework/gui/components/controls/juce_Toolbar.h +++ b/src/juce_appframework/gui/components/controls/juce_Toolbar.h @@ -285,7 +285,7 @@ public: /** @internal */ void mouseDown (const MouseEvent&); /** @internal */ - bool isInterestedInDragSource (const String&); + bool isInterestedInDragSource (const String&, Component*); /** @internal */ void itemDragMove (const String&, Component*, int, int); /** @internal */ diff --git a/src/juce_appframework/gui/components/mouse/juce_DragAndDropContainer.cpp b/src/juce_appframework/gui/components/mouse/juce_DragAndDropContainer.cpp index 585edebb72..776545eded 100644 --- a/src/juce_appframework/gui/components/mouse/juce_DragAndDropContainer.cpp +++ b/src/juce_appframework/gui/components/mouse/juce_DragAndDropContainer.cpp @@ -116,7 +116,7 @@ public: if (over != 0 && over->isValidComponent() && source->isValidComponent() - && currentlyOver->isInterestedInDragSource (dragDesc)) + && currentlyOver->isInterestedInDragSource (dragDesc, source)) { currentlyOver->itemDragExit (dragDesc, source); } @@ -163,7 +163,7 @@ public: { DragAndDropTarget* const ddt = dynamic_cast (hit); - if (ddt != 0 && ddt->isInterestedInDragSource (dragDesc)) + if (ddt != 0 && ddt->isInterestedInDragSource (dragDesc, source)) { relX = screenX; relY = screenY; @@ -255,7 +255,7 @@ public: if (over != 0 && over->isValidComponent() && ! (sourceWatcher->hasBeenDeleted()) - && currentlyOver->isInterestedInDragSource (dragDesc)) + && currentlyOver->isInterestedInDragSource (dragDesc, source)) { currentlyOver->itemDragExit (dragDesc, source); } @@ -263,12 +263,12 @@ public: currentlyOver = ddt; if (currentlyOver != 0 - && currentlyOver->isInterestedInDragSource (dragDesc)) + && currentlyOver->isInterestedInDragSource (dragDesc, source)) currentlyOver->itemDragEnter (dragDesc, source, relX, relY); } if (currentlyOver != 0 - && currentlyOver->isInterestedInDragSource (dragDesc)) + && currentlyOver->isInterestedInDragSource (dragDesc, source)) currentlyOver->itemDragMove (dragDesc, source, relX, relY); if (currentlyOver == 0 diff --git a/src/juce_appframework/gui/components/mouse/juce_DragAndDropTarget.h b/src/juce_appframework/gui/components/mouse/juce_DragAndDropTarget.h index aa02c0f49d..c5d5517516 100644 --- a/src/juce_appframework/gui/components/mouse/juce_DragAndDropTarget.h +++ b/src/juce_appframework/gui/components/mouse/juce_DragAndDropTarget.h @@ -62,7 +62,8 @@ public: @returns true if this component wants to receive the other callbacks regarging this type of object; if it returns false, no other callbacks will be made. */ - virtual bool isInterestedInDragSource (const String& sourceDescription) = 0; + virtual bool isInterestedInDragSource (const String& sourceDescription, + Component* sourceComponent) = 0; /** Callback to indicate that something is being dragged over this component. diff --git a/src/juce_appframework/gui/graphics/imaging/image_file_formats/pnglib/pngerror.c b/src/juce_appframework/gui/graphics/imaging/image_file_formats/pnglib/pngerror.c index 26d2803243..1d96762d57 100644 --- a/src/juce_appframework/gui/graphics/imaging/image_file_formats/pnglib/pngerror.c +++ b/src/juce_appframework/gui/graphics/imaging/image_file_formats/pnglib/pngerror.c @@ -131,10 +131,10 @@ png_warning(png_structp png_ptr, png_const_charp warning_message) * if the character is invalid. */ #define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) -static PNG_CONST char png_digit[16] = { +/*static PNG_CONST char png_digit[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' -}; +};*/ #if !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT) static void /* PRIVATE */ diff --git a/src/juce_core/basics/juce_DataConversions.h b/src/juce_core/basics/juce_DataConversions.h index 0ceb1c2587..61be78eeb3 100644 --- a/src/juce_core/basics/juce_DataConversions.h +++ b/src/juce_core/basics/juce_DataConversions.h @@ -68,13 +68,20 @@ forcedinline uint32 swapByteOrder (uint32 n) throw() /** Swaps the byte-order of a 16-bit short. */ inline uint16 swapByteOrder (const uint16 n) throw() { +#if JUCE_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic! + // Win32 intrinsics version.. + return (uint16) _byteswap_ushort (n2); +#else return (uint16) ((n << 8) | (n >> 8)); +#endif } inline uint64 swapByteOrder (const uint64 value) throw() { #if JUCE_MAC return CFSwapInt64 (value); +#elif JUCE_USE_INTRINSICS + return _byteswap_uint64 (value); #else return (((int64) swapByteOrder ((uint32) value)) << 32) | swapByteOrder ((uint32) (value >> 32)); diff --git a/src/juce_core/io/streams/juce_BufferedInputStream.cpp b/src/juce_core/io/streams/juce_BufferedInputStream.cpp index 7d66144795..255e6eb64d 100644 --- a/src/juce_core/io/streams/juce_BufferedInputStream.cpp +++ b/src/juce_core/io/streams/juce_BufferedInputStream.cpp @@ -52,7 +52,7 @@ BufferedInputStream::BufferedInputStream (InputStream* const source_, if (sourceSize >= 0) bufferSize = jmin (jmax (32, sourceSize), bufferSize); - bufferStart = position + 1; + bufferStart = position; buffer = (char*) juce_malloc (bufferSize); } @@ -136,18 +136,20 @@ int BufferedInputStream::read (void* destBuffer, int maxBytesToRead) else { int bytesRead = 0; - char* d = (char*) destBuffer; - while (bytesRead < maxBytesToRead) + while (maxBytesToRead > 0) { ensureBuffered(); if (isExhausted()) break; - *d++ = buffer [position - bufferStart]; - ++position; - ++bytesRead; + const int bytesAvailable = jmin (maxBytesToRead, (int) (lastReadPos - position)); + memcpy (destBuffer, buffer + (position - bufferStart), bytesAvailable); + maxBytesToRead -= bytesAvailable; + bytesRead += bytesAvailable; + position += bytesAvailable; + destBuffer = (void*) (((char*) destBuffer) + bytesAvailable); } return bytesRead; diff --git a/src/juce_core/io/streams/juce_GZIPDecompressorInputStream.cpp b/src/juce_core/io/streams/juce_GZIPDecompressorInputStream.cpp index 4b69272ef5..fd6e09b97a 100644 --- a/src/juce_core/io/streams/juce_GZIPDecompressorInputStream.cpp +++ b/src/juce_core/io/streams/juce_GZIPDecompressorInputStream.cpp @@ -131,8 +131,10 @@ const int bufferSize = 32768; GZIPDecompressorInputStream::GZIPDecompressorInputStream (InputStream* const sourceStream_, const bool deleteSourceWhenDestroyed_, - const bool noWrap_) + const bool noWrap_, + const int64 uncompressedStreamLength_) : sourceStream (sourceStream_), + uncompressedStreamLength (uncompressedStreamLength_), deleteSourceWhenDestroyed (deleteSourceWhenDestroyed_), noWrap (noWrap_), isEof (false), @@ -150,13 +152,13 @@ GZIPDecompressorInputStream::~GZIPDecompressorInputStream() if (deleteSourceWhenDestroyed) delete sourceStream; - GZIPDecompressHelper* const h = (GZIPDecompressHelper*)helper; + GZIPDecompressHelper* const h = (GZIPDecompressHelper*) helper; delete h; } int64 GZIPDecompressorInputStream::getTotalLength() { - return -1; // unknown.. + return uncompressedStreamLength; } int GZIPDecompressorInputStream::read (void* destBuffer, int howMany) diff --git a/src/juce_core/io/streams/juce_GZIPDecompressorInputStream.h b/src/juce_core/io/streams/juce_GZIPDecompressorInputStream.h index acfc907538..540c071864 100644 --- a/src/juce_core/io/streams/juce_GZIPDecompressorInputStream.h +++ b/src/juce_core/io/streams/juce_GZIPDecompressorInputStream.h @@ -56,10 +56,14 @@ public: when this object is destroyed @param noWrap this is used internally by the ZipFile class and should be ignored by user applications + @param uncompressedStreamLength if the creator knows the length that the + uncompressed stream will be, then it can supply this + value, which will be returned by getTotalLength() */ GZIPDecompressorInputStream (InputStream* const sourceStream, const bool deleteSourceWhenDestroyed, - const bool noWrap = false); + const bool noWrap = false, + const int64 uncompressedStreamLength = -1); /** Destructor. */ ~GZIPDecompressorInputStream(); @@ -77,6 +81,7 @@ public: private: InputStream* const sourceStream; + const int64 uncompressedStreamLength; const bool deleteSourceWhenDestroyed, noWrap; bool isEof; int activeBufferSize; diff --git a/src/juce_core/misc/juce_ZipFile.cpp b/src/juce_core/misc/juce_ZipFile.cpp index 8c9a459481..496b31f0ae 100644 --- a/src/juce_core/misc/juce_ZipFile.cpp +++ b/src/juce_core/misc/juce_ZipFile.cpp @@ -197,7 +197,8 @@ InputStream* ZipFile::createStreamForEntry (const int index) if (zei->compressed) { - stream = new GZIPDecompressorInputStream (stream, true, true); + stream = new GZIPDecompressorInputStream (stream, true, true, + zei->entry.uncompressedSize); // (much faster to unzip in big blocks using a buffer..) stream = new BufferedInputStream (stream, 32768, true);