Browse Source

Fixed a bug in the Flac writer. Optimised BigInteger::getHighestBit(). Misc minor clean-ups.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
59ac5a6d25
22 changed files with 394 additions and 392 deletions
  1. +194
    -191
      juce_amalgamated.cpp
  2. +3
    -5
      juce_amalgamated.h
  3. +3
    -8
      src/audio/audio_file_formats/juce_FlacAudioFormat.cpp
  4. +45
    -19
      src/containers/juce_BigInteger.cpp
  5. +1
    -1
      src/core/juce_StandardHeader.h
  6. +10
    -10
      src/cryptography/juce_MD5.cpp
  7. +6
    -6
      src/cryptography/juce_Primes.cpp
  8. +15
    -15
      src/gui/components/code_editor/juce_CPlusPlusCodeTokeniser.cpp
  9. +1
    -1
      src/gui/components/controls/juce_TextEditor.cpp
  10. +3
    -12
      src/gui/components/juce_Component.cpp
  11. +2
    -4
      src/gui/components/juce_Component.h
  12. +2
    -2
      src/gui/components/keyboard/juce_KeyPress.cpp
  13. +3
    -3
      src/gui/graphics/colour/juce_Colour.cpp
  14. +25
    -33
      src/gui/graphics/contexts/juce_RectanglePlacement.cpp
  15. +2
    -2
      src/gui/graphics/geometry/juce_Path.cpp
  16. +36
    -36
      src/gui/graphics/geometry/juce_PathStrokeType.cpp
  17. +1
    -1
      src/gui/graphics/geometry/juce_RelativeCoordinate.cpp
  18. +12
    -12
      src/gui/graphics/imaging/image_file_formats/juce_JPEGLoader.cpp
  19. +3
    -3
      src/gui/graphics/imaging/image_file_formats/juce_PNGLoader.cpp
  20. +14
    -15
      src/io/network/juce_Socket.cpp
  21. +7
    -7
      src/text/juce_String.cpp
  22. +6
    -6
      src/text/juce_XmlElement.cpp

+ 194
- 191
juce_amalgamated.cpp View File

@@ -2749,36 +2749,62 @@ void BigInteger::negate() throw()
negative = (! negative) && ! isZero();
}

int BigInteger::countNumberOfSetBits() const throw()
#if JUCE_USE_INTRINSICS
#pragma intrinsic (_BitScanReverse)
#endif

namespace BitFunctions
{
int total = 0;
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;
}

for (int i = bitToIndex (highestBit) + 1; --i >= 0;)
inline int highestBitInInt (uint32 n) throw()
{
uint32 n = values[i];
jassert (n != 0); // (the built-in functions may not work for n = 0)

if (n == 0xffffffff)
{
total += 32;
}
else
{
while (n != 0)
{
total += (n & 1);
n >>= 1;
}
}
#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;)
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<uint32*> (output)[i] = ByteOrder::swapIfBigEndian (static_cast<const uint32*> (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 <wchar_t>).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<Component> 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<Component> 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<flo
if (source.isEmpty())
return AffineTransform::identity;

float w = source.getWidth();
float h = source.getHeight();

const float scaleX = destination.getWidth() / w;
const float scaleY = destination.getHeight() / h;

if ((flags & stretchToFit) != 0)
return AffineTransform::translation (-source.getX(), -source.getY())
.scaled (scaleX, scaleY)
.translated (destination.getX(), destination.getY());
float newX = destination.getX();
float newY = destination.getY();

float scale = (flags & fillDestination) != 0 ? jmax (scaleX, scaleY)
: jmin (scaleX, scaleY);
float scaleX = destination.getWidth() / source.getWidth();
float scaleY = destination.getHeight() / source.getHeight();

if ((flags & onlyReduceInSize) != 0)
scale = jmin (scale, 1.0f);
if ((flags & stretchToFit) == 0)
{
scaleX = (flags & fillDestination) != 0 ? jmax (scaleX, scaleY)
: jmin (scaleX, scaleY);

if ((flags & onlyIncreaseInSize) != 0)
scale = jmax (scale, 1.0f);
if ((flags & onlyReduceInSize) != 0)
scaleX = jmin (scaleX, 1.0f);

w *= scale;
h *= scale;
if ((flags & onlyIncreaseInSize) != 0)
scaleX = jmax (scaleX, 1.0f);

float newX = destination.getX();
float newY = destination.getY();
scaleY = scaleX;

if ((flags & xRight) != 0)
newX += destination.getWidth() - w; // right
else if ((flags & xLeft) == 0)
newX += (destination.getWidth() - w) / 2.0f; // centre
if ((flags & xRight) != 0)
newX += destination.getWidth() - source.getWidth() * scaleX; // right
else if ((flags & xLeft) == 0)
newX += (destination.getWidth() - source.getWidth() * scaleX) / 2.0f; // centre

if ((flags & yBottom) != 0)
newY += destination.getHeight() - h; // bottom
else if ((flags & yTop) == 0)
newY += (destination.getHeight() - h) / 2.0f; // centre
if ((flags & yBottom) != 0)
newY += destination.getHeight() - source.getHeight() * scaleX; // bottom
else if ((flags & yTop) == 0)
newY += (destination.getHeight() - source.getHeight() * scaleX) / 2.0f; // centre
}

return AffineTransform::translation (-source.getX(), -source.getY())
.scaled (scale, scale)
.scaled (scaleX, scaleY)
.translated (newX, newY);
}

@@ -91824,9 +91832,9 @@ BEGIN_JUCE_NAMESPACE

namespace PathHelpers
{
static const float ellipseAngularIncrement = 0.05f;
const float ellipseAngularIncrement = 0.05f;

static const String nextToken (const juce_wchar*& t)
const String nextToken (const juce_wchar*& t)
{
while (CharacterFunctions::isWhitespace (*t))
++t;
@@ -93657,13 +93665,13 @@ bool PathStrokeType::operator!= (const PathStrokeType& other) const throw()

namespace PathStrokeHelpers
{
static bool lineIntersection (const float x1, const float y1,
const float x2, const float y2,
const float x3, const float y3,
const float x4, const float y4,
float& intersectionX,
float& intersectionY,
float& distanceBeyondLine1EndSquared) throw()
bool lineIntersection (const float x1, const float y1,
const float x2, const float y2,
const float x3, const float y3,
const float x4, const float y4,
float& intersectionX,
float& intersectionY,
float& distanceBeyondLine1EndSquared) throw()
{
if (x2 != x3 || y2 != y3)
{
@@ -93774,14 +93782,14 @@ namespace PathStrokeHelpers
return true;
}

static void addEdgeAndJoint (Path& destPath,
const PathStrokeType::JointStyle style,
const float maxMiterExtensionSquared, const float width,
const float x1, const float y1,
const float x2, const float y2,
const float x3, const float y3,
const float x4, const float y4,
const float midX, const float midY)
void addEdgeAndJoint (Path& destPath,
const PathStrokeType::JointStyle style,
const float maxMiterExtensionSquared, const float width,
const float x1, const float y1,
const float x2, const float y2,
const float x3, const float y3,
const float x4, const float y4,
const float midX, const float midY)
{
if (style == PathStrokeType::beveled
|| (x3 == x4 && y3 == y4)
@@ -93869,11 +93877,11 @@ namespace PathStrokeHelpers
}
}

static void addLineEnd (Path& destPath,
const PathStrokeType::EndCapStyle style,
const float x1, const float y1,
const float x2, const float y2,
const float width)
void addLineEnd (Path& destPath,
const PathStrokeType::EndCapStyle style,
const float x1, const float y1,
const float x2, const float y2,
const float width)
{
if (style == PathStrokeType::butt)
{
@@ -93934,12 +93942,12 @@ namespace PathStrokeHelpers
float endWidth, endLength;
};

static void addArrowhead (Path& destPath,
const float x1, const float y1,
const float x2, const float y2,
const float tipX, const float tipY,
const float width,
const float arrowheadWidth)
void addArrowhead (Path& destPath,
const float x1, const float y1,
const float x2, const float y2,
const float tipX, const float tipY,
const float width,
const float arrowheadWidth)
{
Line<float> 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<LineSection>& subPath, float amountAtStart, float amountAtEnd)
void shortenSubPath (Array<LineSection>& subPath, float amountAtStart, float amountAtEnd)
{
while (amountAtEnd > 0 && subPath.size() > 0)
{
@@ -94014,10 +94022,10 @@ namespace PathStrokeHelpers
}
}

static void addSubPath (Path& destPath, Array<LineSection>& 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<LineSection>& 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<int> temp;
const int bitsToShift = 32 - bitsPerSample;

if (bitsToShift > 0)
{
const int numChannelsToWrite = (samplesToWrite[1] == 0) ? 1 : 2;
HeapBlock<int> 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<const int**> (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 <JuceJpegDest*> (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 <JuceJpegDest*> (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<InputStream*> (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<OutputStream*> (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();
}


+ 3
- 5
juce_amalgamated.h View File

@@ -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<int>& delta,
const Rectangle<int>& clipRect,
const Component* const compToAvoid) const;
void clipObscuredRegions (Graphics& g, const Rectangle<int>& clipRect,
int deltaX, int deltaY) const;
const Rectangle<int>& clipRect, const Component* const compToAvoid) const;
void clipObscuredRegions (Graphics& g, const Rectangle<int>& clipRect, int deltaX, int deltaY) const;

// how much of the component is not off the edges of its parents
const Rectangle<int> getUnclippedArea() const;


+ 3
- 8
src/audio/audio_file_formats/juce_FlacAudioFormat.cpp View File

@@ -364,32 +364,27 @@ public:
return false;
int* buf[3];
HeapBlock<int> temp;
const int bitsToShift = 32 - bitsPerSample;
if (bitsToShift > 0)
{
const int numChannelsToWrite = (samplesToWrite[1] == 0) ? 1 : 2;
HeapBlock<int> 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<const int**> (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


+ 45
- 19
src/containers/juce_BigInteger.cpp View File

@@ -281,36 +281,62 @@ void BigInteger::negate() throw()
negative = (! negative) && ! isZero();
}
int BigInteger::countNumberOfSetBits() const throw()
#if JUCE_USE_INTRINSICS
#pragma intrinsic (_BitScanReverse)
#endif
namespace BitFunctions
{
int total = 0;
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;
}
for (int i = bitToIndex (highestBit) + 1; --i >= 0;)
inline int highestBitInInt (uint32 n) throw()
{
uint32 n = values[i];
jassert (n != 0); // (the built-in functions may not work for n = 0)
if (n == 0xffffffff)
{
total += 32;
}
else
{
while (n != 0)
{
total += (n & 1);
n >>= 1;
}
}
#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;)
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;
}


+ 1
- 1
src/core/juce_StandardHeader.h View File

@@ -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.


+ 10
- 10
src/cryptography/juce_MD5.cpp View File

@@ -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<uint32*> (output)[i] = ByteOrder::swapIfBigEndian (static_cast<const uint32*> (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;


+ 6
- 6
src/cryptography/juce_Primes.cpp View File

@@ -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);


+ 15
- 15
src/gui/components/code_editor/juce_CPlusPlusCodeTokeniser.cpp View File

@@ -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;


+ 1
- 1
src/gui/components/controls/juce_TextEditor.cpp View File

@@ -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);


+ 3
- 12
src/gui/components/juce_Component.cpp View File

@@ -1433,10 +1433,7 @@ void Component::exitModalState (const int returnValue)
private:
Component::SafePointer<Component> 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<Component> target;
const int commandId;
CustomCommandMessage (CustomCommandMessage&);
CustomCommandMessage& operator= (const CustomCommandMessage&);
int commandId;
};
(new CustomCommandMessage (this, commandId))->post();


+ 2
- 4
src/gui/components/juce_Component.h View File

@@ -2071,10 +2071,8 @@ private:
static void* runModalLoopCallback (void*);
static void bringModalComponentToFront();
void subtractObscuredRegions (RectangleList& result, const Point<int>& delta,
const Rectangle<int>& clipRect,
const Component* const compToAvoid) const;
void clipObscuredRegions (Graphics& g, const Rectangle<int>& clipRect,
int deltaX, int deltaY) const;
const Rectangle<int>& clipRect, const Component* const compToAvoid) const;
void clipObscuredRegions (Graphics& g, const Rectangle<int>& clipRect, int deltaX, int deltaY) const;
// how much of the component is not off the edges of its parents
const Rectangle<int> getUnclippedArea() const;


+ 2
- 2
src/gui/components/keyboard/juce_KeyPress.cpp View File

@@ -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 "; }
}
//==============================================================================


+ 3
- 3
src/gui/graphics/colour/juce_Colour.cpp View File

@@ -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;


+ 25
- 33
src/gui/graphics/contexts/juce_RectanglePlacement.cpp View File

@@ -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<flo
if (source.isEmpty())
return AffineTransform::identity;
float w = source.getWidth();
float h = source.getHeight();
const float scaleX = destination.getWidth() / w;
const float scaleY = destination.getHeight() / h;
if ((flags & stretchToFit) != 0)
return AffineTransform::translation (-source.getX(), -source.getY())
.scaled (scaleX, scaleY)
.translated (destination.getX(), destination.getY());
float newX = destination.getX();
float newY = destination.getY();
float scale = (flags & fillDestination) != 0 ? jmax (scaleX, scaleY)
: jmin (scaleX, scaleY);
float scaleX = destination.getWidth() / source.getWidth();
float scaleY = destination.getHeight() / source.getHeight();
if ((flags & onlyReduceInSize) != 0)
scale = jmin (scale, 1.0f);
if ((flags & stretchToFit) == 0)
{
scaleX = (flags & fillDestination) != 0 ? jmax (scaleX, scaleY)
: jmin (scaleX, scaleY);
if ((flags & onlyIncreaseInSize) != 0)
scale = jmax (scale, 1.0f);
if ((flags & onlyReduceInSize) != 0)
scaleX = jmin (scaleX, 1.0f);
w *= scale;
h *= scale;
if ((flags & onlyIncreaseInSize) != 0)
scaleX = jmax (scaleX, 1.0f);
float newX = destination.getX();
float newY = destination.getY();
scaleY = scaleX;
if ((flags & xRight) != 0)
newX += destination.getWidth() - w; // right
else if ((flags & xLeft) == 0)
newX += (destination.getWidth() - w) / 2.0f; // centre
if ((flags & xRight) != 0)
newX += destination.getWidth() - source.getWidth() * scaleX; // right
else if ((flags & xLeft) == 0)
newX += (destination.getWidth() - source.getWidth() * scaleX) / 2.0f; // centre
if ((flags & yBottom) != 0)
newY += destination.getHeight() - h; // bottom
else if ((flags & yTop) == 0)
newY += (destination.getHeight() - h) / 2.0f; // centre
if ((flags & yBottom) != 0)
newY += destination.getHeight() - source.getHeight() * scaleX; // bottom
else if ((flags & yTop) == 0)
newY += (destination.getHeight() - source.getHeight() * scaleX) / 2.0f; // centre
}
return AffineTransform::translation (-source.getX(), -source.getY())
.scaled (scale, scale)
.scaled (scaleX, scaleY)
.translated (newX, newY);
}


+ 2
- 2
src/gui/graphics/geometry/juce_Path.cpp View File

@@ -41,9 +41,9 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
namespace PathHelpers
{
static const float ellipseAngularIncrement = 0.05f;
const float ellipseAngularIncrement = 0.05f;
static const String nextToken (const juce_wchar*& t)
const String nextToken (const juce_wchar*& t)
{
while (CharacterFunctions::isWhitespace (*t))
++t;


+ 36
- 36
src/gui/graphics/geometry/juce_PathStrokeType.cpp View File

@@ -75,13 +75,13 @@ bool PathStrokeType::operator!= (const PathStrokeType& other) const throw()
//==============================================================================
namespace PathStrokeHelpers
{
static bool lineIntersection (const float x1, const float y1,
const float x2, const float y2,
const float x3, const float y3,
const float x4, const float y4,
float& intersectionX,
float& intersectionY,
float& distanceBeyondLine1EndSquared) throw()
bool lineIntersection (const float x1, const float y1,
const float x2, const float y2,
const float x3, const float y3,
const float x4, const float y4,
float& intersectionX,
float& intersectionY,
float& distanceBeyondLine1EndSquared) throw()
{
if (x2 != x3 || y2 != y3)
{
@@ -192,14 +192,14 @@ namespace PathStrokeHelpers
return true;
}
static void addEdgeAndJoint (Path& destPath,
const PathStrokeType::JointStyle style,
const float maxMiterExtensionSquared, const float width,
const float x1, const float y1,
const float x2, const float y2,
const float x3, const float y3,
const float x4, const float y4,
const float midX, const float midY)
void addEdgeAndJoint (Path& destPath,
const PathStrokeType::JointStyle style,
const float maxMiterExtensionSquared, const float width,
const float x1, const float y1,
const float x2, const float y2,
const float x3, const float y3,
const float x4, const float y4,
const float midX, const float midY)
{
if (style == PathStrokeType::beveled
|| (x3 == x4 && y3 == y4)
@@ -287,11 +287,11 @@ namespace PathStrokeHelpers
}
}
static void addLineEnd (Path& destPath,
const PathStrokeType::EndCapStyle style,
const float x1, const float y1,
const float x2, const float y2,
const float width)
void addLineEnd (Path& destPath,
const PathStrokeType::EndCapStyle style,
const float x1, const float y1,
const float x2, const float y2,
const float width)
{
if (style == PathStrokeType::butt)
{
@@ -352,12 +352,12 @@ namespace PathStrokeHelpers
float endWidth, endLength;
};
static void addArrowhead (Path& destPath,
const float x1, const float y1,
const float x2, const float y2,
const float tipX, const float tipY,
const float width,
const float arrowheadWidth)
void addArrowhead (Path& destPath,
const float x1, const float y1,
const float x2, const float y2,
const float tipX, const float tipY,
const float width,
const float arrowheadWidth)
{
Line<float> 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<LineSection>& subPath, float amountAtStart, float amountAtEnd)
void shortenSubPath (Array<LineSection>& subPath, float amountAtStart, float amountAtEnd)
{
while (amountAtEnd > 0 && subPath.size() > 0)
{
@@ -432,10 +432,10 @@ namespace PathStrokeHelpers
}
}
static void addSubPath (Path& destPath, Array<LineSection>& 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<LineSection>& 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)
{


+ 1
- 1
src/gui/graphics/geometry/juce_RelativeCoordinate.cpp View File

@@ -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;


+ 12
- 12
src/gui/graphics/imaging/image_file_formats/juce_JPEGLoader.cpp View File

@@ -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 <JuceJpegDest*> (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 <JuceJpegDest*> (cinfo->dest);


+ 3
- 3
src/gui/graphics/imaging/image_file_formats/juce_PNGLoader.cpp View File

@@ -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<InputStream*> (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<OutputStream*> (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();
}


+ 14
- 15
src/io/network/juce_Socket.cpp View File

@@ -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());


+ 7
- 7
src/text/juce_String.cpp View File

@@ -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 <wchar_t>).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);


+ 6
- 6
src/text/juce_XmlElement.cpp View File

@@ -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);
}


Loading…
Cancel
Save