Browse Source

Minor fix for ReferenceCountedArray. Tweak to jucer template code.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
626cb292cd
10 changed files with 93 additions and 86 deletions
  1. +0
    -4
      extras/Jucer (experimental)/JuceLibraryCode/BinaryData.cpp
  2. +1
    -1
      extras/Jucer (experimental)/JuceLibraryCode/BinaryData.h
  3. +0
    -4
      extras/Jucer (experimental)/Source/BinaryData/jucer_MainTemplate.cpp
  4. +2
    -3
      extras/Jucer (experimental)/Source/Project/jucer_NewProjectWizard.cpp
  5. +45
    -37
      juce_amalgamated.h
  6. +12
    -9
      src/containers/juce_Array.h
  7. +16
    -15
      src/containers/juce_ReferenceCountedArray.h
  8. +13
    -10
      src/containers/juce_SortedSet.h
  9. +1
    -1
      src/core/juce_StandardHeader.h
  10. +3
    -2
      src/text/juce_String.h

+ 0
- 4
extras/Jucer (experimental)/JuceLibraryCode/BinaryData.cpp View File

@@ -683,14 +683,10 @@ static const unsigned char temp_760350be[] =
" //==============================================================================\r\n"
" APPCLASSNAME()MEMBERINITIALISERS\r\n"
" {\r\n"
" // Don't do anything in this constructor! It will be called before the\r\n"
" // main Juce subsystem has been initialised!\r\n"
" }\r\n"
"\r\n"
" ~APPCLASSNAME()\r\n"
" {\r\n"
" // Don't do anything in this destructor! It will be called after the\r\n"
" // main Juce subsystem has been shutdown and is no longer valid!\r\n"
" }\r\n"
"\r\n"
" //==============================================================================\r\n"


+ 1
- 1
extras/Jucer (experimental)/JuceLibraryCode/BinaryData.h View File

@@ -29,7 +29,7 @@ namespace BinaryData
const int jucer_MainConsoleAppTemplate_cppSize = 749;
extern const char* jucer_MainTemplate_cpp;
const int jucer_MainTemplate_cppSize = 2106;
const int jucer_MainTemplate_cppSize = 1820;
extern const char* jucer_NewCppFileTemplate_cpp;
const int jucer_NewCppFileTemplate_cppSize = 232;


+ 0
- 4
extras/Jucer (experimental)/Source/BinaryData/jucer_MainTemplate.cpp View File

@@ -18,14 +18,10 @@ public:
//==============================================================================
APPCLASSNAME()MEMBERINITIALISERS
{
// Don't do anything in this constructor! It will be called before the
// main Juce subsystem has been initialised!
}
~APPCLASSNAME()
{
// Don't do anything in this destructor! It will be called after the
// main Juce subsystem has been shutdown and is no longer valid!
}
//==============================================================================


+ 2
- 3
extras/Jucer (experimental)/Source/Project/jucer_NewProjectWizard.cpp View File

@@ -85,10 +85,9 @@ public:
if (createWindow)
{
appHeaders << newLine << CodeHelpers::createIncludeStatement (mainWindowH, mainCppFile);
memberInitialisers = " : mainWindow (0)";
initCode = "mainWindow = new " + windowClassName + "();";
shutdownCode = "deleteAndZero (mainWindow);";
privateMembers = windowClassName + "* mainWindow;";
shutdownCode = "mainWindow = 0;";
privateMembers = "ScopedPointer <" + windowClassName + "> mainWindow;";
String windowH = project.getFileTemplate ("jucer_WindowTemplate_h")
.replace ("INCLUDES", CodeHelpers::createIncludeStatement (project.getAppIncludeFile(), mainWindowH), false)


+ 45
- 37
juce_amalgamated.h View File

@@ -64,7 +64,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 66
#define JUCE_BUILDNUMBER 67

/** Current Juce version number.

@@ -1855,8 +1855,9 @@ public:

Uses a case-sensitive comparison.

@returns true if the all the characters in the string are also found in the
string that is passed in.
@returns Returns false if any of the characters in this string do not occur in
the parameter string. If this string is empty, the return value will
always be true.
*/
bool containsOnly (const String& charactersItMightContain) const throw();

@@ -3996,19 +3997,22 @@ public:
int numElementsToAdd = -1)
{
const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
const ScopedLockType lock2 (getLock());

if (startIndex < 0)
{
jassertfalse;
startIndex = 0;
}
const ScopedLockType lock2 (getLock());

if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
numElementsToAdd = arrayToAddFrom.size() - startIndex;
if (startIndex < 0)
{
jassertfalse;
startIndex = 0;
}

while (--numElementsToAdd >= 0)
add (arrayToAddFrom.getUnchecked (startIndex++));
if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
numElementsToAdd = arrayToAddFrom.size() - startIndex;

while (--numElementsToAdd >= 0)
add (arrayToAddFrom.getUnchecked (startIndex++));
}
}

/** Inserts a new element into the array, assuming that the array is sorted.
@@ -10847,27 +10851,28 @@ public:
int startIndex = 0,
int numElementsToAdd = -1) throw()
{
arrayToAddFrom.lockArray();
const ScopedLockType lock (getLock());
const ScopedLockType lock1 (arrayToAddFrom.getLock());

if (startIndex < 0)
{
jassertfalse;
startIndex = 0;
}
const ScopedLockType lock2 (getLock());

if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
numElementsToAdd = arrayToAddFrom.size() - startIndex;
if (startIndex < 0)
{
jassertfalse;
startIndex = 0;
}

if (numElementsToAdd > 0)
{
data.ensureAllocatedSize (numUsed + numElementsToAdd);
if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
numElementsToAdd = arrayToAddFrom.size() - startIndex;

while (--numElementsToAdd >= 0)
add (arrayToAddFrom.getUnchecked (startIndex++));
}
if (numElementsToAdd > 0)
{
data.ensureAllocatedSize (numUsed + numElementsToAdd);

arrayToAddFrom.unlockArray();
while (--numElementsToAdd >= 0)
add (arrayToAddFrom.getUnchecked (startIndex++));
}
}
}

/** Inserts a new object into the array assuming that the array is sorted.
@@ -11553,21 +11558,24 @@ public:
int numElementsToAdd = -1) throw()
{
const typename OtherSetType::ScopedLockType lock1 (setToAddFrom.getLock());
const ScopedLockType lock2 (getLock());
jassert (this != &setToAddFrom);

if (this != &setToAddFrom)
{
if (startIndex < 0)
const ScopedLockType lock2 (getLock());
jassert (this != &setToAddFrom);

if (this != &setToAddFrom)
{
jassertfalse;
startIndex = 0;
}
if (startIndex < 0)
{
jassertfalse;
startIndex = 0;
}

if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
numElementsToAdd = setToAddFrom.size() - startIndex;
if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
numElementsToAdd = setToAddFrom.size() - startIndex;

addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
}
}
}



+ 12
- 9
src/containers/juce_Array.h View File

@@ -570,19 +570,22 @@ public:
int numElementsToAdd = -1)
{
const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
const ScopedLockType lock2 (getLock());
if (startIndex < 0)
{
jassertfalse;
startIndex = 0;
}
const ScopedLockType lock2 (getLock());
if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
numElementsToAdd = arrayToAddFrom.size() - startIndex;
if (startIndex < 0)
{
jassertfalse;
startIndex = 0;
}
while (--numElementsToAdd >= 0)
add (arrayToAddFrom.getUnchecked (startIndex++));
if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
numElementsToAdd = arrayToAddFrom.size() - startIndex;
while (--numElementsToAdd >= 0)
add (arrayToAddFrom.getUnchecked (startIndex++));
}
}
/** Inserts a new element into the array, assuming that the array is sorted.


+ 16
- 15
src/containers/juce_ReferenceCountedArray.h View File

@@ -339,27 +339,28 @@ public:
int startIndex = 0,
int numElementsToAdd = -1) throw()
{
arrayToAddFrom.lockArray();
const ScopedLockType lock (getLock());
const ScopedLockType lock1 (arrayToAddFrom.getLock());
if (startIndex < 0)
{
jassertfalse;
startIndex = 0;
}
const ScopedLockType lock2 (getLock());
if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
numElementsToAdd = arrayToAddFrom.size() - startIndex;
if (startIndex < 0)
{
jassertfalse;
startIndex = 0;
}
if (numElementsToAdd > 0)
{
data.ensureAllocatedSize (numUsed + numElementsToAdd);
if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
numElementsToAdd = arrayToAddFrom.size() - startIndex;
while (--numElementsToAdd >= 0)
add (arrayToAddFrom.getUnchecked (startIndex++));
}
if (numElementsToAdd > 0)
{
data.ensureAllocatedSize (numUsed + numElementsToAdd);
arrayToAddFrom.unlockArray();
while (--numElementsToAdd >= 0)
add (arrayToAddFrom.getUnchecked (startIndex++));
}
}
}
/** Inserts a new object into the array assuming that the array is sorted.


+ 13
- 10
src/containers/juce_SortedSet.h View File

@@ -376,21 +376,24 @@ public:
int numElementsToAdd = -1) throw()
{
const typename OtherSetType::ScopedLockType lock1 (setToAddFrom.getLock());
const ScopedLockType lock2 (getLock());
jassert (this != &setToAddFrom);
if (this != &setToAddFrom)
{
if (startIndex < 0)
const ScopedLockType lock2 (getLock());
jassert (this != &setToAddFrom);
if (this != &setToAddFrom)
{
jassertfalse;
startIndex = 0;
}
if (startIndex < 0)
{
jassertfalse;
startIndex = 0;
}
if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
numElementsToAdd = setToAddFrom.size() - startIndex;
if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
numElementsToAdd = setToAddFrom.size() - startIndex;
addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
}
}
}


+ 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 66
#define JUCE_BUILDNUMBER 67
/** Current Juce version number.


+ 3
- 2
src/text/juce_String.h View File

@@ -291,8 +291,9 @@ public:
Uses a case-sensitive comparison.
@returns true if the all the characters in the string are also found in the
string that is passed in.
@returns Returns false if any of the characters in this string do not occur in
the parameter string. If this string is empty, the return value will
always be true.
*/
bool containsOnly (const String& charactersItMightContain) const throw();


Loading…
Cancel
Save