Browse Source

Avoid jassert name clashes, makefile stuff

Signed-off-by: falkTX <falktx@gmail.com>
tags/v2.1-alpha1-winvst
parent
commit
51428eeb94
37 changed files with 202 additions and 197 deletions
  1. +3
    -2
      Makefile
  2. +1
    -0
      source/Makefile.mk
  3. +2
    -2
      source/backend/engine/Makefile
  4. +1
    -0
      source/modules/juce_audio_devices/native/juce_linux_JackAudio.cpp
  5. +15
    -15
      source/modules/water/containers/Array.h
  6. +1
    -1
      source/modules/water/containers/ElementComparator.h
  7. +1
    -1
      source/modules/water/containers/HashMap.h
  8. +8
    -8
      source/modules/water/containers/LinkedListPointer.h
  9. +2
    -2
      source/modules/water/containers/NamedValueSet.cpp
  10. +4
    -4
      source/modules/water/containers/OwnedArray.h
  11. +9
    -9
      source/modules/water/containers/ReferenceCountedArray.h
  12. +2
    -2
      source/modules/water/containers/SortedSet.h
  13. +3
    -3
      source/modules/water/files/DirectoryIterator.cpp
  14. +9
    -7
      source/modules/water/files/File.cpp
  15. +4
    -4
      source/modules/water/files/FileInputStream.cpp
  16. +2
    -2
      source/modules/water/files/FileOutputStream.cpp
  17. +4
    -4
      source/modules/water/files/TemporaryFile.cpp
  18. +2
    -2
      source/modules/water/maths/MathsFunctions.h
  19. +1
    -1
      source/modules/water/maths/Random.cpp
  20. +5
    -5
      source/modules/water/memory/Atomic.h
  21. +6
    -6
      source/modules/water/memory/MemoryBlock.cpp
  22. +7
    -7
      source/modules/water/memory/ReferenceCountedObject.h
  23. +1
    -1
      source/modules/water/midi/MidiFile.cpp
  24. +36
    -36
      source/modules/water/midi/MidiMessage.cpp
  25. +1
    -1
      source/modules/water/midi/MidiMessageSequence.cpp
  26. +11
    -11
      source/modules/water/processors/AudioProcessorGraph.cpp
  27. +2
    -2
      source/modules/water/streams/InputStream.cpp
  28. +3
    -3
      source/modules/water/streams/MemoryOutputStream.cpp
  29. +10
    -10
      source/modules/water/synthesisers/Synthesiser.cpp
  30. +3
    -3
      source/modules/water/text/CharPointer_UTF8.h
  31. +3
    -3
      source/modules/water/text/Identifier.cpp
  32. +16
    -16
      source/modules/water/text/String.cpp
  33. +1
    -1
      source/modules/water/text/String.h
  34. +1
    -1
      source/modules/water/text/StringArray.cpp
  35. +2
    -2
      source/modules/water/threads/ChildProcess.cpp
  36. +3
    -3
      source/modules/water/water.h
  37. +17
    -17
      source/modules/water/xml/XmlElement.cpp

+ 3
- 2
Makefile View File

@@ -62,15 +62,16 @@ endif
ifeq ($(USING_JUCE),true) ifeq ($(USING_JUCE),true)
ALL_LIBS += $(MODULEDIR)/juce_audio_basics.a ALL_LIBS += $(MODULEDIR)/juce_audio_basics.a
ALL_LIBS += $(MODULEDIR)/juce_audio_devices.a ALL_LIBS += $(MODULEDIR)/juce_audio_devices.a
ALL_LIBS += $(MODULEDIR)/juce_audio_formats.a
ALL_LIBS += $(MODULEDIR)/juce_audio_processors.a
ALL_LIBS += $(MODULEDIR)/juce_core.a ALL_LIBS += $(MODULEDIR)/juce_core.a
ALL_LIBS += $(MODULEDIR)/juce_data_structures.a ALL_LIBS += $(MODULEDIR)/juce_data_structures.a
ALL_LIBS += $(MODULEDIR)/juce_events.a ALL_LIBS += $(MODULEDIR)/juce_events.a
ifeq ($(MACOS_OR_WIN32),true)
ALL_LIBS += $(MODULEDIR)/juce_audio_processors.a
ALL_LIBS += $(MODULEDIR)/juce_graphics.a ALL_LIBS += $(MODULEDIR)/juce_graphics.a
ALL_LIBS += $(MODULEDIR)/juce_gui_basics.a ALL_LIBS += $(MODULEDIR)/juce_gui_basics.a
# ALL_LIBS += $(MODULEDIR)/juce_gui_extra.a # ALL_LIBS += $(MODULEDIR)/juce_gui_extra.a
endif endif
endif


libs: $(ALL_LIBS) libs: $(ALL_LIBS)




+ 1
- 0
source/Makefile.mk View File

@@ -343,6 +343,7 @@ endif


ifeq ($(USING_JUCE),true) ifeq ($(USING_JUCE),true)
BASE_FLAGS += -DUSING_JUCE BASE_FLAGS += -DUSING_JUCE
BUILD_CXX_FLAGS += -DJUCE_APP_CONFIG_HEADER='<AppConfig.h>'
endif endif


# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------


+ 2
- 2
source/backend/engine/Makefile View File

@@ -29,8 +29,8 @@ OBJSa = $(OBJS) \
$(OBJDIR)/CarlaEngineNative.cpp.o $(OBJDIR)/CarlaEngineNative.cpp.o


ifeq ($(USING_JUCE),true) ifeq ($(USING_JUCE),true)
# OBJSa += \
# - $(OBJDIR)/CarlaEngineJuce.cpp.o
OBJSa += \
$(OBJDIR)/CarlaEngineJuce.cpp.o
else else
OBJSa += \ OBJSa += \
$(OBJDIR)/CarlaEngineRtAudio.cpp.o $(OBJDIR)/CarlaEngineRtAudio.cpp.o


+ 1
- 0
source/modules/juce_audio_devices/native/juce_linux_JackAudio.cpp View File

@@ -476,6 +476,7 @@ private:
static void errorCallback (const char* msg) static void errorCallback (const char* msg)
{ {
JUCE_JACK_LOG ("JackAudioIODevice::errorCallback " + String (msg)); JUCE_JACK_LOG ("JackAudioIODevice::errorCallback " + String (msg));
ignoreUnused(msg);
} }
static void sendDeviceChangedCallback(); static void sendDeviceChangedCallback();


+ 15
- 15
source/modules/water/containers/Array.h View File

@@ -229,7 +229,7 @@ public:
{ {
if (isPositiveAndBelow (index, numUsed)) if (isPositiveAndBelow (index, numUsed))
{ {
jassert (data.elements != nullptr);
wassert (data.elements != nullptr);
return data.elements [index]; return data.elements [index];
} }
@@ -247,7 +247,7 @@ public:
*/ */
inline ElementType getUnchecked (const int index) const inline ElementType getUnchecked (const int index) const
{ {
jassert (isPositiveAndBelow (index, numUsed) && data.elements != nullptr);
wassert (isPositiveAndBelow (index, numUsed) && data.elements != nullptr);
return data.elements [index]; return data.elements [index];
} }
@@ -262,7 +262,7 @@ public:
*/ */
inline ElementType& getReference (const int index) const noexcept inline ElementType& getReference (const int index) const noexcept
{ {
jassert (isPositiveAndBelow (index, numUsed) && data.elements != nullptr);
wassert (isPositiveAndBelow (index, numUsed) && data.elements != nullptr);
return data.elements [index]; return data.elements [index];
} }
@@ -274,7 +274,7 @@ public:
{ {
if (numUsed > 0) if (numUsed > 0)
{ {
jassert (data.elements != nullptr);
wassert (data.elements != nullptr);
return data.elements[0]; return data.elements[0];
} }
@@ -289,7 +289,7 @@ public:
{ {
if (numUsed > 0) if (numUsed > 0)
{ {
jassert (data.elements != nullptr);
wassert (data.elements != nullptr);
return data.elements[numUsed - 1]; return data.elements[numUsed - 1];
} }
@@ -551,11 +551,11 @@ public:
*/ */
void set (const int indexToChange, ParameterType newValue) void set (const int indexToChange, ParameterType newValue)
{ {
jassert (indexToChange >= 0);
wassert (indexToChange >= 0);
if (isPositiveAndBelow (indexToChange, numUsed)) if (isPositiveAndBelow (indexToChange, numUsed))
{ {
jassert (data.elements != nullptr);
wassert (data.elements != nullptr);
data.elements [indexToChange] = newValue; data.elements [indexToChange] = newValue;
} }
else if (indexToChange >= 0) else if (indexToChange >= 0)
@@ -576,7 +576,7 @@ public:
*/ */
void setUnchecked (const int indexToChange, ParameterType newValue) void setUnchecked (const int indexToChange, ParameterType newValue)
{ {
jassert (isPositiveAndBelow (indexToChange, numUsed));
wassert (isPositiveAndBelow (indexToChange, numUsed));
data.elements [indexToChange] = newValue; data.elements [indexToChange] = newValue;
} }
@@ -646,7 +646,7 @@ public:
{ {
if (startIndex < 0) if (startIndex < 0)
{ {
jassertfalse;
wassertfalse;
startIndex = 0; startIndex = 0;
} }
@@ -666,7 +666,7 @@ public:
*/ */
void resize (const int targetNumItems) void resize (const int targetNumItems)
{ {
jassert (targetNumItems >= 0);
wassert (targetNumItems >= 0);
const int numToAdd = targetNumItems - numUsed; const int numToAdd = targetNumItems - numUsed;
if (numToAdd > 0) if (numToAdd > 0)
@@ -761,7 +761,7 @@ public:
{ {
if (isPositiveAndBelow (indexToRemove, numUsed)) if (isPositiveAndBelow (indexToRemove, numUsed))
{ {
jassert (data.elements != nullptr);
wassert (data.elements != nullptr);
removeInternal (indexToRemove); removeInternal (indexToRemove);
} }
} }
@@ -780,7 +780,7 @@ public:
{ {
if (isPositiveAndBelow (indexToRemove, numUsed)) if (isPositiveAndBelow (indexToRemove, numUsed))
{ {
jassert (data.elements != nullptr);
wassert (data.elements != nullptr);
ElementType removed (data.elements[indexToRemove]); ElementType removed (data.elements[indexToRemove]);
removeInternal (indexToRemove); removeInternal (indexToRemove);
return removed; return removed;
@@ -801,13 +801,13 @@ public:
*/ */
void remove (const ElementType* elementToRemove) void remove (const ElementType* elementToRemove)
{ {
jassert (elementToRemove != nullptr);
jassert (data.elements != nullptr);
wassert (elementToRemove != nullptr);
wassert (data.elements != nullptr);
const int indexToRemove = int (elementToRemove - data.elements); const int indexToRemove = int (elementToRemove - data.elements);
if (! isPositiveAndBelow (indexToRemove, numUsed)) if (! isPositiveAndBelow (indexToRemove, numUsed))
{ {
jassertfalse;
wassertfalse;
return; return;
} }


+ 1
- 1
source/modules/water/containers/ElementComparator.h View File

@@ -122,7 +122,7 @@ static int findInsertIndexInSortedArray (ElementComparator& comparator,
int firstElement, int firstElement,
int lastElement) int lastElement)
{ {
jassert (firstElement <= lastElement);
wassert (firstElement <= lastElement);
ignoreUnused (comparator); // if you pass in an object with a static compareElements() method, this ignoreUnused (comparator); // if you pass in an object with a static compareElements() method, this
// avoids getting warning messages about the parameter being unused // avoids getting warning messages about the parameter being unused


+ 1
- 1
source/modules/water/containers/HashMap.h View File

@@ -443,7 +443,7 @@ private:
int generateHashFor (KeyTypeParameter key) const int generateHashFor (KeyTypeParameter key) const
{ {
const int hash = hashFunctionToUse.generateHash (key, getNumSlots()); const int hash = hashFunctionToUse.generateHash (key, getNumSlots());
jassert (isPositiveAndBelow (hash, getNumSlots())); // your hash function is generating out-of-range numbers!
wassert (isPositiveAndBelow (hash, getNumSlots())); // your hash function is generating out-of-range numbers!
return hash; return hash;
} }


+ 8
- 8
source/modules/water/containers/LinkedListPointer.h View File

@@ -90,7 +90,7 @@ public:
LinkedListPointer& operator= (LinkedListPointer&& other) noexcept LinkedListPointer& operator= (LinkedListPointer&& other) noexcept
{ {
jassert (this != &other); // hopefully the compiler should make this situation impossible!
wassert (this != &other); // hopefully the compiler should make this situation impossible!
item = other.item; item = other.item;
other.item = nullptr; other.item = nullptr;
@@ -186,8 +186,8 @@ public:
*/ */
void insertNext (ObjectType* const newItem) void insertNext (ObjectType* const newItem)
{ {
jassert (newItem != nullptr);
jassert (newItem->nextListItem == nullptr);
wassert (newItem != nullptr);
wassert (newItem->nextListItem == nullptr);
newItem->nextListItem = item; newItem->nextListItem = item;
item = newItem; item = newItem;
} }
@@ -198,7 +198,7 @@ public:
*/ */
void insertAtIndex (int index, ObjectType* newItem) void insertAtIndex (int index, ObjectType* newItem)
{ {
jassert (newItem != nullptr);
wassert (newItem != nullptr);
LinkedListPointer* l = this; LinkedListPointer* l = this;
while (index != 0 && l->item != nullptr) while (index != 0 && l->item != nullptr)
@@ -215,8 +215,8 @@ public:
*/ */
ObjectType* replaceNext (ObjectType* const newItem) noexcept ObjectType* replaceNext (ObjectType* const newItem) noexcept
{ {
jassert (newItem != nullptr);
jassert (newItem->nextListItem == nullptr);
wassert (newItem != nullptr);
wassert (newItem->nextListItem == nullptr);
ObjectType* const oldItem = item; ObjectType* const oldItem = item;
item = newItem; item = newItem;
@@ -315,7 +315,7 @@ public:
*/ */
void copyToArray (ObjectType** destArray) const noexcept void copyToArray (ObjectType** destArray) const noexcept
{ {
jassert (destArray != nullptr);
wassert (destArray != nullptr);
for (ObjectType* i = item; i != nullptr; i = i->nextListItem) for (ObjectType* i = item; i != nullptr; i = i->nextListItem)
*destArray++ = i; *destArray++ = i;
@@ -344,7 +344,7 @@ public:
: endOfList (&endOfListPointer) : endOfList (&endOfListPointer)
{ {
// This can only be used to add to the end of a list. // This can only be used to add to the end of a list.
jassert (endOfListPointer.item == nullptr);
wassert (endOfListPointer.item == nullptr);
} }
/** Appends an item to the list. */ /** Appends an item to the list. */


+ 2
- 2
source/modules/water/containers/NamedValueSet.cpp View File

@@ -186,7 +186,7 @@ Identifier NamedValueSet::getName (const int index) const noexcept
if (isPositiveAndBelow (index, values.size())) if (isPositiveAndBelow (index, values.size()))
return values.getReference (index).name; return values.getReference (index).name;
jassertfalse;
wassertfalse;
return Identifier(); return Identifier();
} }
@@ -195,7 +195,7 @@ const var& NamedValueSet::getValueAt (const int index) const noexcept
if (isPositiveAndBelow (index, values.size())) if (isPositiveAndBelow (index, values.size()))
return values.getReference (index).value; return values.getReference (index).value;
jassertfalse;
wassertfalse;
return getNullVarRef(); return getNullVarRef();
} }


+ 4
- 4
source/modules/water/containers/OwnedArray.h View File

@@ -415,7 +415,7 @@ public:
} }
else else
{ {
jassertfalse; // you're trying to set an object at a negative index, which doesn't have
wassertfalse; // you're trying to set an object at a negative index, which doesn't have
// any effect - but since the object is not being added, it may be leaking.. // any effect - but since the object is not being added, it may be leaking..
} }
@@ -438,7 +438,7 @@ public:
{ {
if (startIndex < 0) if (startIndex < 0)
{ {
jassertfalse;
wassertfalse;
startIndex = 0; startIndex = 0;
} }
@@ -446,7 +446,7 @@ public:
numElementsToAdd = arrayToAddFrom.size() - startIndex; numElementsToAdd = arrayToAddFrom.size() - startIndex;
data.ensureAllocatedSize (numUsed + numElementsToAdd); data.ensureAllocatedSize (numUsed + numElementsToAdd);
jassert (numElementsToAdd <= 0 || data.elements != nullptr);
wassert (numElementsToAdd <= 0 || data.elements != nullptr);
while (--numElementsToAdd >= 0) while (--numElementsToAdd >= 0)
{ {
@@ -478,7 +478,7 @@ public:
numElementsToAdd = arrayToAddFrom.size() - startIndex; numElementsToAdd = arrayToAddFrom.size() - startIndex;
data.ensureAllocatedSize (numUsed + numElementsToAdd); data.ensureAllocatedSize (numUsed + numElementsToAdd);
jassert (numElementsToAdd <= 0 || data.elements != nullptr);
wassert (numElementsToAdd <= 0 || data.elements != nullptr);
while (--numElementsToAdd >= 0) while (--numElementsToAdd >= 0)
data.elements [numUsed++] = createCopyIfNotNull (arrayToAddFrom.getUnchecked (startIndex++)); data.elements [numUsed++] = createCopyIfNotNull (arrayToAddFrom.getUnchecked (startIndex++));


+ 9
- 9
source/modules/water/containers/ReferenceCountedArray.h View File

@@ -187,7 +187,7 @@ public:
{ {
if (isPositiveAndBelow (index, numUsed)) if (isPositiveAndBelow (index, numUsed))
{ {
jassert (data.elements != nullptr);
wassert (data.elements != nullptr);
return data.elements [index]; return data.elements [index];
} }
@@ -199,7 +199,7 @@ public:
*/ */
inline ObjectClass* getObjectPointerUnchecked (const int index) const noexcept inline ObjectClass* getObjectPointerUnchecked (const int index) const noexcept
{ {
jassert (isPositiveAndBelow (index, numUsed) && data.elements != nullptr);
wassert (isPositiveAndBelow (index, numUsed) && data.elements != nullptr);
return data.elements [index]; return data.elements [index];
} }
@@ -212,7 +212,7 @@ public:
{ {
if (numUsed > 0) if (numUsed > 0)
{ {
jassert (data.elements != nullptr);
wassert (data.elements != nullptr);
return data.elements [0]; return data.elements [0];
} }
@@ -228,7 +228,7 @@ public:
{ {
if (numUsed > 0) if (numUsed > 0)
{ {
jassert (data.elements != nullptr);
wassert (data.elements != nullptr);
return data.elements [numUsed - 1]; return data.elements [numUsed - 1];
} }
@@ -314,7 +314,7 @@ public:
ObjectClass* add (ObjectClass* const newObject) noexcept ObjectClass* add (ObjectClass* const newObject) noexcept
{ {
data.ensureAllocatedSize (numUsed + 1); data.ensureAllocatedSize (numUsed + 1);
jassert (data.elements != nullptr);
wassert (data.elements != nullptr);
data.elements [numUsed++] = newObject; data.elements [numUsed++] = newObject;
if (newObject != nullptr) if (newObject != nullptr)
@@ -346,7 +346,7 @@ public:
indexToInsertAt = numUsed; indexToInsertAt = numUsed;
data.ensureAllocatedSize (numUsed + 1); data.ensureAllocatedSize (numUsed + 1);
jassert (data.elements != nullptr);
wassert (data.elements != nullptr);
ObjectClass** const e = data.elements + indexToInsertAt; ObjectClass** const e = data.elements + indexToInsertAt;
const int numToMove = numUsed - indexToInsertAt; const int numToMove = numUsed - indexToInsertAt;
@@ -411,7 +411,7 @@ public:
else else
{ {
data.ensureAllocatedSize (numUsed + 1); data.ensureAllocatedSize (numUsed + 1);
jassert (data.elements != nullptr);
wassert (data.elements != nullptr);
data.elements [numUsed++] = newObject; data.elements [numUsed++] = newObject;
} }
} }
@@ -432,7 +432,7 @@ public:
{ {
if (startIndex < 0) if (startIndex < 0)
{ {
jassertfalse;
wassertfalse;
startIndex = 0; startIndex = 0;
} }
@@ -840,7 +840,7 @@ private:
if (ObjectClass* o = data.elements [--numUsed]) if (ObjectClass* o = data.elements [--numUsed])
releaseObject (o); releaseObject (o);
jassert (numUsed == 0);
wassert (numUsed == 0);
} }
static void releaseObject (ObjectClass* o) static void releaseObject (ObjectClass* o)


+ 2
- 2
source/modules/water/containers/SortedSet.h View File

@@ -331,13 +331,13 @@ public:
int startIndex = 0, int startIndex = 0,
int numElementsToAdd = -1) noexcept int numElementsToAdd = -1) noexcept
{ {
jassert (this != &setToAddFrom);
wassert (this != &setToAddFrom);
if (this != &setToAddFrom) if (this != &setToAddFrom)
{ {
if (startIndex < 0) if (startIndex < 0)
{ {
jassertfalse;
wassertfalse;
startIndex = 0; startIndex = 0;
} }


+ 3
- 3
source/modules/water/files/DirectoryIterator.cpp View File

@@ -41,8 +41,8 @@ DirectoryIterator::DirectoryIterator (const File& directory, bool recursive,
hasBeenAdvanced (false) hasBeenAdvanced (false)
{ {
// you have to specify the type of files you're looking for! // you have to specify the type of files you're looking for!
jassert ((type & (File::findFiles | File::findDirectories)) != 0);
jassert (type > 0 && type <= 7);
wassert ((type & (File::findFiles | File::findDirectories)) != 0);
wassert (type > 0 && type <= 7);
} }
DirectoryIterator::~DirectoryIterator() DirectoryIterator::~DirectoryIterator()
@@ -143,7 +143,7 @@ const File& DirectoryIterator::getFile() const
return subIterator->getFile(); return subIterator->getFile();
// You need to call DirectoryIterator::next() before asking it for the file that it found! // You need to call DirectoryIterator::next() before asking it for the file that it found!
jassert (hasBeenAdvanced);
wassert (hasBeenAdvanced);
return currentFile; return currentFile;
} }


+ 9
- 7
source/modules/water/files/File.cpp View File

@@ -194,7 +194,7 @@ String File::parseAbsolutePath (const String& p)
// Yes, I know it's legal for a unix pathname to contain a backslash, but this assertion is here // 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. // 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. // 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 ('\\')));
wassert ((! p.containsChar ('\\')) || (p.indexOfChar ('/') >= 0 && p.indexOfChar ('/') < p.indexOfChar ('\\')));
String path (removeEllipsis (p)); String path (removeEllipsis (p));
@@ -722,7 +722,7 @@ FileOutputStream* File::createOutputStream (const size_t bufferSize) const
bool File::appendData (const void* const dataToAppend, bool File::appendData (const void* const dataToAppend,
const size_t numberOfBytes) const const size_t numberOfBytes) const
{ {
jassert (((ssize_t) numberOfBytes) >= 0);
wassert (((ssize_t) numberOfBytes) >= 0);
if (numberOfBytes == 0) if (numberOfBytes == 0)
return true; return true;
@@ -969,7 +969,9 @@ namespace WindowsFileHelpers
int64 fileTimeToTime (const FILETIME* const ft) int64 fileTimeToTime (const FILETIME* const ft)
{ {
static_jassert (sizeof (ULARGE_INTEGER) == sizeof (FILETIME)); // tell me if this fails!
#ifdef CARLA_PROPER_CPP11_SUPPORT
static_wassert (sizeof (ULARGE_INTEGER) == sizeof (FILETIME)); // tell me if this fails!
#endif
return (int64) ((reinterpret_cast<const ULARGE_INTEGER*> (ft)->QuadPart - 116444736000000000LL) / 10000); return (int64) ((reinterpret_cast<const ULARGE_INTEGER*> (ft)->QuadPart - 116444736000000000LL) / 10000);
} }
@@ -1116,7 +1118,7 @@ File File::getSpecialLocation (const SpecialLocationType type)
return WindowsFileHelpers::getModuleFileName (nullptr); return WindowsFileHelpers::getModuleFileName (nullptr);
default: default:
jassertfalse; // unknown type?
wassertfalse; // unknown type?
return File(); return File();
} }
@@ -1354,7 +1356,7 @@ File water_getExecutableFile()
} }
// if we reach this, we failed to find ourselves... // if we reach this, we failed to find ourselves...
jassertfalse;
wassertfalse;
return filename; return filename;
} }
}; };
@@ -1433,7 +1435,7 @@ File File::getSpecialLocation (const SpecialLocationType type)
} }
default: default:
jassertfalse; // unknown type?
wassertfalse; // unknown type?
break; break;
} }
@@ -1584,7 +1586,7 @@ File File::getSpecialLocation (const SpecialLocationType type)
} }
default: default:
jassertfalse; // unknown type?
wassertfalse; // unknown type?
break; break;
} }


+ 4
- 4
source/modules/water/files/FileInputStream.cpp View File

@@ -42,7 +42,7 @@ FileInputStream::FileInputStream (const File& f)
int64 FileInputStream::getTotalLength() int64 FileInputStream::getTotalLength()
{ {
// You should always check that a stream opened successfully before using it! // You should always check that a stream opened successfully before using it!
jassert (openedOk());
wassert (openedOk());
return file.getSize(); return file.getSize();
} }
@@ -50,11 +50,11 @@ int64 FileInputStream::getTotalLength()
int FileInputStream::read (void* buffer, int bytesToRead) int FileInputStream::read (void* buffer, int bytesToRead)
{ {
// You should always check that a stream opened successfully before using it! // You should always check that a stream opened successfully before using it!
jassert (openedOk());
wassert (openedOk());
// The buffer should never be null, and a negative size is probably a // The buffer should never be null, and a negative size is probably a
// sign that something is broken! // sign that something is broken!
jassert (buffer != nullptr && bytesToRead >= 0);
wassert (buffer != nullptr && bytesToRead >= 0);
const size_t num = readInternal (buffer, (size_t) bytesToRead); const size_t num = readInternal (buffer, (size_t) bytesToRead);
currentPosition += (int64) num; currentPosition += (int64) num;
@@ -75,7 +75,7 @@ int64 FileInputStream::getPosition()
bool FileInputStream::setPosition (int64 pos) bool FileInputStream::setPosition (int64 pos)
{ {
// You should always check that a stream opened successfully before using it! // You should always check that a stream opened successfully before using it!
jassert (openedOk());
wassert (openedOk());
if (pos != currentPosition) if (pos != currentPosition)
currentPosition = water_fileSetPosition (fileHandle, pos); currentPosition = water_fileSetPosition (fileHandle, pos);


+ 2
- 2
source/modules/water/files/FileOutputStream.cpp View File

@@ -87,7 +87,7 @@ void FileOutputStream::flush()
bool FileOutputStream::write (const void* const src, const size_t numBytes) bool FileOutputStream::write (const void* const src, const size_t numBytes)
{ {
jassert (src != nullptr && ((ssize_t) numBytes) >= 0);
wassert (src != nullptr && ((ssize_t) numBytes) >= 0);
if (bytesInBuffer + numBytes < bufferSize) if (bytesInBuffer + numBytes < bufferSize)
{ {
@@ -123,7 +123,7 @@ bool FileOutputStream::write (const void* const src, const size_t numBytes)
bool FileOutputStream::writeRepeatedByte (uint8 byte, size_t numBytes) bool FileOutputStream::writeRepeatedByte (uint8 byte, size_t numBytes)
{ {
jassert (((ssize_t) numBytes) >= 0);
wassert (((ssize_t) numBytes) >= 0);
if (bytesInBuffer + numBytes < bufferSize) if (bytesInBuffer + numBytes < bufferSize)
{ {


+ 4
- 4
source/modules/water/files/TemporaryFile.cpp View File

@@ -52,7 +52,7 @@ TemporaryFile::TemporaryFile (const File& target, const int optionFlags)
targetFile (target) targetFile (target)
{ {
// If you use this constructor, you need to give it a valid target file! // If you use this constructor, you need to give it a valid target file!
jassert (targetFile != File());
wassert (targetFile != File());
} }
TemporaryFile::TemporaryFile (const File& target, const File& temporary) TemporaryFile::TemporaryFile (const File& target, const File& temporary)
@@ -72,7 +72,7 @@ TemporaryFile::~TemporaryFile()
call TemporaryFile::deleteTemporaryFile() to detect those error cases and call TemporaryFile::deleteTemporaryFile() to detect those error cases and
handle them appropriately. handle them appropriately.
*/ */
jassertfalse;
wassertfalse;
} }
} }
@@ -81,7 +81,7 @@ bool TemporaryFile::overwriteTargetFileWithTemporary() const
{ {
// This method only works if you created this object with the constructor // This method only works if you created this object with the constructor
// that takes a target file! // that takes a target file!
jassert (targetFile != File());
wassert (targetFile != File());
if (temporaryFile.exists()) if (temporaryFile.exists())
{ {
@@ -98,7 +98,7 @@ bool TemporaryFile::overwriteTargetFileWithTemporary() const
{ {
// There's no temporary file to use. If your write failed, you should // There's no temporary file to use. If your write failed, you should
// probably check, and not bother calling this method. // probably check, and not bother calling this method.
jassertfalse;
wassertfalse;
} }
return false; return false;


+ 2
- 2
source/modules/water/maths/MathsFunctions.h View File

@@ -80,7 +80,7 @@ Type jmap (Type value0To1, Type targetRangeMin, Type targetRangeMax)
template <typename Type> template <typename Type>
Type jmap (Type sourceValue, Type sourceRangeMin, Type sourceRangeMax, Type targetRangeMin, Type targetRangeMax) Type jmap (Type sourceValue, Type sourceRangeMin, Type sourceRangeMax, Type targetRangeMin, Type targetRangeMax)
{ {
jassert (sourceRangeMax != sourceRangeMin); // mapping from a range of zero will produce NaN!
wassert (sourceRangeMax != sourceRangeMin); // mapping from a range of zero will produce NaN!
return targetRangeMin + ((targetRangeMax - targetRangeMin) * (sourceValue - sourceRangeMin)) / (sourceRangeMax - sourceRangeMin); return targetRangeMin + ((targetRangeMax - targetRangeMin) * (sourceValue - sourceRangeMin)) / (sourceRangeMax - sourceRangeMin);
} }
@@ -450,7 +450,7 @@ inline int countNumberOfBits (uint64 n) noexcept
template <typename IntegerType> template <typename IntegerType>
IntegerType negativeAwareModulo (IntegerType dividend, const IntegerType divisor) noexcept IntegerType negativeAwareModulo (IntegerType dividend, const IntegerType divisor) noexcept
{ {
jassert (divisor > 0);
wassert (divisor > 0);
dividend %= divisor; dividend %= divisor;
return (dividend < 0) ? (dividend + divisor) : dividend; return (dividend < 0) ? (dividend + divisor) : dividend;
} }


+ 1
- 1
source/modules/water/maths/Random.cpp View File

@@ -77,7 +77,7 @@ int Random::nextInt() noexcept
int Random::nextInt (const int maxValue) noexcept int Random::nextInt (const int maxValue) noexcept
{ {
jassert (maxValue > 0);
wassert (maxValue > 0);
return (int) ((((unsigned int) nextInt()) * (uint64) maxValue) >> 32); return (int) ((((unsigned int) nextInt()) * (uint64) maxValue) >> 32);
} }


+ 5
- 5
source/modules/water/memory/Atomic.h View File

@@ -74,7 +74,7 @@ public:
{ {
#ifdef CARLA_PROPER_CPP11_SUPPORT #ifdef CARLA_PROPER_CPP11_SUPPORT
// This class can only be used for types which are 32 or 64 bits in size. // This class can only be used for types which are 32 or 64 bits in size.
static_jassert (sizeof (Type) == 4 || sizeof (Type) == 8);
static_wassert (sizeof (Type) == 4 || sizeof (Type) == 8);
#endif #endif
} }
@@ -200,7 +200,7 @@ template<>
inline int32 Atomic<int32>::get() const noexcept inline int32 Atomic<int32>::get() const noexcept
{ {
#ifdef CARLA_PROPER_CPP11_SUPPORT #ifdef CARLA_PROPER_CPP11_SUPPORT
static_jassert (sizeof (int32) == 4);
static_wassert (sizeof (int32) == 4);
#endif #endif
return castFrom32Bit ((int32) __sync_add_and_fetch (const_cast<volatile int32*>(&value), 0)); return castFrom32Bit ((int32) __sync_add_and_fetch (const_cast<volatile int32*>(&value), 0));
} }
@@ -209,7 +209,7 @@ template<>
inline int64 Atomic<int64>::get() const noexcept inline int64 Atomic<int64>::get() const noexcept
{ {
#ifdef CARLA_PROPER_CPP11_SUPPORT #ifdef CARLA_PROPER_CPP11_SUPPORT
static_jassert (sizeof (int64) == 8);
static_wassert (sizeof (int64) == 8);
#endif #endif
return castFrom64Bit ((int64) __sync_add_and_fetch (const_cast<volatile int64*>(&value), 0)); return castFrom64Bit ((int64) __sync_add_and_fetch (const_cast<volatile int64*>(&value), 0));
} }
@@ -218,7 +218,7 @@ template<>
inline uint32 Atomic<uint32>::get() const noexcept inline uint32 Atomic<uint32>::get() const noexcept
{ {
#ifdef CARLA_PROPER_CPP11_SUPPORT #ifdef CARLA_PROPER_CPP11_SUPPORT
static_jassert (sizeof (uint32) == 4);
static_wassert (sizeof (uint32) == 4);
#endif #endif
return castFrom32Bit ((uint32) __sync_add_and_fetch (const_cast<volatile uint32*>(&value), 0)); return castFrom32Bit ((uint32) __sync_add_and_fetch (const_cast<volatile uint32*>(&value), 0));
} }
@@ -227,7 +227,7 @@ template<>
inline uint64 Atomic<uint64>::get() const noexcept inline uint64 Atomic<uint64>::get() const noexcept
{ {
#ifdef CARLA_PROPER_CPP11_SUPPORT #ifdef CARLA_PROPER_CPP11_SUPPORT
static_jassert (sizeof (uint64) == 8);
static_wassert (sizeof (uint64) == 8);
#endif #endif
return castFrom64Bit ((uint64) __sync_add_and_fetch (const_cast<volatile uint64*>(&value), 0)); return castFrom64Bit ((uint64) __sync_add_and_fetch (const_cast<volatile uint64*>(&value), 0));
} }


+ 6
- 6
source/modules/water/memory/MemoryBlock.cpp View File

@@ -50,7 +50,7 @@ MemoryBlock::MemoryBlock (const MemoryBlock& other)
{ {
if (size > 0) if (size > 0)
{ {
jassert (other.data != nullptr);
wassert (other.data != nullptr);
data.malloc (size); data.malloc (size);
memcpy (data, other.data, size); memcpy (data, other.data, size);
} }
@@ -59,11 +59,11 @@ MemoryBlock::MemoryBlock (const MemoryBlock& other)
MemoryBlock::MemoryBlock (const void* const dataToInitialiseFrom, const size_t sizeInBytes) MemoryBlock::MemoryBlock (const void* const dataToInitialiseFrom, const size_t sizeInBytes)
: size (sizeInBytes) : size (sizeInBytes)
{ {
jassert (((ssize_t) sizeInBytes) >= 0);
wassert (((ssize_t) sizeInBytes) >= 0);
if (size > 0) if (size > 0)
{ {
jassert (dataToInitialiseFrom != nullptr); // non-zero size, but a zero pointer passed-in?
wassert (dataToInitialiseFrom != nullptr); // non-zero size, but a zero pointer passed-in?
data.malloc (size); data.malloc (size);
@@ -177,7 +177,7 @@ void MemoryBlock::append (const void* const srcData, const size_t numBytes)
{ {
if (numBytes > 0) if (numBytes > 0)
{ {
jassert (srcData != nullptr); // this must not be null!
wassert (srcData != nullptr); // this must not be null!
const size_t oldSize = size; const size_t oldSize = size;
setSize (size + numBytes); setSize (size + numBytes);
memcpy (data + oldSize, srcData, numBytes); memcpy (data + oldSize, srcData, numBytes);
@@ -188,7 +188,7 @@ void MemoryBlock::replaceWith (const void* const srcData, const size_t numBytes)
{ {
if (numBytes > 0) if (numBytes > 0)
{ {
jassert (srcData != nullptr); // this must not be null!
wassert (srcData != nullptr); // this must not be null!
setSize (numBytes); setSize (numBytes);
memcpy (data, srcData, numBytes); memcpy (data, srcData, numBytes);
} }
@@ -198,7 +198,7 @@ void MemoryBlock::insert (const void* const srcData, const size_t numBytes, size
{ {
if (numBytes > 0) if (numBytes > 0)
{ {
jassert (srcData != nullptr); // this must not be null!
wassert (srcData != nullptr); // this must not be null!
insertPosition = jmin (size, insertPosition); insertPosition = jmin (size, insertPosition);
const size_t trailingDataSize = size - insertPosition; const size_t trailingDataSize = size - insertPosition;
setSize (size + numBytes, false); setSize (size + numBytes, false);


+ 7
- 7
source/modules/water/memory/ReferenceCountedObject.h View File

@@ -81,7 +81,7 @@ public:
*/ */
void decReferenceCount() noexcept void decReferenceCount() noexcept
{ {
jassert (getReferenceCount() > 0);
wassert (getReferenceCount() > 0);
if (--refCount == 0) if (--refCount == 0)
delete this; delete this;
@@ -93,7 +93,7 @@ public:
*/ */
bool decReferenceCountWithoutDeleting() noexcept bool decReferenceCountWithoutDeleting() noexcept
{ {
jassert (getReferenceCount() > 0);
wassert (getReferenceCount() > 0);
return --refCount == 0; return --refCount == 0;
} }
@@ -111,7 +111,7 @@ protected:
virtual ~ReferenceCountedObject() virtual ~ReferenceCountedObject()
{ {
// it's dangerous to delete an object that's still referenced by something else! // it's dangerous to delete an object that's still referenced by something else!
jassert (getReferenceCount() == 0);
wassert (getReferenceCount() == 0);
} }
/** Resets the reference count to zero without deleting the object. /** Resets the reference count to zero without deleting the object.
@@ -160,7 +160,7 @@ public:
*/ */
void decReferenceCount() noexcept void decReferenceCount() noexcept
{ {
jassert (getReferenceCount() > 0);
wassert (getReferenceCount() > 0);
if (--refCount == 0) if (--refCount == 0)
delete this; delete this;
@@ -172,7 +172,7 @@ public:
*/ */
bool decReferenceCountWithoutDeleting() noexcept bool decReferenceCountWithoutDeleting() noexcept
{ {
jassert (getReferenceCount() > 0);
wassert (getReferenceCount() > 0);
return --refCount == 0; return --refCount == 0;
} }
@@ -189,7 +189,7 @@ protected:
virtual ~SingleThreadedReferenceCountedObject() virtual ~SingleThreadedReferenceCountedObject()
{ {
// it's dangerous to delete an object that's still referenced by something else! // it's dangerous to delete an object that's still referenced by something else!
jassert (getReferenceCount() == 0);
wassert (getReferenceCount() == 0);
} }
private: private:
@@ -347,7 +347,7 @@ public:
// the -> operator is called on the referenced object // the -> operator is called on the referenced object
ReferencedType* operator->() const noexcept ReferencedType* operator->() const noexcept
{ {
jassert (referencedObject != nullptr); // null pointer method call!
wassert (referencedObject != nullptr); // null pointer method call!
return referencedObject; return referencedObject;
} }


+ 1
- 1
source/modules/water/midi/MidiFile.cpp View File

@@ -375,7 +375,7 @@ void MidiFile::convertTimestampTicksToSeconds()
//============================================================================== //==============================================================================
bool MidiFile::writeTo (OutputStream& out, int midiFileType) bool MidiFile::writeTo (OutputStream& out, int midiFileType)
{ {
jassert (midiFileType >= 0 && midiFileType <= 2);
wassert (midiFileType >= 0 && midiFileType <= 2);
if (! out.writeIntBigEndian ((int) ByteOrder::bigEndianInt ("MThd"))) return false; if (! out.writeIntBigEndian ((int) ByteOrder::bigEndianInt ("MThd"))) return false;
if (! out.writeIntBigEndian (6)) return false; if (! out.writeIntBigEndian (6)) return false;


+ 36
- 36
source/modules/water/midi/MidiMessage.cpp View File

@@ -52,7 +52,7 @@ uint16 MidiMessage::pitchbendToPitchwheelPos (const float pitchbend,
const float pitchbendRange) noexcept const float pitchbendRange) noexcept
{ {
// can't translate a pitchbend value that is outside of the given range! // can't translate a pitchbend value that is outside of the given range!
jassert (std::abs (pitchbend) <= pitchbendRange);
wassert (std::abs (pitchbend) <= pitchbendRange);
return static_cast<uint16> (pitchbend > 0.0f return static_cast<uint16> (pitchbend > 0.0f
? jmap (pitchbend, 0.0f, pitchbendRange, 8192.0f, 16383.0f) ? jmap (pitchbend, 0.0f, pitchbendRange, 8192.0f, 16383.0f)
@@ -82,7 +82,7 @@ int MidiMessage::readVariableLengthVal (const uint8* data, int& numBytesUsed) no
int MidiMessage::getMessageLengthFromFirstByte (const uint8 firstByte) noexcept int MidiMessage::getMessageLengthFromFirstByte (const uint8 firstByte) noexcept
{ {
// this method only works for valid starting bytes of a short midi message // this method only works for valid starting bytes of a short midi message
jassert (firstByte >= 0x80 && firstByte != 0xf0 && firstByte != 0xf7);
wassert (firstByte >= 0x80 && firstByte != 0xf0 && firstByte != 0xf7);
static const char messageLengths[] = static const char messageLengths[] =
{ {
@@ -110,9 +110,9 @@ MidiMessage::MidiMessage() noexcept
MidiMessage::MidiMessage (const void* const d, const int dataSize, const double t) MidiMessage::MidiMessage (const void* const d, const int dataSize, const double t)
: timeStamp (t), size (dataSize) : timeStamp (t), size (dataSize)
{ {
jassert (dataSize > 0);
wassert (dataSize > 0);
// this checks that the length matches the data.. // this checks that the length matches the data..
jassert (dataSize > 3 || *(uint8*)d >= 0xf0 || getMessageLengthFromFirstByte (*(uint8*)d) == size);
wassert (dataSize > 3 || *(uint8*)d >= 0xf0 || getMessageLengthFromFirstByte (*(uint8*)d) == size);
memcpy (allocateSpace (dataSize), d, (size_t) dataSize); memcpy (allocateSpace (dataSize), d, (size_t) dataSize);
} }
@@ -123,7 +123,7 @@ MidiMessage::MidiMessage (const int byte1, const double t) noexcept
packedData.asBytes[0] = (uint8) byte1; packedData.asBytes[0] = (uint8) byte1;
// check that the length matches the data.. // check that the length matches the data..
jassert (byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == 1);
wassert (byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == 1);
} }
MidiMessage::MidiMessage (const int byte1, const int byte2, const double t) noexcept MidiMessage::MidiMessage (const int byte1, const int byte2, const double t) noexcept
@@ -133,7 +133,7 @@ MidiMessage::MidiMessage (const int byte1, const int byte2, const double t) noex
packedData.asBytes[1] = (uint8) byte2; packedData.asBytes[1] = (uint8) byte2;
// check that the length matches the data.. // check that the length matches the data..
jassert (byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == 2);
wassert (byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == 2);
} }
MidiMessage::MidiMessage (const int byte1, const int byte2, const int byte3, const double t) noexcept MidiMessage::MidiMessage (const int byte1, const int byte2, const int byte3, const double t) noexcept
@@ -144,7 +144,7 @@ MidiMessage::MidiMessage (const int byte1, const int byte2, const int byte3, con
packedData.asBytes[2] = (uint8) byte3; packedData.asBytes[2] = (uint8) byte3;
// check that the length matches the data.. // check that the length matches the data..
jassert (byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == 3);
wassert (byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == 3);
} }
MidiMessage::MidiMessage (const MidiMessage& other) MidiMessage::MidiMessage (const MidiMessage& other)
@@ -334,7 +334,7 @@ int MidiMessage::getChannel() const noexcept
bool MidiMessage::isForChannel (const int channel) const noexcept bool MidiMessage::isForChannel (const int channel) const noexcept
{ {
jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
wassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
const uint8* const data = getData(); const uint8* const data = getData();
@@ -344,7 +344,7 @@ bool MidiMessage::isForChannel (const int channel) const noexcept
void MidiMessage::setChannel (const int channel) noexcept void MidiMessage::setChannel (const int channel) noexcept
{ {
jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
wassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
uint8* const data = getData(); uint8* const data = getData();
@@ -423,7 +423,7 @@ bool MidiMessage::isAftertouch() const noexcept
int MidiMessage::getAfterTouchValue() const noexcept int MidiMessage::getAfterTouchValue() const noexcept
{ {
jassert (isAftertouch());
wassert (isAftertouch());
return getData()[2]; return getData()[2];
} }
@@ -431,9 +431,9 @@ MidiMessage MidiMessage::aftertouchChange (const int channel,
const int noteNum, const int noteNum,
const int aftertouchValue) noexcept const int aftertouchValue) noexcept
{ {
jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
jassert (isPositiveAndBelow (noteNum, (int) 128));
jassert (isPositiveAndBelow (aftertouchValue, (int) 128));
wassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
wassert (isPositiveAndBelow (noteNum, (int) 128));
wassert (isPositiveAndBelow (aftertouchValue, (int) 128));
return MidiMessage (MidiHelpers::initialByte (0xa0, channel), return MidiMessage (MidiHelpers::initialByte (0xa0, channel),
noteNum & 0x7f, noteNum & 0x7f,
@@ -447,14 +447,14 @@ bool MidiMessage::isChannelPressure() const noexcept
int MidiMessage::getChannelPressureValue() const noexcept int MidiMessage::getChannelPressureValue() const noexcept
{ {
jassert (isChannelPressure());
wassert (isChannelPressure());
return getData()[1]; return getData()[1];
} }
MidiMessage MidiMessage::channelPressureChange (const int channel, const int pressure) noexcept MidiMessage MidiMessage::channelPressureChange (const int channel, const int pressure) noexcept
{ {
jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
jassert (isPositiveAndBelow (pressure, (int) 128));
wassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
wassert (isPositiveAndBelow (pressure, (int) 128));
return MidiMessage (MidiHelpers::initialByte (0xd0, channel), pressure & 0x7f); return MidiMessage (MidiHelpers::initialByte (0xd0, channel), pressure & 0x7f);
} }
@@ -476,13 +476,13 @@ bool MidiMessage::isProgramChange() const noexcept
int MidiMessage::getProgramChangeNumber() const noexcept int MidiMessage::getProgramChangeNumber() const noexcept
{ {
jassert (isProgramChange());
wassert (isProgramChange());
return getData()[1]; return getData()[1];
} }
MidiMessage MidiMessage::programChange (const int channel, const int programNumber) noexcept MidiMessage MidiMessage::programChange (const int channel, const int programNumber) noexcept
{ {
jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
wassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
return MidiMessage (MidiHelpers::initialByte (0xc0, channel), programNumber & 0x7f); return MidiMessage (MidiHelpers::initialByte (0xc0, channel), programNumber & 0x7f);
} }
@@ -494,15 +494,15 @@ bool MidiMessage::isPitchWheel() const noexcept
int MidiMessage::getPitchWheelValue() const noexcept int MidiMessage::getPitchWheelValue() const noexcept
{ {
jassert (isPitchWheel());
wassert (isPitchWheel());
const uint8* const data = getData(); const uint8* const data = getData();
return data[1] | (data[2] << 7); return data[1] | (data[2] << 7);
} }
MidiMessage MidiMessage::pitchWheel (const int channel, const int position) noexcept MidiMessage MidiMessage::pitchWheel (const int channel, const int position) noexcept
{ {
jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
jassert (isPositiveAndBelow (position, (int) 0x4000));
wassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16
wassert (isPositiveAndBelow (position, (int) 0x4000));
return MidiMessage (MidiHelpers::initialByte (0xe0, channel), return MidiMessage (MidiHelpers::initialByte (0xe0, channel),
position & 127, (position >> 7) & 127); position & 127, (position >> 7) & 127);
@@ -521,20 +521,20 @@ bool MidiMessage::isControllerOfType (const int controllerType) const noexcept
int MidiMessage::getControllerNumber() const noexcept int MidiMessage::getControllerNumber() const noexcept
{ {
jassert (isController());
wassert (isController());
return getData()[1]; return getData()[1];
} }
int MidiMessage::getControllerValue() const noexcept int MidiMessage::getControllerValue() const noexcept
{ {
jassert (isController());
wassert (isController());
return getData()[2]; return getData()[2];
} }
MidiMessage MidiMessage::controllerEvent (const int channel, const int controllerType, const int value) noexcept MidiMessage MidiMessage::controllerEvent (const int channel, const int controllerType, const int value) noexcept
{ {
// the channel must be between 1 and 16 inclusive // the channel must be between 1 and 16 inclusive
jassert (channel > 0 && channel <= 16);
wassert (channel > 0 && channel <= 16);
return MidiMessage (MidiHelpers::initialByte (0xb0, channel), return MidiMessage (MidiHelpers::initialByte (0xb0, channel),
controllerType & 127, value & 127); controllerType & 127, value & 127);
@@ -542,8 +542,8 @@ MidiMessage MidiMessage::controllerEvent (const int channel, const int controlle
MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, const uint8 velocity) noexcept MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, const uint8 velocity) noexcept
{ {
jassert (channel > 0 && channel <= 16);
jassert (isPositiveAndBelow (noteNumber, (int) 128));
wassert (channel > 0 && channel <= 16);
wassert (isPositiveAndBelow (noteNumber, (int) 128));
return MidiMessage (MidiHelpers::initialByte (0x90, channel), return MidiMessage (MidiHelpers::initialByte (0x90, channel),
noteNumber & 127, MidiHelpers::validVelocity (velocity)); noteNumber & 127, MidiHelpers::validVelocity (velocity));
@@ -556,8 +556,8 @@ MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, const
MidiMessage MidiMessage::noteOff (const int channel, const int noteNumber, uint8 velocity) noexcept MidiMessage MidiMessage::noteOff (const int channel, const int noteNumber, uint8 velocity) noexcept
{ {
jassert (channel > 0 && channel <= 16);
jassert (isPositiveAndBelow (noteNumber, (int) 128));
wassert (channel > 0 && channel <= 16);
wassert (isPositiveAndBelow (noteNumber, (int) 128));
return MidiMessage (MidiHelpers::initialByte (0x80, channel), return MidiMessage (MidiHelpers::initialByte (0x80, channel),
noteNumber & 127, MidiHelpers::validVelocity (velocity)); noteNumber & 127, MidiHelpers::validVelocity (velocity));
@@ -570,8 +570,8 @@ MidiMessage MidiMessage::noteOff (const int channel, const int noteNumber, float
MidiMessage MidiMessage::noteOff (const int channel, const int noteNumber) noexcept MidiMessage MidiMessage::noteOff (const int channel, const int noteNumber) noexcept
{ {
jassert (channel > 0 && channel <= 16);
jassert (isPositiveAndBelow (noteNumber, (int) 128));
wassert (channel > 0 && channel <= 16);
wassert (isPositiveAndBelow (noteNumber, (int) 128));
return MidiMessage (MidiHelpers::initialByte (0x80, channel), noteNumber & 127, 0); return MidiMessage (MidiHelpers::initialByte (0x80, channel), noteNumber & 127, 0);
} }
@@ -667,7 +667,7 @@ int MidiMessage::getMetaEventLength() const noexcept
const uint8* MidiMessage::getMetaEventData() const noexcept const uint8* MidiMessage::getMetaEventData() const noexcept
{ {
jassert (isMetaEvent());
wassert (isMetaEvent());
int n; int n;
const uint8* d = getData() + 2; const uint8* d = getData() + 2;
@@ -693,7 +693,7 @@ String MidiMessage::getTextFromTextMetaEvent() const
MidiMessage MidiMessage::textMetaEvent (int type, StringRef text) MidiMessage MidiMessage::textMetaEvent (int type, StringRef text)
{ {
jassert (type > 0 && type < 16);
wassert (type > 0 && type < 16);
MidiMessage result; MidiMessage result;
@@ -728,7 +728,7 @@ bool MidiMessage::isMidiChannelMetaEvent() const noexcept { const uint8* data
int MidiMessage::getMidiChannelMetaEventChannel() const noexcept int MidiMessage::getMidiChannelMetaEventChannel() const noexcept
{ {
jassert (isMidiChannelMetaEvent());
wassert (isMidiChannelMetaEvent());
return getData()[3] + 1; return getData()[3] + 1;
} }
@@ -841,7 +841,7 @@ bool MidiMessage::isKeySignatureMajorKey() const noexcept
MidiMessage MidiMessage::keySignatureMetaEvent (int numberOfSharpsOrFlats, bool isMinorKey) MidiMessage MidiMessage::keySignatureMetaEvent (int numberOfSharpsOrFlats, bool isMinorKey)
{ {
jassert (numberOfSharpsOrFlats >= -7 && numberOfSharpsOrFlats <= 7);
wassert (numberOfSharpsOrFlats >= -7 && numberOfSharpsOrFlats <= 7);
const uint8 d[] = { 0xff, 0x59, 0x02, (uint8) numberOfSharpsOrFlats, isMinorKey ? (uint8) 1 : (uint8) 0 }; const uint8 d[] = { 0xff, 0x59, 0x02, (uint8) numberOfSharpsOrFlats, isMinorKey ? (uint8) 1 : (uint8) 0 };
return MidiMessage (d, 5, 0.0); return MidiMessage (d, 5, 0.0);
@@ -898,7 +898,7 @@ bool MidiMessage::isFullFrame() const noexcept
void MidiMessage::getFullFrameParameters (int& hours, int& minutes, int& seconds, int& frames, void MidiMessage::getFullFrameParameters (int& hours, int& minutes, int& seconds, int& frames,
MidiMessage::SmpteTimecodeType& timecodeType) const noexcept MidiMessage::SmpteTimecodeType& timecodeType) const noexcept
{ {
jassert (isFullFrame());
wassert (isFullFrame());
const uint8* const data = getData(); const uint8* const data = getData();
timecodeType = (SmpteTimecodeType) (data[5] >> 5); timecodeType = (SmpteTimecodeType) (data[5] >> 5);
@@ -933,7 +933,7 @@ bool MidiMessage::isMidiMachineControlMessage() const noexcept
MidiMessage::MidiMachineControlCommand MidiMessage::getMidiMachineControlCommand() const noexcept MidiMessage::MidiMachineControlCommand MidiMessage::getMidiMachineControlCommand() const noexcept
{ {
jassert (isMidiMachineControlMessage());
wassert (isMidiMachineControlMessage());
return (MidiMachineControlCommand) getData()[4]; return (MidiMachineControlCommand) getData()[4];
} }


+ 1
- 1
source/modules/water/midi/MidiMessageSequence.cpp View File

@@ -317,7 +317,7 @@ void MidiMessageSequence::createControllerUpdatesForTime (const int channelNumbe
else if (mm.isController()) else if (mm.isController())
{ {
const int controllerNumber = mm.getControllerNumber(); const int controllerNumber = mm.getControllerNumber();
jassert (isPositiveAndBelow (controllerNumber, 128));
wassert (isPositiveAndBelow (controllerNumber, 128));
if (! doneControllers[controllerNumber]) if (! doneControllers[controllerNumber])
{ {


+ 11
- 11
source/modules/water/processors/AudioProcessorGraph.cpp View File

@@ -360,7 +360,7 @@ private:
if (inputChan >= numOuts) if (inputChan >= numOuts)
{ {
bufIndex = getReadOnlyEmptyBuffer(); bufIndex = getReadOnlyEmptyBuffer();
jassert (bufIndex >= 0);
wassert (bufIndex >= 0);
} }
else else
{ {
@@ -380,7 +380,7 @@ private:
{ {
// if not found, this is probably a feedback loop // if not found, this is probably a feedback loop
bufIndex = getReadOnlyEmptyBuffer(); bufIndex = getReadOnlyEmptyBuffer();
jassert (bufIndex >= 0);
wassert (bufIndex >= 0);
} }
if (inputChan < numOuts if (inputChan < numOuts
@@ -436,7 +436,7 @@ private:
{ {
// can't re-use any of our input chans, so get a new one and copy everything into it.. // can't re-use any of our input chans, so get a new one and copy everything into it..
bufIndex = getFreeBuffer (false); bufIndex = getFreeBuffer (false);
jassert (bufIndex != 0);
wassert (bufIndex != 0);
const int srcIndex = getBufferContaining (sourceNodes.getUnchecked (0), const int srcIndex = getBufferContaining (sourceNodes.getUnchecked (0),
sourceOutputChans.getUnchecked (0)); sourceOutputChans.getUnchecked (0));
@@ -490,7 +490,7 @@ private:
} }
} }
jassert (bufIndex >= 0);
wassert (bufIndex >= 0);
audioChannelsToUse.add (bufIndex); audioChannelsToUse.add (bufIndex);
if (inputChan < numOuts) if (inputChan < numOuts)
@@ -500,7 +500,7 @@ private:
for (int outputChan = numIns; outputChan < numOuts; ++outputChan) for (int outputChan = numIns; outputChan < numOuts; ++outputChan)
{ {
const int bufIndex = getFreeBuffer (false); const int bufIndex = getFreeBuffer (false);
jassert (bufIndex != 0);
wassert (bufIndex != 0);
audioChannelsToUse.add (bufIndex); audioChannelsToUse.add (bufIndex);
markBufferAsContaining (bufIndex, node.nodeId, outputChan); markBufferAsContaining (bufIndex, node.nodeId, outputChan);
@@ -578,7 +578,7 @@ private:
{ {
// can't re-use any of our input buffers, so get a new one and copy everything into it.. // can't re-use any of our input buffers, so get a new one and copy everything into it..
midiBufferToUse = getFreeBuffer (true); midiBufferToUse = getFreeBuffer (true);
jassert (midiBufferToUse >= 0);
wassert (midiBufferToUse >= 0);
const int srcIndex = getBufferContaining (midiSourceNodes.getUnchecked(0), const int srcIndex = getBufferContaining (midiSourceNodes.getUnchecked(0),
AudioProcessorGraph::midiChannelIndex); AudioProcessorGraph::midiChannelIndex);
@@ -724,13 +724,13 @@ private:
{ {
if (outputIndex == AudioProcessorGraph::midiChannelIndex) if (outputIndex == AudioProcessorGraph::midiChannelIndex)
{ {
jassert (bufferNum > 0 && bufferNum < midiNodeIds.size());
wassert (bufferNum > 0 && bufferNum < midiNodeIds.size());
midiNodeIds.set (bufferNum, nodeId); midiNodeIds.set (bufferNum, nodeId);
} }
else else
{ {
jassert (bufferNum >= 0 && bufferNum < nodeIds.size());
wassert (bufferNum >= 0 && bufferNum < nodeIds.size());
nodeIds.set (bufferNum, nodeId); nodeIds.set (bufferNum, nodeId);
channels.set (bufferNum, outputIndex); channels.set (bufferNum, outputIndex);
@@ -884,7 +884,7 @@ AudioProcessorGraph::Connection::Connection (const uint32 sourceID, const int so
AudioProcessorGraph::Node::Node (const uint32 nodeID, AudioProcessor* const p) noexcept AudioProcessorGraph::Node::Node (const uint32 nodeID, AudioProcessor* const p) noexcept
: nodeId (nodeID), processor (p), isPrepared (false) : nodeId (nodeID), processor (p), isPrepared (false)
{ {
jassert (processor != nullptr);
wassert (processor != nullptr);
} }
void AudioProcessorGraph::Node::prepare (const double newSampleRate, const int newBlockSize, void AudioProcessorGraph::Node::prepare (const double newSampleRate, const int newBlockSize,
@@ -997,7 +997,7 @@ AudioProcessorGraph::Node* AudioProcessorGraph::addNode (AudioProcessor* const n
else else
{ {
// you can't add a node with an id that already exists in the graph.. // you can't add a node with an id that already exists in the graph..
jassert (getNodeForId (nodeId) == nullptr);
wassert (getNodeForId (nodeId) == nullptr);
removeNode (nodeId); removeNode (nodeId);
if (nodeId > lastNodeId) if (nodeId > lastNodeId)
@@ -1166,7 +1166,7 @@ bool AudioProcessorGraph::disconnectNode (const uint32 nodeId)
bool AudioProcessorGraph::isConnectionLegal (const Connection* const c) const bool AudioProcessorGraph::isConnectionLegal (const Connection* const c) const
{ {
jassert (c != nullptr);
wassert (c != nullptr);
const Node* const source = getNodeForId (c->sourceNodeId); const Node* const source = getNodeForId (c->sourceNodeId);
const Node* const dest = getNodeForId (c->destNodeId); const Node* const dest = getNodeForId (c->destNodeId);


+ 2
- 2
source/modules/water/streams/InputStream.cpp View File

@@ -100,7 +100,7 @@ int InputStream::readCompressedInt()
const int numBytes = (sizeByte & 0x7f); const int numBytes = (sizeByte & 0x7f);
if (numBytes > 4) if (numBytes > 4)
{ {
jassertfalse; // trying to read corrupt data - this method must only be used
wassertfalse; // trying to read corrupt data - this method must only be used
// to read data that was written by OutputStream::writeCompressedInt() // to read data that was written by OutputStream::writeCompressedInt()
return 0; return 0;
} }
@@ -137,7 +137,7 @@ float InputStream::readFloat()
{ {
// the union below relies on these types being the same size... // the union below relies on these types being the same size...
#ifdef CARLA_PROPER_CPP11_SUPPORT #ifdef CARLA_PROPER_CPP11_SUPPORT
static_jassert (sizeof (int32) == sizeof (float));
static_wassert (sizeof (int32) == sizeof (float));
#endif #endif
union { int32 asInt; float asFloat; } n; union { int32 asInt; float asFloat; } n;
n.asInt = (int32) readInt(); n.asInt = (int32) readInt();


+ 3
- 3
source/modules/water/streams/MemoryOutputStream.cpp View File

@@ -48,7 +48,7 @@ MemoryOutputStream::MemoryOutputStream (void* destBuffer, size_t destBufferSize)
: blockToUse (nullptr), externalData (destBuffer), : blockToUse (nullptr), externalData (destBuffer),
position (0), size (0), availableSize (destBufferSize) position (0), size (0), availableSize (destBufferSize)
{ {
jassert (externalData != nullptr); // This must be a valid pointer.
wassert (externalData != nullptr); // This must be a valid pointer.
} }
MemoryOutputStream::~MemoryOutputStream() MemoryOutputStream::~MemoryOutputStream()
@@ -81,7 +81,7 @@ void MemoryOutputStream::reset() noexcept
char* MemoryOutputStream::prepareToWrite (size_t numBytes) char* MemoryOutputStream::prepareToWrite (size_t numBytes)
{ {
jassert ((ssize_t) numBytes >= 0);
wassert ((ssize_t) numBytes >= 0);
size_t storageNeeded = position + numBytes; size_t storageNeeded = position + numBytes;
char* data; char* data;
@@ -109,7 +109,7 @@ char* MemoryOutputStream::prepareToWrite (size_t numBytes)
bool MemoryOutputStream::write (const void* const buffer, size_t howMany) bool MemoryOutputStream::write (const void* const buffer, size_t howMany)
{ {
jassert (buffer != nullptr);
wassert (buffer != nullptr);
if (howMany == 0) if (howMany == 0)
return true; return true;


+ 10
- 10
source/modules/water/synthesisers/Synthesiser.cpp View File

@@ -144,7 +144,7 @@ void Synthesiser::setNoteStealingEnabled (const bool shouldSteal)
void Synthesiser::setMinimumRenderingSubdivisionSize (int numSamples, bool shouldBeStrict) noexcept void Synthesiser::setMinimumRenderingSubdivisionSize (int numSamples, bool shouldBeStrict) noexcept
{ {
jassert (numSamples > 0); // it wouldn't make much sense for this to be less than 1
wassert (numSamples > 0); // it wouldn't make much sense for this to be less than 1
minimumSubBlockSize = numSamples; minimumSubBlockSize = numSamples;
subBlockSubdivisionIsStrict = shouldBeStrict; subBlockSubdivisionIsStrict = shouldBeStrict;
} }
@@ -169,7 +169,7 @@ void Synthesiser::processNextBlock (AudioSampleBuffer& outputAudio,
int numSamples) int numSamples)
{ {
// must set the sample rate before using this! // must set the sample rate before using this!
jassert (sampleRate != 0);
wassert (sampleRate != 0);
const int targetChannels = outputAudio.getNumChannels(); const int targetChannels = outputAudio.getNumChannels();
MidiBuffer::Iterator midiIterator (midiData); MidiBuffer::Iterator midiIterator (midiData);
@@ -325,12 +325,12 @@ void Synthesiser::startVoice (SynthesiserVoice* const voice,
void Synthesiser::stopVoice (SynthesiserVoice* voice, float velocity, const bool allowTailOff) void Synthesiser::stopVoice (SynthesiserVoice* voice, float velocity, const bool allowTailOff)
{ {
jassert (voice != nullptr);
wassert (voice != nullptr);
voice->stopNote (velocity, allowTailOff); voice->stopNote (velocity, allowTailOff);
// the subclass MUST call clearCurrentNote() if it's not tailing off! RTFM for stopNote()! // the subclass MUST call clearCurrentNote() if it's not tailing off! RTFM for stopNote()!
jassert (allowTailOff || (voice->getCurrentlyPlayingNote() < 0 && voice->getCurrentlyPlayingSound() == 0));
wassert (allowTailOff || (voice->getCurrentlyPlayingNote() < 0 && voice->getCurrentlyPlayingSound() == 0));
} }
void Synthesiser::noteOff (const int midiChannel, void Synthesiser::noteOff (const int midiChannel,
@@ -472,7 +472,7 @@ void Synthesiser::handleSustainPedal (int midiChannel, bool isDown)
void Synthesiser::handleSostenutoPedal (int midiChannel, bool isDown) void Synthesiser::handleSostenutoPedal (int midiChannel, bool isDown)
{ {
jassert (midiChannel > 0 && midiChannel <= 16);
wassert (midiChannel > 0 && midiChannel <= 16);
for (int i = voices.size(); --i >= 0;) for (int i = voices.size(); --i >= 0;)
{ {
@@ -491,13 +491,13 @@ void Synthesiser::handleSostenutoPedal (int midiChannel, bool isDown)
void Synthesiser::handleSoftPedal (int midiChannel, bool /*isDown*/) void Synthesiser::handleSoftPedal (int midiChannel, bool /*isDown*/)
{ {
ignoreUnused (midiChannel); ignoreUnused (midiChannel);
jassert (midiChannel > 0 && midiChannel <= 16);
wassert (midiChannel > 0 && midiChannel <= 16);
} }
void Synthesiser::handleProgramChange (int midiChannel, int programNumber) void Synthesiser::handleProgramChange (int midiChannel, int programNumber)
{ {
ignoreUnused (midiChannel, programNumber); ignoreUnused (midiChannel, programNumber);
jassert (midiChannel > 0 && midiChannel <= 16);
wassert (midiChannel > 0 && midiChannel <= 16);
} }
//============================================================================== //==============================================================================
@@ -536,7 +536,7 @@ SynthesiserVoice* Synthesiser::findVoiceToSteal (SynthesiserSound* soundToPlay,
// - Protect the lowest & topmost notes, even if sustained, but not if they've been released. // - Protect the lowest & topmost notes, even if sustained, but not if they've been released.
// apparently you are trying to render audio without having any voices... // apparently you are trying to render audio without having any voices...
jassert (voices.size() > 0);
wassert (voices.size() > 0);
// These are the voices we want to protect (ie: only steal if unavoidable) // These are the voices we want to protect (ie: only steal if unavoidable)
SynthesiserVoice* low = nullptr; // Lowest sounding note, might be sustained, but NOT in release phase SynthesiserVoice* low = nullptr; // Lowest sounding note, might be sustained, but NOT in release phase
@@ -552,7 +552,7 @@ SynthesiserVoice* Synthesiser::findVoiceToSteal (SynthesiserSound* soundToPlay,
if (voice->canPlaySound (soundToPlay)) if (voice->canPlaySound (soundToPlay))
{ {
jassert (voice->isVoiceActive()); // We wouldn't be here otherwise
wassert (voice->isVoiceActive()); // We wouldn't be here otherwise
VoiceAgeSorter sorter; VoiceAgeSorter sorter;
usableVoices.addSorted (sorter, voice); usableVoices.addSorted (sorter, voice);
@@ -613,7 +613,7 @@ SynthesiserVoice* Synthesiser::findVoiceToSteal (SynthesiserSound* soundToPlay,
} }
// We've only got "protected" voices now: lowest note takes priority // We've only got "protected" voices now: lowest note takes priority
jassert (low != nullptr);
wassert (low != nullptr);
// Duophonic synth: give priority to the bass note: // Duophonic synth: give priority to the bass note:
if (top != nullptr) if (top != nullptr)


+ 3
- 3
source/modules/water/text/CharPointer_UTF8.h View File

@@ -122,7 +122,7 @@ public:
/** Moves this pointer along to the next character in the string. */ /** Moves this pointer along to the next character in the string. */
CharPointer_UTF8& operator++() noexcept CharPointer_UTF8& operator++() noexcept
{ {
jassert (*data != 0); // trying to advance past the end of the string?
wassert (*data != 0); // trying to advance past the end of the string?
const signed char n = (signed char) *data++; const signed char n = (signed char) *data++;
if (n < 0) if (n < 0)
@@ -282,7 +282,7 @@ public:
*/ */
size_t sizeInBytes() const noexcept size_t sizeInBytes() const noexcept
{ {
jassert (data != nullptr);
wassert (data != nullptr);
return strlen (data) + 1; return strlen (data) + 1;
} }
@@ -556,7 +556,7 @@ public:
*/ */
static bool isByteOrderMark (const void* possibleByteOrder) noexcept static bool isByteOrderMark (const void* possibleByteOrder) noexcept
{ {
jassert (possibleByteOrder != nullptr);
wassert (possibleByteOrder != nullptr);
const uint8* const c = static_cast<const uint8*> (possibleByteOrder); const uint8* const c = static_cast<const uint8*> (possibleByteOrder);
return c[0] == (uint8) byteOrderMark1 return c[0] == (uint8) byteOrderMark1


+ 3
- 3
source/modules/water/text/Identifier.cpp View File

@@ -53,21 +53,21 @@ Identifier::Identifier (const String& nm)
: name (StringPool::getGlobalPool().getPooledString (nm)) : name (StringPool::getGlobalPool().getPooledString (nm))
{ {
// An Identifier cannot be created from an empty string! // An Identifier cannot be created from an empty string!
jassert (nm.isNotEmpty());
wassert (nm.isNotEmpty());
} }
Identifier::Identifier (const char* nm) Identifier::Identifier (const char* nm)
: name (StringPool::getGlobalPool().getPooledString (nm)) : name (StringPool::getGlobalPool().getPooledString (nm))
{ {
// An Identifier cannot be created from an empty string! // An Identifier cannot be created from an empty string!
jassert (nm != nullptr && nm[0] != 0);
wassert (nm != nullptr && nm[0] != 0);
} }
Identifier::Identifier (String::CharPointerType start, String::CharPointerType end) Identifier::Identifier (String::CharPointerType start, String::CharPointerType end)
: name (StringPool::getGlobalPool().getPooledString (start, end)) : name (StringPool::getGlobalPool().getPooledString (start, end))
{ {
// An Identifier cannot be created from an empty string! // An Identifier cannot be created from an empty string!
jassert (start < end);
wassert (start < end);
} }
Identifier Identifier::null; Identifier Identifier::null;


+ 16
- 16
source/modules/water/text/String.cpp View File

@@ -427,7 +427,7 @@ namespace NumberToStringConverters
StackArrayStream strm (buffer); StackArrayStream strm (buffer);
len = strm.writeDouble (n, numDecPlaces); len = strm.writeDouble (n, numDecPlaces);
jassert (len <= charsNeededForDouble);
wassert (len <= charsNeededForDouble);
return buffer; return buffer;
} }
@@ -482,7 +482,7 @@ size_t String::getByteOffsetOfEnd() const noexcept
water_uchar String::operator[] (int index) const noexcept water_uchar String::operator[] (int index) const noexcept
{ {
jassert (index == 0 || (index > 0 && index <= (int) text.lengthUpTo ((size_t) index + 1)));
wassert (index == 0 || (index > 0 && index <= (int) text.lengthUpTo ((size_t) index + 1)));
return text [index]; return text [index];
} }
@@ -559,7 +559,7 @@ static int stringCompareRight (String::CharPointerType s1, String::CharPointerTy
if (c1 != c2 && bias == 0) if (c1 != c2 && bias == 0)
bias = c1 < c2 ? -1 : 1; bias = c1 < c2 ? -1 : 1;
jassert (c1 != 0 && c2 != 0);
wassert (c1 != 0 && c2 != 0);
} }
} }
@@ -632,7 +632,7 @@ static int naturalStringCompare (String::CharPointerType s1, String::CharPointer
return c1 < c2 ? -1 : 1; return c1 < c2 ? -1 : 1;
} }
jassert (c1 != 0 && c2 != 0);
wassert (c1 != 0 && c2 != 0);
} }
} }
@@ -656,11 +656,11 @@ void String::appendCharPointer (const CharPointerType textToAppend)
void String::appendCharPointer (const CharPointerType startOfTextToAppend, void String::appendCharPointer (const CharPointerType startOfTextToAppend,
const CharPointerType endOfTextToAppend) const CharPointerType endOfTextToAppend)
{ {
jassert (startOfTextToAppend.getAddress() != nullptr && endOfTextToAppend.getAddress() != nullptr);
wassert (startOfTextToAppend.getAddress() != nullptr && endOfTextToAppend.getAddress() != nullptr);
const int extraBytesNeeded = getAddressDifference (endOfTextToAppend.getAddress(), const int extraBytesNeeded = getAddressDifference (endOfTextToAppend.getAddress(),
startOfTextToAppend.getAddress()); startOfTextToAppend.getAddress());
jassert (extraBytesNeeded >= 0);
wassert (extraBytesNeeded >= 0);
if (extraBytesNeeded > 0) if (extraBytesNeeded > 0)
{ {
@@ -1058,7 +1058,7 @@ String String::repeatedString (StringRef stringToRepeat, int numberOfTimesToRepe
String String::paddedLeft (const water_uchar padCharacter, int minimumLength) const String String::paddedLeft (const water_uchar padCharacter, int minimumLength) const
{ {
jassert (padCharacter != 0);
wassert (padCharacter != 0);
int extraChars = minimumLength; int extraChars = minimumLength;
CharPointerType end (text); CharPointerType end (text);
@@ -1118,7 +1118,7 @@ String String::replaceSection (int index, int numCharsToReplace, StringRef strin
if (index < 0) if (index < 0)
{ {
// a negative index to replace from? // a negative index to replace from?
jassertfalse;
wassertfalse;
index = 0; index = 0;
} }
@@ -1126,7 +1126,7 @@ String String::replaceSection (int index, int numCharsToReplace, StringRef strin
{ {
// replacing a negative number of characters? // replacing a negative number of characters?
numCharsToReplace = 0; numCharsToReplace = 0;
jassertfalse;
wassertfalse;
} }
CharPointerType insertPoint (text); CharPointerType insertPoint (text);
@@ -1136,7 +1136,7 @@ String String::replaceSection (int index, int numCharsToReplace, StringRef strin
if (insertPoint.isEmpty()) if (insertPoint.isEmpty())
{ {
// replacing beyond the end of the string? // replacing beyond the end of the string?
jassertfalse;
wassertfalse;
return *this + stringToInsert; return *this + stringToInsert;
} }
@@ -1258,7 +1258,7 @@ String String::replaceCharacters (StringRef charactersToReplace, StringRef chara
{ {
// Each character in the first string must have a matching one in the // Each character in the first string must have a matching one in the
// second, so the two strings must be the same length. // second, so the two strings must be the same length.
jassert (charactersToReplace.length() == charactersToInsertInstead.length());
wassert (charactersToReplace.length() == charactersToInsertInstead.length());
StringCreationHelper builder (text); StringCreationHelper builder (text);
@@ -1937,7 +1937,7 @@ struct StringCopier
{ {
static size_t copyToBuffer (const CharPointerType_Src source, typename CharPointerType_Dest::CharType* const buffer, const size_t maxBufferSizeBytes) static size_t copyToBuffer (const CharPointerType_Src source, typename CharPointerType_Dest::CharType* const buffer, const size_t maxBufferSizeBytes)
{ {
jassert (((ssize_t) maxBufferSizeBytes) >= 0); // keep this value positive!
wassert (((ssize_t) maxBufferSizeBytes) >= 0); // keep this value positive!
if (buffer == nullptr) if (buffer == nullptr)
return CharPointerType_Dest::getBytesRequiredFor (source) + sizeof (typename CharPointerType_Dest::CharType); return CharPointerType_Dest::getBytesRequiredFor (source) + sizeof (typename CharPointerType_Dest::CharType);
@@ -1966,7 +1966,7 @@ String String::fromUTF8 (const char* const buffer, int bufferSizeBytes)
if (bufferSizeBytes > 0) if (bufferSizeBytes > 0)
{ {
jassert (CharPointer_UTF8::isValidString (buffer, bufferSizeBytes));
wassert (CharPointer_UTF8::isValidString (buffer, bufferSizeBytes));
return String (CharPointer_UTF8 (buffer), CharPointer_UTF8 (buffer + bufferSizeBytes)); return String (CharPointer_UTF8 (buffer), CharPointer_UTF8 (buffer + bufferSizeBytes));
} }
} }
@@ -2032,7 +2032,7 @@ StringRef::StringRef() noexcept : text ((const String::CharPointerType::CharTyp
StringRef::StringRef (const char* stringLiteral) noexcept StringRef::StringRef (const char* stringLiteral) noexcept
: text (stringLiteral) : text (stringLiteral)
{ {
jassert (stringLiteral != nullptr); // This must be a valid string literal, not a null pointer!!
wassert (stringLiteral != nullptr); // This must be a valid string literal, not a null pointer!!
/* If you get an assertion here, then you're trying to create a string from 8-bit data /* If you get an assertion here, then you're trying to create a string from 8-bit data
that contains values greater than 127. These can NOT be correctly converted to unicode that contains values greater than 127. These can NOT be correctly converted to unicode
@@ -2047,12 +2047,12 @@ StringRef::StringRef (const char* stringLiteral) noexcept
because there's no other way to represent these strings in a way that isn't dependent on because there's no other way to represent these strings in a way that isn't dependent on
the compiler, source code editor and platform. the compiler, source code editor and platform.
*/ */
jassert (CharPointer_UTF8::isValidString (stringLiteral, std::numeric_limits<int>::max()));
wassert (CharPointer_UTF8::isValidString (stringLiteral, std::numeric_limits<int>::max()));
} }
StringRef::StringRef (String::CharPointerType stringLiteral) noexcept : text (stringLiteral) StringRef::StringRef (String::CharPointerType stringLiteral) noexcept : text (stringLiteral)
{ {
jassert (stringLiteral.getAddress() != nullptr); // This must be a valid string literal, not a null pointer!!
wassert (stringLiteral.getAddress() != nullptr); // This must be a valid string literal, not a null pointer!!
} }
StringRef::StringRef (const String& string) noexcept : text (string.getCharPointer()) {} StringRef::StringRef (const String& string) noexcept : text (string.getCharPointer()) {}


+ 1
- 1
source/modules/water/text/String.h View File

@@ -185,7 +185,7 @@ public:
void appendCharPointer (const CharPointer startOfTextToAppend, void appendCharPointer (const CharPointer startOfTextToAppend,
const CharPointer endOfTextToAppend) const CharPointer endOfTextToAppend)
{ {
jassert (startOfTextToAppend.getAddress() != nullptr && endOfTextToAppend.getAddress() != nullptr);
wassert (startOfTextToAppend.getAddress() != nullptr && endOfTextToAppend.getAddress() != nullptr);
size_t extraBytesNeeded = 0, numChars = 1; size_t extraBytesNeeded = 0, numChars = 1;


+ 1
- 1
source/modules/water/text/StringArray.cpp View File

@@ -149,7 +149,7 @@ void StringArray::addArray (const StringArray& otherArray, int startIndex, int n
{ {
if (startIndex < 0) if (startIndex < 0)
{ {
jassertfalse;
wassertfalse;
startIndex = 0; startIndex = 0;
} }


+ 2
- 2
source/modules/water/threads/ChildProcess.cpp View File

@@ -156,7 +156,7 @@ public:
// Looks like you're trying to launch a non-existent exe or a folder (perhaps on OSX // Looks like you're trying to launch a non-existent exe or a folder (perhaps on OSX
// you're trying to launch the .app folder rather than the actual binary inside it?) // you're trying to launch the .app folder rather than the actual binary inside it?)
jassert (File::getCurrentWorkingDirectory().getChildFile (exe).existsAsFile()
wassert (File::getCurrentWorkingDirectory().getChildFile (exe).existsAsFile()
|| ! exe.containsChar (File::separator)); || ! exe.containsChar (File::separator));
int pipeHandles[2] = { 0 }; int pipeHandles[2] = { 0 };
@@ -218,7 +218,7 @@ public:
int read (void* const dest, const int numBytes) noexcept int read (void* const dest, const int numBytes) noexcept
{ {
jassert (dest != nullptr);
wassert (dest != nullptr);
#ifdef fdopen #ifdef fdopen
#error // the zlib headers define this function as NULL! #error // the zlib headers define this function as NULL!


+ 3
- 3
source/modules/water/water.h View File

@@ -23,10 +23,10 @@
//============================================================================== //==============================================================================
#define jassertfalse carla_safe_assert("jassertfalse triggered", __FILE__, __LINE__);
#define jassert(expression) CARLA_SAFE_ASSERT(expression)
#define wassertfalse carla_safe_assert("wassertfalse triggered", __FILE__, __LINE__);
#define wassert(expression) CARLA_SAFE_ASSERT(expression)
#define static_jassert(expression) static_assert(expression, #expression);
#define static_wassert(expression) static_assert(expression, #expression);
//============================================================================== //==============================================================================
// Compiler support // Compiler support


+ 17
- 17
source/modules/water/xml/XmlElement.cpp View File

@@ -71,44 +71,44 @@ XmlElement::XmlAttributeNode::XmlAttributeNode (const XmlAttributeNode& other) n
XmlElement::XmlAttributeNode::XmlAttributeNode (const Identifier& n, const String& v) noexcept XmlElement::XmlAttributeNode::XmlAttributeNode (const Identifier& n, const String& v) noexcept
: name (n), value (v) : name (n), value (v)
{ {
jassert (isValidXmlName (name));
wassert (isValidXmlName (name));
} }
XmlElement::XmlAttributeNode::XmlAttributeNode (String::CharPointerType nameStart, String::CharPointerType nameEnd) XmlElement::XmlAttributeNode::XmlAttributeNode (String::CharPointerType nameStart, String::CharPointerType nameEnd)
: name (nameStart, nameEnd) : name (nameStart, nameEnd)
{ {
jassert (isValidXmlName (name));
wassert (isValidXmlName (name));
} }
//============================================================================== //==============================================================================
XmlElement::XmlElement (const String& tag) XmlElement::XmlElement (const String& tag)
: tagName (StringPool::getGlobalPool().getPooledString (tag)) : tagName (StringPool::getGlobalPool().getPooledString (tag))
{ {
jassert (isValidXmlName (tagName));
wassert (isValidXmlName (tagName));
} }
XmlElement::XmlElement (const char* tag) XmlElement::XmlElement (const char* tag)
: tagName (StringPool::getGlobalPool().getPooledString (tag)) : tagName (StringPool::getGlobalPool().getPooledString (tag))
{ {
jassert (isValidXmlName (tagName));
wassert (isValidXmlName (tagName));
} }
XmlElement::XmlElement (StringRef tag) XmlElement::XmlElement (StringRef tag)
: tagName (StringPool::getGlobalPool().getPooledString (tag)) : tagName (StringPool::getGlobalPool().getPooledString (tag))
{ {
jassert (isValidXmlName (tagName));
wassert (isValidXmlName (tagName));
} }
XmlElement::XmlElement (const Identifier& tag) XmlElement::XmlElement (const Identifier& tag)
: tagName (tag.toString()) : tagName (tag.toString())
{ {
jassert (isValidXmlName (tagName));
wassert (isValidXmlName (tagName));
} }
XmlElement::XmlElement (String::CharPointerType tagNameStart, String::CharPointerType tagNameEnd) XmlElement::XmlElement (String::CharPointerType tagNameStart, String::CharPointerType tagNameEnd)
: tagName (StringPool::getGlobalPool().getPooledString (tagNameStart, tagNameEnd)) : tagName (StringPool::getGlobalPool().getPooledString (tagNameStart, tagNameEnd))
{ {
jassert (isValidXmlName (tagName));
wassert (isValidXmlName (tagName));
} }
XmlElement::XmlElement (int /*dummy*/) noexcept XmlElement::XmlElement (int /*dummy*/) noexcept
@@ -145,7 +145,7 @@ XmlElement::XmlElement (XmlElement&& other) noexcept
XmlElement& XmlElement::operator= (XmlElement&& other) noexcept XmlElement& XmlElement::operator= (XmlElement&& other) noexcept
{ {
jassert (this != &other); // hopefully the compiler should make this situation impossible!
wassert (this != &other); // hopefully the compiler should make this situation impossible!
removeAllAttributes(); removeAllAttributes();
deleteAllChildElements(); deleteAllChildElements();
@@ -161,10 +161,10 @@ XmlElement& XmlElement::operator= (XmlElement&& other) noexcept
void XmlElement::copyChildrenAndAttributesFrom (const XmlElement& other) void XmlElement::copyChildrenAndAttributesFrom (const XmlElement& other)
{ {
jassert (firstChildElement.get() == nullptr);
wassert (firstChildElement.get() == nullptr);
firstChildElement.addCopyOfList (other.firstChildElement); firstChildElement.addCopyOfList (other.firstChildElement);
jassert (attributes.get() == nullptr);
wassert (attributes.get() == nullptr);
attributes.addCopyOfList (other.attributes); attributes.addCopyOfList (other.attributes);
} }
@@ -428,7 +428,7 @@ bool XmlElement::hasTagName (StringRef possibleTagName) const noexcept
// XML tags should be case-sensitive, so although this method allows a // XML tags should be case-sensitive, so although this method allows a
// case-insensitive match to pass, you should try to avoid this. // case-insensitive match to pass, you should try to avoid this.
jassert ((! matches) || tagName == possibleTagName);
wassert ((! matches) || tagName == possibleTagName);
return matches; return matches;
} }
@@ -628,7 +628,7 @@ XmlElement* XmlElement::getChildElement (const int index) const noexcept
XmlElement* XmlElement::getChildByName (StringRef childName) const noexcept XmlElement* XmlElement::getChildByName (StringRef childName) const noexcept
{ {
jassert (! childName.isEmpty());
wassert (! childName.isEmpty());
for (XmlElement* child = firstChildElement; child != nullptr; child = child->nextListItem) for (XmlElement* child = firstChildElement; child != nullptr; child = child->nextListItem)
if (child->hasTagName (childName)) if (child->hasTagName (childName))
@@ -639,7 +639,7 @@ XmlElement* XmlElement::getChildByName (StringRef childName) const noexcept
XmlElement* XmlElement::getChildByAttribute (StringRef attributeName, StringRef attributeValue) const noexcept XmlElement* XmlElement::getChildByAttribute (StringRef attributeName, StringRef attributeValue) const noexcept
{ {
jassert (! attributeName.isEmpty());
wassert (! attributeName.isEmpty());
for (XmlElement* child = firstChildElement; child != nullptr; child = child->nextListItem) for (XmlElement* child = firstChildElement; child != nullptr; child = child->nextListItem)
if (child->compareAttribute (attributeName, attributeValue)) if (child->compareAttribute (attributeName, attributeValue))
@@ -653,7 +653,7 @@ void XmlElement::addChildElement (XmlElement* const newNode) noexcept
if (newNode != nullptr) if (newNode != nullptr)
{ {
// The element being added must not be a child of another node! // The element being added must not be a child of another node!
jassert (newNode->nextListItem == nullptr);
wassert (newNode->nextListItem == nullptr);
firstChildElement.append (newNode); firstChildElement.append (newNode);
} }
@@ -664,7 +664,7 @@ void XmlElement::insertChildElement (XmlElement* const newNode, int indexToInser
if (newNode != nullptr) if (newNode != nullptr)
{ {
// The element being added must not be a child of another node! // The element being added must not be a child of another node!
jassert (newNode->nextListItem == nullptr);
wassert (newNode->nextListItem == nullptr);
firstChildElement.insertAtIndex (indexToInsertAt, newNode); firstChildElement.insertAtIndex (indexToInsertAt, newNode);
} }
@@ -675,7 +675,7 @@ void XmlElement::prependChildElement (XmlElement* newNode) noexcept
if (newNode != nullptr) if (newNode != nullptr)
{ {
// The element being added must not be a child of another node! // The element being added must not be a child of another node!
jassert (newNode->nextListItem == nullptr);
wassert (newNode->nextListItem == nullptr);
firstChildElement.insertNext (newNode); firstChildElement.insertNext (newNode);
} }
@@ -858,7 +858,7 @@ static const String water_xmltextContentAttributeName ("text");
const String& XmlElement::getText() const noexcept const String& XmlElement::getText() const noexcept
{ {
jassert (isTextElement()); // you're trying to get the text from an element that
wassert (isTextElement()); // you're trying to get the text from an element that
// isn't actually a text element.. If this contains text sub-nodes, you // isn't actually a text element.. If this contains text sub-nodes, you
// probably want to use getAllSubText instead. // probably want to use getAllSubText instead.


Loading…
Cancel
Save