racineconde
asked on
warning C4541: 'dynamic_cast' used on polymorphic type 'cSegment' with /GR-; unpredictable behavior may result
This is a warning I have when i compile my windows application.
//------
warning C4541: 'dynamic_cast' used on polymorphic type 'cSegment' with /GR-; unpredictable behavior may result
//------
I've put the incriminated line between two lines like this //------------------------ ---------- ---------- ----------
Here's the whole code:
//************************ ****** BEGINNING OF THE CODE
#include "stdafx.h"
#include "cTimeCode.h"
#include "cEdlData.h"
#include "cAafEdl.h"
#include "cWipe.h"
#include "cCut.h"
cWipe::cWipe(aafInt32 smpte,int duration,aafBoolean_t reverse)
: Smpte(smpte), Duration(duration), Reverse(reverse)
{
}
void cWipe::print()
{
edit();
wcout << L" W:" << setw(3) << Smpte << L" " << setw(3) << Duration << L" ";
frames();
}
cUnknownPtr<IAAFComponent> cWipe::createTransition(cU nknownPtr< IAAFDictio nary> pDictionary,cUnknownPtr<IA AFDataDef> pDataDef)
{
cUnknownPtr<IAAFComponent> pComponent;
if(Duration>0 && length() > 0)//ignore zero length disolves
{
//transition
aafBoolean_t IsSound;
checkResult(pDataDef->IsSo undKind(&I sSound));
cUnknownPtr<IAAFOperationD ef> pOperationDef;
cUnknownPtr<IAAFParameterD ef> pParameterDefSMPTE;
cUnknownPtr<IAAFParameterD ef> pParameterDefReverse;
if(!IsSound)
{
GetWipe(pDictionary,pDataD ef,&pOpera tionDef);
GetWipeParamSMPTE(pDiction ary,pDataD ef,&pParam eterDefSMP TE);
GetWipeParamReverse(pDicti onary,pDat aDef,&pPar ameterDefR everse);
}
else
{
//wipes do not make sense for sound data - so wipes make audio *disolves*
GetDisolve(pDictionary,pDa taDef,kAAF EffectMono AudioDisso lve,&pOper ationDef);
}
cUnknownPtr<IAAFOperationG roup> pOperationGroup;
checkResult(pDictionary->C reateInsta nce(AUID_A AFOperatio nGroup,IID _IAAFOpera tionGroup, (IUnknown **)&pOperationGroup));
checkResult(pOperationGrou p->Initial ize(pDataD ef,Duratio n,pOperati onDef));
cUnknownPtr<IAAFTransition > pTransition;
checkResult(pDictionary->C reateInsta nce(AUID_A AFTransiti on,IID_IAA FTransitio n,(IUnknow n **)&pTransition));
if(pParameterDefSMPTE.isVa lid())
{
cUnknownPtr<IAAFConstantVa lue> pConstantValue;
checkResult(pDictionary->C reateInsta nce(AUID_A AFConstant Value,IID_ IAAFConsta ntValue,(I Unknown **)&pConstantValue));
checkResult(pConstantValue ->Initiali ze(pParame terDefSMPT E,sizeof(S mpte),(uns igned char*)&Smpte));
cUnknownPtr<IAAFParameter> pParameter;
pConstantValue.demandQI(II D_IAAFPara meter,(voi d**)&pPara meter);
checkResult(pOperationGrou p->AddPara meter(pPar ameter));
}
if(pParameterDefReverse.is Valid())
{
cUnknownPtr<IAAFConstantVa lue> pConstantValue;
checkResult(pDictionary->C reateInsta nce(AUID_A AFConstant Value,IID_ IAAFConsta ntValue,(I Unknown **)&pConstantValue));
checkResult(pConstantValue ->Initiali ze(pParame terDefReve rse,sizeof (Reverse), (unsigned char*)&Reverse));
cUnknownPtr<IAAFParameter> pParameter;
pConstantValue.demandQI(II D_IAAFPara meter,(voi d**)&pPara meter);
checkResult(pOperationGrou p->AddPara meter(pPar ameter));
}
checkResult(pTransition->I nitialize( pDataDef,D uration,0, pOperation Group));
pTransition.demandQI(IID_I AAFCompone nt, (void **)&pComponent);
setEditNumber(pDictionary, pComponent ,getEditNu mber());
}
return pComponent;
}
bool cWipe::removeZeroLengthCut (cSegment: :Ptr prevprev,cSegment::Ptr prev)
{
// remove zero length cut (if any) preceding transition
// if zero length cut (prev) matches segment preceding it (prevprev)
bool removePrev = false;
if (prev->length() != 0) return removePrev; // must be zero length
//------------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---
if (!dynamic_cast<cCut::Ptr>( prev)) return removePrev; // must be cut
//------------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---
// check tape names match
wstring prevCassette = prev->cassette();
wstring prevprevCassette = prevprev->cassette();
if(MERGE_B_ROLLS && !prevCassette.empty())
{
wstring::iterator it = prevCassette.end();
--it;
if(*it == L'B') prevCassette.erase(it,prev Cassette.e nd()); // remove 'B' if B roll
}
if(MERGE_B_ROLLS && !prevprevCassette.empty())
{
wstring::iterator it = prevprevCassette.end();
--it;
if(*it == L'B') prevprevCassette.erase(it, prevprevCa ssette.end ()); // remove 'B' if B roll
}
if (prevCassette != prevprevCassette) return removePrev;
// check speed ratios match
aafRational_t prevSpeed = prev->speedRatio();
aafRational_t prevprevSpeed = prevprev->speedRatio();
if ((prevSpeed.numerator * prevprevSpeed.denominator) != (prevprevSpeed.numerator * prevSpeed.denominator)) return removePrev;
// check prev source tc falls within prevprev segment
cTimeCode prevSrcTc = prev->in();
cTimeCode prevprevSrcIn = prevprev->in();
cTimeCode prevprevSrcOut = prevprev->out();
if ((prevSrcTc < prevprevSrcIn) || (prevSrcTc > prevprevSrcOut)) return removePrev;
removePrev = true; // indicates that prev segment should be removed
return removePrev;
}
void cWipe::adjust(cSegment::Pt r prev,bool sound)
{
prev->adjustDestOut(Durati on);
if(sound)
{
prev->setOutFade(Duration) ;
}
}
cSegment::Ptr cWipe::clone()
{
cWipe::Ptr seg = new cWipe(Smpte,Duration,Rever se);
seg->set(getEditNumber(), cassette(), in(), destIn(), destOut(), speedRatio());
return seg;
}
int cWipe::getTransitionDurati on()
{
return Duration;
}
//************************ ****** END OF THE CODE
Is someone has an idea???
//------
warning C4541: 'dynamic_cast' used on polymorphic type 'cSegment' with /GR-; unpredictable behavior may result
//------
I've put the incriminated line between two lines like this //------------------------
Here's the whole code:
//************************
#include "stdafx.h"
#include "cTimeCode.h"
#include "cEdlData.h"
#include "cAafEdl.h"
#include "cWipe.h"
#include "cCut.h"
cWipe::cWipe(aafInt32 smpte,int duration,aafBoolean_t reverse)
: Smpte(smpte), Duration(duration), Reverse(reverse)
{
}
void cWipe::print()
{
edit();
wcout << L" W:" << setw(3) << Smpte << L" " << setw(3) << Duration << L" ";
frames();
}
cUnknownPtr<IAAFComponent>
{
cUnknownPtr<IAAFComponent>
if(Duration>0 && length() > 0)//ignore zero length disolves
{
//transition
aafBoolean_t IsSound;
checkResult(pDataDef->IsSo
cUnknownPtr<IAAFOperationD
cUnknownPtr<IAAFParameterD
cUnknownPtr<IAAFParameterD
if(!IsSound)
{
GetWipe(pDictionary,pDataD
GetWipeParamSMPTE(pDiction
GetWipeParamReverse(pDicti
}
else
{
//wipes do not make sense for sound data - so wipes make audio *disolves*
GetDisolve(pDictionary,pDa
}
cUnknownPtr<IAAFOperationG
checkResult(pDictionary->C
checkResult(pOperationGrou
cUnknownPtr<IAAFTransition
checkResult(pDictionary->C
if(pParameterDefSMPTE.isVa
{
cUnknownPtr<IAAFConstantVa
checkResult(pDictionary->C
checkResult(pConstantValue
cUnknownPtr<IAAFParameter>
pConstantValue.demandQI(II
checkResult(pOperationGrou
}
if(pParameterDefReverse.is
{
cUnknownPtr<IAAFConstantVa
checkResult(pDictionary->C
checkResult(pConstantValue
cUnknownPtr<IAAFParameter>
pConstantValue.demandQI(II
checkResult(pOperationGrou
}
checkResult(pTransition->I
pTransition.demandQI(IID_I
setEditNumber(pDictionary,
}
return pComponent;
}
bool cWipe::removeZeroLengthCut
{
// remove zero length cut (if any) preceding transition
// if zero length cut (prev) matches segment preceding it (prevprev)
bool removePrev = false;
if (prev->length() != 0) return removePrev; // must be zero length
//------------------------
if (!dynamic_cast<cCut::Ptr>(
//------------------------
// check tape names match
wstring prevCassette = prev->cassette();
wstring prevprevCassette = prevprev->cassette();
if(MERGE_B_ROLLS && !prevCassette.empty())
{
wstring::iterator it = prevCassette.end();
--it;
if(*it == L'B') prevCassette.erase(it,prev
}
if(MERGE_B_ROLLS && !prevprevCassette.empty())
{
wstring::iterator it = prevprevCassette.end();
--it;
if(*it == L'B') prevprevCassette.erase(it,
}
if (prevCassette != prevprevCassette) return removePrev;
// check speed ratios match
aafRational_t prevSpeed = prev->speedRatio();
aafRational_t prevprevSpeed = prevprev->speedRatio();
if ((prevSpeed.numerator * prevprevSpeed.denominator)
// check prev source tc falls within prevprev segment
cTimeCode prevSrcTc = prev->in();
cTimeCode prevprevSrcIn = prevprev->in();
cTimeCode prevprevSrcOut = prevprev->out();
if ((prevSrcTc < prevprevSrcIn) || (prevSrcTc > prevprevSrcOut)) return removePrev;
removePrev = true; // indicates that prev segment should be removed
return removePrev;
}
void cWipe::adjust(cSegment::Pt
{
prev->adjustDestOut(Durati
if(sound)
{
prev->setOutFade(Duration)
}
}
cSegment::Ptr cWipe::clone()
{
cWipe::Ptr seg = new cWipe(Smpte,Duration,Rever
seg->set(getEditNumber(), cassette(), in(), destIn(), destOut(), speedRatio());
return seg;
}
int cWipe::getTransitionDurati
{
return Duration;
}
//************************
Is someone has an idea???
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Looks like AlexFM beat me to the punch line while I was typing.... :-)
ASKER
Sorry Axter... But thanks for trying...
Thanks Axter. This was simultaneous post, splitting will be also OK. racineconde, for your decision.
ASKER
I mixed up everything:
Accepted answer --> AlexFM
Assisted answer --> Axter
Thanks guys
Accepted answer --> AlexFM
Assisted answer --> Axter
Thanks guys