int eventDecay(){ if( !environment() ){ CallOut = -1; Destruct(); return 0; } switch(Count){ case 10: if(stank) message("smell", "The "+Limb+" rapidly corrodes.", environment()); SetShort("the corroding remnant of a " + Limb); break; case 20: if(stank) message("smell", "An acrid chemical odor fills the area.", environment()); SetShort("some corroded chemicals"); break; case 30: CallOut = -1; Destruct(); return 0; } Count++; return Count; }
/** This function opens a RMobileSmartCardEap sub-session from RMobilePhone that will refer to the application referenced by aAID. It will be assumed that the application exists and contains a DF_EAP for the aEapType specified. The client must call RMobileSmartCardEap::InitialiseEapMethod() to ensure correct functionality of this sub-session. @param aPhone The RMobilePhone sub-session relative to which this sub-session will open. @param aAId The UICC Application ID, which should be of one that has EAP support. @param aEapType The EAP method type that this sub-session will use under the aAID application. @return KErrNone if successful, otherwise a system-wide error code. @see RMobileSmartCardEap::InitialiseEapMethod() @capability None @publishedPartner @released */ EXPORT_C TInt RMobileSmartCardEap::Open(RMobilePhone& aPhone, const RMobilePhone::TAID& aAID, const TEapType& aEapType) { RSessionBase* session = &aPhone.SessionHandle(); __ASSERT_ALWAYS(session != NULL, PanicClient(EEtelPanicNullHandle)); TInt subSessionHandle = aPhone.SubSessionHandle(); __ASSERT_ALWAYS(subSessionHandle != NULL, PanicClient(EEtelPanicNullHandle)); TRAPD(ret, ConstructL()); if (ret != KErrNone) { Destruct(); return ret; } // Appending the application ID and Eap Type to the name of the // subsession; plus two one-byte delimeters indicating lengths. // See var appIdbuf for why KAIDSize is multiplied by 2. TBufC<SCEAP_SSN_LENGTH + RMobilePhone::KAIDSize*2 + KEapTypeSize + 2> nameBuf(KETelSmartCardEapSession); // 2 for delimeters TPtr name(nameBuf.Des()); // the length of the AID as a Sept ASCII character TChar lengthAIDChar = SeptChar(aAID.Length()); // the value of the AID // converted to a 16-bit string representation. Multiply by 2, // since each AID byte is represented as two sem-octects. TBufC<2*RMobilePhone::KAIDSize> appIdbuf; TPtr appIdPtr(appIdbuf.Des()); ConvertBinToText(aAID, appIdPtr); // the length of the EapType TInt lengthEapType = aEapType.Length(); TChar charEapType = SeptChar(lengthEapType); // the value of the EapType (converted to 16-bit) TBufC<KEapTypeSize> eapTypeBuf; TPtr eapTypePtr(eapTypeBuf.Des()); eapTypePtr.Copy(aEapType); // appending... name.Append(lengthAIDChar); name.Append(appIdPtr); name.Append(charEapType); name.Append(eapTypePtr); TIpcArgs args(&name, TIpcArgs::ENothing, subSessionHandle); SetSessionHandle(*session); ret = CreateSubSession(*session, EEtelOpenFromSubSession, args); if (ret != KErrNone) { Destruct(); } return ret; }
void Vehicle::DeleteMe() { if(IsInWorld()) RemoveFromWorld(false, true); Destruct(); }
// // Driver calls these to create and destroy compiler objects. // ShHandle ConstructCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output, const ShBuiltInResources *resources) { TShHandleBase *base = static_cast<TShHandleBase *>(ConstructCompiler(type, spec, output)); if (base == nullptr) { return 0; } TCompiler *compiler = base->getAsCompiler(); if (compiler == nullptr) { return 0; } // Generate built-in symbol table. if (!compiler->Init(*resources)) { Destruct(base); return 0; } return base; }
void Item::DeleteMe() { if( IsContainer() ) TO_CONTAINER(this)->Destruct(); else Destruct(); }
void CPropertyImplement::Copy(const IProperty& r) { if(this == &r) return; CProperty& left = (CProperty&)*this; const CProperty& right = (const CProperty&)r; if(left.GetValueType() != right.GetValueType()) { Destruct(); Construct(right.GetValueType()); } if(v_str == right.GetValueType()) { left.GetStr() = right.GetStr(); } else if(v_bin == right.GetValueType()) { CBinary& d = left.GetBin(); const CBinary& s = right.GetBin(); d.Clone(s, true); } else { ASSERT(v_u32 == right.GetValueType()); left.GetU32() = right.GetU32(); } }
void CUtlVector<T, A>::RemoveAll() { for(int i = m_Size; --i >= 0; ) { Destruct(&Element(i)); } m_Size = 0; }
void CUtlVector<T, A>::RemoveMultipleFromTail(int num) { assert(num <= Count()); for(int i = m_Size - num; i < m_Size; i++) Destruct(&Element(i)); m_Size -= num; }
EXPORT_C void bases::ConstructL(bool aConvertOnly, CCellMap* aCellMap) { TRAPD(err, bases::InnerConstructL(aConvertOnly, aCellMap)); if (err == KErrCorrupt) { Destruct(); TFileName database_filename; database_filename.Format(_L("%S%S"), &DataDir(), &database_file); User::LeaveIfError(BaflUtils::DeleteFile(Fs(), database_filename)); InnerConstructL(aConvertOnly, aCellMap); } }
// ----------------------------------------------------------------------------- // RMmCustomApiExt::Close // This method closes a RMmCustomApiExt subsession // ----------------------------------------------------------------------------- // EXPORT_C void RMmCustomApiExt::Close() { CloseSubSession( EEtelClose ); Destruct(); //Call also Destruct() from base class (deletes base class's pointer //container) RMmCustomAPI::Destruct(); }
LibinputServer::~LibinputServer() { #ifdef KEY_INPUT_HANDLING_VIRTUAL if (m_virtualkeyboard != nullptr) { Destruct(m_virtualkeyboard); } #endif libinput_unref(m_libinput); udev_unref(m_udev); }
void CUtlVector<T, A>::RemoveMultipleFromHead(int num) { assert(num <= Count()); for(int i = num; --i >= 0; ) Destruct(&Element(i)); ShiftElementsLeft(0, num); m_Size -= num; }
void CUtlVector<T, A>::RemoveMultiple(int elem, int num) { assert(elem >= 0); assert(elem + num <= Count()); for(int i = elem + num; --i >= elem; ) Destruct(&Element(i)); ShiftElementsLeft(elem, num); m_Size -= num; }
void CUtlVector<T, A>::FastRemove(int elem) { assert(IsValidIndex(elem)); Destruct(&Element(elem)); if(m_Size > 0) { if(elem != m_Size - 1) memcpy(&Element(elem), &Element(m_Size - 1), sizeof(T)); --m_Size; } }
/** This function member closes a RMobileSmartCardEap sub-session. The Close() request also attempts to release this instance's lock on the <AID,EAPType> (DF_EAP). @panic Panics the client with ETel Panic EEtelPanicHandleNotClosed, if this instance owns the lock on the DF_EAP but could not release some resource to allow other instances to gain access. (However, it should be noted that the TSY can take control of DF_EAP access in the event that a client dies in such a manner.) @see RMobileSmartCardEap::ReleaseEapMethod() @capability None @publishedPartner @released */ EXPORT_C void RMobileSmartCardEap::Close() { if (iOwnsEapMethodLock) { TInt err = ReleaseEapMethod(); if (err != KErrNone) { PanicClient(EEtelPanicHandleNotClosed); } } CloseSubSession(EEtelClose); Destruct(); }
bool destructStruct(Context *ctx, ParseResult *pr, ParseResult *ret_pr, llvm::IRBuilder<> *builder, bool value_is_ptr) { Struct *st = ctx->getStruct(pr->type); std::vector<Type*> *st_types = &(st->member_types); llvm::Value *struct_value; if (value_is_ptr) { struct_value = pr->value; } else { struct_value = llvm::cast<llvm::Value>( builder->CreateAlloca( ctx->toLLVMType(pr->type, NULL, false)) ); builder->CreateStore(pr->value, struct_value); } int i = 0; for (std::vector<Type*>::iterator b = st_types->begin(), e = st_types->end(); b != e; ++b) { ParseResult element; element.set(ret_pr->block, *b, struct_value); std::vector<llvm::Value *> indices; STL::push_back2( &indices, ctx->nt->getLLVMZero(), llvm::cast<llvm::Value>(ctx->nt->getNativeInt(i++)) ); element.value = builder->Insert( llvm::GetElementPtrInst::Create( struct_value, llvm::ArrayRef<llvm::Value*>(indices) ), "sp" ); element.do_not_destruct = false; Destruct(ctx, &element, &element, builder, true); ret_pr->block = element.block; } return true; }
MessageLog::~MessageLog() { if (GlobalApp->MCP) { GlobalApp->MCP->WidgetSetCheck(IDI_STATUSLOG, 0); } // if Close(); Destruct(); if (LineArray) { delete [] LineArray; LineArray = NULL; } // if } // MessageLog::~MessageLog
void OpenSteer::PolylinePathway::initialize (const int _pointCount, const Vec3 _points[], const double _radius, const bool _cyclic) { // set data members, allocate arrays radius = _radius; cyclic = _cyclic; pointCount = _pointCount; totalPathLength = 0; if (isInit) Destruct(); isInit = true; if (cyclic) pointCount++; lengths = new DEBUG_NEW_PLACEMENT double [pointCount]; points = new DEBUG_NEW_PLACEMENT Vec3 [pointCount]; normals = new DEBUG_NEW_PLACEMENT Vec3 [pointCount]; // loop over all points for (int i = 0; i < pointCount; i++) { // copy in point locations, closing cycle when appropriate const bool closeCycle = cyclic && (i == pointCount-1); const int j = closeCycle ? 0 : i; points[i] = _points[j]; // for the end of each segment if (i > 0) { // compute the segment length normals[i] = points[i] - points[i-1]; lengths[i] = normals[i].length (); // find the normalized vector parallel to the segment normals[i] *= 1 / lengths[i]; // keep running total of segment lengths totalPathLength += lengths[i]; } } }
void CStandardRocket::Update() { iAnimationPlayer->Update(); if(iRange < 0) { Destruct(); }else { iRange -= iSpeed.GetIntInBaseInt(); iCoordinates.iX += iPixelsPerMoveX; iTextureObject->ChangeXCoordinate(iPixelsPerMoveX); iCoordinates.iY += iPixelsPerMoveY; iTextureObject->ChangeYCoordinate(iPixelsPerMoveY); } if(iAlive) { iSmokeCreator->Update(); } }
int asCScriptObject::Release() { // Clear the flag set by the GC gcFlag = false; // Call the script destructor behaviour if the reference counter is 1. if( refCount.get() == 1 && !isDestructCalled ) { CallDestructor(); } // Now do the actual releasing int r = refCount.atomicDec(); if( r == 0 ) { Destruct(); return 0; } return r; }
void DynamicObject::Remove() { if(IsInWorld()) { // remove aura from all targets Unit* target; for(std::set< uint64 >::iterator itr = targets.begin(); itr != targets.end(); ++itr) { uint64 TargetGUID = *itr; target = m_mapMgr->GetUnit(TargetGUID); if(target != NULL) target->RemoveAura(m_spellProto->Id); } WorldPacket data(SMSG_DESTROY_OBJECT, 8); data << GetGUID() << uint8(1); SendMessageToSet(&data, true); if(m_spellProto->IsChannelSpell() && GUID_HIPART(casterGuid) != HIGHGUID_TYPE_GAMEOBJECT) { if(Unit* u_caster = GetMapMgr()->GetUnit(casterGuid)) { if(u_caster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT) == GetGUID()) { u_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0); u_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0); } } } RemoveFromWorld(true); } Destruct(); }
int eventSuffer(object who) { if( !random(100) ) { Destruct(); return 1; } switch(random(3)) { case 0: send_messages("cough", "$agent_name $agent_verb miserably.", who, 0, environment(who)); break; case 1: send_messages("", "$agent_possessive_noun red nose runs all over " "$agent_possessive face.", who, 0, environment(who)); break; case 2: send_messages("look", "$agent_name $agent_verb miserable.", who, 0, environment(who)); break; } who->eventReceiveDamage(0, COLD, random(3) + 1, 1); return 1; }
CInternetHandle::~CInternetHandle(void) { DESTRUCTOR_TRY Destruct(); DESTRUCTOR_CATCH }
VideoEncoder::VideoEncoder(Muxer* muxer, const QString& codec_name, const std::vector<std::pair<QString, QString> >& codec_options, unsigned int bit_rate, unsigned int width, unsigned int height, unsigned int frame_rate) : BaseEncoder(muxer) { try { m_bit_rate = bit_rate; m_width = width; m_height = height; m_frame_rate = frame_rate; m_opt_threads = std::max(1u, std::thread::hardware_concurrency()); m_opt_minrate = (unsigned int) -1; m_opt_maxrate = (unsigned int) -1; m_opt_bufsize = (unsigned int) -1; #if !SSR_USE_AVCODEC_PRIVATE_CRF m_opt_crf = (unsigned int) -1; #endif #if !SSR_USE_AVCODEC_PRIVATE_PRESET m_opt_preset = ""; #endif if(m_width == 0 || m_height == 0) { Logger::LogError("[VideoEncoder::Init] " + QObject::tr("Error: Width or height is zero!")); throw LibavException(); } if(m_width > 10000 || m_height > 10000) { Logger::LogError("[VideoEncoder::Init] " + QObject::tr("Error: Width or height is too large, the maximum width and height is %1!").arg(10000)); throw LibavException(); } if(m_width % 2 != 0 || m_height % 2 != 0) { Logger::LogError("[VideoEncoder::Init] " + QObject::tr("Error: Width or height is not an even number!")); throw LibavException(); } if(m_frame_rate == 0) { Logger::LogError("[VideoEncoder::Init] " + QObject::tr("Error: Frame rate it zero!")); throw LibavException(); } // start the encoder AVDictionary *options = NULL; try { for(unsigned int i = 0; i < codec_options.size(); ++i) { if(codec_options[i].first == "threads") m_opt_threads = codec_options[i].second.toUInt(); else if(codec_options[i].first == "minrate") m_opt_minrate = codec_options[i].second.toUInt() * 1024; // kbps else if(codec_options[i].first == "maxrate") m_opt_maxrate = codec_options[i].second.toUInt() * 1024; // kbps else if(codec_options[i].first == "bufsize") m_opt_bufsize = codec_options[i].second.toUInt() * 1024; // kbit #if !SSR_USE_AVCODEC_PRIVATE_PRESET else if(codec_options[i].first == "crf") m_opt_crf = codec_options[i].second.toUInt(); #endif #if !SSR_USE_AVCODEC_PRIVATE_PRESET else if(codec_options[i].first == "preset") m_opt_preset = codec_options[i].second; #endif else av_dict_set(&options, codec_options[i].first.toAscii().constData(), codec_options[i].second.toAscii().constData(), 0); } CreateCodec(codec_name, &options); av_dict_free(&options); } catch(...) { av_dict_free(&options); throw; } #if !SSR_USE_AVCODEC_ENCODE_VIDEO2 // allocate a temporary buffer // Apparently libav/ffmpeg completely ignores the size of the buffer, and if it's too small it just crashes. // Originally it was 256k, which is large enough for about 99.9% of the packets, but it still occasionally crashes. // So now I'm using a buffer that's always at least large enough to hold a 256k header and *two* completely uncompressed frames. // (one YUV frame takes w * h * 1.5 bytes) // Newer versions of libav/ffmpeg have deprecated avcodec_encode_video and added a new function which does the allocation // automatically, just like avcodec_encode_audio2, but that function isn't available in Ubuntu 12.04/12.10 yet. m_temp_buffer.resize(std::max<unsigned int>(FF_MIN_BUFFER_SIZE, 256 * 1024 + m_width * m_height * 3)); #endif GetMuxer()->RegisterEncoder(GetStreamIndex(), this); } catch(...) { Destruct(); throw; } }
VideoEncoder::~VideoEncoder() { Destruct(); // destruct the base class first }
DMemModelProcess::~DMemModelProcess() { __KTRACE_OPT(KMMU,Kern::Printf("DMemModelProcess destruct")); Destruct(); }
GTGPlayer::~GTGPlayer() { Destruct(); }
void Realloc(uint32_t n_samples, int nBuffers) { Destruct(); Construct(n_samples, nBuffers, SampleRate, wisdomFile.c_str()); }
void Realloc(uint32_t n_samples, int nBuffers) { Destruct(); Construct(n_samples, nBuffers, SampleRate); }
~SuperCapo(){Destruct();}