示例#1
0
j_result_t CH264Decoder::DecodeOneFrame(j_char_t *pInputData, j_int32_t nInputLen, j_char_t *pOutuptData, j_int32_t &nOutputLen)
{
	nOutputLen = 0;
	if (!m_bInit)
	{
		return J_OK;
	}

	int nRet = 0;
	int got_frame;
	m_Packet.data	= (uint8_t *)pInputData;
	m_Packet.size	= nInputLen;
	nRet = avcodec_decode_video2(m_pContext, m_pPicture, &got_frame, &m_Packet);
	if(nRet < 0)
	{
		J_OS::LOGINFO("CXPlDecodeH264::Decode error :%d\n",nRet);
		return J_OK;
	}
	
	InitDecodeParam(m_decParam);
	nOutputLen = CopyData(m_pPicture, pOutuptData, nOutputLen);

	return J_OK;
}
示例#2
0
Uint32 SCI_Boot()
{
   Uint32 EntryAddr;

   // Asign GetWordData to the SCI-A version of the
   // function.  GetOnlyWordData is a pointer to a function.
   // This version doesn't send echo back each character.
   GetOnlyWordData = SCIA_GetOnlyWordData;

   SCIA_Init();
   SCIA_AutobaudLock();
   checksum = 0;

   // If the KeyValue was invalid, abort the load
   // and return the flash entry point. 
   if (SCIA_GetOnlyWordData() != 0x08AA) return FLASH_ENTRY_POINT;

   ReadReservedFn();

   EntryAddr = GetLongData();   
   CopyData();

   return EntryAddr;
}
示例#3
0
void CFX_ByteTextBuf::operator=(const CFX_ByteStringC& str) {
  CopyData(str.GetPtr(), str.GetLength());
}
TDCLInspectorCmdDeletePkg::TDCLInspectorCmdDeletePkg( const KUInt16* inPackageName ):
	TDCLInspectorCommand( kDDeletePackage )
{
    SetLength( UUTF16CStr::StrLen( inPackageName ) * 2 );
    CopyData( inPackageName );
}
示例#5
0
void
PlanarYCbCrImage::SetData(const Data &aData)
{
  CopyData(aData);
}
BOOL CGatewayEpos2ToMaxonSerialV1::Process_RequestCANFrame(CCommand_DCS* pCommand, CProtocolStackManagerBase* pProtocolStackManager, HANDLE hPS_Handle, HANDLE hTransactionHandle)
{
    const BYTE MAX_FRAME_LENGTH = 8;

    //*Constants DCS*
    const int PARAMETER_INDEX_COBID = 0;
    const int PARAMETER_INDEX_LENGTH = 1;
    const int RETURN_PARAMETER_INDEX_ERROR_CODE = 0;
    const int RETURN_PARAMETER_INDEX_DATA = 1;

    //*Constants PS*
    const BYTE OP_CODE = 0x21;
    const BYTE DATA_LENGTH = 4;

    //*Variables DCS*
    //Parameter
    WORD wCobId = 0;
    WORD wLength = 0;
    //Return Parameter
    DWORD dDeviceErrorCode = 0;
    BYTE maxFrameBuffer[MAX_FRAME_LENGTH];

    //*Variables PS*
    //Parameter
    BYTE uOpCode = OP_CODE;
    void* pDataBuffer=NULL;
    DWORD dDataBufferLength;
	BYTE ubKeepLock(0);

    //ReturnParameter
    void* pRetDataBuffer=NULL;
    DWORD dRetDataBufferLength = 0;

    BOOL oResult = FALSE;
    CErrorInfo comErrorInfo;
    CErrorInfo cmdErrorInfo;

    void* pDest;
    void* pSource;

    if(pCommand)
    {
        //Lock CriticalSection
		if(!Lock(pCommand)) return FALSE;

		//Get DCS Parameter Data
        pCommand->GetParameterData(PARAMETER_INDEX_COBID, &wCobId, sizeof(wCobId));
        pCommand->GetParameterData(PARAMETER_INDEX_LENGTH, &wLength, sizeof(wLength));

        //Limit Length
        if(wLength > MAX_FRAME_LENGTH) wLength = MAX_FRAME_LENGTH;
        memset(maxFrameBuffer, 0, MAX_FRAME_LENGTH);

        //Prepare DataBuffer
        dDataBufferLength = DATA_LENGTH;
        pDataBuffer = malloc(dDataBufferLength);

        //Data
        pDest = pDataBuffer;
        CopyData(pDest, &wCobId, sizeof(wCobId));
        CopyData(pDest, &wLength, sizeof(wLength));

        //Execute Command
        oResult = PS_ProcessProtocol(pProtocolStackManager, hPS_Handle, hTransactionHandle, uOpCode, pDataBuffer, dDataBufferLength, ubKeepLock, &pRetDataBuffer, &dRetDataBufferLength, &comErrorInfo);

        //ReturnData
        pSource = pRetDataBuffer;
        if(oResult) oResult = CopyReturnData(&dDeviceErrorCode, sizeof(dDeviceErrorCode), pSource, dRetDataBufferLength);
        if(oResult) oResult = CopyReturnData(maxFrameBuffer, wLength, pSource, dRetDataBufferLength);

        //Evaluate ErrorCode
        oResult = EvaluateErrorCode(oResult, dDeviceErrorCode, &comErrorInfo, &cmdErrorInfo);

        //Set DCS ReturnParameter Data
        pCommand->SetStatus(oResult, &cmdErrorInfo);
        pCommand->SetReturnParameterData(RETURN_PARAMETER_INDEX_ERROR_CODE, &dDeviceErrorCode, sizeof(dDeviceErrorCode));
        pCommand->SetReturnParameterData(RETURN_PARAMETER_INDEX_DATA, maxFrameBuffer, wLength);

        if(pDataBuffer) free(pDataBuffer);
        if(pRetDataBuffer) free(pRetDataBuffer);

		//Unlock CriticalSection
		Unlock();
    }

    return oResult;
}
BOOL CGatewayEpos2ToMaxonSerialV1::Process_SegmentWrite(CCommand_DCS* pCommand, CProtocolStackManagerBase* pProtocolStackManager, HANDLE hPS_Handle, HANDLE hTransactionHandle)
{
    const BYTE MAX_SEGMENT_LENGTH = 63;

    //*Constants DCS*
    const int PARAMETER_INDEX_NODE_ID = 0;
    const int PARAMETER_INDEX_CONTROL_BYTE = 1;
    const int PARAMETER_INDEX_DATA = 2;
    const int RETURN_PARAMETER_INDEX_ERROR_CODE = 0;
    const int RETURN_PARAMETER_INDEX_CONTROL_BYTE = 1;

    //*Constants PS*
    const BYTE OP_CODE = 0x15;
    const BYTE DATA_LENGTH = 1;
    const BYTE RETURN_DATA_LENGTH = 6;

    //*Variables DCS*
    //Parameter
    BYTE uNodeId = 0;
    UEpos2ControlByte controlByte;
    controlByte.bValue = 0;
    void* pData = NULL;
    //Return Parameter
    UEpos2ControlByte retControlByte;
    retControlByte.bValue = 0;
    DWORD dDeviceErrorCode = 0;

    //*Variables PS*
    //Parameter
    BYTE uOpCode = OP_CODE;
    void* pDataBuffer=NULL;
    DWORD dDataBufferLength;
	BYTE ubKeepLock(1);

    //ReturnParameter
    void* pRetDataBuffer=NULL;
    DWORD dRetDataBufferLength = 0;

    BOOL oResult = FALSE;
    CErrorInfo comErrorInfo;
    CErrorInfo cmdErrorInfo;

    void* pDest;
    void* pSource;

    if(pCommand)
    {
        //Check CriticalSection
		if(!IsLocked(pCommand)) return FALSE;

		//GetParameterData
        pCommand->GetParameterData(PARAMETER_INDEX_NODE_ID, &uNodeId, sizeof(uNodeId));
        pCommand->GetParameterData(PARAMETER_INDEX_CONTROL_BYTE, &controlByte.bValue, sizeof(controlByte.bValue));

        //Check Max SegmentLength
        if(controlByte.structure.bLength > MAX_SEGMENT_LENGTH) controlByte.structure.bLength = MAX_SEGMENT_LENGTH;
        pData = malloc(controlByte.structure.bLength);
        pCommand->GetParameterData(PARAMETER_INDEX_DATA, pData, controlByte.structure.bLength);

        //Prepare DataBuffer
        dDataBufferLength = DATA_LENGTH + controlByte.structure.bLength;
        pDataBuffer = malloc(dDataBufferLength);

        //Data
        pDest = pDataBuffer;
        CopyData(pDest, &controlByte.bValue, sizeof(controlByte.bValue));
        CopyData(pDest, pData, controlByte.structure.bLength);

        //Execute Command
        oResult = PS_ProcessProtocol(pProtocolStackManager, hPS_Handle, hTransactionHandle, uOpCode, pDataBuffer, dDataBufferLength, ubKeepLock, &pRetDataBuffer, &dRetDataBufferLength, &comErrorInfo);

        //Check ReturnData Size
        if(oResult && (dRetDataBufferLength != RETURN_DATA_LENGTH))
        {
            if(m_pErrorHandling) m_pErrorHandling->GetError(k_Error_MaxonSerialV1_BadDataSizeReceived, &comErrorInfo);
            oResult = FALSE;
        }

        //ReturnData
        pSource = pRetDataBuffer;
        if(oResult) oResult = CopyReturnData(&dDeviceErrorCode, sizeof(dDeviceErrorCode), pSource, dRetDataBufferLength);
        if(oResult) oResult = CopyReturnData(&retControlByte.bValue, sizeof(retControlByte.bValue), pSource, dRetDataBufferLength);

        //Evaluate ErrorCode
        oResult = EvaluateErrorCode(oResult, dDeviceErrorCode, &comErrorInfo, &cmdErrorInfo);

        //Restore controlByte
        if(oResult && (controlByte.structure.bToggle != retControlByte.structure.bToggle))
        {
            if(m_pErrorHandling) m_pErrorHandling->GetError(ERROR_DEVICE_EPOS_TOGGLE, &cmdErrorInfo);
            oResult = FALSE;
        }

        //SetReturnParameterData
        pCommand->SetStatus(oResult, &cmdErrorInfo);
        pCommand->SetReturnParameterData(RETURN_PARAMETER_INDEX_ERROR_CODE, &dDeviceErrorCode, sizeof(dDeviceErrorCode));
        pCommand->SetReturnParameterData(RETURN_PARAMETER_INDEX_CONTROL_BYTE, &retControlByte, sizeof(retControlByte));

        //Free DataBuffer
        if(pData) free(pData);
        if(pDataBuffer) free(pDataBuffer);
        if(pRetDataBuffer) free(pRetDataBuffer);

		//Unlock CriticalSection
		if(!controlByte.structure.bMoreSegments || !oResult)
		{
			PS_AbortProtocol(pProtocolStackManager, hPS_Handle, hTransactionHandle);
			Unlock();
		}
    }

    return oResult;
}
BOOL CGatewayEpos2ToMaxonSerialV1::Process_SendLSSFrame(CCommand_DCS* pCommand, CProtocolStackManagerBase* pProtocolStackManager, HANDLE hPS_Handle, HANDLE hTransactionHandle)
{
    const BYTE MAX_FRAME_LENGTH = 8;

    //*Constants DCS*
    const int PARAMETER_INDEX_DATA = 0;
    const int RETURN_PARAMETER_INDEX_ERROR_CODE = 0;

    //*Constants PS*
    const BYTE OP_CODE = 0x30;
    const BYTE DATA_LENGTH = 8;

    //*Variables DCS*
    //Parameter
    BYTE maxFrameBuffer[MAX_FRAME_LENGTH];
    //Return Parameter
    DWORD dDeviceErrorCode = 0;

    //*Variables PS*
    //Parameter
    BYTE uOpCode = OP_CODE;
    void* pDataBuffer=NULL;
    DWORD dDataBufferLength;
	BYTE ubKeepLock(0);

    //ReturnParameter

    BOOL oResult = FALSE;
    CErrorInfo comErrorInfo;
    CErrorInfo cmdErrorInfo;

    void* pDest = NULL;
    void* pSource = NULL;

    if(pCommand)
    {
        //Lock CriticalSection
		if(!Lock(pCommand)) return FALSE;

		//Get DCS Parameter Data
        dDataBufferLength = pCommand->GetParameterLength(PARAMETER_INDEX_DATA);

        //Limit Length
        if(dDataBufferLength > MAX_FRAME_LENGTH) dDataBufferLength = MAX_FRAME_LENGTH;
        memset(maxFrameBuffer, 0, MAX_FRAME_LENGTH);
        pCommand->GetParameterData(PARAMETER_INDEX_DATA, maxFrameBuffer, dDataBufferLength);

        //Prepare DataBuffer
        dDataBufferLength = DATA_LENGTH;
        pDataBuffer = malloc(dDataBufferLength);

        //Data
        pDest = pDataBuffer;
        CopyData(pDest, maxFrameBuffer, MAX_FRAME_LENGTH);

        //Execute Command
        oResult = PS_SendFrame(pProtocolStackManager, hPS_Handle, hTransactionHandle, uOpCode, pDataBuffer, dDataBufferLength, &comErrorInfo);

        //Set DCS ReturnParameter Data
        pCommand->SetStatus(oResult, &cmdErrorInfo);

        if(pDataBuffer) free(pDataBuffer);

		//Unlock CriticalSection
		Unlock();
    }

    return oResult;
}
示例#9
0
CStudentYear CStudentYear::operator=( const CStudentYear& otherStudentYear ) {
	CopyData( otherStudentYear );
	return *this;
}
示例#10
0
CStudentYear::CStudentYear( const CStudentYear& otherStudentYear ) {
	CopyData( otherStudentYear );
}
示例#11
0
int CKData::MergeKData( CKData * pother )
{
	if( !pother || pother->GetSize() == 0 )
		return 0;
	if( GetKType() != pother->GetKType() )
		return 0;

	if( GetSize() == 0 )
	{
		CopyData( *pother );
		return GetSize();
	}

	int	nCount		= 0;
	SetSize( GetSize(), pother->GetSize()+1 );
	for( int i=0; i<pother->GetSize(); i++ )
	{
		KDATA	kdnew	=	pother->ElementAt(i);
		if( kdnew.m_fClose < 1e-4 || kdnew.m_fOpen < 1e-4 || kdnew.m_fHigh < 1e-4 || kdnew.m_fLow < 1e-4 )
			continue;

		for( int j=0; j<GetSize(); j++ )
		{
			if( kdnew.m_date == ElementAt(j).m_date )
			{
				SetAt(j,kdnew);
				break;
			}
			if( kdnew.m_date < ElementAt(j).m_date )
			{
				InsertAt(j,kdnew);
				break;
			}
		}
		if( GetSize() == j )
			Add( kdnew );
		nCount	++;
	}

	return nCount;

/*	The Old Version
	if( !pother || pother->GetSize() == 0 )
		return GetSize();
	if( GetKType() != pother->GetKType() )
		return GetSize();

	if( GetSize() == 0 )
	{
		CopyData( *pother );
		return GetSize();
	}

	int nLen = GetSize();
	int nLenOther = pother->GetSize();

	SP_ASSERT( 0 != nLen && 0 != nLenOther );

	if( ElementAt(nLen-1).m_date < pother->ElementAt(0).m_date )
		CopyData( *pother );
//	else if( ElementAt(0).m_date > pother->ElementAt(nLenOther-1).m_date )
//		;
//	else if( ElementAt(0).m_date <= pother->ElementAt(0).m_date
//		&& ElementAt(nLen-1).m_date >= pother->ElementAt(nLenOther-1).m_date )
//		;
	else if( ElementAt(0).m_date > pother->ElementAt(0).m_date
		&& ElementAt(nLen-1).m_date < pother->ElementAt(nLenOther-1).m_date )
		CopyData( *pother );
	else if( ElementAt(0).m_date <= pother->ElementAt(0).m_date
		&& ElementAt(nLen-1).m_date < pother->ElementAt(nLenOther-1).m_date )
	{
		// append from pother
		DWORD	date	=	ElementAt(nLen-1).m_date;
		SetSize( GetSize(), pother->GetSize() );
		for( int i=0; i<pother->GetSize(); i++ )
		{
			KDATA	& kd	=	pother->ElementAt(i);
			if( kd.m_date > m_data )
				Add( kd );
		}
	}
	else if( ElementAt(0).m_date >= pother->ElementAt(0).m_date
		&& ElementAt(nLen-1).m_date > pother->ElementAt(nLenOther-1).m_date )
	{
		// insert from pother
		CKData	temp	=	(*pother);
		DWORD	date	=	pother->ElementAt(nLenOther-1).m_date;
		temp.SetSize( temp.GetSize(), GetSize()+5 );
		for( int i=0; i<GetSize(); i++ )
		{
			KDATA	& kd	=	ElementAt(i);
			if( kd.m_date > date )
				temp.Add( kd );
		}
		CopyData( temp );
	}
	
	return GetSize();
*/
}
示例#12
0
CAssessmentRecord CAssessmentRecord::operator=( const CAssessmentRecord& otherRecord ) {
	CopyData( otherRecord );
	return *this;
}
示例#13
0
CAssessmentRecord::CAssessmentRecord( const CAssessmentRecord& otherRecord ) {
	CopyData( otherRecord );
}
示例#14
0
TCHAR * ParseText(const TCHAR *text,
	const TCHAR **variables, size_t variablesSize,
	const TCHAR **data, size_t dataSize)
{
	size_t length = mir_tstrlen(text);
	size_t nextPos = 0;
	StringHelper ret = {0};
	size_t i;

	// length - 1 because a % in last char will be a % and point
	for (i = 0 ; i < length - 1 ; i++)
	{
		if (text[i] == _T('%'))
		{
			BOOL found = FALSE;

			if (CopyData(&ret, &text[nextPos], i - nextPos))
				return NULL;

			if (text[i + 1] == _T('%'))
			{
				if (CopyData(&ret, _T("%"), 1))
					return NULL;

				i++;

				found = TRUE;
			}
			else
			{
				size_t size = min(variablesSize, dataSize);
				size_t j;

				// See if can find it
				for(j = 0 ; j < size ; j++)
				{
					size_t vlen = mir_tstrlen(variables[j]);

					if (_tcsnicmp(&text[i], variables[j], vlen) == 0)
					{
						if (CopyData(&ret, data[j], mir_tstrlen(data[j])))
							return NULL;

						i += vlen - 1;

						found = TRUE;

						break;
					}
				}
			}

			if (found)
				nextPos = i + 1;
			else
				nextPos = i;
		}
	}

	if (nextPos < length)
		if (CopyData(&ret, &text[nextPos], length - nextPos))
			return NULL;

	return ret.text;
}
示例#15
0
void CTextBuffer::WriteText( const char *pText )
{
	int len = strlen( pText );
	CopyData( pText, len );
}
示例#16
0
LONG CuDlgDomPropTblPages::OnUpdateData (WPARAM wParam, LPARAM lParam)
{
  // cast received parameters
  int nNodeHandle = (int)wParam;
  LPIPMUPDATEPARAMS pUps = (LPIPMUPDATEPARAMS)lParam;
  ASSERT (nNodeHandle != -1);
  ASSERT (pUps);

  // ignore selected actions on filters
  switch (pUps->nIpmHint)
  {
    case 0:
      //case FILTER_DOM_SYSTEMOBJECTS:
      //case FILTER_DOM_BASEOWNER:
      //case FILTER_DOM_OTHEROWNER:
      break;

    case FILTER_DOM_BKREFRESH_DETAIL:
      if (m_Data.m_refreshParams.MustRefresh(pUps->pSFilter->bOnLoad, pUps->pSFilter->refreshtime))
        break;    // need to update
      else
        return 0; // no need to update
      break;
    default:
      return 0L;    // nothing to change on the display
  }

  // Get info on the current item
  LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
  ASSERT (lpRecord);
  ResetDisplay();
  //
  // Get pages of table, even if system object (lpRecord->ownerName is "$ingres" )
  //
  INGRESPAGEINFO pageinfo;
  memset(&pageinfo, 0, sizeof(INGRESPAGEINFO));
  BOOL bOK = GetIngresPageInfo(nNodeHandle, lpRecord->extra, lpRecord->objName, lpRecord->ownerName, &pageinfo);
  if (!bOK) {
    // Need to reset pageinfo since has been partially filled by GetIngresPageInfo
    memset(&pageinfo, 0, sizeof(INGRESPAGEINFO));
    // "Cannot Access Page Information"
    MessageWithHistoryButton(m_hWnd, VDBA_MfcResourceString (IDS_E_PAGE_INFORMATION));
  }

  ASSERT (m_pPieCtrl && m_pPieCtrlHashTable);
  if (m_pPieCtrl && m_pPieCtrlHashTable)
  {
     //
     // Hash Table or Non-Hash Table. This value should be changed
     // upon the table's structure:
   //  BOOL bHashTable = TRUE; 
     ShowPieChartCtrl ((LPVOID)&pageinfo, pageinfo.bNewHash);

  /*
    double dPercent = 0.0;
    CString strTitle;
    CaPieInfoData* pData = m_pPieCtrl->GetPieInformation();
    pData->Cleanup();
    pData->SetCapacity ((double)pageinfo.ltotal, _T(""));
    if (pageinfo.linuse > 0)
    {
        dPercent = ((double)pageinfo.linuse / (double)pageinfo.ltotal) * 100.00;
        pData->AddPie2 (_T("In Use"), dPercent, RGB(0, 0, 192), (double)pageinfo.linuse);
    }
    else
        pData->AddLegend (_T("In Use"), RGB(0, 0, 192));

    if (pageinfo.lfreed > 0)
    {
        dPercent = ((double)pageinfo.lfreed / (double)pageinfo.ltotal) * 100.00;
        pData->AddPie2 (_T("Freed"), dPercent, RGB(0, 192, .0), (double)pageinfo.lfreed);
    }
    else
        pData->AddLegend (_T("Freed"), RGB(0, 192, .0));

    if (pageinfo.lneverused > 0)
    {
        dPercent = ((double)pageinfo.lneverused / (double)pageinfo.ltotal) * 100.00;
        pData->AddPie2 (_T("Never Used"), dPercent, RGB(255, 255, 0), (double)pageinfo.lneverused);
    }
    else
        pData->AddLegend (_T("Never Used"), RGB(255, 255, 0));

    if (pageinfo.loverflow > 0)
    {
        dPercent = ((double)pageinfo.loverflow / (double)pageinfo.ltotal) * 100.00;
        pData->AddPie2 (_T("Overflow"),  dPercent, RGB(255, 0, 0), (double)pageinfo.lneverused);
    }
    else
        pData->AddLegend (_T("Overflow"), RGB(255, 0, 0));

    strTitle.Format (_T("Total = %d"), pageinfo.ltotal);
    pData->SetTitle(strTitle);
    m_pPieCtrl->UpdateLegend();
    m_pPieCtrl->UpdatePieChart();
   */
  }
  // Update refresh info
  m_Data.m_refreshParams.UpdateRefreshParams();

  CopyData (&m_Data, &pageinfo, TRUE); // pageinfo -> m_Data

  // Refresh display
  RefreshDisplay();

  return 0L;
}
示例#17
0
void CuDlgDomPropTblPages::RefreshDisplay(INGRESPAGEINFO* pPageInfo)
{
  UpdateData (FALSE);   // Mandatory!

  // Exclusively use member variables of m_Data for display refresh

  m_cListCtrl.ShowWindow(SW_SHOW);   // can have been hidden by ResetDisplay()

  INGRESPAGEINFO pageinfo;
  CopyData (&m_Data, &pageinfo, FALSE); // m_Data -> pageinfo
  ShowPieChartCtrl ((LPVOID)&pageinfo, pageinfo.bNewHash);

  // MANAGE NOT DISPLAYABLE CASE ($SYSTEM AS OWNER, ETC...
  if (m_Data.m_pByteArray == NULL) {
    m_stRatio.ShowWindow   (SW_HIDE);
    m_cbRatio.ShowWindow   (SW_HIDE);
    m_stPct.ShowWindow     (SW_HIDE);
    m_stZeroPct.ShowWindow (SW_HIDE);
    m_st100Pct.ShowWindow  (SW_HIDE);
    HidePageTypeControls();
    m_cListCtrl.SetDataForDisplay(m_Data.m_lItemsPerByte,
                                  m_Data.m_nbElements, m_Data.m_pByteArray,
                                  m_Data.m_lCurPgPerCell);

    CString csValue(VDBA_MfcResourceString (IDS_NOT_AVAILABLE));//_T("N/A")
    GetDlgItem(IDC_EDIT_PAGES)->SetWindowText(csValue);
    GetDlgItem(IDC_EDIT_INUSE)->SetWindowText(csValue);
    GetDlgItem(IDC_EDIT_OVERFLOW)->SetWindowText(csValue);
    GetDlgItem(IDC_EDIT_FREED)->SetWindowText(csValue);
    GetDlgItem(IDC_EDIT_NEVERUSED)->SetWindowText(csValue);

    return;
  }

  // in case previously hidden
  m_stRatio.ShowWindow   (SW_SHOW);
  m_cbRatio.ShowWindow   (SW_SHOW);

  // fill combobox with set of values
  int goodSel = CB_ERR;
  m_cbRatio.ResetContent();
  CString csCbItem;
  csCbItem.Format(_T("%ld"), m_Data.m_lItemsPerByte);   // Most detailed possible
  int index = m_cbRatio.AddString(csCbItem);
  m_cbRatio.SetItemData(index, m_Data.m_lItemsPerByte);
  if (m_Data.m_lItemsPerByte == m_Data.m_lCurPgPerCell)
    goodSel = index;
  for (long lPgPerCell = m_Data.m_lItemsPerByte * 10;
       (m_Data.m_nbElements * m_Data.m_lItemsPerByte) * 10 > lPgPerCell;   // stop as soon as fits in only one cell
       lPgPerCell *= 10) {
    csCbItem.Format(_T("%ld"), lPgPerCell);
    index = m_cbRatio.AddString(csCbItem);
    m_cbRatio.SetItemData(index, lPgPerCell);
    if (lPgPerCell == m_Data.m_lCurPgPerCell)
      goodSel = index;
  }

  // Selection on "current number of pages per cell"
  ASSERT (goodSel != CB_ERR);     
  m_cbRatio.SetCurSel(goodSel);

  // Show/hide 0% - 100% cells indicators according to current number of pages per cell
  m_stPct.ShowWindow     ( (m_Data.m_lCurPgPerCell == 1) ? SW_HIDE : SW_SHOW);
  m_stZeroPct.ShowWindow ( (m_Data.m_lCurPgPerCell == 1) ? SW_HIDE : SW_SHOW);
  m_st100Pct.ShowWindow  ( (m_Data.m_lCurPgPerCell == 1) ? SW_HIDE : SW_SHOW);
  if (m_Data.m_lCurPgPerCell == 1)
    ShowPageTypeControls();
  else
    HidePageTypeControls();

  // display cells - using current number of displayed pages per cell
  ASSERT (m_Data.m_lCurPgPerCell % m_Data.m_lItemsPerByte == 0);
  m_cListCtrl.SetDataForDisplay(m_Data.m_lItemsPerByte,
                                m_Data.m_nbElements, m_Data.m_pByteArray,
                                m_Data.m_lCurPgPerCell);

  CString csValue;
  csValue.Format(_T("%ld"), m_Data.m_lTotal);
  GetDlgItem(IDC_EDIT_PAGES)->SetWindowText(csValue);
  csValue.Format(_T("%ld"), m_Data.m_lInUse);
  GetDlgItem(IDC_EDIT_INUSE)->SetWindowText(csValue);
  csValue.Format(_T("%ld"), m_Data.m_lOverflow);
  GetDlgItem(IDC_EDIT_OVERFLOW)->SetWindowText(csValue);
  csValue.Format(_T("%ld"), m_Data.m_lFreed);
  GetDlgItem(IDC_EDIT_FREED)->SetWindowText(csValue);
  csValue.Format(_T("%ld"), m_Data.m_lNeverUsed);
  GetDlgItem(IDC_EDIT_NEVERUSED)->SetWindowText(csValue);

}
示例#18
0
/************************************************
 * Public Operators
 ***********************************************/
CDisplayInfo CDisplayInfo::operator=(const CDisplayInfo &ob)
{
	CopyData(ob);

    return *this;
}
BOOL CGatewayEpos2ToMaxonSerialV1::Process_InitiateSegmentedWrite(CCommand_DCS* pCommand, CProtocolStackManagerBase* pProtocolStackManager, HANDLE hPS_Handle, HANDLE hTransactionHandle)
{
    //*Constants DCS*
    const int PARAMETER_INDEX_INDEX = 0;
    const int PARAMETER_INDEX_SUB_INDEX = 1;
    const int PARAMETER_INDEX_NODE_ID = 2;
    const int PARAMETER_INDEX_OBJECT_LENGTH = 3;
    const int RETURN_PARAMETER_INDEX_ERROR_CODE = 0;

    //*Constants PS*
    const BYTE OP_CODE = 0x13;
    const BYTE DATA_LENGTH = 8;
    const BYTE RETURN_DATA_LENGTH = 4;

    //*Variables DCS*
    //Parameter
    WORD wIndex = 0;
    BYTE uSubIndex = 0;
    BYTE uNodeId = 0;
    DWORD dObjectLength = 0;
    //Return Parameter
    DWORD dDeviceErrorCode = 0;

    //*Variables PS*
    //Parameter
    BYTE uOpCode = OP_CODE;
    void* pDataBuffer = NULL;
    DWORD dDataBufferLength;
	BYTE ubKeepLock(1);

    //ReturnParameter
    void* pRetDataBuffer = NULL;
    DWORD dRetDataBufferLength = 0;

    BOOL oResult = FALSE;
    CErrorInfo comErrorInfo;
    CErrorInfo cmdErrorInfo;

    void* pDest;
    void* pSource;

    if(pCommand)
    {
        //Lock CriticalSection
		if(!Lock(pCommand)) return FALSE;

		//Get DCS Parameter Data
        pCommand->GetParameterData(PARAMETER_INDEX_INDEX, &wIndex, sizeof(wIndex));
        pCommand->GetParameterData(PARAMETER_INDEX_SUB_INDEX, &uSubIndex, sizeof(uSubIndex));
        pCommand->GetParameterData(PARAMETER_INDEX_NODE_ID, &uNodeId, sizeof(uNodeId));
        pCommand->GetParameterData(PARAMETER_INDEX_OBJECT_LENGTH, &dObjectLength, sizeof(dObjectLength));

        //Prepare DataBuffer
        dDataBufferLength = DATA_LENGTH;
        pDataBuffer = malloc(dDataBufferLength);

        //Data
        pDest = pDataBuffer;
        CopyData(pDest, &wIndex, sizeof(wIndex));
        CopyData(pDest, &uSubIndex, sizeof(uSubIndex));
        CopyData(pDest, &uNodeId, sizeof(uNodeId));
        CopyData(pDest, &dObjectLength, sizeof(dObjectLength));

        //Execute Command
        oResult = PS_ProcessProtocol(pProtocolStackManager, hPS_Handle, hTransactionHandle, uOpCode, pDataBuffer, dDataBufferLength, ubKeepLock, &pRetDataBuffer, &dRetDataBufferLength, &comErrorInfo);

        //Check ReturnData Size
        if(oResult && (dRetDataBufferLength != RETURN_DATA_LENGTH))
        {
            if(m_pErrorHandling) m_pErrorHandling->GetError(k_Error_MaxonSerialV1_BadDataSizeReceived, &comErrorInfo);
            oResult = FALSE;
        }

        //ReturnData
        pSource = pRetDataBuffer;
        if(oResult) oResult = CopyReturnData(&dDeviceErrorCode, sizeof(dDeviceErrorCode), pSource, dRetDataBufferLength);

        //Evaluate ErrorCode
        oResult = EvaluateErrorCode(oResult, dDeviceErrorCode, &comErrorInfo, &cmdErrorInfo);

        //SetReturnParameterData
        pCommand->SetStatus(oResult, &cmdErrorInfo);
        pCommand->SetReturnParameterData(RETURN_PARAMETER_INDEX_ERROR_CODE, &dDeviceErrorCode, sizeof(dDeviceErrorCode));

        //Free DataBuffer
        if(pDataBuffer) free(pDataBuffer);
        if(pRetDataBuffer) free(pRetDataBuffer);

		//Unlock CriticalSection
		if(!oResult)
		{
			PS_AbortProtocol(pProtocolStackManager, hPS_Handle, hTransactionHandle);
			Unlock();
		}
    }

    return oResult;
}
示例#20
0
// Copy Constructor
CDisplayInfo::CDisplayInfo(const CDisplayInfo &ob)
{
	CopyData(ob);
}
BOOL CGatewayEpos2ToMaxonSerialV1::Process_SendNMTService(CCommand_DCS* pCommand, CProtocolStackManagerBase* pProtocolStackManager, HANDLE hPS_Handle, HANDLE hTransactionHandle)
{
    const WORD RESET_NODE = 129;
    const WORD RESET_COMMUNICATION = 130;

    //*Constants DCS*
    const int PARAMETER_INDEX_NODE_ID = 0;
    const int PARAMETER_INDEX_CMD_SPECIFIER = 1;

    //*Constants PS*
    const BYTE OP_CODE = 0x0E;
    const BYTE DATA_LENGTH = 4;

    //*Variables DCS*
    //Parameter
    WORD wId = 0;
    WORD wCmdSpecifier = 0;

    //*Variables PS*
    //Parameter
    BYTE uOpCode = OP_CODE;
    void* pDataBuffer=NULL;
    DWORD dDataBufferLength = 0;
	BYTE ubKeepLock(0);

    //ReturnParameter

    BOOL oResult = FALSE;
    CErrorInfo comErrorInfo;
    CErrorInfo cmdErrorInfo;

    void* pDest = NULL;
    void* pSource = NULL;

    if(pCommand)
    {
        //Lock CriticalSection
		if(!Lock(pCommand)) return FALSE;

		//Get DCS Parameter Data
        pCommand->GetParameterData(PARAMETER_INDEX_NODE_ID, &wId, sizeof(wId));
        pCommand->GetParameterData(PARAMETER_INDEX_CMD_SPECIFIER, &wCmdSpecifier, sizeof(wCmdSpecifier));

        //Prepare DataBuffer
        dDataBufferLength = DATA_LENGTH;
        pDataBuffer = malloc(dDataBufferLength);

        //Data
        pDest = pDataBuffer;
        CopyData(pDest, &wId, sizeof(wId));
        CopyData(pDest, &wCmdSpecifier, sizeof(wCmdSpecifier));

        //Execute Command
        oResult = PS_SendFrame(pProtocolStackManager, hPS_Handle, hTransactionHandle, uOpCode, pDataBuffer, dDataBufferLength, &comErrorInfo);

        //No EndAck when ResetNode or ResetCommunication
        if((wCmdSpecifier == RESET_NODE) || (wCmdSpecifier == RESET_COMMUNICATION))
        {
            oResult = TRUE;
            comErrorInfo.Reset();
        }

        //Set DCS ReturnParameter Data
        pCommand->SetStatus(oResult, &cmdErrorInfo);

        if(pDataBuffer) free(pDataBuffer);

		//Unlock CriticalSection
		Unlock();
    }

    return oResult;
}
示例#22
0
aText::aText(const aText& src) { CopyData(src); }
示例#23
0
// FindEnclosed
bool COpcTextReader::FindEnclosed(COpcText& cToken)
{
    OPC_ASSERT(m_szBuf != NULL);
    OPC_ASSERT(m_uLength != 0);
      
    WCHAR zStart = 0;
    WCHAR zEnd   = 0;
    cToken.GetBounds(zStart, zEnd);

    // skip leading whitespace
    UINT uPosition = SkipWhitespace(cToken);

    // check if there is still data left to read.
    if (uPosition >= m_uEndOfData)
    {
        return false;
    } 

    // read until finding the start delimiter,
    for (UINT ii = uPosition; ii < m_uEndOfData; ii++)
    {
        // check if search halted.
        if (CheckForHalt(cToken, ii))
        {
            return false;
        }

        // check for start character.
        if (IsEqual(cToken, m_szBuf[ii], zStart)) 
        {
            uPosition = ii;
            break;
        }
    }
    
    // check if there is still data left to read.
    if (ii >= m_uEndOfData)
    {
        return false;
    } 

    // read until finding the end delimiter,
    for (ii = uPosition+1; ii < m_uEndOfData; ii++)
    {
        // check if search halted.
        if (CheckForHalt(cToken, ii))
        {
            return false;
        }

        // check for end character.
        if (IsEqual(cToken, m_szBuf[ii], zStart)) 
        {
            // ignore if character is escaped.
            if (cToken.GetAllowEscape() && (uPosition < ii-1))
            {
                if (m_szBuf[ii-1] == L'\\')
                {
                    continue;
                }
            }

            // copy token - empty tokens are valid.
            CopyData(cToken, uPosition+1, ii);
            return true;
        }
    }

    return false;
}
示例#24
0
aText& aText::operator=(const aText& src)
{
	CopyData(src);
	return *this;
}
示例#25
0
aAnimTextListItem::aAnimTextListItem( const aAnimTextListItem& src )
{
	CopyData( src );
}
示例#26
0
BOOL CStockContainer::RetrieveFromStatic( int nType, LPCTSTR lpszDomain, CStrategy * pStrategy, DWORD dwDate )
{
	CSPMutex::Scoped	l(m_mutex);

	Clear( );

	if( nType == typeNone )
	{
		m_nType	=	typeNone;
		return TRUE;
	}

	if( nType < typeMin || nType > typeMax )
		return FALSE;
	m_nType		=	nType;

	m_dwDate	=	dwDate;
	
	CSPStringArray	astrSpecify;

	switch( nType )
	{
	case typeAll:
		CopyData( AfxGetStockContainer() );
		break;
	case typeIndex:
	case typeA:
	case typeBond:
	case typeFund:
	case typeClassShaa:
	case typeClassShab:
	case typeClassSzna:
	case typeClassSznb:
	case typeClassShabond:
	case typeClassSznbond:
		{
			int	nCount	=	0;
			SetSize( 0, AfxGetStockContainer().GetSize() );
			for( int i=0; i<AfxGetStockContainer().GetSize(); i++ )
			{
				CStockInfo	& info = AfxGetStockContainer().ElementAt(i);
				LONG	stocktype	=	info.GetType();
				if( ( typeIndex == nType && CStock::typeshIndex == stocktype )
					|| ( typeIndex == nType && CStock::typeszIndex == stocktype )
					|| ( typeA == nType && (CStock::typeshA == stocktype || CStock::typeszA == stocktype) && !info.IsFund() )
					|| ( typeBond == nType && (CStock::typeshBond == stocktype || CStock::typeszBond == stocktype) )
					|| ( typeFund == nType && info.IsFund() )
					|| ( typeClassShaa == nType && CStock::typeshA == stocktype )
					|| ( typeClassShab == nType && CStock::typeshB == stocktype )
					|| ( typeClassSzna == nType && CStock::typeszA == stocktype )
					|| ( typeClassSznb == nType && CStock::typeszB == stocktype )
					|| ( typeClassShabond == nType && CStock::typeshBond == stocktype )
					|| ( typeClassSznbond == nType && CStock::typeszBond == stocktype ) )
				{
					Add( info );
					nCount	++;
				}
			}
			SetSize( nCount );
		}
		break;
	case typeStrategy:
		{
			if( pStrategy )
				RetrieveSpecify( pStrategy->GetStocks() );
		}
		break;
	case typeGroup:
		{
			if( lpszDomain && strlen(lpszDomain) > 0 )
			{
				AfxGetGroupContainer().GetDomainStocks( lpszDomain, astrSpecify );
				RetrieveSpecify( astrSpecify );
				m_strDomain	=	lpszDomain;
			}
			else
				return AfxGetGroupContainer().GetAllDomainInfo( this, m_dwDate );
		}
		break;
	case typeDomain:
		{
			if( lpszDomain && strlen(lpszDomain) > 0 )
			{
				AfxGetDomainContainer().GetDomainStocks( lpszDomain, astrSpecify );
				RetrieveSpecify( astrSpecify );
				m_strDomain	=	lpszDomain;
			}
			else
				return AfxGetDomainContainer().GetAllDomainInfo( this, m_dwDate );
		}
		break;
	default:
		SP_ASSERT( FALSE );
		SetMap( );
		SetAverage( );
		return FALSE;
	}

	SetMap( );

	DWORD	dwMainDate = -1;
	AfxGetStockContainer().GetCurrentType( NULL, NULL, &dwMainDate );
	if( m_dwDate != dwMainDate )
		OnDataChanged();
	else
		SetAverage( );
	return TRUE;
}
示例#27
0
BOOL CFoxBase::CopyTo(LPCTSTR pSourceTable, LPCTSTR pDestinationTable)
{
	CString SourceTable,DestinationTable;
	CString SQL;
	_RecordsetPtr IRecordS,IRecordD;
	FieldsPtr IFields;
	FieldPtr IField;

	if(pSourceTable==NULL || pDestinationTable==NULL)
	{
		ExceptionInfo(_T("Source table or destination table cann't be empty"));
		return FALSE;
	}

	SourceTable=pSourceTable;
	DestinationTable=pDestinationTable;

	SourceTable.TrimLeft();
	SourceTable.TrimRight();
	DestinationTable.TrimLeft();
	DestinationTable.TrimRight();

	if(SourceTable.IsEmpty() || DestinationTable.IsEmpty())
	{
		ExceptionInfo(_T("Source table or destination table cann't be empty"));
		return FALSE;
	}

	try
	{
		IRecordS.CreateInstance(__uuidof(Recordset));

		IRecordS->Open(_variant_t(pSourceTable),_variant_t((IDispatch*)GetConnect()),	
					  adOpenKeyset,adLockOptimistic,adCmdTable);
	}
	catch(_com_error &e)
	{
		ExceptionInfo(e);
		return FALSE;
	}
	
	SQL=CreateTableSQL(IRecordS,pDestinationTable);

	if(SQL.IsEmpty())
	{
		return FALSE;
	}

	try
	{
		GetConnect()->Execute(_bstr_t(SQL),NULL,adExecuteNoRecords);
	}
	catch(_com_error &e)
	{
		ExceptionInfo(e);
		return FALSE;
	}

	try
	{
		IRecordD.CreateInstance(__uuidof(Recordset));

		IRecordD->Open(_variant_t(pDestinationTable),_variant_t((IDispatch*)GetConnect()),	
					  adOpenKeyset,adLockOptimistic,adCmdTable);
	}
	catch(_com_error &e)
	{
		ExceptionInfo(e);
		return FALSE;
	}

	if(!CopyData(IRecordS,IRecordD))
	{
		return FALSE;
	}

	return TRUE;
}
void TagsOptionsDlg::OnButtonOK(wxCommandEvent &event)
{
	wxUnusedVar(event);
	CopyData();
	EndModal(wxID_OK);
}
示例#29
0
void CFX_WideTextBuf::operator=(const CFX_WideStringC& str) {
  CopyData(str.GetPtr(), str.GetLength() * sizeof(FX_WCHAR));
}
示例#30
0
int AcuEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
    ConvertHighASCII convHA, CString* pErrMsg) const
{
    NuError nerr;
    long len;
    int result = -1;

    ASSERT(IDOK != -1 && IDCANCEL != -1);
    if (which != kDataThread) {
        *pErrMsg = L"No such fork";
        goto bail;
    }

    len = (long) GetUncompressedLen();
    if (len == 0) {
        LOGI("Empty fork");
        result = IDOK;
        goto bail;
    }

    errno = 0;
    if (fseek(fpArchive->fFp, fOffset, SEEK_SET) < 0) {
        pErrMsg->Format(L"Unable to seek to offset %ld: %hs",
            fOffset, strerror(errno));
        goto bail;
    }

    SET_PROGRESS_BEGIN();

    /*
     * Generally speaking, anything in an ACU file is going to be small.
     *
     * To make life easy, we either unsqueeze the entire thing into a buffer
     * and then write that, or we do a file-to-file copy of the specified
     * number of bytes.
     */
    if (GetSqueezed()) {
        ExpandBuffer expBuf;
        bool lastCR = false;
        char* buf;
        long uncLen;

        nerr = UnSqueeze(fpArchive->fFp, (unsigned long) GetCompressedLen(),
                    &expBuf, false, 0);
        if (nerr != kNuErrNone) {
            pErrMsg->Format(L"File read failed: %hs", NuStrError(nerr));
            goto bail;
        }

        expBuf.SeizeBuffer(&buf, &uncLen);
        LOGI("Unsqueezed %ld bytes to %d", len, uncLen);

        // some bonehead squeezed a zero-length file
        if (uncLen == 0) {
            ASSERT(buf == NULL);
            LOGI("Handling zero-length squeezed file!");
            result = IDOK;
            goto bail;
        }

        int err = GenericEntry::WriteConvert(outfp, buf, uncLen, &conv,
                        &convHA, &lastCR);
        if (err != 0) {
            pErrMsg->Format(L"File write failed: %hs", strerror(err));
            delete[] buf;
            goto bail;
        }

        delete[] buf;
    } else {
        nerr = CopyData(outfp, conv, convHA, pErrMsg);
        if (nerr != kNuErrNone) {
            if (pErrMsg->IsEmpty()) {
                pErrMsg->Format(L"Failed while copying data: %hs\n",
                    NuStrError(nerr));
            }
            goto bail;
        }
    }

    result = IDOK;

bail:
    SET_PROGRESS_END();
    return result;
}