From 59ac5a6d258b2fe7a98459d8b169647a78d8e58a Mon Sep 17 00:00:00 2001 From: Julian Storer Date: Wed, 3 Nov 2010 16:12:05 +0000 Subject: [PATCH] Fixed a bug in the Flac writer. Optimised BigInteger::getHighestBit(). Misc minor clean-ups. --- juce_amalgamated.cpp | 391 +++++++++--------- juce_amalgamated.h | 8 +- .../juce_FlacAudioFormat.cpp | 11 +- src/containers/juce_BigInteger.cpp | 64 ++- src/core/juce_StandardHeader.h | 2 +- src/cryptography/juce_MD5.cpp | 20 +- src/cryptography/juce_Primes.cpp | 12 +- .../juce_CPlusPlusCodeTokeniser.cpp | 30 +- .../components/controls/juce_TextEditor.cpp | 2 +- src/gui/components/juce_Component.cpp | 15 +- src/gui/components/juce_Component.h | 6 +- src/gui/components/keyboard/juce_KeyPress.cpp | 4 +- src/gui/graphics/colour/juce_Colour.cpp | 6 +- .../contexts/juce_RectanglePlacement.cpp | 64 ++- src/gui/graphics/geometry/juce_Path.cpp | 4 +- .../graphics/geometry/juce_PathStrokeType.cpp | 72 ++-- .../geometry/juce_RelativeCoordinate.cpp | 2 +- .../image_file_formats/juce_JPEGLoader.cpp | 24 +- .../image_file_formats/juce_PNGLoader.cpp | 6 +- src/io/network/juce_Socket.cpp | 29 +- src/text/juce_String.cpp | 14 +- src/text/juce_XmlElement.cpp | 12 +- 22 files changed, 400 insertions(+), 398 deletions(-) diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 07fb80db46..f7d4a8b7ce 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -2749,36 +2749,62 @@ void BigInteger::negate() throw() negative = (! negative) && ! isZero(); } +#if JUCE_USE_INTRINSICS + #pragma intrinsic (_BitScanReverse) +#endif + +namespace BitFunctions +{ + inline int countBitsInInt32 (uint32 n) throw() + { + n -= ((n >> 1) & 0x55555555); + n = (((n >> 2) & 0x33333333) + (n & 0x33333333)); + n = (((n >> 4) + n) & 0x0f0f0f0f); + n += (n >> 8); + n += (n >> 16); + return n & 0x3f; + } + + inline int highestBitInInt (uint32 n) throw() + { + jassert (n != 0); // (the built-in functions may not work for n = 0) + + #if JUCE_GCC + return 31 - __builtin_clz (n); + #elif JUCE_USE_INTRINSICS + unsigned long highest; + _BitScanReverse (&highest, n); + return (int) highest; + #else + n |= (n >> 1); + n |= (n >> 2); + n |= (n >> 4); + n |= (n >> 8); + n |= (n >> 16); + return countBitsInInt32 (n >> 1); + #endif + } +} + int BigInteger::countNumberOfSetBits() const throw() { int total = 0; for (int i = bitToIndex (highestBit) + 1; --i >= 0;) - { - uint32 n = values[i]; - - if (n == 0xffffffff) - { - total += 32; - } - else - { - while (n != 0) - { - total += (n & 1); - n >>= 1; - } - } - } + total += BitFunctions::countBitsInInt32 (values[i]); return total; } int BigInteger::getHighestBit() const throw() { - for (int i = highestBit + 1; --i >= 0;) - if ((values [bitToIndex (i)] & bitToMask (i)) != 0) - return i; + for (int i = bitToIndex (highestBit + 1); i >= 0; --i) + { + const uint32 n = values[i]; + + if (n != 0) + return BitFunctions::highestBitInInt (n) + (i << 5); + } return -1; } @@ -6003,38 +6029,38 @@ MD5::~MD5() namespace MD5Functions { - static void encode (void* const output, const void* const input, const int numBytes) throw() + void encode (void* const output, const void* const input, const int numBytes) throw() { for (int i = 0; i < (numBytes >> 2); ++i) static_cast (output)[i] = ByteOrder::swapIfBigEndian (static_cast (input) [i]); } - static inline uint32 F (const uint32 x, const uint32 y, const uint32 z) throw() { return (x & y) | (~x & z); } - static inline uint32 G (const uint32 x, const uint32 y, const uint32 z) throw() { return (x & z) | (y & ~z); } - static inline uint32 H (const uint32 x, const uint32 y, const uint32 z) throw() { return x ^ y ^ z; } - static inline uint32 I (const uint32 x, const uint32 y, const uint32 z) throw() { return y ^ (x | ~z); } + inline uint32 rotateLeft (const uint32 x, const uint32 n) throw() { return (x << n) | (x >> (32 - n)); } - static inline uint32 rotateLeft (const uint32 x, const uint32 n) throw() { return (x << n) | (x >> (32 - n)); } + inline uint32 F (const uint32 x, const uint32 y, const uint32 z) throw() { return (x & y) | (~x & z); } + inline uint32 G (const uint32 x, const uint32 y, const uint32 z) throw() { return (x & z) | (y & ~z); } + inline uint32 H (const uint32 x, const uint32 y, const uint32 z) throw() { return x ^ y ^ z; } + inline uint32 I (const uint32 x, const uint32 y, const uint32 z) throw() { return y ^ (x | ~z); } - static void FF (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() + void FF (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() { a += F (b, c, d) + x + ac; a = rotateLeft (a, s) + b; } - static void GG (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() + void GG (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() { a += G (b, c, d) + x + ac; a = rotateLeft (a, s) + b; } - static void HH (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() + void HH (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() { a += H (b, c, d) + x + ac; a = rotateLeft (a, s) + b; } - static void II (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() + void II (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() { a += I (b, c, d) + x + ac; a = rotateLeft (a, s) + b; @@ -6193,7 +6219,7 @@ BEGIN_JUCE_NAMESPACE namespace PrimesHelpers { - static void createSmallSieve (const int numBits, BigInteger& result) + void createSmallSieve (const int numBits, BigInteger& result) { result.setBit (numBits); result.clearBit (numBits); // to enlarge the array @@ -6211,8 +6237,8 @@ namespace PrimesHelpers while (n <= (numBits >> 1)); } - static void bigSieve (const BigInteger& base, const int numBits, BigInteger& result, - const BigInteger& smallSieve, const int smallSieveSize) + void bigSieve (const BigInteger& base, const int numBits, BigInteger& result, + const BigInteger& smallSieve, const int smallSieveSize) { jassert (! base[0]); // must be even! @@ -6249,8 +6275,8 @@ namespace PrimesHelpers while (index < smallSieveSize); } - static bool findCandidate (const BigInteger& base, const BigInteger& sieve, - const int numBits, BigInteger& result, const int certainty) + bool findCandidate (const BigInteger& base, const BigInteger& sieve, + const int numBits, BigInteger& result, const int certainty) { for (int i = 0; i < numBits; ++i) { @@ -6266,7 +6292,7 @@ namespace PrimesHelpers return false; } - static bool passesMillerRabin (const BigInteger& n, int iterations) + bool passesMillerRabin (const BigInteger& n, int iterations) { const BigInteger one (1), two (2); const BigInteger nMinusOne (n - one); @@ -8627,7 +8653,7 @@ void juce_shutdownWin32Sockets() namespace SocketHelpers { - static bool resetSocketOptions (const int handle, const bool isDatagram, const bool allowBroadcast) throw() + bool resetSocketOptions (const int handle, const bool isDatagram, const bool allowBroadcast) throw() { const int sndBufSize = 65536; const int rcvBufSize = 65536; @@ -8640,7 +8666,7 @@ namespace SocketHelpers : (setsockopt (handle, IPPROTO_TCP, TCP_NODELAY, (const char*) &one, sizeof (one)) == 0)); } - static bool bindSocketToPort (const int handle, const int port) throw() + bool bindSocketToPort (const int handle, const int port) throw() { if (handle <= 0 || port <= 0) return false; @@ -8654,10 +8680,10 @@ namespace SocketHelpers return bind (handle, (struct sockaddr*) &servTmpAddr, sizeof (struct sockaddr_in)) >= 0; } - static int readSocket (const int handle, - void* const destBuffer, const int maxBytesToRead, - bool volatile& connected, - const bool blockUntilSpecifiedAmountHasArrived) throw() + int readSocket (const int handle, + void* const destBuffer, const int maxBytesToRead, + bool volatile& connected, + const bool blockUntilSpecifiedAmountHasArrived) throw() { int bytesRead = 0; @@ -8692,8 +8718,7 @@ namespace SocketHelpers return bytesRead; } - static int waitForReadiness (const int handle, const bool forReading, - const int timeoutMsecs) throw() + int waitForReadiness (const int handle, const bool forReading, const int timeoutMsecs) throw() { struct timeval timeout; struct timeval* timeoutp; @@ -8750,7 +8775,7 @@ namespace SocketHelpers return 0; } - static bool setSocketBlockingState (const int handle, const bool shouldBlock) throw() + bool setSocketBlockingState (const int handle, const bool shouldBlock) throw() { #if JUCE_WINDOWS u_long nonBlocking = shouldBlock ? 0 : 1; @@ -8775,12 +8800,12 @@ namespace SocketHelpers return true; } - static bool connectSocket (int volatile& handle, - const bool isDatagram, - void** serverAddress, - const String& hostName, - const int portNumber, - const int timeOutMillisecs) throw() + bool connectSocket (int volatile& handle, + const bool isDatagram, + void** serverAddress, + const String& hostName, + const int portNumber, + const int timeOutMillisecs) throw() { struct hostent* const hostEnt = gethostbyname (hostName.toUTF8()); @@ -12013,7 +12038,7 @@ const String String::charToString (const juce_wchar character) namespace NumberToStringConverters { // pass in a pointer to the END of a buffer.. - static juce_wchar* int64ToString (juce_wchar* t, const int64 n) throw() + juce_wchar* int64ToString (juce_wchar* t, const int64 n) throw() { *--t = 0; int64 v = (n >= 0) ? n : -n; @@ -12031,7 +12056,7 @@ namespace NumberToStringConverters return t; } - static juce_wchar* uint64ToString (juce_wchar* t, int64 v) throw() + juce_wchar* uint64ToString (juce_wchar* t, int64 v) throw() { *--t = 0; @@ -12045,7 +12070,7 @@ namespace NumberToStringConverters return t; } - static juce_wchar* intToString (juce_wchar* t, const int n) throw() + juce_wchar* intToString (juce_wchar* t, const int n) throw() { if (n == (int) 0x80000000) // (would cause an overflow) return int64ToString (t, n); @@ -12066,7 +12091,7 @@ namespace NumberToStringConverters return t; } - static juce_wchar* uintToString (juce_wchar* t, unsigned int v) throw() + juce_wchar* uintToString (juce_wchar* t, unsigned int v) throw() { *--t = 0; @@ -12080,7 +12105,7 @@ namespace NumberToStringConverters return t; } - static juce_wchar getDecimalPoint() + juce_wchar getDecimalPoint() { #if JUCE_MSVC && _MSC_VER < 1400 static juce_wchar dp = std::_USE (std::locale(), std::numpunct ).decimal_point(); @@ -12090,7 +12115,7 @@ namespace NumberToStringConverters return dp; } - static juce_wchar* doubleToString (juce_wchar* buffer, int numChars, double n, int numDecPlaces, size_t& len) throw() + juce_wchar* doubleToString (juce_wchar* buffer, int numChars, double n, int numDecPlaces, size_t& len) throw() { if (numDecPlaces > 0 && n > -1.0e20 && n < 1.0e20) { @@ -12119,7 +12144,7 @@ namespace NumberToStringConverters else { #if JUCE_WINDOWS - #if JUCE_MSVC && _MSC_VER <= 1400 + #if (JUCE_MSVC && _MSC_VER <= 1400) || JUCE_MINGW len = _snwprintf (buffer, numChars, L"%.9g", n); #else len = _snwprintf_s (buffer, numChars, _TRUNCATE, L"%.9g", n); @@ -15807,7 +15832,7 @@ XmlElement::~XmlElement() throw() namespace XmlOutputFunctions { - /*static bool isLegalXmlCharSlow (const juce_wchar character) throw() + /*bool isLegalXmlCharSlow (const juce_wchar character) throw() { if ((character >= 'a' && character <= 'z') || (character >= 'A' && character <= 'Z') @@ -15826,7 +15851,7 @@ namespace XmlOutputFunctions return false; } - static void generateLegalCharConstants() + void generateLegalCharConstants() { uint8 n[32]; zerostruct (n); @@ -15841,7 +15866,7 @@ namespace XmlOutputFunctions DBG (s); }*/ - static bool isLegalXmlChar (const uint32 c) throw() + bool isLegalXmlChar (const uint32 c) throw() { static const unsigned char legalChars[] = { 0, 0, 0, 0, 187, 255, 255, 175, 255, 255, 255, 191, 254, 255, 255, 127 }; @@ -15849,7 +15874,7 @@ namespace XmlOutputFunctions && (legalChars [c >> 3] & (1 << (c & 7))) != 0; } - static void escapeIllegalXmlChars (OutputStream& outputStream, const String& text, const bool changeNewLines) + void escapeIllegalXmlChars (OutputStream& outputStream, const String& text, const bool changeNewLines) { const juce_wchar* t = text; @@ -15897,7 +15922,7 @@ namespace XmlOutputFunctions } } - static void writeSpaces (OutputStream& out, int numSpaces) + void writeSpaces (OutputStream& out, int numSpaces) { if (numSpaces > 0) { @@ -15914,7 +15939,7 @@ namespace XmlOutputFunctions } } - static void writeNewLine (OutputStream& out) + void writeNewLine (OutputStream& out) { out.write ("\r\n", 2); } @@ -41241,10 +41266,7 @@ void Component::exitModalState (const int returnValue) private: Component::SafePointer target; - const int result; - - ExitModalStateMessage (ExitModalStateMessage&); - ExitModalStateMessage& operator= (const ExitModalStateMessage&); + int result; }; (new ExitModalStateMessage (this, returnValue))->post(); @@ -41424,11 +41446,8 @@ void Component::internalRepaint (int x, int y, int w, int h) { if (parentComponent_ != 0) { - x += getX(); - y += getY(); - if (parentComponent_->flags.visibleFlag) - parentComponent_->internalRepaint (x, y, w, h); + parentComponent_->internalRepaint (x + getX(), y + getY(), w, h); } else if (flags.hasHeavyweightPeerFlag) { @@ -41931,10 +41950,7 @@ void Component::postCommandMessage (const int commandId) private: Component::SafePointer target; - const int commandId; - - CustomCommandMessage (CustomCommandMessage&); - CustomCommandMessage& operator= (const CustomCommandMessage&); + int commandId; }; (new CustomCommandMessage (this, commandId))->post(); @@ -46962,19 +46978,19 @@ CPlusPlusCodeTokeniser::~CPlusPlusCodeTokeniser() namespace CppTokeniser { - static bool isIdentifierStart (const juce_wchar c) throw() + bool isIdentifierStart (const juce_wchar c) throw() { return CharacterFunctions::isLetter (c) || c == '_' || c == '@'; } - static bool isIdentifierBody (const juce_wchar c) throw() + bool isIdentifierBody (const juce_wchar c) throw() { return CharacterFunctions::isLetterOrDigit (c) || c == '_' || c == '@'; } - static bool isReservedKeyword (const juce_wchar* const token, const int tokenLength) throw() + bool isReservedKeyword (const juce_wchar* const token, const int tokenLength) throw() { static const juce_wchar* const keywords2Char[] = { JUCE_T("if"), JUCE_T("do"), JUCE_T("or"), JUCE_T("id"), 0 }; @@ -47032,7 +47048,7 @@ namespace CppTokeniser return false; } - static int parseIdentifier (CodeDocument::Iterator& source) throw() + int parseIdentifier (CodeDocument::Iterator& source) throw() { int tokenLength = 0; juce_wchar possibleIdentifier [19]; @@ -47058,7 +47074,7 @@ namespace CppTokeniser return CPlusPlusCodeTokeniser::tokenType_identifier; } - static bool skipNumberSuffix (CodeDocument::Iterator& source) + bool skipNumberSuffix (CodeDocument::Iterator& source) { const juce_wchar c = source.peekNextChar(); if (c == 'l' || c == 'L' || c == 'u' || c == 'U') @@ -47070,14 +47086,14 @@ namespace CppTokeniser return true; } - static bool isHexDigit (const juce_wchar c) throw() + bool isHexDigit (const juce_wchar c) throw() { return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); } - static bool parseHexLiteral (CodeDocument::Iterator& source) throw() + bool parseHexLiteral (CodeDocument::Iterator& source) throw() { if (source.nextChar() != '0') return false; @@ -47099,12 +47115,12 @@ namespace CppTokeniser return skipNumberSuffix (source); } - static bool isOctalDigit (const juce_wchar c) throw() + bool isOctalDigit (const juce_wchar c) throw() { return c >= '0' && c <= '7'; } - static bool parseOctalLiteral (CodeDocument::Iterator& source) throw() + bool parseOctalLiteral (CodeDocument::Iterator& source) throw() { if (source.nextChar() != '0') return false; @@ -47118,12 +47134,12 @@ namespace CppTokeniser return skipNumberSuffix (source); } - static bool isDecimalDigit (const juce_wchar c) throw() + bool isDecimalDigit (const juce_wchar c) throw() { return c >= '0' && c <= '9'; } - static bool parseDecimalLiteral (CodeDocument::Iterator& source) throw() + bool parseDecimalLiteral (CodeDocument::Iterator& source) throw() { int numChars = 0; while (isDecimalDigit (source.peekNextChar())) @@ -47138,7 +47154,7 @@ namespace CppTokeniser return skipNumberSuffix (source); } - static bool parseFloatLiteral (CodeDocument::Iterator& source) throw() + bool parseFloatLiteral (CodeDocument::Iterator& source) throw() { int numDigits = 0; @@ -47195,7 +47211,7 @@ namespace CppTokeniser return true; } - static int parseNumber (CodeDocument::Iterator& source) + int parseNumber (CodeDocument::Iterator& source) { const CodeDocument::Iterator original (source); @@ -47223,7 +47239,7 @@ namespace CppTokeniser return CPlusPlusCodeTokeniser::tokenType_error; } - static void skipQuotedString (CodeDocument::Iterator& source) throw() + void skipQuotedString (CodeDocument::Iterator& source) throw() { const juce_wchar quote = source.nextChar(); @@ -47239,7 +47255,7 @@ namespace CppTokeniser } } - static void skipComment (CodeDocument::Iterator& source) throw() + void skipComment (CodeDocument::Iterator& source) throw() { bool lastWasStar = false; @@ -53315,7 +53331,7 @@ namespace TextEditorDefs const int maxActionsPerTransaction = 100; - static int getCharacterCategory (const juce_wchar character) + int getCharacterCategory (const juce_wchar character) { return CharacterFunctions::isLetterOrDigit (character) ? 2 : (CharacterFunctions::isWhitespace (character) ? 0 : 1); @@ -60799,7 +60815,7 @@ namespace KeyPressHelpers int code; }; - static const KeyNameAndCode translations[] = + const KeyNameAndCode translations[] = { { "spacebar", KeyPress::spaceKey }, { "return", KeyPress::returnKey }, @@ -60822,7 +60838,7 @@ namespace KeyPressHelpers { "rewind", KeyPress::rewindKey } }; - static const String numberPadPrefix() { return "numpad "; } + const String numberPadPrefix() { return "numpad "; } } const KeyPress KeyPress::createFromDescription (const String& desc) @@ -79810,7 +79826,7 @@ BEGIN_JUCE_NAMESPACE namespace RelativeCoordinateHelpers { - static void skipComma (const juce_wchar* const s, int& i) + void skipComma (const juce_wchar* const s, int& i) { while (CharacterFunctions::isWhitespace (s[i])) ++i; @@ -80446,13 +80462,13 @@ BEGIN_JUCE_NAMESPACE namespace ColourHelpers { - static uint8 floatAlphaToInt (const float alpha) throw() + uint8 floatAlphaToInt (const float alpha) throw() { return (uint8) jlimit (0, 0xff, roundToInt (alpha * 255.0f)); } - static void convertHSBtoRGB (float h, float s, float v, - uint8& r, uint8& g, uint8& b) throw() + void convertHSBtoRGB (float h, float s, float v, + uint8& r, uint8& g, uint8& b) throw() { v = jlimit (0.0f, 1.0f, v); v *= 255.0f; @@ -85740,10 +85756,8 @@ RectanglePlacement& RectanglePlacement::operator= (const RectanglePlacement& oth return *this; } -void RectanglePlacement::applyTo (double& x, double& y, - double& w, double& h, - const double dx, const double dy, - const double dw, const double dh) const throw() +void RectanglePlacement::applyTo (double& x, double& y, double& w, double& h, + const double dx, const double dy, const double dw, const double dh) const throw() { if (w == 0 || h == 0) return; @@ -85790,44 +85804,38 @@ const AffineTransform RectanglePlacement::getTransformToFit (const Rectangle line (x1, y1, x2, y2); destPath.lineTo (line.getPointAlongLine (-(arrowheadWidth / 2.0f - width), 0)); @@ -93955,7 +93963,7 @@ namespace PathStrokeHelpers float rx1, ry1, rx2, ry2; // the right-hand stroke }; - static void shortenSubPath (Array& subPath, float amountAtStart, float amountAtEnd) + void shortenSubPath (Array& subPath, float amountAtStart, float amountAtEnd) { while (amountAtEnd > 0 && subPath.size() > 0) { @@ -94014,10 +94022,10 @@ namespace PathStrokeHelpers } } - static void addSubPath (Path& destPath, Array& subPath, - const bool isClosed, const float width, const float maxMiterExtensionSquared, - const PathStrokeType::JointStyle jointStyle, const PathStrokeType::EndCapStyle endStyle, - const Arrowhead* const arrowhead) + void addSubPath (Path& destPath, Array& subPath, + const bool isClosed, const float width, const float maxMiterExtensionSquared, + const PathStrokeType::JointStyle jointStyle, const PathStrokeType::EndCapStyle endStyle, + const Arrowhead* const arrowhead) { jassert (subPath.size() > 0); @@ -94127,11 +94135,11 @@ namespace PathStrokeHelpers destPath.closeSubPath(); } - static void createStroke (const float thickness, const PathStrokeType::JointStyle jointStyle, - const PathStrokeType::EndCapStyle endStyle, - Path& destPath, const Path& source, - const AffineTransform& transform, - const float extraAccuracy, const Arrowhead* const arrowhead) + void createStroke (const float thickness, const PathStrokeType::JointStyle jointStyle, + const PathStrokeType::EndCapStyle endStyle, + Path& destPath, const Path& source, + const AffineTransform& transform, + const float extraAccuracy, const Arrowhead* const arrowhead) { if (thickness <= 0) { @@ -129011,32 +129019,27 @@ public: return false; int* buf[3]; + HeapBlock temp; const int bitsToShift = 32 - bitsPerSample; if (bitsToShift > 0) { const int numChannelsToWrite = (samplesToWrite[1] == 0) ? 1 : 2; - HeapBlock temp (numSamples * numChannelsToWrite); + temp.malloc (numSamples * numChannelsToWrite); buf[0] = temp.getData(); buf[1] = temp.getData() + numSamples; buf[2] = 0; for (int i = numChannelsToWrite; --i >= 0;) - { if (samplesToWrite[i] != 0) - { for (int j = 0; j < numSamples; ++j) buf [i][j] = (samplesToWrite [i][j] >> bitsToShift); - } - } samplesToWrite = const_cast (buf); } - return FLAC__stream_encoder_process (encoder, - (const FLAC__int32**) samplesToWrite, - numSamples) != 0; + return FLAC__stream_encoder_process (encoder, (const FLAC__int32**) samplesToWrite, numSamples) != 0; } bool writeData (const void* const data, const int size) const @@ -211640,16 +211643,16 @@ namespace JPEGHelpers struct JPEGDecodingFailure {}; - static void fatalErrorHandler (j_common_ptr) + void fatalErrorHandler (j_common_ptr) { throw JPEGDecodingFailure(); } - static void silentErrorCallback1 (j_common_ptr) {} - static void silentErrorCallback2 (j_common_ptr, int) {} - static void silentErrorCallback3 (j_common_ptr, char*) {} + void silentErrorCallback1 (j_common_ptr) {} + void silentErrorCallback2 (j_common_ptr, int) {} + void silentErrorCallback3 (j_common_ptr, char*) {} - static void setupSilentErrorHandler (struct jpeg_error_mgr& err) + void setupSilentErrorHandler (struct jpeg_error_mgr& err) { zerostruct (err); @@ -211660,11 +211663,11 @@ namespace JPEGHelpers err.reset_error_mgr = silentErrorCallback1; } - static void dummyCallback1 (j_decompress_ptr) + void dummyCallback1 (j_decompress_ptr) { } - static void jpegSkip (j_decompress_ptr decompStruct, long num) + void jpegSkip (j_decompress_ptr decompStruct, long num) { decompStruct->src->next_input_byte += num; @@ -211672,12 +211675,12 @@ namespace JPEGHelpers decompStruct->src->bytes_in_buffer -= num; } - static boolean jpegFill (j_decompress_ptr) + boolean jpegFill (j_decompress_ptr) { return 0; } - static const int jpegBufferSize = 512; + const int jpegBufferSize = 512; struct JuceJpegDest : public jpeg_destination_mgr { @@ -211685,11 +211688,11 @@ namespace JPEGHelpers char* buffer; }; - static void jpegWriteInit (j_compress_ptr) + void jpegWriteInit (j_compress_ptr) { } - static void jpegWriteTerminate (j_compress_ptr cinfo) + void jpegWriteTerminate (j_compress_ptr cinfo) { JuceJpegDest* const dest = static_cast (cinfo->dest); @@ -211697,7 +211700,7 @@ namespace JPEGHelpers dest->output->write (dest->buffer, (int) numToWrite); } - static boolean jpegWriteFlush (j_compress_ptr cinfo) + boolean jpegWriteFlush (j_compress_ptr cinfo) { JuceJpegDest* const dest = static_cast (cinfo->dest); @@ -237392,19 +237395,19 @@ namespace PNGHelpers { using namespace pnglibNamespace; - static void JUCE_CDECL readCallback (png_structp png, png_bytep data, png_size_t length) + void JUCE_CDECL readCallback (png_structp png, png_bytep data, png_size_t length) { static_cast (png_get_io_ptr (png))->read (data, (int) length); } - static void JUCE_CDECL writeDataCallback (png_structp png, png_bytep data, png_size_t length) + void JUCE_CDECL writeDataCallback (png_structp png, png_bytep data, png_size_t length) { static_cast (png_get_io_ptr (png))->write (data, (int) length); } struct PNGErrorStruct {}; - static void JUCE_CDECL errorCallback (png_structp, png_const_charp) + void JUCE_CDECL errorCallback (png_structp, png_const_charp) { throw PNGErrorStruct(); } diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 0ba851a835..0e5615f6bb 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -64,7 +64,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 52 -#define JUCE_BUILDNUMBER 85 +#define JUCE_BUILDNUMBER 86 /** Current Juce version number. @@ -27971,10 +27971,8 @@ private: static void* runModalLoopCallback (void*); static void bringModalComponentToFront(); void subtractObscuredRegions (RectangleList& result, const Point& delta, - const Rectangle& clipRect, - const Component* const compToAvoid) const; - void clipObscuredRegions (Graphics& g, const Rectangle& clipRect, - int deltaX, int deltaY) const; + const Rectangle& clipRect, const Component* const compToAvoid) const; + void clipObscuredRegions (Graphics& g, const Rectangle& clipRect, int deltaX, int deltaY) const; // how much of the component is not off the edges of its parents const Rectangle getUnclippedArea() const; diff --git a/src/audio/audio_file_formats/juce_FlacAudioFormat.cpp b/src/audio/audio_file_formats/juce_FlacAudioFormat.cpp index 854b9f94fa..01c6050a75 100644 --- a/src/audio/audio_file_formats/juce_FlacAudioFormat.cpp +++ b/src/audio/audio_file_formats/juce_FlacAudioFormat.cpp @@ -364,32 +364,27 @@ public: return false; int* buf[3]; + HeapBlock temp; const int bitsToShift = 32 - bitsPerSample; if (bitsToShift > 0) { const int numChannelsToWrite = (samplesToWrite[1] == 0) ? 1 : 2; - HeapBlock temp (numSamples * numChannelsToWrite); + temp.malloc (numSamples * numChannelsToWrite); buf[0] = temp.getData(); buf[1] = temp.getData() + numSamples; buf[2] = 0; for (int i = numChannelsToWrite; --i >= 0;) - { if (samplesToWrite[i] != 0) - { for (int j = 0; j < numSamples; ++j) buf [i][j] = (samplesToWrite [i][j] >> bitsToShift); - } - } samplesToWrite = const_cast (buf); } - return FLAC__stream_encoder_process (encoder, - (const FLAC__int32**) samplesToWrite, - numSamples) != 0; + return FLAC__stream_encoder_process (encoder, (const FLAC__int32**) samplesToWrite, numSamples) != 0; } bool writeData (const void* const data, const int size) const diff --git a/src/containers/juce_BigInteger.cpp b/src/containers/juce_BigInteger.cpp index c6019435fc..4f0a3841a7 100644 --- a/src/containers/juce_BigInteger.cpp +++ b/src/containers/juce_BigInteger.cpp @@ -281,36 +281,62 @@ void BigInteger::negate() throw() negative = (! negative) && ! isZero(); } +#if JUCE_USE_INTRINSICS + #pragma intrinsic (_BitScanReverse) +#endif + +namespace BitFunctions +{ + inline int countBitsInInt32 (uint32 n) throw() + { + n -= ((n >> 1) & 0x55555555); + n = (((n >> 2) & 0x33333333) + (n & 0x33333333)); + n = (((n >> 4) + n) & 0x0f0f0f0f); + n += (n >> 8); + n += (n >> 16); + return n & 0x3f; + } + + inline int highestBitInInt (uint32 n) throw() + { + jassert (n != 0); // (the built-in functions may not work for n = 0) + + #if JUCE_GCC + return 31 - __builtin_clz (n); + #elif JUCE_USE_INTRINSICS + unsigned long highest; + _BitScanReverse (&highest, n); + return (int) highest; + #else + n |= (n >> 1); + n |= (n >> 2); + n |= (n >> 4); + n |= (n >> 8); + n |= (n >> 16); + return countBitsInInt32 (n >> 1); + #endif + } +} + int BigInteger::countNumberOfSetBits() const throw() { int total = 0; for (int i = bitToIndex (highestBit) + 1; --i >= 0;) - { - uint32 n = values[i]; - - if (n == 0xffffffff) - { - total += 32; - } - else - { - while (n != 0) - { - total += (n & 1); - n >>= 1; - } - } - } + total += BitFunctions::countBitsInInt32 (values[i]); return total; } int BigInteger::getHighestBit() const throw() { - for (int i = highestBit + 1; --i >= 0;) - if ((values [bitToIndex (i)] & bitToMask (i)) != 0) - return i; + for (int i = bitToIndex (highestBit + 1); i >= 0; --i) + { + const uint32 n = values[i]; + + if (n != 0) + return BitFunctions::highestBitInInt (n) + (i << 5); + } return -1; } diff --git a/src/core/juce_StandardHeader.h b/src/core/juce_StandardHeader.h index bd6a46fda7..6dba1c01f9 100644 --- a/src/core/juce_StandardHeader.h +++ b/src/core/juce_StandardHeader.h @@ -33,7 +33,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 52 -#define JUCE_BUILDNUMBER 85 +#define JUCE_BUILDNUMBER 86 /** Current Juce version number. diff --git a/src/cryptography/juce_MD5.cpp b/src/cryptography/juce_MD5.cpp index ad27bb6cf5..3e05ec5f9b 100644 --- a/src/cryptography/juce_MD5.cpp +++ b/src/cryptography/juce_MD5.cpp @@ -128,38 +128,38 @@ MD5::~MD5() //============================================================================== namespace MD5Functions { - static void encode (void* const output, const void* const input, const int numBytes) throw() + void encode (void* const output, const void* const input, const int numBytes) throw() { for (int i = 0; i < (numBytes >> 2); ++i) static_cast (output)[i] = ByteOrder::swapIfBigEndian (static_cast (input) [i]); } - static inline uint32 F (const uint32 x, const uint32 y, const uint32 z) throw() { return (x & y) | (~x & z); } - static inline uint32 G (const uint32 x, const uint32 y, const uint32 z) throw() { return (x & z) | (y & ~z); } - static inline uint32 H (const uint32 x, const uint32 y, const uint32 z) throw() { return x ^ y ^ z; } - static inline uint32 I (const uint32 x, const uint32 y, const uint32 z) throw() { return y ^ (x | ~z); } + inline uint32 rotateLeft (const uint32 x, const uint32 n) throw() { return (x << n) | (x >> (32 - n)); } - static inline uint32 rotateLeft (const uint32 x, const uint32 n) throw() { return (x << n) | (x >> (32 - n)); } + inline uint32 F (const uint32 x, const uint32 y, const uint32 z) throw() { return (x & y) | (~x & z); } + inline uint32 G (const uint32 x, const uint32 y, const uint32 z) throw() { return (x & z) | (y & ~z); } + inline uint32 H (const uint32 x, const uint32 y, const uint32 z) throw() { return x ^ y ^ z; } + inline uint32 I (const uint32 x, const uint32 y, const uint32 z) throw() { return y ^ (x | ~z); } - static void FF (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() + void FF (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() { a += F (b, c, d) + x + ac; a = rotateLeft (a, s) + b; } - static void GG (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() + void GG (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() { a += G (b, c, d) + x + ac; a = rotateLeft (a, s) + b; } - static void HH (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() + void HH (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() { a += H (b, c, d) + x + ac; a = rotateLeft (a, s) + b; } - static void II (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() + void II (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() { a += I (b, c, d) + x + ac; a = rotateLeft (a, s) + b; diff --git a/src/cryptography/juce_Primes.cpp b/src/cryptography/juce_Primes.cpp index 440a48d6e3..fbd2a393c6 100644 --- a/src/cryptography/juce_Primes.cpp +++ b/src/cryptography/juce_Primes.cpp @@ -34,7 +34,7 @@ BEGIN_JUCE_NAMESPACE //============================================================================== namespace PrimesHelpers { - static void createSmallSieve (const int numBits, BigInteger& result) + void createSmallSieve (const int numBits, BigInteger& result) { result.setBit (numBits); result.clearBit (numBits); // to enlarge the array @@ -52,8 +52,8 @@ namespace PrimesHelpers while (n <= (numBits >> 1)); } - static void bigSieve (const BigInteger& base, const int numBits, BigInteger& result, - const BigInteger& smallSieve, const int smallSieveSize) + void bigSieve (const BigInteger& base, const int numBits, BigInteger& result, + const BigInteger& smallSieve, const int smallSieveSize) { jassert (! base[0]); // must be even! @@ -90,8 +90,8 @@ namespace PrimesHelpers while (index < smallSieveSize); } - static bool findCandidate (const BigInteger& base, const BigInteger& sieve, - const int numBits, BigInteger& result, const int certainty) + bool findCandidate (const BigInteger& base, const BigInteger& sieve, + const int numBits, BigInteger& result, const int certainty) { for (int i = 0; i < numBits; ++i) { @@ -107,7 +107,7 @@ namespace PrimesHelpers return false; } - static bool passesMillerRabin (const BigInteger& n, int iterations) + bool passesMillerRabin (const BigInteger& n, int iterations) { const BigInteger one (1), two (2); const BigInteger nMinusOne (n - one); diff --git a/src/gui/components/code_editor/juce_CPlusPlusCodeTokeniser.cpp b/src/gui/components/code_editor/juce_CPlusPlusCodeTokeniser.cpp index 28220d050d..4d51c96f7f 100644 --- a/src/gui/components/code_editor/juce_CPlusPlusCodeTokeniser.cpp +++ b/src/gui/components/code_editor/juce_CPlusPlusCodeTokeniser.cpp @@ -42,19 +42,19 @@ CPlusPlusCodeTokeniser::~CPlusPlusCodeTokeniser() //============================================================================== namespace CppTokeniser { - static bool isIdentifierStart (const juce_wchar c) throw() + bool isIdentifierStart (const juce_wchar c) throw() { return CharacterFunctions::isLetter (c) || c == '_' || c == '@'; } - static bool isIdentifierBody (const juce_wchar c) throw() + bool isIdentifierBody (const juce_wchar c) throw() { return CharacterFunctions::isLetterOrDigit (c) || c == '_' || c == '@'; } - static bool isReservedKeyword (const juce_wchar* const token, const int tokenLength) throw() + bool isReservedKeyword (const juce_wchar* const token, const int tokenLength) throw() { static const juce_wchar* const keywords2Char[] = { JUCE_T("if"), JUCE_T("do"), JUCE_T("or"), JUCE_T("id"), 0 }; @@ -112,7 +112,7 @@ namespace CppTokeniser return false; } - static int parseIdentifier (CodeDocument::Iterator& source) throw() + int parseIdentifier (CodeDocument::Iterator& source) throw() { int tokenLength = 0; juce_wchar possibleIdentifier [19]; @@ -138,7 +138,7 @@ namespace CppTokeniser return CPlusPlusCodeTokeniser::tokenType_identifier; } - static bool skipNumberSuffix (CodeDocument::Iterator& source) + bool skipNumberSuffix (CodeDocument::Iterator& source) { const juce_wchar c = source.peekNextChar(); if (c == 'l' || c == 'L' || c == 'u' || c == 'U') @@ -150,14 +150,14 @@ namespace CppTokeniser return true; } - static bool isHexDigit (const juce_wchar c) throw() + bool isHexDigit (const juce_wchar c) throw() { return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); } - static bool parseHexLiteral (CodeDocument::Iterator& source) throw() + bool parseHexLiteral (CodeDocument::Iterator& source) throw() { if (source.nextChar() != '0') return false; @@ -179,12 +179,12 @@ namespace CppTokeniser return skipNumberSuffix (source); } - static bool isOctalDigit (const juce_wchar c) throw() + bool isOctalDigit (const juce_wchar c) throw() { return c >= '0' && c <= '7'; } - static bool parseOctalLiteral (CodeDocument::Iterator& source) throw() + bool parseOctalLiteral (CodeDocument::Iterator& source) throw() { if (source.nextChar() != '0') return false; @@ -198,12 +198,12 @@ namespace CppTokeniser return skipNumberSuffix (source); } - static bool isDecimalDigit (const juce_wchar c) throw() + bool isDecimalDigit (const juce_wchar c) throw() { return c >= '0' && c <= '9'; } - static bool parseDecimalLiteral (CodeDocument::Iterator& source) throw() + bool parseDecimalLiteral (CodeDocument::Iterator& source) throw() { int numChars = 0; while (isDecimalDigit (source.peekNextChar())) @@ -218,7 +218,7 @@ namespace CppTokeniser return skipNumberSuffix (source); } - static bool parseFloatLiteral (CodeDocument::Iterator& source) throw() + bool parseFloatLiteral (CodeDocument::Iterator& source) throw() { int numDigits = 0; @@ -275,7 +275,7 @@ namespace CppTokeniser return true; } - static int parseNumber (CodeDocument::Iterator& source) + int parseNumber (CodeDocument::Iterator& source) { const CodeDocument::Iterator original (source); @@ -303,7 +303,7 @@ namespace CppTokeniser return CPlusPlusCodeTokeniser::tokenType_error; } - static void skipQuotedString (CodeDocument::Iterator& source) throw() + void skipQuotedString (CodeDocument::Iterator& source) throw() { const juce_wchar quote = source.nextChar(); @@ -319,7 +319,7 @@ namespace CppTokeniser } } - static void skipComment (CodeDocument::Iterator& source) throw() + void skipComment (CodeDocument::Iterator& source) throw() { bool lastWasStar = false; diff --git a/src/gui/components/controls/juce_TextEditor.cpp b/src/gui/components/controls/juce_TextEditor.cpp index b486b9e8bf..73e4aaa485 100644 --- a/src/gui/components/controls/juce_TextEditor.cpp +++ b/src/gui/components/controls/juce_TextEditor.cpp @@ -966,7 +966,7 @@ namespace TextEditorDefs const int maxActionsPerTransaction = 100; - static int getCharacterCategory (const juce_wchar character) + int getCharacterCategory (const juce_wchar character) { return CharacterFunctions::isLetterOrDigit (character) ? 2 : (CharacterFunctions::isWhitespace (character) ? 0 : 1); diff --git a/src/gui/components/juce_Component.cpp b/src/gui/components/juce_Component.cpp index 2e0f5b7d23..99ce3d0e28 100644 --- a/src/gui/components/juce_Component.cpp +++ b/src/gui/components/juce_Component.cpp @@ -1433,10 +1433,7 @@ void Component::exitModalState (const int returnValue) private: Component::SafePointer target; - const int result; - - ExitModalStateMessage (ExitModalStateMessage&); - ExitModalStateMessage& operator= (const ExitModalStateMessage&); + int result; }; (new ExitModalStateMessage (this, returnValue))->post(); @@ -1620,11 +1617,8 @@ void Component::internalRepaint (int x, int y, int w, int h) { if (parentComponent_ != 0) { - x += getX(); - y += getY(); - if (parentComponent_->flags.visibleFlag) - parentComponent_->internalRepaint (x, y, w, h); + parentComponent_->internalRepaint (x + getX(), y + getY(), w, h); } else if (flags.hasHeavyweightPeerFlag) { @@ -2138,10 +2132,7 @@ void Component::postCommandMessage (const int commandId) private: Component::SafePointer target; - const int commandId; - - CustomCommandMessage (CustomCommandMessage&); - CustomCommandMessage& operator= (const CustomCommandMessage&); + int commandId; }; (new CustomCommandMessage (this, commandId))->post(); diff --git a/src/gui/components/juce_Component.h b/src/gui/components/juce_Component.h index 6270bb3ad4..4414d71a81 100644 --- a/src/gui/components/juce_Component.h +++ b/src/gui/components/juce_Component.h @@ -2071,10 +2071,8 @@ private: static void* runModalLoopCallback (void*); static void bringModalComponentToFront(); void subtractObscuredRegions (RectangleList& result, const Point& delta, - const Rectangle& clipRect, - const Component* const compToAvoid) const; - void clipObscuredRegions (Graphics& g, const Rectangle& clipRect, - int deltaX, int deltaY) const; + const Rectangle& clipRect, const Component* const compToAvoid) const; + void clipObscuredRegions (Graphics& g, const Rectangle& clipRect, int deltaX, int deltaY) const; // how much of the component is not off the edges of its parents const Rectangle getUnclippedArea() const; diff --git a/src/gui/components/keyboard/juce_KeyPress.cpp b/src/gui/components/keyboard/juce_KeyPress.cpp index b0ee39a386..6c98ce0ab2 100644 --- a/src/gui/components/keyboard/juce_KeyPress.cpp +++ b/src/gui/components/keyboard/juce_KeyPress.cpp @@ -104,7 +104,7 @@ namespace KeyPressHelpers int code; }; - static const KeyNameAndCode translations[] = + const KeyNameAndCode translations[] = { { "spacebar", KeyPress::spaceKey }, { "return", KeyPress::returnKey }, @@ -127,7 +127,7 @@ namespace KeyPressHelpers { "rewind", KeyPress::rewindKey } }; - static const String numberPadPrefix() { return "numpad "; } + const String numberPadPrefix() { return "numpad "; } } //============================================================================== diff --git a/src/gui/graphics/colour/juce_Colour.cpp b/src/gui/graphics/colour/juce_Colour.cpp index abcac2e3fc..6b1767cfc4 100644 --- a/src/gui/graphics/colour/juce_Colour.cpp +++ b/src/gui/graphics/colour/juce_Colour.cpp @@ -33,13 +33,13 @@ BEGIN_JUCE_NAMESPACE //============================================================================== namespace ColourHelpers { - static uint8 floatAlphaToInt (const float alpha) throw() + uint8 floatAlphaToInt (const float alpha) throw() { return (uint8) jlimit (0, 0xff, roundToInt (alpha * 255.0f)); } - static void convertHSBtoRGB (float h, float s, float v, - uint8& r, uint8& g, uint8& b) throw() + void convertHSBtoRGB (float h, float s, float v, + uint8& r, uint8& g, uint8& b) throw() { v = jlimit (0.0f, 1.0f, v); v *= 255.0f; diff --git a/src/gui/graphics/contexts/juce_RectanglePlacement.cpp b/src/gui/graphics/contexts/juce_RectanglePlacement.cpp index 36695b219d..95eaf89f8a 100644 --- a/src/gui/graphics/contexts/juce_RectanglePlacement.cpp +++ b/src/gui/graphics/contexts/juce_RectanglePlacement.cpp @@ -42,10 +42,8 @@ RectanglePlacement& RectanglePlacement::operator= (const RectanglePlacement& oth return *this; } -void RectanglePlacement::applyTo (double& x, double& y, - double& w, double& h, - const double dx, const double dy, - const double dw, const double dh) const throw() +void RectanglePlacement::applyTo (double& x, double& y, double& w, double& h, + const double dx, const double dy, const double dw, const double dh) const throw() { if (w == 0 || h == 0) return; @@ -92,44 +90,38 @@ const AffineTransform RectanglePlacement::getTransformToFit (const Rectangle line (x1, y1, x2, y2); destPath.lineTo (line.getPointAlongLine (-(arrowheadWidth / 2.0f - width), 0)); @@ -373,7 +373,7 @@ namespace PathStrokeHelpers float rx1, ry1, rx2, ry2; // the right-hand stroke }; - static void shortenSubPath (Array& subPath, float amountAtStart, float amountAtEnd) + void shortenSubPath (Array& subPath, float amountAtStart, float amountAtEnd) { while (amountAtEnd > 0 && subPath.size() > 0) { @@ -432,10 +432,10 @@ namespace PathStrokeHelpers } } - static void addSubPath (Path& destPath, Array& subPath, - const bool isClosed, const float width, const float maxMiterExtensionSquared, - const PathStrokeType::JointStyle jointStyle, const PathStrokeType::EndCapStyle endStyle, - const Arrowhead* const arrowhead) + void addSubPath (Path& destPath, Array& subPath, + const bool isClosed, const float width, const float maxMiterExtensionSquared, + const PathStrokeType::JointStyle jointStyle, const PathStrokeType::EndCapStyle endStyle, + const Arrowhead* const arrowhead) { jassert (subPath.size() > 0); @@ -545,11 +545,11 @@ namespace PathStrokeHelpers destPath.closeSubPath(); } - static void createStroke (const float thickness, const PathStrokeType::JointStyle jointStyle, - const PathStrokeType::EndCapStyle endStyle, - Path& destPath, const Path& source, - const AffineTransform& transform, - const float extraAccuracy, const Arrowhead* const arrowhead) + void createStroke (const float thickness, const PathStrokeType::JointStyle jointStyle, + const PathStrokeType::EndCapStyle endStyle, + Path& destPath, const Path& source, + const AffineTransform& transform, + const float extraAccuracy, const Arrowhead* const arrowhead) { if (thickness <= 0) { diff --git a/src/gui/graphics/geometry/juce_RelativeCoordinate.cpp b/src/gui/graphics/geometry/juce_RelativeCoordinate.cpp index 322feac881..2074684a99 100644 --- a/src/gui/graphics/geometry/juce_RelativeCoordinate.cpp +++ b/src/gui/graphics/geometry/juce_RelativeCoordinate.cpp @@ -35,7 +35,7 @@ BEGIN_JUCE_NAMESPACE //============================================================================== namespace RelativeCoordinateHelpers { - static void skipComma (const juce_wchar* const s, int& i) + void skipComma (const juce_wchar* const s, int& i) { while (CharacterFunctions::isWhitespace (s[i])) ++i; diff --git a/src/gui/graphics/imaging/image_file_formats/juce_JPEGLoader.cpp b/src/gui/graphics/imaging/image_file_formats/juce_JPEGLoader.cpp index 512c0c7e15..96b0eb82ce 100644 --- a/src/gui/graphics/imaging/image_file_formats/juce_JPEGLoader.cpp +++ b/src/gui/graphics/imaging/image_file_formats/juce_JPEGLoader.cpp @@ -139,16 +139,16 @@ namespace JPEGHelpers struct JPEGDecodingFailure {}; - static void fatalErrorHandler (j_common_ptr) + void fatalErrorHandler (j_common_ptr) { throw JPEGDecodingFailure(); } - static void silentErrorCallback1 (j_common_ptr) {} - static void silentErrorCallback2 (j_common_ptr, int) {} - static void silentErrorCallback3 (j_common_ptr, char*) {} + void silentErrorCallback1 (j_common_ptr) {} + void silentErrorCallback2 (j_common_ptr, int) {} + void silentErrorCallback3 (j_common_ptr, char*) {} - static void setupSilentErrorHandler (struct jpeg_error_mgr& err) + void setupSilentErrorHandler (struct jpeg_error_mgr& err) { zerostruct (err); @@ -161,11 +161,11 @@ namespace JPEGHelpers //============================================================================== - static void dummyCallback1 (j_decompress_ptr) + void dummyCallback1 (j_decompress_ptr) { } - static void jpegSkip (j_decompress_ptr decompStruct, long num) + void jpegSkip (j_decompress_ptr decompStruct, long num) { decompStruct->src->next_input_byte += num; @@ -173,13 +173,13 @@ namespace JPEGHelpers decompStruct->src->bytes_in_buffer -= num; } - static boolean jpegFill (j_decompress_ptr) + boolean jpegFill (j_decompress_ptr) { return 0; } //============================================================================== - static const int jpegBufferSize = 512; + const int jpegBufferSize = 512; struct JuceJpegDest : public jpeg_destination_mgr { @@ -187,11 +187,11 @@ namespace JPEGHelpers char* buffer; }; - static void jpegWriteInit (j_compress_ptr) + void jpegWriteInit (j_compress_ptr) { } - static void jpegWriteTerminate (j_compress_ptr cinfo) + void jpegWriteTerminate (j_compress_ptr cinfo) { JuceJpegDest* const dest = static_cast (cinfo->dest); @@ -199,7 +199,7 @@ namespace JPEGHelpers dest->output->write (dest->buffer, (int) numToWrite); } - static boolean jpegWriteFlush (j_compress_ptr cinfo) + boolean jpegWriteFlush (j_compress_ptr cinfo) { JuceJpegDest* const dest = static_cast (cinfo->dest); diff --git a/src/gui/graphics/imaging/image_file_formats/juce_PNGLoader.cpp b/src/gui/graphics/imaging/image_file_formats/juce_PNGLoader.cpp index c20bb698cd..d9847785a5 100644 --- a/src/gui/graphics/imaging/image_file_formats/juce_PNGLoader.cpp +++ b/src/gui/graphics/imaging/image_file_formats/juce_PNGLoader.cpp @@ -110,19 +110,19 @@ namespace PNGHelpers { using namespace pnglibNamespace; - static void JUCE_CDECL readCallback (png_structp png, png_bytep data, png_size_t length) + void JUCE_CDECL readCallback (png_structp png, png_bytep data, png_size_t length) { static_cast (png_get_io_ptr (png))->read (data, (int) length); } - static void JUCE_CDECL writeDataCallback (png_structp png, png_bytep data, png_size_t length) + void JUCE_CDECL writeDataCallback (png_structp png, png_bytep data, png_size_t length) { static_cast (png_get_io_ptr (png))->write (data, (int) length); } struct PNGErrorStruct {}; - static void JUCE_CDECL errorCallback (png_structp, png_const_charp) + void JUCE_CDECL errorCallback (png_structp, png_const_charp) { throw PNGErrorStruct(); } diff --git a/src/io/network/juce_Socket.cpp b/src/io/network/juce_Socket.cpp index 9ea0df1e99..89d207abbe 100644 --- a/src/io/network/juce_Socket.cpp +++ b/src/io/network/juce_Socket.cpp @@ -100,7 +100,7 @@ void juce_shutdownWin32Sockets() //============================================================================== namespace SocketHelpers { - static bool resetSocketOptions (const int handle, const bool isDatagram, const bool allowBroadcast) throw() + bool resetSocketOptions (const int handle, const bool isDatagram, const bool allowBroadcast) throw() { const int sndBufSize = 65536; const int rcvBufSize = 65536; @@ -113,7 +113,7 @@ namespace SocketHelpers : (setsockopt (handle, IPPROTO_TCP, TCP_NODELAY, (const char*) &one, sizeof (one)) == 0)); } - static bool bindSocketToPort (const int handle, const int port) throw() + bool bindSocketToPort (const int handle, const int port) throw() { if (handle <= 0 || port <= 0) return false; @@ -127,10 +127,10 @@ namespace SocketHelpers return bind (handle, (struct sockaddr*) &servTmpAddr, sizeof (struct sockaddr_in)) >= 0; } - static int readSocket (const int handle, - void* const destBuffer, const int maxBytesToRead, - bool volatile& connected, - const bool blockUntilSpecifiedAmountHasArrived) throw() + int readSocket (const int handle, + void* const destBuffer, const int maxBytesToRead, + bool volatile& connected, + const bool blockUntilSpecifiedAmountHasArrived) throw() { int bytesRead = 0; @@ -165,8 +165,7 @@ namespace SocketHelpers return bytesRead; } - static int waitForReadiness (const int handle, const bool forReading, - const int timeoutMsecs) throw() + int waitForReadiness (const int handle, const bool forReading, const int timeoutMsecs) throw() { struct timeval timeout; struct timeval* timeoutp; @@ -223,7 +222,7 @@ namespace SocketHelpers return 0; } - static bool setSocketBlockingState (const int handle, const bool shouldBlock) throw() + bool setSocketBlockingState (const int handle, const bool shouldBlock) throw() { #if JUCE_WINDOWS u_long nonBlocking = shouldBlock ? 0 : 1; @@ -248,12 +247,12 @@ namespace SocketHelpers return true; } - static bool connectSocket (int volatile& handle, - const bool isDatagram, - void** serverAddress, - const String& hostName, - const int portNumber, - const int timeOutMillisecs) throw() + bool connectSocket (int volatile& handle, + const bool isDatagram, + void** serverAddress, + const String& hostName, + const int portNumber, + const int timeOutMillisecs) throw() { struct hostent* const hostEnt = gethostbyname (hostName.toUTF8()); diff --git a/src/text/juce_String.cpp b/src/text/juce_String.cpp index 2d2350eec5..8bdadb955d 100644 --- a/src/text/juce_String.cpp +++ b/src/text/juce_String.cpp @@ -282,7 +282,7 @@ const String String::charToString (const juce_wchar character) namespace NumberToStringConverters { // pass in a pointer to the END of a buffer.. - static juce_wchar* int64ToString (juce_wchar* t, const int64 n) throw() + juce_wchar* int64ToString (juce_wchar* t, const int64 n) throw() { *--t = 0; int64 v = (n >= 0) ? n : -n; @@ -300,7 +300,7 @@ namespace NumberToStringConverters return t; } - static juce_wchar* uint64ToString (juce_wchar* t, int64 v) throw() + juce_wchar* uint64ToString (juce_wchar* t, int64 v) throw() { *--t = 0; @@ -314,7 +314,7 @@ namespace NumberToStringConverters return t; } - static juce_wchar* intToString (juce_wchar* t, const int n) throw() + juce_wchar* intToString (juce_wchar* t, const int n) throw() { if (n == (int) 0x80000000) // (would cause an overflow) return int64ToString (t, n); @@ -335,7 +335,7 @@ namespace NumberToStringConverters return t; } - static juce_wchar* uintToString (juce_wchar* t, unsigned int v) throw() + juce_wchar* uintToString (juce_wchar* t, unsigned int v) throw() { *--t = 0; @@ -349,7 +349,7 @@ namespace NumberToStringConverters return t; } - static juce_wchar getDecimalPoint() + juce_wchar getDecimalPoint() { #if JUCE_MSVC && _MSC_VER < 1400 static juce_wchar dp = std::_USE (std::locale(), std::numpunct ).decimal_point(); @@ -359,7 +359,7 @@ namespace NumberToStringConverters return dp; } - static juce_wchar* doubleToString (juce_wchar* buffer, int numChars, double n, int numDecPlaces, size_t& len) throw() + juce_wchar* doubleToString (juce_wchar* buffer, int numChars, double n, int numDecPlaces, size_t& len) throw() { if (numDecPlaces > 0 && n > -1.0e20 && n < 1.0e20) { @@ -388,7 +388,7 @@ namespace NumberToStringConverters else { #if JUCE_WINDOWS - #if JUCE_MSVC && _MSC_VER <= 1400 + #if (JUCE_MSVC && _MSC_VER <= 1400) || JUCE_MINGW len = _snwprintf (buffer, numChars, L"%.9g", n); #else len = _snwprintf_s (buffer, numChars, _TRUNCATE, L"%.9g", n); diff --git a/src/text/juce_XmlElement.cpp b/src/text/juce_XmlElement.cpp index 563e738746..864af30ef6 100644 --- a/src/text/juce_XmlElement.cpp +++ b/src/text/juce_XmlElement.cpp @@ -153,7 +153,7 @@ XmlElement::~XmlElement() throw() //============================================================================== namespace XmlOutputFunctions { - /*static bool isLegalXmlCharSlow (const juce_wchar character) throw() + /*bool isLegalXmlCharSlow (const juce_wchar character) throw() { if ((character >= 'a' && character <= 'z') || (character >= 'A' && character <= 'Z') @@ -172,7 +172,7 @@ namespace XmlOutputFunctions return false; } - static void generateLegalCharConstants() + void generateLegalCharConstants() { uint8 n[32]; zerostruct (n); @@ -187,7 +187,7 @@ namespace XmlOutputFunctions DBG (s); }*/ - static bool isLegalXmlChar (const uint32 c) throw() + bool isLegalXmlChar (const uint32 c) throw() { static const unsigned char legalChars[] = { 0, 0, 0, 0, 187, 255, 255, 175, 255, 255, 255, 191, 254, 255, 255, 127 }; @@ -195,7 +195,7 @@ namespace XmlOutputFunctions && (legalChars [c >> 3] & (1 << (c & 7))) != 0; } - static void escapeIllegalXmlChars (OutputStream& outputStream, const String& text, const bool changeNewLines) + void escapeIllegalXmlChars (OutputStream& outputStream, const String& text, const bool changeNewLines) { const juce_wchar* t = text; @@ -243,7 +243,7 @@ namespace XmlOutputFunctions } } - static void writeSpaces (OutputStream& out, int numSpaces) + void writeSpaces (OutputStream& out, int numSpaces) { if (numSpaces > 0) { @@ -260,7 +260,7 @@ namespace XmlOutputFunctions } } - static void writeNewLine (OutputStream& out) + void writeNewLine (OutputStream& out) { out.write ("\r\n", 2); }