1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Formatting

This commit is contained in:
Tom Poole 2023-09-29 16:41:53 +01:00
parent ff0cb4ad5b
commit 4153d59e39
279 changed files with 1281 additions and 1281 deletions

View file

@ -104,7 +104,7 @@ class ArrayBaseTests : public UnitTest
using CopyableType = ArrayBaseTestsHelpers::TriviallyCopyableType;
using NoncopyableType = ArrayBaseTestsHelpers::NonTriviallyCopyableType;
#if ! (defined(__GNUC__) && __GNUC__ < 5 && ! defined(__clang__))
#if ! (defined (__GNUC__) && __GNUC__ < 5 && ! defined (__clang__))
static_assert (std::is_trivially_copyable_v<CopyableType>,
"Test TriviallyCopyableType is not trivially copyable");
static_assert (! std::is_trivially_copyable_v<NoncopyableType>,

View file

@ -385,7 +385,7 @@ public:
private:
//==============================================================================
#if defined(__GNUC__) && __GNUC__ < 5 && ! defined(__clang__)
#if defined (__GNUC__) && __GNUC__ < 5 && ! defined (__clang__)
static constexpr auto isTriviallyCopyable = std::is_scalar_v<ElementType>;
#else
static constexpr auto isTriviallyCopyable = std::is_trivially_copyable_v<ElementType>;

View file

@ -142,7 +142,7 @@ public:
for (auto i = hashSlots.size(); --i >= 0;)
{
auto* h = hashSlots.getUnchecked(i);
auto* h = hashSlots.getUnchecked (i);
while (h != nullptr)
{
@ -217,7 +217,7 @@ public:
const ScopedLockType sl (getLock());
for (auto i = getNumSlots(); --i >= 0;)
for (auto* entry = hashSlots.getUnchecked(i); entry != nullptr; entry = entry->nextEntry)
for (auto* entry = hashSlots.getUnchecked (i); entry != nullptr; entry = entry->nextEntry)
if (entry->value == valueToLookFor)
return true;
@ -269,7 +269,7 @@ public:
for (auto i = getNumSlots(); --i >= 0;)
{
auto* entry = hashSlots.getUnchecked(i);
auto* entry = hashSlots.getUnchecked (i);
HashEntry* previous = nullptr;
while (entry != nullptr)
@ -311,7 +311,7 @@ public:
{
HashEntry* nextEntry = nullptr;
for (auto* entry = hashSlots.getUnchecked(i); entry != nullptr; entry = nextEntry)
for (auto* entry = hashSlots.getUnchecked (i); entry != nullptr; entry = nextEntry)
{
auto hashIndex = generateHashFor (entry->key, newNumberOfSlots);

View file

@ -260,18 +260,18 @@ public:
//==============================================================================
#ifndef DOXYGEN
void call (void (ListenerClass::*callbackFunction) ())
void call (void (ListenerClass::*callbackFunction)())
{
call ([=] (ListenerClass& l) { (l.*callbackFunction)(); });
}
void callExcluding (ListenerClass* listenerToExclude, void (ListenerClass::*callbackFunction) ())
void callExcluding (ListenerClass* listenerToExclude, void (ListenerClass::*callbackFunction)())
{
callExcluding (listenerToExclude, [=] (ListenerClass& l) { (l.*callbackFunction)(); });
}
template <class BailOutCheckerType>
void callChecked (const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction) ())
void callChecked (const BailOutCheckerType& bailOutChecker, void (ListenerClass::*callbackFunction)())
{
callChecked (bailOutChecker, [=] (ListenerClass& l) { (l.*callbackFunction)(); });
}
@ -279,7 +279,7 @@ public:
template <class BailOutCheckerType>
void callCheckedExcluding (ListenerClass* listenerToExclude,
const BailOutCheckerType& bailOutChecker,
void (ListenerClass::*callbackFunction) ())
void (ListenerClass::*callbackFunction)())
{
callCheckedExcluding (listenerToExclude, bailOutChecker, [=] (ListenerClass& l) { (l.*callbackFunction)(); });
}

View file

@ -96,9 +96,9 @@ bool NamedValueSet::operator== (const NamedValueSet& other) const noexcept
for (int i = 0; i < num; ++i)
{
// optimise for the case where the keys are in the same order
if (values.getReference(i).name == other.values.getReference(i).name)
if (values.getReference (i).name == other.values.getReference (i).name)
{
if (values.getReference(i).value != other.values.getReference(i).value)
if (values.getReference (i).value != other.values.getReference (i).value)
return false;
}
else
@ -106,8 +106,8 @@ bool NamedValueSet::operator== (const NamedValueSet& other) const noexcept
// if we encounter keys that are in a different order, search remaining items by brute force..
for (int j = i; j < num; ++j)
{
if (auto* otherVal = other.getVarPointer (values.getReference(j).name))
if (values.getReference(j).value == *otherVal)
if (auto* otherVal = other.getVarPointer (values.getReference (j).name))
if (values.getReference (j).value == *otherVal)
continue;
return false;
@ -205,7 +205,7 @@ int NamedValueSet::indexOf (const Identifier& name) const noexcept
auto numValues = values.size();
for (int i = 0; i < numValues; ++i)
if (values.getReference(i).name == name)
if (values.getReference (i).name == name)
return i;
return -1;
@ -217,7 +217,7 @@ bool NamedValueSet::remove (const Identifier& name)
for (int i = 0; i < numValues; ++i)
{
if (values.getReference(i).name == name)
if (values.getReference (i).name == name)
{
values.remove (i);
return true;

View file

@ -161,7 +161,7 @@ public:
{
for (int i = ranges.size(); --i >= 0;)
{
auto& r = ranges.getReference(i);
auto& r = ranges.getReference (i);
if (r.getEnd() <= rangeToRemove.getStart())
break;

View file

@ -1055,7 +1055,7 @@ public:
expect (! File().existsAsFile());
expect (! File().isDirectory());
#if ! JUCE_WINDOWS
expect (File("/").isDirectory());
expect (File ("/").isDirectory());
#endif
expect (home.isDirectory());
expect (home.exists());

View file

@ -431,7 +431,7 @@ struct JSONFormatter
if (! allOnOneLine)
writeSpaces (out, indentLevel + indentSize);
write (out, array.getReference(i), indentLevel + indentSize, allOnOneLine, maximumDecimalPlaces);
write (out, array.getReference (i), indentLevel + indentSize, allOnOneLine, maximumDecimalPlaces);
if (i < array.size() - 1)
{

View file

@ -144,7 +144,7 @@ private:
{
push ((double) t);
}
else if (auto converted = convert(t))
else if (auto converted = convert (t))
{
push (*converted);
}

View file

@ -288,7 +288,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
ResultCode perform (const Scope& s, var* returnedValue) const override
{
return (condition->getResult(s) ? trueBranch : falseBranch)->perform (s, returnedValue);
return (condition->getResult (s) ? trueBranch : falseBranch)->perform (s, returnedValue);
}
ExpPtr condition;
@ -793,7 +793,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
DynamicObject::Ptr newObject (new DynamicObject());
for (int i = 0; i < names.size(); ++i)
newObject->setProperty (names.getUnchecked(i), initialisers.getUnchecked(i)->getResult (s));
newObject->setProperty (names.getUnchecked (i), initialisers.getUnchecked (i)->getResult (s));
return newObject.get();
}
@ -811,7 +811,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
Array<var> a;
for (int i = 0; i < values.size(); ++i)
a.add (values.getUnchecked(i)->getResult (s));
a.add (values.getUnchecked (i)->getResult (s));
// std::move() needed here for older compilers
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wredundant-move")
@ -848,7 +848,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
functionRoot->setProperty (thisIdent, args.thisObject);
for (int i = 0; i < parameters.size(); ++i)
functionRoot->setProperty (parameters.getReference(i),
functionRoot->setProperty (parameters.getReference (i),
i < args.numArguments ? args.arguments[i] : var::undefined());
var result;
@ -1641,7 +1641,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
auto target = get (a, 0);
for (int i = (a.numArguments > 1 ? getInt (a, 1) : 0); i < array->size(); ++i)
if (array->getReference(i) == target)
if (array->getReference (i) == target)
return i;
}
@ -1780,7 +1780,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
{
auto s = getString (a, 0).trim();
return s[0] == '0' ? (s[1] == 'x' ? s.substring(2).getHexValue64() : getOctalValue (s))
return s[0] == '0' ? (s[1] == 'x' ? s.substring (2).getHexValue64() : getOctalValue (s))
: s.getLargeIntValue();
}
};

View file

@ -1005,7 +1005,7 @@ void BigInteger::montgomeryMultiplication (const BigInteger& other, const BigInt
void BigInteger::extendedEuclidean (const BigInteger& a, const BigInteger& b,
BigInteger& x, BigInteger& y)
{
BigInteger p(a), q(b), gcd(1);
BigInteger p (a), q (b), gcd (1);
Array<BigInteger> tempValues;
while (! q.isZero())
@ -1321,12 +1321,12 @@ public:
Random r = getRandom();
expect (BigInteger().isZero());
expect (BigInteger(1).isOne());
expect (BigInteger (1).isOne());
for (int j = 10000; --j >= 0;)
{
BigInteger b1 (getBigRandom(r)),
b2 (getBigRandom(r));
BigInteger b1 (getBigRandom (r)),
b2 (getBigRandom (r));
BigInteger b3 = b1 + b2;
expect (b3 > b1 && b3 > b2);

View file

@ -69,7 +69,7 @@ public:
virtual void visitAllSymbols (SymbolVisitor& visitor, const Scope& scope, int recursionDepth)
{
for (int i = getNumInputs(); --i >= 0;)
getInput(i)->visitAllSymbols (visitor, scope, recursionDepth);
getInput (i)->visitAllSymbols (visitor, scope, recursionDepth);
}
private:
@ -238,7 +238,7 @@ struct Expression::Helpers
Type getType() const noexcept { return functionType; }
Term* clone() const { return new Function (functionName, parameters); }
int getNumInputs() const { return parameters.size(); }
Term* getInput (int i) const { return parameters.getReference(i).term.get(); }
Term* getInput (int i) const { return parameters.getReference (i).term.get(); }
String getName() const { return functionName; }
TermPtr resolve (const Scope& scope, int recursionDepth)
@ -252,7 +252,7 @@ struct Expression::Helpers
HeapBlock<double> params (numParams);
for (int i = 0; i < numParams; ++i)
params[i] = parameters.getReference(i).term->resolve (scope, recursionDepth + 1)->toDouble();
params[i] = parameters.getReference (i).term->resolve (scope, recursionDepth + 1)->toDouble();
result = scope.evaluateFunction (functionName, params, numParams);
}
@ -267,7 +267,7 @@ struct Expression::Helpers
int getInputIndexFor (const Term* possibleInput) const
{
for (int i = 0; i < parameters.size(); ++i)
if (parameters.getReference(i).term == possibleInput)
if (parameters.getReference (i).term == possibleInput)
return i;
return -1;
@ -282,7 +282,7 @@ struct Expression::Helpers
for (int i = 0; i < parameters.size(); ++i)
{
s << parameters.getReference(i).term->toString();
s << parameters.getReference (i).term->toString();
if (i < parameters.size() - 1)
s << ", ";

View file

@ -149,7 +149,7 @@ struct MathConstants
/** A predefined value for Euler's number */
static constexpr FloatType euler = static_cast<FloatType> (2.71828182845904523536L);
/** A predefined value for sqrt(2) */
/** A predefined value for sqrt (2) */
static constexpr FloatType sqrt2 = static_cast<FloatType> (1.4142135623730950488L);
};
@ -276,8 +276,8 @@ static Tolerance<Type> relativeTolerance (Type tolerance)
differences that are subnormal are always considered equal. It is highly recommend this
value is reviewed depending on the calculation being carried out. In general specifying an
absolute value is useful when considering values close to zero. For example you might
expect sin(pi) to return 0, but what it actually returns is close to the error of the value pi.
Therefore, in this example it might be better to set the absolute tolerance to sin(pi).
expect sin (pi) to return 0, but what it actually returns is close to the error of the value pi.
Therefore, in this example it might be better to set the absolute tolerance to sin (pi).
The default relative tolerance is equal to the machine epsilon which is the difference between
1.0 and the next floating-point value that can be represented by Type. In most cases this value

View file

@ -215,7 +215,7 @@ public:
expect (! approximatelyEqual (nan, nan));
const auto expectNotEqualTo = [&](auto value)
const auto expectNotEqualTo = [&] (auto value)
{
expect (! approximatelyEqual (value, nan));
expect (! approximatelyEqual (nan, value));
@ -242,7 +242,7 @@ public:
expect (! approximatelyEqual (inf, -inf));
expect (! approximatelyEqual (-inf, inf));
const auto expectNotEqualTo = [&](auto value)
const auto expectNotEqualTo = [&] (auto value)
{
expect (! approximatelyEqual (value, inf));
expect (! approximatelyEqual (value, -inf));
@ -274,11 +274,11 @@ public:
(T) 0.0078125 /* 2^-7 */
};
const auto testTolerance = [&](auto tolerance)
const auto testTolerance = [&] (auto tolerance)
{
const auto t = Tolerance<T>{}.withAbsolute ((T) tolerance);
const auto testValue= [&](auto value)
const auto testValue= [&] (auto value)
{
const auto boundary = value + tolerance;

View file

@ -113,7 +113,7 @@ private:
#if (DOXYGEN || JUCE_CHECK_MEMORY_LEAKS)
/** This macro lets you embed a leak-detecting object inside a class.
To use it, simply declare a JUCE_LEAK_DETECTOR(YourClassName) inside a private section
To use it, simply declare a JUCE_LEAK_DETECTOR (YourClassName) inside a private section
of the class declaration. E.g.
@code

View file

@ -135,7 +135,7 @@ private:
static SharedObjectHolder& getSharedObjectHolder() noexcept
{
static void* holder [(sizeof (SharedObjectHolder) + sizeof(void*) - 1) / sizeof(void*)] = { nullptr };
static void* holder [(sizeof (SharedObjectHolder) + sizeof (void*) - 1) / sizeof (void*)] = { nullptr };
return *reinterpret_cast<SharedObjectHolder*> (holder);
}

View file

@ -128,10 +128,10 @@ struct SingletonHolder : private MutexType // (inherited so we can use the empt
/**
Macro to generate the appropriate methods and boilerplate for a singleton class.
To use this, add the line JUCE_DECLARE_SINGLETON(MyClass, doNotRecreateAfterDeletion)
To use this, add the line JUCE_DECLARE_SINGLETON (MyClass, doNotRecreateAfterDeletion)
to the class's definition.
Then put a macro JUCE_IMPLEMENT_SINGLETON(MyClass) along with the class's
Then put a macro JUCE_IMPLEMENT_SINGLETON (MyClass) along with the class's
implementation code.
It's also a very good idea to also add the call clearSingletonInstance() in your class's

View file

@ -201,7 +201,7 @@ String ArgumentList::getValueForOption (StringRef option) const
for (int i = 0; i < arguments.size(); ++i)
{
auto& arg = arguments.getReference(i);
auto& arg = arguments.getReference (i);
if (arg == option)
{
@ -227,7 +227,7 @@ String ArgumentList::removeValueForOption (StringRef option)
for (int i = 0; i < arguments.size(); ++i)
{
auto& arg = arguments.getReference(i);
auto& arg = arguments.getReference (i);
if (arg == option)
{

View file

@ -161,7 +161,7 @@ struct AndroidDocumentDetail
documentId.get()) };
return DocumentsContractIteratorEngine { Columns { GlobalRef { uri },
GlobalRefImpl<jstring> { javaString("document_id") } },
GlobalRefImpl<jstring> { javaString ("document_id") } },
childrenUri.get() };
}

View file

@ -777,7 +777,7 @@ String File::getVersion() const
VS_FIXEDFILEINFO* vffi;
UINT len = 0;
if (VerQueryValue (buffer, (LPTSTR) _T("\\"), (LPVOID*) &vffi, &len))
if (VerQueryValue (buffer, (LPTSTR) _T ("\\"), (LPVOID*) &vffi, &len))
{
result << (int) HIWORD (vffi->dwFileVersionMS) << '.'
<< (int) LOWORD (vffi->dwFileVersionMS) << '.'

View file

@ -139,14 +139,14 @@ Array<JNIClassBase*>& JNIClassBase::getClasses()
static File getCodeCacheDirectory()
{
int pid = getpid();
File cmdline("/proc/" + String(pid) + "/cmdline");
File cmdline ("/proc/" + String (pid) + "/cmdline");
auto bundleId = cmdline.loadFileAsString().trimStart().trimEnd();
if (bundleId.isEmpty())
return {};
return File("/data/data/" + bundleId + "/code_cache");
return File ("/data/data/" + bundleId + "/code_cache");
}
void JNIClassBase::initialise (JNIEnv* env, jobject context)
@ -279,14 +279,14 @@ void JNIClassBase::initialiseAllClasses (JNIEnv* env, jobject context)
{
const Array<JNIClassBase*>& classes = getClasses();
for (int i = classes.size(); --i >= 0;)
classes.getUnchecked(i)->initialise (env, context);
classes.getUnchecked (i)->initialise (env, context);
}
void JNIClassBase::releaseAllClasses (JNIEnv* env)
{
const Array<JNIClassBase*>& classes = getClasses();
for (int i = classes.size(); --i >= 0;)
classes.getUnchecked(i)->release (env);
classes.getUnchecked (i)->release (env);
}
jmethodID JNIClassBase::resolveMethod (JNIEnv* env, const char* methodName, const char* params)

View file

@ -379,7 +379,7 @@ public:
{
#else
curl_off_t curlLength;
if (symbols->curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &curlLength) == CURLE_OK)
if (symbols->curl_easy_getinfo (curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &curlLength) == CURLE_OK)
{
#endif
contentLength = static_cast<int64> (curlLength);

View file

@ -511,9 +511,9 @@ private:
else
writeHost (header, httpRequestCmd, originalURL, proxyName, proxyPort);
writeValueIfNotPresent (header, userHeaders, "User-Agent:", "JUCE/" JUCE_STRINGIFY(JUCE_MAJOR_VERSION)
"." JUCE_STRINGIFY(JUCE_MINOR_VERSION)
"." JUCE_STRINGIFY(JUCE_BUILDNUMBER));
writeValueIfNotPresent (header, userHeaders, "User-Agent:", "JUCE/" JUCE_STRINGIFY (JUCE_MAJOR_VERSION)
"." JUCE_STRINGIFY (JUCE_MINOR_VERSION)
"." JUCE_STRINGIFY (JUCE_BUILDNUMBER));
writeValueIfNotPresent (header, userHeaders, "Connection:", "close");
const auto postDataSize = postData.getSize();

View file

@ -274,7 +274,7 @@ private:
void createConnection (const String& address, WebInputStream::Listener* listener)
{
static HINTERNET sessionHandle = InternetOpen (_T("juce"), INTERNET_OPEN_TYPE_PRECONFIG, nullptr, nullptr, 0);
static HINTERNET sessionHandle = InternetOpen (_T ("juce"), INTERNET_OPEN_TYPE_PRECONFIG, nullptr, nullptr, 0);
closeConnection();
@ -388,7 +388,7 @@ private:
void openHTTPConnection (URL_COMPONENTS& uc, const String& address, WebInputStream::Listener* listener)
{
const TCHAR* mimeTypes[] = { _T("*/*"), nullptr };
const TCHAR* mimeTypes[] = { _T ("*/*"), nullptr };
DWORD flags = INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_NO_COOKIES
| INTERNET_FLAG_NO_AUTO_REDIRECT;

View file

@ -182,13 +182,13 @@ struct PermissionsOverlay : FragmentOverlay
auto requestPermissionsMethodID
= env->GetMethodID(AndroidFragment, "requestPermissions", "([Ljava/lang/String;I)V");
= env->GetMethodID (AndroidFragment, "requestPermissions", "([Ljava/lang/String;I)V");
// this code should only be reached for SDKs >= 23, so this method should be
// be available
jassert(requestPermissionsMethodID != nullptr);
jassert (requestPermissionsMethodID != nullptr);
env->CallVoidMethod (getNativeHandle(), requestPermissionsMethodID, jPermissionsArray.get (), 0);
env->CallVoidMethod (getNativeHandle(), requestPermissionsMethodID, jPermissionsArray.get(), 0);
}
else
{

View file

@ -128,7 +128,7 @@ int SystemStats::getCpuSpeedInMegahertz()
for (int i = 0; i < getNumCpus(); ++i)
{
int freqKHz = File ("/sys/devices/system/cpu/cpu" + String(i) + "/cpufreq/cpuinfo_max_freq")
int freqKHz = File ("/sys/devices/system/cpu/cpu" + String (i) + "/cpufreq/cpuinfo_max_freq")
.loadFileAsString()
.getIntValue();

View file

@ -244,7 +244,7 @@ static DebugFlagsInitialiser debugFlagsInitialiser;
#if JUCE_MINGW
static uint64 getWindowsVersion()
{
auto filename = _T("kernel32.dll");
auto filename = _T ("kernel32.dll");
DWORD handle = 0;
if (auto size = GetFileVersionInfoSize (filename, &handle))
@ -256,7 +256,7 @@ static DebugFlagsInitialiser debugFlagsInitialiser;
VS_FIXEDFILEINFO* info = nullptr;
UINT verSize = 0;
if (VerQueryValue (data, (LPCTSTR) _T("\\"), (void**) &info, &verSize))
if (VerQueryValue (data, (LPCTSTR) _T ("\\"), (void**) &info, &verSize))
if (size > 0 && info != nullptr && info->dwSignature == 0xfeef04bd)
return ((uint64) info->dwFileVersionMS << 32) | (uint64) info->dwFileVersionLS;
}

View file

@ -72,7 +72,7 @@ extern "C" jint JNIEXPORT JNI_OnLoad (JavaVM* vm, void*)
auto* env = getEnv();
// register the initialisation function
auto juceJavaClass = env->FindClass("com/rmsl/juce/Java");
auto juceJavaClass = env->FindClass ("com/rmsl/juce/Java");
if (juceJavaClass != nullptr)
{

View file

@ -237,7 +237,7 @@ JUCE_API void JUCE_CALLTYPE Process::hide()
#if JUCE_MAC
[NSApp hide: nil];
#elif JUCE_IOS
[[UIApplication sharedApplication] performSelector: @selector(suspend)];
[[UIApplication sharedApplication] performSelector: @selector (suspend)];
#endif
}
}

View file

@ -178,7 +178,7 @@ struct SleepEvent
SleepEvent() noexcept
: handle (CreateEvent (nullptr, FALSE, FALSE,
#if JUCE_DEBUG
_T("JUCE Sleep Event")))
_T ("JUCE Sleep Event")))
#else
nullptr))
#endif

View file

@ -69,7 +69,7 @@ public:
@returns true on success; false may indicate that another socket is already bound
on the same port
@see bindToPort(int localPortNumber), IPAddress::getAllAddresses
@see bindToPort (int localPortNumber), IPAddress::getAllAddresses
*/
bool bindToPort (int localPortNumber, const String& localAddress);
@ -238,7 +238,7 @@ public:
@returns true on success; false may indicate that another socket is already bound
on the same port
@see bindToPort(int localPortNumber), IPAddress::getAllAddresses
@see bindToPort (int localPortNumber), IPAddress::getAllAddresses
*/
bool bindToPort (int localPortNumber, const String& localAddress);

View file

@ -947,7 +947,7 @@ String URL::removeEscapeChars (const String& s)
for (int i = 0; i < utf8.size(); ++i)
{
if (utf8.getUnchecked(i) == '%')
if (utf8.getUnchecked (i) == '%')
{
auto hexDigit1 = CharacterFunctions::getHexDigitValue ((juce_wchar) (uint8) utf8 [i + 1]);
auto hexDigit2 = CharacterFunctions::getHexDigitValue ((juce_wchar) (uint8) utf8 [i + 2]);
@ -975,7 +975,7 @@ String URL::addEscapeChars (const String& s, bool isParameter, bool roundBracket
for (int i = 0; i < utf8.size(); ++i)
{
auto c = utf8.getUnchecked(i);
auto c = utf8.getUnchecked (i);
if (! (CharacterFunctions::isLetterOrDigit (c)
|| legalChars.containsChar ((juce_wchar) c)))
@ -1022,7 +1022,7 @@ std::unique_ptr<InputStream> URL::createInputStream (bool usePostCommand,
.withConnectionTimeoutMs (timeOutMs)
.withResponseHeaders (responseHeaders)
.withStatusCode (statusCode)
.withNumRedirectsToFollow(numRedirectsToFollow)
.withNumRedirectsToFollow (numRedirectsToFollow)
.withHttpRequestCmd (httpRequestCmd));
}

View file

@ -33,7 +33,7 @@ WebInputStream::~WebInputStream()
}
WebInputStream& WebInputStream::withExtraHeaders (const String& extra) { pimpl->withExtraHeaders (extra); return *this; }
WebInputStream& WebInputStream::withCustomRequestCommand (const String& cmd) { pimpl->withCustomRequestCommand(cmd); return *this; }
WebInputStream& WebInputStream::withCustomRequestCommand (const String& cmd) { pimpl->withCustomRequestCommand (cmd); return *this; }
WebInputStream& WebInputStream::withConnectionTimeout (int t) { pimpl->withConnectionTimeout (t); return *this; }
WebInputStream& WebInputStream::withNumRedirectsToFollow (int num) { pimpl->withNumRedirectsToFollow (num); return *this; }
StringPairArray WebInputStream::getRequestHeaders() const { return pimpl->getRequestHeaders(); }

View file

@ -46,7 +46,7 @@ InputStream* URLInputSource::createInputStreamFor (const String& relatedItemPath
{
auto sub = u.getSubPath();
auto parent = sub.containsChar (L'/') ? sub.upToLastOccurrenceOf ("/", false, false)
: String ();
: String();
return u.withNewSubPath (parent)
.getChildURL (relatedItemPath)

View file

@ -232,8 +232,8 @@
*/
#if JUCE_CLANG && __clang_major__ >= JUCE_SANITIZER_ATTRIBUTE_MINIMUM_CLANG_VERSION
#define JUCE_BEGIN_NO_SANITIZE(warnings) \
_Pragma(JUCE_TO_STRING(clang attribute push(__attribute__((no_sanitize(warnings))), apply_to=function)))
#define JUCE_END_NO_SANITIZE _Pragma(JUCE_TO_STRING(clang attribute pop))
_Pragma (JUCE_TO_STRING (clang attribute push (__attribute__ ((no_sanitize (warnings))), apply_to=function)))
#define JUCE_END_NO_SANITIZE _Pragma (JUCE_TO_STRING (clang attribute pop))
#else
#define JUCE_BEGIN_NO_SANITIZE(warnings)
#define JUCE_END_NO_SANITIZE

View file

@ -87,7 +87,7 @@ namespace juce
#if JUCE_CLANG && defined (__has_feature) && ! defined (JUCE_ANALYZER_NORETURN)
#if __has_feature (attribute_analyzer_noreturn)
inline void __attribute__((analyzer_noreturn)) juce_assert_noreturn() {}
inline void __attribute__ ((analyzer_noreturn)) juce_assert_noreturn() {}
#define JUCE_ANALYZER_NORETURN juce::juce_assert_noreturn();
#endif
#endif
@ -283,7 +283,7 @@ namespace juce
#if JUCE_MSVC
#define forcedinline __forceinline
#else
#define forcedinline inline __attribute__((always_inline))
#define forcedinline inline __attribute__ ((always_inline))
#endif
#endif
@ -306,7 +306,7 @@ namespace juce
//==============================================================================
#if JUCE_GCC || JUCE_CLANG
#define JUCE_PACKED __attribute__((packed))
#define JUCE_PACKED __attribute__ ((packed))
#elif ! defined (DOXYGEN)
#define JUCE_PACKED
#endif
@ -315,7 +315,7 @@ namespace juce
#if JUCE_GCC || DOXYGEN
/** This can be appended to a function declaration to tell gcc to disable associative
math optimisations which break some floating point algorithms. */
#define JUCE_NO_ASSOCIATIVE_MATH_OPTIMISATIONS __attribute__((__optimize__("no-associative-math")))
#define JUCE_NO_ASSOCIATIVE_MATH_OPTIMISATIONS __attribute__ ((__optimize__ ("no-associative-math")))
#else
#define JUCE_NO_ASSOCIATIVE_MATH_OPTIMISATIONS
#endif

View file

@ -147,7 +147,7 @@ JUCE_END_IGNORE_WARNINGS_MSVC
#pragma warning (disable: 1125) // (virtual override warning)
#endif
#elif defined (JUCE_DLL) || defined (JUCE_DLL_BUILD)
#define JUCE_API __attribute__ ((visibility("default")))
#define JUCE_API __attribute__ ((visibility ("default")))
#endif
//==============================================================================

View file

@ -37,9 +37,9 @@ String SystemStats::getJUCEVersion()
static_assert (sizeof (int64) == 8, "Basic sanity test failed: please report!");
static_assert (sizeof (uint64) == 8, "Basic sanity test failed: please report!");
return "JUCE v" JUCE_STRINGIFY(JUCE_MAJOR_VERSION)
"." JUCE_STRINGIFY(JUCE_MINOR_VERSION)
"." JUCE_STRINGIFY(JUCE_BUILDNUMBER);
return "JUCE v" JUCE_STRINGIFY (JUCE_MAJOR_VERSION)
"." JUCE_STRINGIFY (JUCE_MINOR_VERSION)
"." JUCE_STRINGIFY (JUCE_BUILDNUMBER);
}
#if JUCE_ANDROID && ! defined (JUCE_DISABLE_JUCE_VERSION_PRINTING)

View file

@ -55,10 +55,10 @@ namespace juce
(you can use this to add comments).
Note that this is a singleton class, so don't create or destroy the object directly.
There's also a TRANS(text) macro defined to make it easy to use the this.
There's also a TRANS (text) macro defined to make it easy to use the this.
@code
printSomething (TRANS("hello"));
printSomething (TRANS ("hello"));
@endcode
This macro is used in the JUCE classes themselves, so your application has a chance to

View file

@ -789,7 +789,7 @@ namespace StringHelpers
template <typename T>
inline String& operationAddAssign (String& str, const T number)
{
char buffer [(sizeof(T) * 8) / 2];
char buffer [(sizeof (T) * 8) / 2];
auto* end = buffer + numElementsInArray (buffer);
auto* start = NumberToStringConverters::numberToString (end, number);
@ -2420,12 +2420,12 @@ public:
expect (s.compare (String ("012345678")) == 0);
expect (s.compare (String ("012345679")) < 0);
expect (s.compare (String ("012345676")) > 0);
expect (String("a").compareNatural ("A") == 0);
expect (String("A").compareNatural ("B") < 0);
expect (String("a").compareNatural ("B") < 0);
expect (String("10").compareNatural ("2") > 0);
expect (String("Abc 10").compareNatural ("aBC 2") > 0);
expect (String("Abc 1").compareNatural ("aBC 2") < 0);
expect (String ("a").compareNatural ("A") == 0);
expect (String ("A").compareNatural ("B") < 0);
expect (String ("a").compareNatural ("B") < 0);
expect (String ("10").compareNatural ("2") > 0);
expect (String ("Abc 10").compareNatural ("aBC 2") > 0);
expect (String ("Abc 1").compareNatural ("aBC 2") < 0);
expect (s.substring (2, 3) == String::charToString (s[2]));
expect (s.substring (0, 1) == String::charToString (s[0]));
expect (s.getLastCharacter() == s [s.length() - 1]);
@ -2707,7 +2707,7 @@ public:
expectEquals (s5.upToLastOccurrenceOf (String(), true, false), s5);
expectEquals (s5.upToLastOccurrenceOf ("zword", true, false), s5);
expectEquals (s5.upToLastOccurrenceOf ("word", true, false), s5.dropLastCharacters (1));
expectEquals (s5.dropLastCharacters(1).upToLastOccurrenceOf ("word", true, false), s5.dropLastCharacters (1));
expectEquals (s5.dropLastCharacters (1).upToLastOccurrenceOf ("word", true, false), s5.dropLastCharacters (1));
expectEquals (s5.upToLastOccurrenceOf ("Word", true, true), s5.dropLastCharacters (1));
expectEquals (s5.upToLastOccurrenceOf ("word", false, false), s5.dropLastCharacters (5));
expectEquals (s5.upToLastOccurrenceOf ("Word", false, true), s5.dropLastCharacters (5));

View file

@ -24,7 +24,7 @@
// Annoyingly we can only forward-declare a typedef by forward-declaring the
// aliased type
#if __has_attribute(objc_bridge)
#define JUCE_CF_BRIDGED_TYPE(T) __attribute__((objc_bridge(T)))
#define JUCE_CF_BRIDGED_TYPE(T) __attribute__ ((objc_bridge (T)))
#else
#define JUCE_CF_BRIDGED_TYPE(T)
#endif

View file

@ -201,7 +201,7 @@ int StringArray::indexOf (StringRef stringToLookFor, bool ignoreCase, int i) con
if (ignoreCase)
{
for (; i < numElements; ++i)
if (strings.getReference(i).equalsIgnoreCase (stringToLookFor))
if (strings.getReference (i).equalsIgnoreCase (stringToLookFor))
return i;
}
else
@ -230,7 +230,7 @@ void StringArray::removeString (StringRef stringToRemove, bool ignoreCase)
if (ignoreCase)
{
for (int i = size(); --i >= 0;)
if (strings.getReference(i).equalsIgnoreCase (stringToRemove))
if (strings.getReference (i).equalsIgnoreCase (stringToRemove))
strings.remove (i);
}
else
@ -252,13 +252,13 @@ void StringArray::removeEmptyStrings (bool removeWhitespaceStrings)
if (removeWhitespaceStrings)
{
for (int i = size(); --i >= 0;)
if (! strings.getReference(i).containsNonWhitespaceChars())
if (! strings.getReference (i).containsNonWhitespaceChars())
strings.remove (i);
}
else
{
for (int i = size(); --i >= 0;)
if (strings.getReference(i).isEmpty())
if (strings.getReference (i).isEmpty())
strings.remove (i);
}
}
@ -304,7 +304,7 @@ String StringArray::joinIntoString (StringRef separator, int start, int numberTo
auto bytesNeeded = (size_t) (last - start - 1) * separatorBytes;
for (int i = start; i < last; ++i)
bytesNeeded += strings.getReference(i).getCharPointer().sizeInBytes() - sizeof (String::CharPointerType::CharType);
bytesNeeded += strings.getReference (i).getCharPointer().sizeInBytes() - sizeof (String::CharPointerType::CharType);
String result;
result.preallocateBytes (bytesNeeded);
@ -412,7 +412,7 @@ void StringArray::removeDuplicates (bool ignoreCase)
{
for (int i = 0; i < size() - 1; ++i)
{
auto s = strings.getReference(i);
auto s = strings.getReference (i);
for (int nextIndex = i + 1;;)
{
@ -439,7 +439,7 @@ void StringArray::appendNumbersToDuplicates (bool ignoreCase,
for (int i = 0; i < size() - 1; ++i)
{
auto& s = strings.getReference(i);
auto& s = strings.getReference (i);
auto nextIndex = indexOf (s, ignoreCase, i + 1);
if (nextIndex >= 0)

View file

@ -149,7 +149,7 @@ void StringPool::garbageCollect()
const ScopedLock sl (lock);
for (int i = strings.size(); --i >= 0;)
if (strings.getReference(i).getReferenceCount() == 1)
if (strings.getReference (i).getReferenceCount() == 1)
strings.remove (i);
lastGarbageCollectionTime = Time::getApproximateMillisecondCounter();

View file

@ -153,7 +153,7 @@ public:
WaitableEvent timerFiredOnce;
WaitableEvent timerFiredTwice;
Timer timer {[&, callbackCount = 0] () mutable
Timer timer {[&, callbackCount = 0]() mutable
{
switch (++callbackCount)
{
@ -181,7 +181,7 @@ public:
{
WaitableEvent stoppedTimer;
auto timerCallback = [&](Timer& timer)
auto timerCallback = [&] (Timer& timer)
{
expect (timer.isTimerRunning());
timer.stopTimer();
@ -200,7 +200,7 @@ public:
WaitableEvent timerRestarted;
WaitableEvent timerFiredAfterRestart;
Timer timer {[&, callbackCount = 0] () mutable
Timer timer {[&, callbackCount = 0]() mutable
{
switch (++callbackCount)
{
@ -240,7 +240,7 @@ public:
WaitableEvent stoppingTimer;
std::atomic<bool> timerCallbackFinished { false };
Timer timer {[&, callbackCount = 0] () mutable
Timer timer {[&, callbackCount = 0]() mutable
{
switch (++callbackCount)
{
@ -295,7 +295,7 @@ public:
WaitableEvent timerFiredAfterRestart;
std::atomic<int> lastCallbackCount {0};
Timer timer {[&, callbackCount = 0] () mutable
Timer timer {[&, callbackCount = 0]() mutable
{
switch (++callbackCount)
{
@ -336,7 +336,7 @@ public:
WaitableEvent timerStopped;
WaitableEvent timerFiredAfterRestart;
Timer timer {[&, callbackCount = 0] () mutable
Timer timer {[&, callbackCount = 0]() mutable
{
switch (++callbackCount)
{

View file

@ -366,9 +366,9 @@ public:
beginTest ("Misc");
char a1[7];
expect (numElementsInArray(a1) == 7);
expect (numElementsInArray (a1) == 7);
int a2[3];
expect (numElementsInArray(a2) == 3);
expect (numElementsInArray (a2) == 3);
expect (ByteOrder::swap ((uint16) 0x1122) == 0x2211);
expect (ByteOrder::swap ((uint32) 0x11223344) == 0x44332211);

View file

@ -277,7 +277,7 @@ bool ThreadPool::removeAllJobs (bool interruptRunningJobs, int timeOutMs,
for (int i = jobs.size(); --i >= 0;)
{
auto* job = jobs.getUnchecked(i);
auto* job = jobs.getUnchecked (i);
if (selectedJobsToRemove == nullptr || selectedJobsToRemove->isJobSuitable (job))
{

View file

@ -75,13 +75,13 @@ static String translateTimeField (int n, const char* singular, const char* plura
return TRANS (n == 1 ? singular : plural).replace (n == 1 ? "1" : "2", String (n));
}
static String describeYears (int n) { return translateTimeField (n, NEEDS_TRANS("1 year"), NEEDS_TRANS("2 years")); }
static String describeMonths (int n) { return translateTimeField (n, NEEDS_TRANS("1 month"), NEEDS_TRANS("2 months")); }
static String describeWeeks (int n) { return translateTimeField (n, NEEDS_TRANS("1 week"), NEEDS_TRANS("2 weeks")); }
static String describeDays (int n) { return translateTimeField (n, NEEDS_TRANS("1 day"), NEEDS_TRANS("2 days")); }
static String describeHours (int n) { return translateTimeField (n, NEEDS_TRANS("1 hr"), NEEDS_TRANS("2 hrs")); }
static String describeMinutes (int n) { return translateTimeField (n, NEEDS_TRANS("1 min"), NEEDS_TRANS("2 mins")); }
static String describeSeconds (int n) { return translateTimeField (n, NEEDS_TRANS("1 sec"), NEEDS_TRANS("2 secs")); }
static String describeYears (int n) { return translateTimeField (n, NEEDS_TRANS ("1 year"), NEEDS_TRANS ("2 years")); }
static String describeMonths (int n) { return translateTimeField (n, NEEDS_TRANS ("1 month"), NEEDS_TRANS ("2 months")); }
static String describeWeeks (int n) { return translateTimeField (n, NEEDS_TRANS ("1 week"), NEEDS_TRANS ("2 weeks")); }
static String describeDays (int n) { return translateTimeField (n, NEEDS_TRANS ("1 day"), NEEDS_TRANS ("2 days")); }
static String describeHours (int n) { return translateTimeField (n, NEEDS_TRANS ("1 hr"), NEEDS_TRANS ("2 hrs")); }
static String describeMinutes (int n) { return translateTimeField (n, NEEDS_TRANS ("1 min"), NEEDS_TRANS ("2 mins")); }
static String describeSeconds (int n) { return translateTimeField (n, NEEDS_TRANS ("1 sec"), NEEDS_TRANS ("2 secs")); }
String RelativeTime::getApproximateDescription() const
{

View file

@ -206,7 +206,7 @@ public:
/** Returns the name of one of the elements attributes.
E.g. for an element such as \<MOOSE legs="4" antlers="2">, then
getAttributeName(1) would return "antlers".
getAttributeName (1) would return "antlers".
@see getAttributeValue, getStringAttribute
*/
@ -215,7 +215,7 @@ public:
/** Returns the value of one of the elements attributes.
E.g. for an element such as \<MOOSE legs="4" antlers="2">, then
getAttributeName(1) would return "2".
getAttributeName (1) would return "2".
@see getAttributeName, getStringAttribute
*/
@ -689,7 +689,7 @@ private:
return *this;
}
Iterator operator++(int)
Iterator operator++ (int)
{
auto copy = *this;
++(*this);
@ -790,7 +790,7 @@ private:
void reorderChildElements (XmlElement**, int) noexcept;
XmlAttributeNode* getAttribute (StringRef) const noexcept;
// Sigh.. L"" or _T("") string literals are problematic in general, and really inappropriate
// Sigh.. L"" or _T ("") string literals are problematic in general, and really inappropriate
// for XML tags. Use a UTF-8 encoded literal instead, or if you're really determined to use
// UTF-16, cast it to a String and use the other constructor.
XmlElement (const wchar_t*) = delete;