Exemplo n.º 1
0
      /* Explicit constructor, taking as input initial receiver
       * coordinates, ephemeris to be used, default observable and
       * whether TGD will be computed or not.
       *
       * Both the tropospheric and ionospheric models will be set to NULL.
       *
       * This constructor is meant to be used when working with GNSS
       * data structures in order to set the basic parameters from the
       * beginning.
       *
       * @param RxCoordinates Initial receiver coordinates.
       * @param dEphemeris    XvtStore<SatID> object to be used by default.
       * @param dObservable   Observable type to be used by default.
       * @param usetgd        Whether TGD will be used by default or not.
       *
       * @sa DataStructures.hpp.
       */
   ModeledPR::ModeledPR( const Position& RxCoordinates,
                         XvtStore<SatID>& dEphemeris,
                         const TypeID& dObservable,
                         bool usetgd )
   {

      init();
      Prepare(RxCoordinates);
      pDefaultIonoModel = NULL;
      pDefaultTropoModel = NULL;
      setDefaultObservable(dObservable);
      setDefaultEphemeris(dEphemeris);
      useTGD = usetgd;

   }  // End of 'ModeledPR::ModeledPR()'
Exemplo n.º 2
0
void Proposer :: OnAcceptTimeout()
{
    PLGHead("OK");
    
    if (GetInstanceID() != m_llTimeoutInstanceID)
    {
        PLGErr("TimeoutInstanceID %lu not same to NowInstanceID %lu, skip",
                m_llTimeoutInstanceID, GetInstanceID());
        return;
    }
    
    BP->GetProposerBP()->AcceptTimeout();
    
    Prepare(m_bWasRejectBySomeone);
}
Exemplo n.º 3
0
main ()
{
        freopen ( "p.in" , "r" , stdin );
        freopen ( "p.out" , "w" , stdout );
        
        int     state;
        while ( init () ) {
                state = Prepare ();
                if ( state == 1 ) printf ( "White has a winning path.\n" ); else
                if ( state == 2 ) printf ( "Black has a winning path.\n" ); else
                if ( state == 3 ) printf ( "White can win in one move.\n" ); else
                if ( state == 4 ) printf ( "Black can win in one move.\n" ); else
                printf ( "There is no winning path.\n" );
        }
}
Exemplo n.º 4
0
      /* Returns a satTypeValueMap object, adding the new data generated when
       * calling a modeling object.
       *
       * @param time      Epoch.
       * @param gData     Data object holding the data.
       */
   satTypeValueMap& ModeledPR::processModel( const DayTime& time,
                                             satTypeValueMap& gData )
      throw(Exception)
   {

         // First, if the model is not prepared let's take care of it
      if( !getModelPrepared() )
      {
         Prepare(time, gData);
      }

      ModeledReferencePR::processModel(time, gData);

      return gData;

   }   // End of method 'ModeledPR::processModel()'
Exemplo n.º 5
0
bool csPortalContainer::HitBeamOutline (const csVector3& start,
  	const csVector3& end, csVector3& isect, float* pr)
{
  Prepare ();
  size_t i;
  for (i = 0; i < portals.GetSize (); i++)
  {
    csPortal *p = portals[i];
    if (p->IntersectSegment (start, end, isect, pr))
    {
      return true;
    }
  }

  return false;
}
Exemplo n.º 6
0
void RegisterIcons()
{
	// prepare masks
	int i;

	if (hHeap)
		HeapDestroy(hHeap);
	hHeap = HeapCreate(HEAP_NO_SERIALIZE, 0, 0);

	for (i = 0; i < DEFAULT_KN_FP_MASK_COUNT; i++)
		Prepare(&def_kn_fp_mask[i], true);

	for (i = 0; i < DEFAULT_KN_FP_OVERLAYS_COUNT; i++)
		Prepare(&def_kn_fp_overlays_mask[i], true);

	if (db_get_b(NULL, MODULENAME, "GroupMirandaVersion", 0)) {
		for (i = 0; i < DEFAULT_KN_FP_OVERLAYS2_COUNT; i++)
			Prepare(&def_kn_fp_overlays2_mask[i], true);
	}
	else {
		for (i = 0; i < DEFAULT_KN_FP_OVERLAYS2_NO_VER_COUNT; i++)
			Prepare(&def_kn_fp_overlays2_mask[i], true);
		for (; i < DEFAULT_KN_FP_OVERLAYS2_COUNT; i++)
			Prepare(&def_kn_fp_overlays2_mask[i], false);
	}

	if (db_get_b(NULL, MODULENAME, "GroupOverlaysUnicode", 1)) {
		for (i = 0; i < DEFAULT_KN_FP_OVERLAYS3_COUNT; i++)
			Prepare(&def_kn_fp_overlays3_mask[i], true);
	}
	else {
		for (i = 0; i < DEFAULT_KN_FP_OVERLAYS3_NO_UNICODE_COUNT; i++)
			Prepare(&def_kn_fp_overlays3_mask[i], true);
		for (; i < DEFAULT_KN_FP_OVERLAYS3_COUNT; i++)
			Prepare(&def_kn_fp_overlays3_mask[i], false);
	}

	for (i = 0; i < DEFAULT_KN_FP_OVERLAYS4_COUNT; i++)
		Prepare(&def_kn_fp_overlays4_mask[i], true);
}
Exemplo n.º 7
0
    bool dbRecord::Execute(uint32 uid)
    {
        SetID(uid);
        CS_ASSERT_MSG("Error: wrong number of expected fields", index == count);

        if(!prepared)
            Prepare();

        psStopWatch timer;
        timer.Start();

        CS_ASSERT(count != index);

        csStringArray paramStrings;
        const char *paramValues[index];
        for(unsigned int i = 0; i < index; i++)
        {
            csString value;
            switch(temp[i].type)
            {
                case SQL_TYPE_FLOAT:
                    value.Format("%f", temp[i].fValue);
                    break;
                case SQL_TYPE_INT:
                    value.Format("%i", temp[i].iValue);
                    break;
                case SQL_TYPE_STRING:
                    value = temp[i].sValue;
                    break;
                case SQL_TYPE_NULL:
                    break;
            }
            paramStrings.Push(value);
            paramValues[i] = paramStrings.Get(i);
        }

        PGresult *res = PQexecPrepared(conn, stmt.GetData(), index, paramValues, NULL, NULL,0);
        bool result = (res && PQresultStatus(res) != PGRES_FATAL_ERROR);
        if(result && timer.Stop() > 1000)
        {
            csString status;
            status.Format("SQL query in file %s line %d, has taken %u time to process.\n", file, line, timer.Stop());
            if(logcsv)
                logcsv->Write(CSV_STATUS, status);
        }
        return result;
    }
Exemplo n.º 8
0
 Statement::Statement(Connection &conn, const std::string &stmt)
   : StmtHldr(new StatementHolder(conn))
   , IsOpen(false)
 {
   if (!stmt.empty())
   {
     try
     {
       Prepare(stmt);
     }
     catch (std::exception &)
     {
       delete StmtHldr;
       throw;
     }
   }
 }
Exemplo n.º 9
0
void SerializedGameData::MakeSnapshot(GameWorld& gw, EventManager& evMgr)
{
    Prepare(false);

    // Anzahl Objekte reinschreiben
    PushUnsignedInt(GameObject::GetObjCount());

    // Objektmanager serialisieren
    gw.Serialize(*this);
    // EventManager serialisieren
    evMgr.Serialize(*this);
    // Spieler serialisieren
    for(unsigned i = 0; i < GAMECLIENT.GetPlayerCount(); ++i)
        GAMECLIENT.GetPlayer(i).Serialize(*this);

    writtenObjIds.clear();
}
Exemplo n.º 10
0
void SerializedGameData::ReadSnapshot(GameWorld& gw, EventManager& evMgr)
{
    Prepare(true);

    em = &evMgr;

    expectedObjectsReadCount = PopUnsignedInt();
    GameObject::SetObjCount(expectedObjectsReadCount);

    gw.Deserialize(*this);
    evMgr.Deserialize(*this);
    for (unsigned i = 0; i < GAMECLIENT.GetPlayerCount(); ++i)
        GAMECLIENT.GetPlayer(i).Deserialize(*this);

    em = NULL;
    readObjects.clear();
}
Exemplo n.º 11
0
void P2PSync<Dtype>::Run(const vector<int>& gpus) {
  vector<shared_ptr<P2PSync<Dtype> > > syncs(gpus.size());
  Prepare(gpus, &syncs);

  LOG(INFO)<< "Starting Optimization";

  for (int i = 1; i < syncs.size(); ++i) {
    syncs[i]->StartInternalThread();
  }

  // Run root solver on current thread
  solver_->Solve();

  for (int i = 1; i < syncs.size(); ++i) {
    syncs[i]->StopInternalThread();
  }
}
Exemplo n.º 12
0
void Manacher(char *s,int *len)
{
    int mx=0,id,i;
    Prepare(s);
    memset(len,0,sizeof(len));
    for (i=1; i<slen; i++)
    {
        if (mx>i) len[i]=Min(len[2*id-i],mx-i);
        else len[i]=1;
        while (str[i-len[i]]==str[i+len[i]]) len[i]++;
        if (i+len[i]>mx)
        {
            mx=i+len[i];
            id=i;
        }
    }
}
Exemplo n.º 13
0
	inline bool get(int target) {
		Prepare(target);
		memset(link, 0, sizeof link);
		for (int i = 1; i <= n; i++) 
			for (int j = 1; j <= m; j++) if (ok(i, j)) {
				cur++;
				Dfs(lab[i][j]);
			}
		for (int i = 1; i <= n; i++) 
			for (int j = 1; j <= m; j++) if (!ok(i,j))
				link[link[lab[i][j]]] = lab[i][j];
		int u = lab[px][py];
		if (!link[u]) return false;
		cur++;
		hash[u] = cur;
		bool ret = !Dfs(link[u], false);
		return ret;
	}
Exemplo n.º 14
0
void CRemote::PageLogin()
{
	if ( ! Settings.Remote.Username.IsEmpty() &&
		 ! Settings.Remote.Password.IsEmpty() )
	{
		CString strUsername = GetKey( L"username" );
		CString strPassword = GetKey( L"password" );

		if ( strUsername.IsEmpty() )
			strUsername = GetKey( L"name" );
		if ( strPassword.IsEmpty() )
			strPassword = GetKey( L"pass" );

		if ( strUsername == Settings.Remote.Username && ! strPassword.IsEmpty() )
		{
			CSHA pSHA1;
			pSHA1.Add( (LPCTSTR)strPassword, strPassword.GetLength() * sizeof(TCHAR) );
			pSHA1.Finish();
			Hashes::Sha1Hash tmp;
			pSHA1.GetHash( &tmp[ 0 ] );
			tmp.validate();
			strPassword = tmp.toString();

			if ( strPassword == Settings.Remote.Password )
			{
				// Success:
				__int32 nCookie = GetRandomNum( 0i32, _I32_MAX );
				m_pCookies.AddTail( nCookie );
				m_sHeader.Format( L"Set-Cookie: EnvyRemote=%i; path=/remote\r\n", nCookie );
				m_sRedirect.Format( L"/remote/home?%i", GetRandomNum( 0i32, _I32_MAX ) );
				return;
			}
		}
	}

	// Pre-fill or Failure:
	m_nTab = tabNone;
	Prepare();		// Header
	if ( ! GetKey( L"submit" ).IsEmpty() )
		Add( L"failure", L"true" );
	else if ( GetKey( L"username" ) == Settings.Remote.Username )
		Add( L"user_name", Settings.Remote.Username );
	Output( L"login" );
}
Exemplo n.º 15
0
bool CGuildMarkUploader::__LoginState_RecvKeyAgreement()
{
	TPacketKeyAgreement packet;
	if (!Recv(sizeof(packet), &packet))
	{
		return false;
	}

	Tracenf("KEY_AGREEMENT RECV %u", packet.wDataLength);

	TPacketKeyAgreement packetToSend;
	size_t dataLength = TPacketKeyAgreement::MAX_DATA_LEN;
	size_t agreedLength = Prepare(packetToSend.data, &dataLength);
	if (agreedLength == 0)
	{
		// 초기화 실패
		Disconnect();
		return false;
	}
	assert(dataLength <= TPacketKeyAgreement::MAX_DATA_LEN);

	if (Activate(packet.wAgreedLength, packet.data, packet.wDataLength))
	{
		// Key agreement 성공, 응답 전송
		packetToSend.bHeader = HEADER_CG_KEY_AGREEMENT;
		packetToSend.wAgreedLength = (WORD)agreedLength;
		packetToSend.wDataLength = (WORD)dataLength;

		if (!Send(sizeof(packetToSend), &packetToSend))
		{
			Tracen(" CAccountConnector::__AuthState_RecvKeyAgreement - SendKeyAgreement Error");
			return false;
		}
		Tracenf("KEY_AGREEMENT SEND %u", packetToSend.wDataLength);
	}
	else
	{
		// 키 협상 실패
		Disconnect();
		return false;
	}
	return true;
}
void OpenSMOKE_PostProcessor_RateOfProductionAnalysis::ReadFromBinaryFile(BzzLoad &fLoad)
{
	char dummy[Constants::NAME_SIZE];
	fLoad.fileLoad.read((char*) dummy, sizeof(dummy));
	std::string version = dummy;
	if (version != "V20100417")
		ErrorMessage("This version post processing file is not supported: " + version);
	cout << "Version: " << version << endl;

	// Indices of species
	CheckInBinaryFile(fLoad, "INDICES");
	fLoad >> indices;	

	// Reaction rates
	CheckInBinaryFile(fLoad, "REACTIONRATES");
	fLoad >> reactionRates;

	// Preparing data
	ropa = new OpenSMOKE_RateOfProductionAnalysis();
	BzzVector aux_x = post_processor->get_x();
	ropa->Initialize(post_processor->mix, indices);
	ropa->SetNumberOfPoints(aux_x.Size());
	ropa->Run(reactionRates, aux_x);

	// Formation rates
	{
		ChangeDimensions(post_processor->get_x().Size(), NC, &formationRates);
		BzzVector RVector(NC);
		BzzVector C(NC);
		for(int j=1;j<=post_processor->get_x().Size();j++)
		{
			double T    = post_processor->get_T(j);
			double P_Pa = post_processor->get_P_Pa(j);
			double Ctot = post_processor->get_Ctot(j);
			C = post_processor->get_C(j);
			post_processor->mix->ComputeKineticParameters( T, log(T), 1./T, P_Pa);
			post_processor->mix->ComputeFromConcentrations( T, C, Ctot, &RVector);	// [kmol/m3/s]
			formationRates.SetRow(j, RVector);										// [kmol/m3/s]
		}
	}
	Prepare();
}
Exemplo n.º 17
0
void Web::Setup(std::string skin) {
	if (skin.empty()) skin = default_skin;
	Models::Generic::Setup c;
	Prepare(c,"[Setup]");
	std::string lock = GetFromConfig<std::string>("setup.lockfile");
	if (Generic::FileSystem::Check(lock).ExistFile()) {
		render(skin,"Setup",c);
		return;
	}
	if(request().request_method()=="POST") {
		c.load(context());
		c.clear();
		Generic::FileSystem::Create(lock).CreateFile();
		std::string schema = GetFromConfig<std::string>("setup.db-schema");
		
		Static::DB::Interact.LoadSchema(schema);
		response().set_redirect_header("/");
	}
	render(skin,"Setup",c);
}
Exemplo n.º 18
0
HRESULT CChainComparer::Execute()
{
	// if either of the chains is null, nothing to do - everything inserted/deleted - return now
	if (m_pAnchor1 == NULL || m_pAnchor2 == NULL)
		return S_OK;

	CCompareChainsDepthGauge gauge(m_pHost->GetContext());
	m_pHost->SendOccaisionalProgressMessage();
	Prepare();
	DUMP_CHAIN(DBG_START_OF_BINDING, "At start of binding");

	if (m_pHost->DoBothFilesHaveRSIDInfo())
		SequenceIDSensitivePass();

	CompareTheChains();

	DUMP_CHAIN(DBG_END_OF_COMPARE, "At the end of compare chains");
	ProgressMessageWithCancelCheck();
	return S_OK;
}
Exemplo n.º 19
0
void SerializedGameData::ReadSnapshot(GameWorld& gw)
{
    Prepare(true);

    em = &gw.GetEvMgr();

    expectedObjectsCount = PopUnsignedInt();
    GameObject::SetObjCount(0);

    gw.Deserialize(*this);
    em->Deserialize(*this);
    for (unsigned i = 0; i < gw.GetPlayerCount(); ++i)
        gw.GetPlayer(i).Deserialize(*this);

    // If this check fails, we did not serialize all objects or there was an async
    RTTR_Assert(expectedObjectsCount == GameObject::GetObjCount());
    RTTR_Assert(expectedObjectsCount == objectsCount + 1); // "Nothing" nodeObj does not get serialized
    em = NULL;
    readObjects.clear();
}
int main(int argc, const char * argv[]) {

	if (argc != 3) {
		fprintf(stderr, "use: %s input_file filter_char\n", argv[0]);
		exit(1);
	}

	UtInit();

	Prepare();

	UtCreate(ReaderThread, (UT_ARGUMENT)argv[1]);
	UtCreate(FilterThread, (UT_ARGUMENT)argv[2][0]);
	UtCreate(PrinterThread, (UT_ARGUMENT)0);
	
	UtRun();
	
	UtEnd();
	return 0;
}
void GoodThumbSource::generate(base::binary_guard &&guard) {
	if (!guard) {
		return;
	}
	const auto data = _document->data();
	const auto isWallPaper = _document->isWallPaper();
	auto location = _document->location().isEmpty()
		? nullptr
		: std::make_unique<FileLocation>(_document->location());
	if (data.isEmpty() && !location) {
		_empty = true;
		return;
	}
	crl::async([
		=,
		guard = std::move(guard),
		location = std::move(location)
	]() mutable {
		const auto filepath = (location && location->accessEnable())
			? location->name()
			: QString();
		auto result = Prepare(filepath, data, isWallPaper);
		auto bytes = QByteArray();
		if (!result.isNull()) {
			auto buffer = QBuffer(&bytes);
			const auto format = (isWallPaper && result.hasAlphaChannel())
				? "PNG"
				: "JPG";
			result.save(&buffer, format, kGoodThumbQuality);
		}
		if (!filepath.isEmpty()) {
			location->accessDisable();
		}
		const auto bytesSize = bytes.size();
		ready(
			std::move(guard),
			std::move(result),
			bytesSize,
			std::move(bytes));
	});
}
Exemplo n.º 22
0
JBoolean
SVNTabBase::Execute
	(
	const JCharacter*	origCmd,
	const JCharacter*	warnMsgID,
	const JBoolean		includeDeleted,
	const JBoolean		blocking
	)
{
	JString cmd = origCmd;
	if (!Prepare(&cmd, warnMsgID, includeDeleted))
		{
		return kJFalse;
		}

	if (blocking)
		{
		(JXGetApplication())->DisplayBusyCursor();

		JSimpleProcess* p;
		if (itsDirector->HasPath())
			{
			JSimpleProcess::Create(&p, itsDirector->GetPath(), cmd, kJTrue);
			}
		else
			{
			JSimpleProcess::Create(&p, cmd, kJTrue);
			}
		p->WaitUntilFinished();
		}
	else if (itsDirector->HasPath())
		{
		JSimpleProcess::Create(itsDirector->GetPath(), cmd, kJTrue);
		}
	else
		{
		JSimpleProcess::Create(cmd, kJTrue);
		}

	return kJTrue;
}
Exemplo n.º 23
0
bool nxInputManager::Start(WNDPROC lpfnMessageProc,bool bRawInput,bool bDInput,bool bXInput,DWORD dwMilliseconds)
{
    nxScopedRecursiveLock objGuard(csThreadManagement);
    // If it's already running, or no input interfaces are chosen (meaning, there will be no messages/devices to handle).. return false
    if (isRunning || (!bRawInput && !bDInput && !bXInput))
        return false;
    isRunning=true;
    vcThreads.push_back(nxCreateThread(MessageThread,(LPVOID)lpfnMessageProc));
    // Wait for the input manager to be created
    while (!hManager)
        Sleep(1);
    // Enumerate and obtain information for all devices
    Prepare(bRawInput,bDInput,bXInput);
    if (bRawInput)
        vcThreads.push_back(nxCreateThread(RawInputThread,(LPVOID)false));
    if (bDInput)
        vcThreads.push_back(nxCreateThread(DInputThread,(LPVOID)dwMilliseconds));
    if (bXInput)
        vcThreads.push_back(nxCreateThread(XInputThread,(LPVOID)dwMilliseconds));
    return true;
}
Exemplo n.º 24
0
bool
HwcComposer2D::Render(EGLDisplay dpy, EGLSurface sur)
{
    if (!mList) {
        // After boot, HWC list hasn't been created yet
        return GetGonkDisplay()->SwapBuffers(dpy, sur);
    }

    GetGonkDisplay()->UpdateFBSurface(dpy, sur);

    FramebufferSurface* fbsurface = (FramebufferSurface*)(GetGonkDisplay()->GetFBSurface());
    if (!fbsurface) {
        LOGE("H/W Composition failed. FBSurface not initialized.");
        return false;
    }

    if (mPrepared) {
        // No mHwc prepare, if already prepared in current draw cycle
        mList->hwLayers[mList->numHwLayers - 1].handle = fbsurface->lastHandle;
        mList->hwLayers[mList->numHwLayers - 1].acquireFenceFd = fbsurface->GetPrevFBAcquireFd();
    } else {
        mList->flags = HWC_GEOMETRY_CHANGED;
        mList->numHwLayers = 2;
        mList->hwLayers[0].hints = 0;
        mList->hwLayers[0].compositionType = HWC_FRAMEBUFFER;
        mList->hwLayers[0].flags = HWC_SKIP_LAYER;
        mList->hwLayers[0].backgroundColor = {0};
        mList->hwLayers[0].acquireFenceFd = -1;
        mList->hwLayers[0].releaseFenceFd = -1;
        mList->hwLayers[0].displayFrame = {0, 0, mScreenRect.width, mScreenRect.height};
        Prepare(fbsurface->lastHandle, fbsurface->GetPrevFBAcquireFd());
    }

    // GPU or partial HWC Composition
    Commit();

    GetGonkDisplay()->SetFBReleaseFd(mList->hwLayers[mList->numHwLayers - 1].releaseFenceFd);
    mList->hwLayers[mList->numHwLayers - 1].releaseFenceFd = -1;
    return true;
}
Exemplo n.º 25
0
bool
HwcComposer2D::Render(nsIWidget* aWidget)
{
    nsScreenGonk* screen = static_cast<nsWindow*>(aWidget)->GetScreen();

    // HWC module does not exist or mList is not created yet.
    if (!mHal->HasHwc() || !mList) {
        return GetGonkDisplay()->SwapBuffers(screen->GetDpy(), screen->GetSur());
    } else if (!mList && !ReallocLayerList()) {
        LOGE("Cannot realloc layer list");
        return false;
    }

    DisplaySurface* dispSurface = screen->GetDisplaySurface();
    if (!dispSurface) {
        LOGE("H/W Composition failed. DispSurface not initialized.");
        return false;
    }

    if (mPrepared) {
        // No mHwc prepare, if already prepared in current draw cycle
        mList->hwLayers[mList->numHwLayers - 1].handle = dispSurface->lastHandle;
        mList->hwLayers[mList->numHwLayers - 1].acquireFenceFd = dispSurface->GetPrevDispAcquireFd();
    } else {
        mList->flags = HWC_GEOMETRY_CHANGED;
        mList->numHwLayers = 2;
        mList->hwLayers[0].hints = 0;
        mList->hwLayers[0].compositionType = HWC_FRAMEBUFFER;
        mList->hwLayers[0].flags = HWC_SKIP_LAYER;
        mList->hwLayers[0].backgroundColor = {0};
        mList->hwLayers[0].acquireFenceFd = -1;
        mList->hwLayers[0].releaseFenceFd = -1;
        mList->hwLayers[0].displayFrame = {0, 0, mScreenRect.width, mScreenRect.height};
        Prepare(dispSurface->lastHandle, dispSurface->GetPrevDispAcquireFd(), screen);
    }

    // GPU or partial HWC Composition
    return Commit(screen);
}
Exemplo n.º 26
0
void SerializedGameData::MakeSnapshot(GameWorld& gw)
{
    Prepare(false);

    // Anzahl Objekte reinschreiben
    expectedObjectsCount = GameObject::GetObjCount();
    PushUnsignedInt(expectedObjectsCount);

    // Objektmanager serialisieren
    gw.Serialize(*this);
    // EventManager serialisieren
    gw.GetEvMgr().Serialize(*this);
    // Spieler serialisieren
    for(unsigned i = 0; i < gw.GetPlayerCount(); ++i)
        gw.GetPlayer(i).Serialize(*this);

    // If this check fails, we missed some objects or some objects were destroyed without decreasing the obj count
    RTTR_Assert(writtenObjIds.size() == objectsCount);
    RTTR_Assert(expectedObjectsCount == objectsCount + 1); // "Nothing" nodeObj does not get serialized

    writtenObjIds.clear();
}
Exemplo n.º 27
0
void CLineNumberEdit::SetLineNumberFormat( CString format )
/* ============================================================
	Function :		CLineNumberEdit::SetLineNumberFormat
	Description :	Changes the way line numbers are presented 
					on screen. 
 
	Return :		void
	Parameters :	CString format - The new format string

	Usage :			Call with a format string using the same 
					format as CString::Format. It should contain 
					one and only one numeric type.

   ============================================================*/
{

	m_format = format;
	m_line.SetLineNumberFormat( format );
	if( m_hWnd )
		Prepare();

}
Exemplo n.º 28
0
LRESULT CLineNumberEdit::OnSetFont( WPARAM wParam, LPARAM lParam )
/* ============================================================
	Function :		CLineNumberEdit::OnSetFont
	Description :	Mapped to WM_SETFONT. We must recalculate 
					the line number control size as well.
 
	Return :		LRESULT			- Always 0
	Parameters :	WPARAM wParam	- From Windows
					LPARAM lParam	- From Windows

	Usage :			Called from Windows

   ============================================================*/
{

	DefWindowProc( WM_SETFONT, wParam, lParam );
	// We resize the line-number
	// field
	Prepare();
	return 0;

}
Exemplo n.º 29
0
void TextBlock::SetFont(Font * _font)
{
    mutex.Lock();
    
	if (!_font || _font == font)
	{
        mutex.Unlock();
		return;
	}

	SafeRelease(font);
	font = SafeRetain(_font);

	originalFontSize = font->GetSize();
	
	SafeRelease(textBlockRender);
    SafeDelete(textureInvalidater);
	switch (font->GetFontType()) {
		case Font::TYPE_FT:
			textBlockRender = new TextBlockSoftwareRender(this);
            textureInvalidater = new TextBlockSoftwareTexInvalidater(this);
			break;
		case Font::TYPE_GRAPHICAL:
			textBlockRender = new TextBlockGraphicsRender(this);
			break;
		case Font::TYPE_DISTANCE:
			textBlockRender = new TextBlockDistanceRender(this);
			break;
			
		default:
			DVASSERT(!"Unknown font type");
			break;
	}
	
	needRedraw = true;

    mutex.Unlock();
	Prepare();
}
void CParaNdisTX::Send(PNET_BUFFER_LIST NBL)
{
    PNET_BUFFER_LIST nextNBL = nullptr;
    NDIS_STATUS RejectionStatus = NDIS_STATUS_FAILURE;

    if (!m_StateMachine.RegisterOutstandingItems(ParaNdis_CountNBLs(NBL), &RejectionStatus))
    {
        ParaNdis_CompleteNBLChainWithStatus(m_Context->MiniportHandle, NBL, RejectionStatus);
        return;
    }

    for(auto currNBL = NBL; currNBL != nullptr; currNBL = nextNBL)
    {
        nextNBL = NET_BUFFER_LIST_NEXT_NBL(currNBL);
        NET_BUFFER_LIST_NEXT_NBL(currNBL) = nullptr;

        auto NBLHolder = new (m_Context->MiniportHandle) CNBL(currNBL, m_Context, *this);

        if (NBLHolder == nullptr)
        {
            currNBL->Status = NDIS_STATUS_RESOURCES;
            CompleteOutstandingNBLChain(currNBL);
            DPrintf(0, ("ERROR: Failed to allocate CNBL instance\n"));
            continue;
        }

        if(NBLHolder->Prepare() &&
           ParaNdis_IsSendPossible(m_Context))
        {
            NBLHolder->StartMapping();
        }
        else
        {
            NBLHolder->SetStatus(ParaNdis_ExactSendFailureStatus(m_Context));
            NBLHolder->Release();
        }
    }
}