@@ -941,9 +941,7 @@ private: | |||||
} | } | ||||
bufferSizes.addIfNotAlreadyThere (preferredSize); | bufferSizes.addIfNotAlreadyThere (preferredSize); | ||||
DefaultElementComparator <int> comparator; | |||||
bufferSizes.sort (comparator); | |||||
bufferSizes.sort(); | |||||
} | } | ||||
double getSampleRate() const | double getSampleRate() const | ||||
@@ -889,17 +889,11 @@ public: | |||||
void readMaxLevels (int64 startSampleInFile, int64 numSamples, Range<float>* results, int numChannelsToRead) override | void readMaxLevels (int64 startSampleInFile, int64 numSamples, Range<float>* results, int numChannelsToRead) override | ||||
{ | { | ||||
if (numSamples <= 0) | |||||
{ | |||||
for (int i = 0; i < numChannelsToRead; ++i) | |||||
results[i] = Range<float>(); | |||||
numSamples = jmin (numSamples, lengthInSamples - startSampleInFile); | |||||
return; | |||||
} | |||||
if (map == nullptr || ! mappedSection.contains (Range<int64> (startSampleInFile, startSampleInFile + numSamples))) | |||||
if (map == nullptr || numSamples <= 0 || ! mappedSection.contains (Range<int64> (startSampleInFile, startSampleInFile + numSamples))) | |||||
{ | { | ||||
jassertfalse; // you must make sure that the window contains all the samples you're going to attempt to read. | |||||
jassert (numSamples <= 0); // you must make sure that the window contains all the samples you're going to attempt to read. | |||||
for (int i = 0; i < numChannelsToRead; ++i) | for (int i = 0; i < numChannelsToRead; ++i) | ||||
results[i] = Range<float>(); | results[i] = Range<float>(); | ||||
@@ -650,17 +650,23 @@ namespace WavFileHelpers | |||||
{ | { | ||||
while (input.getPosition() < chunkEnd) | while (input.getPosition() < chunkEnd) | ||||
{ | { | ||||
const int infoType = input.readInt(); | |||||
const int64 infoLength = jlimit ((int64) 0, chunkEnd - input.getPosition(), (int64) input.readInt()); | |||||
const int infoType = input.readInt(); | |||||
for (int i = 0; i < numElementsInArray (types); ++i) | |||||
int64 infoLength = chunkEnd - input.getPosition(); | |||||
if (infoLength > 0) | |||||
{ | { | ||||
if (isMatchingTypeIgnoringCase (infoType, types[i])) | |||||
infoLength = jlimit ((int64) 0, infoLength, (int64) input.readInt()); | |||||
for (int i = 0; i < numElementsInArray (types); ++i) | |||||
{ | { | ||||
MemoryBlock mb; | |||||
input.readIntoMemoryBlock (mb, (ssize_t) infoLength); | |||||
values.set (types[i], mb.toString()); | |||||
break; | |||||
if (isMatchingTypeIgnoringCase (infoType, types[i])) | |||||
{ | |||||
MemoryBlock mb; | |||||
input.readIntoMemoryBlock (mb, (ssize_t) infoLength); | |||||
values.set (types[i], mb.toString()); | |||||
break; | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -1513,17 +1519,11 @@ public: | |||||
void readMaxLevels (int64 startSampleInFile, int64 numSamples, Range<float>* results, int numChannelsToRead) override | void readMaxLevels (int64 startSampleInFile, int64 numSamples, Range<float>* results, int numChannelsToRead) override | ||||
{ | { | ||||
if (numSamples <= 0) | |||||
{ | |||||
for (int i = 0; i < numChannelsToRead; ++i) | |||||
results[i] = Range<float>(); | |||||
return; | |||||
} | |||||
numSamples = jmin (numSamples, lengthInSamples - startSampleInFile); | |||||
if (map == nullptr || ! mappedSection.contains (Range<int64> (startSampleInFile, startSampleInFile + numSamples))) | |||||
if (map == nullptr || numSamples <= 0 || ! mappedSection.contains (Range<int64> (startSampleInFile, startSampleInFile + numSamples))) | |||||
{ | { | ||||
jassertfalse; // you must make sure that the window contains all the samples you're going to attempt to read. | |||||
jassert (numSamples <= 0); // you must make sure that the window contains all the samples you're going to attempt to read. | |||||
for (int i = 0; i < numChannelsToRead; ++i) | for (int i = 0; i < numChannelsToRead; ++i) | ||||
results[i] = Range<float>(); | results[i] = Range<float>(); | ||||
@@ -1053,6 +1053,16 @@ public: | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
/** Sorts the array using a default comparison operation. | |||||
If the type of your elements isn't supported by the DefaultElementComparator class | |||||
then you may need to use the other version of sort, which takes a custom comparator. | |||||
*/ | |||||
void sort() | |||||
{ | |||||
DefaultElementComparator<ElementType> comparator; | |||||
sort (comparator); | |||||
} | |||||
/** Sorts the elements in the array. | /** Sorts the elements in the array. | ||||
This will use a comparator object to sort the elements into order. The object | This will use a comparator object to sort the elements into order. The object | ||||
@@ -1081,7 +1091,7 @@ public: | |||||
*/ | */ | ||||
template <class ElementComparator> | template <class ElementComparator> | ||||
void sort (ElementComparator& comparator, | void sort (ElementComparator& comparator, | ||||
const bool retainOrderOfEquivalentItems = false) const | |||||
const bool retainOrderOfEquivalentItems = false) | |||||
{ | { | ||||
const ScopedLockType lock (getLock()); | const ScopedLockType lock (getLock()); | ||||
(void) comparator; // if you pass in an object with a static compareElements() method, this | (void) comparator; // if you pass in an object with a static compareElements() method, this | ||||
@@ -911,7 +911,7 @@ bool File::createSymbolicLink (const File& linkFileToCreate, bool overwriteExist | |||||
} | } | ||||
return true; | return true; | ||||
#elif JUCE_WINDOWS | |||||
#elif JUCE_MSVC | |||||
return CreateSymbolicLink (linkFileToCreate.getFullPathName().toWideCharPointer(), | return CreateSymbolicLink (linkFileToCreate.getFullPathName().toWideCharPointer(), | ||||
fullPath.toWideCharPointer(), | fullPath.toWideCharPointer(), | ||||
isDirectory() ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0) != FALSE; | isDirectory() ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0) != FALSE; | ||||
@@ -114,7 +114,7 @@ | |||||
#if JUCE_MINGW | #if JUCE_MINGW | ||||
#include <basetyps.h> | #include <basetyps.h> | ||||
#include <sys/time.h> | #include <sys/time.h> | ||||
#define alloca __builtin_alloca | |||||
#define alloca(x) __builtin_alloca((x)) | |||||
#else | #else | ||||
#include <crtdbg.h> | #include <crtdbg.h> | ||||
#include <comutil.h> | #include <comutil.h> | ||||
@@ -643,6 +643,7 @@ bool File::isShortcut() const | |||||
File File::getLinkedTarget() const | File File::getLinkedTarget() const | ||||
{ | { | ||||
#if JUCE_MSVC | |||||
{ | { | ||||
HANDLE h = CreateFile (getFullPathName().toWideCharPointer(), | HANDLE h = CreateFile (getFullPathName().toWideCharPointer(), | ||||
GENERIC_READ, FILE_SHARE_READ, nullptr, | GENERIC_READ, FILE_SHARE_READ, nullptr, | ||||
@@ -662,13 +663,21 @@ File File::getLinkedTarget() const | |||||
if (requiredSize > 0) | if (requiredSize > 0) | ||||
{ | { | ||||
CloseHandle (h); | CloseHandle (h); | ||||
return File (String (buffer)); | |||||
const StringRef prefix ("\\\\?\\"); | |||||
const String path (buffer); | |||||
// It turns out that GetFinalPathNameByHandleW prepends \\?\ to the path. | |||||
// This is not a bug, it's feature. See MSDN for more information. | |||||
return File (path.startsWith (prefix) ? path.substring (prefix.length()) | |||||
: path); | |||||
} | } | ||||
} | } | ||||
CloseHandle (h); | CloseHandle (h); | ||||
} | } | ||||
} | } | ||||
#endif | |||||
File result (*this); | File result (*this); | ||||
String p (getFullPathName()); | String p (getFullPathName()); | ||||
@@ -36,7 +36,7 @@ | |||||
*/ | */ | ||||
#define JUCE_MAJOR_VERSION 4 | #define JUCE_MAJOR_VERSION 4 | ||||
#define JUCE_MINOR_VERSION 0 | #define JUCE_MINOR_VERSION 0 | ||||
#define JUCE_BUILDNUMBER 1 | |||||
#define JUCE_BUILDNUMBER 2 | |||||
/** Current Juce version number. | /** Current Juce version number. | ||||
@@ -30,7 +30,7 @@ class GZIPCompressorOutputStream::GZIPCompressorHelper | |||||
{ | { | ||||
public: | public: | ||||
GZIPCompressorHelper (const int compressionLevel, const int windowBits) | GZIPCompressorHelper (const int compressionLevel, const int windowBits) | ||||
: compLevel ((compressionLevel < 1 || compressionLevel > 9) ? -1 : compressionLevel), | |||||
: compLevel ((compressionLevel < 0 || compressionLevel > 9) ? -1 : compressionLevel), | |||||
isFirstDeflate (true), | isFirstDeflate (true), | ||||
streamIsValid (false), | streamIsValid (false), | ||||
finished (false) | finished (false) | ||||
@@ -48,9 +48,9 @@ public: | |||||
@param destStream the stream into which the compressed data should | @param destStream the stream into which the compressed data should | ||||
be written | be written | ||||
@param compressionLevel how much to compress the data, between 1 and 9, where | |||||
1 is the fastest/lowest compression, and 9 is the | |||||
slowest/highest compression. Any value outside this range | |||||
@param compressionLevel how much to compress the data, between 0 and 9, where | |||||
0 is non-compressed storage, 1 is the fastest/lowest compression, | |||||
and 9 is the slowest/highest compression. Any value outside this range | |||||
indicates that a default compression level should be used. | indicates that a default compression level should be used. | ||||
@param deleteDestStreamWhenDestroyed whether or not to delete the destStream object when | @param deleteDestStreamWhenDestroyed whether or not to delete the destStream object when | ||||
this stream is destroyed | this stream is destroyed | ||||
@@ -59,7 +59,7 @@ public: | |||||
its value for some reason | its value for some reason | ||||
*/ | */ | ||||
GZIPCompressorOutputStream (OutputStream* destStream, | GZIPCompressorOutputStream (OutputStream* destStream, | ||||
int compressionLevel = 0, | |||||
int compressionLevel = -1, | |||||
bool deleteDestStreamWhenDestroyed = false, | bool deleteDestStreamWhenDestroyed = false, | ||||
int windowBits = 0); | int windowBits = 0); | ||||
@@ -1084,6 +1084,7 @@ void TextEditor::colourChanged() | |||||
void TextEditor::lookAndFeelChanged() | void TextEditor::lookAndFeelChanged() | ||||
{ | { | ||||
caret = nullptr; | |||||
recreateCaret(); | recreateCaret(); | ||||
repaint(); | repaint(); | ||||
} | } | ||||