Exemplo n.º 1
0
AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers)
{
    ALCdevice *device;
    ALCcontext *context;
    ALbuffer *ALBuf;
    ALsizei i;

    context = GetContextRef();
    if(!context) return;

    if(!(n >= 0))
        SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);

    device = context->Device;
    for(i = 0;i < n;i++)
    {
        if(!buffers[i])
            continue;

        /* Check for valid Buffer ID */
        if((ALBuf=LookupBuffer(device, buffers[i])) == NULL)
            SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done);
        if(ReadRef(&ALBuf->ref) != 0)
            SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done);
    }

    for(i = 0;i < n;i++)
    {
        if((ALBuf=LookupBuffer(device, buffers[i])) != NULL)
            DeleteBuffer(device, ALBuf);
    }

done:
    ALCcontext_DecRef(context);
}
Exemplo n.º 2
0
//---------------------------------------------------------------------------
//  IFXString::Assign
//
//  This method copies the source UTF-8 characters to the destination wide characters.
//---------------------------------------------------------------------------
IFXRESULT IFXString::Assign(const U8* pSource)
{
	IFXRESULT result = IFX_OK;

	if(!pSource)
	{
		DeleteBuffer();
	}
	else
	{
		U32 size = 0;
		result = IFXOSGetWideCharStrSize( pSource, &size );
		size = size + 1; //null terminator

		if( IFXSUCCESS( result) && (size > 0) )
		{
			NewBuffer(size);
			if (m_Buffer)
				result = IFXOSConvertUtf8StrToWideChar( pSource, m_Buffer, size );
			else
				result = IFX_E_OUT_OF_MEMORY;
		}
		else
			result = IFX_E_UNDEFINED;
	}

	return result;
}
Exemplo n.º 3
0
	int SensorData_Upload(char *dataPoint, void* value, unsigned char datatype)
	{
		int ret = 0;
	    EdpPacket* update_pkg;
			   
	    switch (datatype) {
	        default:
	        case DATATYPE_INT:
	            update_pkg = PacketSavedataInt(kTypeFullJson, SRC_DEVID, dataPoint, *(int*)value, 0, EDP_TOKEN); 
	            break;
	        case DATATYPE_DOUBLE:
	            update_pkg = PacketSavedataDouble(kTypeFullJson, SRC_DEVID, dataPoint, *(double*)value, 0, EDP_TOKEN); 
	            break;
	        case DATATYPE_STRING:
	            update_pkg = PacketSavedataString(kTypeFullJson, SRC_DEVID, dataPoint, (const char*)value, 0, EDP_TOKEN); 
	            break;
	    }
		OSTimeDly(10);
	
	    /* 发送转存数据到OneNet并转发到Dev2设备 */
	    ret = Socket_TCPClientSendData((char*)update_pkg->_data, update_pkg->_write_pos);
		
	    if (ret <= 0) {
	        log_info("Save and transmit full json data failed(ret:%d).\n", ret);
	    } else {
	        log_notice("Save and transmit full json data success.\n");
	    }	
	    DeleteBuffer(&update_pkg);
	
	    return 0;
	}
Exemplo n.º 4
0
INT32 Adreno::MemoryBuffer::ExpandBuffer( INT32 num_new_bytes )
{
    INT32 old_size = BufferSize();
    INT32 new_size = old_size + num_new_bytes;

    if( new_size > 0 )
    {
        BYTE* new_buffer = new BYTE[ new_size ];

        // Copy the old buffer
        if( m_buffer )
        {
            for( INT32 i = 0; i < old_size; ++i )
            {
                new_buffer[ i ] = m_buffer[ i ];
            }

            DeleteBuffer();
        }

        // Zero out the new bytes
        for( INT32 i = old_size; i < new_size; ++i )
        {
            new_buffer[ i ] = 0;
        }

        // Use the new buffer
        m_size   = new_size;
        m_buffer = new_buffer;
    }

    return old_size;
}
Exemplo n.º 5
0
void CDVDVideoCodecLibMpeg2::DeleteBuffer(DVDVideoPicture* pPic)
{
  if(pPic)
  {
    _aligned_free(pPic->data[0]);
    _aligned_free(pPic->data[1]);
    _aligned_free(pPic->data[2]);

    pPic->data[0] = 0;
    pPic->data[1] = 0;
    pPic->data[2] = 0;

    pPic->iLineSize[0] = 0;
    pPic->iLineSize[1] = 0;
    pPic->iLineSize[2] = 0;

    pPic->iFlags &= ~DVP_FLAG_ALLOCATED;
    pPic->iFlags &= ~DVP_FLAG_LIBMPEG2_ALLOCATED;
    if (m_pCurrentBuffer == pPic) m_pCurrentBuffer = NULL;
  }
  else
  {
    //Release all buffers
    for (int i = 0; i < 3; i++) DeleteBuffer(m_pVideoBuffer + i);
  }
}
Exemplo n.º 6
0
void System::Quit()
{
	DeleteBuffer();
	g_input->PurgeInstance();
	g_scene->PurgeInstance();
	g_system->PurgeInstance();
}
Exemplo n.º 7
0
static void EEPROMWriteReadTestHandler(SignalType * Signal)
{
    switch (Signal->Event)
    {
        case EE_PRIMITIVE:
            switch (Signal->SubEvent)
            {
                case EE_READ_DATA_cfm:
                {
                    char* ptr;
                    EeStoreDataReqType *EeStoreDataReq;

                    ptr = StringPrint(StatusString, "EE_READ_DATA_cfm[");
                    ptr = StrPrintHexWord(ptr, EEP_UserDataArea);
                    ptr = StringPrint(ptr, "]=[");
                    ptr = StrPrintHexByte(ptr, eepromData[0]);
                    ptr = StringPrint(ptr, "]");
                    PrintStatus(0, StatusString);

                    eepromData[0]++;

                    NewSignal(sizeof(EeStoreDataReqType) + 1, (void **) &EeStoreDataReq);
                    getSignalData(EeStoreDataReq)[0] = eepromData[0];
                    EeStoreDataReq->DataTypes = EEDT_ANYADDRESS;
                    EeStoreDataReq->SubsNo = 0;
                    setAddressData(EEP_UserDataArea, 1);
                    SendSignal((SignalType *) EeStoreDataReq, EE_PROCESS_ID, EE_PRIMITIVE, EE_STORE_DATA_req);

                    setSignalHandler(APPLICATION_PROCESS_ID_PP, PPconnectionHandler, 0);
                }
                break;
            }
    }
    DeleteBuffer(Signal);
}
Exemplo n.º 8
0
/* if possible, read num_bytes from session.  If not possible,
return false and write nothing.  DO NOT pass in 0 bytes to read. */
Bool ReadSessionBytes(session_node *s,int num_bytes,void *buf)
{
	buffer_node *bn,*blist;
	int copied,copy_bytes;
	
	if (GetSessionReadBytes(s) < num_bytes)
		return False;
	
	blist = s->receive_list;
	
	if (blist->len_buf - s->receive_index > num_bytes)
	{
		memcpy(buf,blist->buf + s->receive_index,num_bytes);
		s->receive_index += num_bytes;
		return True;
	}
	
	/* reading at least as many bytes as there are in first buffer */
	
	copy_bytes = blist->len_buf - s->receive_index;
	memcpy(buf,blist->buf + s->receive_index,copy_bytes);
	copied = copy_bytes;
	
	bn = blist->next;
	DeleteBuffer(blist);
	s->receive_list = bn;
	s->receive_index = 0;
	
	copy_bytes = 0; /* in case exactly read message, set receive_index right */
	while (s->receive_list != NULL && copied < num_bytes)
	{
	  copy_bytes = std::min(num_bytes-copied,s->receive_list->len_buf);
	  memcpy((char *)buf+copied,s->receive_list->buf,copy_bytes);
	  
	  copied += copy_bytes;
	  if (copy_bytes == s->receive_list->len_buf)
	    {
	      bn = s->receive_list->next;
	      DeleteBuffer(s->receive_list);
	      s->receive_list = bn;
	      copy_bytes = 0; /* if last copy ended with this buffer,
				 set receive_index right */
	    }
	}
	s->receive_index = copy_bytes;
	return True;
}
Exemplo n.º 9
0
	void ArrayBuffer<DataType>::SetBufferUsage(unsigned int usage)
	{
		if (m_BufferUsage != usage)
		{
			DeleteBuffer();
			UpdateBuffer();
		}
	}
Exemplo n.º 10
0
EXPORT_C void CImOffLineOperation::SetOperation(TOffLineOpType aOpType, TMsvId aMessageId, TMsvId aTargetMessageId)
    {
    DeleteBuffer();
    iOpType				= aOpType;
    iMessageId			= aMessageId;
    iTargetMessageId	= aTargetMessageId;
    iMtmFunctionId		= 0;
    }
Exemplo n.º 11
0
int Agent_cloud_process(void)
{
	EdpPacket* connect_pkg = NULL;
	int ret;
	unsigned char failedcnt = 0;

	cloud_conn_status.conn_status = SOCK_DONE;

	#ifndef   Devid_RestFul
		AGAIN:    
			/* 向Onenet服务器发送EDP连接报文 */
			connect_pkg = PacketConnect1((char*)SRC_DEVID, (char*)CLOUD_API_KEY);
		
			/* dump package data */
			log_info("Packet connect data(len:%d):\n", connect_pkg->_write_pos);
			dump_hex(connect_pkg->_data, connect_pkg->_write_pos);
			log_info("SRC_DEVID:%s CLOUD_API_KEY:%s\r\n",SRC_DEVID,CLOUD_API_KEY);
		
			ret = Socket_TCPClientSendData((char *)connect_pkg->_data, connect_pkg->_write_pos);
			DeleteBuffer(&connect_pkg);
			if (ret < 0) {
				cloud_conn_status.conn_status = CLOUD_CONN_ERROR;
				log_info("Send connect data failed(ret:%d).\n", ret);
		        failedcnt++;
		        /* 发送连接次数超过3次则退出连接 */
		        if (failedcnt > 3) {
		            Socket_TCPClientClose();
		            return -1;
		        }
		        OSTimeDly(50);
				goto AGAIN;
			} else {
				log_notice("Send connect data success.\n");
			}
	#endif


	/* 主进程用于接收云端服务器的数据 */
	while (1)
	{
		ret = Socket_TCPClientRecvData(recv_buf, CLOUD_RECV_BUFFER_SIZE);
		if (ret > 0) {
			recv_buf[ret] = '\0';
			#if   (4 & Devid_Mode) //restful方式
			   log_notice("%s\r\n",recv_buf);
			   RestFul_RecvProcess(recv_buf,ret);
			#else
               recv_data_process(recv_buf, ret);
			#endif
		}
		
		if (ret < 0 || TCPClient_reset_flag == 0xa5 ) {  //关闭TCP链接
			log_err("Recv tcp client data error(%d)\n", ret);
			Socket_TCPClientClose();
			return -1;
		}
	}
}
Exemplo n.º 12
0
UByte voice_callUser(PPIDType called, PPIDType caller)
{
    ApplicationInstanceType *applicationInstanceData;

    if (QuickData[called].EmptyMarker == 0) {
        SignalType * signal;
        NewSignal(sizeof(SignalType), (void**) &signal);

        PPID2PMID((PMIDType *) signal->Address, called);

        applicationInstanceData = getApplicationInstance(signal->Address);

        if (applicationInstanceData->state == idle) {
            applicationInstanceData->state = incommingcall;
            applicationInstanceData->connectedTo = caller;

            SendSignal((SignalType*) signal, APP_CC_PROCESS_ID, APP_CC_PRIMITIVE, APPCCSetupReq);

            /*setup the outgoing side of the call:*/
            {
                PMIDType pmid;
                char tmp[13];
                UByte sum = called;

                PPID2PMID(&pmid, caller);

                applicationInstanceData = getApplicationInstance(pmid);
                applicationInstanceData->connectedTo = called;

                memset(tmp, 0, 12);
                tmp[0] = sum + '0';
                handleConnectPrim(pmid, applicationInstanceData);
                /*{
                 AudioLineCtrlReqType *AudioLineCtrlReq;
                 NewSignal(sizeof(AudioLineCtrlReqType), (void **) &AudioLineCtrlReq);
                 AudioLineCtrlReq->TheSignal.Address[0] = 0x0F;
                 AudioLineCtrlReq->TheSignal.Address[1] = 0;//MeInstance->Mcei;
                 AudioLineCtrlReq->Lid = sum;
                 _memcpy(AudioLineCtrlReq->Pmid,pmid,3);
                 AudioLineCtrlReq->option = 3;
                 PrintStatus(0, "\r\napp: send AUDIOLINECTRL_req to mac layer");

                 SendSignal((SignalType*)AudioLineCtrlReq, CCF_PROCESS_ID, CCF_PRIMITIVE, AUDIOLINECTRL_req);
                 }*/
            }

            return 1;
        } else {
            DeleteBuffer(signal);
            PrintStatus(0, "\r\nnumber found, but user allready active.\n");
            return 2;
        }
    } else {
        PrintStatus(0, "\r\nnumber not found...");
        return 3;
    }
}
Exemplo n.º 13
0
MeshStream::~MeshStream()
{
	if (m_IsLocked)
	{
		m_BufferAccess.UnLock();
	}

	DeleteBuffer();
}
Exemplo n.º 14
0
//This call could possibly be moved outside of the codec, could allow us to do some type of
//direct rendering. problem is that that the buffer requested isn't allways the next one
//that should go to display.
DVDVideoPicture* CDVDVideoCodecLibMpeg2::GetBuffer(unsigned int width, unsigned int height)
{
  for(int i = 0; i < 3; i++)
  {
    if( !(m_pVideoBuffer[i].iFlags & DVP_FLAG_LIBMPEG2_INUSE) )
    {
      if( m_pVideoBuffer[i].iWidth != width || m_pVideoBuffer[i].iHeight != height ) //Dimensions changed.. realloc needed
      {
        DeleteBuffer(m_pVideoBuffer+i);
      }

      if( !(m_pVideoBuffer[i].iFlags & DVP_FLAG_ALLOCATED) )
      { //Need to allocate

        //First make sure all properties are reset
        memset(&m_pVideoBuffer[i], 0, sizeof(DVDVideoPicture));

        //Allocate for YV12 frame
        unsigned int iPixels = width*height;
        unsigned int iChromaPixels = iPixels/4;

        // If we're dealing with a 4:2:2 format, then we actually need more pixels to
        // store the chroma, as "the two chroma components are sampled at half the
        // sample rate of luma, so horizontal chroma resolution is cut in half."
        //
        // FIXME: Do we need to handle 4:4:4 and 4:1:1 as well?
        //
        if (m_bIs422)
          iChromaPixels = iPixels/2;

        m_pVideoBuffer[i].iLineSize[0] = width;   //Y
        m_pVideoBuffer[i].iLineSize[1] = width/2; //U
        m_pVideoBuffer[i].iLineSize[2] = width/2; //V
        m_pVideoBuffer[i].iLineSize[3] = 0;

        m_pVideoBuffer[i].iWidth = width;
        m_pVideoBuffer[i].iHeight = height;

        m_pVideoBuffer[i].data[0] = (BYTE*)_aligned_malloc(iPixels, 16);    //Y
        m_pVideoBuffer[i].data[1] = (BYTE*)_aligned_malloc(iChromaPixels, 16);  //U
        m_pVideoBuffer[i].data[2] = (BYTE*)_aligned_malloc(iChromaPixels, 16);  //V

        //Set all data to 0 for less artifacts.. hmm.. what is black in YUV??
        memset( m_pVideoBuffer[i].data[0], 0, iPixels );
        memset( m_pVideoBuffer[i].data[1], 0, iChromaPixels );
        memset( m_pVideoBuffer[i].data[2], 0, iChromaPixels );
      }
      m_pVideoBuffer[i].pts = DVD_NOPTS_VALUE;
      m_pVideoBuffer[i].iFlags = DVP_FLAG_LIBMPEG2_INUSE | DVP_FLAG_ALLOCATED; //Mark as inuse
      return m_pVideoBuffer+i;
    }
  }

  //No free pictures found.
  return NULL;
}
Exemplo n.º 15
0
/*
 *  @brief  EDP协议向自己透传数据,用于测试,将src_dev替换成目标DEVICE ID即可
 */
void Push_DataToMyself(void)
{
    EdpPacket* send_pkg;
    int8_t push_data[] = {44};
    printf("%s %d\n", __func__, __LINE__);
    send_pkg = PacketPushdata(src_dev, push_data, sizeof(push_data));
    DoSend(0, (const uint8_t *)send_pkg->_data, send_pkg->_write_pos);
    DeleteBuffer(&send_pkg);
    mDelay(1000);
}
Exemplo n.º 16
0
EXPORT_C void CImOffLineOperation::SetOperation(TOffLineOpType aOpType, TMsvId aMessageId, TMsvId aTargetMessageId, TInt aMtmFunctionId, HBufC8* aParameters)
    {
    DeleteBuffer();
    iOpType				= aOpType;
    iMessageId			= aMessageId;
    iTargetMessageId	= aTargetMessageId;
    iMtmFunctionId		= aMtmFunctionId;
    iMtmFunctionId		= aMtmFunctionId;
    iMtmParameters		= aParameters;
    }
Exemplo n.º 17
0
static void PPAlreadySubscribedHandler(SignalType * Signal)
{
    switch (Signal->Event)
    {
    case IWU_PRIMITIVE:
    {
        switch (Signal->SubEvent)
        {
        case OM_SUBS_SELECT_cfm:
        {
            OmSubsSelectCfmType *OmSubsSelectCfm = (OmSubsSelectCfmType *) Signal;
            if (OmSubsSelectCfm->NotAccepted) {
                PrintStatus(0, "Login to subscribed base failed!");
            }
        }
        break;
        case OM_SUBS_STATUS_ind:
        {
            OmSubsStatusIndType *OmSubsStatusInd = (OmSubsStatusIndType *) Signal;
            if (OmSubsStatusInd->Status & SS_LocRegSucceeded) {
                PrintStatus(0, "Login to subscribed base completed");
            } else if (OmSubsStatusInd->Status & SS_Locked) {
                PrintStatus(0, "Locked to subscribed base");
            } else if (OmSubsStatusInd->Status & SS_Subscripted) {
                _sprintf_(StatusString, "Subscription number [%02x]", OmSubsStatusInd->SubsNo);
                PrintStatus(0, StatusString);
            }
        }
        break;
        case OM_ATTACH_ind:
        {
            OmAttachIndType * OmAttachInd = (OmAttachIndType *) Signal;
            IwuToIwuType * IwuToIwuPtr;

            IwuToIwuPtr = (IwuToIwuType *) FindInfoElement(IwuToIwuId, getOmAttachIndTypeIE(OmAttachInd) - 2, OmAttachInd->SignalHeader.SignalLength - sizeof(OmAttachIndType) + 2);
            if (IwuToIwuPtr != NULL) {
                if (IwuToIwuPtr->ProtocolDiscrim == UserSpecific && IwuToIwuPtr->DiscrimType == UseOfEmc) {
                    StandByTxtIEType *standbyText = (StandByTxtIEType *) FindInfoElement(StandByTxtAPEIEId, getIwuToIwuSIE(IwuToIwuPtr) - 2, OmAttachInd->SignalHeader.SignalLength - sizeof(OmAttachIndType) - sizeof(IwuToIwuType) + 2);
                    if (standbyText) {
                        memcpy(StatusString, standbyText->StandByTxt, standbyText->LengthOfContents);
                        StatusString[standbyText->LengthOfContents] = '\0';
                        PrintStatus(0, StatusString);
                    }
                }
            }
            setSignalHandler(APPLICATION_PROCESS_ID_PP, PPLockedHandler, 0);
        }
        }
    }
    break;

    }
    DeleteBuffer(Signal);
}
Exemplo n.º 18
0
IFXINLINE void IFXString::NewBuffer(U32 size)
{
	DeleteBuffer();
	if(size)
	{
		//m_Buffer = new IFXCHAR[size];
		m_Buffer = (IFXCHAR*)IFXAllocate(size * sizeof(IFXCHAR));
		if( NULL != m_Buffer )
			m_BufferLength = size;
	}
}
Exemplo n.º 19
0
void AsyncSocketWrite(SOCKET sock)
{
	int bytes;  
	session_node *s;
	buffer_node *bn;
	
	s = GetSessionBySocket(sock);
	if (s == NULL)
		return;
	
	if (s->hangup)
		return;
	
	/* dprintf("got async write session %i\n",s->session_id); */
	if (WaitForSingleObject(s->muxSend,10000) != WAIT_OBJECT_0)
	{
		eprintf("AsyncSocketWrite couldn't get session %i muxSend\n",s->session_id);
		return;
	}
	
	while (s->send_list != NULL)
	{
		bn = s->send_list;
		/* dprintf("async writing %i\n",bn->len_buf); */
		bytes = send(s->conn.socket,bn->buf,bn->len_buf,0);
		if (bytes == SOCKET_ERROR)
		{
			if (GetLastError() != WSAEWOULDBLOCK)
			{
				/* eprintf("AsyncSocketWrite got send error %i\n",GetLastError()); */
				if (!ReleaseMutex(s->muxSend))
					eprintf("File %s line %i release of non-owned mutex\n",__FILE__,__LINE__);
				HangupSession(s);
				return;
			}
			
			/* dprintf("got write event, but send would block\n"); */
			break;
		}
		else
		{
			if (bytes != bn->len_buf)
				dprintf("async write wrote %i/%i bytes\n",bytes,bn->len_buf);
			
			transmitted_bytes += bn->len_buf;
			
			s->send_list = bn->next;
			DeleteBuffer(bn);
		}
	}
	if (!ReleaseMutex(s->muxSend))
		eprintf("File %s line %i release of non-owned mutex\n",__FILE__,__LINE__);
}
Exemplo n.º 20
0
    void ReallocateBuffer(SIZE_T count)
    {
        // count is always > STACKCOUNT here.
        T * newBuffer = (T *)PAL_malloc((count + 1) * sizeof(T));
        if (NULL == newBuffer)
        {
            SetLastError(ERROR_NOT_ENOUGH_MEMORY);

            DeleteBuffer();
            m_count = 0;

            return;
        }

        DeleteBuffer();
        m_buffer = newBuffer;
        m_count = count;
        m_size = count+1;

        return;
    }
Exemplo n.º 21
0
EXPORT_C void CImOffLineOperation::CopyL(const CImOffLineOperation& aOperation)
    {
    DeleteBuffer();
    iOpType				= aOperation.iOpType; 
    iMessageId			= aOperation.iMessageId;
    iTargetMessageId	= aOperation.iTargetMessageId;
	iMtmFunctionId		= aOperation.iMtmFunctionId;
    if (aOperation.iMtmParameters)
        {
        iMtmParameters = aOperation.iMtmParameters->Des().AllocL();
        }
    }
Exemplo n.º 22
0
void SessionAddBufferList(session_node *s,buffer_node *blist)
{
	buffer_node *bn,*temp;
	int length;
	
	/* prereq: we must already hold the muxSend for s */
	
	if (s->send_list == NULL)
	{
		/* put first node on, then try the compress junk */
		s->send_list = blist;
		blist = blist->next;
		s->send_list->next = NULL;
		bn = s->send_list;
	}
	else
	{
		length = 1;
		bn = s->send_list;
		while (bn->next != NULL)
		{
			length++;
			bn = bn->next;
		}
		
		/* dprintf("non-blank send list len %i\n",length); */      
		
		/* if currently backed up more than MAX_SESSION_BUFFER_LIST_LEN,
		then don't waste any more memory on them */
		if (length > MAX_SESSION_BUFFER_LIST_LEN)
		{
			//dprintf("SessionAddBufferList deleting because buffer list too long %i\n",s->session_id);
			DeleteBufferList(blist);
			return;
		}
	}
	
	/* simple approach: set bn->next to blist.  However, this can use up
	a ton of buffers, when the amount of data to be sent is small.  So
	do a couple discreet checks, and perhaps memcpy's. */
	while (blist != NULL && blist->len_buf < (bn->size_prebuf - bn->len_buf - HEADERBYTES))
	{
		/* dprintf("squeezing %i in %i\n",blist->len_buf,bn->size_buf-bn->len_buf); */
		memcpy(bn->buf+bn->len_buf,blist->buf,blist->len_buf);
		bn->len_buf += blist->len_buf;
		temp = blist->next;
		DeleteBuffer(blist);
		blist = temp;
	}
	
	bn->next = blist;
}
nsHtml5OwningUTF16Buffer::~nsHtml5OwningUTF16Buffer()
{
  MOZ_COUNT_DTOR(nsHtml5OwningUTF16Buffer);
  DeleteBuffer();

  // This is to avoid dtor recursion on 'next', bug 706932.
  nsRefPtr<nsHtml5OwningUTF16Buffer> tail;
  tail.swap(next);
  while (tail && tail->mRefCnt == 1) {
    nsRefPtr<nsHtml5OwningUTF16Buffer> tmp;
    tmp.swap(tail->next);
    tail.swap(tmp);
  }
}
Exemplo n.º 24
0
/*
 *  @brief  发送PING包维持心跳
 */
void Ping_Server(void)
{
    EdpPacket *send_pkg;
    printf("%s %d\n", __func__, __LINE__);
    /* 组装ping包 */
    send_pkg = PacketPing();

    DoSend(0, (const uint8_t *)send_pkg->_data,
           send_pkg->_write_pos);
    mDelay(500);
    /* 必须释放这个内存,否则造成泄露 */
    DeleteBuffer(&send_pkg);
    mDelay(100);
}
Exemplo n.º 25
0
void CDVDVideoCodecLibMpeg2::Dispose()
{
  if (m_pHandle)
    m_dll.mpeg2_close(m_pHandle);

  m_pHandle = NULL;
  m_pInfo = NULL;

  DeleteBuffer(NULL);
  m_pCurrentBuffer = NULL;
  m_irffpattern = 0;

  m_dll.Unload();
}
Exemplo n.º 26
0
IFXString::IFXString(const IFXCHAR* operand)
: 	m_Buffer(NULL),
	m_BufferLength(0)
{
	if(!operand)
	{
		DeleteBuffer();
	}
	else
	{
		NewBuffer((U32)wcslen(operand)+1);
		if (m_Buffer)
			wcscpy(m_Buffer, operand);
	}
}
Exemplo n.º 27
0
EXPORT_C void CImOffLineOperation::InternalizeL( RMsvReadStream& aReadStream )
    {                        
    DeleteBuffer();
    iOpType				= TOffLineOpType(aReadStream.ReadInt32L());
    iMessageId			= TMsvId(aReadStream.ReadInt32L());
    iTargetMessageId	= TMsvId(aReadStream.ReadInt32L());
    iMtmFunctionId		= aReadStream.ReadInt32L();

    TInt length			= aReadStream.ReadInt32L();
    
    if (length > 0)
        {               
        iMtmParameters = HBufC8::NewL(aReadStream, length);
        }
	return;
	}
Exemplo n.º 28
0
/*
 *  @brief  EDP协议向Onenet上传湿度信息,数据点格式TYPE=3
 */
void Save_HumToOneNet(void)
{
    EdpPacket* send_pkg;
    uint16_t hum[1];
    SHT20_read_user_reg();
    mDelay(200);//延迟,设备没有那么快的响应时间,否则总线处理忙等待
    SHT2x_MeasureHM(SHT20_Measurement_RH_NHM, hum);

    printf("%s %d hum:%d\n", __func__, __LINE__, (uint32_t)hum[0]);

    send_pkg = PacketSavedataInt(kTypeSimpleJsonWithoutTime, NULL, "hum", (uint32_t)hum[0], 0, NULL);

    DoSend(0, (const uint8_t *)send_pkg->_data, send_pkg->_write_pos);
    DeleteBuffer(&send_pkg);
    mDelay(1000);
}
Exemplo n.º 29
0
IFXString::IFXString(const IFXString* operand)
: 	m_Buffer(NULL),
	m_BufferLength(0)
{
	if(!operand)
	{
		DeleteBuffer();
	}
	else
	{
		if (operand->m_BufferLength > 0) 
		{
			NewBuffer((U32)operand->m_BufferLength);
			if (m_Buffer)
				wcscpy(m_Buffer, operand->m_Buffer);
		}
	}
}
Exemplo n.º 30
0
static void PPDialingHandler(SignalType * Signal)
{
    switch (Signal->Event)
    {
        case IWU_PRIMITIVE:
        {
            switch (Signal->SubEvent)
            {
                case CC_CONNECT_prim:
                {
                    SignalType * startAudio;
                    NewBuffer(sizeof(SignalType), (void**) &startAudio);
                    SendSignal((SignalType*) startAudio, DSP_PROCESS_ID, SETUPAUDIO_EVENT, 0);
                    connected = 1;
                }
                case CC_INFO_prim: /*do not break*/
                {
                    if (connected == 1) {
                        SignalType* mySignal;
                        NewSignal(sizeof(SignalType) + 2 + strlen(numberToDial), (void **) &mySignal);
                        getSignalData(mySignal)[0] = 0x2c;
                        getSignalData(mySignal)[1] = strlen(numberToDial);
                        memcpy(getSignalData(mySignal) + 2, numberToDial, strlen(numberToDial));
                        InjectSignal(mySignal, IWU_PROCESS_ID, IWU_PRIMITIVE, CC_INFO_prim, Signal->SessionId);
                    }
                }
                break;
                case CC_RELEASE_prim:
                {
                    if (connected == 1) {
                        Signal->SignalLength = sizeof(CcReleaseComPrimType);
                        SendSignal(Signal, IWU_PROCESS_ID, IWU_PRIMITIVE, CC_RELEASE_COM_prim);
                        connected = 0;
                        setSignalHandler(APPLICATION_PROCESS_ID_PP, PPconnectionHandler, 0);
                        return;
                    }
                }
                break;
            }
        }
    }
    DeleteBuffer(Signal);
}