Browse Source

Removed a few more places where static objects could cause problems for people who do unwise amounts of work in their static constructors.

tags/2021-05-28
jules 11 years ago
parent
commit
a316bd5f6f
21 changed files with 44 additions and 44 deletions
  1. +1
    -1
      extras/Introjucer/Source/Utility/jucer_MiscUtilities.h
  2. +1
    -1
      modules/juce_audio_processors/scanning/juce_PluginDirectoryScanner.cpp
  3. +4
    -4
      modules/juce_browser_plugin_client/wrapper/juce_ActiveX_GlueCode.cpp
  4. +1
    -1
      modules/juce_browser_plugin_client/wrapper/juce_NPAPI_GlueCode.cpp
  5. +1
    -1
      modules/juce_core/containers/juce_PropertySet.cpp
  6. +2
    -2
      modules/juce_core/files/juce_File.cpp
  7. +2
    -2
      modules/juce_core/files/juce_TemporaryFile.cpp
  8. +7
    -7
      modules/juce_core/javascript/juce_JSON.cpp
  9. +1
    -1
      modules/juce_core/javascript/juce_Javascript.cpp
  10. +1
    -1
      modules/juce_core/native/juce_android_Files.cpp
  11. +2
    -2
      modules/juce_core/native/juce_linux_Files.cpp
  12. +1
    -1
      modules/juce_core/native/juce_mac_Files.mm
  13. +2
    -2
      modules/juce_core/native/juce_win32_Files.cpp
  14. +1
    -1
      modules/juce_core/time/juce_PerformanceCounter.cpp
  15. +1
    -1
      modules/juce_core/time/juce_PerformanceCounter.h
  16. +3
    -3
      modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp
  17. +9
    -9
      modules/juce_data_structures/values/juce_ValueTree.cpp
  18. +1
    -1
      modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp
  19. +1
    -1
      modules/juce_gui_basics/widgets/juce_ListBox.cpp
  20. +1
    -1
      modules/juce_gui_basics/widgets/juce_TableListBox.cpp
  21. +1
    -1
      modules/juce_gui_basics/widgets/juce_TreeView.cpp

+ 1
- 1
extras/Introjucer/Source/Utility/jucer_MiscUtilities.h View File

@@ -231,7 +231,7 @@ public:
if (getColour() != newColour)
{
if (newColour == defaultColour && defaultButton.isVisible())
colourValue = var::null;
colourValue = var();
else
colourValue = newColour.toDisplayString (true);
}


+ 1
- 1
modules/juce_audio_processors/scanning/juce_PluginDirectoryScanner.cpp View File

@@ -120,7 +120,7 @@ bool PluginDirectoryScanner::skipNextFile()
void PluginDirectoryScanner::setDeadMansPedalFile (const StringArray& newContents)
{
if (deadMansPedalFile != File::nonexistent)
if (deadMansPedalFile.getFullPathName().isNotEmpty())
deadMansPedalFile.replaceWithText (newContents.joinIntoString ("\n"), true, true);
}


+ 4
- 4
modules/juce_browser_plugin_client/wrapper/juce_ActiveX_GlueCode.cpp View File

@@ -252,7 +252,7 @@ public:
}
}
return var::null;
return var();
}
bool hasProperty (const Identifier& propertyName) const override
@@ -297,7 +297,7 @@ public:
void removeProperty (const Identifier& propertyName) override
{
setProperty (propertyName, var::null);
setProperty (propertyName, var());
}
bool hasMethod (const Identifier& methodName) const override
@@ -401,7 +401,7 @@ var variantTojuceVar (const VARIANT& v)
switch (v.vt & ~VT_BYREF)
{
case VT_VOID:
case VT_EMPTY: return var::null;
case VT_EMPTY: return var();
case VT_I1: return var ((int) v.cVal);
case VT_I2: return var ((int) v.iVal);
case VT_I4: return var ((int) v.lVal);
@@ -421,7 +421,7 @@ var variantTojuceVar (const VARIANT& v)
}
}
return var::null;
return var();
}
//==============================================================================


+ 1
- 1
modules/juce_browser_plugin_client/wrapper/juce_NPAPI_GlueCode.cpp View File

@@ -896,7 +896,7 @@ static var createValueFromNPVariant (NPP npp, const NPVariant& v)
else if (NPVARIANT_IS_OBJECT (v) && npp != nullptr)
return var (new DynamicObjectWrappingNPObject (npp, NPVARIANT_TO_OBJECT (v)));
return var::null;
return var();
}
static void createNPVariantFromValue (NPP npp, NPVariant& out, const var& v)


+ 1
- 1
modules/juce_core/containers/juce_PropertySet.cpp View File

@@ -155,7 +155,7 @@ void PropertySet::removeValue (StringRef keyName)
void PropertySet::setValue (const String& keyName, const XmlElement* const xml)
{
setValue (keyName, xml == nullptr ? var::null
setValue (keyName, xml == nullptr ? var()
: var (xml->createDocument ("", true)));
}


+ 2
- 2
modules/juce_core/files/juce_File.cpp View File

@@ -322,7 +322,7 @@ String File::getFileNameWithoutExtension() const
bool File::isAChildOf (const File& potentialParent) const
{
if (potentialParent == File::nonexistent)
if (potentialParent.fullPath.isEmpty())
return false;
const String ourPath (getPathUpToLastSlash());
@@ -629,7 +629,7 @@ bool File::hasFileExtension (StringRef possibleSuffix) const
File File::withFileExtension (StringRef newExtension) const
{
if (fullPath.isEmpty())
return File::nonexistent;
return File();
String filePart (getFileName());


+ 2
- 2
modules/juce_core/files/juce_TemporaryFile.cpp View File

@@ -50,7 +50,7 @@ TemporaryFile::TemporaryFile (const File& target, const int optionFlags)
targetFile (target)
{
// If you use this constructor, you need to give it a valid target file!
jassert (targetFile != File::nonexistent);
jassert (targetFile != File());
}
TemporaryFile::TemporaryFile (const File& target, const File& temporary)
@@ -79,7 +79,7 @@ bool TemporaryFile::overwriteTargetFileWithTemporary() const
{
// This method only works if you created this object with the constructor
// that takes a target file!
jassert (targetFile != File::nonexistent);
jassert (targetFile != File());
if (temporaryFile.exists())
{


+ 7
- 7
modules/juce_core/javascript/juce_JSON.cpp View File

@@ -35,7 +35,7 @@ public:
switch (t.getAndAdvance())
{
case 0: result = var::null; return Result::ok();
case 0: result = var(); return Result::ok();
case '{': return parseObject (t, result);
case '[': return parseArray (t, result);
}
@@ -148,7 +148,7 @@ private:
if (t2.getAndAdvance() == 'u' && t2.getAndAdvance() == 'l' && t2.getAndAdvance() == 'l')
{
t = t2;
result = var::null;
result = var();
return Result::ok();
}
break;
@@ -254,7 +254,7 @@ private:
if (c2 != ':')
return createFail ("Expected ':', but found", &oldT);
resultProperties.set (propertyName, var::null);
resultProperties.set (propertyName, var());
var* propertyValue = resultProperties.getVarPointer (propertyName);
Result r2 (parseAny (t, *propertyValue));
@@ -300,7 +300,7 @@ private:
return createFail ("Unexpected end-of-input in array declaration");
t = oldT;
destArray->add (var::null);
destArray->add (var());
Result r (parseAny (t, destArray->getReference (destArray->size() - 1)));
if (r.failed())
@@ -514,7 +514,7 @@ var JSON::parse (const String& text)
var result;
if (! JSONParser::parseObjectOrArray (text.getCharPointer(), result))
result = var::null;
result = var();
return result;
}
@@ -610,7 +610,7 @@ public:
{
switch (r.nextInt (depth > 3 ? 6 : 8))
{
case 0: return var::null;
case 0: return var();
case 1: return r.nextInt();
case 2: return r.nextInt64();
case 3: return r.nextBool();
@@ -638,7 +638,7 @@ public:
}
default:
return var::null;
return var();
}
}


+ 1
- 1
modules/juce_core/javascript/juce_Javascript.cpp View File

@@ -1244,7 +1244,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
if (matchIf (TokenTypes::openParen)) return parseSuffixes (matchCloseParen (parseExpression()));
if (matchIf (TokenTypes::true_)) return parseSuffixes (new LiteralValue (location, (int) 1));
if (matchIf (TokenTypes::false_)) return parseSuffixes (new LiteralValue (location, (int) 0));
if (matchIf (TokenTypes::null_)) return parseSuffixes (new LiteralValue (location, var::null));
if (matchIf (TokenTypes::null_)) return parseSuffixes (new LiteralValue (location, var()));
if (matchIf (TokenTypes::undefined)) return parseSuffixes (new Expression (location));
if (currentType == TokenTypes::literal)


+ 1
- 1
modules/juce_core/native/juce_android_Files.cpp View File

@@ -80,7 +80,7 @@ File File::getSpecialLocation (const SpecialLocationType type)
break;
}
return File::nonexistent;
return File();
}
bool File::moveToTrash() const


+ 2
- 2
modules/juce_core/native/juce_linux_Files.cpp View File

@@ -115,7 +115,7 @@ File File::getSpecialLocation (const SpecialLocationType type)
if (struct passwd* const pw = getpwuid (getuid()))
return File (CharPointer_UTF8 (pw->pw_dir));
return File::nonexistent;
return File();
}
case userDocumentsDirectory: return resolveXDGFolder ("XDG_DOCUMENTS_DIR", "~");
@@ -163,7 +163,7 @@ File File::getSpecialLocation (const SpecialLocationType type)
break;
}
return File::nonexistent;
return File();
}
//==============================================================================


+ 1
- 1
modules/juce_core/native/juce_mac_Files.mm View File

@@ -257,7 +257,7 @@ File File::getSpecialLocation (const SpecialLocationType type)
return File (resultPath.convertToPrecomposedUnicode());
}
return File::nonexistent;
return File();
}
//==============================================================================


+ 2
- 2
modules/juce_core/native/juce_win32_Files.cpp View File

@@ -93,7 +93,7 @@ namespace WindowsFileHelpers
if (SHGetSpecialFolderPath (0, path, type, FALSE))
return File (String (path));
return File::nonexistent;
return File();
}
File getModuleFileName (HINSTANCE moduleHandle)
@@ -542,7 +542,7 @@ File JUCE_CALLTYPE File::getSpecialLocation (const SpecialLocationType type)
default:
jassertfalse; // unknown type?
return File::nonexistent;
return File();
}
return WindowsFileHelpers::getSpecialFolderPath (csidlType);


+ 1
- 1
modules/juce_core/time/juce_PerformanceCounter.cpp View File

@@ -28,7 +28,7 @@
static void appendToFile (const File& f, const String& s)
{
if (f != File::nonexistent)
if (f.getFullPathName().isNotEmpty())
{
FileOutputStream out (f);


+ 1
- 1
modules/juce_core/time/juce_PerformanceCounter.h View File

@@ -65,7 +65,7 @@ public:
*/
PerformanceCounter (const String& counterName,
int runsPerPrintout = 100,
const File& loggingFile = File::nonexistent);
const File& loggingFile = File());
/** Destructor. */
~PerformanceCounter();


+ 3
- 3
modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp View File

@@ -90,8 +90,8 @@ File PropertiesFile::Options::getDefaultFile() const
File dir (File::getSpecialLocation (commonToAllUsers ? File::commonApplicationDataDirectory
: File::userApplicationDataDirectory));
if (dir == File::nonexistent)
return File::nonexistent;
if (dir == File())
return File();
dir = dir.getChildFile (folderName.isNotEmpty() ? folderName
: applicationName);
@@ -165,7 +165,7 @@ bool PropertiesFile::save()
stopTimer();
if (options.doNotSave
|| file == File::nonexistent
|| file == File()
|| file.isDirectory()
|| ! file.getParentDirectory().createDirectory())
return false;


+ 9
- 9
modules/juce_data_structures/values/juce_ValueTree.cpp View File

@@ -168,7 +168,7 @@ public:
}
else
{
undoManager->perform (new SetPropertyAction (this, name, newValue, var::null, true, false));
undoManager->perform (new SetPropertyAction (this, name, newValue, var(), true, false));
}
}
}
@@ -188,7 +188,7 @@ public:
else
{
if (properties.contains (name))
undoManager->perform (new SetPropertyAction (this, name, var::null, properties [name], false, true));
undoManager->perform (new SetPropertyAction (this, name, var(), properties [name], false, true));
}
}
@@ -206,7 +206,7 @@ public:
else
{
for (int i = properties.size(); --i >= 0;)
undoManager->perform (new SetPropertyAction (this, properties.getName(i), var::null,
undoManager->perform (new SetPropertyAction (this, properties.getName(i), var(),
properties.getValueAt(i), false, true));
}
}
@@ -230,7 +230,7 @@ public:
return ValueTree (s);
}
return ValueTree::invalid;
return ValueTree();
}
ValueTree getOrCreateChildWithName (const Identifier typeToMatch, UndoManager* undoManager)
@@ -257,7 +257,7 @@ public:
return ValueTree (s);
}
return ValueTree::invalid;
return ValueTree();
}
bool isAChildOf (const SharedObject* const possibleParent) const noexcept
@@ -846,17 +846,17 @@ ValueTree ValueTree::getChild (int index) const
ValueTree ValueTree::getChildWithName (const Identifier type) const
{
return object != nullptr ? object->getChildWithName (type) : ValueTree::invalid;
return object != nullptr ? object->getChildWithName (type) : ValueTree();
}
ValueTree ValueTree::getOrCreateChildWithName (const Identifier type, UndoManager* undoManager)
{
return object != nullptr ? object->getOrCreateChildWithName (type, undoManager) : ValueTree::invalid;
return object != nullptr ? object->getOrCreateChildWithName (type, undoManager) : ValueTree();
}
ValueTree ValueTree::getChildWithProperty (const Identifier propertyName, const var& propertyValue) const
{
return object != nullptr ? object->getChildWithProperty (propertyName, propertyValue) : ValueTree::invalid;
return object != nullptr ? object->getChildWithProperty (propertyName, propertyValue) : ValueTree();
}
bool ValueTree::isAChildOf (const ValueTree& possibleParent) const
@@ -976,7 +976,7 @@ ValueTree ValueTree::readFromStream (InputStream& input)
const String type (input.readString());
if (type.isEmpty())
return ValueTree::invalid;
return ValueTree();
ValueTree v (type);


+ 1
- 1
modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp View File

@@ -136,7 +136,7 @@ File DirectoryContentsList::getFile (const int index) const
if (const FileInfo* const info = files [index])
return root.getChildFile (info->filename);
return File::nonexistent;
return File();
}
bool DirectoryContentsList::contains (const File& targetFile) const


+ 1
- 1
modules/juce_gui_basics/widgets/juce_ListBox.cpp View File

@@ -952,6 +952,6 @@ void ListBoxModel::selectedRowsChanged (int) {}
void ListBoxModel::deleteKeyPressed (int) {}
void ListBoxModel::returnKeyPressed (int) {}
void ListBoxModel::listWasScrolled() {}
var ListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var::null; }
var ListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var(); }
String ListBoxModel::getTooltipForRow (int) { return String::empty; }
MouseCursor ListBoxModel::getMouseCursorForRow (int) { return MouseCursor::NormalCursor; }

+ 1
- 1
modules/juce_gui_basics/widgets/juce_TableListBox.cpp View File

@@ -466,7 +466,7 @@ void TableListBoxModel::returnKeyPressed (int) {}
void TableListBoxModel::listWasScrolled() {}
String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/) { return String::empty; }
var TableListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var::null; }
var TableListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var(); }
Component* TableListBoxModel::refreshComponentForCell (int, int, bool, Component* existingComponentToUpdate)
{


+ 1
- 1
modules/juce_gui_basics/widgets/juce_TreeView.cpp View File

@@ -1371,7 +1371,7 @@ String TreeViewItem::getTooltip()
var TreeViewItem::getDragSourceDescription()
{
return var::null;
return var();
}
bool TreeViewItem::isInterestedInFileDrag (const StringArray&)


Loading…
Cancel
Save