| @@ -5085,35 +5085,37 @@ int InputStream::readCompressedInt() | |||
| int64 InputStream::readInt64() | |||
| { | |||
| char temp[8]; | |||
| union { uint8 asBytes[8]; uint64 asInt64; } n; | |||
| if (read (temp, 8) == 8) | |||
| return (int64) ByteOrder::swapIfBigEndian (*reinterpret_cast <uint64*> (temp)); | |||
| if (read (n.asBytes, 8) == 8) | |||
| return (int64) ByteOrder::swapIfBigEndian (n.asInt64); | |||
| return 0; | |||
| } | |||
| int64 InputStream::readInt64BigEndian() | |||
| { | |||
| char temp[8]; | |||
| union { uint8 asBytes[8]; uint64 asInt64; } n; | |||
| if (read (temp, 8) == 8) | |||
| return (int64) ByteOrder::swapIfLittleEndian (*reinterpret_cast <uint64*> (temp)); | |||
| if (read (n.asBytes, 8) == 8) | |||
| return (int64) ByteOrder::swapIfLittleEndian (n.asInt64); | |||
| return 0; | |||
| } | |||
| float InputStream::readFloat() | |||
| { | |||
| union { int asInt; float asFloat; } n; | |||
| n.asInt = readInt(); | |||
| // the union below relies on these types being the same size... | |||
| static_jassert (sizeof (int32) == sizeof (float)); | |||
| union { int32 asInt; float asFloat; } n; | |||
| n.asInt = (int32) readInt(); | |||
| return n.asFloat; | |||
| } | |||
| float InputStream::readFloatBigEndian() | |||
| { | |||
| union { int asInt; float asFloat; } n; | |||
| n.asInt = readIntBigEndian(); | |||
| union { int32 asInt; float asFloat; } n; | |||
| n.asInt = (int32) readIntBigEndian(); | |||
| return n.asFloat; | |||
| } | |||
| @@ -10322,10 +10324,10 @@ public: | |||
| static StringHolder empty; | |||
| private: | |||
| static inline StringHolder* bufferFromText (juce_wchar* const text) throw() | |||
| static inline StringHolder* bufferFromText (void* const text) throw() | |||
| { | |||
| // (Can't use offsetof() here because of warnings about this not being a POD) | |||
| return reinterpret_cast <StringHolder*> (reinterpret_cast <char*> (text) | |||
| return reinterpret_cast <StringHolder*> (static_cast <char*> (text) | |||
| - (reinterpret_cast <size_t> (reinterpret_cast <StringHolder*> (1)->text) - 1)); | |||
| } | |||
| }; | |||
| @@ -11533,9 +11535,7 @@ const String String::substring (int start, int end) const | |||
| return empty; | |||
| int len = 0; | |||
| const juce_wchar* const t = text; | |||
| while (len <= end && t [len] != 0) | |||
| while (len <= end && text [len] != 0) | |||
| ++len; | |||
| if (end >= len) | |||
| @@ -11558,8 +11558,8 @@ const String String::substring (const int start) const | |||
| if (start >= len) | |||
| return empty; | |||
| else | |||
| return String (text + start, len - start); | |||
| return String (text + start, len - start); | |||
| } | |||
| const String String::dropLastCharacters (const int numberToDrop) const | |||
| @@ -11578,11 +11578,10 @@ const String String::fromFirstOccurrenceOf (const String& sub, | |||
| { | |||
| const int i = ignoreCase ? indexOfIgnoreCase (sub) | |||
| : indexOf (sub); | |||
| if (i < 0) | |||
| return empty; | |||
| else | |||
| return substring (includeSubString ? i : i + sub.length()); | |||
| return substring (includeSubString ? i : i + sub.length()); | |||
| } | |||
| const String String::fromLastOccurrenceOf (const String& sub, | |||
| @@ -11591,7 +11590,6 @@ const String String::fromLastOccurrenceOf (const String& sub, | |||
| { | |||
| const int i = ignoreCase ? lastIndexOfIgnoreCase (sub) | |||
| : lastIndexOf (sub); | |||
| if (i < 0) | |||
| return *this; | |||
| @@ -11604,7 +11602,6 @@ const String String::upToFirstOccurrenceOf (const String& sub, | |||
| { | |||
| const int i = ignoreCase ? indexOfIgnoreCase (sub) | |||
| : indexOf (sub); | |||
| if (i < 0) | |||
| return *this; | |||
| @@ -11685,8 +11682,8 @@ const String String::trim() const | |||
| return empty; | |||
| else if (start > 0 || end < len) | |||
| return String (text + start, end - start); | |||
| else | |||
| return *this; | |||
| return *this; | |||
| } | |||
| const String String::trimStart() const | |||
| @@ -11701,8 +11698,8 @@ const String String::trimStart() const | |||
| if (t == text) | |||
| return *this; | |||
| else | |||
| return String (t); | |||
| return String (t); | |||
| } | |||
| const String String::trimEnd() const | |||
| @@ -11720,9 +11717,6 @@ const String String::trimEnd() const | |||
| const String String::trimCharactersAtStart (const String& charactersToTrim) const | |||
| { | |||
| if (isEmpty()) | |||
| return empty; | |||
| const juce_wchar* t = text; | |||
| while (charactersToTrim.containsChar (*t)) | |||
| @@ -11730,8 +11724,8 @@ const String String::trimCharactersAtStart (const String& charactersToTrim) cons | |||
| if (t == text) | |||
| return *this; | |||
| else | |||
| return String (t); | |||
| return String (t); | |||
| } | |||
| const String String::trimCharactersAtEnd (const String& charactersToTrim) const | |||
| @@ -11791,7 +11785,17 @@ const String String::removeCharacters (const String& charactersToRemove) const | |||
| const String String::initialSectionContainingOnly (const String& permittedCharacters) const | |||
| { | |||
| return substring (0, CharacterFunctions::getIntialSectionContainingOnly (text, permittedCharacters.text)); | |||
| int i = 0; | |||
| for (;;) | |||
| { | |||
| if (! permittedCharacters.containsChar (text[i])) | |||
| break; | |||
| ++i; | |||
| } | |||
| return substring (0, i); | |||
| } | |||
| const String String::initialSectionNotContaining (const String& charactersToStopAt) const | |||
| @@ -12104,7 +12108,7 @@ const char* String::toUTF8() const | |||
| String* const mutableThis = const_cast <String*> (this); | |||
| mutableThis->text = StringHolder::makeUniqueWithSize (mutableThis->text, currentLen + 1 + utf8BytesNeeded / sizeof (juce_wchar)); | |||
| char* const otherCopy = (char*) (text + currentLen); | |||
| char* const otherCopy = reinterpret_cast <char*> (text + currentLen); | |||
| copyToUTF8 (otherCopy, std::numeric_limits<int>::max()); | |||
| return otherCopy; | |||
| @@ -12291,12 +12295,11 @@ const char* String::toCString() const | |||
| } | |||
| else | |||
| { | |||
| int len = length(); | |||
| const int len = length(); | |||
| String* const mutableThis = const_cast <String*> (this); | |||
| mutableThis->text = StringHolder::makeUniqueWithSize (mutableThis->text, (len + 1) * 2); | |||
| char* otherCopy = (char*) (text + len + 1); | |||
| char* otherCopy = reinterpret_cast <char*> (text + len + 1); | |||
| CharacterFunctions::copy (otherCopy, text, len); | |||
| otherCopy [len] = 0; | |||
| return otherCopy; | |||
| @@ -26339,6 +26342,26 @@ MidiBuffer::~MidiBuffer() throw() | |||
| { | |||
| } | |||
| inline uint8* MidiBuffer::getData() const throw() | |||
| { | |||
| return static_cast <uint8*> (data.getData()); | |||
| } | |||
| inline int MidiBuffer::getEventTime (const void* const d) throw() | |||
| { | |||
| return *static_cast <const int*> (d); | |||
| } | |||
| inline uint16 MidiBuffer::getEventDataSize (const void* const d) throw() | |||
| { | |||
| return *reinterpret_cast <const uint16*> (static_cast <const char*> (d) + sizeof (int)); | |||
| } | |||
| inline uint16 MidiBuffer::getEventTotalSize (const void* const d) throw() | |||
| { | |||
| return getEventDataSize (d) + sizeof (int) + sizeof (uint16); | |||
| } | |||
| void MidiBuffer::clear() throw() | |||
| { | |||
| bytesUsed = 0; | |||
| @@ -26406,23 +26429,23 @@ void MidiBuffer::addEvent (const uint8* const newData, | |||
| if (numBytes > 0) | |||
| { | |||
| int spaceNeeded = bytesUsed + numBytes + 6; | |||
| int spaceNeeded = bytesUsed + numBytes + sizeof (int) + sizeof (uint16); | |||
| data.ensureSize ((spaceNeeded + spaceNeeded / 2 + 8) & ~7); | |||
| uint8* d = findEventAfter (getData(), sampleNumber); | |||
| const int bytesToMove = bytesUsed - (int) (d - getData()); | |||
| if (bytesToMove > 0) | |||
| memmove (d + numBytes + 6, d, bytesToMove); | |||
| memmove (d + numBytes + sizeof (int) + sizeof (uint16), d, bytesToMove); | |||
| *reinterpret_cast <int*> (d) = sampleNumber; | |||
| d += 4; | |||
| d += sizeof (int); | |||
| *reinterpret_cast <uint16*> (d) = (uint16) numBytes; | |||
| d += 2; | |||
| d += sizeof (uint16); | |||
| memcpy (d, newData, numBytes); | |||
| bytesUsed += numBytes + 6; | |||
| bytesUsed += numBytes + sizeof (int) + sizeof (uint16); | |||
| } | |||
| } | |||
| @@ -26457,8 +26480,7 @@ int MidiBuffer::getNumEvents() const throw() | |||
| while (d < end) | |||
| { | |||
| d += 4; | |||
| d += 2 + *reinterpret_cast <const uint16*> (d); | |||
| d += getEventTotalSize (d); | |||
| ++n; | |||
| } | |||
| @@ -26467,7 +26489,7 @@ int MidiBuffer::getNumEvents() const throw() | |||
| int MidiBuffer::getFirstEventTime() const throw() | |||
| { | |||
| return (bytesUsed > 0) ? *reinterpret_cast <const int*> (data.getData()) : 0; | |||
| return bytesUsed > 0 ? getEventTime (data.getData()) : 0; | |||
| } | |||
| int MidiBuffer::getLastEventTime() const throw() | |||
| @@ -26480,10 +26502,10 @@ int MidiBuffer::getLastEventTime() const throw() | |||
| for (;;) | |||
| { | |||
| const uint8* nextOne = d + 6 + *reinterpret_cast <const uint16*> (d + 4); | |||
| const uint8* const nextOne = d + getEventTotalSize (d); | |||
| if (nextOne >= endData) | |||
| return *reinterpret_cast <const int*> (d); | |||
| return getEventTime (d); | |||
| d = nextOne; | |||
| } | |||
| @@ -26493,11 +26515,8 @@ uint8* MidiBuffer::findEventAfter (uint8* d, const int samplePosition) const thr | |||
| { | |||
| const uint8* const endData = getData() + bytesUsed; | |||
| while (d < endData && *reinterpret_cast <const int*> (d) <= samplePosition) | |||
| { | |||
| d += 4; | |||
| d += 2 + *reinterpret_cast <const uint16*> (d); | |||
| } | |||
| while (d < endData && getEventTime (d) <= samplePosition) | |||
| d += getEventTotalSize (d); | |||
| return d; | |||
| } | |||
| @@ -26517,11 +26536,8 @@ void MidiBuffer::Iterator::setNextSamplePosition (const int samplePosition) thro | |||
| data = buffer.getData(); | |||
| const uint8* dataEnd = data + buffer.bytesUsed; | |||
| while (data < dataEnd && *reinterpret_cast <const int*> (data) < samplePosition) | |||
| { | |||
| data += 4; | |||
| data += 2 + *(uint16*) data; | |||
| } | |||
| while (data < dataEnd && getEventTime (data) < samplePosition) | |||
| data += getEventTotalSize (data); | |||
| } | |||
| bool MidiBuffer::Iterator::getNextEvent (const uint8* &midiData, int& numBytes, int& samplePosition) throw() | |||
| @@ -26529,10 +26545,9 @@ bool MidiBuffer::Iterator::getNextEvent (const uint8* &midiData, int& numBytes, | |||
| if (data >= buffer.getData() + buffer.bytesUsed) | |||
| return false; | |||
| samplePosition = *reinterpret_cast <const int*> (data); | |||
| data += 4; | |||
| numBytes = *reinterpret_cast <const uint16*> (data); | |||
| data += 2; | |||
| samplePosition = getEventTime (data); | |||
| numBytes = getEventDataSize (data); | |||
| data += sizeof (int) + sizeof (uint16); | |||
| midiData = data; | |||
| data += numBytes; | |||
| @@ -26544,10 +26559,9 @@ bool MidiBuffer::Iterator::getNextEvent (MidiMessage& result, int& samplePositio | |||
| if (data >= buffer.getData() + buffer.bytesUsed) | |||
| return false; | |||
| samplePosition = *reinterpret_cast <const int*> (data); | |||
| data += 4; | |||
| const int numBytes = *reinterpret_cast <const uint16*> (data); | |||
| data += 2; | |||
| samplePosition = getEventTime (data); | |||
| const int numBytes = getEventDataSize (data); | |||
| data += sizeof (int) + sizeof (uint16); | |||
| result = MidiMessage (data, numBytes, samplePosition); | |||
| data += numBytes; | |||
| @@ -27189,26 +27203,24 @@ int MidiMessage::getMessageLengthFromFirstByte (const uint8 firstByte) throw() | |||
| MidiMessage::MidiMessage (const void* const d, const int dataSize, const double t) | |||
| : timeStamp (t), | |||
| message (0), | |||
| size (dataSize) | |||
| { | |||
| jassert (dataSize > 0); | |||
| if (dataSize <= 4) | |||
| data = (uint8*) &message; | |||
| data = static_cast<uint8*> (preallocatedData.asBytes); | |||
| else | |||
| data = (uint8*) juce_malloc (dataSize); | |||
| data = static_cast<uint8*> (juce_malloc (dataSize)); | |||
| memcpy (data, d, dataSize); | |||
| // check that the length matches the data.. | |||
| jassert (size > 3 || *reinterpret_cast<const uint8*> (d) >= 0xf0 | |||
| || getMessageLengthFromFirstByte (*reinterpret_cast<const uint8*> (d)) == size); | |||
| jassert (size > 3 || data[0] >= 0xf0 || getMessageLengthFromFirstByte (data[0]) == size); | |||
| } | |||
| MidiMessage::MidiMessage (const int byte1, const double t) throw() | |||
| : timeStamp (t), | |||
| data ((uint8*) &message), | |||
| data (static_cast<uint8*> (preallocatedData.asBytes)), | |||
| size (1) | |||
| { | |||
| data[0] = (uint8) byte1; | |||
| @@ -27219,7 +27231,7 @@ MidiMessage::MidiMessage (const int byte1, const double t) throw() | |||
| MidiMessage::MidiMessage (const int byte1, const int byte2, const double t) throw() | |||
| : timeStamp (t), | |||
| data ((uint8*) &message), | |||
| data (static_cast<uint8*> (preallocatedData.asBytes)), | |||
| size (2) | |||
| { | |||
| data[0] = (uint8) byte1; | |||
| @@ -27231,7 +27243,7 @@ MidiMessage::MidiMessage (const int byte1, const int byte2, const double t) thro | |||
| MidiMessage::MidiMessage (const int byte1, const int byte2, const int byte3, const double t) throw() | |||
| : timeStamp (t), | |||
| data ((uint8*) &message), | |||
| data (static_cast<uint8*> (preallocatedData.asBytes)), | |||
| size (3) | |||
| { | |||
| data[0] = (uint8) byte1; | |||
| @@ -27244,40 +27256,39 @@ MidiMessage::MidiMessage (const int byte1, const int byte2, const int byte3, con | |||
| MidiMessage::MidiMessage (const MidiMessage& other) | |||
| : timeStamp (other.timeStamp), | |||
| message (other.message), | |||
| size (other.size) | |||
| { | |||
| if (other.data != (uint8*) &other.message) | |||
| if (other.data != static_cast <const uint8*> (other.preallocatedData.asBytes)) | |||
| { | |||
| data = (uint8*) juce_malloc (size); | |||
| data = static_cast<uint8*> (juce_malloc (size)); | |||
| memcpy (data, other.data, size); | |||
| } | |||
| else | |||
| { | |||
| data = (uint8*) &message; | |||
| data = static_cast<uint8*> (preallocatedData.asBytes); | |||
| preallocatedData.asInt32 = other.preallocatedData.asInt32; | |||
| } | |||
| } | |||
| MidiMessage::MidiMessage (const MidiMessage& other, const double newTimeStamp) | |||
| : timeStamp (newTimeStamp), | |||
| message (other.message), | |||
| size (other.size) | |||
| { | |||
| if (other.data != (uint8*) &other.message) | |||
| if (other.data != static_cast <const uint8*> (other.preallocatedData.asBytes)) | |||
| { | |||
| data = (uint8*) juce_malloc (size); | |||
| data = static_cast<uint8*> (juce_malloc (size)); | |||
| memcpy (data, other.data, size); | |||
| } | |||
| else | |||
| { | |||
| data = (uint8*) &message; | |||
| data = static_cast<uint8*> (preallocatedData.asBytes); | |||
| preallocatedData.asInt32 = other.preallocatedData.asInt32; | |||
| } | |||
| } | |||
| MidiMessage::MidiMessage (const void* src_, int sz, int& numBytesUsed, const uint8 lastStatusByte, double t) | |||
| : timeStamp (t), | |||
| data ((uint8*) &message), | |||
| message (0) | |||
| data (static_cast<uint8*> (preallocatedData.asBytes)) | |||
| { | |||
| const uint8* src = static_cast <const uint8*> (src_); | |||
| unsigned int byte = (unsigned int) *src; | |||
| @@ -27315,7 +27326,7 @@ MidiMessage::MidiMessage (const void* src_, int sz, int& numBytesUsed, const uin | |||
| size = 1 + (int) (d - src); | |||
| data = (uint8*) juce_malloc (size); | |||
| data = static_cast<uint8*> (juce_malloc (size)); | |||
| *data = (uint8) byte; | |||
| memcpy (data + 1, src, size - 1); | |||
| } | |||
| @@ -27325,14 +27336,15 @@ MidiMessage::MidiMessage (const void* src_, int sz, int& numBytesUsed, const uin | |||
| const int bytesLeft = readVariableLengthVal (src + 1, n); | |||
| size = jmin (sz + 1, n + 2 + bytesLeft); | |||
| data = (uint8*) juce_malloc (size); | |||
| data = static_cast<uint8*> (juce_malloc (size)); | |||
| *data = (uint8) byte; | |||
| memcpy (data + 1, src, size - 1); | |||
| } | |||
| else | |||
| { | |||
| preallocatedData.asInt32 = 0; | |||
| size = getMessageLengthFromFirstByte ((uint8) byte); | |||
| *data = (uint8) byte; | |||
| data[0] = (uint8) byte; | |||
| if (size > 1) | |||
| { | |||
| @@ -27347,7 +27359,7 @@ MidiMessage::MidiMessage (const void* src_, int sz, int& numBytesUsed, const uin | |||
| } | |||
| else | |||
| { | |||
| message = 0; | |||
| preallocatedData.asInt32 = 0; | |||
| size = 0; | |||
| } | |||
| } | |||
| @@ -27358,19 +27370,19 @@ MidiMessage& MidiMessage::operator= (const MidiMessage& other) | |||
| { | |||
| timeStamp = other.timeStamp; | |||
| size = other.size; | |||
| message = other.message; | |||
| if (data != (uint8*) &message) | |||
| if (data != static_cast <const uint8*> (preallocatedData.asBytes)) | |||
| juce_free (data); | |||
| if (other.data != (uint8*) &other.message) | |||
| if (other.data != static_cast <const uint8*> (other.preallocatedData.asBytes)) | |||
| { | |||
| data = (uint8*) juce_malloc (size); | |||
| data = static_cast<uint8*> (juce_malloc (size)); | |||
| memcpy (data, other.data, size); | |||
| } | |||
| else | |||
| { | |||
| data = (uint8*) &message; | |||
| data = static_cast<uint8*> (preallocatedData.asBytes); | |||
| preallocatedData.asInt32 = other.preallocatedData.asInt32; | |||
| } | |||
| } | |||
| @@ -27379,7 +27391,7 @@ MidiMessage& MidiMessage::operator= (const MidiMessage& other) | |||
| MidiMessage::~MidiMessage() | |||
| { | |||
| if (data != (uint8*) &message) | |||
| if (data != static_cast <const uint8*> (preallocatedData.asBytes)) | |||
| juce_free (data); | |||
| } | |||
| @@ -81506,11 +81518,9 @@ public: | |||
| y = y_; | |||
| generate (scratchBuffer, x, width); | |||
| const uint8* mask = reinterpret_cast <uint8*> (scratchBuffer.getData()); | |||
| if (sizeof (SrcPixelType) == sizeof (PixelARGB)) | |||
| mask += PixelARGB::indexA; | |||
| et.clipLineToMask (x, y_, mask, sizeof (SrcPixelType), width); | |||
| et.clipLineToMask (x, y_, | |||
| reinterpret_cast<uint8*> (scratchBuffer.getData()) + SrcPixelType::indexA, | |||
| sizeof (SrcPixelType), width); | |||
| } | |||
| private: | |||
| @@ -213585,7 +213595,7 @@ void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* call | |||
| static BOOL CALLBACK BroadcastEnumWindowProc (HWND hwnd, LPARAM lParam) | |||
| { | |||
| if (hwnd != juce_messageWindowHandle) | |||
| (reinterpret_cast <VoidArray*> (lParam))->add ((void*) hwnd); | |||
| reinterpret_cast <VoidArray*> (lParam)->add ((void*) hwnd); | |||
| return TRUE; | |||
| } | |||
| @@ -231933,15 +231943,15 @@ public: | |||
| const int width = image.getWidth(); | |||
| const int height = image.getHeight(); | |||
| HeapBlock <uint32> colour (width * height); | |||
| HeapBlock <char> colour (width * height); | |||
| int index = 0; | |||
| for (int y = 0; y < height; ++y) | |||
| for (int x = 0; x < width; ++x) | |||
| colour[index++] = image.getPixelAt (x, y).getARGB(); | |||
| colour[index++] = static_cast<char> (image.getPixelAt (x, y).getARGB()); | |||
| XImage* ximage = XCreateImage (display, CopyFromParent, 24, ZPixmap, | |||
| 0, reinterpret_cast<char*> (colour.getData()), | |||
| 0, colour.getData(), | |||
| width, height, 32, 0); | |||
| Pixmap pixmap = XCreatePixmap (display, DefaultRootWindow (display), | |||
| @@ -231961,7 +231971,7 @@ public: | |||
| const int width = image.getWidth(); | |||
| const int height = image.getHeight(); | |||
| const int stride = (width + 7) >> 3; | |||
| HeapBlock <uint8> mask; | |||
| HeapBlock <char> mask; | |||
| mask.calloc (stride * height); | |||
| const bool msbfirst = (BitmapBitOrder (display) == MSBFirst); | |||
| @@ -231969,7 +231979,7 @@ public: | |||
| { | |||
| for (int x = 0; x < width; ++x) | |||
| { | |||
| const uint8 bit = (uint8) (1 << (msbfirst ? (7 - (x & 7)) : (x & 7))); | |||
| const char bit = (char) (1 << (msbfirst ? (7 - (x & 7)) : (x & 7))); | |||
| const int offset = y * stride + (x >> 3); | |||
| if (image.getPixelAt (x, y).getAlpha() >= 128) | |||
| @@ -231978,7 +231988,7 @@ public: | |||
| } | |||
| return XCreatePixmapFromBitmapData (display, DefaultRootWindow (display), | |||
| reinterpret_cast<char*> (mask.getData()), width, height, 1, 0, 1); | |||
| mask.getData(), width, height, 1, 0, 1); | |||
| } | |||
| void setIcon (const Image& newIcon) | |||
| @@ -233824,7 +233834,7 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot | |||
| } | |||
| const int stride = (cursorW + 7) >> 3; | |||
| HeapBlock <uint8> maskPlane, sourcePlane; | |||
| HeapBlock <char> maskPlane, sourcePlane; | |||
| maskPlane.calloc (stride * cursorH); | |||
| sourcePlane.calloc (stride * cursorH); | |||
| @@ -233834,7 +233844,7 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot | |||
| { | |||
| for (int x = cursorW; --x >= 0;) | |||
| { | |||
| const uint8 mask = (uint8) (1 << (msbfirst ? (7 - (x & 7)) : (x & 7))); | |||
| const char mask = (char) (1 << (msbfirst ? (7 - (x & 7)) : (x & 7))); | |||
| const int offset = y * stride + (x >> 3); | |||
| const Colour c (im.getPixelAt (x, y)); | |||
| @@ -233847,8 +233857,8 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot | |||
| } | |||
| } | |||
| Pixmap sourcePixmap = XCreatePixmapFromBitmapData (display, root, reinterpret_cast <char*> (sourcePlane.getData()), cursorW, cursorH, 0xffff, 0, 1); | |||
| Pixmap maskPixmap = XCreatePixmapFromBitmapData (display, root, reinterpret_cast <char*> (maskPlane.getData()), cursorW, cursorH, 0xffff, 0, 1); | |||
| Pixmap sourcePixmap = XCreatePixmapFromBitmapData (display, root, sourcePlane.getData(), cursorW, cursorH, 0xffff, 0, 1); | |||
| Pixmap maskPixmap = XCreatePixmapFromBitmapData (display, root, maskPlane.getData(), cursorW, cursorH, 0xffff, 0, 1); | |||
| XColor white, black; | |||
| black.red = black.green = black.blue = 0; | |||
| @@ -234512,7 +234522,7 @@ public: | |||
| if (isInterleaved) | |||
| { | |||
| scratch.ensureSize (sizeof (float) * numSamples * numChannelsRunning, false); | |||
| float* interleaved = reinterpret_cast <float*> (scratch.getData()); | |||
| float* interleaved = static_cast <float*> (scratch.getData()); | |||
| AudioDataConverters::interleaveSamples ((const float**) data, interleaved, numSamples, numChannelsRunning); | |||
| AudioDataConverters::convertFloatToFormat (sampleFormat, interleaved, interleaved, numSamples * numChannelsRunning); | |||
| @@ -234550,7 +234560,7 @@ public: | |||
| if (isInterleaved) | |||
| { | |||
| scratch.ensureSize (sizeof (float) * numSamples * numChannelsRunning, false); | |||
| float* interleaved = reinterpret_cast <float*> (scratch.getData()); | |||
| float* interleaved = static_cast <float*> (scratch.getData()); | |||
| snd_pcm_sframes_t num = snd_pcm_readi (handle, (void*) interleaved, numSamples); | |||
| @@ -243259,7 +243269,7 @@ static const String getConnectedEndpointName (MIDIEndpointRef endpoint) | |||
| if (s.isNotEmpty()) | |||
| { | |||
| if (result.isNotEmpty()) | |||
| result += (", "); | |||
| result += ", "; | |||
| result += s; | |||
| } | |||
| @@ -251422,7 +251432,7 @@ static const String getConnectedEndpointName (MIDIEndpointRef endpoint) | |||
| if (s.isNotEmpty()) | |||
| { | |||
| if (result.isNotEmpty()) | |||
| result += (", "); | |||
| result += ", "; | |||
| result += s; | |||
| } | |||
| @@ -870,13 +870,13 @@ public: | |||
| static uint64 swapIfLittleEndian (uint64 value); | |||
| static uint32 littleEndianInt (const char* bytes); | |||
| static uint32 littleEndianInt (const void* bytes); | |||
| static uint16 littleEndianShort (const char* bytes); | |||
| static uint16 littleEndianShort (const void* bytes); | |||
| static uint32 bigEndianInt (const char* bytes); | |||
| static uint32 bigEndianInt (const void* bytes); | |||
| static uint16 bigEndianShort (const char* bytes); | |||
| static uint16 bigEndianShort (const void* bytes); | |||
| static int littleEndian24Bit (const char* bytes); | |||
| @@ -944,10 +944,10 @@ inline uint64 ByteOrder::swap (uint64 value) | |||
| inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return swap (v); } | |||
| inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return swap (v); } | |||
| inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return swap (v); } | |||
| inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return *reinterpret_cast <const uint32*> (bytes); } | |||
| inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return *reinterpret_cast <const uint16*> (bytes); } | |||
| inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return swap (*reinterpret_cast <const uint32*> (bytes)); } | |||
| inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return swap (*reinterpret_cast <const uint16*> (bytes)); } | |||
| inline uint32 ByteOrder::littleEndianInt (const void* const bytes) { return *static_cast <const uint32*> (bytes); } | |||
| inline uint16 ByteOrder::littleEndianShort (const void* const bytes) { return *static_cast <const uint16*> (bytes); } | |||
| inline uint32 ByteOrder::bigEndianInt (const void* const bytes) { return swap (*static_cast <const uint32*> (bytes)); } | |||
| inline uint16 ByteOrder::bigEndianShort (const void* const bytes) { return swap (*static_cast <const uint16*> (bytes)); } | |||
| inline bool ByteOrder::isBigEndian() { return false; } | |||
| #else | |||
| inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return swap (v); } | |||
| @@ -956,10 +956,10 @@ inline uint64 ByteOrder::swap (uint64 value) | |||
| inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return v; } | |||
| inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return v; } | |||
| inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return v; } | |||
| inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return swap (*reinterpret_cast <const uint32*> (bytes)); } | |||
| inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return swap (*reinterpret_cast <const uint16*> (bytes)); } | |||
| inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return *reinterpret_cast <const uint32*> (bytes); } | |||
| inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return *reinterpret_cast <const uint16*> (bytes); } | |||
| inline uint32 ByteOrder::littleEndianInt (const void* const bytes) { return swap (*static_cast <const uint32*> (bytes)); } | |||
| inline uint16 ByteOrder::littleEndianShort (const void* const bytes) { return swap (*static_cast <const uint16*> (bytes)); } | |||
| inline uint32 ByteOrder::bigEndianInt (const void* const bytes) { return *static_cast <const uint32*> (bytes); } | |||
| inline uint16 ByteOrder::bigEndianShort (const void* const bytes) { return *static_cast <const uint16*> (bytes); } | |||
| inline bool ByteOrder::isBigEndian() { return true; } | |||
| #endif | |||
| @@ -1513,8 +1513,8 @@ public: | |||
| { | |||
| } | |||
| HeapBlock (const size_t numElements) | |||
| : data (reinterpret_cast <ElementType*> (::juce_malloc (numElements * sizeof (ElementType)))) | |||
| explicit HeapBlock (const size_t numElements) | |||
| : data (static_cast <ElementType*> (::juce_malloc (numElements * sizeof (ElementType)))) | |||
| { | |||
| } | |||
| @@ -1548,13 +1548,13 @@ public: | |||
| void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) | |||
| { | |||
| ::juce_free (data); | |||
| data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * elementSize)); | |||
| data = static_cast <ElementType*> (::juce_malloc (newNumElements * elementSize)); | |||
| } | |||
| void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) | |||
| { | |||
| ::juce_free (data); | |||
| data = reinterpret_cast <ElementType*> (::juce_calloc (newNumElements * elementSize)); | |||
| data = static_cast <ElementType*> (::juce_calloc (newNumElements * elementSize)); | |||
| } | |||
| void allocate (const size_t newNumElements, const bool initialiseToZero) | |||
| @@ -1562,17 +1562,17 @@ public: | |||
| ::juce_free (data); | |||
| if (initialiseToZero) | |||
| data = reinterpret_cast <ElementType*> (::juce_calloc (newNumElements * sizeof (ElementType))); | |||
| data = static_cast <ElementType*> (::juce_calloc (newNumElements * sizeof (ElementType))); | |||
| else | |||
| data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * sizeof (ElementType))); | |||
| data = static_cast <ElementType*> (::juce_malloc (newNumElements * sizeof (ElementType))); | |||
| } | |||
| void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) | |||
| { | |||
| if (data == 0) | |||
| data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * elementSize)); | |||
| data = static_cast <ElementType*> (::juce_malloc (newNumElements * elementSize)); | |||
| else | |||
| data = reinterpret_cast <ElementType*> (::juce_realloc (data, newNumElements * elementSize)); | |||
| data = static_cast <ElementType*> (::juce_realloc (data, newNumElements * elementSize)); | |||
| } | |||
| void free() | |||
| @@ -4509,7 +4509,7 @@ class JUCE_API XmlElement | |||
| { | |||
| public: | |||
| XmlElement (const String& tagName) throw(); | |||
| explicit XmlElement (const String& tagName) throw(); | |||
| XmlElement (const XmlElement& other) throw(); | |||
| @@ -6430,9 +6430,9 @@ class JUCE_API ScopedLock | |||
| { | |||
| public: | |||
| inline ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); } | |||
| inline explicit ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); } | |||
| inline ~ScopedLock() throw() { lock_.exit(); } | |||
| inline ~ScopedLock() throw() { lock_.exit(); } | |||
| private: | |||
| @@ -6446,9 +6446,9 @@ class ScopedUnlock | |||
| { | |||
| public: | |||
| inline ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); } | |||
| inline explicit ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); } | |||
| inline ~ScopedUnlock() throw() { lock_.enter(); } | |||
| inline ~ScopedUnlock() throw() { lock_.enter(); } | |||
| private: | |||
| @@ -6615,7 +6615,7 @@ class JUCE_API ValueTree | |||
| { | |||
| public: | |||
| ValueTree (const String& type); | |||
| explicit ValueTree (const String& type); | |||
| ValueTree (const ValueTree& other); | |||
| @@ -7117,7 +7117,7 @@ class JUCE_API Random | |||
| { | |||
| public: | |||
| Random (int64 seedValue) throw(); | |||
| explicit Random (int64 seedValue) throw(); | |||
| ~Random() throw(); | |||
| @@ -7518,15 +7518,15 @@ public: | |||
| MD5& operator= (const MD5& other); | |||
| MD5 (const MemoryBlock& data); | |||
| explicit MD5 (const MemoryBlock& data); | |||
| MD5 (const char* data, const size_t numBytes); | |||
| MD5 (const String& text); | |||
| explicit MD5 (const String& text); | |||
| MD5 (InputStream& input, int64 numBytesToRead = -1); | |||
| MD5 (const File& file); | |||
| explicit MD5 (const File& file); | |||
| ~MD5(); | |||
| @@ -7580,6 +7580,11 @@ public: | |||
| int numRandomSeeds = 0); | |||
| static bool isProbablyPrime (const BigInteger& number, int certainty); | |||
| private: | |||
| Primes(); | |||
| Primes (const Primes&); | |||
| Primes& operator= (const Primes&); | |||
| }; | |||
| #endif // __JUCE_PRIMES_JUCEHEADER__ | |||
| @@ -7599,7 +7604,7 @@ public: | |||
| RSAKey(); | |||
| RSAKey (const String& stringRepresentation); | |||
| explicit RSAKey (const String& stringRepresentation); | |||
| ~RSAKey(); | |||
| @@ -7679,7 +7684,7 @@ class JUCE_API FileInputStream : public InputStream | |||
| { | |||
| public: | |||
| FileInputStream (const File& fileToRead); | |||
| explicit FileInputStream (const File& fileToRead); | |||
| ~FileInputStream(); | |||
| @@ -8641,7 +8646,7 @@ class JUCE_API InterProcessLock | |||
| { | |||
| public: | |||
| InterProcessLock (const String& name); | |||
| explicit InterProcessLock (const String& name); | |||
| ~InterProcessLock(); | |||
| @@ -8702,6 +8707,11 @@ public: | |||
| static void lowerPrivilege(); | |||
| static bool JUCE_CALLTYPE isRunningUnderDebugger(); | |||
| private: | |||
| Process(); | |||
| Process (const Process&); | |||
| Process& operator= (const Process&); | |||
| }; | |||
| #endif // __JUCE_PROCESS_JUCEHEADER__ | |||
| @@ -8755,7 +8765,7 @@ class JUCE_API Thread | |||
| { | |||
| public: | |||
| Thread (const String& threadName); | |||
| explicit Thread (const String& threadName); | |||
| virtual ~Thread(); | |||
| @@ -8883,9 +8893,9 @@ class JUCE_API ScopedReadLock | |||
| { | |||
| public: | |||
| inline ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); } | |||
| inline explicit ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); } | |||
| inline ~ScopedReadLock() throw() { lock_.exitRead(); } | |||
| inline ~ScopedReadLock() throw() { lock_.exitRead(); } | |||
| private: | |||
| @@ -8910,11 +8920,11 @@ class JUCE_API ScopedTryLock | |||
| { | |||
| public: | |||
| inline ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {} | |||
| inline explicit ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {} | |||
| inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); } | |||
| inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); } | |||
| bool isLocked() const throw() { return lockWasSuccessful; } | |||
| bool isLocked() const throw() { return lockWasSuccessful; } | |||
| private: | |||
| @@ -8940,9 +8950,9 @@ class JUCE_API ScopedWriteLock | |||
| { | |||
| public: | |||
| inline ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); } | |||
| inline explicit ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); } | |||
| inline ~ScopedWriteLock() throw() { lock_.exitWrite(); } | |||
| inline ~ScopedWriteLock() throw() { lock_.exitWrite(); } | |||
| private: | |||
| @@ -8973,7 +8983,7 @@ class JUCE_API ThreadPoolJob | |||
| { | |||
| public: | |||
| ThreadPoolJob (const String& name); | |||
| explicit ThreadPoolJob (const String& name); | |||
| virtual ~ThreadPoolJob(); | |||
| @@ -9101,7 +9111,7 @@ class JUCE_API TimeSliceThread : public Thread | |||
| { | |||
| public: | |||
| TimeSliceThread (const String& threadName); | |||
| explicit TimeSliceThread (const String& threadName); | |||
| ~TimeSliceThread(); | |||
| @@ -10639,7 +10649,7 @@ public: | |||
| protected: | |||
| String name; | |||
| Typeface (const String& name) throw(); | |||
| explicit Typeface (const String& name) throw(); | |||
| private: | |||
| Typeface (const Typeface&); | |||
| @@ -10652,7 +10662,7 @@ public: | |||
| CustomTypeface(); | |||
| CustomTypeface (InputStream& serialisedTypefaceStream); | |||
| explicit CustomTypeface (InputStream& serialisedTypefaceStream); | |||
| ~CustomTypeface(); | |||
| @@ -11407,6 +11417,8 @@ public: | |||
| { | |||
| } | |||
| enum { indexA = 0 }; | |||
| private: | |||
| uint8 a : 8; | |||
| @@ -11832,7 +11844,7 @@ class JUCE_API Graphics | |||
| { | |||
| public: | |||
| Graphics (Image& imageToDrawOnto) throw(); | |||
| explicit Graphics (Image& imageToDrawOnto) throw(); | |||
| ~Graphics() throw(); | |||
| @@ -12176,7 +12188,7 @@ public: | |||
| int bottomGap, | |||
| int rightGap) throw(); | |||
| BorderSize (int allGaps) throw(); | |||
| explicit BorderSize (int allGaps) throw(); | |||
| ~BorderSize() throw(); | |||
| @@ -12234,7 +12246,7 @@ public: | |||
| virtual ~Component(); | |||
| Component (const String& componentName); | |||
| explicit Component (const String& componentName); | |||
| const String& getName() const throw() { return componentName_; } | |||
| @@ -12813,7 +12825,7 @@ namespace StandardApplicationCommandIDs | |||
| struct JUCE_API ApplicationCommandInfo | |||
| { | |||
| ApplicationCommandInfo (CommandID commandID) throw(); | |||
| explicit ApplicationCommandInfo (CommandID commandID) throw(); | |||
| void setInfo (const String& shortName, | |||
| const String& description, | |||
| @@ -14251,7 +14263,7 @@ class JUCE_API AudioThumbnailCache : public TimeSliceThread | |||
| { | |||
| public: | |||
| AudioThumbnailCache (int maxNumThumbsToStore); | |||
| explicit AudioThumbnailCache (int maxNumThumbsToStore); | |||
| ~AudioThumbnailCache(); | |||
| @@ -15174,7 +15186,7 @@ public: | |||
| virtual ~AudioIODeviceType(); | |||
| protected: | |||
| AudioIODeviceType (const String& typeName); | |||
| explicit AudioIODeviceType (const String& typeName); | |||
| private: | |||
| String typeName; | |||
| @@ -15468,7 +15480,13 @@ public: | |||
| private: | |||
| double timeStamp; | |||
| uint8* data; | |||
| int message, size; | |||
| int size; | |||
| union | |||
| { | |||
| uint8 asBytes[4]; | |||
| uint32 asInt32; | |||
| } preallocatedData; | |||
| }; | |||
| #endif // __JUCE_MIDIMESSAGE_JUCEHEADER__ | |||
| @@ -15526,7 +15544,7 @@ protected: | |||
| String name; | |||
| void* internal; | |||
| MidiInput (const String& name); | |||
| explicit MidiInput (const String& name); | |||
| private: | |||
| MidiInput (const MidiInput&); | |||
| @@ -15552,7 +15570,7 @@ public: | |||
| MidiBuffer() throw(); | |||
| MidiBuffer (const MidiMessage& message) throw(); | |||
| explicit MidiBuffer (const MidiMessage& message) throw(); | |||
| MidiBuffer (const MidiBuffer& other) throw(); | |||
| @@ -15621,8 +15639,11 @@ private: | |||
| MemoryBlock data; | |||
| int bytesUsed; | |||
| uint8* getData() const throw() { return reinterpret_cast <uint8*> (data.getData()); } | |||
| uint8* getData() const throw(); | |||
| uint8* findEventAfter (uint8* d, const int samplePosition) const throw(); | |||
| static int getEventTime (const void* d) throw(); | |||
| static uint16 getEventDataSize (const void* d) throw(); | |||
| static uint16 getEventTotalSize (const void* d) throw(); | |||
| }; | |||
| #endif // __JUCE_MIDIBUFFER_JUCEHEADER__ | |||
| @@ -15765,8 +15786,8 @@ class JUCE_API TooltipWindow : public Component, | |||
| { | |||
| public: | |||
| TooltipWindow (Component* parentComponent = 0, | |||
| int millisecondsBeforeTipAppears = 700); | |||
| explicit TooltipWindow (Component* parentComponent = 0, | |||
| int millisecondsBeforeTipAppears = 700); | |||
| ~TooltipWindow(); | |||
| @@ -15826,7 +15847,7 @@ class JUCE_API Button : public Component, | |||
| { | |||
| protected: | |||
| Button (const String& buttonName); | |||
| explicit Button (const String& buttonName); | |||
| public: | |||
| virtual ~Button(); | |||
| @@ -16105,7 +16126,7 @@ class JUCE_API Viewport : public Component, | |||
| { | |||
| public: | |||
| Viewport (const String& componentName = String::empty); | |||
| explicit Viewport (const String& componentName = String::empty); | |||
| ~Viewport(); | |||
| @@ -16401,8 +16422,8 @@ class JUCE_API TextEditor : public Component, | |||
| { | |||
| public: | |||
| TextEditor (const String& componentName = String::empty, | |||
| tchar passwordCharacter = 0); | |||
| explicit TextEditor (const String& componentName = String::empty, | |||
| tchar passwordCharacter = 0); | |||
| virtual ~TextEditor(); | |||
| @@ -16821,7 +16842,7 @@ class JUCE_API ComboBox : public Component, | |||
| { | |||
| public: | |||
| ComboBox (const String& componentName); | |||
| explicit ComboBox (const String& componentName); | |||
| ~ComboBox(); | |||
| @@ -17194,6 +17215,11 @@ public: | |||
| static void deinterleaveSamples (const float* source, float** dest, | |||
| int numSamples, int numChannels); | |||
| private: | |||
| AudioDataConverters(); | |||
| AudioDataConverters (const AudioDataConverters&); | |||
| AudioDataConverters& operator= (const AudioDataConverters&); | |||
| }; | |||
| #endif // __JUCE_AUDIODATACONVERTERS_JUCEHEADER__ | |||
| @@ -20015,7 +20041,7 @@ class JUCE_API ImageButton : public Button | |||
| { | |||
| public: | |||
| ImageButton (const String& name); | |||
| explicit ImageButton (const String& name); | |||
| ~ImageButton(); | |||
| @@ -20979,7 +21005,7 @@ class JUCE_API ProgressBar : public Component, | |||
| { | |||
| public: | |||
| ProgressBar (double& progress); | |||
| explicit ProgressBar (double& progress); | |||
| ~ProgressBar(); | |||
| @@ -21058,7 +21084,7 @@ class JUCE_API Slider : public Component, | |||
| { | |||
| public: | |||
| Slider (const String& componentName); | |||
| explicit Slider (const String& componentName); | |||
| ~Slider(); | |||
| @@ -23481,7 +23507,7 @@ class JUCE_API KeyPressMappingSet : public KeyListener, | |||
| { | |||
| public: | |||
| KeyPressMappingSet (ApplicationCommandManager* commandManager) throw(); | |||
| explicit KeyPressMappingSet (ApplicationCommandManager* commandManager) throw(); | |||
| KeyPressMappingSet (const KeyPressMappingSet& other) throw(); | |||
| @@ -23873,7 +23899,7 @@ class JUCE_API TabbedComponent : public Component | |||
| { | |||
| public: | |||
| TabbedComponent (const TabbedButtonBar::Orientation orientation); | |||
| explicit TabbedComponent (const TabbedButtonBar::Orientation orientation); | |||
| ~TabbedComponent(); | |||
| @@ -25349,7 +25375,7 @@ public: | |||
| { | |||
| } | |||
| SelectedItemSet (const Array <SelectableItemType>& items) | |||
| explicit SelectedItemSet (const Array <SelectableItemType>& items) | |||
| : selectedItems (items) | |||
| { | |||
| } | |||
| @@ -25531,7 +25557,7 @@ class LassoComponent : public Component | |||
| { | |||
| public: | |||
| LassoComponent (const int outlineThickness_ = 1) | |||
| explicit LassoComponent (const int outlineThickness_ = 1) | |||
| : source (0), | |||
| outlineThickness (outlineThickness_) | |||
| { | |||
| @@ -26960,7 +26986,7 @@ class JUCE_API WebBrowserComponent : public Component | |||
| { | |||
| public: | |||
| WebBrowserComponent (bool unloadPageWhenBrowserIsHidden = true); | |||
| explicit WebBrowserComponent (bool unloadPageWhenBrowserIsHidden = true); | |||
| ~WebBrowserComponent(); | |||
| @@ -48,7 +48,7 @@ | |||
| struct JUCE_API ApplicationCommandInfo | |||
| { | |||
| //============================================================================== | |||
| ApplicationCommandInfo (CommandID commandID) throw(); | |||
| explicit ApplicationCommandInfo (CommandID commandID) throw(); | |||
| //============================================================================== | |||
| /** Sets a number of the structures values at once. | |||
| @@ -49,7 +49,7 @@ public: | |||
| The maxNumThumbsToStore parameter lets you specify how many previews should | |||
| be kept in memory at once. | |||
| */ | |||
| AudioThumbnailCache (int maxNumThumbsToStore); | |||
| explicit AudioThumbnailCache (int maxNumThumbsToStore); | |||
| /** Destructor. */ | |||
| ~AudioThumbnailCache(); | |||
| @@ -132,7 +132,7 @@ public: | |||
| virtual ~AudioIODeviceType(); | |||
| protected: | |||
| AudioIODeviceType (const String& typeName); | |||
| explicit AudioIODeviceType (const String& typeName); | |||
| private: | |||
| String typeName; | |||
| @@ -177,7 +177,7 @@ protected: | |||
| String name; | |||
| void* internal; | |||
| MidiInput (const String& name); | |||
| explicit MidiInput (const String& name); | |||
| private: | |||
| MidiInput (const MidiInput&); | |||
| @@ -87,6 +87,11 @@ public: | |||
| static void deinterleaveSamples (const float* source, float** dest, | |||
| int numSamples, int numChannels); | |||
| private: | |||
| AudioDataConverters(); | |||
| AudioDataConverters (const AudioDataConverters&); | |||
| AudioDataConverters& operator= (const AudioDataConverters&); | |||
| }; | |||
| @@ -66,6 +66,26 @@ MidiBuffer::~MidiBuffer() throw() | |||
| { | |||
| } | |||
| inline uint8* MidiBuffer::getData() const throw() | |||
| { | |||
| return static_cast <uint8*> (data.getData()); | |||
| } | |||
| inline int MidiBuffer::getEventTime (const void* const d) throw() | |||
| { | |||
| return *static_cast <const int*> (d); | |||
| } | |||
| inline uint16 MidiBuffer::getEventDataSize (const void* const d) throw() | |||
| { | |||
| return *reinterpret_cast <const uint16*> (static_cast <const char*> (d) + sizeof (int)); | |||
| } | |||
| inline uint16 MidiBuffer::getEventTotalSize (const void* const d) throw() | |||
| { | |||
| return getEventDataSize (d) + sizeof (int) + sizeof (uint16); | |||
| } | |||
| void MidiBuffer::clear() throw() | |||
| { | |||
| bytesUsed = 0; | |||
| @@ -133,23 +153,23 @@ void MidiBuffer::addEvent (const uint8* const newData, | |||
| if (numBytes > 0) | |||
| { | |||
| int spaceNeeded = bytesUsed + numBytes + 6; | |||
| int spaceNeeded = bytesUsed + numBytes + sizeof (int) + sizeof (uint16); | |||
| data.ensureSize ((spaceNeeded + spaceNeeded / 2 + 8) & ~7); | |||
| uint8* d = findEventAfter (getData(), sampleNumber); | |||
| const int bytesToMove = bytesUsed - (int) (d - getData()); | |||
| if (bytesToMove > 0) | |||
| memmove (d + numBytes + 6, d, bytesToMove); | |||
| memmove (d + numBytes + sizeof (int) + sizeof (uint16), d, bytesToMove); | |||
| *reinterpret_cast <int*> (d) = sampleNumber; | |||
| d += 4; | |||
| d += sizeof (int); | |||
| *reinterpret_cast <uint16*> (d) = (uint16) numBytes; | |||
| d += 2; | |||
| d += sizeof (uint16); | |||
| memcpy (d, newData, numBytes); | |||
| bytesUsed += numBytes + 6; | |||
| bytesUsed += numBytes + sizeof (int) + sizeof (uint16); | |||
| } | |||
| } | |||
| @@ -184,8 +204,7 @@ int MidiBuffer::getNumEvents() const throw() | |||
| while (d < end) | |||
| { | |||
| d += 4; | |||
| d += 2 + *reinterpret_cast <const uint16*> (d); | |||
| d += getEventTotalSize (d); | |||
| ++n; | |||
| } | |||
| @@ -194,7 +213,7 @@ int MidiBuffer::getNumEvents() const throw() | |||
| int MidiBuffer::getFirstEventTime() const throw() | |||
| { | |||
| return (bytesUsed > 0) ? *reinterpret_cast <const int*> (data.getData()) : 0; | |||
| return bytesUsed > 0 ? getEventTime (data.getData()) : 0; | |||
| } | |||
| int MidiBuffer::getLastEventTime() const throw() | |||
| @@ -207,10 +226,10 @@ int MidiBuffer::getLastEventTime() const throw() | |||
| for (;;) | |||
| { | |||
| const uint8* nextOne = d + 6 + *reinterpret_cast <const uint16*> (d + 4); | |||
| const uint8* const nextOne = d + getEventTotalSize (d); | |||
| if (nextOne >= endData) | |||
| return *reinterpret_cast <const int*> (d); | |||
| return getEventTime (d); | |||
| d = nextOne; | |||
| } | |||
| @@ -220,11 +239,8 @@ uint8* MidiBuffer::findEventAfter (uint8* d, const int samplePosition) const thr | |||
| { | |||
| const uint8* const endData = getData() + bytesUsed; | |||
| while (d < endData && *reinterpret_cast <const int*> (d) <= samplePosition) | |||
| { | |||
| d += 4; | |||
| d += 2 + *reinterpret_cast <const uint16*> (d); | |||
| } | |||
| while (d < endData && getEventTime (d) <= samplePosition) | |||
| d += getEventTotalSize (d); | |||
| return d; | |||
| } | |||
| @@ -246,11 +262,8 @@ void MidiBuffer::Iterator::setNextSamplePosition (const int samplePosition) thro | |||
| data = buffer.getData(); | |||
| const uint8* dataEnd = data + buffer.bytesUsed; | |||
| while (data < dataEnd && *reinterpret_cast <const int*> (data) < samplePosition) | |||
| { | |||
| data += 4; | |||
| data += 2 + *(uint16*) data; | |||
| } | |||
| while (data < dataEnd && getEventTime (data) < samplePosition) | |||
| data += getEventTotalSize (data); | |||
| } | |||
| bool MidiBuffer::Iterator::getNextEvent (const uint8* &midiData, int& numBytes, int& samplePosition) throw() | |||
| @@ -258,10 +271,9 @@ bool MidiBuffer::Iterator::getNextEvent (const uint8* &midiData, int& numBytes, | |||
| if (data >= buffer.getData() + buffer.bytesUsed) | |||
| return false; | |||
| samplePosition = *reinterpret_cast <const int*> (data); | |||
| data += 4; | |||
| numBytes = *reinterpret_cast <const uint16*> (data); | |||
| data += 2; | |||
| samplePosition = getEventTime (data); | |||
| numBytes = getEventDataSize (data); | |||
| data += sizeof (int) + sizeof (uint16); | |||
| midiData = data; | |||
| data += numBytes; | |||
| @@ -273,10 +285,9 @@ bool MidiBuffer::Iterator::getNextEvent (MidiMessage& result, int& samplePositio | |||
| if (data >= buffer.getData() + buffer.bytesUsed) | |||
| return false; | |||
| samplePosition = *reinterpret_cast <const int*> (data); | |||
| data += 4; | |||
| const int numBytes = *reinterpret_cast <const uint16*> (data); | |||
| data += 2; | |||
| samplePosition = getEventTime (data); | |||
| const int numBytes = getEventDataSize (data); | |||
| data += sizeof (int) + sizeof (uint16); | |||
| result = MidiMessage (data, numBytes, samplePosition); | |||
| data += numBytes; | |||
| @@ -47,7 +47,7 @@ public: | |||
| MidiBuffer() throw(); | |||
| /** Creates a MidiBuffer containing a single midi message. */ | |||
| MidiBuffer (const MidiMessage& message) throw(); | |||
| explicit MidiBuffer (const MidiMessage& message) throw(); | |||
| /** Creates a copy of another MidiBuffer. */ | |||
| MidiBuffer (const MidiBuffer& other) throw(); | |||
| @@ -229,8 +229,11 @@ private: | |||
| MemoryBlock data; | |||
| int bytesUsed; | |||
| uint8* getData() const throw() { return reinterpret_cast <uint8*> (data.getData()); } | |||
| uint8* getData() const throw(); | |||
| uint8* findEventAfter (uint8* d, const int samplePosition) const throw(); | |||
| static int getEventTime (const void* d) throw(); | |||
| static uint16 getEventDataSize (const void* d) throw(); | |||
| static uint16 getEventTotalSize (const void* d) throw(); | |||
| }; | |||
| @@ -78,26 +78,24 @@ int MidiMessage::getMessageLengthFromFirstByte (const uint8 firstByte) throw() | |||
| //============================================================================== | |||
| MidiMessage::MidiMessage (const void* const d, const int dataSize, const double t) | |||
| : timeStamp (t), | |||
| message (0), | |||
| size (dataSize) | |||
| { | |||
| jassert (dataSize > 0); | |||
| if (dataSize <= 4) | |||
| data = (uint8*) &message; | |||
| data = static_cast<uint8*> (preallocatedData.asBytes); | |||
| else | |||
| data = (uint8*) juce_malloc (dataSize); | |||
| data = static_cast<uint8*> (juce_malloc (dataSize)); | |||
| memcpy (data, d, dataSize); | |||
| // check that the length matches the data.. | |||
| jassert (size > 3 || *reinterpret_cast<const uint8*> (d) >= 0xf0 | |||
| || getMessageLengthFromFirstByte (*reinterpret_cast<const uint8*> (d)) == size); | |||
| jassert (size > 3 || data[0] >= 0xf0 || getMessageLengthFromFirstByte (data[0]) == size); | |||
| } | |||
| MidiMessage::MidiMessage (const int byte1, const double t) throw() | |||
| : timeStamp (t), | |||
| data ((uint8*) &message), | |||
| data (static_cast<uint8*> (preallocatedData.asBytes)), | |||
| size (1) | |||
| { | |||
| data[0] = (uint8) byte1; | |||
| @@ -108,7 +106,7 @@ MidiMessage::MidiMessage (const int byte1, const double t) throw() | |||
| MidiMessage::MidiMessage (const int byte1, const int byte2, const double t) throw() | |||
| : timeStamp (t), | |||
| data ((uint8*) &message), | |||
| data (static_cast<uint8*> (preallocatedData.asBytes)), | |||
| size (2) | |||
| { | |||
| data[0] = (uint8) byte1; | |||
| @@ -120,7 +118,7 @@ MidiMessage::MidiMessage (const int byte1, const int byte2, const double t) thro | |||
| MidiMessage::MidiMessage (const int byte1, const int byte2, const int byte3, const double t) throw() | |||
| : timeStamp (t), | |||
| data ((uint8*) &message), | |||
| data (static_cast<uint8*> (preallocatedData.asBytes)), | |||
| size (3) | |||
| { | |||
| data[0] = (uint8) byte1; | |||
| @@ -133,40 +131,39 @@ MidiMessage::MidiMessage (const int byte1, const int byte2, const int byte3, con | |||
| MidiMessage::MidiMessage (const MidiMessage& other) | |||
| : timeStamp (other.timeStamp), | |||
| message (other.message), | |||
| size (other.size) | |||
| { | |||
| if (other.data != (uint8*) &other.message) | |||
| if (other.data != static_cast <const uint8*> (other.preallocatedData.asBytes)) | |||
| { | |||
| data = (uint8*) juce_malloc (size); | |||
| data = static_cast<uint8*> (juce_malloc (size)); | |||
| memcpy (data, other.data, size); | |||
| } | |||
| else | |||
| { | |||
| data = (uint8*) &message; | |||
| data = static_cast<uint8*> (preallocatedData.asBytes); | |||
| preallocatedData.asInt32 = other.preallocatedData.asInt32; | |||
| } | |||
| } | |||
| MidiMessage::MidiMessage (const MidiMessage& other, const double newTimeStamp) | |||
| : timeStamp (newTimeStamp), | |||
| message (other.message), | |||
| size (other.size) | |||
| { | |||
| if (other.data != (uint8*) &other.message) | |||
| if (other.data != static_cast <const uint8*> (other.preallocatedData.asBytes)) | |||
| { | |||
| data = (uint8*) juce_malloc (size); | |||
| data = static_cast<uint8*> (juce_malloc (size)); | |||
| memcpy (data, other.data, size); | |||
| } | |||
| else | |||
| { | |||
| data = (uint8*) &message; | |||
| data = static_cast<uint8*> (preallocatedData.asBytes); | |||
| preallocatedData.asInt32 = other.preallocatedData.asInt32; | |||
| } | |||
| } | |||
| MidiMessage::MidiMessage (const void* src_, int sz, int& numBytesUsed, const uint8 lastStatusByte, double t) | |||
| : timeStamp (t), | |||
| data ((uint8*) &message), | |||
| message (0) | |||
| data (static_cast<uint8*> (preallocatedData.asBytes)) | |||
| { | |||
| const uint8* src = static_cast <const uint8*> (src_); | |||
| unsigned int byte = (unsigned int) *src; | |||
| @@ -204,7 +201,7 @@ MidiMessage::MidiMessage (const void* src_, int sz, int& numBytesUsed, const uin | |||
| size = 1 + (int) (d - src); | |||
| data = (uint8*) juce_malloc (size); | |||
| data = static_cast<uint8*> (juce_malloc (size)); | |||
| *data = (uint8) byte; | |||
| memcpy (data + 1, src, size - 1); | |||
| } | |||
| @@ -214,14 +211,15 @@ MidiMessage::MidiMessage (const void* src_, int sz, int& numBytesUsed, const uin | |||
| const int bytesLeft = readVariableLengthVal (src + 1, n); | |||
| size = jmin (sz + 1, n + 2 + bytesLeft); | |||
| data = (uint8*) juce_malloc (size); | |||
| data = static_cast<uint8*> (juce_malloc (size)); | |||
| *data = (uint8) byte; | |||
| memcpy (data + 1, src, size - 1); | |||
| } | |||
| else | |||
| { | |||
| preallocatedData.asInt32 = 0; | |||
| size = getMessageLengthFromFirstByte ((uint8) byte); | |||
| *data = (uint8) byte; | |||
| data[0] = (uint8) byte; | |||
| if (size > 1) | |||
| { | |||
| @@ -236,7 +234,7 @@ MidiMessage::MidiMessage (const void* src_, int sz, int& numBytesUsed, const uin | |||
| } | |||
| else | |||
| { | |||
| message = 0; | |||
| preallocatedData.asInt32 = 0; | |||
| size = 0; | |||
| } | |||
| } | |||
| @@ -247,19 +245,19 @@ MidiMessage& MidiMessage::operator= (const MidiMessage& other) | |||
| { | |||
| timeStamp = other.timeStamp; | |||
| size = other.size; | |||
| message = other.message; | |||
| if (data != (uint8*) &message) | |||
| if (data != static_cast <const uint8*> (preallocatedData.asBytes)) | |||
| juce_free (data); | |||
| if (other.data != (uint8*) &other.message) | |||
| if (other.data != static_cast <const uint8*> (other.preallocatedData.asBytes)) | |||
| { | |||
| data = (uint8*) juce_malloc (size); | |||
| data = static_cast<uint8*> (juce_malloc (size)); | |||
| memcpy (data, other.data, size); | |||
| } | |||
| else | |||
| { | |||
| data = (uint8*) &message; | |||
| data = static_cast<uint8*> (preallocatedData.asBytes); | |||
| preallocatedData.asInt32 = other.preallocatedData.asInt32; | |||
| } | |||
| } | |||
| @@ -268,7 +266,7 @@ MidiMessage& MidiMessage::operator= (const MidiMessage& other) | |||
| MidiMessage::~MidiMessage() | |||
| { | |||
| if (data != (uint8*) &message) | |||
| if (data != static_cast <const uint8*> (preallocatedData.asBytes)) | |||
| juce_free (data); | |||
| } | |||
| @@ -896,7 +896,13 @@ public: | |||
| private: | |||
| double timeStamp; | |||
| uint8* data; | |||
| int message, size; | |||
| int size; | |||
| union | |||
| { | |||
| uint8 asBytes[4]; | |||
| uint32 asInt32; | |||
| } preallocatedData; | |||
| }; | |||
| @@ -89,8 +89,8 @@ public: | |||
| If you want an array of zero values, you can use the calloc() method instead. | |||
| */ | |||
| HeapBlock (const size_t numElements) | |||
| : data (reinterpret_cast <ElementType*> (::juce_malloc (numElements * sizeof (ElementType)))) | |||
| explicit HeapBlock (const size_t numElements) | |||
| : data (static_cast <ElementType*> (::juce_malloc (numElements * sizeof (ElementType)))) | |||
| { | |||
| } | |||
| @@ -180,7 +180,7 @@ public: | |||
| void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) | |||
| { | |||
| ::juce_free (data); | |||
| data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * elementSize)); | |||
| data = static_cast <ElementType*> (::juce_malloc (newNumElements * elementSize)); | |||
| } | |||
| /** Allocates a specified amount of memory and clears it. | |||
| @@ -189,7 +189,7 @@ public: | |||
| void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) | |||
| { | |||
| ::juce_free (data); | |||
| data = reinterpret_cast <ElementType*> (::juce_calloc (newNumElements * elementSize)); | |||
| data = static_cast <ElementType*> (::juce_calloc (newNumElements * elementSize)); | |||
| } | |||
| /** Allocates a specified amount of memory and optionally clears it. | |||
| @@ -201,9 +201,9 @@ public: | |||
| ::juce_free (data); | |||
| if (initialiseToZero) | |||
| data = reinterpret_cast <ElementType*> (::juce_calloc (newNumElements * sizeof (ElementType))); | |||
| data = static_cast <ElementType*> (::juce_calloc (newNumElements * sizeof (ElementType))); | |||
| else | |||
| data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * sizeof (ElementType))); | |||
| data = static_cast <ElementType*> (::juce_malloc (newNumElements * sizeof (ElementType))); | |||
| } | |||
| /** Re-allocates a specified amount of memory. | |||
| @@ -214,9 +214,9 @@ public: | |||
| void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) | |||
| { | |||
| if (data == 0) | |||
| data = reinterpret_cast <ElementType*> (::juce_malloc (newNumElements * elementSize)); | |||
| data = static_cast <ElementType*> (::juce_malloc (newNumElements * elementSize)); | |||
| else | |||
| data = reinterpret_cast <ElementType*> (::juce_realloc (data, newNumElements * elementSize)); | |||
| data = static_cast <ElementType*> (::juce_realloc (data, newNumElements * elementSize)); | |||
| } | |||
| /** Frees any currently-allocated data. | |||
| @@ -77,7 +77,7 @@ public: | |||
| Like an XmlElement, each ValueTree node has a type, which you can access with | |||
| getType() and hasType(). | |||
| */ | |||
| ValueTree (const String& type); | |||
| explicit ValueTree (const String& type); | |||
| /** Creates a reference to another ValueTree. */ | |||
| ValueTree (const ValueTree& other); | |||
| @@ -65,16 +65,16 @@ public: | |||
| //============================================================================== | |||
| /** Turns 4 bytes into a little-endian integer. */ | |||
| static uint32 littleEndianInt (const char* bytes); | |||
| static uint32 littleEndianInt (const void* bytes); | |||
| /** Turns 2 bytes into a little-endian integer. */ | |||
| static uint16 littleEndianShort (const char* bytes); | |||
| static uint16 littleEndianShort (const void* bytes); | |||
| /** Turns 4 bytes into a big-endian integer. */ | |||
| static uint32 bigEndianInt (const char* bytes); | |||
| static uint32 bigEndianInt (const void* bytes); | |||
| /** Turns 2 bytes into a big-endian integer. */ | |||
| static uint16 bigEndianShort (const char* bytes); | |||
| static uint16 bigEndianShort (const void* bytes); | |||
| //============================================================================== | |||
| /** Converts 3 little-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits). */ | |||
| @@ -151,10 +151,10 @@ inline uint64 ByteOrder::swap (uint64 value) | |||
| inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return swap (v); } | |||
| inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return swap (v); } | |||
| inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return swap (v); } | |||
| inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return *reinterpret_cast <const uint32*> (bytes); } | |||
| inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return *reinterpret_cast <const uint16*> (bytes); } | |||
| inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return swap (*reinterpret_cast <const uint32*> (bytes)); } | |||
| inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return swap (*reinterpret_cast <const uint16*> (bytes)); } | |||
| inline uint32 ByteOrder::littleEndianInt (const void* const bytes) { return *static_cast <const uint32*> (bytes); } | |||
| inline uint16 ByteOrder::littleEndianShort (const void* const bytes) { return *static_cast <const uint16*> (bytes); } | |||
| inline uint32 ByteOrder::bigEndianInt (const void* const bytes) { return swap (*static_cast <const uint32*> (bytes)); } | |||
| inline uint16 ByteOrder::bigEndianShort (const void* const bytes) { return swap (*static_cast <const uint16*> (bytes)); } | |||
| inline bool ByteOrder::isBigEndian() { return false; } | |||
| #else | |||
| inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return swap (v); } | |||
| @@ -163,10 +163,10 @@ inline uint64 ByteOrder::swap (uint64 value) | |||
| inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return v; } | |||
| inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return v; } | |||
| inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return v; } | |||
| inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return swap (*reinterpret_cast <const uint32*> (bytes)); } | |||
| inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return swap (*reinterpret_cast <const uint16*> (bytes)); } | |||
| inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return *reinterpret_cast <const uint32*> (bytes); } | |||
| inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return *reinterpret_cast <const uint16*> (bytes); } | |||
| inline uint32 ByteOrder::littleEndianInt (const void* const bytes) { return swap (*static_cast <const uint32*> (bytes)); } | |||
| inline uint16 ByteOrder::littleEndianShort (const void* const bytes) { return swap (*static_cast <const uint16*> (bytes)); } | |||
| inline uint32 ByteOrder::bigEndianInt (const void* const bytes) { return *static_cast <const uint32*> (bytes); } | |||
| inline uint16 ByteOrder::bigEndianShort (const void* const bytes) { return *static_cast <const uint16*> (bytes); } | |||
| inline bool ByteOrder::isBigEndian() { return true; } | |||
| #endif | |||
| @@ -45,7 +45,7 @@ public: | |||
| new Random (Time::currentTimeMillis()) | |||
| */ | |||
| Random (int64 seedValue) throw(); | |||
| explicit Random (int64 seedValue) throw(); | |||
| /** Destructor. */ | |||
| ~Random() throw(); | |||
| @@ -55,7 +55,7 @@ public: | |||
| //============================================================================== | |||
| /** Creates a checksum for a block of binary data. */ | |||
| MD5 (const MemoryBlock& data); | |||
| explicit MD5 (const MemoryBlock& data); | |||
| /** Creates a checksum for a block of binary data. */ | |||
| MD5 (const char* data, const size_t numBytes); | |||
| @@ -68,7 +68,7 @@ public: | |||
| of this method with a checksum created by a different framework, which may have | |||
| used a different encoding. | |||
| */ | |||
| MD5 (const String& text); | |||
| explicit MD5 (const String& text); | |||
| /** Creates a checksum for the input from a stream. | |||
| @@ -79,7 +79,7 @@ public: | |||
| MD5 (InputStream& input, int64 numBytesToRead = -1); | |||
| /** Creates a checksum for a file. */ | |||
| MD5 (const File& file); | |||
| explicit MD5 (const File& file); | |||
| /** Destructor. */ | |||
| ~MD5(); | |||
| @@ -64,6 +64,12 @@ public: | |||
| safe value might be anything over about 20-30. | |||
| */ | |||
| static bool isProbablyPrime (const BigInteger& number, int certainty); | |||
| private: | |||
| Primes(); | |||
| Primes (const Primes&); | |||
| Primes& operator= (const Primes&); | |||
| }; | |||
| @@ -50,7 +50,7 @@ public: | |||
| This reloads a key from a string created by the toString() method. | |||
| */ | |||
| RSAKey (const String& stringRepresentation); | |||
| explicit RSAKey (const String& stringRepresentation); | |||
| /** Destructor. */ | |||
| ~RSAKey(); | |||
| @@ -79,7 +79,7 @@ protected: | |||
| initially set to this string, but these can be changed later | |||
| using the setName() and setButtonText() methods) | |||
| */ | |||
| Button (const String& buttonName); | |||
| explicit Button (const String& buttonName); | |||
| public: | |||
| /** Destructor. */ | |||
| @@ -49,7 +49,7 @@ public: | |||
| @param name the name to give the component | |||
| */ | |||
| ImageButton (const String& name); | |||
| explicit ImageButton (const String& name); | |||
| /** Destructor. */ | |||
| ~ImageButton(); | |||
| @@ -84,7 +84,7 @@ public: | |||
| @param componentName the name to set for the component (see Component::setName()) | |||
| */ | |||
| ComboBox (const String& componentName); | |||
| explicit ComboBox (const String& componentName); | |||
| /** Destructor. */ | |||
| ~ComboBox(); | |||
| @@ -59,7 +59,7 @@ public: | |||
| you'd better be careful not to delete this variable while the | |||
| ProgressBar still exists! | |||
| */ | |||
| ProgressBar (double& progress); | |||
| explicit ProgressBar (double& progress); | |||
| /** Destructor. */ | |||
| ~ProgressBar(); | |||
| @@ -68,7 +68,7 @@ public: | |||
| When created, you'll need to set up the slider's style and range with setSliderStyle(), | |||
| setRange(), etc. | |||
| */ | |||
| Slider (const String& componentName); | |||
| explicit Slider (const String& componentName); | |||
| /** Destructor. */ | |||
| ~Slider(); | |||
| @@ -89,8 +89,8 @@ public: | |||
| for a black splodge (not all fonts include this, though), or 0x2022, | |||
| which is a bullet (probably the best choice for linux). | |||
| */ | |||
| TextEditor (const String& componentName = String::empty, | |||
| tchar passwordCharacter = 0); | |||
| explicit TextEditor (const String& componentName = String::empty, | |||
| tchar passwordCharacter = 0); | |||
| /** Destructor. */ | |||
| virtual ~TextEditor(); | |||
| @@ -81,7 +81,7 @@ public: | |||
| @see getName, setName | |||
| */ | |||
| Component (const String& componentName); | |||
| explicit Component (const String& componentName); | |||
| /** Returns the name of this component. | |||
| @@ -107,7 +107,7 @@ public: | |||
| @see ApplicationCommandManager | |||
| */ | |||
| KeyPressMappingSet (ApplicationCommandManager* commandManager) throw(); | |||
| explicit KeyPressMappingSet (ApplicationCommandManager* commandManager) throw(); | |||
| /** Creates an copy of a KeyPressMappingSet. */ | |||
| KeyPressMappingSet (const KeyPressMappingSet& other) throw(); | |||
| @@ -47,7 +47,7 @@ public: | |||
| Once created, add some tabs with the addTab() method. | |||
| */ | |||
| TabbedComponent (const TabbedButtonBar::Orientation orientation); | |||
| explicit TabbedComponent (const TabbedButtonBar::Orientation orientation); | |||
| /** Destructor. */ | |||
| ~TabbedComponent(); | |||
| @@ -53,7 +53,7 @@ public: | |||
| The viewport is initially empty - use the setViewedComponent() method to | |||
| add a child component for it to manage. | |||
| */ | |||
| Viewport (const String& componentName = String::empty); | |||
| explicit Viewport (const String& componentName = String::empty); | |||
| /** Destructor. */ | |||
| ~Viewport(); | |||
| @@ -106,7 +106,7 @@ public: | |||
| The fill colour is used to fill the lasso'ed rectangle, and the outline | |||
| colour is used to draw a line around its edge. | |||
| */ | |||
| LassoComponent (const int outlineThickness_ = 1) | |||
| explicit LassoComponent (const int outlineThickness_ = 1) | |||
| : source (0), | |||
| outlineThickness (outlineThickness_) | |||
| { | |||
| @@ -56,7 +56,7 @@ public: | |||
| the browser using resources in the background when it's not | |||
| actually being used. | |||
| */ | |||
| WebBrowserComponent (bool unloadPageWhenBrowserIsHidden = true); | |||
| explicit WebBrowserComponent (bool unloadPageWhenBrowserIsHidden = true); | |||
| /** Destructor. */ | |||
| ~WebBrowserComponent(); | |||
| @@ -67,8 +67,8 @@ public: | |||
| @see TooltipClient, LookAndFeel::drawTooltip, LookAndFeel::getTooltipSize | |||
| */ | |||
| TooltipWindow (Component* parentComponent = 0, | |||
| int millisecondsBeforeTipAppears = 700); | |||
| explicit TooltipWindow (Component* parentComponent = 0, | |||
| int millisecondsBeforeTipAppears = 700); | |||
| /** Destructor. */ | |||
| ~TooltipWindow(); | |||
| @@ -546,6 +546,10 @@ public: | |||
| { | |||
| } | |||
| //============================================================================== | |||
| /** The indexes of the different components in the byte layout of this type of colour. */ | |||
| enum { indexA = 0 }; | |||
| private: | |||
| //============================================================================== | |||
| uint8 a : 8; | |||
| @@ -64,7 +64,7 @@ public: | |||
| Obviously you shouldn't delete the image before this context is deleted. | |||
| */ | |||
| Graphics (Image& imageToDrawOnto) throw(); | |||
| explicit Graphics (Image& imageToDrawOnto) throw(); | |||
| /** Destructor. */ | |||
| ~Graphics() throw(); | |||
| @@ -586,11 +586,9 @@ public: | |||
| y = y_; | |||
| generate (scratchBuffer, x, width); | |||
| const uint8* mask = reinterpret_cast <uint8*> (scratchBuffer.getData()); | |||
| if (sizeof (SrcPixelType) == sizeof (PixelARGB)) | |||
| mask += PixelARGB::indexA; | |||
| et.clipLineToMask (x, y_, mask, sizeof (SrcPixelType), width); | |||
| et.clipLineToMask (x, y_, | |||
| reinterpret_cast<uint8*> (scratchBuffer.getData()) + SrcPixelType::indexA, | |||
| sizeof (SrcPixelType), width); | |||
| } | |||
| private: | |||
| @@ -112,7 +112,7 @@ public: | |||
| protected: | |||
| String name; | |||
| Typeface (const String& name) throw(); | |||
| explicit Typeface (const String& name) throw(); | |||
| private: | |||
| Typeface (const Typeface&); | |||
| @@ -141,7 +141,7 @@ public: | |||
| The stream must have been created by writeToStream(). | |||
| @see writeToStream | |||
| */ | |||
| CustomTypeface (InputStream& serialisedTypefaceStream); | |||
| explicit CustomTypeface (InputStream& serialisedTypefaceStream); | |||
| /** Destructor. */ | |||
| ~CustomTypeface(); | |||
| @@ -58,7 +58,7 @@ public: | |||
| int rightGap) throw(); | |||
| /** Creates a border with the given gap on all sides. */ | |||
| BorderSize (int allGaps) throw(); | |||
| explicit BorderSize (int allGaps) throw(); | |||
| /** Destructor. */ | |||
| ~BorderSize() throw(); | |||
| @@ -45,7 +45,7 @@ public: | |||
| @param fileToRead the file to read from - if the file can't be accessed for some | |||
| reason, then the stream will just contain no data | |||
| */ | |||
| FileInputStream (const File& fileToRead); | |||
| explicit FileInputStream (const File& fileToRead); | |||
| /** Destructor. */ | |||
| ~FileInputStream(); | |||
| @@ -108,35 +108,37 @@ int InputStream::readCompressedInt() | |||
| int64 InputStream::readInt64() | |||
| { | |||
| char temp[8]; | |||
| union { uint8 asBytes[8]; uint64 asInt64; } n; | |||
| if (read (temp, 8) == 8) | |||
| return (int64) ByteOrder::swapIfBigEndian (*reinterpret_cast <uint64*> (temp)); | |||
| if (read (n.asBytes, 8) == 8) | |||
| return (int64) ByteOrder::swapIfBigEndian (n.asInt64); | |||
| return 0; | |||
| } | |||
| int64 InputStream::readInt64BigEndian() | |||
| { | |||
| char temp[8]; | |||
| union { uint8 asBytes[8]; uint64 asInt64; } n; | |||
| if (read (temp, 8) == 8) | |||
| return (int64) ByteOrder::swapIfLittleEndian (*reinterpret_cast <uint64*> (temp)); | |||
| if (read (n.asBytes, 8) == 8) | |||
| return (int64) ByteOrder::swapIfLittleEndian (n.asInt64); | |||
| return 0; | |||
| } | |||
| float InputStream::readFloat() | |||
| { | |||
| union { int asInt; float asFloat; } n; | |||
| n.asInt = readInt(); | |||
| // the union below relies on these types being the same size... | |||
| static_jassert (sizeof (int32) == sizeof (float)); | |||
| union { int32 asInt; float asFloat; } n; | |||
| n.asInt = (int32) readInt(); | |||
| return n.asFloat; | |||
| } | |||
| float InputStream::readFloatBigEndian() | |||
| { | |||
| union { int asInt; float asFloat; } n; | |||
| n.asInt = readIntBigEndian(); | |||
| union { int32 asInt; float asFloat; } n; | |||
| n.asInt = (int32) readIntBigEndian(); | |||
| return n.asFloat; | |||
| } | |||
| @@ -234,7 +234,7 @@ public: | |||
| if (isInterleaved) | |||
| { | |||
| scratch.ensureSize (sizeof (float) * numSamples * numChannelsRunning, false); | |||
| float* interleaved = reinterpret_cast <float*> (scratch.getData()); | |||
| float* interleaved = static_cast <float*> (scratch.getData()); | |||
| AudioDataConverters::interleaveSamples ((const float**) data, interleaved, numSamples, numChannelsRunning); | |||
| AudioDataConverters::convertFloatToFormat (sampleFormat, interleaved, interleaved, numSamples * numChannelsRunning); | |||
| @@ -272,7 +272,7 @@ public: | |||
| if (isInterleaved) | |||
| { | |||
| scratch.ensureSize (sizeof (float) * numSamples * numChannelsRunning, false); | |||
| float* interleaved = reinterpret_cast <float*> (scratch.getData()); | |||
| float* interleaved = static_cast <float*> (scratch.getData()); | |||
| snd_pcm_sframes_t num = snd_pcm_readi (handle, (void*) interleaved, numSamples); | |||
| @@ -1114,15 +1114,15 @@ public: | |||
| const int width = image.getWidth(); | |||
| const int height = image.getHeight(); | |||
| HeapBlock <uint32> colour (width * height); | |||
| HeapBlock <char> colour (width * height); | |||
| int index = 0; | |||
| for (int y = 0; y < height; ++y) | |||
| for (int x = 0; x < width; ++x) | |||
| colour[index++] = image.getPixelAt (x, y).getARGB(); | |||
| colour[index++] = static_cast<char> (image.getPixelAt (x, y).getARGB()); | |||
| XImage* ximage = XCreateImage (display, CopyFromParent, 24, ZPixmap, | |||
| 0, reinterpret_cast<char*> (colour.getData()), | |||
| 0, colour.getData(), | |||
| width, height, 32, 0); | |||
| Pixmap pixmap = XCreatePixmap (display, DefaultRootWindow (display), | |||
| @@ -1142,7 +1142,7 @@ public: | |||
| const int width = image.getWidth(); | |||
| const int height = image.getHeight(); | |||
| const int stride = (width + 7) >> 3; | |||
| HeapBlock <uint8> mask; | |||
| HeapBlock <char> mask; | |||
| mask.calloc (stride * height); | |||
| const bool msbfirst = (BitmapBitOrder (display) == MSBFirst); | |||
| @@ -1150,7 +1150,7 @@ public: | |||
| { | |||
| for (int x = 0; x < width; ++x) | |||
| { | |||
| const uint8 bit = (uint8) (1 << (msbfirst ? (7 - (x & 7)) : (x & 7))); | |||
| const char bit = (char) (1 << (msbfirst ? (7 - (x & 7)) : (x & 7))); | |||
| const int offset = y * stride + (x >> 3); | |||
| if (image.getPixelAt (x, y).getAlpha() >= 128) | |||
| @@ -1159,7 +1159,7 @@ public: | |||
| } | |||
| return XCreatePixmapFromBitmapData (display, DefaultRootWindow (display), | |||
| reinterpret_cast<char*> (mask.getData()), width, height, 1, 0, 1); | |||
| mask.getData(), width, height, 1, 0, 1); | |||
| } | |||
| void setIcon (const Image& newIcon) | |||
| @@ -3027,7 +3027,7 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot | |||
| } | |||
| const int stride = (cursorW + 7) >> 3; | |||
| HeapBlock <uint8> maskPlane, sourcePlane; | |||
| HeapBlock <char> maskPlane, sourcePlane; | |||
| maskPlane.calloc (stride * cursorH); | |||
| sourcePlane.calloc (stride * cursorH); | |||
| @@ -3037,7 +3037,7 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot | |||
| { | |||
| for (int x = cursorW; --x >= 0;) | |||
| { | |||
| const uint8 mask = (uint8) (1 << (msbfirst ? (7 - (x & 7)) : (x & 7))); | |||
| const char mask = (char) (1 << (msbfirst ? (7 - (x & 7)) : (x & 7))); | |||
| const int offset = y * stride + (x >> 3); | |||
| const Colour c (im.getPixelAt (x, y)); | |||
| @@ -3050,8 +3050,8 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot | |||
| } | |||
| } | |||
| Pixmap sourcePixmap = XCreatePixmapFromBitmapData (display, root, reinterpret_cast <char*> (sourcePlane.getData()), cursorW, cursorH, 0xffff, 0, 1); | |||
| Pixmap maskPixmap = XCreatePixmapFromBitmapData (display, root, reinterpret_cast <char*> (maskPlane.getData()), cursorW, cursorH, 0xffff, 0, 1); | |||
| Pixmap sourcePixmap = XCreatePixmapFromBitmapData (display, root, sourcePlane.getData(), cursorW, cursorH, 0xffff, 0, 1); | |||
| Pixmap maskPixmap = XCreatePixmapFromBitmapData (display, root, maskPlane.getData(), cursorW, cursorH, 0xffff, 0, 1); | |||
| XColor white, black; | |||
| black.red = black.green = black.blue = 0; | |||
| @@ -161,7 +161,7 @@ static const String getConnectedEndpointName (MIDIEndpointRef endpoint) | |||
| if (s.isNotEmpty()) | |||
| { | |||
| if (result.isNotEmpty()) | |||
| result += (", "); | |||
| result += ", "; | |||
| result += s; | |||
| } | |||
| @@ -213,7 +213,7 @@ void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* call | |||
| static BOOL CALLBACK BroadcastEnumWindowProc (HWND hwnd, LPARAM lParam) | |||
| { | |||
| if (hwnd != juce_messageWindowHandle) | |||
| (reinterpret_cast <VoidArray*> (lParam))->add ((void*) hwnd); | |||
| reinterpret_cast <VoidArray*> (lParam)->add ((void*) hwnd); | |||
| return TRUE; | |||
| } | |||
| @@ -138,10 +138,10 @@ public: | |||
| static StringHolder empty; | |||
| private: | |||
| static inline StringHolder* bufferFromText (juce_wchar* const text) throw() | |||
| static inline StringHolder* bufferFromText (void* const text) throw() | |||
| { | |||
| // (Can't use offsetof() here because of warnings about this not being a POD) | |||
| return reinterpret_cast <StringHolder*> (reinterpret_cast <char*> (text) | |||
| return reinterpret_cast <StringHolder*> (static_cast <char*> (text) | |||
| - (reinterpret_cast <size_t> (reinterpret_cast <StringHolder*> (1)->text) - 1)); | |||
| } | |||
| }; | |||
| @@ -1364,9 +1364,7 @@ const String String::substring (int start, int end) const | |||
| return empty; | |||
| int len = 0; | |||
| const juce_wchar* const t = text; | |||
| while (len <= end && t [len] != 0) | |||
| while (len <= end && text [len] != 0) | |||
| ++len; | |||
| if (end >= len) | |||
| @@ -1389,8 +1387,8 @@ const String String::substring (const int start) const | |||
| if (start >= len) | |||
| return empty; | |||
| else | |||
| return String (text + start, len - start); | |||
| return String (text + start, len - start); | |||
| } | |||
| const String String::dropLastCharacters (const int numberToDrop) const | |||
| @@ -1409,11 +1407,10 @@ const String String::fromFirstOccurrenceOf (const String& sub, | |||
| { | |||
| const int i = ignoreCase ? indexOfIgnoreCase (sub) | |||
| : indexOf (sub); | |||
| if (i < 0) | |||
| return empty; | |||
| else | |||
| return substring (includeSubString ? i : i + sub.length()); | |||
| return substring (includeSubString ? i : i + sub.length()); | |||
| } | |||
| const String String::fromLastOccurrenceOf (const String& sub, | |||
| @@ -1422,7 +1419,6 @@ const String String::fromLastOccurrenceOf (const String& sub, | |||
| { | |||
| const int i = ignoreCase ? lastIndexOfIgnoreCase (sub) | |||
| : lastIndexOf (sub); | |||
| if (i < 0) | |||
| return *this; | |||
| @@ -1435,7 +1431,6 @@ const String String::upToFirstOccurrenceOf (const String& sub, | |||
| { | |||
| const int i = ignoreCase ? indexOfIgnoreCase (sub) | |||
| : indexOf (sub); | |||
| if (i < 0) | |||
| return *this; | |||
| @@ -1517,8 +1512,8 @@ const String String::trim() const | |||
| return empty; | |||
| else if (start > 0 || end < len) | |||
| return String (text + start, end - start); | |||
| else | |||
| return *this; | |||
| return *this; | |||
| } | |||
| const String String::trimStart() const | |||
| @@ -1533,8 +1528,8 @@ const String String::trimStart() const | |||
| if (t == text) | |||
| return *this; | |||
| else | |||
| return String (t); | |||
| return String (t); | |||
| } | |||
| const String String::trimEnd() const | |||
| @@ -1552,9 +1547,6 @@ const String String::trimEnd() const | |||
| const String String::trimCharactersAtStart (const String& charactersToTrim) const | |||
| { | |||
| if (isEmpty()) | |||
| return empty; | |||
| const juce_wchar* t = text; | |||
| while (charactersToTrim.containsChar (*t)) | |||
| @@ -1562,8 +1554,8 @@ const String String::trimCharactersAtStart (const String& charactersToTrim) cons | |||
| if (t == text) | |||
| return *this; | |||
| else | |||
| return String (t); | |||
| return String (t); | |||
| } | |||
| const String String::trimCharactersAtEnd (const String& charactersToTrim) const | |||
| @@ -1624,7 +1616,17 @@ const String String::removeCharacters (const String& charactersToRemove) const | |||
| const String String::initialSectionContainingOnly (const String& permittedCharacters) const | |||
| { | |||
| return substring (0, CharacterFunctions::getIntialSectionContainingOnly (text, permittedCharacters.text)); | |||
| int i = 0; | |||
| for (;;) | |||
| { | |||
| if (! permittedCharacters.containsChar (text[i])) | |||
| break; | |||
| ++i; | |||
| } | |||
| return substring (0, i); | |||
| } | |||
| const String String::initialSectionNotContaining (const String& charactersToStopAt) const | |||
| @@ -1940,7 +1942,7 @@ const char* String::toUTF8() const | |||
| String* const mutableThis = const_cast <String*> (this); | |||
| mutableThis->text = StringHolder::makeUniqueWithSize (mutableThis->text, currentLen + 1 + utf8BytesNeeded / sizeof (juce_wchar)); | |||
| char* const otherCopy = (char*) (text + currentLen); | |||
| char* const otherCopy = reinterpret_cast <char*> (text + currentLen); | |||
| copyToUTF8 (otherCopy, std::numeric_limits<int>::max()); | |||
| return otherCopy; | |||
| @@ -2128,12 +2130,11 @@ const char* String::toCString() const | |||
| } | |||
| else | |||
| { | |||
| int len = length(); | |||
| const int len = length(); | |||
| String* const mutableThis = const_cast <String*> (this); | |||
| mutableThis->text = StringHolder::makeUniqueWithSize (mutableThis->text, (len + 1) * 2); | |||
| char* otherCopy = (char*) (text + len + 1); | |||
| char* otherCopy = reinterpret_cast <char*> (text + len + 1); | |||
| CharacterFunctions::copy (otherCopy, text, len); | |||
| otherCopy [len] = 0; | |||
| return otherCopy; | |||
| @@ -145,7 +145,7 @@ class JUCE_API XmlElement | |||
| public: | |||
| //============================================================================== | |||
| /** Creates an XmlElement with this tag name. */ | |||
| XmlElement (const String& tagName) throw(); | |||
| explicit XmlElement (const String& tagName) throw(); | |||
| /** Creates a (deep) copy of another element. */ | |||
| XmlElement (const XmlElement& other) throw(); | |||
| @@ -43,7 +43,7 @@ public: | |||
| @param name a name that processes will use to identify this lock object | |||
| */ | |||
| InterProcessLock (const String& name); | |||
| explicit InterProcessLock (const String& name); | |||
| /** Destructor. | |||
| @@ -91,6 +91,12 @@ public: | |||
| /** Returns true if this process is being hosted by a debugger. | |||
| */ | |||
| static bool JUCE_CALLTYPE isRunningUnderDebugger(); | |||
| private: | |||
| Process(); | |||
| Process (const Process&); | |||
| Process& operator= (const Process&); | |||
| }; | |||
| @@ -66,7 +66,7 @@ public: | |||
| otherwise there are no guarantees what will happen! Best just to use it | |||
| as a local stack object, rather than creating one with the new() operator. | |||
| */ | |||
| inline ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); } | |||
| inline explicit ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); } | |||
| /** Destructor. | |||
| @@ -75,7 +75,7 @@ public: | |||
| Make sure this object is created and deleted by the same thread, | |||
| otherwise there are no guarantees what will happen! | |||
| */ | |||
| inline ~ScopedLock() throw() { lock_.exit(); } | |||
| inline ~ScopedLock() throw() { lock_.exit(); } | |||
| private: | |||
| @@ -139,7 +139,7 @@ public: | |||
| otherwise there are no guarantees what will happen! Best just to use it | |||
| as a local stack object, rather than creating one with the new() operator. | |||
| */ | |||
| inline ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); } | |||
| inline explicit ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); } | |||
| /** Destructor. | |||
| @@ -148,7 +148,7 @@ public: | |||
| Make sure this object is created and deleted by the same thread, | |||
| otherwise there are no guarantees what will happen! | |||
| */ | |||
| inline ~ScopedUnlock() throw() { lock_.enter(); } | |||
| inline ~ScopedUnlock() throw() { lock_.enter(); } | |||
| private: | |||
| @@ -66,7 +66,7 @@ public: | |||
| otherwise there are no guarantees what will happen! Best just to use it | |||
| as a local stack object, rather than creating one with the new() operator. | |||
| */ | |||
| inline ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); } | |||
| inline explicit ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); } | |||
| /** Destructor. | |||
| @@ -75,7 +75,7 @@ public: | |||
| Make sure this object is created and deleted by the same thread, | |||
| otherwise there are no guarantees what will happen! | |||
| */ | |||
| inline ~ScopedReadLock() throw() { lock_.exitRead(); } | |||
| inline ~ScopedReadLock() throw() { lock_.exitRead(); } | |||
| private: | |||
| @@ -75,7 +75,7 @@ public: | |||
| otherwise there are no guarantees what will happen! Best just to use it | |||
| as a local stack object, rather than creating one with the new() operator. | |||
| */ | |||
| inline ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {} | |||
| inline explicit ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {} | |||
| /** Destructor. | |||
| @@ -84,13 +84,13 @@ public: | |||
| Make sure this object is created and deleted by the same thread, | |||
| otherwise there are no guarantees what will happen! | |||
| */ | |||
| inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); } | |||
| inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); } | |||
| /** Lock state | |||
| @return True if the CriticalSection is locked. | |||
| */ | |||
| bool isLocked() const throw() { return lockWasSuccessful; } | |||
| bool isLocked() const throw() { return lockWasSuccessful; } | |||
| private: | |||
| //============================================================================== | |||
| @@ -66,7 +66,7 @@ public: | |||
| otherwise there are no guarantees what will happen! Best just to use it | |||
| as a local stack object, rather than creating one with the new() operator. | |||
| */ | |||
| inline ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); } | |||
| inline explicit ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); } | |||
| /** Destructor. | |||
| @@ -75,7 +75,7 @@ public: | |||
| Make sure this object is created and deleted by the same thread, | |||
| otherwise there are no guarantees what will happen! | |||
| */ | |||
| inline ~ScopedWriteLock() throw() { lock_.exitWrite(); } | |||
| inline ~ScopedWriteLock() throw() { lock_.exitWrite(); } | |||
| private: | |||
| @@ -55,7 +55,7 @@ public: | |||
| When first created, the thread is not running. Use the startThread() | |||
| method to start it. | |||
| */ | |||
| Thread (const String& threadName); | |||
| explicit Thread (const String& threadName); | |||
| /** Destructor. | |||
| @@ -200,6 +200,8 @@ public: | |||
| This puts the thread to sleep until either the timeout period expires, or | |||
| another thread calls the notify() method to wake it up. | |||
| A negative time-out value means that the method will wait indefinitely. | |||
| @returns true if the event has been signalled, false if the timeout expires. | |||
| */ | |||
| bool wait (int timeOutMilliseconds) const; | |||
| @@ -57,7 +57,7 @@ public: | |||
| After creating your job, add it to a thread pool with ThreadPool::addJob(). | |||
| */ | |||
| ThreadPoolJob (const String& name); | |||
| explicit ThreadPoolJob (const String& name); | |||
| /** Destructor. */ | |||
| virtual ~ThreadPoolJob(); | |||
| @@ -83,7 +83,7 @@ public: | |||
| When first created, the thread is not running. Use the startThread() | |||
| method to start it. | |||
| */ | |||
| TimeSliceThread (const String& threadName); | |||
| explicit TimeSliceThread (const String& threadName); | |||
| /** Destructor. | |||
| @@ -55,7 +55,7 @@ public: | |||
| } | |||
| /** Creates a set based on an array of items. */ | |||
| SelectedItemSet (const Array <SelectableItemType>& items) | |||
| explicit SelectedItemSet (const Array <SelectableItemType>& items) | |||
| : selectedItems (items) | |||
| { | |||
| } | |||