Browse Source

Minor code clean-ups

tags/2021-05-28
Julian Storer 16 years ago
parent
commit
59a2506864
44 changed files with 428 additions and 566 deletions
  1. +1
    -1
      extras/audio plugins/wrapper/RTAS/juce_RTAS_MacUtilities.mm
  2. +183
    -258
      juce_amalgamated.cpp
  3. +40
    -35
      juce_amalgamated.h
  4. +7
    -7
      src/audio/audio_file_formats/juce_AudioFormatManager.cpp
  5. +5
    -4
      src/audio/devices/juce_AudioDeviceManager.cpp
  6. +6
    -6
      src/core/juce_PlatformUtilities.h
  7. +4
    -4
      src/gui/components/controls/juce_TextEditor.cpp
  8. +1
    -1
      src/gui/components/controls/juce_TextEditor.h
  9. +1
    -2
      src/gui/components/controls/juce_TreeView.cpp
  10. +2
    -2
      src/gui/components/menus/juce_MenuBarModel.h
  11. +23
    -55
      src/gui/components/mouse/juce_MouseCursor.cpp
  12. +4
    -5
      src/gui/components/mouse/juce_MouseCursor.h
  13. +13
    -27
      src/gui/graphics/imaging/juce_ImageCache.cpp
  14. +2
    -1
      src/gui/graphics/imaging/juce_ImageCache.h
  15. +8
    -12
      src/io/files/juce_ZipFile.cpp
  16. +1
    -1
      src/io/files/juce_ZipFile.h
  17. +2
    -4
      src/io/streams/juce_BufferedInputStream.cpp
  18. +2
    -1
      src/io/streams/juce_BufferedInputStream.h
  19. +9
    -20
      src/io/streams/juce_GZIPCompressorOutputStream.cpp
  20. +4
    -2
      src/io/streams/juce_GZIPCompressorOutputStream.h
  21. +10
    -20
      src/io/streams/juce_GZIPDecompressorInputStream.cpp
  22. +5
    -2
      src/io/streams/juce_GZIPDecompressorInputStream.h
  23. +6
    -10
      src/io/streams/juce_MemoryOutputStream.cpp
  24. +2
    -1
      src/io/streams/juce_MemoryOutputStream.h
  25. +4
    -4
      src/io/streams/juce_SubregionStream.cpp
  26. +2
    -1
      src/io/streams/juce_SubregionStream.h
  27. +3
    -3
      src/native/mac/juce_iphone_Audio.cpp
  28. +2
    -2
      src/native/mac/juce_iphone_UIViewComponentPeer.mm
  29. +6
    -6
      src/native/mac/juce_mac_AppleRemote.mm
  30. +1
    -1
      src/native/mac/juce_mac_CarbonViewWrapperComponent.h
  31. +14
    -14
      src/native/mac/juce_mac_CoreGraphicsContext.mm
  32. +2
    -2
      src/native/mac/juce_mac_CoreMidi.cpp
  33. +2
    -2
      src/native/mac/juce_mac_Files.mm
  34. +6
    -6
      src/native/mac/juce_mac_Fonts.mm
  35. +5
    -5
      src/native/mac/juce_mac_MainMenu.mm
  36. +2
    -2
      src/native/mac/juce_mac_MessageManager.mm
  37. +1
    -1
      src/native/mac/juce_mac_MiscUtilities.mm
  38. +2
    -2
      src/native/mac/juce_mac_NSViewComponentPeer.mm
  39. +1
    -1
      src/native/mac/juce_mac_SystemStats.mm
  40. +1
    -1
      src/native/mac/juce_mac_Threads.mm
  41. +2
    -2
      src/native/windows/juce_win32_PlatformUtils.cpp
  42. +12
    -12
      src/text/juce_LocalisedStrings.cpp
  43. +12
    -12
      src/text/juce_LocalisedStrings.h
  44. +7
    -6
      src/utilities/juce_DeletedAtShutdown.cpp

+ 1
- 1
extras/audio plugins/wrapper/RTAS/juce_RTAS_MacUtilities.mm View File

@@ -115,7 +115,7 @@ void removeSubWindow (void* nsWindow, Component* comp)
MessageManager::getInstance()->runDispatchLoopUntil (1);
}
static bool isJuceWindow (WindowRef w) throw()
static bool isJuceWindow (WindowRef w)
{
for (int i = ComponentPeer::getNumPeers(); --i >= 0;)
{


+ 183
- 258
juce_amalgamated.cpp
File diff suppressed because it is too large
View File


+ 40
- 35
juce_amalgamated.h View File

@@ -12659,7 +12659,7 @@ public:
/** MAC ONLY - Returns the current OS version number.
E.g. if it's running on 10.4, this will be 4, 10.5 will return 5, etc.
*/
static int getOSXMinorVersionNumber() throw();
static int getOSXMinorVersionNumber();
#endif

#if JUCE_WINDOWS || DOXYGEN
@@ -12846,20 +12846,20 @@ public:
false, it will be shared with other apps.
@see stop
*/
bool start (const bool inExclusiveMode) throw();
bool start (const bool inExclusiveMode);

/** Stops the device running.
@see start
*/
void stop() throw();
void stop();

/** Returns true if the device has been started successfully.
*/
bool isActive() const throw();
bool isActive() const;

/** Returns the ID number of the remote, if it has sent one.
*/
int getRemoteId() const throw() { return remoteId; }
int getRemoteId() const { return remoteId; }

juce_UseDebuggingNewOperator

@@ -12871,7 +12871,7 @@ private:
void* queue;
int remoteId;

bool open (const bool openInExclusiveMode) throw();
bool open (const bool openInExclusiveMode);

AppleRemoteDevice (const AppleRemoteDevice&);
const AppleRemoteDevice& operator= (const AppleRemoteDevice&);
@@ -14348,9 +14348,9 @@ private:
friend class ZipInputStream;
CriticalSection lock;
InputStream* inputStream;
ScopedPointer <InputStream> streamToDelete;
ScopedPointer <InputSource> inputSource;

bool deleteStreamWhenDestroyed;
int numEntries, centralRecStart;

#ifdef JUCE_DEBUG
@@ -14940,7 +14940,7 @@ public:

private:
InputStream* const source;
const bool deleteSourceWhenDestroyed;
ScopedPointer <InputStream> sourceToDelete;
int bufferSize;
int64 position, lastReadPos, bufferStart, bufferOverlap;
HeapBlock <char> buffer;
@@ -14995,6 +14995,8 @@ private:
#ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
#define __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__

class GZIPCompressorHelper;

/**
A stream which uses zlib to compress the data written into it.

@@ -15034,9 +15036,9 @@ public:

private:
OutputStream* const destStream;
const bool deleteDestStream;
ScopedPointer <OutputStream> streamToDelete;
HeapBlock <uint8> buffer;
void* helper;
ScopedPointer <GZIPCompressorHelper> helper;
bool doNextBlock();

GZIPCompressorOutputStream (const GZIPCompressorOutputStream&);
@@ -15053,6 +15055,8 @@ private:
#ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
#define __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__

class GZIPDecompressHelper;

/**
This stream will decompress a source-stream using zlib.

@@ -15095,13 +15099,14 @@ public:

private:
InputStream* const sourceStream;
ScopedPointer <InputStream> streamToDelete;
const int64 uncompressedStreamLength;
const bool deleteSourceWhenDestroyed, noWrap;
const bool noWrap;
bool isEof;
int activeBufferSize;
int64 originalSourcePos, currentPos;
HeapBlock <uint8> buffer;
void* helper;
ScopedPointer <GZIPDecompressHelper> helper;

GZIPDecompressorInputStream (const GZIPDecompressorInputStream&);
const GZIPDecompressorInputStream& operator= (const GZIPDecompressorInputStream&);
@@ -15226,8 +15231,8 @@ public:

private:
MemoryBlock* data;
ScopedPointer <MemoryBlock> dataToDelete;
int position, size, blockSize;
bool ownsMemoryBlock;
};

#endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
@@ -15291,7 +15296,7 @@ public:

private:
InputStream* const source;
const bool deleteSourceWhenDestroyed;
ScopedPointer <InputStream> sourceToDelete;
const int64 startPositionInSourceStream, lengthOfSourceStream;

SubregionStream (const SubregionStream&);
@@ -15370,17 +15375,17 @@ public:
When you create one of these, you can call setCurrentMappings() to make it
the set of mappings that the system's using.
*/
LocalisedStrings (const String& fileContents) throw();
LocalisedStrings (const String& fileContents);

/** Creates a set of translations from a file.

When you create one of these, you can call setCurrentMappings() to make it
the set of mappings that the system's using.
*/
LocalisedStrings (const File& fileToLoad) throw();
LocalisedStrings (const File& fileToLoad);

/** Destructor. */
~LocalisedStrings() throw();
~LocalisedStrings();

/** Selects the current set of mappings to be used by the system.

@@ -15392,14 +15397,14 @@ public:

@see translateWithCurrentMappings
*/
static void setCurrentMappings (LocalisedStrings* newTranslations) throw();
static void setCurrentMappings (LocalisedStrings* newTranslations);

/** Returns the currently selected set of mappings.

This is the object that was last passed to setCurrentMappings(). It may
be 0 if none has been created.
*/
static LocalisedStrings* getCurrentMappings() throw();
static LocalisedStrings* getCurrentMappings();

/** Tries to translate a string using the currently selected set of mappings.

@@ -15410,7 +15415,7 @@ public:

@see setCurrentMappings, getCurrentMappings
*/
static const String translateWithCurrentMappings (const String& text) throw();
static const String translateWithCurrentMappings (const String& text);

/** Tries to translate a string using the currently selected set of mappings.

@@ -15421,13 +15426,13 @@ public:

@see setCurrentMappings, getCurrentMappings
*/
static const String translateWithCurrentMappings (const char* text) throw();
static const String translateWithCurrentMappings (const char* text);

/** Attempts to look up a string and return its localised version.

If the string isn't found in the list, the original string will be returned.
*/
const String translate (const String& text) const throw();
const String translate (const String& text) const;

/** Returns the name of the language specified in the translation file.

@@ -15436,7 +15441,7 @@ public:
language: german
@endcode
*/
const String getLanguageName() const throw() { return languageName; }
const String getLanguageName() const { return languageName; }

/** Returns the list of suitable country codes listed in the translation file.

@@ -15447,12 +15452,12 @@ public:

The country codes are supposed to be 2-character ISO complient codes.
*/
const StringArray getCountryCodes() const throw() { return countryCodes; }
const StringArray getCountryCodes() const { return countryCodes; }

/** Indicates whether to use a case-insensitive search when looking up a string.
This defaults to true.
*/
void setIgnoresCase (const bool shouldIgnoreCase) throw();
void setIgnoresCase (const bool shouldIgnoreCase);

juce_UseDebuggingNewOperator

@@ -15461,7 +15466,7 @@ private:
StringArray countryCodes;
StringPairArray translations;

void loadFromText (const String& fileContents) throw();
void loadFromText (const String& fileContents);
};

#endif // __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
@@ -16809,7 +16814,7 @@ private:
#define __JUCE_MOUSECURSOR_JUCEHEADER__

class Image;
class RefCountedMouseCursor;
class SharedMouseCursorInternal;
class ComponentPeer;
class Component;

@@ -16867,7 +16872,7 @@ public:
@param hotSpotX the x position of the cursor's hotspot within the image
@param hotSpotY the y position of the cursor's hotspot within the image
*/
MouseCursor (Image& image,
MouseCursor (const Image& image,
const int hotSpotX,
const int hotSpotY) throw();

@@ -16921,13 +16926,11 @@ public:
juce_UseDebuggingNewOperator

private:
RefCountedMouseCursor* cursorHandle;
ReferenceCountedObjectPtr <SharedMouseCursorInternal> cursorHandle;

friend class Component;

void showInWindow (ComponentPeer* window) const throw();
void showInAllWindows() const throw();

void* getHandle() const throw();
};

@@ -33540,7 +33543,7 @@ protected:

private:

Viewport* viewport;
ScopedPointer <Viewport> viewport;
TextHolderComponent* textHolder;
BorderSize borderSize;

@@ -48976,12 +48979,12 @@ public:
object then newMenuBarModel must be non-null.
*/
static void setMacMainMenu (MenuBarModel* newMenuBarModel,
const PopupMenu* extraAppleMenuItems = 0) throw();
const PopupMenu* extraAppleMenuItems = 0);

/** MAC ONLY - Returns the menu model that is currently being shown as
the main menu bar.
*/
static MenuBarModel* getMacMainMenu() throw();
static MenuBarModel* getMacMainMenu();

#endif

@@ -55816,6 +55819,8 @@ private:
#ifndef __JUCE_IMAGECACHE_JUCEHEADER__
#define __JUCE_IMAGECACHE_JUCEHEADER__

struct ImageCacheItem;

/**
A global cache of images that have been loaded from files or memory.

@@ -55942,7 +55947,7 @@ public:
private:

CriticalSection lock;
VoidArray images;
OwnedArray <ImageCacheItem> images;

ImageCache() throw();
ImageCache (const ImageCache&);


+ 7
- 7
src/audio/audio_file_formats/juce_AudioFormatManager.cpp View File

@@ -98,10 +98,7 @@ void AudioFormatManager::registerBasicFormats()
void AudioFormatManager::clearFormats()
{
for (int i = getNumKnownFormats(); --i >= 0;)
{
AudioFormat* const af = getKnownFormat(i);
delete af;
}
delete getKnownFormat(i);
knownFormats.clear();
defaultFormatIndex = 0;
@@ -191,12 +188,14 @@ AudioFormatReader* AudioFormatManager::createReaderFor (const File& file)
return 0;
}
AudioFormatReader* AudioFormatManager::createReaderFor (InputStream* in)
AudioFormatReader* AudioFormatManager::createReaderFor (InputStream* audioFileStream)
{
// you need to actually register some formats before the manager can
// use them to open a file!
jassert (knownFormats.size() > 0);
ScopedPointer <InputStream> in (audioFileStream);
if (in != 0)
{
const int64 originalStreamPos = in->getPosition();
@@ -206,7 +205,10 @@ AudioFormatReader* AudioFormatManager::createReaderFor (InputStream* in)
AudioFormatReader* const r = getKnownFormat(i)->createReaderFor (in, false);
if (r != 0)
{
in.release();
return r;
}
in->setPosition (originalStreamPos);
@@ -214,8 +216,6 @@ AudioFormatReader* AudioFormatManager::createReaderFor (InputStream* in)
// that all the formats can have a go at opening it.
jassert (in->getPosition() == originalStreamPos);
}
delete in;
}
return 0;


+ 5
- 4
src/audio/devices/juce_AudioDeviceManager.cpp View File

@@ -926,10 +926,11 @@ void AudioDeviceManager::CallbackHandler::handleIncomingMidiMessage (MidiInput*
//==============================================================================
void AudioDeviceManager::playTestSound()
{
audioCallbackLock.enter();
AudioSampleBuffer* oldSound = testSound.release();
audioCallbackLock.exit();
delete oldSound;
{
audioCallbackLock.enter();
ScopedPointer <AudioSampleBuffer> oldSound (testSound);
audioCallbackLock.exit();
}
testSoundPosition = 0;


+ 6
- 6
src/core/juce_PlatformUtilities.h View File

@@ -77,7 +77,7 @@ public:
/** MAC ONLY - Returns the current OS version number.
E.g. if it's running on 10.4, this will be 4, 10.5 will return 5, etc.
*/
static int getOSXMinorVersionNumber() throw();
static int getOSXMinorVersionNumber();
#endif
@@ -273,20 +273,20 @@ public:
false, it will be shared with other apps.
@see stop
*/
bool start (const bool inExclusiveMode) throw();
bool start (const bool inExclusiveMode);
/** Stops the device running.
@see start
*/
void stop() throw();
void stop();
/** Returns true if the device has been started successfully.
*/
bool isActive() const throw();
bool isActive() const;
/** Returns the ID number of the remote, if it has sent one.
*/
int getRemoteId() const throw() { return remoteId; }
int getRemoteId() const { return remoteId; }
//==============================================================================
juce_UseDebuggingNewOperator
@@ -299,7 +299,7 @@ private:
void* queue;
int remoteId;
bool open (const bool openInExclusiveMode) throw();
bool open (const bool openInExclusiveMode);
AppleRemoteDevice (const AppleRemoteDevice&);
const AppleRemoteDevice& operator= (const AppleRemoteDevice&);


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

@@ -1045,7 +1045,7 @@ TextEditor::TextEditor (const String& name,
TextEditor::~TextEditor()
{
clearInternal (0);
delete viewport;
viewport = 0;
}
//==============================================================================
@@ -2614,15 +2614,15 @@ void TextEditor::splitSection (const int sectionIndex,
sections.insert (sectionIndex + 1,
((UniformTextSection*) sections.getUnchecked (sectionIndex))
->split (charToSplitAt, passwordCharacter));
->split (charToSplitAt, passwordCharacter));
}
void TextEditor::coalesceSimilarSections() throw()
{
for (int i = 0; i < sections.size() - 1; ++i)
{
UniformTextSection* const s1 = (UniformTextSection*) (sections.getUnchecked (i));
UniformTextSection* const s2 = (UniformTextSection*) (sections.getUnchecked (i + 1));
UniformTextSection* const s1 = (UniformTextSection*) sections.getUnchecked (i);
UniformTextSection* const s2 = (UniformTextSection*) sections.getUnchecked (i + 1);
if (s1->font == s2->font
&& s1->colour == s2->colour)


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

@@ -609,7 +609,7 @@ protected:
private:
//==============================================================================
Viewport* viewport;
ScopedPointer <Viewport> viewport;
TextHolderComponent* textHolder;
BorderSize borderSize;


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

@@ -218,7 +218,7 @@ public:
for (int i = rowComponentItems.size(); --i >= 0;)
{
Component* const comp = (Component*) (rowComponents.getUnchecked(i));
Component* const comp = (Component*) rowComponents.getUnchecked(i);
bool keep = false;
@@ -467,7 +467,6 @@ void TreeView::deleteRootItem()
setRootItem (0);
}
void TreeView::setRootItemVisible (const bool shouldBeVisible)
{
rootItemVisible = shouldBeVisible;


+ 2
- 2
src/gui/components/menus/juce_MenuBarModel.h View File

@@ -151,12 +151,12 @@ public:
object then newMenuBarModel must be non-null.
*/
static void setMacMainMenu (MenuBarModel* newMenuBarModel,
const PopupMenu* extraAppleMenuItems = 0) throw();
const PopupMenu* extraAppleMenuItems = 0);
/** MAC ONLY - Returns the menu model that is currently being shown as
the main menu bar.
*/
static MenuBarModel* getMacMainMenu() throw();
static MenuBarModel* getMacMainMenu();
#endif


+ 23
- 55
src/gui/components/mouse/juce_MouseCursor.cpp View File

@@ -39,47 +39,32 @@ void juce_deleteMouseCursor (void* const cursorHandle, const bool isStandard) th
//==============================================================================
static CriticalSection mouseCursorLock;
static VoidArray standardCursors (2);
static CriticalSection activeCursorListLock;
static VoidArray activeCursors (2);
//==============================================================================
class RefCountedMouseCursor
class SharedMouseCursorInternal : public ReferenceCountedObject
{
public:
RefCountedMouseCursor (const MouseCursor::StandardCursorType t) throw()
: refCount (1),
standardType (t),
SharedMouseCursorInternal (const MouseCursor::StandardCursorType type) throw()
: standardType (type),
isStandard (true)
{
handle = juce_createStandardMouseCursor (standardType);
standardCursors.add (this);
activeCursors.add (this);
}
RefCountedMouseCursor (Image& image,
const int hotSpotX,
const int hotSpotY) throw()
: refCount (1),
standardType (MouseCursor::NormalCursor),
SharedMouseCursorInternal (const Image& image, const int hotSpotX, const int hotSpotY) throw()
: standardType (MouseCursor::NormalCursor),
isStandard (false)
{
handle = juce_createMouseCursorFromImage (image, hotSpotX, hotSpotY);
}
~RefCountedMouseCursor() throw()
~SharedMouseCursorInternal() throw()
{
juce_deleteMouseCursor (handle, isStandard);
standardCursors.removeValue (this);
}
void decRef() throw()
{
if (--refCount == 0)
delete this;
}
void incRef() throw()
{
++refCount;
activeCursors.removeValue (this);
}
void* getHandle() const throw()
@@ -87,22 +72,17 @@ public:
return handle;
}
static RefCountedMouseCursor* findInstance (MouseCursor::StandardCursorType type) throw()
static SharedMouseCursorInternal* findInstance (MouseCursor::StandardCursorType type) throw()
{
const ScopedLock sl (mouseCursorLock);
for (int i = 0; i < standardCursors.size(); i++)
for (int i = activeCursors.size(); --i >= 0;)
{
RefCountedMouseCursor* const r = (RefCountedMouseCursor*) standardCursors.getUnchecked(i);
SharedMouseCursorInternal* const r = (SharedMouseCursorInternal*) activeCursors.getUnchecked(i);
if (r->standardType == type)
{
r->incRef();
return r;
}
}
return new RefCountedMouseCursor (type);
return new SharedMouseCursorInternal (type);
}
//==============================================================================
@@ -110,56 +90,44 @@ public:
private:
void* handle;
int refCount;
const MouseCursor::StandardCursorType standardType;
const bool isStandard;
const RefCountedMouseCursor& operator= (const RefCountedMouseCursor&);
const SharedMouseCursorInternal& operator= (const SharedMouseCursorInternal&);
};
//==============================================================================
MouseCursor::MouseCursor() throw()
{
cursorHandle = RefCountedMouseCursor::findInstance (NormalCursor);
const ScopedLock sl (activeCursorListLock);
cursorHandle = SharedMouseCursorInternal::findInstance (NormalCursor);
}
MouseCursor::MouseCursor (const StandardCursorType type) throw()
{
cursorHandle = RefCountedMouseCursor::findInstance (type);
const ScopedLock sl (activeCursorListLock);
cursorHandle = SharedMouseCursorInternal::findInstance (type);
}
MouseCursor::MouseCursor (Image& image,
const int hotSpotX,
const int hotSpotY) throw()
MouseCursor::MouseCursor (const Image& image, const int hotSpotX, const int hotSpotY) throw()
{
cursorHandle = new RefCountedMouseCursor (image, hotSpotX, hotSpotY);
const ScopedLock sl (activeCursorListLock);
cursorHandle = new SharedMouseCursorInternal (image, hotSpotX, hotSpotY);
}
MouseCursor::MouseCursor (const MouseCursor& other) throw()
: cursorHandle (other.cursorHandle)
{
const ScopedLock sl (mouseCursorLock);
cursorHandle->incRef();
}
MouseCursor::~MouseCursor() throw()
{
const ScopedLock sl (mouseCursorLock);
cursorHandle->decRef();
}
const MouseCursor& MouseCursor::operator= (const MouseCursor& other) throw()
{
if (this != &other)
{
const ScopedLock sl (mouseCursorLock);
cursorHandle->decRef();
cursorHandle = other.cursorHandle;
cursorHandle->incRef();
}
cursorHandle = other.cursorHandle;
return *this;
}


+ 4
- 5
src/gui/components/mouse/juce_MouseCursor.h View File

@@ -26,8 +26,9 @@
#ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
#define __JUCE_MOUSECURSOR_JUCEHEADER__
#include "../../../containers/juce_ReferenceCountedObject.h"
class Image;
class RefCountedMouseCursor;
class SharedMouseCursorInternal;
class ComponentPeer;
class Component;
@@ -88,7 +89,7 @@ public:
@param hotSpotX the x position of the cursor's hotspot within the image
@param hotSpotY the y position of the cursor's hotspot within the image
*/
MouseCursor (Image& image,
MouseCursor (const Image& image,
const int hotSpotX,
const int hotSpotY) throw();
@@ -146,13 +147,11 @@ public:
juce_UseDebuggingNewOperator
private:
RefCountedMouseCursor* cursorHandle;
ReferenceCountedObjectPtr <SharedMouseCursorInternal> cursorHandle;
friend class Component;
void showInWindow (ComponentPeer* window) const throw();
void showInAllWindows() const throw();
void* getHandle() const throw();
};


+ 13
- 27
src/gui/graphics/imaging/juce_ImageCache.cpp View File

@@ -33,12 +33,12 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
struct CachedImageInfo
struct ImageCacheItem
{
Image* image;
ScopedPointer <Image> image;
int64 hashCode;
int refCount;
unsigned int releaseTime;
uint32 releaseTime;
juce_UseDebuggingNewOperator
};
@@ -55,17 +55,6 @@ ImageCache::ImageCache() throw()
ImageCache::~ImageCache()
{
const ScopedLock sl (lock);
for (int i = images.size(); --i >= 0;)
{
CachedImageInfo* const ci = (CachedImageInfo*) images.getUnchecked(i);
delete ci->image;
delete ci;
}
images.clear();
jassert (instance == this);
instance = 0;
}
@@ -78,11 +67,11 @@ Image* ImageCache::getFromHashCode (const int64 hashCode)
for (int i = instance->images.size(); --i >= 0;)
{
CachedImageInfo* const ci = (CachedImageInfo*) instance->images.getUnchecked(i);
ImageCacheItem* const ci = instance->images.getUnchecked(i);
if (ci->hashCode == hashCode)
{
atomicIncrement (ci->refCount);
ci->refCount++;
return ci->image;
}
}
@@ -99,7 +88,7 @@ void ImageCache::addImageToCache (Image* const image,
if (instance == 0)
instance = new ImageCache();
CachedImageInfo* const newC = new CachedImageInfo();
ImageCacheItem* const newC = new ImageCacheItem();
newC->hashCode = hashCode;
newC->image = image;
newC->refCount = 1;
@@ -118,9 +107,9 @@ void ImageCache::release (Image* const imageToRelease)
for (int i = instance->images.size(); --i >= 0;)
{
CachedImageInfo* const ci = (CachedImageInfo*) instance->images.getUnchecked(i);
ImageCacheItem* const ci = instance->images.getUnchecked(i);
if (ci->image == imageToRelease)
if ((Image*) ci->image == imageToRelease)
{
if (--(ci->refCount) == 0)
ci->releaseTime = Time::getApproximateMillisecondCounter();
@@ -149,7 +138,7 @@ bool ImageCache::isImageInCache (Image* const imageToLookFor)
const ScopedLock sl (instance->lock);
for (int i = instance->images.size(); --i >= 0;)
if (((const CachedImageInfo*) instance->images.getUnchecked(i))->image == imageToLookFor)
if ((Image*) instance->images.getUnchecked(i)->image == imageToLookFor)
return true;
}
@@ -164,9 +153,9 @@ void ImageCache::incReferenceCount (Image* const image)
for (int i = instance->images.size(); --i >= 0;)
{
CachedImageInfo* const ci = (CachedImageInfo*) instance->images.getUnchecked(i);
ImageCacheItem* const ci = (ImageCacheItem*) instance->images.getUnchecked(i);
if (ci->image == image)
if ((Image*) ci->image == image)
{
ci->refCount++;
return;
@@ -186,7 +175,7 @@ void ImageCache::timerCallback()
for (int i = images.size(); --i >= 0;)
{
CachedImageInfo* const ci = (CachedImageInfo*) images.getUnchecked(i);
ImageCacheItem* const ci = images.getUnchecked(i);
if (ci->refCount <= 0)
{
@@ -194,8 +183,6 @@ void ImageCache::timerCallback()
|| now < ci->releaseTime - 1000)
{
images.remove (i);
delete ci->image;
delete ci;
}
else
{
@@ -210,8 +197,7 @@ void ImageCache::timerCallback()
Image* ImageCache::getFromFile (const File& file)
{
const int64 hashCode = file.getFullPathName().hashCode64();
const int64 hashCode = file.hashCode64();
Image* image = getFromHashCode (hashCode);
if (image == 0)


+ 2
- 1
src/gui/graphics/imaging/juce_ImageCache.h View File

@@ -31,6 +31,7 @@
#include "../../../events/juce_Timer.h"
#include "../../../utilities/juce_DeletedAtShutdown.h"
#include "../../../containers/juce_VoidArray.h"
struct ImageCacheItem;
//==============================================================================
@@ -162,7 +163,7 @@ public:
private:
//==============================================================================
CriticalSection lock;
VoidArray images;
OwnedArray <ImageCacheItem> images;
ImageCache() throw();
ImageCache (const ImageCache&);


+ 8
- 12
src/io/files/juce_ZipFile.cpp View File

@@ -52,8 +52,7 @@ class ZipInputStream : public InputStream
{
public:
//==============================================================================
ZipInputStream (ZipFile& file_,
ZipEntryInfo& zei) throw()
ZipInputStream (ZipFile& file_, ZipEntryInfo& zei)
: file (file_),
zipEntryInfo (zei),
pos (0),
@@ -161,19 +160,20 @@ private:
//==============================================================================
ZipFile::ZipFile (InputStream* const source_,
const bool deleteStreamWhenDestroyed_) throw()
: inputStream (source_),
deleteStreamWhenDestroyed (deleteStreamWhenDestroyed_)
const bool deleteStreamWhenDestroyed) throw()
: inputStream (source_)
#ifdef JUCE_DEBUG
, numOpenStreams (0)
#endif
{
if (deleteStreamWhenDestroyed)
streamToDelete = inputStream;
init();
}
ZipFile::ZipFile (const File& file)
: inputStream (0),
deleteStreamWhenDestroyed (false)
: inputStream (0)
#ifdef JUCE_DEBUG
, numOpenStreams (0)
#endif
@@ -184,8 +184,7 @@ ZipFile::ZipFile (const File& file)
ZipFile::ZipFile (InputSource* const inputSource_)
: inputStream (0),
inputSource (inputSource_),
deleteStreamWhenDestroyed (false)
inputSource (inputSource_)
#ifdef JUCE_DEBUG
, numOpenStreams (0)
#endif
@@ -198,9 +197,6 @@ ZipFile::~ZipFile() throw()
for (int i = entries.size(); --i >= 0;)
delete (ZipEntryInfo*) entries.getUnchecked(i);
if (deleteStreamWhenDestroyed)
delete inputStream;
#ifdef JUCE_DEBUG
// If you hit this assertion, it means you've created a stream to read
// one of the items in the zipfile, but you've forgotten to delete that


+ 1
- 1
src/io/files/juce_ZipFile.h View File

@@ -150,9 +150,9 @@ private:
friend class ZipInputStream;
CriticalSection lock;
InputStream* inputStream;
ScopedPointer <InputStream> streamToDelete;
ScopedPointer <InputSource> inputSource;
bool deleteStreamWhenDestroyed;
int numEntries, centralRecStart;
#ifdef JUCE_DEBUG


+ 2
- 4
src/io/streams/juce_BufferedInputStream.cpp View File

@@ -34,9 +34,9 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
BufferedInputStream::BufferedInputStream (InputStream* const source_,
const int bufferSize_,
const bool deleteSourceWhenDestroyed_) throw()
const bool deleteSourceWhenDestroyed) throw()
: source (source_),
deleteSourceWhenDestroyed (deleteSourceWhenDestroyed_),
sourceToDelete (deleteSourceWhenDestroyed ? source_ : 0),
bufferSize (jmax (256, bufferSize_)),
position (source_->getPosition()),
lastReadPos (0),
@@ -52,8 +52,6 @@ BufferedInputStream::BufferedInputStream (InputStream* const source_,
BufferedInputStream::~BufferedInputStream() throw()
{
if (deleteSourceWhenDestroyed)
delete source;
}
//==============================================================================


+ 2
- 1
src/io/streams/juce_BufferedInputStream.h View File

@@ -27,6 +27,7 @@
#define __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
#include "juce_InputStream.h"
#include "../../containers/juce_ScopedPointer.h"
//==============================================================================
@@ -74,7 +75,7 @@ public:
private:
InputStream* const source;
const bool deleteSourceWhenDestroyed;
ScopedPointer <InputStream> sourceToDelete;
int bufferSize;
int64 position, lastReadPos, bufferStart, bufferOverlap;
HeapBlock <char> buffer;


+ 9
- 20
src/io/streams/juce_GZIPCompressorOutputStream.cpp View File

@@ -136,39 +136,31 @@ const int gzipCompBufferSize = 32768;
GZIPCompressorOutputStream::GZIPCompressorOutputStream (OutputStream* const destStream_,
int compressionLevel,
const bool deleteDestStream_,
const bool deleteDestStream,
const bool noWrap)
: destStream (destStream_),
deleteDestStream (deleteDestStream_),
streamToDelete (deleteDestStream ? destStream_ : 0),
buffer (gzipCompBufferSize)
{
if (compressionLevel < 1 || compressionLevel > 9)
compressionLevel = -1;
helper = new GZIPCompressorHelper (compressionLevel, noWrap);
}
GZIPCompressorOutputStream::~GZIPCompressorOutputStream()
{
flush();
delete (GZIPCompressorHelper*) helper;
if (deleteDestStream)
delete destStream;
}
//==============================================================================
void GZIPCompressorOutputStream::flush()
{
GZIPCompressorHelper* const h = (GZIPCompressorHelper*) helper;
if (! h->finished)
if (! helper->finished)
{
h->shouldFinish = true;
helper->shouldFinish = true;
while (! h->finished)
while (! helper->finished)
doNextBlock();
}
@@ -177,13 +169,11 @@ void GZIPCompressorOutputStream::flush()
bool GZIPCompressorOutputStream::write (const void* destBuffer, int howMany)
{
GZIPCompressorHelper* const h = (GZIPCompressorHelper*) helper;
if (! h->finished)
if (! helper->finished)
{
h->setInput ((uint8*) destBuffer, howMany);
helper->setInput ((uint8*) destBuffer, howMany);
while (! h->needsInput())
while (! helper->needsInput())
{
if (! doNextBlock())
return false;
@@ -195,8 +185,7 @@ bool GZIPCompressorOutputStream::write (const void* destBuffer, int howMany)
bool GZIPCompressorOutputStream::doNextBlock()
{
GZIPCompressorHelper* const h = (GZIPCompressorHelper*) helper;
const int len = h->doNextBlock (buffer, gzipCompBufferSize);
const int len = helper->doNextBlock (buffer, gzipCompBufferSize);
if (len > 0)
return destStream->write (buffer, len);


+ 4
- 2
src/io/streams/juce_GZIPCompressorOutputStream.h View File

@@ -27,6 +27,8 @@
#define __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
#include "juce_OutputStream.h"
#include "../../containers/juce_ScopedPointer.h"
class GZIPCompressorHelper;
//==============================================================================
@@ -72,9 +74,9 @@ public:
private:
OutputStream* const destStream;
const bool deleteDestStream;
ScopedPointer <OutputStream> streamToDelete;
HeapBlock <uint8> buffer;
void* helper;
ScopedPointer <GZIPCompressorHelper> helper;
bool doNextBlock();
GZIPCompressorOutputStream (const GZIPCompressorOutputStream&);


+ 10
- 20
src/io/streams/juce_GZIPDecompressorInputStream.cpp View File

@@ -163,28 +163,24 @@ public:
const int gzipDecompBufferSize = 32768;
GZIPDecompressorInputStream::GZIPDecompressorInputStream (InputStream* const sourceStream_,
const bool deleteSourceWhenDestroyed_,
const bool deleteSourceWhenDestroyed,
const bool noWrap_,
const int64 uncompressedStreamLength_)
: sourceStream (sourceStream_),
streamToDelete (deleteSourceWhenDestroyed ? sourceStream_ : 0),
uncompressedStreamLength (uncompressedStreamLength_),
deleteSourceWhenDestroyed (deleteSourceWhenDestroyed_),
noWrap (noWrap_),
isEof (false),
activeBufferSize (0),
originalSourcePos (sourceStream_->getPosition()),
currentPos (0),
buffer (gzipDecompBufferSize)
buffer (gzipDecompBufferSize),
helper (new GZIPDecompressHelper (noWrap_))
{
helper = new GZIPDecompressHelper (noWrap_);
}
GZIPDecompressorInputStream::~GZIPDecompressorInputStream()
{
if (deleteSourceWhenDestroyed)
delete sourceStream;
delete (GZIPDecompressHelper*) helper;
}
int64 GZIPDecompressorInputStream::getTotalLength()
@@ -194,8 +190,6 @@ int64 GZIPDecompressorInputStream::getTotalLength()
int GZIPDecompressorInputStream::read (void* destBuffer, int howMany)
{
GZIPDecompressHelper* const h = (GZIPDecompressHelper*) helper;
if ((howMany > 0) && ! isEof)
{
jassert (destBuffer != 0);
@@ -205,26 +199,26 @@ int GZIPDecompressorInputStream::read (void* destBuffer, int howMany)
int numRead = 0;
uint8* d = (uint8*) destBuffer;
while (! h->error)
while (! helper->error)
{
const int n = h->doNextBlock (d, howMany);
const int n = helper->doNextBlock (d, howMany);
currentPos += n;
if (n == 0)
{
if (h->finished || h->needsDictionary)
if (helper->finished || helper->needsDictionary)
{
isEof = true;
return numRead;
}
if (h->needsInput())
if (helper->needsInput())
{
activeBufferSize = sourceStream->read (buffer, gzipDecompBufferSize);
if (activeBufferSize > 0)
{
h->setInput ((uint8*) buffer, activeBufferSize);
helper->setInput ((uint8*) buffer, activeBufferSize);
}
else
{
@@ -251,9 +245,7 @@ int GZIPDecompressorInputStream::read (void* destBuffer, int howMany)
bool GZIPDecompressorInputStream::isExhausted()
{
const GZIPDecompressHelper* const h = (GZIPDecompressHelper*) helper;
return h->error || isEof;
return helper->error || isEof;
}
int64 GZIPDecompressorInputStream::getPosition()
@@ -272,8 +264,6 @@ bool GZIPDecompressorInputStream::setPosition (int64 newPos)
else
{
// reset the stream and start again..
delete (GZIPDecompressHelper*) helper;
isEof = false;
activeBufferSize = 0;
currentPos = 0;


+ 5
- 2
src/io/streams/juce_GZIPDecompressorInputStream.h View File

@@ -27,6 +27,8 @@
#define __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
#include "juce_InputStream.h"
#include "../../containers/juce_ScopedPointer.h"
class GZIPDecompressHelper;
//==============================================================================
@@ -75,13 +77,14 @@ public:
private:
InputStream* const sourceStream;
ScopedPointer <InputStream> streamToDelete;
const int64 uncompressedStreamLength;
const bool deleteSourceWhenDestroyed, noWrap;
const bool noWrap;
bool isEof;
int activeBufferSize;
int64 originalSourcePos, currentPos;
HeapBlock <uint8> buffer;
void* helper;
ScopedPointer <GZIPDecompressHelper> helper;
GZIPDecompressorInputStream (const GZIPDecompressorInputStream&);
const GZIPDecompressorInputStream& operator= (const GZIPDecompressorInputStream&);


+ 6
- 10
src/io/streams/juce_MemoryOutputStream.cpp View File

@@ -38,26 +38,22 @@ MemoryOutputStream::MemoryOutputStream (const int initialSize,
: data (memoryBlockToWriteTo),
position (0),
size (0),
blockSize (jmax (16, blockSizeToIncreaseBy)),
ownsMemoryBlock (memoryBlockToWriteTo == 0)
blockSize (jmax (16, blockSizeToIncreaseBy))
{
if (memoryBlockToWriteTo == 0)
data = new MemoryBlock (initialSize);
if (data == 0)
dataToDelete = data = new MemoryBlock (initialSize);
else
memoryBlockToWriteTo->setSize (initialSize, false);
data->setSize (initialSize, false);
}
MemoryOutputStream::~MemoryOutputStream() throw()
{
if (ownsMemoryBlock)
delete data;
else
flush();
flush();
}
void MemoryOutputStream::flush()
{
if (! ownsMemoryBlock)
if (dataToDelete == 0)
data->setSize (size, false);
}


+ 2
- 1
src/io/streams/juce_MemoryOutputStream.h View File

@@ -28,6 +28,7 @@
#include "juce_OutputStream.h"
#include "../../containers/juce_MemoryBlock.h"
#include "../../containers/juce_ScopedPointer.h"
//==============================================================================
@@ -87,8 +88,8 @@ public:
private:
MemoryBlock* data;
ScopedPointer <MemoryBlock> dataToDelete;
int position, size, blockSize;
bool ownsMemoryBlock;
};
#endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__

+ 4
- 4
src/io/streams/juce_SubregionStream.cpp View File

@@ -35,19 +35,19 @@ BEGIN_JUCE_NAMESPACE
SubregionStream::SubregionStream (InputStream* const sourceStream,
const int64 startPositionInSourceStream_,
const int64 lengthOfSourceStream_,
const bool deleteSourceWhenDestroyed_) throw()
const bool deleteSourceWhenDestroyed) throw()
: source (sourceStream),
deleteSourceWhenDestroyed (deleteSourceWhenDestroyed_),
startPositionInSourceStream (startPositionInSourceStream_),
lengthOfSourceStream (lengthOfSourceStream_)
{
if (deleteSourceWhenDestroyed)
sourceToDelete = source;
setPosition (0);
}
SubregionStream::~SubregionStream() throw()
{
if (deleteSourceWhenDestroyed)
delete source;
}
int64 SubregionStream::getTotalLength()


+ 2
- 1
src/io/streams/juce_SubregionStream.h View File

@@ -27,6 +27,7 @@
#define __JUCE_SUBREGIONSTREAM_JUCEHEADER__
#include "juce_InputStream.h"
#include "../../containers/juce_ScopedPointer.h"
//==============================================================================
@@ -82,7 +83,7 @@ public:
private:
InputStream* const source;
const bool deleteSourceWhenDestroyed;
ScopedPointer <InputStream> sourceToDelete;
const int64 startPositionInSourceStream, lengthOfSourceStream;
SubregionStream (const SubregionStream&);


+ 3
- 3
src/native/mac/juce_iphone_Audio.cpp View File

@@ -271,7 +271,7 @@ private:
//==================================================================================================
OSStatus process (AudioUnitRenderActionFlags* ioActionFlags, const AudioTimeStamp* inTimeStamp,
UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList* ioData) throw()
UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList* ioData)
{
OSStatus err = noErr;
@@ -349,7 +349,7 @@ private:
return err;
}
void updateDeviceInfo() throw()
void updateDeviceInfo()
{
UInt32 size = sizeof (sampleRate);
AudioSessionGetProperty (kAudioSessionProperty_CurrentHardwareSampleRate, &size, &sampleRate);
@@ -496,7 +496,7 @@ private:
// If the routing is set to go through the receiver (i.e. the speaker, but quiet), this re-routes it
// to make it loud. Needed because by default when using an input + output, the output is kept quiet.
static void fixAudioRouteIfSetToReceiver() throw()
static void fixAudioRouteIfSetToReceiver()
{
CFStringRef audioRoute = 0;
UInt32 propertySize = sizeof (audioRoute);


+ 2
- 2
src/native/mac/juce_iphone_UIViewComponentPeer.mm View File

@@ -179,14 +179,14 @@ void ModifierKeys::updateCurrentModifiers() throw()
currentModifierFlags = currentModifiers;
}
static int getModifierForButtonNumber (const int num) throw()
static int getModifierForButtonNumber (const int num)
{
return num == 0 ? ModifierKeys::leftButtonModifier
: (num == 1 ? ModifierKeys::rightButtonModifier
: (num == 2 ? ModifierKeys::middleButtonModifier : 0));
}
static int64 getMouseTime (UIEvent* e) throw()
static int64 getMouseTime (UIEvent* e)
{
return (Time::currentTimeMillis() - Time::getMillisecondCounter())
+ (int64) ([e timestamp] * 1000.0);


+ 6
- 6
src/native/mac/juce_mac_AppleRemote.mm View File

@@ -40,7 +40,7 @@ AppleRemoteDevice::~AppleRemoteDevice()
stop();
}
static io_object_t getAppleRemoteDevice() throw()
static io_object_t getAppleRemoteDevice()
{
CFMutableDictionaryRef dict = IOServiceMatching ("AppleIRController");
@@ -57,7 +57,7 @@ static io_object_t getAppleRemoteDevice() throw()
return iod;
}
static bool createAppleRemoteInterface (io_object_t iod, void** device) throw()
static bool createAppleRemoteInterface (io_object_t iod, void** device)
{
jassert (*device == 0);
io_name_t classname;
@@ -86,7 +86,7 @@ static bool createAppleRemoteInterface (io_object_t iod, void** device) throw()
return *device != 0;
}
bool AppleRemoteDevice::start (const bool inExclusiveMode) throw()
bool AppleRemoteDevice::start (const bool inExclusiveMode)
{
if (queue != 0)
return true;
@@ -109,7 +109,7 @@ bool AppleRemoteDevice::start (const bool inExclusiveMode) throw()
return result;
}
void AppleRemoteDevice::stop() throw()
void AppleRemoteDevice::stop()
{
if (queue != 0)
{
@@ -127,7 +127,7 @@ void AppleRemoteDevice::stop() throw()
}
}
bool AppleRemoteDevice::isActive() const throw()
bool AppleRemoteDevice::isActive() const
{
return queue != 0;
}
@@ -138,7 +138,7 @@ static void appleRemoteQueueCallback (void* const target, const IOReturn result,
((AppleRemoteDevice*) target)->handleCallbackInternal();
}
bool AppleRemoteDevice::open (const bool openInExclusiveMode) throw()
bool AppleRemoteDevice::open (const bool openInExclusiveMode)
{
Array <int> cookies;


+ 1
- 1
src/native/mac/juce_mac_CarbonViewWrapperComponent.h View File

@@ -202,7 +202,7 @@ public:
setEmbeddedWindowToOurSize();
}
static void recursiveHIViewRepaint (HIViewRef view) throw()
static void recursiveHIViewRepaint (HIViewRef view)
{
HIViewSetNeedsDisplay (view, true);
HIViewRef child = HIViewGetFirstSubview (view);


+ 14
- 14
src/native/mac/juce_mac_CoreGraphicsContext.mm View File

@@ -55,7 +55,7 @@ public:
LowLevelGraphicsContext* createLowLevelContext();
//==============================================================================
static CGImageRef createImage (const Image& juceImage, const bool forAlpha, CGColorSpaceRef colourSpace) throw()
static CGImageRef createImage (const Image& juceImage, const bool forAlpha, CGColorSpaceRef colourSpace)
{
const CoreGraphicsImage* nativeImage = dynamic_cast <const CoreGraphicsImage*> (&juceImage);
@@ -106,7 +106,7 @@ public:
CGContextRef context;
private:
static CGBitmapInfo getCGImageFlags (const Image& image) throw()
static CGBitmapInfo getCGImageFlags (const Image& image)
{
#if JUCE_BIG_ENDIAN
return image.getFormat() == Image::ARGB ? (kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Big) : kCGBitmapByteOrderDefault;
@@ -536,18 +536,18 @@ private:
struct SavedState
{
SavedState() throw()
SavedState()
: font (1.0f), fontRef (0), fontTransform (CGAffineTransformIdentity)
{
}
SavedState (const SavedState& other) throw()
SavedState (const SavedState& other)
: fillType (other.fillType), font (other.font), fontRef (other.fontRef),
fontTransform (other.fontTransform)
{
}
~SavedState() throw()
~SavedState()
{
}
@@ -576,7 +576,7 @@ private:
outData[3] = colour.getAlpha() / 255.0f;
}
CGShadingRef createGradient (const AffineTransform& transform, ColourGradient gradient) throw()
CGShadingRef createGradient (const AffineTransform& transform, ColourGradient gradient)
{
numGradientLookupEntries = gradient.createLookupTable (transform, gradientLookupTable);
--numGradientLookupEntries;
@@ -602,7 +602,7 @@ private:
return result;
}
void drawGradient() throw()
void drawGradient()
{
flip();
applyTransform (state->fillType.transform);
@@ -615,7 +615,7 @@ private:
CGShadingRelease (shading);
}
void createPath (const Path& path) const throw()
void createPath (const Path& path) const
{
CGContextBeginPath (context);
Path::Iterator i (path);
@@ -645,7 +645,7 @@ private:
}
}
void createPath (const Path& path, const AffineTransform& transform) const throw()
void createPath (const Path& path, const AffineTransform& transform) const
{
CGContextBeginPath (context);
Path::Iterator i (path);
@@ -682,7 +682,7 @@ private:
}
}
static Image* createAlphaChannelImage (const Image& im) throw()
static Image* createAlphaChannelImage (const Image& im)
{
if (im.getFormat() == Image::SingleChannel)
return const_cast <Image*> (&im);
@@ -690,18 +690,18 @@ private:
return im.createCopyOfAlphaChannel();
}
static void deleteAlphaChannelImage (const Image& im, Image* const alphaIm) throw()
static void deleteAlphaChannelImage (const Image& im, Image* const alphaIm)
{
if (im.getFormat() != Image::SingleChannel)
delete alphaIm;
}
void flip() const throw()
void flip() const
{
CGContextConcatCTM (context, CGAffineTransformMake (1, 0, 0, -1, 0, flipHeight));
}
void applyTransform (const AffineTransform& transform) const throw()
void applyTransform (const AffineTransform& transform) const
{
CGAffineTransform t;
t.a = transform.mat00;
@@ -713,7 +713,7 @@ private:
CGContextConcatCTM (context, t);
}
float flipY (float y) const throw()
float flipY (float y) const
{
return flipHeight - y;
}


+ 2
- 2
src/native/mac/juce_mac_CoreMidi.cpp View File

@@ -236,12 +236,12 @@ static bool makeSureClientExists()
class MidiPortAndEndpoint
{
public:
MidiPortAndEndpoint (MIDIPortRef port_, MIDIEndpointRef endPoint_) throw()
MidiPortAndEndpoint (MIDIPortRef port_, MIDIEndpointRef endPoint_)
: port (port_), endPoint (endPoint_)
{
}
~MidiPortAndEndpoint() throw()
~MidiPortAndEndpoint()
{
if (port != 0)
MIDIPortDispose (port);


+ 2
- 2
src/native/mac/juce_mac_Files.mm View File

@@ -107,7 +107,7 @@ const StringArray juce_getFileSystemRoots() throw()
}
//==============================================================================
static bool isFileOnDriveType (const File* const f, const char** types) throw()
static bool isFileOnDriveType (const File* const f, const char** types)
{
struct statfs buf;
@@ -157,7 +157,7 @@ bool File::isOnRemovableDrive() const throw()
#endif
}
static bool juce_isHiddenFile (const String& path) throw()
static bool juce_isHiddenFile (const String& path)
{
#if JUCE_IPHONE
return File (path).getFileName().startsWithChar (T('.'));


+ 6
- 6
src/native/mac/juce_mac_Fonts.mm View File

@@ -349,7 +349,7 @@ private:
AffineTransform pathTransform;
#endif
void createGlyphsForString (const juce_wchar* const text, const int length, HeapBlock <CGGlyph>& glyphs) throw()
void createGlyphsForString (const juce_wchar* const text, const int length, HeapBlock <CGGlyph>& glyphs)
{
#if SUPPORT_10_4_FONTS
#if ! SUPPORT_ONLY_10_4_FONTS
@@ -382,7 +382,7 @@ private:
class CharToGlyphMapper
{
public:
CharToGlyphMapper (CGFontRef fontRef) throw()
CharToGlyphMapper (CGFontRef fontRef)
: segCount (0), endCode (0), startCode (0), idDelta (0),
idRangeOffset (0), glyphIndexes (0)
{
@@ -424,7 +424,7 @@ private:
}
}
~CharToGlyphMapper() throw()
~CharToGlyphMapper()
{
if (endCode != 0)
{
@@ -436,7 +436,7 @@ private:
}
}
int getGlyphForCharacter (const juce_wchar c) const throw()
int getGlyphForCharacter (const juce_wchar c) const
{
for (int i = 0; i < segCount; ++i)
{
@@ -464,12 +464,12 @@ private:
int segCount;
CFDataRef endCode, startCode, idDelta, idRangeOffset, glyphIndexes;
static uint16 getValue16 (CFDataRef data, const int index) throw()
static uint16 getValue16 (CFDataRef data, const int index)
{
return CFSwapInt16BigToHost (*(UInt16*) (CFDataGetBytePtr (data) + index));
}
static uint32 getValue32 (CFDataRef data, const int index) throw()
static uint32 getValue32 (CFDataRef data, const int index)
{
return CFSwapInt32BigToHost (*(UInt32*) (CFDataGetBytePtr (data) + index));
}


+ 5
- 5
src/native/mac/juce_mac_MainMenu.mm View File

@@ -60,14 +60,14 @@ public:
static JuceMainMenuHandler* instance;
//==============================================================================
JuceMainMenuHandler() throw()
JuceMainMenuHandler()
: currentModel (0),
lastUpdateTime (0)
{
callback = [[JuceMenuCallback alloc] initWithOwner: this];
}
~JuceMainMenuHandler() throw()
~JuceMainMenuHandler()
{
setMenu (0);
@@ -77,7 +77,7 @@ public:
[callback release];
}
void setMenu (MenuBarModel* const newMenuBarModel) throw()
void setMenu (MenuBarModel* const newMenuBarModel)
{
if (currentModel != newMenuBarModel)
{
@@ -489,7 +489,7 @@ static void rebuildMainMenu (const PopupMenu* extraItems)
}
void MenuBarModel::setMacMainMenu (MenuBarModel* newMenuBarModel,
const PopupMenu* extraAppleMenuItems) throw()
const PopupMenu* extraAppleMenuItems)
{
if (getMacMainMenu() != newMenuBarModel)
{
@@ -518,7 +518,7 @@ void MenuBarModel::setMacMainMenu (MenuBarModel* newMenuBarModel,
newMenuBarModel->menuItemsChanged();
}
MenuBarModel* MenuBarModel::getMacMainMenu() throw()
MenuBarModel* MenuBarModel::getMacMainMenu()
{
return JuceMainMenuHandler::instance != 0
? JuceMainMenuHandler::instance->currentModel : 0;


+ 2
- 2
src/native/mac/juce_mac_MessageManager.mm View File

@@ -129,7 +129,7 @@ public:
delete this;
}
void postMessage (void* m) throw()
void postMessage (void* m)
{
messages.add (m);
CFRunLoopSourceSignal (runLoopSource);
@@ -141,7 +141,7 @@ private:
CFRunLoopSourceRef runLoopSource;
Array <void*, CriticalSection> messages;
void runLoopCallback() throw()
void runLoopCallback()
{
int numDispatched = 0;


+ 1
- 1
src/native/mac/juce_mac_MiscUtilities.mm View File

@@ -59,7 +59,7 @@ void PlatformUtilities::addItemToDock (const File& file)
}
}
int PlatformUtilities::getOSXMinorVersionNumber() throw()
int PlatformUtilities::getOSXMinorVersionNumber()
{
SInt32 versionMinor = 0;
OSErr err = Gestalt (gestaltSystemVersionMinor, &versionMinor);


+ 2
- 2
src/native/mac/juce_mac_NSViewComponentPeer.mm View File

@@ -637,7 +637,7 @@ void ModifierKeys::updateCurrentModifiers() throw()
currentModifierFlags = currentModifiers;
}
static int64 getMouseTime (NSEvent* e) throw()
static int64 getMouseTime (NSEvent* e)
{
return (Time::currentTimeMillis() - Time::getMillisecondCounter())
+ (int64) ([e timestamp] * 1000.0);
@@ -650,7 +650,7 @@ static void getMousePos (NSEvent* e, NSView* view, int& x, int& y)
y = roundFloatToInt ([view frame].size.height - p.y);
}
static int getModifierForButtonNumber (const int num) throw()
static int getModifierForButtonNumber (const int num)
{
return num == 0 ? ModifierKeys::leftButtonModifier
: (num == 1 ? ModifierKeys::rightButtonModifier


+ 1
- 1
src/native/mac/juce_mac_SystemStats.mm View File

@@ -46,7 +46,7 @@ static void juce_getCpuVendor (char* const v) throw()
memcpy (v, vendor, 16);
}
static unsigned int getCPUIDWord (unsigned int& familyModel, unsigned int& extFeatures) throw()
static unsigned int getCPUIDWord (unsigned int& familyModel, unsigned int& extFeatures)
{
unsigned int cpu = 0;
unsigned int ext = 0;


+ 1
- 1
src/native/mac/juce_mac_Threads.mm View File

@@ -36,7 +36,7 @@
//==============================================================================
void JUCE_API juce_threadEntryPoint (void*);
void* threadEntryProc (void* userData) throw()
void* threadEntryProc (void* userData)
{
const ScopedAutoReleasePool pool;
juce_threadEntryPoint (userData);


+ 2
- 2
src/native/windows/juce_win32_PlatformUtils.cpp View File

@@ -31,7 +31,7 @@
//==============================================================================
static HKEY findKeyForPath (String name,
const bool createForWriting,
String& valueName) throw()
String& valueName)
{
HKEY rootKey = 0;
@@ -175,7 +175,7 @@ void PlatformUtilities::registerFileAssociation (const String& fileExtension,
//==============================================================================
bool juce_IsRunningInWine() throw()
bool juce_IsRunningInWine()
{
HKEY key;
if (RegOpenKeyEx (HKEY_CURRENT_USER, _T("Software\\Wine"), 0, KEY_READ, &key) == ERROR_SUCCESS)


+ 12
- 12
src/text/juce_LocalisedStrings.cpp View File

@@ -32,27 +32,27 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
LocalisedStrings::LocalisedStrings (const String& fileContents) throw()
LocalisedStrings::LocalisedStrings (const String& fileContents)
{
loadFromText (fileContents);
}
LocalisedStrings::LocalisedStrings (const File& fileToLoad) throw()
LocalisedStrings::LocalisedStrings (const File& fileToLoad)
{
loadFromText (fileToLoad.loadFileAsString());
}
LocalisedStrings::~LocalisedStrings() throw()
LocalisedStrings::~LocalisedStrings()
{
}
//==============================================================================
const String LocalisedStrings::translate (const String& text) const throw()
const String LocalisedStrings::translate (const String& text) const
{
return translations.getValue (text, text);
}
static int findCloseQuote (const String& text, int startPos) throw()
static int findCloseQuote (const String& text, int startPos)
{
tchar lastChar = 0;
@@ -70,7 +70,7 @@ static int findCloseQuote (const String& text, int startPos) throw()
return startPos;
}
static const String unescapeString (const String& s) throw()
static const String unescapeString (const String& s)
{
return s.replace (T("\\\""), T("\""))
.replace (T("\\\'"), T("\'"))
@@ -79,7 +79,7 @@ static const String unescapeString (const String& s) throw()
.replace (T("\\n"), T("\n"));
}
void LocalisedStrings::loadFromText (const String& fileContents) throw()
void LocalisedStrings::loadFromText (const String& fileContents)
{
StringArray lines;
lines.addLines (fileContents);
@@ -118,7 +118,7 @@ void LocalisedStrings::loadFromText (const String& fileContents) throw()
}
}
void LocalisedStrings::setIgnoresCase (const bool shouldIgnoreCase) throw()
void LocalisedStrings::setIgnoresCase (const bool shouldIgnoreCase)
{
translations.setIgnoresCase (shouldIgnoreCase);
}
@@ -127,7 +127,7 @@ void LocalisedStrings::setIgnoresCase (const bool shouldIgnoreCase) throw()
static CriticalSection currentMappingsLock;
static LocalisedStrings* currentMappings = 0;
void LocalisedStrings::setCurrentMappings (LocalisedStrings* newTranslations) throw()
void LocalisedStrings::setCurrentMappings (LocalisedStrings* newTranslations)
{
const ScopedLock sl (currentMappingsLock);
@@ -135,12 +135,12 @@ void LocalisedStrings::setCurrentMappings (LocalisedStrings* newTranslations) th
currentMappings = newTranslations;
}
LocalisedStrings* LocalisedStrings::getCurrentMappings() throw()
LocalisedStrings* LocalisedStrings::getCurrentMappings()
{
return currentMappings;
}
const String LocalisedStrings::translateWithCurrentMappings (const String& text) throw()
const String LocalisedStrings::translateWithCurrentMappings (const String& text)
{
const ScopedLock sl (currentMappingsLock);
@@ -150,7 +150,7 @@ const String LocalisedStrings::translateWithCurrentMappings (const String& text)
return text;
}
const String LocalisedStrings::translateWithCurrentMappings (const char* text) throw()
const String LocalisedStrings::translateWithCurrentMappings (const char* text)
{
return translateWithCurrentMappings (String (text));
}


+ 12
- 12
src/text/juce_LocalisedStrings.h View File

@@ -94,17 +94,17 @@ public:
When you create one of these, you can call setCurrentMappings() to make it
the set of mappings that the system's using.
*/
LocalisedStrings (const String& fileContents) throw();
LocalisedStrings (const String& fileContents);
/** Creates a set of translations from a file.
When you create one of these, you can call setCurrentMappings() to make it
the set of mappings that the system's using.
*/
LocalisedStrings (const File& fileToLoad) throw();
LocalisedStrings (const File& fileToLoad);
/** Destructor. */
~LocalisedStrings() throw();
~LocalisedStrings();
//==============================================================================
/** Selects the current set of mappings to be used by the system.
@@ -117,14 +117,14 @@ public:
@see translateWithCurrentMappings
*/
static void setCurrentMappings (LocalisedStrings* newTranslations) throw();
static void setCurrentMappings (LocalisedStrings* newTranslations);
/** Returns the currently selected set of mappings.
This is the object that was last passed to setCurrentMappings(). It may
be 0 if none has been created.
*/
static LocalisedStrings* getCurrentMappings() throw();
static LocalisedStrings* getCurrentMappings();
/** Tries to translate a string using the currently selected set of mappings.
@@ -135,7 +135,7 @@ public:
@see setCurrentMappings, getCurrentMappings
*/
static const String translateWithCurrentMappings (const String& text) throw();
static const String translateWithCurrentMappings (const String& text);
/** Tries to translate a string using the currently selected set of mappings.
@@ -146,14 +146,14 @@ public:
@see setCurrentMappings, getCurrentMappings
*/
static const String translateWithCurrentMappings (const char* text) throw();
static const String translateWithCurrentMappings (const char* text);
//==============================================================================
/** Attempts to look up a string and return its localised version.
If the string isn't found in the list, the original string will be returned.
*/
const String translate (const String& text) const throw();
const String translate (const String& text) const;
/** Returns the name of the language specified in the translation file.
@@ -162,7 +162,7 @@ public:
language: german
@endcode
*/
const String getLanguageName() const throw() { return languageName; }
const String getLanguageName() const { return languageName; }
/** Returns the list of suitable country codes listed in the translation file.
@@ -173,14 +173,14 @@ public:
The country codes are supposed to be 2-character ISO complient codes.
*/
const StringArray getCountryCodes() const throw() { return countryCodes; }
const StringArray getCountryCodes() const { return countryCodes; }
//==============================================================================
/** Indicates whether to use a case-insensitive search when looking up a string.
This defaults to true.
*/
void setIgnoresCase (const bool shouldIgnoreCase) throw();
void setIgnoresCase (const bool shouldIgnoreCase);
//==============================================================================
juce_UseDebuggingNewOperator
@@ -190,7 +190,7 @@ private:
StringArray countryCodes;
StringPairArray translations;
void loadFromText (const String& fileContents) throw();
void loadFromText (const String& fileContents);
};


+ 7
- 6
src/utilities/juce_DeletedAtShutdown.cpp View File

@@ -62,15 +62,16 @@ void DeletedAtShutdown::deleteAll()
{
JUCE_TRY
{
DeletedAtShutdown* const deletee = (DeletedAtShutdown*) localCopy.getUnchecked(i);
DeletedAtShutdown* deletee = (DeletedAtShutdown*) localCopy.getUnchecked(i);
// double-check that it's not already been deleted during another object's destructor.
lock.enter();
const bool okToDelete = objectsToDelete.contains (deletee);
lock.exit();
{
const ScopedLock sl (lock);
if (! objectsToDelete.contains (deletee))
deletee = 0;
}
if (okToDelete)
delete deletee;
delete deletee;
}
JUCE_CATCH_EXCEPTION
}


Loading…
Cancel
Save