Browse Source

Fixed a couple of linux file issues. Removed operator& overloads from a couple of places where they shouldn't have been done. Fixed a few minor win32 compile issues. Improved some internal COM object wrappers.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
6277552ef5
23 changed files with 317 additions and 332 deletions
  1. +44
    -58
      extras/juce demo/Source/MainDemoWindow.cpp
  2. +2
    -2
      extras/juce demo/Source/MainDemoWindow.h
  3. +132
    -114
      juce_amalgamated.cpp
  4. +7
    -22
      juce_amalgamated.h
  5. +4
    -4
      src/application/juce_Application.h
  6. +1
    -1
      src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp
  7. +18
    -19
      src/audio/processors/juce_GenericAudioProcessorEditor.cpp
  8. +0
    -12
      src/containers/juce_HeapBlock.h
  9. +0
    -3
      src/containers/juce_ScopedPointer.h
  10. +1
    -1
      src/core/juce_Atomic.h
  11. +1
    -1
      src/core/juce_StandardHeader.h
  12. +12
    -20
      src/gui/components/layout/juce_ComponentAnimator.cpp
  13. +1
    -1
      src/gui/components/layout/juce_ComponentAnimator.h
  14. +2
    -1
      src/gui/graphics/imaging/image_file_formats/juce_PNGLoader.cpp
  15. +1
    -4
      src/native/common/juce_MidiDataConcatenator.h
  16. +7
    -1
      src/native/common/juce_posix_SharedCode.h
  17. +3
    -3
      src/native/linux/juce_linux_Files.cpp
  18. +15
    -12
      src/native/windows/juce_win32_ActiveXComponent.cpp
  19. +2
    -2
      src/native/windows/juce_win32_AudioCDReader.cpp
  20. +29
    -35
      src/native/windows/juce_win32_CameraDevice.cpp
  21. +1
    -1
      src/native/windows/juce_win32_Files.cpp
  22. +32
    -13
      src/native/windows/juce_win32_NativeIncludes.h
  23. +2
    -2
      src/native/windows/juce_win32_WASAPI.cpp

+ 44
- 58
extras/juce demo/Source/MainDemoWindow.cpp View File

@@ -32,47 +32,10 @@ class ContentComp : public Component,
public MenuBarModel,
public ApplicationCommandTarget
{
//==============================================================================
MainDemoWindow* mainWindow;
OldSchoolLookAndFeel oldLookAndFeel;
Component* currentDemo;
int currentDemoId;
TooltipWindow tooltipWindow; // to add tooltips to an application, you
// just need to create one of these and leave it
// there to do its work..
enum CommandIDs
{
showRendering = 0x2000,
showFontsAndText = 0x2001,
showWidgets = 0x2002,
showThreading = 0x2003,
showTreeView = 0x2004,
showAudio = 0x2005,
showDragAndDrop = 0x2006,
showOpenGL = 0x2007,
showQuicktime = 0x2008,
showInterprocessComms = 0x2009,
showTable = 0x2010,
showCamera = 0x2011,
showWebBrowser = 0x2012,
showCodeEditor = 0x2013,
setDefaultLookAndFeel = 0x200b,
setOldSchoolLookAndFeel = 0x200c,
useNativeTitleBar = 0x200d,
useNativeMenus = 0x200e,
goToKioskMode = 0x200f
};
public:
//==============================================================================
ContentComp (MainDemoWindow* mainWindow_)
: mainWindow (mainWindow_),
currentDemo (0),
currentDemoId (0)
{
invokeDirectly (showRendering, true);
@@ -83,8 +46,6 @@ public:
// (need to do this because the old school look-and-feel object is one of our members,
// so will be deleted with us, and would leave a dangling pointer if it's selected)
LookAndFeel::setDefaultLookAndFeel (0);
deleteAllChildren();
}
//==============================================================================
@@ -97,9 +58,7 @@ public:
//==============================================================================
void showDemo (Component* demoComp)
{
delete currentDemo;
currentDemo = demoComp;
addAndMakeVisible (currentDemo);
resized();
}
@@ -114,7 +73,7 @@ public:
const PopupMenu getMenuForIndex (int menuIndex, const String& /*menuName*/)
{
ApplicationCommandManager* const commandManager = mainWindow->commandManager;
ApplicationCommandManager* commandManager = &(mainWindow->commandManager);
PopupMenu menu;
@@ -492,6 +451,41 @@ public:
}
juce_UseDebuggingNewOperator
private:
//==============================================================================
MainDemoWindow* mainWindow;
OldSchoolLookAndFeel oldLookAndFeel;
ScopedPointer<Component> currentDemo;
int currentDemoId;
TooltipWindow tooltipWindow; // to add tooltips to an application, you
// just need to create one of these and leave it
// there to do its work..
enum CommandIDs
{
showRendering = 0x2000,
showFontsAndText = 0x2001,
showWidgets = 0x2002,
showThreading = 0x2003,
showTreeView = 0x2004,
showAudio = 0x2005,
showDragAndDrop = 0x2006,
showOpenGL = 0x2007,
showQuicktime = 0x2008,
showInterprocessComms = 0x2009,
showTable = 0x2010,
showCamera = 0x2011,
showWebBrowser = 0x2012,
showCodeEditor = 0x2013,
setDefaultLookAndFeel = 0x200b,
setOldSchoolLookAndFeel = 0x200c,
useNativeTitleBar = 0x200d,
useNativeMenus = 0x200e,
goToKioskMode = 0x200f
};
};
//==============================================================================
@@ -541,19 +535,17 @@ MainDemoWindow::MainDemoWindow()
DocumentWindow::allButtons,
true)
{
commandManager = new ApplicationCommandManager();
setResizable (true, false); // resizability is a property of ResizableWindow
setResizeLimits (400, 300, 8192, 8192);
ContentComp* contentComp = new ContentComp (this);
commandManager->registerAllCommandsForTarget (contentComp);
commandManager->registerAllCommandsForTarget (JUCEApplication::getInstance());
commandManager.registerAllCommandsForTarget (contentComp);
commandManager.registerAllCommandsForTarget (JUCEApplication::getInstance());
// this lets the command manager use keypresses that arrive in our window to send
// out commands
addKeyListener (commandManager->getKeyMappings());
addKeyListener (commandManager.getKeyMappings());
// sets the main content component for the window to be this tabbed
// panel. This will be deleted when the window is deleted.
@@ -565,28 +557,24 @@ MainDemoWindow::MainDemoWindow()
// tells our menu bar model that it should watch this command manager for
// changes, and send change messages accordingly.
contentComp->setApplicationCommandManagerToWatch (commandManager);
contentComp->setApplicationCommandManagerToWatch (&commandManager);
setVisible (true);
#if JUCE_WINDOWS || JUCE_LINUX
#if JUCE_WINDOWS || JUCE_LINUX
taskbarIcon = new DemoTaskbarComponent();
#endif
#endif
}
MainDemoWindow::~MainDemoWindow()
{
#if JUCE_WINDOWS || JUCE_LINUX
deleteAndZero (taskbarIcon);
#endif
// because we've set the content comp to be used as our menu bar model, we
// have to switch this off before deleting the content comp..
setMenuBar (0);
#if JUCE_MAC // ..and also the main bar if we're using that on a Mac...
#if JUCE_MAC // ..and also the main bar if we're using that on a Mac...
MenuBarModel::setMacMainMenu (0);
#endif
#endif
// setting our content component to 0 will delete the current one, and
// that will in turn delete all its child components. You don't always
@@ -595,8 +583,6 @@ MainDemoWindow::~MainDemoWindow()
// make sure our content comp has gone away before deleting our command
// manager.
setContentComponent (0, true);
delete commandManager;
}
void MainDemoWindow::closeButtonPressed()


+ 2
- 2
extras/juce demo/Source/MainDemoWindow.h View File

@@ -40,10 +40,10 @@ public:
void closeButtonPressed();
// the command manager object used to dispatch command events
ApplicationCommandManager* commandManager;
ApplicationCommandManager commandManager;
private:
Component* taskbarIcon;
ScopedPointer<Component> taskbarIcon;
};


+ 132
- 114
juce_amalgamated.cpp View File

@@ -641,35 +641,54 @@ public:
ComSmartPtr() throw() : p (0) {}
ComSmartPtr (ComClass* const p_) : p (p_) { if (p_ != 0) p_->AddRef(); }
ComSmartPtr (const ComSmartPtr<ComClass>& p_) : p (p_.p) { if (p != 0) p->AddRef(); }
~ComSmartPtr() { if (p != 0) p->Release(); }
~ComSmartPtr() { release(); }

operator ComClass*() const throw() { return p; }
ComClass& operator*() const throw() { return *p; }
ComClass** operator&() throw() { return &p; }
ComClass* operator->() const throw() { return p; }

ComClass* operator= (ComClass* const newP)
ComSmartPtr& operator= (ComClass* const newP)
{
if (newP != 0) newP->AddRef();
if (p != 0) p->Release();
release();
p = newP;
return newP;
return *this;
}

ComClass* operator= (const ComSmartPtr<ComClass>& newP) { return operator= (newP.p); }
ComSmartPtr& operator= (const ComSmartPtr<ComClass>& newP) { return operator= (newP.p); }

HRESULT CoCreateInstance (REFCLSID rclsid, DWORD dwClsContext = CLSCTX_INPROC_SERVER)
// Releases and nullifies this pointer and returns its address
ComClass** resetAndGetPointerAddress()
{
#ifndef __MINGW32__
operator= (0);
return ::CoCreateInstance (rclsid, 0, dwClsContext, __uuidof (ComClass), (void**) &p);
#else
return S_FALSE;
#endif
release();
p = 0;
return &p;
}

HRESULT CoCreateInstance (REFCLSID classUUID, DWORD dwClsContext = CLSCTX_INPROC_SERVER)
{
#ifndef __MINGW32__
return ::CoCreateInstance (classUUID, 0, dwClsContext, __uuidof (ComClass), (void**) resetAndGetPointerAddress());
#else
return E_NOTIMPL;
#endif
}

template <class OtherComClass>
HRESULT QueryInterface (REFCLSID classUUID, ComSmartPtr<OtherComClass>& destObject) const
{
if (p == 0)
return E_POINTER;

return p->QueryInterface (classUUID, (void**) destObject.resetAndGetPointerAddress());
}

private:
ComClass* p;

void release() { if (p != 0) p->Release(); }

ComClass** operator&() throw(); // private to avoid it being used accidentally
};

/** Handy base class for writing COM objects, providing ref-counting and a basic QueryInterface method.
@@ -22777,7 +22796,7 @@ public:
}
}

int framesToDo = jmin (numSamples, bufferList->mBuffers[0].mDataByteSize / inputStreamDesc.mBytesPerFrame);
int framesToDo = jmin (numSamples, (int) (bufferList->mBuffers[0].mDataByteSize / inputStreamDesc.mBytesPerFrame));
bufferList->mBuffers[0].mDataByteSize = inputStreamDesc.mBytesPerFrame * framesToDo;

UInt32 outFlags = 0;
@@ -37418,26 +37437,24 @@ class ProcessorParameterPropertyComp : public PropertyComponent,
public AsyncUpdater
{
public:
ProcessorParameterPropertyComp (const String& name,
AudioProcessor* const owner_,
const int index_)
ProcessorParameterPropertyComp (const String& name, AudioProcessor& owner_, int index_)
: PropertyComponent (name),
owner (owner_),
index (index_)
index (index_),
slider (owner_, index_)
{
addAndMakeVisible (slider = new ParamSlider (owner_, index_));
owner_->addListener (this);
addAndMakeVisible (&slider);
owner_.addListener (this);
}

~ProcessorParameterPropertyComp()
{
owner->removeListener (this);
deleteAllChildren();
owner.removeListener (this);
}

void refresh()
{
slider->setValue (owner->getParameter (index), false);
slider.setValue (owner.getParameter (index), false);
}

void audioProcessorChanged (AudioProcessor*) {}
@@ -37456,14 +37473,11 @@ public:
juce_UseDebuggingNewOperator

private:
AudioProcessor* const owner;
const int index;
Slider* slider;

class ParamSlider : public Slider
{
public:
ParamSlider (AudioProcessor* const owner_, const int index_)
ParamSlider (AudioProcessor& owner_, const int index_)
: Slider (String::empty),
owner (owner_),
index (index_)
@@ -37482,25 +37496,29 @@ private:
{
const float newVal = (float) getValue();

if (owner->getParameter (index) != newVal)
owner->setParameter (index, newVal);
if (owner.getParameter (index) != newVal)
owner.setParameter (index, newVal);
}

const String getTextFromValue (double /*value*/)
{
return owner->getParameterText (index);
return owner.getParameterText (index);
}

juce_UseDebuggingNewOperator

private:
AudioProcessor* const owner;
AudioProcessor& owner;
const int index;

ParamSlider (const ParamSlider&);
ParamSlider& operator= (const ParamSlider&);
};

AudioProcessor& owner;
const int index;
ParamSlider slider;

ProcessorParameterPropertyComp (const ProcessorParameterPropertyComp&);
ProcessorParameterPropertyComp& operator= (const ProcessorParameterPropertyComp&);
};
@@ -37508,6 +37526,7 @@ private:
GenericAudioProcessorEditor::GenericAudioProcessorEditor (AudioProcessor* const owner_)
: AudioProcessorEditor (owner_)
{
jassert (owner_ != 0);
setOpaque (true);

addAndMakeVisible (panel = new PropertyPanel());
@@ -37523,7 +37542,7 @@ GenericAudioProcessorEditor::GenericAudioProcessorEditor (AudioProcessor* const
if (name.trim().isEmpty())
name = "Unnamed";

ProcessorParameterPropertyComp* const pc = new ProcessorParameterPropertyComp (name, owner_, i);
ProcessorParameterPropertyComp* const pc = new ProcessorParameterPropertyComp (name, *owner_, i);
params.add (pc);
totalHeight += pc->getPreferredHeight();
}
@@ -61456,12 +61475,6 @@ public:
{
}

Component::SafePointer<Component> component;
Rectangle<int> destination;
int msElapsed, msTotal;
double startSpeed, midSpeed, endSpeed, lastProgress;
double left, top, right, bottom;

bool useTimeslice (const int elapsed)
{
if (component == 0)
@@ -61507,6 +61520,12 @@ public:
component->setBounds (destination);
}

Component::SafePointer<Component> component;
Rectangle<int> destination;
int msElapsed, msTotal;
double startSpeed, midSpeed, endSpeed, lastProgress;
double left, top, right, bottom;

private:
inline double timeToDistance (const double time) const
{
@@ -61523,8 +61542,6 @@ ComponentAnimator::ComponentAnimator()

ComponentAnimator::~ComponentAnimator()
{
cancelAllAnimations (false);
jassert (tasks.size() == 0);
}

ComponentAnimator::AnimationTask* ComponentAnimator::findTaskFor (Component* const component) const
@@ -61581,15 +61598,13 @@ void ComponentAnimator::animateComponent (Component* const component,

void ComponentAnimator::cancelAllAnimations (const bool moveComponentsToTheirFinalPositions)
{
for (int i = tasks.size(); --i >= 0;)
if (tasks.size() > 0)
{
AnimationTask* const at = tasks.getUnchecked(i);

if (moveComponentsToTheirFinalPositions)
at->moveToFinalDestination();
for (int i = tasks.size(); --i >= 0;)
tasks.getUnchecked(i)->moveToFinalDestination();

delete at;
tasks.remove (i);
tasks.clear();
sendChangeMessage (this);
}
}
@@ -61604,8 +61619,7 @@ void ComponentAnimator::cancelAnimation (Component* const component,
if (moveComponentToItsFinalPosition)
at->moveToFinalDestination();

tasks.removeValue (at);
delete at;
tasks.removeObject (at);
sendChangeMessage (this);
}
}
@@ -61638,12 +61652,9 @@ void ComponentAnimator::timerCallback()

for (int i = tasks.size(); --i >= 0;)
{
AnimationTask* const at = tasks.getUnchecked(i);

if (! at->useTimeslice (elapsed))
if (! tasks.getUnchecked(i)->useTimeslice (elapsed))
{
tasks.remove (i);
delete at;
sendChangeMessage (this);
}
}
@@ -237479,7 +237490,8 @@ bool PNGImageFormat::writeImageToStream (const Image& image, OutputStream& out)
}
}

png_write_rows (pngWriteStruct, &rowData, 1);
png_bytep rowPtr = rowData;
png_write_rows (pngWriteStruct, &rowPtr, 1);
}

png_write_end (pngWriteStruct, pngInfoStruct);
@@ -237553,10 +237565,7 @@ public:
const MidiMessage m (d, numBytes, used, 0, time);

if (used <= 0)
{
jassertfalse; // malformed midi message
break;
}
break; // malformed message..

callback.handleIncomingMidiMessage (input, m);
numBytes -= used;
@@ -238907,7 +238916,7 @@ const File File::getLinkedTarget() const
if (SUCCEEDED (shellLink.CoCreateInstance (CLSID_ShellLink)))
{
ComSmartPtr <IPersistFile> persistFile;
if (SUCCEEDED (shellLink->QueryInterface (IID_IPersistFile, (LPVOID*) &persistFile)))
if (SUCCEEDED (shellLink.QueryInterface (IID_IPersistFile, persistFile)))
{
if (SUCCEEDED (persistFile->Load ((const WCHAR*) p, STGM_READ))
&& SUCCEEDED (shellLink->Resolve (0, SLR_ANY_MATCH | SLR_NO_UI)))
@@ -244662,8 +244671,11 @@ namespace ActiveXHelpers

HRESULT __stdcall GetWindowContext (LPOLEINPLACEFRAME* lplpFrame, LPOLEINPLACEUIWINDOW* lplpDoc, LPRECT, LPRECT, LPOLEINPLACEFRAMEINFO lpFrameInfo)
{
*lplpFrame = frame;
*lplpDoc = 0;
/* Note: if you call AddRef on the frame here, then some types of object (e.g. web browser control) cause leaks..
If you don't call AddRef then others crash (e.g. QuickTime).. Bit of a catch-22, so letting it leak is probably preferable.
*/
if (lplpFrame != 0) { frame->AddRef(); *lplpFrame = frame; }
if (lplpDoc != 0) *lplpDoc = 0;
lpFrameInfo->fMDIApp = FALSE;
lpFrameInfo->hwndFrame = window;
lpFrameInfo->haccel = 0;
@@ -244767,7 +244779,7 @@ namespace ActiveXHelpers

class ActiveXControlComponent::Pimpl : public ComponentMovementWatcher
{
ActiveXControlComponent* const owner;
ActiveXControlComponent& owner;
bool wasShowing;

public:
@@ -244776,10 +244788,10 @@ public:
IOleClientSite* clientSite;
IOleObject* control;

Pimpl (HWND hwnd, ActiveXControlComponent* const owner_)
: ComponentMovementWatcher (owner_),
Pimpl (HWND hwnd, ActiveXControlComponent& owner_)
: ComponentMovementWatcher (&owner_),
owner (owner_),
wasShowing (owner_ != 0 && owner_->isShowing()),
wasShowing (owner_.isShowing()),
controlHWND (0),
storage (new ActiveXHelpers::JuceIStorage()),
clientSite (new ActiveXHelpers::JuceIOleClientSite (hwnd)),
@@ -244801,24 +244813,24 @@ public:

void componentMovedOrResized (bool /*wasMoved*/, bool /*wasResized*/)
{
Component* const topComp = owner->getTopLevelComponent();
Component* const topComp = owner.getTopLevelComponent();

if (topComp->getPeer() != 0)
{
const Point<int> pos (owner->relativePositionToOtherComponent (topComp, Point<int>()));
const Point<int> pos (owner.relativePositionToOtherComponent (topComp, Point<int>()));

owner->setControlBounds (Rectangle<int> (pos.getX(), pos.getY(), owner->getWidth(), owner->getHeight()));
owner.setControlBounds (Rectangle<int> (pos.getX(), pos.getY(), owner.getWidth(), owner.getHeight()));
}
}

void componentPeerChanged()
{
const bool isShowingNow = owner->isShowing();
const bool isShowingNow = owner.isShowing();

if (wasShowing != isShowingNow)
{
wasShowing = isShowingNow;
owner->setControlVisible (isShowingNow);
owner.setControlVisible (isShowingNow);
}

componentMovedOrResized (true, true);
@@ -244908,7 +244920,7 @@ bool ActiveXControlComponent::createControl (const void* controlIID)
const Point<int> pos (relativePositionToOtherComponent (getTopLevelComponent(), Point<int>()));
HWND hwnd = (HWND) peer->getNativeHandle();

ScopedPointer<Pimpl> newControl (new Pimpl (hwnd, this));
ScopedPointer<Pimpl> newControl (new Pimpl (hwnd, *this));

HRESULT hr;
if ((hr = OleCreate (*(const IID*) controlIID, IID_IOleObject, 1 /*OLERENDER_DRAW*/, 0,
@@ -248374,7 +248386,7 @@ public:
int getIntProperty (const LPOLESTR name, const int defaultReturn) const
{
ComSmartPtr<IPropertyStorage> prop;
if (FAILED (discRecorder->GetRecorderProperties (&prop)))
if (FAILED (discRecorder->GetRecorderProperties (prop.resetAndGetPointerAddress())))
return defaultReturn;

PROPSPEC iPropSpec;
@@ -248389,7 +248401,7 @@ public:
bool setIntProperty (const LPOLESTR name, const int value) const
{
ComSmartPtr<IPropertyStorage> prop;
if (FAILED (discRecorder->GetRecorderProperties (&prop)))
if (FAILED (discRecorder->GetRecorderProperties (prop.resetAndGetPointerAddress())))
return false;

PROPSPEC iPropSpec;
@@ -252658,11 +252670,11 @@ static const String getDeviceID (IMMDevice* const device)
return s;
}

static EDataFlow getDataFlow (IMMDevice* const device)
static EDataFlow getDataFlow (const ComSmartPtr<IMMDevice>& device)
{
EDataFlow flow = eRender;
ComSmartPtr <IMMEndpoint> endPoint;
if (check (device->QueryInterface (__uuidof (IMMEndpoint), (void**) &endPoint)))
if (check (device.QueryInterface (__uuidof (IMMEndpoint), endPoint)))
(void) check (endPoint->GetDataFlow (&flow));

return flow;
@@ -253667,7 +253679,7 @@ public:
if (FAILED (hr))
return;

hr = graphBuilder->QueryInterface (IID_IMediaControl, (void**) &mediaControl);
hr = graphBuilder.QueryInterface (IID_IMediaControl, mediaControl);
if (FAILED (hr))
return;

@@ -253675,7 +253687,7 @@ public:
ComSmartPtr <IAMStreamConfig> streamConfig;

hr = captureGraphBuilder->FindInterface (&PIN_CATEGORY_CAPTURE, 0, filter,
IID_IAMStreamConfig, (void**) &streamConfig);
IID_IAMStreamConfig, (void**) streamConfig.resetAndGetPointerAddress());

if (streamConfig != 0)
{
@@ -253706,7 +253718,7 @@ public:
if (FAILED (hr))
return;

hr = sampleGrabberBase->QueryInterface (IID_ISampleGrabber, (void**) &sampleGrabber);
hr = sampleGrabberBase.QueryInterface (IID_ISampleGrabber, sampleGrabber);
if (FAILED (hr))
return;

@@ -253718,16 +253730,16 @@ public:
sampleGrabber->SetMediaType (&mt);

callback = new GrabberCallback (*this);
sampleGrabber->SetCallback (callback, 1);
hr = sampleGrabber->SetCallback (callback, 1);

hr = graphBuilder->AddFilter (sampleGrabberBase, _T("Sample Grabber"));
if (FAILED (hr))
return;

ComSmartPtr <IPin> grabberInputPin;
if (! (getPin (smartTee, PINDIR_OUTPUT, &smartTeeCaptureOutputPin, "capture")
&& getPin (smartTee, PINDIR_OUTPUT, &smartTeePreviewOutputPin, "preview")
&& getPin (sampleGrabberBase, PINDIR_INPUT, &grabberInputPin)))
if (! (getPin (smartTee, PINDIR_OUTPUT, smartTeeCaptureOutputPin, "capture")
&& getPin (smartTee, PINDIR_OUTPUT, smartTeePreviewOutputPin, "preview")
&& getPin (sampleGrabberBase, PINDIR_INPUT, grabberInputPin)))
return;

hr = graphBuilder->Connect (smartTeePreviewOutputPin, grabberInputPin);
@@ -253798,10 +253810,10 @@ public:
recordNextFrameTime = false;

ComSmartPtr <IPin> pin;
if (getPin (filter, PINDIR_OUTPUT, &pin))
if (getPin (filter, PINDIR_OUTPUT, pin))
{
ComSmartPtr <IAMPushSource> pushSource;
HRESULT hr = pin->QueryInterface (IID_IAMPushSource, (void**) &pushSource);
HRESULT hr = pin.QueryInterface (IID_IAMPushSource, pushSource);

if (pushSource != 0)
{
@@ -253871,7 +253883,7 @@ public:
if (SUCCEEDED (hr))
{
ComSmartPtr <IFileSinkFilter> fileSink;
hr = asfWriter->QueryInterface (IID_IFileSinkFilter, (void**) &fileSink);
hr = asfWriter.QueryInterface (IID_IFileSinkFilter, fileSink);

if (SUCCEEDED (hr))
{
@@ -253884,10 +253896,10 @@ public:
if (SUCCEEDED (hr))
{
ComSmartPtr <IConfigAsfWriter> asfConfig;
hr = asfWriter->QueryInterface (IID_IConfigAsfWriter, (void**) &asfConfig);
hr = asfWriter.QueryInterface (IID_IConfigAsfWriter, asfConfig);
asfConfig->SetIndexMode (true);
ComSmartPtr <IWMProfileManager> profileManager;
hr = WMCreateProfileManager (&profileManager);
hr = WMCreateProfileManager (profileManager.resetAndGetPointerAddress());

// This gibberish is the DirectShow profile for a video-only wmv file.
String prof ("<profile version=\"589824\" storageformat=\"1\" name=\"Quality\" description=\"Quality type for output.\"><streamconfig "
@@ -253903,14 +253915,14 @@ public:
.replace ("$HEIGHT", String (height));

ComSmartPtr <IWMProfile> currentProfile;
hr = profileManager->LoadProfileByData ((const WCHAR*) prof, &currentProfile);
hr = profileManager->LoadProfileByData ((const WCHAR*) prof, currentProfile.resetAndGetPointerAddress());
hr = asfConfig->ConfigureFilterUsingProfile (currentProfile);

if (SUCCEEDED (hr))
{
ComSmartPtr <IPin> asfWriterInputPin;

if (getPin (asfWriter, PINDIR_INPUT, &asfWriterInputPin, "Video Input 01"))
if (getPin (asfWriter, PINDIR_INPUT, asfWriterInputPin, "Video Input 01"))
{
hr = graphBuilder->Connect (smartTeeCaptureOutputPin, asfWriterInputPin);

@@ -253992,7 +254004,7 @@ public:
owner->addChangeListener (this);
owner->addUser();
owner->viewerComps.add (this);
setSize (owner_->width, owner_->height);
setSize (owner->width, owner->height);
}

~DShowCaptureViewerComp()
@@ -254152,14 +254164,14 @@ private:
return false;
}

static bool getPin (IBaseFilter* filter, const PIN_DIRECTION wantedDirection, IPin** result, const char* pinName = 0)
static bool getPin (IBaseFilter* filter, const PIN_DIRECTION wantedDirection, ComSmartPtr<IPin>& result, const char* pinName = 0)
{
ComSmartPtr <IEnumPins> enumerator;
ComSmartPtr <IPin> pin;

filter->EnumPins (&enumerator);
filter->EnumPins (enumerator.resetAndGetPointerAddress());

while (enumerator->Next (1, &pin, 0) == S_OK)
while (enumerator->Next (1, pin.resetAndGetPointerAddress(), 0) == S_OK)
{
PIN_DIRECTION dir;
pin->QueryDirection (&dir);
@@ -254172,8 +254184,7 @@ private:

if (pinName == 0 || String (pinName).equalsIgnoreCase (String (info.achName)))
{
pin->AddRef();
*result = pin;
result = pin;
return true;
}
}
@@ -254186,20 +254197,20 @@ private:
{
ComSmartPtr <IPin> in, out;

return getPin (first, PINDIR_OUTPUT, &out)
&& getPin (second, PINDIR_INPUT, &in)
return getPin (first, PINDIR_OUTPUT, out)
&& getPin (second, PINDIR_INPUT, in)
&& SUCCEEDED (graphBuilder->Connect (out, in));
}

bool addGraphToRot()
{
ComSmartPtr <IRunningObjectTable> rot;
if (FAILED (GetRunningObjectTable (0, &rot)))
if (FAILED (GetRunningObjectTable (0, rot.resetAndGetPointerAddress())))
return false;

ComSmartPtr <IMoniker> moniker;
WCHAR buffer[128];
HRESULT hr = CreateItemMoniker (_T("!"), buffer, &moniker);
HRESULT hr = CreateItemMoniker (_T("!"), buffer, moniker.resetAndGetPointerAddress());
if (FAILED (hr))
return false;

@@ -254211,7 +254222,7 @@ private:
{
ComSmartPtr <IRunningObjectTable> rot;

if (SUCCEEDED (GetRunningObjectTable (0, &rot)))
if (SUCCEEDED (GetRunningObjectTable (0, rot.resetAndGetPointerAddress())))
rot->Revoke (graphRegistrationID);
}

@@ -254338,22 +254349,22 @@ static ComSmartPtr <IBaseFilter> enumerateCameras (StringArray* const names,
if (SUCCEEDED (hr))
{
ComSmartPtr <IEnumMoniker> enumerator;
hr = pDevEnum->CreateClassEnumerator (CLSID_VideoInputDeviceCategory, &enumerator, 0);
hr = pDevEnum->CreateClassEnumerator (CLSID_VideoInputDeviceCategory, enumerator.resetAndGetPointerAddress(), 0);

if (SUCCEEDED (hr) && enumerator != 0)
{
ComSmartPtr <IBaseFilter> captureFilter;
ComSmartPtr <IMoniker> moniker;
ULONG fetched;

while (enumerator->Next (1, &moniker, &fetched) == S_OK)
while (enumerator->Next (1, moniker.resetAndGetPointerAddress(), &fetched) == S_OK)
{
hr = moniker->BindToObject (0, 0, IID_IBaseFilter, (void**) &captureFilter);
ComSmartPtr <IBaseFilter> captureFilter;
hr = moniker->BindToObject (0, 0, IID_IBaseFilter, (void**) captureFilter.resetAndGetPointerAddress());

if (SUCCEEDED (hr))
{
ComSmartPtr <IPropertyBag> propertyBag;
hr = moniker->BindToStorage (0, 0, IID_IPropertyBag, (void**) &propertyBag);
hr = moniker->BindToStorage (0, 0, IID_IPropertyBag, (void**) propertyBag.resetAndGetPointerAddress());

if (SUCCEEDED (hr))
{
@@ -254372,17 +254383,12 @@ static ComSmartPtr <IBaseFilter> enumerateCameras (StringArray* const names,
{
name = var.bstrVal;
result = captureFilter;
captureFilter = 0;
break;
}

++index;
}

moniker = 0;
}

captureFilter = 0;
}
}
}
@@ -254731,8 +254737,14 @@ bool File::isDirectory() const

bool File::exists() const
{
juce_statStruct info;

return fullPath.isNotEmpty()
&& access (fullPath.toUTF8(), F_OK) == 0;
#if JUCE_IOS && ! __DARWIN_ONLY_64_BIT_INO_T
&& (lstat64 (fullPath.toUTF8(), &info) == 0);
#else
&& (lstat (fullPath.toUTF8(), &info) == 0);
#endif
}

bool File::existsAsFile() const
@@ -255302,16 +255314,16 @@ bool File::isHidden() const
return getFileName().startsWithChar ('.');
}

static const File juce_readlink (const char* const utf8, const File& defaultFile)
static const File juce_readlink (const String& file, const File& defaultFile)
{
const int size = 8192;
HeapBlock<char> buffer;
buffer.malloc (size + 4);

const size_t numBytes = readlink (utf8, buffer, size);
const size_t numBytes = readlink (file.toUTF8(), buffer, size);

if (numBytes > 0 && numBytes <= size)
return File (String::fromUTF8 (buffer, (int) numBytes));
return File (file).getSiblingFile (String::fromUTF8 (buffer, (int) numBytes));

return defaultFile;
}
@@ -264568,8 +264580,14 @@ bool File::isDirectory() const

bool File::exists() const
{
juce_statStruct info;

return fullPath.isNotEmpty()
&& access (fullPath.toUTF8(), F_OK) == 0;
#if JUCE_IOS && ! __DARWIN_ONLY_64_BIT_INO_T
&& (lstat64 (fullPath.toUTF8(), &info) == 0);
#else
&& (lstat (fullPath.toUTF8(), &info) == 0);
#endif
}

bool File::existsAsFile() const


+ 7
- 22
juce_amalgamated.h View File

@@ -64,7 +64,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 74
#define JUCE_BUILDNUMBER 75

/** Current Juce version number.

@@ -2951,7 +2951,7 @@ private:
long juce_InterlockedExchangeAdd (volatile long* a, long b) throw();
long juce_InterlockedCompareExchange (volatile long* a, long b, long c) throw();
__int64 juce_InterlockedCompareExchange64 (volatile __int64* a, __int64 b, __int64 c) throw();
void juce_MemoryBarrier() throw() { long x = 0; juce_InterlockedIncrement (&x); }
inline void juce_MemoryBarrier() throw() { long x = 0; juce_InterlockedIncrement (&x); }
#endif

#if JUCE_64BIT
@@ -3430,18 +3430,6 @@ public:
template <typename IndexType>
inline ElementType* operator+ (IndexType index) const throw() { return data + index; }

/** Returns a reference to the raw data pointer.
Beware that the pointer returned here will become invalid as soon as you call
any of the allocator methods on this object!
*/
inline ElementType* const* operator&() const throw() { return static_cast <ElementType* const*> (&data); }

/** Returns a reference to the raw data pointer.
Beware that the pointer returned here will become invalid as soon as you call
any of the allocator methods on this object!
*/
inline ElementType** operator&() throw() { return static_cast <ElementType**> (&data); }

/** Compares the pointer with another pointer.
This can be handy for checking whether this is a null pointer.
*/
@@ -6720,9 +6708,6 @@ public:
/** Lets you access methods and properties of the object that this ScopedPointer refers to. */
inline ObjectType* operator->() const throw() { return object; }

/** Returns a reference to the address of the object that this ScopedPointer refers to. */
inline ObjectType* const* operator&() const throw() { return static_cast <ObjectType* const*> (&object); }

/** Removes the current object from this ScopedPointer without deleting it.

This will return the current object, and set the ScopedPointer to a null pointer.
@@ -28475,11 +28460,8 @@ public:
e.g. @code
class MyJUCEApp : public JUCEApplication
{
MyApplicationWindow* myMainWindow;

public:
MyJUCEApp()
: myMainWindow (0)
{
}

@@ -28496,7 +28478,7 @@ public:

void shutdown()
{
delete myMainWindow;
myMainWindow = 0;
}

const String getApplicationName()
@@ -28508,6 +28490,9 @@ public:
{
return "1.0";
}

private:
ScopedPointer <MyApplicationWindow> myMainWindow;
};

// this creates wrapper code to actually launch the app properly.
@@ -45606,7 +45591,7 @@ public:

private:
class AnimationTask;
Array <AnimationTask*> tasks;
OwnedArray <AnimationTask> tasks;
uint32 lastTime;

AnimationTask* findTaskFor (Component* component) const;


+ 4
- 4
src/application/juce_Application.h View File

@@ -46,11 +46,8 @@
e.g. @code
class MyJUCEApp : public JUCEApplication
{
MyApplicationWindow* myMainWindow;
public:
MyJUCEApp()
: myMainWindow (0)
{
}
@@ -67,7 +64,7 @@
void shutdown()
{
delete myMainWindow;
myMainWindow = 0;
}
const String getApplicationName()
@@ -79,6 +76,9 @@
{
return "1.0";
}
private:
ScopedPointer <MyApplicationWindow> myMainWindow;
};
// this creates wrapper code to actually launch the app properly.


+ 1
- 1
src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp View File

@@ -256,7 +256,7 @@ public:
}
}
int framesToDo = jmin (numSamples, bufferList->mBuffers[0].mDataByteSize / inputStreamDesc.mBytesPerFrame);
int framesToDo = jmin (numSamples, (int) (bufferList->mBuffers[0].mDataByteSize / inputStreamDesc.mBytesPerFrame));
bufferList->mBuffers[0].mDataByteSize = inputStreamDesc.mBytesPerFrame * framesToDo;
UInt32 outFlags = 0;


+ 18
- 19
src/audio/processors/juce_GenericAudioProcessorEditor.cpp View File

@@ -38,26 +38,24 @@ class ProcessorParameterPropertyComp : public PropertyComponent,
public AsyncUpdater
{
public:
ProcessorParameterPropertyComp (const String& name,
AudioProcessor* const owner_,
const int index_)
ProcessorParameterPropertyComp (const String& name, AudioProcessor& owner_, int index_)
: PropertyComponent (name),
owner (owner_),
index (index_)
index (index_),
slider (owner_, index_)
{
addAndMakeVisible (slider = new ParamSlider (owner_, index_));
owner_->addListener (this);
addAndMakeVisible (&slider);
owner_.addListener (this);
}
~ProcessorParameterPropertyComp()
{
owner->removeListener (this);
deleteAllChildren();
owner.removeListener (this);
}
void refresh()
{
slider->setValue (owner->getParameter (index), false);
slider.setValue (owner.getParameter (index), false);
}
void audioProcessorChanged (AudioProcessor*) {}
@@ -77,15 +75,11 @@ public:
juce_UseDebuggingNewOperator
private:
AudioProcessor* const owner;
const int index;
Slider* slider;
//==============================================================================
class ParamSlider : public Slider
{
public:
ParamSlider (AudioProcessor* const owner_, const int index_)
ParamSlider (AudioProcessor& owner_, const int index_)
: Slider (String::empty),
owner (owner_),
index (index_)
@@ -104,26 +98,30 @@ private:
{
const float newVal = (float) getValue();
if (owner->getParameter (index) != newVal)
owner->setParameter (index, newVal);
if (owner.getParameter (index) != newVal)
owner.setParameter (index, newVal);
}
const String getTextFromValue (double /*value*/)
{
return owner->getParameterText (index);
return owner.getParameterText (index);
}
//==============================================================================
juce_UseDebuggingNewOperator
private:
AudioProcessor* const owner;
AudioProcessor& owner;
const int index;
ParamSlider (const ParamSlider&);
ParamSlider& operator= (const ParamSlider&);
};
AudioProcessor& owner;
const int index;
ParamSlider slider;
ProcessorParameterPropertyComp (const ProcessorParameterPropertyComp&);
ProcessorParameterPropertyComp& operator= (const ProcessorParameterPropertyComp&);
};
@@ -133,6 +131,7 @@ private:
GenericAudioProcessorEditor::GenericAudioProcessorEditor (AudioProcessor* const owner_)
: AudioProcessorEditor (owner_)
{
jassert (owner_ != 0);
setOpaque (true);
addAndMakeVisible (panel = new PropertyPanel());
@@ -148,7 +147,7 @@ GenericAudioProcessorEditor::GenericAudioProcessorEditor (AudioProcessor* const
if (name.trim().isEmpty())
name = "Unnamed";
ProcessorParameterPropertyComp* const pc = new ProcessorParameterPropertyComp (name, owner_, i);
ProcessorParameterPropertyComp* const pc = new ProcessorParameterPropertyComp (name, *owner_, i);
params.add (pc);
totalHeight += pc->getPreferredHeight();
}


+ 0
- 12
src/containers/juce_HeapBlock.h View File

@@ -147,18 +147,6 @@ public:
template <typename IndexType>
inline ElementType* operator+ (IndexType index) const throw() { return data + index; }
/** Returns a reference to the raw data pointer.
Beware that the pointer returned here will become invalid as soon as you call
any of the allocator methods on this object!
*/
inline ElementType* const* operator&() const throw() { return static_cast <ElementType* const*> (&data); }
/** Returns a reference to the raw data pointer.
Beware that the pointer returned here will become invalid as soon as you call
any of the allocator methods on this object!
*/
inline ElementType** operator&() throw() { return static_cast <ElementType**> (&data); }
//==============================================================================
/** Compares the pointer with another pointer.
This can be handy for checking whether this is a null pointer.


+ 0
- 3
src/containers/juce_ScopedPointer.h View File

@@ -139,9 +139,6 @@ public:
/** Lets you access methods and properties of the object that this ScopedPointer refers to. */
inline ObjectType* operator->() const throw() { return object; }
/** Returns a reference to the address of the object that this ScopedPointer refers to. */
inline ObjectType* const* operator&() const throw() { return static_cast <ObjectType* const*> (&object); }
//==============================================================================
/** Removes the current object from this ScopedPointer without deleting it.


+ 1
- 1
src/core/juce_Atomic.h View File

@@ -207,7 +207,7 @@ private:
long juce_InterlockedExchangeAdd (volatile long* a, long b) throw();
long juce_InterlockedCompareExchange (volatile long* a, long b, long c) throw();
__int64 juce_InterlockedCompareExchange64 (volatile __int64* a, __int64 b, __int64 c) throw();
void juce_MemoryBarrier() throw() { long x = 0; juce_InterlockedIncrement (&x); }
inline void juce_MemoryBarrier() throw() { long x = 0; juce_InterlockedIncrement (&x); }
#endif
#if JUCE_64BIT


+ 1
- 1
src/core/juce_StandardHeader.h View File

@@ -33,7 +33,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 74
#define JUCE_BUILDNUMBER 75
/** Current Juce version number.


+ 12
- 20
src/gui/components/layout/juce_ComponentAnimator.cpp View File

@@ -40,12 +40,6 @@ public:
{
}
Component::SafePointer<Component> component;
Rectangle<int> destination;
int msElapsed, msTotal;
double startSpeed, midSpeed, endSpeed, lastProgress;
double left, top, right, bottom;
bool useTimeslice (const int elapsed)
{
if (component == 0)
@@ -91,6 +85,12 @@ public:
component->setBounds (destination);
}
Component::SafePointer<Component> component;
Rectangle<int> destination;
int msElapsed, msTotal;
double startSpeed, midSpeed, endSpeed, lastProgress;
double left, top, right, bottom;
private:
inline double timeToDistance (const double time) const
{
@@ -108,8 +108,6 @@ ComponentAnimator::ComponentAnimator()
ComponentAnimator::~ComponentAnimator()
{
cancelAllAnimations (false);
jassert (tasks.size() == 0);
}
//==============================================================================
@@ -167,15 +165,13 @@ void ComponentAnimator::animateComponent (Component* const component,
void ComponentAnimator::cancelAllAnimations (const bool moveComponentsToTheirFinalPositions)
{
for (int i = tasks.size(); --i >= 0;)
if (tasks.size() > 0)
{
AnimationTask* const at = tasks.getUnchecked(i);
if (moveComponentsToTheirFinalPositions)
at->moveToFinalDestination();
for (int i = tasks.size(); --i >= 0;)
tasks.getUnchecked(i)->moveToFinalDestination();
delete at;
tasks.remove (i);
tasks.clear();
sendChangeMessage (this);
}
}
@@ -190,8 +186,7 @@ void ComponentAnimator::cancelAnimation (Component* const component,
if (moveComponentToItsFinalPosition)
at->moveToFinalDestination();
tasks.removeValue (at);
delete at;
tasks.removeObject (at);
sendChangeMessage (this);
}
}
@@ -224,12 +219,9 @@ void ComponentAnimator::timerCallback()
for (int i = tasks.size(); --i >= 0;)
{
AnimationTask* const at = tasks.getUnchecked(i);
if (! at->useTimeslice (elapsed))
if (! tasks.getUnchecked(i)->useTimeslice (elapsed))
{
tasks.remove (i);
delete at;
sendChangeMessage (this);
}
}


+ 1
- 1
src/gui/components/layout/juce_ComponentAnimator.h View File

@@ -128,7 +128,7 @@ public:
private:
class AnimationTask;
Array <AnimationTask*> tasks;
OwnedArray <AnimationTask> tasks;
uint32 lastTime;
AnimationTask* findTaskFor (Component* component) const;


+ 2
- 1
src/gui/graphics/imaging/image_file_formats/juce_PNGLoader.cpp View File

@@ -341,7 +341,8 @@ bool PNGImageFormat::writeImageToStream (const Image& image, OutputStream& out)
}
}
png_write_rows (pngWriteStruct, &rowData, 1);
png_bytep rowPtr = rowData;
png_write_rows (pngWriteStruct, &rowPtr, 1);
}
png_write_end (pngWriteStruct, pngInfoStruct);


+ 1
- 4
src/native/common/juce_MidiDataConcatenator.h View File

@@ -65,10 +65,7 @@ public:
const MidiMessage m (d, numBytes, used, 0, time);
if (used <= 0)
{
jassertfalse; // malformed midi message
break;
}
break; // malformed message..
callback.handleIncomingMidiMessage (input, m);
numBytes -= used;


+ 7
- 1
src/native/common/juce_posix_SharedCode.h View File

@@ -246,8 +246,14 @@ bool File::isDirectory() const
bool File::exists() const
{
juce_statStruct info;
return fullPath.isNotEmpty()
&& access (fullPath.toUTF8(), F_OK) == 0;
#if JUCE_IOS && ! __DARWIN_ONLY_64_BIT_INO_T
&& (lstat64 (fullPath.toUTF8(), &info) == 0);
#else
&& (lstat (fullPath.toUTF8(), &info) == 0);
#endif
}
bool File::existsAsFile() const


+ 3
- 3
src/native/linux/juce_linux_Files.cpp View File

@@ -107,16 +107,16 @@ bool File::isHidden() const
}
//==============================================================================
static const File juce_readlink (const char* const utf8, const File& defaultFile)
static const File juce_readlink (const String& file, const File& defaultFile)
{
const int size = 8192;
HeapBlock<char> buffer;
buffer.malloc (size + 4);
const size_t numBytes = readlink (utf8, buffer, size);
const size_t numBytes = readlink (file.toUTF8(), buffer, size);
if (numBytes > 0 && numBytes <= size)
return File (String::fromUTF8 (buffer, (int) numBytes));
return File (file).getSiblingFile (String::fromUTF8 (buffer, (int) numBytes));
return defaultFile;
}


+ 15
- 12
src/native/windows/juce_win32_ActiveXComponent.cpp View File

@@ -105,8 +105,11 @@ namespace ActiveXHelpers
HRESULT __stdcall GetWindowContext (LPOLEINPLACEFRAME* lplpFrame, LPOLEINPLACEUIWINDOW* lplpDoc, LPRECT, LPRECT, LPOLEINPLACEFRAMEINFO lpFrameInfo)
{
*lplpFrame = frame;
*lplpDoc = 0;
/* Note: if you call AddRef on the frame here, then some types of object (e.g. web browser control) cause leaks..
If you don't call AddRef then others crash (e.g. QuickTime).. Bit of a catch-22, so letting it leak is probably preferable.
*/
if (lplpFrame != 0) { frame->AddRef(); *lplpFrame = frame; }
if (lplpDoc != 0) *lplpDoc = 0;
lpFrameInfo->fMDIApp = FALSE;
lpFrameInfo->hwndFrame = window;
lpFrameInfo->haccel = 0;
@@ -213,7 +216,7 @@ namespace ActiveXHelpers
//==============================================================================
class ActiveXControlComponent::Pimpl : public ComponentMovementWatcher
{
ActiveXControlComponent* const owner;
ActiveXControlComponent& owner;
bool wasShowing;
public:
@@ -223,10 +226,10 @@ public:
IOleObject* control;
//==============================================================================
Pimpl (HWND hwnd, ActiveXControlComponent* const owner_)
: ComponentMovementWatcher (owner_),
Pimpl (HWND hwnd, ActiveXControlComponent& owner_)
: ComponentMovementWatcher (&owner_),
owner (owner_),
wasShowing (owner_ != 0 && owner_->isShowing()),
wasShowing (owner_.isShowing()),
controlHWND (0),
storage (new ActiveXHelpers::JuceIStorage()),
clientSite (new ActiveXHelpers::JuceIOleClientSite (hwnd)),
@@ -249,24 +252,24 @@ public:
//==============================================================================
void componentMovedOrResized (bool /*wasMoved*/, bool /*wasResized*/)
{
Component* const topComp = owner->getTopLevelComponent();
Component* const topComp = owner.getTopLevelComponent();
if (topComp->getPeer() != 0)
{
const Point<int> pos (owner->relativePositionToOtherComponent (topComp, Point<int>()));
const Point<int> pos (owner.relativePositionToOtherComponent (topComp, Point<int>()));
owner->setControlBounds (Rectangle<int> (pos.getX(), pos.getY(), owner->getWidth(), owner->getHeight()));
owner.setControlBounds (Rectangle<int> (pos.getX(), pos.getY(), owner.getWidth(), owner.getHeight()));
}
}
void componentPeerChanged()
{
const bool isShowingNow = owner->isShowing();
const bool isShowingNow = owner.isShowing();
if (wasShowing != isShowingNow)
{
wasShowing = isShowingNow;
owner->setControlVisible (isShowingNow);
owner.setControlVisible (isShowingNow);
}
componentMovedOrResized (true, true);
@@ -356,7 +359,7 @@ bool ActiveXControlComponent::createControl (const void* controlIID)
const Point<int> pos (relativePositionToOtherComponent (getTopLevelComponent(), Point<int>()));
HWND hwnd = (HWND) peer->getNativeHandle();
ScopedPointer<Pimpl> newControl (new Pimpl (hwnd, this));
ScopedPointer<Pimpl> newControl (new Pimpl (hwnd, *this));
HRESULT hr;
if ((hr = OleCreate (*(const IID*) controlIID, IID_IOleObject, 1 /*OLERENDER_DRAW*/, 0,


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

@@ -2163,7 +2163,7 @@ public:
int getIntProperty (const LPOLESTR name, const int defaultReturn) const
{
ComSmartPtr<IPropertyStorage> prop;
if (FAILED (discRecorder->GetRecorderProperties (&prop)))
if (FAILED (discRecorder->GetRecorderProperties (prop.resetAndGetPointerAddress())))
return defaultReturn;
PROPSPEC iPropSpec;
@@ -2178,7 +2178,7 @@ public:
bool setIntProperty (const LPOLESTR name, const int value) const
{
ComSmartPtr<IPropertyStorage> prop;
if (FAILED (discRecorder->GetRecorderProperties (&prop)))
if (FAILED (discRecorder->GetRecorderProperties (prop.resetAndGetPointerAddress())))
return false;
PROPSPEC iPropSpec;


+ 29
- 35
src/native/windows/juce_win32_CameraDevice.cpp View File

@@ -55,7 +55,7 @@ public:
if (FAILED (hr))
return;
hr = graphBuilder->QueryInterface (IID_IMediaControl, (void**) &mediaControl);
hr = graphBuilder.QueryInterface (IID_IMediaControl, mediaControl);
if (FAILED (hr))
return;
@@ -63,7 +63,7 @@ public:
ComSmartPtr <IAMStreamConfig> streamConfig;
hr = captureGraphBuilder->FindInterface (&PIN_CATEGORY_CAPTURE, 0, filter,
IID_IAMStreamConfig, (void**) &streamConfig);
IID_IAMStreamConfig, (void**) streamConfig.resetAndGetPointerAddress());
if (streamConfig != 0)
{
@@ -94,7 +94,7 @@ public:
if (FAILED (hr))
return;
hr = sampleGrabberBase->QueryInterface (IID_ISampleGrabber, (void**) &sampleGrabber);
hr = sampleGrabberBase.QueryInterface (IID_ISampleGrabber, sampleGrabber);
if (FAILED (hr))
return;
@@ -106,16 +106,16 @@ public:
sampleGrabber->SetMediaType (&mt);
callback = new GrabberCallback (*this);
sampleGrabber->SetCallback (callback, 1);
hr = sampleGrabber->SetCallback (callback, 1);
hr = graphBuilder->AddFilter (sampleGrabberBase, _T("Sample Grabber"));
if (FAILED (hr))
return;
ComSmartPtr <IPin> grabberInputPin;
if (! (getPin (smartTee, PINDIR_OUTPUT, &smartTeeCaptureOutputPin, "capture")
&& getPin (smartTee, PINDIR_OUTPUT, &smartTeePreviewOutputPin, "preview")
&& getPin (sampleGrabberBase, PINDIR_INPUT, &grabberInputPin)))
if (! (getPin (smartTee, PINDIR_OUTPUT, smartTeeCaptureOutputPin, "capture")
&& getPin (smartTee, PINDIR_OUTPUT, smartTeePreviewOutputPin, "preview")
&& getPin (sampleGrabberBase, PINDIR_INPUT, grabberInputPin)))
return;
hr = graphBuilder->Connect (smartTeePreviewOutputPin, grabberInputPin);
@@ -186,10 +186,10 @@ public:
recordNextFrameTime = false;
ComSmartPtr <IPin> pin;
if (getPin (filter, PINDIR_OUTPUT, &pin))
if (getPin (filter, PINDIR_OUTPUT, pin))
{
ComSmartPtr <IAMPushSource> pushSource;
HRESULT hr = pin->QueryInterface (IID_IAMPushSource, (void**) &pushSource);
HRESULT hr = pin.QueryInterface (IID_IAMPushSource, pushSource);
if (pushSource != 0)
{
@@ -259,7 +259,7 @@ public:
if (SUCCEEDED (hr))
{
ComSmartPtr <IFileSinkFilter> fileSink;
hr = asfWriter->QueryInterface (IID_IFileSinkFilter, (void**) &fileSink);
hr = asfWriter.QueryInterface (IID_IFileSinkFilter, fileSink);
if (SUCCEEDED (hr))
{
@@ -272,10 +272,10 @@ public:
if (SUCCEEDED (hr))
{
ComSmartPtr <IConfigAsfWriter> asfConfig;
hr = asfWriter->QueryInterface (IID_IConfigAsfWriter, (void**) &asfConfig);
hr = asfWriter.QueryInterface (IID_IConfigAsfWriter, asfConfig);
asfConfig->SetIndexMode (true);
ComSmartPtr <IWMProfileManager> profileManager;
hr = WMCreateProfileManager (&profileManager);
hr = WMCreateProfileManager (profileManager.resetAndGetPointerAddress());
// This gibberish is the DirectShow profile for a video-only wmv file.
String prof ("<profile version=\"589824\" storageformat=\"1\" name=\"Quality\" description=\"Quality type for output.\"><streamconfig "
@@ -291,14 +291,14 @@ public:
.replace ("$HEIGHT", String (height));
ComSmartPtr <IWMProfile> currentProfile;
hr = profileManager->LoadProfileByData ((const WCHAR*) prof, &currentProfile);
hr = profileManager->LoadProfileByData ((const WCHAR*) prof, currentProfile.resetAndGetPointerAddress());
hr = asfConfig->ConfigureFilterUsingProfile (currentProfile);
if (SUCCEEDED (hr))
{
ComSmartPtr <IPin> asfWriterInputPin;
if (getPin (asfWriter, PINDIR_INPUT, &asfWriterInputPin, "Video Input 01"))
if (getPin (asfWriter, PINDIR_INPUT, asfWriterInputPin, "Video Input 01"))
{
hr = graphBuilder->Connect (smartTeeCaptureOutputPin, asfWriterInputPin);
@@ -383,7 +383,7 @@ public:
owner->addChangeListener (this);
owner->addUser();
owner->viewerComps.add (this);
setSize (owner_->width, owner_->height);
setSize (owner->width, owner->height);
}
~DShowCaptureViewerComp()
@@ -544,14 +544,14 @@ private:
return false;
}
static bool getPin (IBaseFilter* filter, const PIN_DIRECTION wantedDirection, IPin** result, const char* pinName = 0)
static bool getPin (IBaseFilter* filter, const PIN_DIRECTION wantedDirection, ComSmartPtr<IPin>& result, const char* pinName = 0)
{
ComSmartPtr <IEnumPins> enumerator;
ComSmartPtr <IPin> pin;
filter->EnumPins (&enumerator);
filter->EnumPins (enumerator.resetAndGetPointerAddress());
while (enumerator->Next (1, &pin, 0) == S_OK)
while (enumerator->Next (1, pin.resetAndGetPointerAddress(), 0) == S_OK)
{
PIN_DIRECTION dir;
pin->QueryDirection (&dir);
@@ -564,8 +564,7 @@ private:
if (pinName == 0 || String (pinName).equalsIgnoreCase (String (info.achName)))
{
pin->AddRef();
*result = pin;
result = pin;
return true;
}
}
@@ -578,20 +577,20 @@ private:
{
ComSmartPtr <IPin> in, out;
return getPin (first, PINDIR_OUTPUT, &out)
&& getPin (second, PINDIR_INPUT, &in)
return getPin (first, PINDIR_OUTPUT, out)
&& getPin (second, PINDIR_INPUT, in)
&& SUCCEEDED (graphBuilder->Connect (out, in));
}
bool addGraphToRot()
{
ComSmartPtr <IRunningObjectTable> rot;
if (FAILED (GetRunningObjectTable (0, &rot)))
if (FAILED (GetRunningObjectTable (0, rot.resetAndGetPointerAddress())))
return false;
ComSmartPtr <IMoniker> moniker;
WCHAR buffer[128];
HRESULT hr = CreateItemMoniker (_T("!"), buffer, &moniker);
HRESULT hr = CreateItemMoniker (_T("!"), buffer, moniker.resetAndGetPointerAddress());
if (FAILED (hr))
return false;
@@ -603,7 +602,7 @@ private:
{
ComSmartPtr <IRunningObjectTable> rot;
if (SUCCEEDED (GetRunningObjectTable (0, &rot)))
if (SUCCEEDED (GetRunningObjectTable (0, rot.resetAndGetPointerAddress())))
rot->Revoke (graphRegistrationID);
}
@@ -737,22 +736,22 @@ static ComSmartPtr <IBaseFilter> enumerateCameras (StringArray* const names,
if (SUCCEEDED (hr))
{
ComSmartPtr <IEnumMoniker> enumerator;
hr = pDevEnum->CreateClassEnumerator (CLSID_VideoInputDeviceCategory, &enumerator, 0);
hr = pDevEnum->CreateClassEnumerator (CLSID_VideoInputDeviceCategory, enumerator.resetAndGetPointerAddress(), 0);
if (SUCCEEDED (hr) && enumerator != 0)
{
ComSmartPtr <IBaseFilter> captureFilter;
ComSmartPtr <IMoniker> moniker;
ULONG fetched;
while (enumerator->Next (1, &moniker, &fetched) == S_OK)
while (enumerator->Next (1, moniker.resetAndGetPointerAddress(), &fetched) == S_OK)
{
hr = moniker->BindToObject (0, 0, IID_IBaseFilter, (void**) &captureFilter);
ComSmartPtr <IBaseFilter> captureFilter;
hr = moniker->BindToObject (0, 0, IID_IBaseFilter, (void**) captureFilter.resetAndGetPointerAddress());
if (SUCCEEDED (hr))
{
ComSmartPtr <IPropertyBag> propertyBag;
hr = moniker->BindToStorage (0, 0, IID_IPropertyBag, (void**) &propertyBag);
hr = moniker->BindToStorage (0, 0, IID_IPropertyBag, (void**) propertyBag.resetAndGetPointerAddress());
if (SUCCEEDED (hr))
{
@@ -771,17 +770,12 @@ static ComSmartPtr <IBaseFilter> enumerateCameras (StringArray* const names,
{
name = var.bstrVal;
result = captureFilter;
captureFilter = 0;
break;
}
++index;
}
moniker = 0;
}
captureFilter = 0;
}
}
}


+ 1
- 1
src/native/windows/juce_win32_Files.cpp View File

@@ -521,7 +521,7 @@ const File File::getLinkedTarget() const
if (SUCCEEDED (shellLink.CoCreateInstance (CLSID_ShellLink)))
{
ComSmartPtr <IPersistFile> persistFile;
if (SUCCEEDED (shellLink->QueryInterface (IID_IPersistFile, (LPVOID*) &persistFile)))
if (SUCCEEDED (shellLink.QueryInterface (IID_IPersistFile, persistFile)))
{
if (SUCCEEDED (persistFile->Load ((const WCHAR*) p, STGM_READ))
&& SUCCEEDED (shellLink->Resolve (0, SLR_ANY_MATCH | SLR_NO_UI)))


+ 32
- 13
src/native/windows/juce_win32_NativeIncludes.h View File

@@ -199,35 +199,54 @@ public:
ComSmartPtr() throw() : p (0) {}
ComSmartPtr (ComClass* const p_) : p (p_) { if (p_ != 0) p_->AddRef(); }
ComSmartPtr (const ComSmartPtr<ComClass>& p_) : p (p_.p) { if (p != 0) p->AddRef(); }
~ComSmartPtr() { if (p != 0) p->Release(); }
~ComSmartPtr() { release(); }
operator ComClass*() const throw() { return p; }
ComClass& operator*() const throw() { return *p; }
ComClass** operator&() throw() { return &p; }
ComClass* operator->() const throw() { return p; }
ComClass* operator= (ComClass* const newP)
ComSmartPtr& operator= (ComClass* const newP)
{
if (newP != 0) newP->AddRef();
if (p != 0) p->Release();
release();
p = newP;
return newP;
return *this;
}
ComClass* operator= (const ComSmartPtr<ComClass>& newP) { return operator= (newP.p); }
ComSmartPtr& operator= (const ComSmartPtr<ComClass>& newP) { return operator= (newP.p); }
HRESULT CoCreateInstance (REFCLSID rclsid, DWORD dwClsContext = CLSCTX_INPROC_SERVER)
// Releases and nullifies this pointer and returns its address
ComClass** resetAndGetPointerAddress()
{
#ifndef __MINGW32__
operator= (0);
return ::CoCreateInstance (rclsid, 0, dwClsContext, __uuidof (ComClass), (void**) &p);
#else
return S_FALSE;
#endif
release();
p = 0;
return &p;
}
HRESULT CoCreateInstance (REFCLSID classUUID, DWORD dwClsContext = CLSCTX_INPROC_SERVER)
{
#ifndef __MINGW32__
return ::CoCreateInstance (classUUID, 0, dwClsContext, __uuidof (ComClass), (void**) resetAndGetPointerAddress());
#else
return E_NOTIMPL;
#endif
}
template <class OtherComClass>
HRESULT QueryInterface (REFCLSID classUUID, ComSmartPtr<OtherComClass>& destObject) const
{
if (p == 0)
return E_POINTER;
return p->QueryInterface (classUUID, (void**) destObject.resetAndGetPointerAddress());
}
private:
ComClass* p;
void release() { if (p != 0) p->Release(); }
ComClass** operator&() throw(); // private to avoid it being used accidentally
};
//==============================================================================


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

@@ -103,11 +103,11 @@ static const String getDeviceID (IMMDevice* const device)
return s;
}
static EDataFlow getDataFlow (IMMDevice* const device)
static EDataFlow getDataFlow (const ComSmartPtr<IMMDevice>& device)
{
EDataFlow flow = eRender;
ComSmartPtr <IMMEndpoint> endPoint;
if (check (device->QueryInterface (__uuidof (IMMEndpoint), (void**) &endPoint)))
if (check (device.QueryInterface (__uuidof (IMMEndpoint), endPoint)))
(void) check (endPoint->GetDataFlow (&flow));
return flow;


Loading…
Cancel
Save