diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 10fd317316..1aec3f666a 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -5105,7 +5105,7 @@ public: } else { - result = scope.evaluateFunction (functionName, 0, 0); + result = scope.evaluateFunction (functionName, nullptr, 0); } return new Constant (result, false); @@ -36189,8 +36189,6 @@ public: : channelNum (channelNum_) {} - ~ClearChannelOp() {} - void perform (AudioSampleBuffer& sharedBufferChans, const OwnedArray &, const int numSamples) { sharedBufferChans.clear (channelNum, 0, numSamples); @@ -36210,8 +36208,6 @@ public: dstChannelNum (dstChannelNum_) {} - ~CopyChannelOp() {} - void perform (AudioSampleBuffer& sharedBufferChans, const OwnedArray &, const int numSamples) { sharedBufferChans.copyFrom (dstChannelNum, 0, sharedBufferChans, srcChannelNum, 0, numSamples); @@ -36231,8 +36227,6 @@ public: dstChannelNum (dstChannelNum_) {} - ~AddChannelOp() {} - void perform (AudioSampleBuffer& sharedBufferChans, const OwnedArray &, const int numSamples) { sharedBufferChans.addFrom (dstChannelNum, 0, sharedBufferChans, srcChannelNum, 0, numSamples); @@ -36251,8 +36245,6 @@ public: : bufferNum (bufferNum_) {} - ~ClearMidiBufferOp() {} - void perform (AudioSampleBuffer&, const OwnedArray & sharedMidiBuffers, const int) { sharedMidiBuffers.getUnchecked (bufferNum)->clear(); @@ -36272,8 +36264,6 @@ public: dstBufferNum (dstBufferNum_) {} - ~CopyMidiBufferOp() {} - void perform (AudioSampleBuffer&, const OwnedArray & sharedMidiBuffers, const int) { *sharedMidiBuffers.getUnchecked (dstBufferNum) = *sharedMidiBuffers.getUnchecked (srcBufferNum); @@ -36293,8 +36283,6 @@ public: dstBufferNum (dstBufferNum_) {} - ~AddMidiBufferOp() {} - void perform (AudioSampleBuffer&, const OwnedArray & sharedMidiBuffers, const int numSamples) { sharedMidiBuffers.getUnchecked (dstBufferNum) @@ -36326,10 +36314,6 @@ public: audioChannelsToUse.add (0); } - ~ProcessBufferOp() - { - } - void perform (AudioSampleBuffer& sharedBufferChans, const OwnedArray & sharedMidiBuffers, const int numSamples) { for (int i = totalChans; --i >= 0;) @@ -37576,10 +37560,10 @@ void SamplerVoice::renderNextBlock (AudioSampleBuffer& outputBuffer, int startSa { const float* const inL = playingSound->data->getSampleData (0, 0); const float* const inR = playingSound->data->getNumChannels() > 1 - ? playingSound->data->getSampleData (1, 0) : 0; + ? playingSound->data->getSampleData (1, 0) : nullptr; float* outL = outputBuffer.getSampleData (0, startSample); - float* outR = outputBuffer.getNumChannels() > 1 ? outputBuffer.getSampleData (1, startSample) : 0; + float* outR = outputBuffer.getNumChannels() > 1 ? outputBuffer.getSampleData (1, startSample) : nullptr; while (--numSamples >= 0) { @@ -38771,7 +38755,7 @@ void MessageManager::runDispatchLoop() void MessageManager::stopDispatchLoop() { - postMessageToQueue (new Message (quitMessageId, 0, 0, 0)); + postMessageToQueue (new Message (quitMessageId, 0, 0, nullptr)); quitMessagePosted = true; } @@ -38876,13 +38860,13 @@ private: MessageManagerLock::MessageManagerLock (Thread* const threadToCheck) : locked (false) { - init (threadToCheck, 0); + init (threadToCheck, nullptr); } MessageManagerLock::MessageManagerLock (ThreadPoolJob* const jobToCheckForExitSignal) : locked (false) { - init (0, jobToCheckForExitSignal); + init (nullptr, jobToCheckForExitSignal); } void MessageManagerLock::init (Thread* const threadToCheck, ThreadPoolJob* const job) @@ -41484,7 +41468,7 @@ void Component::getVisibleArea (RectangleList& result, const bool includeSibling c->getLocalBounds(), this); } - ComponentHelpers::subtractObscuredRegions (*this, result, Point(), unclipped, 0); + ComponentHelpers::subtractObscuredRegions (*this, result, Point(), unclipped, nullptr); result.consolidate(); } } @@ -51699,7 +51683,7 @@ public: if (comp != nullptr && columnId != (int) comp->getProperties() [columnProperty]) { - columnComponents.set (i, 0); + columnComponents.set (i, nullptr); comp = nullptr; } @@ -51864,7 +51848,7 @@ private: }; TableListBox::TableListBox (const String& name, TableListBoxModel* const model_) - : ListBox (name, 0), + : ListBox (name, nullptr), header (nullptr), model (model_), autoSizeOptionsShown (true) @@ -55169,7 +55153,7 @@ void Toolbar::buttonClicked (Button*) { PopupMenu m; m.addCustomItem (1, new MissingItemsComponent (*this, getThickness())); - m.showMenuAsync (PopupMenu::Options().withTargetComponent (missingItemsButton), 0); + m.showMenuAsync (PopupMenu::Options().withTargetComponent (missingItemsButton), nullptr); } } @@ -58380,12 +58364,12 @@ bool FileChooser::browseForMultipleFilesOrDirectories (FilePreviewComponent* pre bool FileChooser::browseForFileToSave (const bool warnAboutOverwritingExistingFiles) { - return showDialog (false, true, true, warnAboutOverwritingExistingFiles, false, 0); + return showDialog (false, true, true, warnAboutOverwritingExistingFiles, false, nullptr); } bool FileChooser::browseForDirectory() { - return showDialog (true, false, false, false, false, 0); + return showDialog (true, false, false, false, false, nullptr); } bool FileChooser::showDialog (const bool selectsDirectories, @@ -58403,13 +58387,13 @@ bool FileChooser::showDialog (const bool selectsDirectories, jassert (previewComponent == nullptr || (previewComponent->getWidth() > 10 && previewComponent->getHeight() > 10)); -#if JUCE_WINDOWS + #if JUCE_WINDOWS if (useNativeDialogBox && ! (selectsFiles && selectsDirectories)) -#elif JUCE_MAC + #elif JUCE_MAC if (useNativeDialogBox && (previewComponent == nullptr)) -#else + #else if (false) -#endif + #endif { showPlatformDialog (results, title, startingFile, filters, selectsDirectories, selectsFiles, isSave, @@ -58770,7 +58754,7 @@ BEGIN_JUCE_NAMESPACE const Image juce_createIconForFile (const File& file); FileListComponent::FileListComponent (DirectoryContentsList& listToShow) - : ListBox (String::empty, 0), + : ListBox (String::empty, nullptr), DirectoryContentsDisplayComponent (listToShow) { setModel (this); @@ -58966,7 +58950,7 @@ Component* FileListComponent::refreshComponentForRow (int row, bool isSelected, if (fileList.getFileInfo (row, fileInfo)) comp->update (fileList.getDirectory(), &fileInfo, row, isSelected); else - comp->update (fileList.getDirectory(), 0, row, isSelected); + comp->update (fileList.getDirectory(), nullptr, row, isSelected); return comp; } @@ -61605,7 +61589,7 @@ Component* ComponentBuilder::createComponent() TypeHandler* const type = getHandlerForState (state); jassert (type != nullptr); // trying to create a component from an unknown type of ValueTree - return type != nullptr ? ComponentBuilderHelpers::createNewComponent (*type, state, 0) : 0; + return type != nullptr ? ComponentBuilderHelpers::createNewComponent (*type, state, nullptr) : nullptr; } void ComponentBuilder::registerTypeHandler (ComponentBuilder::TypeHandler* const type) @@ -67518,7 +67502,7 @@ Button* LookAndFeel::createTabBarExtrasButton() overImage.addAndMakeVisible (dp.createCopy()); DrawableButton* db = new DrawableButton ("tabs", DrawableButton::ImageFitted); - db->setImages (&normalImage, &overImage, 0); + db->setImages (&normalImage, &overImage, nullptr); return db; } @@ -67821,7 +67805,7 @@ Drawable* LookAndFeel::loadDrawableFromData (const void* data, size_t numBytes) MemoryInputStream m (data, numBytes, false); GZIPDecompressorInputStream gz (m); ValueTree drawable (ValueTree::readFromStream (gz)); - return Drawable::createFromValueTree (drawable.getChild (0), 0); + return Drawable::createFromValueTree (drawable.getChild (0), nullptr); } const Drawable* LookAndFeel::getDefaultFolderImage() @@ -72979,7 +72963,7 @@ public: const String& noItemsMessage_, const int minNumber_, const int maxNumber_) - : ListBox (String::empty, 0), + : ListBox (String::empty, nullptr), deviceManager (deviceManager_), noItemsMessage (noItemsMessage_), minNumber (minNumber_), @@ -73538,7 +73522,7 @@ public: ChannelSelectorListBox (const AudioIODeviceType::DeviceSetupDetails& setup_, const BoxType type_, const String& noItemsMessage_) - : ListBox (String::empty, 0), + : ListBox (String::empty, nullptr), setup (setup_), type (type_), noItemsMessage (noItemsMessage_) @@ -79740,8 +79724,8 @@ void MarkerList::ValueTreeWrapper::setMarker (const MarkerList::Marker& m, UndoM else { marker = ValueTree (markerTag); - marker.setProperty (nameProperty, m.name, 0); - marker.setProperty (posProperty, m.position.toString(), 0); + marker.setProperty (nameProperty, m.name, nullptr); + marker.setProperty (posProperty, m.position.toString(), nullptr); state.addChild (marker, -1, undoManager); } } @@ -80379,7 +80363,7 @@ RelativePointPath::StartSubPath::StartSubPath (const RelativePoint& pos) const ValueTree RelativePointPath::StartSubPath::createTree() const { ValueTree v (DrawablePath::ValueTreeWrapper::Element::startSubPathElement); - v.setProperty (DrawablePath::ValueTreeWrapper::point1, startPos.toString(), 0); + v.setProperty (DrawablePath::ValueTreeWrapper::point1, startPos.toString(), nullptr); return v; } @@ -80433,7 +80417,7 @@ RelativePointPath::LineTo::LineTo (const RelativePoint& endPoint_) const ValueTree RelativePointPath::LineTo::createTree() const { ValueTree v (DrawablePath::ValueTreeWrapper::Element::lineToElement); - v.setProperty (DrawablePath::ValueTreeWrapper::point1, endPoint.toString(), 0); + v.setProperty (DrawablePath::ValueTreeWrapper::point1, endPoint.toString(), nullptr); return v; } @@ -80463,8 +80447,8 @@ RelativePointPath::QuadraticTo::QuadraticTo (const RelativePoint& controlPoint, const ValueTree RelativePointPath::QuadraticTo::createTree() const { ValueTree v (DrawablePath::ValueTreeWrapper::Element::quadraticToElement); - v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), 0); - v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), 0); + v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), nullptr); + v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), nullptr); return v; } @@ -80496,9 +80480,9 @@ RelativePointPath::CubicTo::CubicTo (const RelativePoint& controlPoint1, const R const ValueTree RelativePointPath::CubicTo::createTree() const { ValueTree v (DrawablePath::ValueTreeWrapper::Element::cubicToElement); - v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), 0); - v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), 0); - v.setProperty (DrawablePath::ValueTreeWrapper::point3, controlPoints[2].toString(), 0); + v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), nullptr); + v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), nullptr); + v.setProperty (DrawablePath::ValueTreeWrapper::point3, controlPoints[2].toString(), nullptr); return v; } @@ -86737,9 +86721,9 @@ const String Drawable::ValueTreeWrapperBase::getID() const void Drawable::ValueTreeWrapperBase::setID (const String& newID) { if (newID.isEmpty()) - state.removeProperty (ComponentBuilder::idProperty, 0); + state.removeProperty (ComponentBuilder::idProperty, nullptr); else - state.setProperty (ComponentBuilder::idProperty, newID, 0); + state.setProperty (ComponentBuilder::idProperty, newID, nullptr); } END_JUCE_NAMESPACE @@ -87141,7 +87125,7 @@ ValueTree DrawableShape::FillAndStrokeState::getFillState (const Identifier& fil if (v.isValid()) return v; - setFill (fillOrStrokeType, FillType (Colours::black), 0, 0); + setFill (fillOrStrokeType, FillType (Colours::black), nullptr, nullptr); return getFillState (fillOrStrokeType); } @@ -87436,8 +87420,8 @@ const RelativeRectangle DrawableComposite::ValueTreeWrapper::getContentArea() co void DrawableComposite::ValueTreeWrapper::setContentArea (const RelativeRectangle& newArea, UndoManager* undoManager) { - MarkerList::ValueTreeWrapper markersX (getMarkerListCreating (true, 0)); - MarkerList::ValueTreeWrapper markersY (getMarkerListCreating (false, 0)); + MarkerList::ValueTreeWrapper markersX (getMarkerListCreating (true, nullptr)); + MarkerList::ValueTreeWrapper markersY (getMarkerListCreating (false, nullptr)); markersX.setMarker (MarkerList::Marker (contentLeftMarkerName, newArea.left), undoManager); markersX.setMarker (MarkerList::Marker (contentRightMarkerName, newArea.right), undoManager); @@ -87474,7 +87458,7 @@ const ValueTree DrawableComposite::createValueTree (ComponentBuilder::ImageProvi ValueTreeWrapper v (tree); v.setID (getComponentID()); - v.setBoundingBox (bounds, 0); + v.setBoundingBox (bounds, nullptr); ValueTree childList (v.getChildListCreating (nullptr)); @@ -87483,11 +87467,11 @@ const ValueTree DrawableComposite::createValueTree (ComponentBuilder::ImageProvi const Drawable* const d = dynamic_cast (getChildComponent(i)); jassert (d != nullptr); // You can't save a mix of Drawables and normal components! - childList.addChild (d->createValueTree (imageProvider), -1, 0); + childList.addChild (d->createValueTree (imageProvider), -1, nullptr); } - v.getMarkerListCreating (true, 0).readFrom (markersX, 0); - v.getMarkerListCreating (false, 0).readFrom (markersY, 0); + v.getMarkerListCreating (true, nullptr).readFrom (markersX, nullptr); + v.getMarkerListCreating (false, nullptr).readFrom (markersY, nullptr); return tree; } @@ -87741,16 +87725,16 @@ const ValueTree DrawableImage::createValueTree (ComponentBuilder::ImageProvider* ValueTreeWrapper v (tree); v.setID (getComponentID()); - v.setOpacity (opacity, 0); - v.setOverlayColour (overlayColour, 0); - v.setBoundingBox (bounds, 0); + v.setOpacity (opacity, nullptr); + v.setOverlayColour (overlayColour, nullptr); + v.setBoundingBox (bounds, nullptr); if (image.isValid()) { jassert (imageProvider != nullptr); // if you're using images, you need to provide something that can load and save them! if (imageProvider != nullptr) - v.setImageIdentifier (imageProvider->getIdentifierForImage (image), 0); + v.setImageIdentifier (imageProvider->getIdentifierForImage (image), nullptr); } return tree; @@ -87878,7 +87862,7 @@ void DrawablePath::setPath (const RelativePointPath& newRelativePath) else { relativePath = nullptr; - applyRelativePath (newRelativePath, 0); + applyRelativePath (newRelativePath, nullptr); } } @@ -87897,7 +87881,7 @@ DrawablePath::ValueTreeWrapper::ValueTreeWrapper (const ValueTree& state_) ValueTree DrawablePath::ValueTreeWrapper::getPathState() { - return state.getOrCreateChildWithName (path, 0); + return state.getOrCreateChildWithName (path, nullptr); } bool DrawablePath::ValueTreeWrapper::usesNonZeroWinding() const @@ -88223,9 +88207,9 @@ ValueTree DrawablePath::ValueTreeWrapper::Element::insertPoint (const Point= 0xd800 && n <= 0xdfff) + { + const uint32 nextWord = (uint32) (uint16) in.readShort(); + jassert (nextWord >= 0xdc00); // illegal unicode character! + + n = 0x10000 + (((n - 0xd800) << 10) | (nextWord - 0xdc00)); + } + + return (juce_wchar) n; + } + + void writeChar (OutputStream& out, juce_wchar charToWrite) + { + if (charToWrite >= 0x10000) + { + charToWrite -= 0x10000; + out.writeShort ((short) (uint16) (0xd800 + (charToWrite >> 10))); + out.writeShort ((short) (uint16) (0xdc00 + (charToWrite & 0x3ff))); + } + else + { + out.writeShort ((short) (uint16) charToWrite); + } + } +} + CustomTypeface::CustomTypeface() : Typeface (String::empty) { @@ -91837,13 +91853,13 @@ CustomTypeface::CustomTypeface (InputStream& serialisedTypefaceStream) isBold = in.readBool(); isItalic = in.readBool(); ascent = in.readFloat(); - defaultCharacter = (juce_wchar) in.readShort(); + defaultCharacter = CustomTypefaceHelpers::readChar (in); int i, numChars = in.readInt(); for (i = 0; i < numChars; ++i) { - const juce_wchar c = (juce_wchar) in.readShort(); + const juce_wchar c = CustomTypefaceHelpers::readChar (in); const float width = in.readFloat(); Path p; @@ -91855,8 +91871,8 @@ CustomTypeface::CustomTypeface (InputStream& serialisedTypefaceStream) for (i = 0; i < numKerningPairs; ++i) { - const juce_wchar char1 = (juce_wchar) in.readShort(); - const juce_wchar char2 = (juce_wchar) in.readShort(); + const juce_wchar char1 = CustomTypefaceHelpers::readChar (in); + const juce_wchar char2 = CustomTypefaceHelpers::readChar (in); addKerningPair (char1, char2, in.readFloat()); } @@ -92004,7 +92020,7 @@ bool CustomTypeface::writeToStream (OutputStream& outputStream) out.writeBool (isBold); out.writeBool (isItalic); out.writeFloat (ascent); - out.writeShort ((short) (unsigned short) defaultCharacter); + CustomTypefaceHelpers::writeChar (out, defaultCharacter); out.writeInt (glyphs.size()); int i, numKerningPairs = 0; @@ -92012,7 +92028,7 @@ bool CustomTypeface::writeToStream (OutputStream& outputStream) for (i = 0; i < glyphs.size(); ++i) { const GlyphInfo* const g = glyphs.getUnchecked (i); - out.writeShort ((short) (unsigned short) g->character); + CustomTypefaceHelpers::writeChar (out, g->character); out.writeFloat (g->width); g->path.writePathToStream (out); @@ -92028,8 +92044,8 @@ bool CustomTypeface::writeToStream (OutputStream& outputStream) for (int j = 0; j < g->kerningPairs.size(); ++j) { const GlyphInfo::KerningPair& p = g->kerningPairs.getReference (j); - out.writeShort ((short) (unsigned short) g->character); - out.writeShort ((short) (unsigned short) p.character2); + CustomTypefaceHelpers::writeChar (out, g->character); + CustomTypefaceHelpers::writeChar (out, p.character2); out.writeFloat (p.kerningAmount); } } diff --git a/juce_amalgamated.h b/juce_amalgamated.h index f04cafd699..3bd5adf10a 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -10691,7 +10691,7 @@ public: HashMap (const int numberOfSlots = defaultHashTableSize) : totalNumItems (0) { - slots.insertMultiple (0, 0, numberOfSlots); + slots.insertMultiple (0, nullptr, numberOfSlots); } /** Destructor. */ @@ -10718,7 +10718,7 @@ public: h = h->nextEntry; } - slots.set (i, 0); + slots.set (i, nullptr); } totalNumItems = 0; @@ -55966,7 +55966,7 @@ private: void mouseDrag (const MouseEvent& e) { - myDragger.dragComponent (this, e, 0); + myDragger.dragComponent (this, e, nullptr); } }; @endcode @@ -64326,7 +64326,7 @@ private: MyContentComponent content; content.setSize (300, 300); - CallOutBox callOut (content, *this, 0); + CallOutBox callOut (content, *this, nullptr); callOut.runModalLoop(); } @endcode diff --git a/src/audio/processors/juce_AudioProcessorGraph.cpp b/src/audio/processors/juce_AudioProcessorGraph.cpp index ee1b21c52d..77339bc1fb 100644 --- a/src/audio/processors/juce_AudioProcessorGraph.cpp +++ b/src/audio/processors/juce_AudioProcessorGraph.cpp @@ -359,8 +359,6 @@ public: : channelNum (channelNum_) {} - ~ClearChannelOp() {} - void perform (AudioSampleBuffer& sharedBufferChans, const OwnedArray &, const int numSamples) { sharedBufferChans.clear (channelNum, 0, numSamples); @@ -381,8 +379,6 @@ public: dstChannelNum (dstChannelNum_) {} - ~CopyChannelOp() {} - void perform (AudioSampleBuffer& sharedBufferChans, const OwnedArray &, const int numSamples) { sharedBufferChans.copyFrom (dstChannelNum, 0, sharedBufferChans, srcChannelNum, 0, numSamples); @@ -403,8 +399,6 @@ public: dstChannelNum (dstChannelNum_) {} - ~AddChannelOp() {} - void perform (AudioSampleBuffer& sharedBufferChans, const OwnedArray &, const int numSamples) { sharedBufferChans.addFrom (dstChannelNum, 0, sharedBufferChans, srcChannelNum, 0, numSamples); @@ -424,8 +418,6 @@ public: : bufferNum (bufferNum_) {} - ~ClearMidiBufferOp() {} - void perform (AudioSampleBuffer&, const OwnedArray & sharedMidiBuffers, const int) { sharedMidiBuffers.getUnchecked (bufferNum)->clear(); @@ -446,8 +438,6 @@ public: dstBufferNum (dstBufferNum_) {} - ~CopyMidiBufferOp() {} - void perform (AudioSampleBuffer&, const OwnedArray & sharedMidiBuffers, const int) { *sharedMidiBuffers.getUnchecked (dstBufferNum) = *sharedMidiBuffers.getUnchecked (srcBufferNum); @@ -468,8 +458,6 @@ public: dstBufferNum (dstBufferNum_) {} - ~AddMidiBufferOp() {} - void perform (AudioSampleBuffer&, const OwnedArray & sharedMidiBuffers, const int numSamples) { sharedMidiBuffers.getUnchecked (dstBufferNum) @@ -502,10 +490,6 @@ public: audioChannelsToUse.add (0); } - ~ProcessBufferOp() - { - } - void perform (AudioSampleBuffer& sharedBufferChans, const OwnedArray & sharedMidiBuffers, const int numSamples) { for (int i = totalChans; --i >= 0;) diff --git a/src/audio/synthesisers/juce_Sampler.cpp b/src/audio/synthesisers/juce_Sampler.cpp index 12186e4f50..7c4054a528 100644 --- a/src/audio/synthesisers/juce_Sampler.cpp +++ b/src/audio/synthesisers/juce_Sampler.cpp @@ -176,10 +176,10 @@ void SamplerVoice::renderNextBlock (AudioSampleBuffer& outputBuffer, int startSa { const float* const inL = playingSound->data->getSampleData (0, 0); const float* const inR = playingSound->data->getNumChannels() > 1 - ? playingSound->data->getSampleData (1, 0) : 0; + ? playingSound->data->getSampleData (1, 0) : nullptr; float* outL = outputBuffer.getSampleData (0, startSample); - float* outR = outputBuffer.getNumChannels() > 1 ? outputBuffer.getSampleData (1, startSample) : 0; + float* outR = outputBuffer.getNumChannels() > 1 ? outputBuffer.getSampleData (1, startSample) : nullptr; while (--numSamples >= 0) { diff --git a/src/containers/juce_HashMap.h b/src/containers/juce_HashMap.h index e1c47a5629..83a7dcd5b3 100644 --- a/src/containers/juce_HashMap.h +++ b/src/containers/juce_HashMap.h @@ -111,7 +111,7 @@ public: HashMap (const int numberOfSlots = defaultHashTableSize) : totalNumItems (0) { - slots.insertMultiple (0, 0, numberOfSlots); + slots.insertMultiple (0, nullptr, numberOfSlots); } /** Destructor. */ @@ -139,7 +139,7 @@ public: h = h->nextEntry; } - slots.set (i, 0); + slots.set (i, nullptr); } totalNumItems = 0; diff --git a/src/events/juce_MessageManager.cpp b/src/events/juce_MessageManager.cpp index a244d59217..f47b73577a 100644 --- a/src/events/juce_MessageManager.cpp +++ b/src/events/juce_MessageManager.cpp @@ -130,7 +130,7 @@ void MessageManager::runDispatchLoop() void MessageManager::stopDispatchLoop() { - postMessageToQueue (new Message (quitMessageId, 0, 0, 0)); + postMessageToQueue (new Message (quitMessageId, 0, 0, nullptr)); quitMessagePosted = true; } @@ -240,13 +240,13 @@ private: MessageManagerLock::MessageManagerLock (Thread* const threadToCheck) : locked (false) { - init (threadToCheck, 0); + init (threadToCheck, nullptr); } MessageManagerLock::MessageManagerLock (ThreadPoolJob* const jobToCheckForExitSignal) : locked (false) { - init (0, jobToCheckForExitSignal); + init (nullptr, jobToCheckForExitSignal); } void MessageManagerLock::init (Thread* const threadToCheck, ThreadPoolJob* const job) diff --git a/src/gui/components/controls/juce_TableListBox.cpp b/src/gui/components/controls/juce_TableListBox.cpp index 953bbf6b08..86e8d4752d 100644 --- a/src/gui/components/controls/juce_TableListBox.cpp +++ b/src/gui/components/controls/juce_TableListBox.cpp @@ -98,7 +98,7 @@ public: if (comp != nullptr && columnId != (int) comp->getProperties() [columnProperty]) { - columnComponents.set (i, 0); + columnComponents.set (i, nullptr); comp = nullptr; } @@ -267,7 +267,7 @@ private: //============================================================================== TableListBox::TableListBox (const String& name, TableListBoxModel* const model_) - : ListBox (name, 0), + : ListBox (name, nullptr), header (nullptr), model (model_), autoSizeOptionsShown (true) diff --git a/src/gui/components/controls/juce_Toolbar.cpp b/src/gui/components/controls/juce_Toolbar.cpp index bf31e528c2..112787c313 100644 --- a/src/gui/components/controls/juce_Toolbar.cpp +++ b/src/gui/components/controls/juce_Toolbar.cpp @@ -558,7 +558,7 @@ void Toolbar::buttonClicked (Button*) { PopupMenu m; m.addCustomItem (1, new MissingItemsComponent (*this, getThickness())); - m.showMenuAsync (PopupMenu::Options().withTargetComponent (missingItemsButton), 0); + m.showMenuAsync (PopupMenu::Options().withTargetComponent (missingItemsButton), nullptr); } } diff --git a/src/gui/components/filebrowser/juce_FileChooser.cpp b/src/gui/components/filebrowser/juce_FileChooser.cpp index c1b54d1cca..2ab0cbb792 100644 --- a/src/gui/components/filebrowser/juce_FileChooser.cpp +++ b/src/gui/components/filebrowser/juce_FileChooser.cpp @@ -74,12 +74,12 @@ bool FileChooser::browseForMultipleFilesOrDirectories (FilePreviewComponent* pre bool FileChooser::browseForFileToSave (const bool warnAboutOverwritingExistingFiles) { - return showDialog (false, true, true, warnAboutOverwritingExistingFiles, false, 0); + return showDialog (false, true, true, warnAboutOverwritingExistingFiles, false, nullptr); } bool FileChooser::browseForDirectory() { - return showDialog (true, false, false, false, false, 0); + return showDialog (true, false, false, false, false, nullptr); } bool FileChooser::showDialog (const bool selectsDirectories, @@ -97,13 +97,13 @@ bool FileChooser::showDialog (const bool selectsDirectories, jassert (previewComponent == nullptr || (previewComponent->getWidth() > 10 && previewComponent->getHeight() > 10)); -#if JUCE_WINDOWS + #if JUCE_WINDOWS if (useNativeDialogBox && ! (selectsFiles && selectsDirectories)) -#elif JUCE_MAC + #elif JUCE_MAC if (useNativeDialogBox && (previewComponent == nullptr)) -#else + #else if (false) -#endif + #endif { showPlatformDialog (results, title, startingFile, filters, selectsDirectories, selectsFiles, isSave, diff --git a/src/gui/components/filebrowser/juce_FileListComponent.cpp b/src/gui/components/filebrowser/juce_FileListComponent.cpp index fc3e1c5292..e7fc825626 100644 --- a/src/gui/components/filebrowser/juce_FileListComponent.cpp +++ b/src/gui/components/filebrowser/juce_FileListComponent.cpp @@ -37,7 +37,7 @@ const Image juce_createIconForFile (const File& file); //============================================================================== FileListComponent::FileListComponent (DirectoryContentsList& listToShow) - : ListBox (String::empty, 0), + : ListBox (String::empty, nullptr), DirectoryContentsDisplayComponent (listToShow) { setModel (this); @@ -237,7 +237,7 @@ Component* FileListComponent::refreshComponentForRow (int row, bool isSelected, if (fileList.getFileInfo (row, fileInfo)) comp->update (fileList.getDirectory(), &fileInfo, row, isSelected); else - comp->update (fileList.getDirectory(), 0, row, isSelected); + comp->update (fileList.getDirectory(), nullptr, row, isSelected); return comp; } diff --git a/src/gui/components/juce_Component.cpp b/src/gui/components/juce_Component.cpp index 6d75d7a2e4..7174ce3776 100644 --- a/src/gui/components/juce_Component.cpp +++ b/src/gui/components/juce_Component.cpp @@ -2137,7 +2137,7 @@ void Component::getVisibleArea (RectangleList& result, const bool includeSibling c->getLocalBounds(), this); } - ComponentHelpers::subtractObscuredRegions (*this, result, Point(), unclipped, 0); + ComponentHelpers::subtractObscuredRegions (*this, result, Point(), unclipped, nullptr); result.consolidate(); } } diff --git a/src/gui/components/layout/juce_ComponentBuilder.cpp b/src/gui/components/layout/juce_ComponentBuilder.cpp index 67b56d878b..ad49e7015e 100644 --- a/src/gui/components/layout/juce_ComponentBuilder.cpp +++ b/src/gui/components/layout/juce_ComponentBuilder.cpp @@ -146,7 +146,7 @@ Component* ComponentBuilder::createComponent() TypeHandler* const type = getHandlerForState (state); jassert (type != nullptr); // trying to create a component from an unknown type of ValueTree - return type != nullptr ? ComponentBuilderHelpers::createNewComponent (*type, state, 0) : 0; + return type != nullptr ? ComponentBuilderHelpers::createNewComponent (*type, state, nullptr) : nullptr; } void ComponentBuilder::registerTypeHandler (ComponentBuilder::TypeHandler* const type) diff --git a/src/gui/components/lookandfeel/juce_LookAndFeel.cpp b/src/gui/components/lookandfeel/juce_LookAndFeel.cpp index 3a6c2b5ed2..35a316d03d 100644 --- a/src/gui/components/lookandfeel/juce_LookAndFeel.cpp +++ b/src/gui/components/lookandfeel/juce_LookAndFeel.cpp @@ -2479,7 +2479,7 @@ Button* LookAndFeel::createTabBarExtrasButton() overImage.addAndMakeVisible (dp.createCopy()); DrawableButton* db = new DrawableButton ("tabs", DrawableButton::ImageFitted); - db->setImages (&normalImage, &overImage, 0); + db->setImages (&normalImage, &overImage, nullptr); return db; } @@ -2790,7 +2790,7 @@ Drawable* LookAndFeel::loadDrawableFromData (const void* data, size_t numBytes) MemoryInputStream m (data, numBytes, false); GZIPDecompressorInputStream gz (m); ValueTree drawable (ValueTree::readFromStream (gz)); - return Drawable::createFromValueTree (drawable.getChild (0), 0); + return Drawable::createFromValueTree (drawable.getChild (0), nullptr); } const Drawable* LookAndFeel::getDefaultFolderImage() diff --git a/src/gui/components/mouse/juce_ComponentDragger.h b/src/gui/components/mouse/juce_ComponentDragger.h index e7f1de61b8..591327c25c 100644 --- a/src/gui/components/mouse/juce_ComponentDragger.h +++ b/src/gui/components/mouse/juce_ComponentDragger.h @@ -52,7 +52,7 @@ void mouseDrag (const MouseEvent& e) { - myDragger.dragComponent (this, e, 0); + myDragger.dragComponent (this, e, nullptr); } }; @endcode diff --git a/src/gui/components/positioning/juce_MarkerList.cpp b/src/gui/components/positioning/juce_MarkerList.cpp index 476adc8335..b4bea4640f 100644 --- a/src/gui/components/positioning/juce_MarkerList.cpp +++ b/src/gui/components/positioning/juce_MarkerList.cpp @@ -237,8 +237,8 @@ void MarkerList::ValueTreeWrapper::setMarker (const MarkerList::Marker& m, UndoM else { marker = ValueTree (markerTag); - marker.setProperty (nameProperty, m.name, 0); - marker.setProperty (posProperty, m.position.toString(), 0); + marker.setProperty (nameProperty, m.name, nullptr); + marker.setProperty (posProperty, m.position.toString(), nullptr); state.addChild (marker, -1, undoManager); } } diff --git a/src/gui/components/positioning/juce_RelativePointPath.cpp b/src/gui/components/positioning/juce_RelativePointPath.cpp index 57c580f2be..1ef45b35dc 100644 --- a/src/gui/components/positioning/juce_RelativePointPath.cpp +++ b/src/gui/components/positioning/juce_RelativePointPath.cpp @@ -155,7 +155,7 @@ RelativePointPath::StartSubPath::StartSubPath (const RelativePoint& pos) const ValueTree RelativePointPath::StartSubPath::createTree() const { ValueTree v (DrawablePath::ValueTreeWrapper::Element::startSubPathElement); - v.setProperty (DrawablePath::ValueTreeWrapper::point1, startPos.toString(), 0); + v.setProperty (DrawablePath::ValueTreeWrapper::point1, startPos.toString(), nullptr); return v; } @@ -211,7 +211,7 @@ RelativePointPath::LineTo::LineTo (const RelativePoint& endPoint_) const ValueTree RelativePointPath::LineTo::createTree() const { ValueTree v (DrawablePath::ValueTreeWrapper::Element::lineToElement); - v.setProperty (DrawablePath::ValueTreeWrapper::point1, endPoint.toString(), 0); + v.setProperty (DrawablePath::ValueTreeWrapper::point1, endPoint.toString(), nullptr); return v; } @@ -242,8 +242,8 @@ RelativePointPath::QuadraticTo::QuadraticTo (const RelativePoint& controlPoint, const ValueTree RelativePointPath::QuadraticTo::createTree() const { ValueTree v (DrawablePath::ValueTreeWrapper::Element::quadraticToElement); - v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), 0); - v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), 0); + v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), nullptr); + v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), nullptr); return v; } @@ -277,9 +277,9 @@ RelativePointPath::CubicTo::CubicTo (const RelativePoint& controlPoint1, const R const ValueTree RelativePointPath::CubicTo::createTree() const { ValueTree v (DrawablePath::ValueTreeWrapper::Element::cubicToElement); - v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), 0); - v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), 0); - v.setProperty (DrawablePath::ValueTreeWrapper::point3, controlPoints[2].toString(), 0); + v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), nullptr); + v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), nullptr); + v.setProperty (DrawablePath::ValueTreeWrapper::point3, controlPoints[2].toString(), nullptr); return v; } diff --git a/src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp b/src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp index d21660f3a0..04ebc87a38 100644 --- a/src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp +++ b/src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp @@ -88,7 +88,7 @@ public: const String& noItemsMessage_, const int minNumber_, const int maxNumber_) - : ListBox (String::empty, 0), + : ListBox (String::empty, nullptr), deviceManager (deviceManager_), noItemsMessage (noItemsMessage_), minNumber (minNumber_), @@ -650,7 +650,7 @@ public: ChannelSelectorListBox (const AudioIODeviceType::DeviceSetupDetails& setup_, const BoxType type_, const String& noItemsMessage_) - : ListBox (String::empty, 0), + : ListBox (String::empty, nullptr), setup (setup_), type (type_), noItemsMessage (noItemsMessage_) diff --git a/src/gui/components/windows/juce_CallOutBox.h b/src/gui/components/windows/juce_CallOutBox.h index ea5b8b7737..4af65a4457 100644 --- a/src/gui/components/windows/juce_CallOutBox.h +++ b/src/gui/components/windows/juce_CallOutBox.h @@ -46,7 +46,7 @@ MyContentComponent content; content.setSize (300, 300); - CallOutBox callOut (content, *this, 0); + CallOutBox callOut (content, *this, nullptr); callOut.runModalLoop(); } @endcode diff --git a/src/gui/graphics/drawables/juce_Drawable.cpp b/src/gui/graphics/drawables/juce_Drawable.cpp index 4e21fdb968..cedeb205bf 100644 --- a/src/gui/graphics/drawables/juce_Drawable.cpp +++ b/src/gui/graphics/drawables/juce_Drawable.cpp @@ -238,9 +238,9 @@ const String Drawable::ValueTreeWrapperBase::getID() const void Drawable::ValueTreeWrapperBase::setID (const String& newID) { if (newID.isEmpty()) - state.removeProperty (ComponentBuilder::idProperty, 0); + state.removeProperty (ComponentBuilder::idProperty, nullptr); else - state.setProperty (ComponentBuilder::idProperty, newID, 0); + state.setProperty (ComponentBuilder::idProperty, newID, nullptr); } diff --git a/src/gui/graphics/drawables/juce_DrawableComposite.cpp b/src/gui/graphics/drawables/juce_DrawableComposite.cpp index dbb5814f62..0b3de87ea3 100644 --- a/src/gui/graphics/drawables/juce_DrawableComposite.cpp +++ b/src/gui/graphics/drawables/juce_DrawableComposite.cpp @@ -290,8 +290,8 @@ const RelativeRectangle DrawableComposite::ValueTreeWrapper::getContentArea() co void DrawableComposite::ValueTreeWrapper::setContentArea (const RelativeRectangle& newArea, UndoManager* undoManager) { - MarkerList::ValueTreeWrapper markersX (getMarkerListCreating (true, 0)); - MarkerList::ValueTreeWrapper markersY (getMarkerListCreating (false, 0)); + MarkerList::ValueTreeWrapper markersX (getMarkerListCreating (true, nullptr)); + MarkerList::ValueTreeWrapper markersY (getMarkerListCreating (false, nullptr)); markersX.setMarker (MarkerList::Marker (contentLeftMarkerName, newArea.left), undoManager); markersX.setMarker (MarkerList::Marker (contentRightMarkerName, newArea.right), undoManager); @@ -329,7 +329,7 @@ const ValueTree DrawableComposite::createValueTree (ComponentBuilder::ImageProvi ValueTreeWrapper v (tree); v.setID (getComponentID()); - v.setBoundingBox (bounds, 0); + v.setBoundingBox (bounds, nullptr); ValueTree childList (v.getChildListCreating (nullptr)); @@ -338,11 +338,11 @@ const ValueTree DrawableComposite::createValueTree (ComponentBuilder::ImageProvi const Drawable* const d = dynamic_cast (getChildComponent(i)); jassert (d != nullptr); // You can't save a mix of Drawables and normal components! - childList.addChild (d->createValueTree (imageProvider), -1, 0); + childList.addChild (d->createValueTree (imageProvider), -1, nullptr); } - v.getMarkerListCreating (true, 0).readFrom (markersX, 0); - v.getMarkerListCreating (false, 0).readFrom (markersY, 0); + v.getMarkerListCreating (true, nullptr).readFrom (markersX, nullptr); + v.getMarkerListCreating (false, nullptr).readFrom (markersY, nullptr); return tree; } diff --git a/src/gui/graphics/drawables/juce_DrawableImage.cpp b/src/gui/graphics/drawables/juce_DrawableImage.cpp index 0703d6738c..eb7cf84a69 100644 --- a/src/gui/graphics/drawables/juce_DrawableImage.cpp +++ b/src/gui/graphics/drawables/juce_DrawableImage.cpp @@ -283,16 +283,16 @@ const ValueTree DrawableImage::createValueTree (ComponentBuilder::ImageProvider* ValueTreeWrapper v (tree); v.setID (getComponentID()); - v.setOpacity (opacity, 0); - v.setOverlayColour (overlayColour, 0); - v.setBoundingBox (bounds, 0); + v.setOpacity (opacity, nullptr); + v.setOverlayColour (overlayColour, nullptr); + v.setBoundingBox (bounds, nullptr); if (image.isValid()) { jassert (imageProvider != nullptr); // if you're using images, you need to provide something that can load and save them! if (imageProvider != nullptr) - v.setImageIdentifier (imageProvider->getIdentifierForImage (image), 0); + v.setImageIdentifier (imageProvider->getIdentifierForImage (image), nullptr); } return tree; diff --git a/src/gui/graphics/drawables/juce_DrawablePath.cpp b/src/gui/graphics/drawables/juce_DrawablePath.cpp index 564a6f50ed..a34826ff1b 100644 --- a/src/gui/graphics/drawables/juce_DrawablePath.cpp +++ b/src/gui/graphics/drawables/juce_DrawablePath.cpp @@ -150,7 +150,7 @@ void DrawablePath::setPath (const RelativePointPath& newRelativePath) else { relativePath = nullptr; - applyRelativePath (newRelativePath, 0); + applyRelativePath (newRelativePath, nullptr); } } @@ -171,7 +171,7 @@ DrawablePath::ValueTreeWrapper::ValueTreeWrapper (const ValueTree& state_) ValueTree DrawablePath::ValueTreeWrapper::getPathState() { - return state.getOrCreateChildWithName (path, 0); + return state.getOrCreateChildWithName (path, nullptr); } bool DrawablePath::ValueTreeWrapper::usesNonZeroWinding() const @@ -498,9 +498,9 @@ ValueTree DrawablePath::ValueTreeWrapper::Element::insertPoint (const Point= 0xd800 && n <= 0xdfff) + { + const uint32 nextWord = (uint32) (uint16) in.readShort(); + jassert (nextWord >= 0xdc00); // illegal unicode character! + + n = 0x10000 + (((n - 0xd800) << 10) | (nextWord - 0xdc00)); + } + + return (juce_wchar) n; + } + + void writeChar (OutputStream& out, juce_wchar charToWrite) + { + if (charToWrite >= 0x10000) + { + charToWrite -= 0x10000; + out.writeShort ((short) (uint16) (0xd800 + (charToWrite >> 10))); + out.writeShort ((short) (uint16) (0xdc00 + (charToWrite & 0x3ff))); + } + else + { + out.writeShort ((short) (uint16) charToWrite); + } + } +} + //============================================================================== CustomTypeface::CustomTypeface() : Typeface (String::empty) @@ -118,13 +151,13 @@ CustomTypeface::CustomTypeface (InputStream& serialisedTypefaceStream) isBold = in.readBool(); isItalic = in.readBool(); ascent = in.readFloat(); - defaultCharacter = (juce_wchar) in.readShort(); + defaultCharacter = CustomTypefaceHelpers::readChar (in); int i, numChars = in.readInt(); for (i = 0; i < numChars; ++i) { - const juce_wchar c = (juce_wchar) in.readShort(); + const juce_wchar c = CustomTypefaceHelpers::readChar (in); const float width = in.readFloat(); Path p; @@ -136,8 +169,8 @@ CustomTypeface::CustomTypeface (InputStream& serialisedTypefaceStream) for (i = 0; i < numKerningPairs; ++i) { - const juce_wchar char1 = (juce_wchar) in.readShort(); - const juce_wchar char2 = (juce_wchar) in.readShort(); + const juce_wchar char1 = CustomTypefaceHelpers::readChar (in); + const juce_wchar char2 = CustomTypefaceHelpers::readChar (in); addKerningPair (char1, char2, in.readFloat()); } @@ -286,7 +319,7 @@ bool CustomTypeface::writeToStream (OutputStream& outputStream) out.writeBool (isBold); out.writeBool (isItalic); out.writeFloat (ascent); - out.writeShort ((short) (unsigned short) defaultCharacter); + CustomTypefaceHelpers::writeChar (out, defaultCharacter); out.writeInt (glyphs.size()); int i, numKerningPairs = 0; @@ -294,7 +327,7 @@ bool CustomTypeface::writeToStream (OutputStream& outputStream) for (i = 0; i < glyphs.size(); ++i) { const GlyphInfo* const g = glyphs.getUnchecked (i); - out.writeShort ((short) (unsigned short) g->character); + CustomTypefaceHelpers::writeChar (out, g->character); out.writeFloat (g->width); g->path.writePathToStream (out); @@ -310,8 +343,8 @@ bool CustomTypeface::writeToStream (OutputStream& outputStream) for (int j = 0; j < g->kerningPairs.size(); ++j) { const GlyphInfo::KerningPair& p = g->kerningPairs.getReference (j); - out.writeShort ((short) (unsigned short) g->character); - out.writeShort ((short) (unsigned short) p.character2); + CustomTypefaceHelpers::writeChar (out, g->character); + CustomTypefaceHelpers::writeChar (out, p.character2); out.writeFloat (p.kerningAmount); } } diff --git a/src/maths/juce_Expression.cpp b/src/maths/juce_Expression.cpp index 108b5c5c4e..4d08c74bb1 100644 --- a/src/maths/juce_Expression.cpp +++ b/src/maths/juce_Expression.cpp @@ -272,7 +272,7 @@ public: } else { - result = scope.evaluateFunction (functionName, 0, 0); + result = scope.evaluateFunction (functionName, nullptr, 0); } return new Constant (result, false);