diff --git a/extras/Jucer (experimental)/Source/Project/jucer_ProjectExport_XCode.h b/extras/Jucer (experimental)/Source/Project/jucer_ProjectExport_XCode.h index e154ee44b1..d6f12a7603 100644 --- a/extras/Jucer (experimental)/Source/Project/jucer_ProjectExport_XCode.h +++ b/extras/Jucer (experimental)/Source/Project/jucer_ProjectExport_XCode.h @@ -98,6 +98,14 @@ public: props.add (new TextPropertyComponent (getSetting ("documentExtensions"), "Document file extensions", 128, false)); props.getLast()->setTooltip ("A comma-separated list of file extensions for documents that your app can open."); } + else if (iPhone) + { + props.add (new BooleanPropertyComponent (getSetting ("UIFileSharingEnabled"), "File Sharing Enabled", "Enabled")); + props.getLast()->setTooltip ("Enable this to expose your app's files to iTunes."); + + props.add (new BooleanPropertyComponent (getSetting ("UIStatusBarHidden"), "Status Bar Hidden", "Enabled")); + props.getLast()->setTooltip ("Enable this to disable the status bar in your app."); + } } void launchProject() @@ -326,6 +334,9 @@ private: XmlElement plist ("plist"); XmlElement* dict = plist.createNewChildElement ("dict"); + if (iPhone) + addPlistDictionaryKeyBool (dict, "LSRequiresIPhoneOS", true); + addPlistDictionaryKey (dict, "CFBundleExecutable", "${EXECUTABLE_NAME}"); addPlistDictionaryKey (dict, "CFBundleIconFile", iconFile.exists() ? iconFile.getFileName() : String::empty); addPlistDictionaryKey (dict, "CFBundleIdentifier", project.getBundleIdentifier().toString()); @@ -370,6 +381,12 @@ private: } } + if (getSetting ("UIFileSharingEnabled").getValue()) + addPlistDictionaryKeyBool (dict, "UIFileSharingEnabled", true); + + if (getSetting ("UIStatusBarHidden").getValue()) + addPlistDictionaryKeyBool (dict, "UIStatusBarHidden", true); + MemoryOutputStream mo; plist.writeToStream (mo, ""); @@ -730,6 +747,12 @@ private: xml->createNewChildElement ("string")->addTextElement (value); } + static void addPlistDictionaryKeyBool (XmlElement* xml, const String& key, const bool value) + { + xml->createNewChildElement ("key")->addTextElement (key); + xml->createNewChildElement (value ? "true" : "false"); + } + const String addBuildFile (const RelativePath& path, const String& fileRefID, bool addToSourceBuildPhase, bool inhibitWarnings) { String fileID (createID (path.toUnixStyle() + "buildref")); diff --git a/extras/audio plugin host/Source/HostStartup.cpp b/extras/audio plugin host/Source/HostStartup.cpp index ddd7861980..46cd8541b6 100644 --- a/extras/audio plugin host/Source/HostStartup.cpp +++ b/extras/audio plugin host/Source/HostStartup.cpp @@ -48,7 +48,7 @@ public: { } - void initialise (const String& /*commandLine*/) + void initialise (const String& commandLine) { // initialise our settings file.. ApplicationProperties::getInstance() diff --git a/extras/audio plugin host/Source/MainHostWindow.h b/extras/audio plugin host/Source/MainHostWindow.h index 1c167822b3..59e2b6d366 100644 --- a/extras/audio plugin host/Source/MainHostWindow.h +++ b/extras/audio plugin host/Source/MainHostWindow.h @@ -83,6 +83,8 @@ public: void addPluginsToMenu (PopupMenu& m) const; const PluginDescription* getChosenType (const int menuID) const; + GraphDocumentComponent* getGraphEditor() const; + private: //============================================================================== AudioDeviceManager deviceManager; @@ -92,7 +94,6 @@ private: KnownPluginList::SortMethod pluginSortMethod; void showAudioSettings(); - GraphDocumentComponent* getGraphEditor() const; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainHostWindow); }; diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index bf23df53c0..19779450a8 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -7567,7 +7567,13 @@ const String File::parseAbsolutePath (const String& p) } #else // Mac or Linux.. - String path (p.replaceCharacter ('\\', '/')); + + // Yes, I know it's legal for a unix pathname to contain a backslash, but this assertion is here + // to catch anyone who's trying to run code that was written on Windows with hard-coded path names. + // If that's why you've ended up here, use File::getChildFile() to build your paths instead. + jassert ((! p.containsChar ('\\')) || (p.indexOfChar ('/') >= 0 && p.indexOfChar ('/') < p.indexOfChar ('\\'))); + + String path (p); if (path.startsWithChar ('~')) { @@ -7808,11 +7814,11 @@ bool File::isAChildOf (const File& potentialParent) const bool File::isAbsolutePath (const String& path) { return path.startsWithChar ('/') || path.startsWithChar ('\\') -#if JUCE_WINDOWS + #if JUCE_WINDOWS || (path.isNotEmpty() && path[1] == ':'); -#else + #else || path.startsWithChar ('~'); -#endif + #endif } const File File::getChildFile (String relativePath) const @@ -7829,11 +7835,12 @@ const File File::getChildFile (String relativePath) const if (relativePath[0] == '.') { -#if JUCE_WINDOWS + #if JUCE_WINDOWS relativePath = relativePath.replaceCharacter ('/', '\\').trimStart(); -#else - relativePath = relativePath.replaceCharacter ('\\', '/').trimStart(); -#endif + #else + relativePath = relativePath.trimStart(); + #endif + while (relativePath[0] == '.') { if (relativePath[1] == '.') @@ -20657,7 +20664,7 @@ AudioFormatReader* AiffAudioFormat::createReaderFor (InputStream* sourceStream, { ScopedPointer w (new AiffAudioFormatReader (sourceStream)); - if (w->sampleRate != 0) + if (w->sampleRate > 0) return w.release(); if (! deleteStreamIfOpeningFails) @@ -22618,10 +22625,13 @@ public: { if (destSamples[j] != 0) { - const short* const src = ((const short*) bufferList->mBuffers[0].mData) + j; + const short* src = ((const short*) bufferList->mBuffers[0].mData) + j; for (int i = 0; i < samplesReceived; ++i) - destSamples[j][startOffsetInDestBuffer + i] = src [i << 1] << 16; + { + destSamples[j][startOffsetInDestBuffer + i] = (*src << 16); + src += numChannels; + } } } @@ -23398,7 +23408,7 @@ AudioFormatReader* WavAudioFormat::createReaderFor (InputStream* sourceStream, { ScopedPointer r (new WavAudioFormatReader (sourceStream)); - if (r->sampleRate != 0) + if (r->sampleRate > 0) return r.release(); if (! deleteStreamIfOpeningFails) @@ -23870,7 +23880,7 @@ void AudioTransportSource::setSource (PositionableAudioSource* const newSource, newPositionableSource->setNextReadPosition (0); - if (sourceSampleRateToCorrectFor != 0) + if (sourceSampleRateToCorrectFor > 0) newMasterSource = newResamplerSource = new ResamplingAudioSource (newPositionableSource, false, maxNumChannels); else @@ -24013,7 +24023,7 @@ void AudioTransportSource::prepareToPlay (int samplesPerBlockExpected, if (masterSource != 0) masterSource->prepareToPlay (samplesPerBlockExpected, sampleRate); - if (resamplerSource != 0 && sourceSampleRate != 0) + if (resamplerSource != 0 && sourceSampleRate > 0) resamplerSource->setResamplingRatio (sourceSampleRate / sampleRate); isPrepared = true; @@ -24668,7 +24678,7 @@ void MixerAudioSource::addInputSource (AudioSource* input, const bool deleteWhen localBufferSize = bufferSizeExpected; } - if (localRate != 0.0) + if (localRate > 0.0) input->prepareToPlay (localBufferSize, localRate); const ScopedLock sl (lock); @@ -25516,7 +25526,7 @@ double AudioDeviceManager::chooseBestSampleRate (double rate) const { const double sr = currentAudioDevice->getSampleRate (i); - if (sr >= 44100.0 && (lowestAbove44 == 0 || sr < lowestAbove44)) + if (sr >= 44100.0 && (lowestAbove44 < 1.0 || sr < lowestAbove44)) lowestAbove44 = sr; } @@ -28043,7 +28053,6 @@ namespace MidiFileHelpers break; } } - } return correctedTempoTime + (time - tempoTime) * secsPerTick; @@ -28062,19 +28071,16 @@ namespace MidiFileHelpers { const double diff = (first->message.getTimeStamp() - second->message.getTimeStamp()); - if (diff == 0) - { - if (first->message.isNoteOff() && second->message.isNoteOn()) - return -1; - else if (first->message.isNoteOn() && second->message.isNoteOff()) - return 1; - else - return 0; - } - else - { - return (diff > 0) ? 1 : -1; - } + if (diff > 0) + return 1; + else if (diff < 0) + return -1; + else if (first->message.isNoteOff() && second->message.isNoteOn()) + return -1; + else if (first->message.isNoteOn() && second->message.isNoteOff()) + return 1; + + return 0; } }; } @@ -62983,7 +62989,7 @@ void ResizableEdgeComponent::paint (Graphics& g) isMouseOver(), isMouseButtonDown()); } -void ResizableEdgeComponent::mouseDown (const MouseEvent& e) +void ResizableEdgeComponent::mouseDown (const MouseEvent&) { if (component == 0) { @@ -81073,7 +81079,7 @@ void Colour::getHSB (float& h, float& s, float& v) const throw() { s = (hi - lo) / (float) hi; - if (s != 0) + if (s > 0) { const float invDiff = 1.0f / (hi - lo); @@ -81451,6 +81457,16 @@ bool ColourGradient::isInvisible() const throw() return true; } +bool ColourGradient::ColourPoint::operator== (const ColourPoint& other) const throw() +{ + return position == other.position && colour == other.colour; +} + +bool ColourGradient::ColourPoint::operator!= (const ColourPoint& other) const throw() +{ + return position != other.position || colour != other.colour; +} + END_JUCE_NAMESPACE /*** End of inlined file: juce_ColourGradient.cpp ***/ @@ -86641,7 +86657,7 @@ public: owner.repaint(); } - void applyNewBounds (const Rectangle& newBounds) + void applyNewBounds (const Rectangle&) { jassertfalse; // drawables can't be resized directly! } @@ -87701,7 +87717,7 @@ public: owner.applyRelativePath (*owner.relativePath, &scope); } - void applyNewBounds (const Rectangle& newBounds) + void applyNewBounds (const Rectangle&) { jassertfalse; // drawables can't be resized directly! } @@ -93782,6 +93798,12 @@ PathFlatteningIterator::~PathFlatteningIterator() { } +bool PathFlatteningIterator::isLastInSubpath() const throw() +{ + return stackPos == stackBase.getData() + && (index >= path.numElements || points [index] == Path::moveMarker); +} + bool PathFlatteningIterator::next() { x1 = x2; @@ -129170,7 +129192,7 @@ AudioFormatReader* FlacAudioFormat::createReaderFor (InputStream* in, { ScopedPointer r (new FlacReader (in)); - if (r->sampleRate != 0) + if (r->sampleRate > 0) return r.release(); if (! deleteStreamIfOpeningFails) @@ -188176,7 +188198,7 @@ AudioFormatReader* OggVorbisAudioFormat::createReaderFor (InputStream* in, { ScopedPointer r (new OggReader (in)); - if (r->sampleRate != 0) + if (r->sampleRate > 0) return r.release(); if (! deleteStreamIfOpeningFails) diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 1cdf6cb1ce..d0e8a9c7ed 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -24103,7 +24103,7 @@ public: const Point delta (end - start); const double length = juce_hypot ((double) delta.getX(), (double) delta.getY()); - if (length == 0) + if (length <= 0) return start; return Point (start.getX() + (ValueType) ((delta.getX() * distanceFromStart - delta.getY() * perpendicularDistance) / length), @@ -27692,8 +27692,8 @@ private: : position (position_), colour (colour_) {} - bool operator== (const ColourPoint& other) const throw() { return position == other.position && colour == other.colour; } - bool operator!= (const ColourPoint& other) const throw() { return position != other.position || colour != other.colour; } + bool operator== (const ColourPoint& other) const throw(); + bool operator!= (const ColourPoint& other) const throw(); double position; Colour colour; @@ -65679,8 +65679,7 @@ public: int subPathIndex; /** Returns true if the current segment is the last in the current sub-path. */ - bool isLastInSubpath() const throw() { return stackPos == stackBase.getData() - && (index >= path.numElements || points [index] == Path::moveMarker); } + bool isLastInSubpath() const throw(); /** This is the default value that should be used for the tolerance value (see the constructor parameters). */ static const float defaultTolerance; diff --git a/src/audio/audio_file_formats/juce_AiffAudioFormat.cpp b/src/audio/audio_file_formats/juce_AiffAudioFormat.cpp index 403ab66942..5140a083d2 100644 --- a/src/audio/audio_file_formats/juce_AiffAudioFormat.cpp +++ b/src/audio/audio_file_formats/juce_AiffAudioFormat.cpp @@ -404,7 +404,7 @@ AudioFormatReader* AiffAudioFormat::createReaderFor (InputStream* sourceStream, { ScopedPointer w (new AiffAudioFormatReader (sourceStream)); - if (w->sampleRate != 0) + if (w->sampleRate > 0) return w.release(); if (! deleteStreamIfOpeningFails) diff --git a/src/audio/audio_file_formats/juce_FlacAudioFormat.cpp b/src/audio/audio_file_formats/juce_FlacAudioFormat.cpp index 075afc1244..228a0d50dd 100644 --- a/src/audio/audio_file_formats/juce_FlacAudioFormat.cpp +++ b/src/audio/audio_file_formats/juce_FlacAudioFormat.cpp @@ -507,7 +507,7 @@ AudioFormatReader* FlacAudioFormat::createReaderFor (InputStream* in, { ScopedPointer r (new FlacReader (in)); - if (r->sampleRate != 0) + if (r->sampleRate > 0) return r.release(); if (! deleteStreamIfOpeningFails) diff --git a/src/audio/audio_file_formats/juce_OggVorbisAudioFormat.cpp b/src/audio/audio_file_formats/juce_OggVorbisAudioFormat.cpp index 0194df9ee9..bcf0d69f41 100644 --- a/src/audio/audio_file_formats/juce_OggVorbisAudioFormat.cpp +++ b/src/audio/audio_file_formats/juce_OggVorbisAudioFormat.cpp @@ -426,7 +426,7 @@ AudioFormatReader* OggVorbisAudioFormat::createReaderFor (InputStream* in, { ScopedPointer r (new OggReader (in)); - if (r->sampleRate != 0) + if (r->sampleRate > 0) return r.release(); if (! deleteStreamIfOpeningFails) diff --git a/src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp b/src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp index f3cb02dffe..2e7ce0656c 100644 --- a/src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp +++ b/src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp @@ -280,10 +280,13 @@ public: { if (destSamples[j] != 0) { - const short* const src = ((const short*) bufferList->mBuffers[0].mData) + j; + const short* src = ((const short*) bufferList->mBuffers[0].mData) + j; for (int i = 0; i < samplesReceived; ++i) - destSamples[j][startOffsetInDestBuffer + i] = src [i << 1] << 16; + { + destSamples[j][startOffsetInDestBuffer + i] = (*src << 16); + src += numChannels; + } } } diff --git a/src/audio/audio_file_formats/juce_WavAudioFormat.cpp b/src/audio/audio_file_formats/juce_WavAudioFormat.cpp index 64401dd6e7..837c3edbae 100644 --- a/src/audio/audio_file_formats/juce_WavAudioFormat.cpp +++ b/src/audio/audio_file_formats/juce_WavAudioFormat.cpp @@ -718,7 +718,7 @@ AudioFormatReader* WavAudioFormat::createReaderFor (InputStream* sourceStream, { ScopedPointer r (new WavAudioFormatReader (sourceStream)); - if (r->sampleRate != 0) + if (r->sampleRate > 0) return r.release(); if (! deleteStreamIfOpeningFails) diff --git a/src/audio/audio_sources/juce_AudioTransportSource.cpp b/src/audio/audio_sources/juce_AudioTransportSource.cpp index b21e148cc1..bc302bfddb 100644 --- a/src/audio/audio_sources/juce_AudioTransportSource.cpp +++ b/src/audio/audio_sources/juce_AudioTransportSource.cpp @@ -94,7 +94,7 @@ void AudioTransportSource::setSource (PositionableAudioSource* const newSource, newPositionableSource->setNextReadPosition (0); - if (sourceSampleRateToCorrectFor != 0) + if (sourceSampleRateToCorrectFor > 0) newMasterSource = newResamplerSource = new ResamplingAudioSource (newPositionableSource, false, maxNumChannels); else @@ -237,7 +237,7 @@ void AudioTransportSource::prepareToPlay (int samplesPerBlockExpected, if (masterSource != 0) masterSource->prepareToPlay (samplesPerBlockExpected, sampleRate); - if (resamplerSource != 0 && sourceSampleRate != 0) + if (resamplerSource != 0 && sourceSampleRate > 0) resamplerSource->setResamplingRatio (sourceSampleRate / sampleRate); isPrepared = true; diff --git a/src/audio/audio_sources/juce_MixerAudioSource.cpp b/src/audio/audio_sources/juce_MixerAudioSource.cpp index c956cd1184..52dae954e5 100644 --- a/src/audio/audio_sources/juce_MixerAudioSource.cpp +++ b/src/audio/audio_sources/juce_MixerAudioSource.cpp @@ -59,7 +59,7 @@ void MixerAudioSource::addInputSource (AudioSource* input, const bool deleteWhen localBufferSize = bufferSizeExpected; } - if (localRate != 0.0) + if (localRate > 0.0) input->prepareToPlay (localBufferSize, localRate); const ScopedLock sl (lock); diff --git a/src/audio/devices/juce_AudioDeviceManager.cpp b/src/audio/devices/juce_AudioDeviceManager.cpp index dfc8bf9af5..2c999bbf23 100644 --- a/src/audio/devices/juce_AudioDeviceManager.cpp +++ b/src/audio/devices/juce_AudioDeviceManager.cpp @@ -468,7 +468,7 @@ double AudioDeviceManager::chooseBestSampleRate (double rate) const { const double sr = currentAudioDevice->getSampleRate (i); - if (sr >= 44100.0 && (lowestAbove44 == 0 || sr < lowestAbove44)) + if (sr >= 44100.0 && (lowestAbove44 < 1.0 || sr < lowestAbove44)) lowestAbove44 = sr; } diff --git a/src/audio/midi/juce_MidiFile.cpp b/src/audio/midi/juce_MidiFile.cpp index acd2549ed9..d4919ca82d 100644 --- a/src/audio/midi/juce_MidiFile.cpp +++ b/src/audio/midi/juce_MidiFile.cpp @@ -150,7 +150,6 @@ namespace MidiFileHelpers break; } } - } return correctedTempoTime + (time - tempoTime) * secsPerTick; @@ -169,19 +168,16 @@ namespace MidiFileHelpers { const double diff = (first->message.getTimeStamp() - second->message.getTimeStamp()); - if (diff == 0) - { - if (first->message.isNoteOff() && second->message.isNoteOn()) - return -1; - else if (first->message.isNoteOn() && second->message.isNoteOff()) - return 1; - else - return 0; - } - else - { - return (diff > 0) ? 1 : -1; - } + if (diff > 0) + return 1; + else if (diff < 0) + return -1; + else if (first->message.isNoteOff() && second->message.isNoteOn()) + return -1; + else if (first->message.isNoteOn() && second->message.isNoteOff()) + return 1; + + return 0; } }; } diff --git a/src/gui/components/layout/juce_ResizableEdgeComponent.cpp b/src/gui/components/layout/juce_ResizableEdgeComponent.cpp index a75fa73c54..ecd651fa5c 100644 --- a/src/gui/components/layout/juce_ResizableEdgeComponent.cpp +++ b/src/gui/components/layout/juce_ResizableEdgeComponent.cpp @@ -60,7 +60,7 @@ void ResizableEdgeComponent::paint (Graphics& g) isMouseOver(), isMouseButtonDown()); } -void ResizableEdgeComponent::mouseDown (const MouseEvent& e) +void ResizableEdgeComponent::mouseDown (const MouseEvent&) { if (component == 0) { diff --git a/src/gui/graphics/colour/juce_Colour.cpp b/src/gui/graphics/colour/juce_Colour.cpp index 3abc6a9f75..bc8d4b9878 100644 --- a/src/gui/graphics/colour/juce_Colour.cpp +++ b/src/gui/graphics/colour/juce_Colour.cpp @@ -339,7 +339,7 @@ void Colour::getHSB (float& h, float& s, float& v) const throw() { s = (hi - lo) / (float) hi; - if (s != 0) + if (s > 0) { const float invDiff = 1.0f / (hi - lo); diff --git a/src/gui/graphics/colour/juce_ColourGradient.cpp b/src/gui/graphics/colour/juce_ColourGradient.cpp index 3c279605d8..4e3d0ed765 100644 --- a/src/gui/graphics/colour/juce_ColourGradient.cpp +++ b/src/gui/graphics/colour/juce_ColourGradient.cpp @@ -219,5 +219,15 @@ bool ColourGradient::isInvisible() const throw() return true; } +bool ColourGradient::ColourPoint::operator== (const ColourPoint& other) const throw() +{ + return position == other.position && colour == other.colour; +} + +bool ColourGradient::ColourPoint::operator!= (const ColourPoint& other) const throw() +{ + return position != other.position || colour != other.colour; +} + END_JUCE_NAMESPACE diff --git a/src/gui/graphics/colour/juce_ColourGradient.h b/src/gui/graphics/colour/juce_ColourGradient.h index abaaaa1084..18c5b3df47 100644 --- a/src/gui/graphics/colour/juce_ColourGradient.h +++ b/src/gui/graphics/colour/juce_ColourGradient.h @@ -163,8 +163,8 @@ private: : position (position_), colour (colour_) {} - bool operator== (const ColourPoint& other) const throw() { return position == other.position && colour == other.colour; } - bool operator!= (const ColourPoint& other) const throw() { return position != other.position || colour != other.colour; } + bool operator== (const ColourPoint& other) const throw(); + bool operator!= (const ColourPoint& other) const throw(); double position; Colour colour; diff --git a/src/gui/graphics/drawables/juce_DrawablePath.cpp b/src/gui/graphics/drawables/juce_DrawablePath.cpp index 1a9f4b2a51..a5c207021a 100644 --- a/src/gui/graphics/drawables/juce_DrawablePath.cpp +++ b/src/gui/graphics/drawables/juce_DrawablePath.cpp @@ -123,7 +123,7 @@ public: owner.applyRelativePath (*owner.relativePath, &scope); } - void applyNewBounds (const Rectangle& newBounds) + void applyNewBounds (const Rectangle&) { jassertfalse; // drawables can't be resized directly! } diff --git a/src/gui/graphics/drawables/juce_DrawableShape.cpp b/src/gui/graphics/drawables/juce_DrawableShape.cpp index 37ac5add7d..0ff712c878 100644 --- a/src/gui/graphics/drawables/juce_DrawableShape.cpp +++ b/src/gui/graphics/drawables/juce_DrawableShape.cpp @@ -77,7 +77,7 @@ public: owner.repaint(); } - void applyNewBounds (const Rectangle& newBounds) + void applyNewBounds (const Rectangle&) { jassertfalse; // drawables can't be resized directly! } diff --git a/src/gui/graphics/geometry/juce_Line.h b/src/gui/graphics/geometry/juce_Line.h index 27c1d7f1e7..bccbf69105 100644 --- a/src/gui/graphics/geometry/juce_Line.h +++ b/src/gui/graphics/geometry/juce_Line.h @@ -211,7 +211,7 @@ public: const Point delta (end - start); const double length = juce_hypot ((double) delta.getX(), (double) delta.getY()); - if (length == 0) + if (length <= 0) return start; return Point (start.getX() + (ValueType) ((delta.getX() * distanceFromStart - delta.getY() * perpendicularDistance) / length), diff --git a/src/gui/graphics/geometry/juce_PathIterator.cpp b/src/gui/graphics/geometry/juce_PathIterator.cpp index 0a7d8cae89..9ed646981e 100644 --- a/src/gui/graphics/geometry/juce_PathIterator.cpp +++ b/src/gui/graphics/geometry/juce_PathIterator.cpp @@ -63,6 +63,12 @@ PathFlatteningIterator::~PathFlatteningIterator() { } +bool PathFlatteningIterator::isLastInSubpath() const throw() +{ + return stackPos == stackBase.getData() + && (index >= path.numElements || points [index] == Path::moveMarker); +} + bool PathFlatteningIterator::next() { x1 = x2; diff --git a/src/gui/graphics/geometry/juce_PathIterator.h b/src/gui/graphics/geometry/juce_PathIterator.h index 81ecdace0b..6c34a44179 100644 --- a/src/gui/graphics/geometry/juce_PathIterator.h +++ b/src/gui/graphics/geometry/juce_PathIterator.h @@ -91,9 +91,7 @@ public: int subPathIndex; /** Returns true if the current segment is the last in the current sub-path. */ - bool isLastInSubpath() const throw() { return stackPos == stackBase.getData() - && (index >= path.numElements || points [index] == Path::moveMarker); } - + bool isLastInSubpath() const throw(); /** This is the default value that should be used for the tolerance value (see the constructor parameters). */ static const float defaultTolerance; diff --git a/src/io/files/juce_File.cpp b/src/io/files/juce_File.cpp index e072810cff..000b43e642 100644 --- a/src/io/files/juce_File.cpp +++ b/src/io/files/juce_File.cpp @@ -118,7 +118,13 @@ const String File::parseAbsolutePath (const String& p) } #else // Mac or Linux.. - String path (p.replaceCharacter ('\\', '/')); + + // Yes, I know it's legal for a unix pathname to contain a backslash, but this assertion is here + // to catch anyone who's trying to run code that was written on Windows with hard-coded path names. + // If that's why you've ended up here, use File::getChildFile() to build your paths instead. + jassert ((! p.containsChar ('\\')) || (p.indexOfChar ('/') >= 0 && p.indexOfChar ('/') < p.indexOfChar ('\\'))); + + String path (p); if (path.startsWithChar ('~')) { @@ -364,11 +370,11 @@ bool File::isAChildOf (const File& potentialParent) const bool File::isAbsolutePath (const String& path) { return path.startsWithChar ('/') || path.startsWithChar ('\\') -#if JUCE_WINDOWS + #if JUCE_WINDOWS || (path.isNotEmpty() && path[1] == ':'); -#else + #else || path.startsWithChar ('~'); -#endif + #endif } const File File::getChildFile (String relativePath) const @@ -385,11 +391,12 @@ const File File::getChildFile (String relativePath) const if (relativePath[0] == '.') { -#if JUCE_WINDOWS + #if JUCE_WINDOWS relativePath = relativePath.replaceCharacter ('/', '\\').trimStart(); -#else - relativePath = relativePath.replaceCharacter ('\\', '/').trimStart(); -#endif + #else + relativePath = relativePath.trimStart(); + #endif + while (relativePath[0] == '.') { if (relativePath[1] == '.')