• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ AddRef函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中AddRef函数的典型用法代码示例。如果您正苦于以下问题:C++ AddRef函数的具体用法?C++ AddRef怎么用?C++ AddRef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了AddRef函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: promise

already_AddRefed<DetailedPromise>
MediaKeys::Init(ErrorResult& aRv)
{
  RefPtr<DetailedPromise> promise(MakePromise(aRv,
    NS_LITERAL_CSTRING("MediaKeys::Init()")));
  if (aRv.Failed()) {
    return nullptr;
  }

  mProxy = new CDMProxy(this, mKeySystem);

  // Determine principal (at creation time) of the MediaKeys object.
  nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(GetParentObject());
  if (!sop) {
    promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR,
                         NS_LITERAL_CSTRING("Couldn't get script principal in MediaKeys::Init"));
    return promise.forget();
  }
  mPrincipal = sop->GetPrincipal();

  // Determine principal of the "top-level" window; the principal of the
  // page that will display in the URL bar.
  nsCOMPtr<nsPIDOMWindowInner> window = GetParentObject();
  if (!window) {
    promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR,
                         NS_LITERAL_CSTRING("Couldn't get top-level window in MediaKeys::Init"));
    return promise.forget();
  }
  nsCOMPtr<nsPIDOMWindowOuter> top = window->GetOuterWindow()->GetTop();
  if (!top || !top->GetExtantDoc()) {
    promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR,
                         NS_LITERAL_CSTRING("Couldn't get document in MediaKeys::Init"));
    return promise.forget();
  }

  mTopLevelPrincipal = top->GetExtantDoc()->NodePrincipal();

  if (!mPrincipal || !mTopLevelPrincipal) {
    NS_WARNING("Failed to get principals when creating MediaKeys");
    promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR,
                         NS_LITERAL_CSTRING("Couldn't get principal(s) in MediaKeys::Init"));
    return promise.forget();
  }

  nsAutoString origin;
  nsresult rv = nsContentUtils::GetUTFOrigin(mPrincipal, origin);
  if (NS_FAILED(rv)) {
    promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR,
                         NS_LITERAL_CSTRING("Couldn't get principal origin string in MediaKeys::Init"));
    return promise.forget();
  }
  nsAutoString topLevelOrigin;
  rv = nsContentUtils::GetUTFOrigin(mTopLevelPrincipal, topLevelOrigin);
  if (NS_FAILED(rv)) {
    promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR,
                         NS_LITERAL_CSTRING("Couldn't get top-level principal origin string in MediaKeys::Init"));
    return promise.forget();
  }

  nsIDocument* doc = window->GetExtantDoc();
  const bool inPrivateBrowsing = nsContentUtils::IsInPrivateBrowsing(doc);

  EME_LOG("MediaKeys[%p]::Create() (%s, %s), %s",
          this,
          NS_ConvertUTF16toUTF8(origin).get(),
          NS_ConvertUTF16toUTF8(topLevelOrigin).get(),
          (inPrivateBrowsing ? "PrivateBrowsing" : "NonPrivateBrowsing"));

  // The CDMProxy's initialization is asynchronous. The MediaKeys is
  // refcounted, and its instance is returned to JS by promise once
  // it's been initialized. No external refs exist to the MediaKeys while
  // we're waiting for the promise to be resolved, so we must hold a
  // reference to the new MediaKeys object until it's been created,
  // or its creation has failed. Store the id of the promise returned
  // here, and hold a self-reference until that promise is resolved or
  // rejected.
  MOZ_ASSERT(!mCreatePromiseId, "Should only be created once!");
  mCreatePromiseId = StorePromise(promise);
  AddRef();
  mProxy->Init(mCreatePromiseId,
               origin,
               topLevelOrigin,
               KeySystemToGMPName(mKeySystem),
               inPrivateBrowsing,
               new MediaKeysGMPCrashHelper(this));

  return promise.forget();
}
开发者ID:carriercomm,项目名称:gecko-dev,代码行数:88,代码来源:MediaKeys.cpp


示例2: m_tvBankedPlayTime

BasicPacketFlow::BasicPacketFlow(Process* p,
                                 IHXSessionStats* pSessionStats,
                                 UINT16 unStreamCount,
                                 PacketFlowManager* pFlowMgr,
                                 BOOL bIsMulticast)
    : m_tvBankedPlayTime(0,0)
{
    m_pProc 		 	= p;
    m_pFlowMgr 		 	= pFlowMgr;
    m_unStreamCount 	 	= unStreamCount;
    m_uNumStreamsRegistered	= 0;
    m_ulRefCount 	 	= 0;
    m_bPaused		 	= FALSE;
    m_bInSeek		 	= FALSE;
    m_bInitialSubscriptionDone	= FALSE;
    m_bInitialPlayReceived	= FALSE;
    m_bGetPacketsOutstanding	= FALSE;
    m_tTimeLineStart.tv_sec	= 0;
    m_tTimeLineStart.tv_usec	= 0;
    m_bTimeLineSuspended	= TRUE;
    m_bIsMulticast		= bIsMulticast;
    m_ulPacketsOutstanding	= 0;
    m_fDeliveryRatio		= 1.0;
    m_bSourceIsDone		= FALSE;
    m_ulNumStreamDones		= 0;
    m_uEndPoint			= 0;
    m_bIsPausePointSet          = FALSE; 
    m_bIsDone			= FALSE;
    m_ulResendIDPosition	= 0;
    m_bSubscribed		= FALSE;
    m_bAutoSubscription		= TRUE;
    m_ulWouldBlocking		= 0;
    m_bWouldBlockAvailable      = FALSE;
    m_pConvertShim              = 0;
    m_pConvertingPacket		= NULL;
    m_bPlayPendingOnSeek	= FALSE;
    m_pPlayerControl            = NULL;
    m_pPlayerSessionId          = NULL;
    m_pRateManager              = NULL;
    m_bSeekPacketPending  = FALSE;
    m_bSessionPlaying     = FALSE;
    m_bDeliveryBandwidthSet = FALSE;
    m_pStats                    = pSessionStats;
    m_pStats->AddRef();
    m_bRTPInfoRequired          = TRUE;
    m_uFirstStreamRegistered	= 0xFFFF;

    m_ulSetDeliveryBandwidth = 0;
    m_ulBandwidth = 0;

    memset(m_pResendIDs, 0, sizeof(UINT32) * MAX_RESENDS_PER_SECOND);

    // Contorted initialization due to NT not able to intialize array
    // elements on creation even though it is standard C++
    m_pStreams = new PacketStream[unStreamCount];

    // then the intialization
    for (UINT16 iStream = 0; iStream < unStreamCount; iStream++)
	m_pStreams[iStream].SetFlow(this);

    // get clock for PlayTime tracking

    if (HXR_OK != m_pProc->pc->server_context->
        QueryInterface(IID_IHXAccurateClock, (void**) &m_pAccurateClock))
    {
        // system doesn't have accurate clock, use our own.
        AddRef();
        m_pAccurateClock = (IHXAccurateClock*) this;
    }

    // for safety, initialize this to current time, although we really
    // set it in Play().
    
    HXTimeval hxt = m_pAccurateClock->GetTimeOfDay();
    m_tvRTSPPlayTime.tv_sec = hxt.tv_sec;
    m_tvRTSPPlayTime.tv_usec = hxt.tv_usec;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:77,代码来源:basicpcktflow.cpp


示例3: AddRef

 AwtTextComponent::OleCallback::OleCallback() {
     m_refs = 0;
     AddRef();
 }
开发者ID:sakeinntojiu,项目名称:openjdk8-jdk,代码行数:4,代码来源:awt_TextComponent.cpp


示例4: CCountedPtr

	/** default (NULL) construct or construct from a raw pointer */
	FORCEINLINE CCountedPtr(Tcls *pObj = NULL) : m_pT(pObj) {AddRef();}
开发者ID:a7omic,项目名称:OpenTTD,代码行数:2,代码来源:countedptr.hpp


示例5: AddRef

void    CchaffIGC::Terminate(void)
{
    AddRef();
	TmodelIGC<IchaffIGC>::Terminate();
    Release();
}
开发者ID:Factoid,项目名称:alleg-core,代码行数:6,代码来源:chaffIGC.cpp


示例6: AddRef

		void RocketDocument3D::AddReference()
		{
			AddRef();
		}
开发者ID:1vanK,项目名称:libRocket-Urho3D,代码行数:4,代码来源:RocketDocument3D.cpp


示例7: RefCount

GDIFontRasterizer::GDIFontRasterizer()
: RefCount(0), FontDC(NULL), NonBoldFontDC(NULL), LastBitmap(NULL), ChAntialiasMethodInit(false)
, ChUseResampling(false), ChAntialiasMethod(camResample8)
{
	AddRef();
}
开发者ID:harada3,项目名称:krkrz,代码行数:6,代码来源:GDIFontRasterizer.cpp


示例8: AddRef

/////////////////////////////////////////////////////////////////////////
//  Method:
//	IUnknown::QueryInterface
//  Purpose:
//	Implement this to export the interfaces supported by your 
//	object.
//
STDMETHODIMP FileObjectWrapper::QueryInterface(REFIID riid, void** ppvObj)
{
    if (IsEqualIID(riid, IID_IUnknown))
    {
	AddRef();
	*ppvObj = (IUnknown*)(IHXFileObject *)this;
	return HXR_OK;
    }
    else if (IsEqualIID(riid, IID_IHXFileObject))
    {
	if(m_has_file_object)
	{
	    AddRef();
	    *ppvObj = (IHXFileObject*)this;
	    return HXR_OK;
	}
    }
    else if (IsEqualIID(riid, IID_IHXFileStat))
    {
	if(m_has_file_stat)
	{
	    AddRef();
	    *ppvObj = (IHXFileStat*)this;
	    return HXR_OK;
	}
    }
    else if(IsEqualIID(riid, IID_IHXFileExists))
    {
	if(m_has_file_exists)
	{
	    AddRef();
	    *ppvObj = (IHXFileExists*)this;
	    return HXR_OK;
	}
    }
    else if(IsEqualIID(riid, IID_IHXFileMimeMapper))
    {
	if(m_has_file_mime_mapper)
	{
	    AddRef();
	    *ppvObj = (IHXFileMimeMapper*)this;
	    return HXR_OK;
	}
    }
    else if(IsEqualIID(riid, IID_IHXBroadcastMapper))
    {
	if(m_has_broadcast_mapper)
	{
	    AddRef();
	    *ppvObj = (IHXBroadcastMapper*)this;
	    return HXR_OK;
	}
    }
    else if(IsEqualIID(riid, IID_IHXGetFileFromSamePool))
    {
	if(m_has_pool_object)
	{
	    AddRef();
	    *ppvObj = (IHXGetFileFromSamePool*)this;
	    return HXR_OK;
	}
    }
    else if(IsEqualIID(riid, IID_IHXRequestHandler))
    {
	if(m_has_request_handler)
	{
	    AddRef();
	    *ppvObj = (IHXRequestHandler*)this;
	    return HXR_OK;
	}
    }
    else if(IsEqualIID(riid, IID_IHXPostDataHandler))
    {
	if(m_has_post_data_handler)
	{
	    AddRef();
	    *ppvObj = (IHXPostDataHandler*)this;
	    return HXR_OK;
	}
    }

    *ppvObj = NULL;
    return HXR_NOINTERFACE;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:91,代码来源:flob_wrap.cpp


示例9: AddRef

HX_RESULT
StaticPushSource::Init(IHXPSinkControl* pSink)
{
    HX_RESULT			h_result = HXR_OK;
    IHXFileObject*             pFileObject;
    IHXBandwidthNegotiator*    pBandwidthNegotiator;

    pSink->AddRef();
    m_pSinkControl = pSink;

    AddRef();
    if (HXR_OK == h_result)
    {
	if(HXR_OK == m_pFileObject->QueryInterface(IID_IHXFileObject,
						 (void**)&pFileObject))
	{
	  
	    if(m_pBWEValues && 
	       (HXR_OK == m_pFileFormat->QueryInterface(
		IID_IHXBandwidthNegotiator,
		(void**)&pBandwidthNegotiator)))
	    {
		pBandwidthNegotiator->SetBandwidthInfo(m_pBWEValues);
		pBandwidthNegotiator->Release();
		m_pBWEValues->Release();
		m_pBWEValues = NULL;
	    }

	    h_result = m_pFileFormat->InitFileFormat(m_pRequest, this,
						     pFileObject);
	    /*
	     * The IHXFileObject belongs to the IHXFileFormatObject...
	     */
	    
	    HX_RELEASE(m_pFileObject);

	    HX_RELEASE(pFileObject);

	    /*
	     * so does the IHXRequest
	     */

	    HX_RELEASE(m_pRequest);

	    if (HXR_OK != h_result)
	    {

		ERRMSG(m_proc->pc->error_handler,
		       "File Format initialization failed\n");
		m_pFileFormat->Close();
		m_pFileFormat->Release();
		m_pFileFormat = 0;
	    }
	}

    }

    Release();

    return h_result;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:61,代码来源:inputsrc_push.cpp


示例10: NiAdminThread

// Management thread
void NiAdminThread(THREAD *thread, void *param)
{
	NAT_ADMIN *a = (NAT_ADMIN *)param;
	NAT *n;
	SOCK *s;
	UCHAR random[SHA1_SIZE];
	UINT err;
	// Validate arguments
	if (thread == NULL || param == NULL)
	{
		return;
	}

	// Random number generation
	Rand(random, sizeof(random));

	a->Thread = thread;
	AddRef(a->Thread->ref);
	s = a->Sock;
	AddRef(s->ref);

	n = a->Nat;

	LockList(n->AdminList);
	{
		Add(n->AdminList, a);
	}
	UnlockList(n->AdminList);

	NoticeThreadInit(thread);

	err = ERR_AUTH_FAILED;

	if (StartSSL(s, n->AdminX, n->AdminK))
	{
		PACK *p;

		// Send the random number
		p = NewPack();
		PackAddData(p, "auth_random", random, sizeof(random));

		if (HttpServerSend(s, p))
		{
			PACK *p;
			// Receive a password
			p = HttpServerRecv(s);
			if (p != NULL)
			{
				UCHAR secure_password[SHA1_SIZE];
				UCHAR secure_check[SHA1_SIZE];

				if (PackGetData2(p, "secure_password", secure_password, sizeof(secure_password)))
				{
					SecurePassword(secure_check, n->HashedPassword, random);

					if (Cmp(secure_check, secure_password, SHA1_SIZE) == 0)
					{
						UCHAR test[SHA1_SIZE];
						// Password match
						Hash(test, "", 0, true);
						SecurePassword(test, test, random);

#if	0
						if (Cmp(test, secure_check, SHA1_SIZE) == 0 && s->RemoteIP.addr[0] != 127)
						{
							// A client can not connect from the outside with blank password
							err = ERR_NULL_PASSWORD_LOCAL_ONLY;
						}
						else
#endif

						{
							// Successful connection
							err = ERR_NO_ERROR;
							NiAdminMain(n, s);
						}
					}
				}

				FreePack(p);
			}
		}

		FreePack(p);

		if (err != ERR_NO_ERROR)
		{
			p = PackError(err);
			HttpServerSend(s, p);
			FreePack(p);
		}
	}

	Disconnect(s);
	ReleaseSock(s);
}
开发者ID:benapetr,项目名称:SoftEtherVPN,代码行数:97,代码来源:Nat.c


示例11: NiListenThread

// Management port Listen thread
void NiListenThread(THREAD *thread, void *param)
{
	NAT *n = (NAT *)param;
	SOCK *a;
	UINT i;
	bool b = false;
	// Validate arguments
	if (thread == NULL || param == NULL)
	{
		return;
	}

	// Initialize the management list
	n->AdminList = NewList(NULL);

	while (true)
	{
		a = Listen(DEFAULT_NAT_ADMIN_PORT);
		if (b == false)
		{
			b = true;
			NoticeThreadInit(thread);
		}
		if (a != NULL)
		{
			break;
		}

		Wait(n->HaltEvent, NAT_ADMIN_PORT_LISTEN_INTERVAL);
		if (n->Halt)
		{
			return;
		}
	}

	n->AdminListenSock = a;
	AddRef(a->ref);

	// Waiting
	while (true)
	{
		SOCK *s = Accept(a);
		THREAD *t;
		NAT_ADMIN *admin;
		if (s == NULL)
		{
			break;
		}
		if (n->Halt)
		{
			ReleaseSock(s);
			break;
		}

		admin = ZeroMalloc(sizeof(NAT_ADMIN));
		admin->Nat = n;
		admin->Sock = s;
		t = NewThread(NiAdminThread, admin);
		WaitThreadInit(t);
		ReleaseThread(t);
	}

	// Disconnect all management connections
	LockList(n->AdminList);
	{
		for (i = 0;i < LIST_NUM(n->AdminList);i++)
		{
			NAT_ADMIN *a = LIST_DATA(n->AdminList, i);
			Disconnect(a->Sock);
			WaitThread(a->Thread, INFINITE);
			ReleaseThread(a->Thread);
			ReleaseSock(a->Sock);
			Free(a);
		}
	}
	UnlockList(n->AdminList);

	ReleaseList(n->AdminList);

	ReleaseSock(a);
}
开发者ID:benapetr,项目名称:SoftEtherVPN,代码行数:82,代码来源:Nat.c


示例12: AddRef

	STDMETHODIMP DragDropTarget::QueryInterface(REFIID riid, void **ppv)
	{
		*ppv = this;
		AddRef();
		return NOERROR;
	}
开发者ID:lufinkey,项目名称:BoilermakeWormhole,代码行数:6,代码来源:DragDropTarget.cpp


示例13: NS_ENSURE_ARG

NS_IMETHODIMP 
morkStdioFile::AcquireBud(nsIMdbEnv * mdbev, nsIMdbHeap* ioHeap, nsIMdbFile **acquiredFile)
  // AcquireBud() starts a new "branch" version of the file, empty of content,
  // so that a new version of the file can be written.  This new file
  // can later be told to BecomeTrunk() the original file, so the branch
  // created by budding the file will replace the original file.  Some
  // file subclasses might initially take the unsafe but expedient
  // approach of simply truncating this file down to zero length, and
  // then returning the same morkFile pointer as this, with an extra
  // reference count increment.  Note that the caller of AcquireBud() is
  // expected to eventually call CutStrongRef() on the returned file
  // in order to release the strong reference.  High quality versions
  // of morkFile subclasses will create entirely new files which later
  // are renamed to become the old file, so that better transactional
  // behavior is exhibited by the file, so crashes protect old files.
  // Note that AcquireBud() is an illegal operation on readonly files.
{
  NS_ENSURE_ARG(acquiredFile);
  MORK_USED_1(ioHeap);
  nsresult rv = NS_OK;
  morkFile* outFile = 0;
  morkEnv *ev = morkEnv::FromMdbEnv(mdbev);

  if ( this->IsOpenAndActiveFile() )
  {
    FILE* file = (FILE*) mStdioFile_File;
    if ( file )
    {
//#ifdef MORK_WIN
//      truncate(file, /*eof*/ 0);
//#else /*MORK_WIN*/
      char* name = mFile_Name;
      if ( name )
      {
        if ( MORK_FILECLOSE(file) >= 0 )
        {
          this->SetFileActive(morkBool_kFalse);
          this->SetFileIoOpen(morkBool_kFalse);
          mStdioFile_File = 0;
          
          file = MORK_FILEOPEN(name, "wb+"); // open for write, discarding old content
          if ( file )
          {
            mStdioFile_File = file;
            this->SetFileActive(morkBool_kTrue);
            this->SetFileIoOpen(morkBool_kTrue);
            this->SetFileFrozen(morkBool_kFalse);
          }
          else
            this->new_stdio_file_fault(ev);
        }
        else
          this->new_stdio_file_fault(ev);
      }
      else
        this->NilFileNameError(ev);
      
//#endif /*MORK_WIN*/

      if ( ev->Good() && this->AddStrongRef(ev->AsMdbEnv()) )
      {
        outFile = this;
        AddRef();
      }
    }
    else if ( mFile_Thief )
    {
      rv = mFile_Thief->AcquireBud(ev->AsMdbEnv(), ioHeap, acquiredFile);
    }
    else
      this->NewMissingIoError(ev);
  }
  else this->NewFileDownError(ev);
  
  *acquiredFile = outFile;
  return rv;
}
开发者ID:alanyjw,项目名称:comm-central,代码行数:77,代码来源:morkFile.cpp


示例14: ElListenerProc

// Listener thread
void ElListenerProc(THREAD *thread, void *param)
{
	TCP_ACCEPTED_PARAM *data = (TCP_ACCEPTED_PARAM *)param;
	EL *e;
	SOCK *s;
	UCHAR rand[SHA1_SIZE];
	UCHAR pass1[SHA1_SIZE], pass2[SHA1_SIZE];
	// Validate arguments
	if (data == NULL || thread == NULL)
	{
		return;
	}

	e = (EL *)data->r->ThreadParam;
	s = data->s;
	AddRef(s->ref);
	SetTimeout(s, 5000);
	LockList(e->AdminThreadList);
	{
		AddRef(thread->ref);
		AddRef(s->ref);
		Insert(e->AdminThreadList, thread);
		Insert(e->AdminSockList, s);
	}
	UnlockList(e->AdminThreadList);
	NoticeThreadInit(thread);

	// Submit a challenge
	Rand(rand, sizeof(rand));
	SendAll(s, rand, sizeof(rand), false);

	// Receive a response
	SecurePassword(pass1, e->HashedPassword, rand);
	Zero(pass2, sizeof(pass2));
	RecvAll(s, pass2, sizeof(pass2), false);

	if (Cmp(pass1, pass2, SHA1_SIZE) != 0)
	{
		// Password incorrect
		bool code = false;
		code = Endian32(code);
		SendAll(s, &code, sizeof(code), false);
	}
	else
	{
		// Password match
		bool code = true;
		RPC *r;

		code = Endian32(code);
		SendAll(s, &code, sizeof(code), false);

		SetTimeout(s, INFINITE);

		// Start operation as a RPC server
		r = StartRpcServer(s, ElRpcServer, e);
		RpcServer(r);
		RpcFree(r);
	}

	Disconnect(s);
	ReleaseSock(s);

	LockList(e->AdminThreadList);
	{
		if (Delete(e->AdminThreadList, thread))
		{
			ReleaseThread(thread);
		}
		if (Delete(e->AdminSockList, s))
		{
			ReleaseSock(s);
		}
	}
	UnlockList(e->AdminThreadList);
}
开发者ID:455475876github,项目名称:SoftEtherVPN,代码行数:77,代码来源:EtherLog.c


示例15: AddRef

void eFilePushThread::sendEvent(int evt)
{
	/* add a ref, to make sure the object is not destroyed while the messagepump contains unhandled messages */
	AddRef();
	m_messagepump.send(evt);
}
开发者ID:fairbird,项目名称:OpenPLI-BlackHole,代码行数:6,代码来源:filepush.cpp


示例16: m_cRef

CXFilterV2::CXFilterV2():
	m_cRef(1)
{
	AddRef();
}
开发者ID:jwtab,项目名称:dxlogin,代码行数:5,代码来源:CredentialV2_Imp.cpp


示例17: if

STDAPI CTextService::QueryInterface(REFIID riid, void **ppvObj)
{
	if(ppvObj == nullptr)
	{
		return E_INVALIDARG;
	}

	*ppvObj = nullptr;

	if(IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfTextInputProcessor))
	{
		*ppvObj = (ITfTextInputProcessor *)this;
	}
	else if(IsEqualIID(riid, IID_ITfTextInputProcessorEx))
	{
		*ppvObj = (ITfTextInputProcessorEx *)this;
	}
	else if(IsEqualIID(riid, IID_ITfThreadMgrEventSink))
	{
		*ppvObj = (ITfThreadMgrEventSink *)this;
	}
	else if(IsEqualIID(riid, IID_ITfThreadFocusSink))
	{
		*ppvObj = (ITfThreadFocusSink *)this;
	}
	else if(IsEqualIID(riid, IID_ITfCompartmentEventSink))
	{
		*ppvObj = (ITfCompartmentEventSink *)this;
	}
	else if(IsEqualIID(riid, IID_ITfTextEditSink))
	{
		*ppvObj = (ITfTextEditSink *)this;
	}
	else if(IsEqualIID(riid, IID_ITfKeyEventSink))
	{
		*ppvObj = (ITfKeyEventSink *)this;
	}
	else if(IsEqualIID(riid, IID_ITfCompositionSink))
	{
		*ppvObj = (ITfKeyEventSink *)this;
	}
	else if(IsEqualIID(riid, IID_ITfDisplayAttributeProvider))
	{
		*ppvObj = (ITfDisplayAttributeProvider *)this;
	}
	else if(IsEqualIID(riid, IID_ITfFunctionProvider))
	{
		*ppvObj = (ITfFunctionProvider *)this;
	}
	else if(IsEqualIID(riid, IID_ITfFnConfigure))
	{
		*ppvObj = (ITfFnConfigure *)this;
	}
	else if(IsEqualIID(riid, IID_ITfFnShowHelp))
	{
		*ppvObj = (ITfFnShowHelp *)this;
	}
	else if(IsEqualIID(riid, IID_ITfFnReconversion))
	{
		*ppvObj = (ITfFnReconversion *)this;
	}
	else if(IsEqualIID(riid, IID_ITfFnGetPreferredTouchKeyboardLayout))
	{
		*ppvObj = (ITfFnGetPreferredTouchKeyboardLayout *)this;
	}

	if(*ppvObj)
	{
		AddRef();
		return S_OK;
	}

	return E_NOINTERFACE;
}
开发者ID:nathancorvussolis,项目名称:corvusskk,代码行数:74,代码来源:TextService.cpp


示例18: AddLocalBridge

// Add a local-bridge
void AddLocalBridge(CEDAR *c, char *hubname, char *devicename, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast)
{
	UINT i;
	HUB *h = NULL;
	LOCALBRIDGE *br = NULL;
	// Validate arguments
	if (c == NULL || hubname == NULL || devicename == NULL)
	{
		return;
	}

	if (OS_IS_UNIX(GetOsInfo()->OsType) == false)
	{
		tapmode = false;
	}

	LockList(c->HubList);
	{
		LockList(c->LocalBridgeList);
		{
			bool exists = false;

			// Ensure that the same configuration local-bridge doesn't exist already 
			for (i = 0;i < LIST_NUM(c->LocalBridgeList);i++)
			{
				LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i);
				if (StrCmpi(br->DeviceName, devicename) == 0)
				{
					if (StrCmpi(br->HubName, hubname) == 0)
					{
						if (br->TapMode == tapmode)
						{
							exists = true;
						}
					}
				}
			}

			if (exists == false)
			{
				// Add configuration
				br = ZeroMalloc(sizeof(LOCALBRIDGE));
				StrCpy(br->HubName, sizeof(br->HubName), hubname);
				StrCpy(br->DeviceName, sizeof(br->DeviceName), devicename);
				br->Bridge = NULL;
				br->Local = local;
				br->TapMode = tapmode;
				br->LimitBroadcast = limit_broadcast;
				br->Monitor = monitor;
				if (br->TapMode)
				{
					if (tapaddr != NULL && IsZero(tapaddr, 6) == false)
					{
						Copy(br->TapMacAddress, tapaddr, 6);
					}
					else
					{
						GenMacAddress(br->TapMacAddress);
					}
				}

				Add(c->LocalBridgeList, br);

				// Find the hub
				for (i = 0;i < LIST_NUM(c->HubList);i++)
				{
					HUB *hub = LIST_DATA(c->HubList, i);
					if (StrCmpi(hub->Name, br->HubName) == 0)
					{
						h = hub;
						AddRef(h->ref);
						break;
					}
				}
			}
		}
		UnlockList(c->LocalBridgeList);
	}
	UnlockList(c->HubList);

	// Start the local-bridge immediately
	if (h != NULL && br != NULL && h->Type != HUB_TYPE_FARM_DYNAMIC)
	{
		Lock(h->lock_online);
		{
			if (h->Offline == false)
			{
				LockList(c->LocalBridgeList);
				{
					if (IsInList(c->LocalBridgeList, br))
					{
						if (br->Bridge == NULL)
						{
							br->Bridge = BrNewBridge(h, br->DeviceName, NULL, br->Local, br->Monitor, br->TapMode, br->TapMacAddress, br->LimitBroadcast, br);
						}
					}
				}
				UnlockList(c->LocalBridgeList);
			}
//.........这里部分代码省略.........
开发者ID:benapetr,项目名称:SoftEtherVPN,代码行数:101,代码来源:Bridge.c


示例19: DALSYS_Log_Err


//.........这里部分代码省略.........

    if (pDrvCxt == NULL)
    {
        DALSYS_Log_Err("%s: failed %d\n",__func__,__LINE__);
        return AUDIO_FTM_ERR_INVALID_PARAM;
    }

    DALSYS_SyncEnter(pDrvCxt->hClientSync);

    if((ShareMode == AUD_FTM_SHAREMODE_EXCLU ) && (DALSYS_atomic_read(&pDrvCxt->dwOpenCount) != 0))
        /* ShareMode = 0: exclusive mode; =FILE_SHARE_READ: read only; =FILE_SHARE_WRITE: write only */
    {
        DALSYS_SyncLeave(pDrvCxt->hClientSync);
        DALSYS_Log_Err("%s: failed %d\n",__func__,__LINE__);
        return AUDIO_FTM_ERROR;
    }

  if(DAL_SUCCESS != DALSYS_Malloc(sizeof(Aud_FTM_ClientCtxt_T), (void **)&pOpenContext))
    {
        DALSYS_Log_Err("%s: failed %d\n",__func__,__LINE__);
        DALSYS_SyncLeave(pDrvCxt->hClientSync);
        return AUDIO_FTM_ERR_MEM_ALLOC_FAIL;
    }

    if (pOpenContext == NULL)
    {
      DALSYS_SyncLeave(pDrvCxt->hClientSync);
        DALSYS_Log_Err("%s: failed %d\n",__func__,__LINE__);
      return AUDIO_FTM_ERR_MEM_ALLOC_FAIL;
    }
  DALSYS_memset(pOpenContext,0,sizeof(Aud_FTM_ClientCtxt_T));

    // Store device settings for future use
    pOpenContext->pDrvCtxt = pDrvCxt;
    pOpenContext->dwAccessCode = AccessMode;
    pOpenContext->dwShareMode = ShareMode;

  pOpenContext->dwClientID=DALSYS_atomic_read(&pDrvCxt->dwOpenCount);

  pDrvCxt->apClientCtxt[pOpenContext->dwClientID]=pOpenContext;

#ifdef MSM8960_ALSA
  pDrvCxt->pDevCtxt->read_write_flag = PCM_OUT;
#endif

  /***** open HW *****/
  DALSYS_Log_Info("%s: open hw\n",__func__);
  pDrvCxt->pDevCtxt->playbackdevice =
  pDrvCxt->pDevCtxt->pDrvCtxt->client_param.device;
  res=audio_ftm_hw_open(pDrvCxt->pDevCtxt);
  if(res != AUDIO_FTM_SUCCESS)
  {
    DALSYS_Log_Err("%s: failed %d\n",__func__,__LINE__);
    DALSYS_SyncLeave(pDrvCxt->hClientSync);
    return AUDIO_FTM_ERROR;
  }

    audio_ftm_hw_iocontrol(pDrvCxt->pDevCtxt, IOCTL_AUDIO_FTM_RX_DEV_BUF_SIZE, NULL, 0, &dev_buf_size, sizeof(dev_buf_size), NULL);
    pDrvCxt->nRx_blk_convey_samples=dev_buf_size/sizeof(int16);

  /********* init circular buf ********/
    fifo_buf_size=dev_buf_size*AUD_FTM_TONE_PLAY_FIFO_FACTOR+4;    // reserve 4 bytes

  DALSYS_Log_Info("%s: init buf\n",__func__);
  aud_ftm_cbuf_init(&(pDrvCxt->fifo_data_buf), fifo_buf_size);

  if(DAL_SUCCESS != DALSYS_Malloc(dev_buf_size*AUD_FTM_TONE_PLAY_FIFO_FACTOR, (void **)&pTmpBuf))  /* buffer for DTMF data producing */
  {
          DALSYS_SyncLeave(pDrvCxt->hClientSync);
      DALSYS_Log_Err(" pTmpBuf allocation fail\n");
      return DAL_ERROR;
    }
  DALSYS_memset(pTmpBuf,0,dev_buf_size*AUD_FTM_TONE_PLAY_FIFO_FACTOR);

  if(DAL_SUCCESS != DALSYS_Malloc(dev_buf_size, (void **)&pAud_ftm_rx_buf))  /* buffer for fetch data from FIFO and pass to low layer driver for consuming */
  {
          DALSYS_SyncLeave(pDrvCxt->hClientSync);
      DALSYS_Log_Err(" pAud_ftm_rx_buf allocation fail\n");
      return DAL_ERROR;
    }
  DALSYS_memset(pAud_ftm_rx_buf,0,dev_buf_size);

  /***** prefill the circular buffer with DTMF data *****/

  for(i=0; i<((dev_buf_size*AUD_FTM_TONE_PLAY_FIFO_FACTOR)/sizeof(int16)); i++)
  {
    *(pTmpBuf+i)=audio_ftm_dtmf_tone_sample_gen(&(pDrvCxt->dtmfGen),pDrvCxt->nDTMF_Gain);
  }
  aud_ftm_cbuf_write (&(pDrvCxt->fifo_data_buf),(uint8 *)pTmpBuf,(int32)(dev_buf_size*AUD_FTM_TONE_PLAY_FIFO_FACTOR));

    // Increase opened device counter
  AddRef(&pDrvCxt->dwOpenCount);
    pDrvCxt->bOpened=TRUE;

    DALSYS_SyncLeave(pDrvCxt->hClientSync);

    *pClientContext=  (AUDIO_FTM_CLIENT_HANDLE_T)pOpenContext;

    return AUDIO_FTM_SUCCESS;
}
开发者ID:xingrz,项目名称:android_tools_leeco_msm8996,代码行数:101,代码来源:audio_ftm_tone_play.c


示例20: GNetUpdater

	GNetUpdater()
	{
		AddRef();
	}
开发者ID:JagHond,项目名称:freefalcon-central,代码行数:4,代码来源:serverbrowser.cpp



注:本文中的AddRef函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AddResource函数代码示例发布时间:2022-05-30
下一篇:
C++ AddQuestLevelToTitle函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap