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

Removed the (rather pointless) granularity value from the array objects. Converted a few macros into functions and other misc code clean-ups.

This commit is contained in:
Julian Storer 2010-01-13 18:58:40 +00:00
parent c368805559
commit 97035bb3a1
69 changed files with 218 additions and 369 deletions

View file

@ -204,7 +204,8 @@ private:
const float* s = buffer.getSampleData (0, 0);
const int spikeDriftAllowed = 5;
Array <int> spikesFound (100);
Array <int> spikesFound;
spikesFound.ensureStorageAllocated (100);
double runningAverage = 0;
int lastSpike = 0;

View file

@ -38,8 +38,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
ApplicationCommandManager::ApplicationCommandManager()
: listeners (8),
firstTarget (0)
: firstTarget (0)
{
keyMappings = new KeyPressMappingSet (this);
@ -166,7 +165,7 @@ const StringArray ApplicationCommandManager::getCommandCategories() const throw(
const Array <CommandID> ApplicationCommandManager::getCommandsInCategory (const String& categoryName) const throw()
{
Array <CommandID> results (4);
Array <CommandID> results;
for (int i = 0; i < commands.size(); ++i)
if (commands.getUnchecked(i)->categoryName == categoryName)

View file

@ -37,8 +37,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
AudioFormatManager::AudioFormatManager()
: knownFormats (4),
defaultFormatIndex (0)
: defaultFormatIndex (0)
{
}

View file

@ -42,8 +42,7 @@ class SharedBufferingAudioSourceThread : public DeletedAtShutdown,
{
public:
SharedBufferingAudioSourceThread()
: Thread ("Audio Buffer"),
sources (8)
: Thread ("Audio Buffer")
{
}

View file

@ -64,9 +64,6 @@ AudioDeviceManager::AudioDeviceManager()
inputLevelMeasurementEnabledCount (0),
inputLevel (0),
tempBuffer (2, 2),
enabledMidiInputs (4),
midiCallbacks (4),
midiCallbackDevices (4),
defaultMidiOutput (0),
cpuUsageMs (0),
timeToCpuScale (0)

View file

@ -32,24 +32,20 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
MidiBuffer::MidiBuffer() throw()
: data (32),
bytesUsed (0)
: bytesUsed (0)
{
}
MidiBuffer::MidiBuffer (const MidiMessage& message) throw()
: data (32),
bytesUsed (0)
: bytesUsed (0)
{
addEvent (message, 0);
}
MidiBuffer::MidiBuffer (const MidiBuffer& other) throw()
: data (32),
bytesUsed (other.bytesUsed)
: bytesUsed (other.bytesUsed),
data (other.data)
{
data.ensureAllocatedSize (bytesUsed);
memcpy (data.elements, other.data.elements, bytesUsed);
}
const MidiBuffer& MidiBuffer::operator= (const MidiBuffer& other) throw()
@ -57,10 +53,7 @@ const MidiBuffer& MidiBuffer::operator= (const MidiBuffer& other) throw()
if (this != &other)
{
bytesUsed = other.bytesUsed;
data.ensureAllocatedSize (bytesUsed);
if (bytesUsed > 0)
memcpy (data.elements, other.data.elements, bytesUsed);
data = other.data;
}
return *this;
@ -68,8 +61,7 @@ const MidiBuffer& MidiBuffer::operator= (const MidiBuffer& other) throw()
void MidiBuffer::swap (MidiBuffer& other)
{
swapVariables <uint8*> (data.elements, other.data.elements);
swapVariables <int> (data.numAllocated, other.data.numAllocated);
data.swapWith (other.data);
swapVariables <int> (bytesUsed, other.bytesUsed);
}
@ -85,12 +77,12 @@ void MidiBuffer::clear() throw()
void MidiBuffer::clear (const int startSample,
const int numSamples) throw()
{
uint8* const start = findEventAfter (data.elements, startSample - 1);
uint8* const start = findEventAfter (data, startSample - 1);
uint8* const end = findEventAfter (start, startSample + numSamples - 1);
if (end > start)
{
const size_t bytesToMove = (size_t) (bytesUsed - (end - data.elements));
const size_t bytesToMove = (size_t) (bytesUsed - (end - (uint8*) data.getData()));
if (bytesToMove > 0)
memmove (start, end, bytesToMove);
@ -144,10 +136,11 @@ void MidiBuffer::addEvent (const uint8* const newData,
if (numBytes > 0)
{
data.ensureAllocatedSize (bytesUsed + numBytes + 6);
int spaceNeeded = bytesUsed + numBytes + 6;
data.ensureSize ((spaceNeeded + spaceNeeded / 2 + 8) & ~7);
uint8* d = findEventAfter (data.elements, sampleNumber);
const size_t bytesToMove = (size_t) (bytesUsed - (d - data.elements));
uint8* d = findEventAfter ((uint8*) data.getData(), sampleNumber);
const size_t bytesToMove = (size_t) (bytesUsed - (d - (uint8*) data.getData()));
if (bytesToMove > 0)
memmove (d + numBytes + 6,
@ -173,13 +166,13 @@ void MidiBuffer::addEvents (const MidiBuffer& otherBuffer,
Iterator i (otherBuffer);
i.setNextSamplePosition (startSample);
const uint8* data;
int size, position;
const uint8* eventData;
int eventSize, position;
while (i.getNextEvent (data, size, position)
while (i.getNextEvent (eventData, eventSize, position)
&& (position < startSample + numSamples || numSamples < 0))
{
addEvent (data, size, position + sampleDeltaToAdd);
addEvent (eventData, eventSize, position + sampleDeltaToAdd);
}
}
@ -191,8 +184,8 @@ bool MidiBuffer::isEmpty() const throw()
int MidiBuffer::getNumEvents() const throw()
{
int n = 0;
const uint8* d = data.elements;
const uint8* const end = data.elements + bytesUsed;
const uint8* d = (uint8*) data.getData();
const uint8* const end = d + bytesUsed;
while (d < end)
{
@ -206,7 +199,7 @@ int MidiBuffer::getNumEvents() const throw()
int MidiBuffer::getFirstEventTime() const throw()
{
return (bytesUsed > 0) ? *(const int*) data.elements : 0;
return (bytesUsed > 0) ? *(const int*) data.getData() : 0;
}
int MidiBuffer::getLastEventTime() const throw()
@ -214,7 +207,7 @@ int MidiBuffer::getLastEventTime() const throw()
if (bytesUsed == 0)
return 0;
const uint8* d = data.elements;
const uint8* d = (uint8*) data.getData();
const uint8* const endData = d + bytesUsed;
for (;;)
@ -230,7 +223,7 @@ int MidiBuffer::getLastEventTime() const throw()
uint8* MidiBuffer::findEventAfter (uint8* d, const int samplePosition) const throw()
{
const uint8* const endData = data.elements + bytesUsed;
const uint8* const endData = ((uint8*) data.getData()) + bytesUsed;
while (d < endData && *(int*) d <= samplePosition)
{
@ -244,7 +237,7 @@ uint8* MidiBuffer::findEventAfter (uint8* d, const int samplePosition) const thr
//==============================================================================
MidiBuffer::Iterator::Iterator (const MidiBuffer& buffer_) throw()
: buffer (buffer_),
data (buffer_.data.elements)
data ((uint8*) buffer_.data.getData())
{
}
@ -255,8 +248,8 @@ MidiBuffer::Iterator::~Iterator() throw()
//==============================================================================
void MidiBuffer::Iterator::setNextSamplePosition (const int samplePosition) throw()
{
data = buffer.data.elements;
const uint8* dataEnd = buffer.data.elements + buffer.bytesUsed;
data = buffer.data;
const uint8* dataEnd = ((uint8*) buffer.data.getData()) + buffer.bytesUsed;
while (data < dataEnd && *(int*) data < samplePosition)
{
@ -269,7 +262,7 @@ bool MidiBuffer::Iterator::getNextEvent (const uint8* &midiData,
int& numBytes,
int& samplePosition) throw()
{
if (data >= buffer.data.elements + buffer.bytesUsed)
if (data >= ((uint8*) buffer.data.getData()) + buffer.bytesUsed)
return false;
samplePosition = *(int*) data;
@ -285,7 +278,7 @@ bool MidiBuffer::Iterator::getNextEvent (const uint8* &midiData,
bool MidiBuffer::Iterator::getNextEvent (MidiMessage& result,
int& samplePosition) throw()
{
if (data >= buffer.data.elements + buffer.bytesUsed)
if (data >= ((uint8*) buffer.data.getData()) + buffer.bytesUsed)
return false;
samplePosition = *(int*) data;

View file

@ -26,7 +26,7 @@
#ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
#define __JUCE_MIDIBUFFER_JUCEHEADER__
#include "../../containers/juce_ArrayAllocationBase.h"
#include "../../containers/juce_MemoryBlock.h"
#include "juce_MidiMessage.h"
@ -226,7 +226,7 @@ public:
private:
friend class MidiBuffer::Iterator;
ArrayAllocationBase <uint8> data;
MemoryBlock data;
int bytesUsed;
uint8* findEventAfter (uint8* d, const int samplePosition) const throw();

View file

@ -33,7 +33,6 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
MidiKeyboardState::MidiKeyboardState()
: listeners (2)
{
zeromem (noteStates, sizeof (noteStates));
}

View file

@ -298,7 +298,8 @@ void MidiMessageSequence::createControllerUpdatesForTime (const int channelNumbe
{
bool doneProg = false;
bool donePitchWheel = false;
Array <int> doneControllers (32);
Array <int> doneControllers;
doneControllers.ensureStorageAllocated (32);
for (int i = list.size(); --i >= 0;)
{

View file

@ -72,9 +72,7 @@ void SynthesiserVoice::clearCurrentNote()
//==============================================================================
Synthesiser::Synthesiser()
: voices (2),
sounds (2),
sampleRate (0),
: sampleRate (0),
lastNoteOnCounter (0),
shouldStealNotes (true)
{

View file

@ -56,15 +56,9 @@ class Array
{
public:
//==============================================================================
/** Creates an empty array.
@param granularity this is the size of increment by which the internal storage
used by the array will grow. Only change it from the default if you know the
array is going to be very big and needs to be able to grow efficiently.
*/
Array (const int granularity = juceDefaultArrayGranularity) throw()
: data (granularity),
numUsed (0)
/** Creates an empty array. */
Array() throw()
: numUsed (0)
{
}
@ -72,7 +66,6 @@ public:
@param other the array to copy
*/
Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other) throw()
: data (other.data.granularity)
{
other.lockArray();
numUsed = other.numUsed;
@ -86,8 +79,7 @@ public:
@param values the array to copy from
*/
Array (const ElementType* values) throw()
: data (juceDefaultArrayGranularity),
numUsed (0)
: numUsed (0)
{
while (*values != 0)
add (*values++);
@ -99,8 +91,7 @@ public:
@param numValues the number of values in the array
*/
Array (const ElementType* values, int numValues) throw()
: data (juceDefaultArrayGranularity),
numUsed (numValues)
: numUsed (numValues)
{
data.setAllocatedSize (numValues);
memcpy (data.elements, values, numValues * sizeof (ElementType));
@ -121,7 +112,6 @@ public:
other.lockArray();
lock.enter();
data.granularity = other.data.granularity;
data.ensureAllocatedSize (other.size());
numUsed = other.numUsed;
memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
@ -977,19 +967,7 @@ public:
void minimiseStorageOverheads() throw()
{
lock.enter();
if (numUsed == 0)
{
data.setAllocatedSize (0);
}
else
{
const int newAllocation = data.granularity * (numUsed / data.granularity + 1);
if (newAllocation < data.numAllocated)
data.setAllocatedSize (newAllocation);
}
data.shrinkToNoMoreThan (numUsed);
lock.exit();
}
@ -1001,7 +979,9 @@ public:
*/
void ensureStorageAllocated (const int minNumElements) throw()
{
lock.enter();
data.ensureAllocatedSize (minNumElements);
lock.exit();
}
//==============================================================================

View file

@ -27,14 +27,6 @@
#define __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
//==============================================================================
/** The default size of chunk in which arrays increase their storage.
Used by ArrayAllocationBase and its subclasses.
*/
const int juceDefaultArrayGranularity = 8;
//==============================================================================
/**
Implements some basic array storage allocation functions.
@ -49,17 +41,11 @@ class ArrayAllocationBase
{
public:
//==============================================================================
/** Creates an empty array.
@param granularity_ this is the size of increment by which the internal storage
will be increased.
*/
ArrayAllocationBase (const int granularity_) throw()
/** Creates an empty array. */
ArrayAllocationBase() throw()
: elements (0),
numAllocated (0),
granularity (granularity_)
numAllocated (0)
{
jassert (granularity > 0);
}
/** Destructor. */
@ -114,25 +100,21 @@ public:
void ensureAllocatedSize (int minNumElements) throw()
{
if (minNumElements > numAllocated)
{
// for arrays with small granularity that get big, start
// increasing the size in bigger jumps
if (minNumElements > (granularity << 6))
{
minNumElements += (minNumElements / granularity);
if (minNumElements > (granularity << 8))
minNumElements += granularity << 6;
else
minNumElements += granularity << 5;
}
setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7);
}
setAllocatedSize (granularity * (minNumElements / granularity + 1));
}
/** Minimises the amount of storage allocated so that it's no more than
the given number of elements.
*/
void shrinkToNoMoreThan (int maxNumElements) throw()
{
if (maxNumElements < numAllocated)
setAllocatedSize (maxNumElements);
}
//==============================================================================
ElementType* elements;
int numAllocated, granularity;
int numAllocated;
private:
ArrayAllocationBase (const ArrayAllocationBase&);

View file

@ -145,6 +145,12 @@ void MemoryBlock::ensureSize (const int minimumSize,
setSize (minimumSize, initialiseToZero);
}
void MemoryBlock::swapWith (MemoryBlock& other) throw()
{
swapVariables (size, other.size);
data.swapWith (other.data);
}
//==============================================================================
void MemoryBlock::fillWith (const uint8 value) throw()
{

View file

@ -151,6 +151,11 @@ public:
void append (const void* const data,
const int numBytes) throw();
/** Exchanges the contents of this and another memory block.
No actual copying is required for this, so it's very fast.
*/
void swapWith (MemoryBlock& other) throw();
//==============================================================================
/** Copies data into this MemoryBlock from a memory address.

View file

@ -58,15 +58,9 @@ class OwnedArray
{
public:
//==============================================================================
/** Creates an empty array.
@param granularity this is the size of increment by which the internal storage
used by the array will grow. Only change it from the default if you know the
array is going to be very big and needs to be able to grow efficiently.
*/
OwnedArray (const int granularity = juceDefaultArrayGranularity) throw()
: data (granularity),
numUsed (0)
/** Creates an empty array. */
OwnedArray() throw()
: numUsed (0)
{
}
@ -674,19 +668,7 @@ public:
void minimiseStorageOverheads() throw()
{
lock.enter();
if (numUsed == 0)
{
data.setAllocatedSize (0);
}
else
{
const int newAllocation = data.granularity * (numUsed / data.granularity + 1);
if (newAllocation < data.numAllocated)
data.setAllocatedSize (newAllocation);
}
data.shrinkToNoMoreThan (numUsed);
lock.exit();
}
@ -698,7 +680,9 @@ public:
*/
void ensureStorageAllocated (const int minNumElements) throw()
{
lock.enter();
data.ensureAllocatedSize (minNumElements);
lock.exit();
}
//==============================================================================

View file

@ -51,22 +51,15 @@ class ReferenceCountedArray
public:
//==============================================================================
/** Creates an empty array.
@param granularity this is the size of increment by which the internal storage
used by the array will grow. Only change it from the default if you know the
array is going to be very big and needs to be able to grow efficiently.
@see ReferenceCountedObject, Array, OwnedArray
*/
ReferenceCountedArray (const int granularity = juceDefaultArrayGranularity) throw()
: data (granularity),
numUsed (0)
ReferenceCountedArray() throw()
: numUsed (0)
{
}
/** Creates a copy of another array */
ReferenceCountedArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
: data (other.data.granularity)
{
other.lockArray();
numUsed = other.numUsed;
@ -93,7 +86,6 @@ public:
clear();
data.granularity = other.granularity;
data.ensureAllocatedSize (other.numUsed);
numUsed = other.numUsed;
memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*));
@ -738,19 +730,7 @@ public:
void minimiseStorageOverheads() throw()
{
lock.enter();
if (numUsed == 0)
{
data.setAllocatedSize (0);
}
else
{
const int newAllocation = data.granularity * (numUsed / data.granularity + 1);
if (newAllocation < data.numAllocated)
data.setAllocatedSize (newAllocation);
}
data.shrinkToNoMoreThan (numUsed);
lock.exit();
}

View file

@ -62,15 +62,9 @@ class SortedSet
{
public:
//==============================================================================
/** Creates an empty set.
@param granularity this is the size of increment by which the internal storage
used by the array will grow. Only change it from the default if you know the
array is going to be very big and needs to be able to grow efficiently.
*/
SortedSet (const int granularity = juceDefaultArrayGranularity) throw()
: data (granularity),
numUsed (0)
/** Creates an empty set. */
SortedSet() throw()
: numUsed (0)
{
}
@ -78,7 +72,6 @@ public:
@param other the set to copy
*/
SortedSet (const SortedSet<ElementType, TypeOfCriticalSectionToUse>& other) throw()
: data (other.data.granularity)
{
other.lockSet();
numUsed = other.numUsed;
@ -102,7 +95,6 @@ public:
other.lockSet();
lock.enter();
data.granularity = other.data.granularity;
data.ensureAllocatedSize (other.size());
numUsed = other.numUsed;
memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
@ -572,19 +564,7 @@ public:
void minimiseStorageOverheads() throw()
{
lock.enter();
if (numUsed == 0)
{
data.setAllocatedSize (0);
}
else
{
const int newAllocation = data.granularity * (numUsed / data.granularity + 1);
if (newAllocation < data.numAllocated)
data.setAllocatedSize (newAllocation);
}
data.shrinkToNoMoreThan (numUsed);
lock.exit();
}

View file

@ -145,6 +145,11 @@ void Value::setValue (const var& newValue)
value->setValue (newValue);
}
const String Value::toString() const
{
return value->getValue().toString();
}
const Value& Value::operator= (const var& newValue)
{
value->setValue (newValue);

View file

@ -76,6 +76,12 @@ public:
/** Returns the current value. */
operator const var() const;
/** Returns the value as a string.
This is alternative to writing things like "myValue.getValue().toString()".
*/
const String toString() const;
/** Sets the current value.
You can also use operator= to set the value.

View file

@ -193,7 +193,7 @@ inline void swapVariables (Type& variable1, Type& variable2)
variable2 = tempVal;
}
/** Handy macro for getting the number of elements in a simple const C array.
/** Handy function for getting the number of elements in a simple const C array.
E.g.
@code
@ -202,7 +202,8 @@ inline void swapVariables (Type& variable1, Type& variable2)
int numElements = numElementsInArray (myArray) // returns 3
@endcode
*/
#define numElementsInArray(a) ((int) (sizeof (a) / sizeof ((a)[0])))
template <typename Type>
inline int numElementsInArray (Type& array) { return (int) (sizeof (array) / sizeof (array[0])); }
//==============================================================================
// Some useful maths functions that aren't always present with all compilers and build settings.

View file

@ -200,15 +200,17 @@
//==============================================================================
/** Clears a block of memory. */
#define zeromem(memory, numBytes) memset (memory, 0, numBytes)
inline void zeromem (void* memory, int numBytes) { memset (memory, 0, numBytes); }
/** Clears a reference to a local structure. */
#define zerostruct(structure) memset (&structure, 0, sizeof (structure))
template <typename Type>
inline void zerostruct (Type& structure) { memset (&structure, 0, sizeof (structure)); }
/** A handy macro that calls delete on a pointer if it's non-zero, and
then sets the pointer to null.
/** A handy function that calls delete on a pointer if it's non-zero, and then sets
the pointer to null.
*/
#define deleteAndZero(pointer) { delete (pointer); (pointer) = 0; }
template <typename Type>
inline void deleteAndZero (Type& pointer) { delete pointer; pointer = 0; }

View file

@ -203,20 +203,12 @@
forcedinline void myfunction (int x)
@endcode
*/
#ifdef JUCE_DEBUG
#ifndef JUCE_DEBUG
#define forcedinline __forceinline
#else
#define forcedinline inline
#endif
/** A platform-independent way of stopping the compiler inlining a function.
Use the syntax: @code
juce_noinline void myfunction (int x)
@endcode
*/
#define juce_noinline
#else
/** A platform-independent way of forcing an inline function.
@ -230,14 +222,6 @@
#define forcedinline inline
#endif
/** A platform-independent way of stopping the compiler inlining a function.
Use the syntax: @code
juce_noinline void myfunction (int x)
@endcode
*/
#define juce_noinline __attribute__((noinline))
#endif
#endif // __JUCE_PLATFORMDEFS_JUCEHEADER__

View file

@ -60,6 +60,11 @@ void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI()
#ifdef JUCE_DEBUG
{
char a1[7];
jassert (numElementsInArray(a1) == 7);
int a2[3];
jassert (numElementsInArray(a2) == 3);
// Some simple test code to keep an eye on things and make sure these functions
// work ok on all platforms. Let me know if any of these assertions fail!
int n = 1;

View file

@ -70,10 +70,10 @@
#ifdef _DEBUG
#define JUCE_DEBUG 1
#endif
#ifdef __MINGW32__
#define JUCE_MINGW 1
#endif
#ifdef __MINGW32__
#define JUCE_MINGW 1
#endif
/** If defined, this indicates that the processor is little-endian. */
#define JUCE_LITTLE_ENDIAN 1

View file

@ -36,10 +36,8 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
Button::Button (const String& name)
: Component (name),
shortcuts (2),
keySource (0),
text (name),
buttonListeners (2),
buttonPressTime (0),
lastTimeCallbackTime (0),
commandManagerToUse (0),

View file

@ -38,7 +38,6 @@ Label::Label (const String& componentName,
text (labelText),
font (15.0f),
justification (Justification::centredLeft),
listeners (2),
ownerComponent (0),
horizontalBorderSize (3),
verticalBorderSize (1),

View file

@ -91,7 +91,6 @@ private:
//==============================================================================
Slider::Slider (const String& name)
: Component (name),
listeners (2),
lastCurrentValue (0),
lastValueMin (0),
lastValueMax (0),

View file

@ -64,8 +64,7 @@ private:
//==============================================================================
TableHeaderComponent::TableHeaderComponent()
: listeners (2),
columnsChanged (false),
: columnsChanged (false),
columnsResized (false),
sortChanged (false),
menuActive (true),

View file

@ -79,17 +79,17 @@ public:
const Colour& colour_,
const tchar passwordCharacter)
: font (font_),
colour (colour_),
atoms (64)
colour (colour_)
{
initialiseAtoms (text, passwordCharacter);
}
UniformTextSection (const UniformTextSection& other)
: font (other.font),
colour (other.colour),
atoms (64)
colour (other.colour)
{
atoms.ensureStorageAllocated (other.atoms.size());
for (int i = 0; i < other.atoms.size(); ++i)
atoms.add (new TextAtom (*(const TextAtom*) other.atoms.getUnchecked(i)));
}
@ -141,6 +141,8 @@ public:
}
}
atoms.ensureStorageAllocated (atoms.size() + other.atoms.size() - i);
while (i < other.atoms.size())
{
atoms.add (other.getAtom(i));
@ -990,10 +992,8 @@ TextEditor::TextEditor (const String& name,
currentFont (14.0f),
totalNumChars (0),
caretPosition (0),
sections (8),
passwordCharacter (passwordCharacter_),
dragType (notDragging),
listeners (2)
dragType (notDragging)
{
setOpaque (true);

View file

@ -1086,7 +1086,6 @@ enum TreeViewOpenness
TreeViewItem::TreeViewItem()
: ownerView (0),
parentItem (0),
subItems (8),
y (0),
itemHeight (0),
totalHeight (0),

View file

@ -33,8 +33,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
DirectoryContentsDisplayComponent::DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow)
: fileList (listToShow),
listeners (2)
: fileList (listToShow)
{
}

View file

@ -44,7 +44,6 @@ FileBrowserComponent::FileBrowserComponent (int flags_,
: FileFilter (String::empty),
fileFilter (fileFilter_),
flags (flags_),
listeners (2),
previewComp (previewComp_),
thread ("Juce FileBrowser")
{

View file

@ -46,8 +46,8 @@ BEGIN_JUCE_NAMESPACE
Component* Component::componentUnderMouse = 0;
Component* Component::currentlyFocusedComponent = 0;
static Array <Component*> modalComponentStack (4), modalComponentReturnValueKeys (4);
static Array <int> modalReturnValues (4);
static Array <Component*> modalComponentStack, modalComponentReturnValueKeys;
static Array <int> modalReturnValues;
static const int customCommandMessage = 0x7fff0001;
static const int exitModalStateMessage = 0x7fff0002;
@ -108,7 +108,6 @@ Component::Component() throw()
: parentComponent_ (0),
componentUID (++nextComponentUID),
numDeepMouseListeners (0),
childComponentList_ (16),
lookAndFeel_ (0),
effect_ (0),
bufferedImage_ (0),
@ -125,7 +124,6 @@ Component::Component (const String& name) throw()
parentComponent_ (0),
componentUID (++nextComponentUID),
numDeepMouseListeners (0),
childComponentList_ (16),
lookAndFeel_ (0),
effect_ (0),
bufferedImage_ (0),
@ -2163,7 +2161,7 @@ void Component::parentSizeChanged()
void Component::addComponentListener (ComponentListener* const newListener) throw()
{
if (componentListeners_ == 0)
componentListeners_ = new VoidArray (4);
componentListeners_ = new VoidArray();
componentListeners_->addIfNotAlreadyThere (newListener);
}
@ -2243,7 +2241,7 @@ void Component::addMouseListener (MouseListener* const newListener,
checkMessageManagerIsLocked
if (mouseListeners_ == 0)
mouseListeners_ = new VoidArray (4);
mouseListeners_ = new VoidArray();
if (! mouseListeners_->contains (newListener))
{
@ -3509,7 +3507,7 @@ const Rectangle Component::getParentMonitorArea() const throw()
void Component::addKeyListener (KeyListener* const newListener) throw()
{
if (keyListeners_ == 0)
keyListeners_ = new VoidArray (4);
keyListeners_ = new VoidArray();
keyListeners_->addIfNotAlreadyThere (newListener);
}

View file

@ -40,11 +40,7 @@ extern void juce_updateMultiMonitorInfo (Array <Rectangle>& monitorCoords,
static Desktop* juce_desktopInstance = 0;
Desktop::Desktop() throw()
: mouseListeners (2),
desktopComponents (4),
monitorCoordsClipped (2),
monitorCoordsUnclipped (2),
lastMouseX (0),
: lastMouseX (0),
lastMouseY (0),
kioskModeComponent (0)
{

View file

@ -34,7 +34,6 @@ BEGIN_JUCE_NAMESPACE
ComponentMovementWatcher::ComponentMovementWatcher (Component* const component_)
: component (component_),
lastPeer (0),
registeredParentComps (4),
reentrant (false)
{
jassert (component != 0); // can't use this with a null pointer..

View file

@ -98,8 +98,7 @@ ScrollBar::ScrollBar (const bool vertical_,
isDraggingThumb (false),
alwaysVisible (false),
upButton (0),
downButton (0),
listeners (2)
downButton (0)
{
setButtonVisibility (buttonsAreVisible);

View file

@ -1281,15 +1281,13 @@ private:
//==============================================================================
PopupMenu::PopupMenu()
: items (8),
lookAndFeel (0),
: lookAndFeel (0),
separatorPending (false)
{
}
PopupMenu::PopupMenu (const PopupMenu& other)
: items (8),
lookAndFeel (other.lookAndFeel),
: lookAndFeel (other.lookAndFeel),
separatorPending (false)
{
items.ensureStorageAllocated (other.items.size());

View file

@ -40,7 +40,7 @@ void juce_deleteMouseCursor (void* const cursorHandle, const bool isStandard) th
//==============================================================================
static CriticalSection activeCursorListLock;
static VoidArray activeCursors (2);
static VoidArray activeCursors;
//==============================================================================
class SharedMouseCursorInternal : public ReferenceCountedObject

View file

@ -674,6 +674,7 @@ private:
return y;
}
public:
//==============================================================================
class ChannelSelectorListBox : public ListBox,
public ListBoxModel
@ -930,6 +931,7 @@ private:
const ChannelSelectorListBox& operator= (const ChannelSelectorListBox&);
};
private:
ChannelSelectorListBox* inputChanList;
ChannelSelectorListBox* outputChanList;

View file

@ -95,8 +95,6 @@ MidiKeyboardComponent::MidiKeyboardComponent (MidiKeyboardState& state_,
canScroll (true),
mouseDragging (false),
useMousePositionForVelocity (true),
keyPresses (4),
keyPressNotes (16),
keyMappingOctave (6),
octaveNumForMiddleC (3)
{

View file

@ -53,7 +53,7 @@ extern bool juce_MouseHasMovedSignificantlySincePressed;
static const int fakeMouseMoveMessage = 0x7fff00ff;
static VoidArray heavyweightPeers (4);
static VoidArray heavyweightPeers;
//==============================================================================

View file

@ -45,8 +45,7 @@ class TopLevelWindowManager : public Timer,
public:
//==============================================================================
TopLevelWindowManager()
: windows (8),
currentActive (0)
: currentActive (0)
{
}

View file

@ -32,7 +32,6 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
ColourGradient::ColourGradient() throw()
: colours (4)
{
#ifdef JUCE_DEBUG
x1 = 987654.0f;
@ -50,8 +49,7 @@ ColourGradient::ColourGradient (const Colour& colour1,
y1 (y1_),
x2 (x2_),
y2 (y2_),
isRadial (isRadial_),
colours (4)
isRadial (isRadial_)
{
colours.add (0);
colours.add (colour1.getARGB());

View file

@ -35,20 +35,16 @@ BEGIN_JUCE_NAMESPACE
static const Graphics::ResamplingQuality defaultQuality = Graphics::mediumResamplingQuality;
//==============================================================================
#define MINIMUM_COORD -0x3fffffff
#define MAXIMUM_COORD 0x3fffffff
#undef ASSERT_COORDS_ARE_SENSIBLE_NUMBERS
#define ASSERT_COORDS_ARE_SENSIBLE_NUMBERS(x, y, w, h) \
jassert ((int) x >= MINIMUM_COORD \
&& (int) x <= MAXIMUM_COORD \
&& (int) y >= MINIMUM_COORD \
&& (int) y <= MAXIMUM_COORD \
&& (int) w >= MINIMUM_COORD \
&& (int) w <= MAXIMUM_COORD \
&& (int) h >= MINIMUM_COORD \
&& (int) h <= MAXIMUM_COORD);
template <typename Type>
static bool areCoordsSensibleNumbers (Type x, Type y, Type w, Type h)
{
const int maxVal = 0x3fffffff;
return (int) x >= -maxVal && (int) x <= maxVal
&& (int) y >= -maxVal && (int) y <= maxVal
&& (int) w >= -maxVal && (int) w <= maxVal
&& (int) h >= -maxVal && (int) h <= maxVal;
}
//==============================================================================
LowLevelGraphicsContext::LowLevelGraphicsContext()
@ -62,7 +58,7 @@ LowLevelGraphicsContext::~LowLevelGraphicsContext()
//==============================================================================
Graphics::Graphics (Image& imageToDrawOnto) throw()
: context (imageToDrawOnto.createLowLevelContext()),
ownsContext (true),
contextToDelete (context),
saveStatePending (false)
{
resetToDefaultState();
@ -70,7 +66,6 @@ Graphics::Graphics (Image& imageToDrawOnto) throw()
Graphics::Graphics (LowLevelGraphicsContext* const internalContext) throw()
: context (internalContext),
ownsContext (false),
saveStatePending (false)
{
resetToDefaultState();
@ -78,8 +73,6 @@ Graphics::Graphics (LowLevelGraphicsContext* const internalContext) throw()
Graphics::~Graphics() throw()
{
if (ownsContext)
delete context;
}
//==============================================================================
@ -325,7 +318,7 @@ void Graphics::fillRect (int x,
int height) const throw()
{
// passing in a silly number can cause maths problems in rendering!
ASSERT_COORDS_ARE_SENSIBLE_NUMBERS (x, y, width, height);
jassert (areCoordsSensibleNumbers (x, y, width, height));
context->fillRect (Rectangle (x, y, width, height), false);
}
@ -341,7 +334,7 @@ void Graphics::fillRect (const float x,
const float height) const throw()
{
// passing in a silly number can cause maths problems in rendering!
ASSERT_COORDS_ARE_SENSIBLE_NUMBERS (x, y, width, height);
jassert (areCoordsSensibleNumbers (x, y, width, height));
Path p;
p.addRectangle (x, y, width, height);
@ -397,7 +390,7 @@ void Graphics::drawRect (const int x,
const int lineThickness) const throw()
{
// passing in a silly number can cause maths problems in rendering!
ASSERT_COORDS_ARE_SENSIBLE_NUMBERS (x, y, width, height);
jassert (areCoordsSensibleNumbers (x, y, width, height));
context->fillRect (Rectangle (x, y, width, lineThickness), false);
context->fillRect (Rectangle (x, y + lineThickness, lineThickness, height - lineThickness * 2), false);
@ -412,7 +405,7 @@ void Graphics::drawRect (const float x,
const float lineThickness) const throw()
{
// passing in a silly number can cause maths problems in rendering!
ASSERT_COORDS_ARE_SENSIBLE_NUMBERS (x, y, width, height);
jassert (areCoordsSensibleNumbers (x, y, width, height));
Path p;
p.addRectangle (x, y, width, lineThickness);
@ -441,7 +434,7 @@ void Graphics::drawBevel (const int x,
const bool sharpEdgeOnOutside) const throw()
{
// passing in a silly number can cause maths problems in rendering!
ASSERT_COORDS_ARE_SENSIBLE_NUMBERS (x, y, width, height);
jassert (areCoordsSensibleNumbers (x, y, width, height));
if (clipRegionIntersects (x, y, width, height))
{
@ -476,7 +469,7 @@ void Graphics::fillEllipse (const float x,
const float height) const throw()
{
// passing in a silly number can cause maths problems in rendering!
ASSERT_COORDS_ARE_SENSIBLE_NUMBERS (x, y, width, height);
jassert (areCoordsSensibleNumbers (x, y, width, height));
Path p;
p.addEllipse (x, y, width, height);
@ -490,7 +483,7 @@ void Graphics::drawEllipse (const float x,
const float lineThickness) const throw()
{
// passing in a silly number can cause maths problems in rendering!
ASSERT_COORDS_ARE_SENSIBLE_NUMBERS (x, y, width, height);
jassert (areCoordsSensibleNumbers (x, y, width, height));
Path p;
p.addEllipse (x, y, width, height);
@ -504,7 +497,7 @@ void Graphics::fillRoundedRectangle (const float x,
const float cornerSize) const throw()
{
// passing in a silly number can cause maths problems in rendering!
ASSERT_COORDS_ARE_SENSIBLE_NUMBERS (x, y, width, height);
jassert (areCoordsSensibleNumbers (x, y, width, height));
Path p;
p.addRoundedRectangle (x, y, width, height, cornerSize);
@ -529,7 +522,7 @@ void Graphics::drawRoundedRectangle (const float x,
const float lineThickness) const throw()
{
// passing in a silly number can cause maths problems in rendering!
ASSERT_COORDS_ARE_SENSIBLE_NUMBERS (x, y, width, height);
jassert (areCoordsSensibleNumbers (x, y, width, height));
Path p;
p.addRoundedRectangle (x, y, width, height, cornerSize);
@ -723,7 +716,7 @@ void Graphics::drawImageWithin (const Image* const imageToDraw,
const bool fillAlphaChannelWithCurrentBrush) const throw()
{
// passing in a silly number can cause maths problems in rendering!
ASSERT_COORDS_ARE_SENSIBLE_NUMBERS (destX, destY, destW, destH);
jassert (areCoordsSensibleNumbers (destX, destY, destW, destH));
if (imageToDraw != 0)
{
@ -757,8 +750,8 @@ void Graphics::drawImage (const Image* const imageToDraw,
const bool fillAlphaChannelWithCurrentBrush) const throw()
{
// passing in a silly number can cause maths problems in rendering!
ASSERT_COORDS_ARE_SENSIBLE_NUMBERS (dx, dy, dw, dh);
ASSERT_COORDS_ARE_SENSIBLE_NUMBERS (sx, sy, sw, sh);
jassert (areCoordsSensibleNumbers (dx, dy, dw, dh));
jassert (areCoordsSensibleNumbers (sx, sy, sw, sh));
if (context->clipRegionIntersects (Rectangle (dx, dy, dw, dh)))
{

View file

@ -717,7 +717,7 @@ public:
private:
//==============================================================================
LowLevelGraphicsContext* const context;
const bool ownsContext;
ScopedPointer <LowLevelGraphicsContext> contextToDelete;
bool saveStatePending;
void saveStateIfPending() throw();

View file

@ -443,10 +443,9 @@ void LowLevelGraphicsPostScriptRenderer::writeImage (const Image& im,
pixel = Colours::transparentWhite;
}
char colourString [16];
sprintf (colourString, "%x%x%x", pixel.getRed(), pixel.getGreen(), pixel.getBlue());
const uint8 pixelValues[3] = { pixel.getRed(), pixel.getGreen(), pixel.getBlue() };
out << (const char*) colourString;
out << String::toHexString (pixelValues, 3, 0);
charsOnLine += 3;
if (charsOnLine > 100)

View file

@ -1341,10 +1341,10 @@ private:
//==============================================================================
LowLevelGraphicsSoftwareRenderer::LowLevelGraphicsSoftwareRenderer (Image& image_)
: image (image_),
stateStack (20)
: image (image_)
{
currentState = new LLGCSavedState (image_.getBounds(), 0, 0, Font(), FillType(), Graphics::mediumResamplingQuality);
currentState = new LLGCSavedState (image_.getBounds(), 0, 0, Font(),
FillType(), Graphics::mediumResamplingQuality);
}
LowLevelGraphicsSoftwareRenderer::~LowLevelGraphicsSoftwareRenderer()

View file

@ -341,8 +341,7 @@ class TypefaceCache : public DeletedAtShutdown
{
public:
TypefaceCache (int numToCache = 10) throw()
: counter (1),
faces (2)
: counter (1)
{
while (--numToCache >= 0)
faces.add (new CachedFace());

View file

@ -109,8 +109,8 @@ void PositionedGlyph::moveBy (const float deltaX,
//==============================================================================
GlyphArrangement::GlyphArrangement()
: glyphs (128)
{
glyphs.ensureStorageAllocated (128);
}
GlyphArrangement::GlyphArrangement (const GlyphArrangement& other)

View file

@ -93,22 +93,21 @@ public:
//==============================================================================
TextLayout::TextLayout() throw()
: tokens (64),
totalLines (0)
: totalLines (0)
{
tokens.ensureStorageAllocated (64);
}
TextLayout::TextLayout (const String& text,
const Font& font) throw()
: tokens (64),
totalLines (0)
: totalLines (0)
{
tokens.ensureStorageAllocated (64);
appendText (text, font);
}
TextLayout::TextLayout (const TextLayout& other) throw()
: tokens (64),
totalLines (0)
: totalLines (0)
{
*this = other;
}

View file

@ -49,8 +49,7 @@ static const int defaultGranularity = 32;
//==============================================================================
Path::Path() throw()
: data (defaultGranularity),
numElements (0),
: numElements (0),
pathXMin (0),
pathXMax (0),
pathYMin (0),
@ -64,8 +63,7 @@ Path::~Path() throw()
}
Path::Path (const Path& other) throw()
: data (defaultGranularity),
numElements (other.numElements),
: numElements (other.numElements),
pathXMin (other.pathXMin),
pathXMax (other.pathXMax),
pathYMin (other.pathYMin),

View file

@ -32,9 +32,9 @@
namespace jpeglibNamespace
{
#if JUCE_INCLUDE_JPEGLIB_CODE
#if JUCE_MINGW
typedef unsigned char boolean;
#endif
#if JUCE_MINGW
typedef unsigned char boolean;
#endif
extern "C"
{
#define JPEG_INTERNALS

View file

@ -49,7 +49,6 @@ static int cacheTimeout = 5000;
ImageCache::ImageCache()
: images (4)
{
}

View file

@ -985,17 +985,6 @@ bool File::appendText (const String& text,
return false;
}
bool File::printf (const tchar* pf, ...) const
{
va_list list;
va_start (list, pf);
String text;
text.vprintf (pf, list);
return appendData ((const char*) text, text.length());
}
bool File::replaceWithText (const String& textToWrite,
const bool asUnicode,
const bool writeUnicodeHeaderBytes) const

View file

@ -575,7 +575,7 @@ public:
@returns a stream that will write to this file (initially positioned at the
end of the file), or 0 if the file can't be opened for some reason
@see createInputStream, printf, appendData, appendText
@see createInputStream, appendData, appendText
*/
FileOutputStream* createOutputStream (const int bufferSize = 0x8000) const;
@ -602,14 +602,6 @@ public:
const String loadFileAsString() const;
//==============================================================================
/** Writes text to the end of the file.
This will try to do a printf to the file.
@returns false if it can't write to the file for some reason
*/
bool printf (const tchar* format, ...) const;
/** Appends a block of binary data to the end of the file.
This will try to write the given buffer to the end of the file.

View file

@ -416,12 +416,6 @@ const String juce_getOutputFromCommand (const String& command)
}
//==============================================================================
#if JUCE_64BIT
#define filedesc ((long long) internal)
#else
#define filedesc ((int) internal)
#endif
InterProcessLock::InterProcessLock (const String& name_)
: internal (0),
name (name_),
@ -436,7 +430,7 @@ InterProcessLock::InterProcessLock (const String& name_)
temp.create();
internal = (void*) open (temp.getFullPathName().toUTF8(), O_RDWR);
internal = open (temp.getFullPathName().toUTF8(), O_RDWR);
}
InterProcessLock::~InterProcessLock()
@ -444,7 +438,7 @@ InterProcessLock::~InterProcessLock()
while (reentrancyLevel > 0)
this->exit();
close (filedesc);
close (internal);
}
bool InterProcessLock::enter (const int timeOutMillisecs)
@ -464,7 +458,7 @@ bool InterProcessLock::enter (const int timeOutMillisecs)
for (;;)
{
const int result = fcntl (filedesc, F_SETLK, &fl);
const int result = fcntl (internal, F_SETLK, &fl);
if (result >= 0)
{
@ -498,7 +492,7 @@ void InterProcessLock::exit()
for (;;)
{
const int result = fcntl (filedesc, F_SETLKW, &fl);
const int result = fcntl (internal, F_SETLKW, &fl);
if (result >= 0 || errno != EINTR)
break;

View file

@ -504,7 +504,7 @@ private:
{
NSString* route = (NSString*) audioRoute;
//printf ("audio route: %s\n", [route cString]);
//DBG ("audio route: " + nsStringToJuce (route));
if ([route hasPrefix: @"Receiver"])
{

View file

@ -406,7 +406,7 @@ void* juce_findFileStart (const String& directory, const String& wildCard, Strin
if (e != 0)
{
FindFileStruct* ff = new FindFileStruct();
ScopedPointer <FindFileStruct> ff (new FindFileStruct());
ff->enumerator = [e retain];
ff->parentDir = directory;
ff->wildCard = wildCard;
@ -415,10 +415,9 @@ void* juce_findFileStart (const String& directory, const String& wildCard, Strin
ff->parentDir += File::separator;
if (juce_findFileNext (ff, firstResultFile, isDir, isHidden, fileSize, modTime, creationTime, isReadOnly))
return ff;
return ff.release();
[e release];
delete ff;
}
return 0;
@ -426,9 +425,8 @@ void* juce_findFileStart (const String& directory, const String& wildCard, Strin
void juce_findFileClose (void* handle)
{
FindFileStruct* ff = (FindFileStruct*) handle;
ScopedPointer <FindFileStruct> ff ((FindFileStruct*) handle);
[ff->enumerator release];
delete ff;
}
//==============================================================================

View file

@ -178,7 +178,7 @@ public:
{
makeInactive();
[renderContext clearDrawable];
delete viewHolder;
viewHolder = 0;
}
bool makeActive() const throw()
@ -250,7 +250,7 @@ public:
private:
OpenGLPixelFormat pixelFormat;
NSViewComponentInternal* viewHolder;
ScopedPointer <NSViewComponentInternal> viewHolder;
//==============================================================================
WindowedGLContext (const WindowedGLContext&);

View file

@ -1723,7 +1723,6 @@ class ASIOAudioIODeviceType : public AudioIODeviceType
public:
ASIOAudioIODeviceType()
: AudioIODeviceType (T("ASIO")),
classIds (2),
hasScanned (false)
{
CoInitialize (0);

View file

@ -171,7 +171,7 @@ public:
HRESULT __stdcall GetWindowContext (LPOLEINPLACEFRAME* lplpFrame, LPOLEINPLACEUIWINDOW* lplpDoc, LPRECT, LPRECT, LPOLEINPLACEFRAMEINFO lpFrameInfo)
{
frame->AddRef();
// frame->AddRef(); // MS docs are unclear about whether this is needed, but it seems to lead to a memory leak..
*lplpFrame = frame;
*lplpDoc = 0;
lpFrameInfo->fMDIApp = FALSE;

View file

@ -960,8 +960,6 @@ public:
isStarted (false),
outputDeviceIndex (outputDeviceIndex_),
inputDeviceIndex (inputDeviceIndex_),
inChans (4),
outChans (4),
numInputBuffers (0),
numOutputBuffers (0),
totalSamplesOut (0),

View file

@ -32,16 +32,16 @@
static const unsigned int specialId = WM_APP + 0x4400;
static const unsigned int broadcastId = WM_APP + 0x4403;
static const unsigned int specialCallbackId = WM_APP + 0x4402;
static const TCHAR* const messageWindowName = _T("JUCEWindow");
HWND juce_messageWindowHandle = 0;
extern long improbableWindowNumber; // defined in windowing.cpp
#ifndef WM_APPCOMMAND
#define WM_APPCOMMAND 0x0319
#endif
#ifndef WM_APPCOMMAND
#define WM_APPCOMMAND 0x0319
#endif
//==============================================================================

View file

@ -415,7 +415,7 @@ struct MidiOutHandle
juce_UseDebuggingNewOperator
};
static VoidArray handles (4);
static Array <MidiOutHandle*> midiOutputHandles;
//==============================================================================
const StringArray MidiOutput::getDevices()
@ -485,9 +485,9 @@ MidiOutput* MidiOutput::openDevice (int index)
}
}
for (i = handles.size(); --i >= 0;)
for (i = midiOutputHandles.size(); --i >= 0;)
{
MidiOutHandle* const han = (MidiOutHandle*) handles.getUnchecked(i);
MidiOutHandle* const han = midiOutputHandles.getUnchecked(i);
if (han != 0 && han->deviceId == deviceId)
{
@ -510,7 +510,7 @@ MidiOutput* MidiOutput::openDevice (int index)
han->deviceId = deviceId;
han->refCount = 1;
han->handle = h;
handles.add (han);
midiOutputHandles.add (han);
MidiOutput* const out = new MidiOutput();
out->internal = (void*) han;
@ -533,10 +533,10 @@ MidiOutput::~MidiOutput()
{
MidiOutHandle* const h = (MidiOutHandle*) internal;
if (handles.contains ((void*) h) && --(h->refCount) == 0)
if (midiOutputHandles.contains (h) && --(h->refCount) == 0)
{
midiOutClose (h->handle);
handles.removeValue ((void*) h);
midiOutputHandles.removeValue (h);
delete h;
}
}

View file

@ -72,7 +72,7 @@ static HKEY findKeyForPath (String name,
const String PlatformUtilities::getRegistryValue (const String& regValuePath,
const String& defaultValue)
{
String valueName, s;
String valueName, result (defaultValue);
HKEY k = findKeyForPath (regValuePath, false, valueName);
if (k != 0)
@ -82,14 +82,17 @@ const String PlatformUtilities::getRegistryValue (const String& regValuePath,
DWORD type = REG_SZ;
if (RegQueryValueEx (k, valueName, 0, &type, (LPBYTE) buffer, &bufferSize) == ERROR_SUCCESS)
s = buffer;
else
s = defaultValue;
{
if (type == REG_SZ)
result = buffer;
else if (type == REG_DWORD)
result = String ((int) *(DWORD*) buffer);
}
RegCloseKey (k);
}
return s;
return result;
}
void PlatformUtilities::setRegistryValue (const String& regValuePath,

View file

@ -715,10 +715,7 @@ void XmlElement::setAttribute (const tchar* const attributeName,
void XmlElement::setAttribute (const tchar* const attributeName,
const double number) throw()
{
tchar buffer [40];
CharacterFunctions::printf (buffer, numElementsInArray (buffer), T("%.9g"), number);
setAttribute (attributeName, buffer);
setAttribute (attributeName, String (number));
}
void XmlElement::removeAttribute (const tchar* const attributeName) throw()

View file

@ -73,7 +73,14 @@ public:
private:
//==============================================================================
#if JUCE_WINDOWS
void* internal;
#elif JUCE_64BIT
long long internal;
#else
int internal;
#endif
String name;
int reentrancyLevel;

View file

@ -43,7 +43,7 @@ void juce_CloseThreadHandle (void* handle);
#endif
//==============================================================================
static VoidArray runningThreads (4);
static VoidArray runningThreads;
static CriticalSection runningThreadsLock;
//==============================================================================

View file

@ -34,7 +34,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
static VoidArray objectsToDelete (16);
static VoidArray objectsToDelete;
static CriticalSection lock;
//==============================================================================