1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-21 01:24:21 +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

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