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

C++ MemCopy函数代码示例

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

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



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

示例1: Unimplemented2

u32 mxRenderMesh::CopyFromMesh( const ::irr::scene::IMesh* mesh )
{
	if ( mesh->getMeshBufferCount() > 0 )
	{
		if ( mesh->getMeshBufferCount() > 1 ) {
			Unimplemented2( "multiple mesh buffers" );
		}

		::irr::scene::IMeshBuffer * pBuf = mesh->getMeshBuffer( 0 );
		Assert( pBuf );

		Assert2( pBuf->getIndexType() == ::irr::video::E_INDEX_TYPE::EIT_16BIT, "only 16-bit indices are supported !" );
		Assert2( pBuf->getVertexType() == ::irr::video::E_VERTEX_TYPE::EVT_STANDARD, "only standard vertex type is supported !" );

		const TVertex *	pVertices = ( TVertex* ) pBuf->getVertices();
		const u32  vertexCount = pBuf->getVertexCount();

		Vertices.SetNum( vertexCount );
		MemCopy( Vertices.Ptr(), pVertices, vertexCount * sizeof( TVertex ) );

		const TIndex * pIndices = pBuf->getIndices();
		const u32  triangleCount = pBuf->getIndexCount() / 3;

		Triangles.SetNum( triangleCount );
		MemCopy( Triangles.Ptr(), pIndices, pBuf->getIndexCount() * sizeof( TIndex ) );

	//	GCommon->DebugPrint( "* Loaded mesh: %u verts, %u tris\n", vertexCount, triangleCount );

		return triangleCount;
	}
	return 0;
}
开发者ID:tecan,项目名称:Luna,代码行数:32,代码来源:Mesh.cpp


示例2: StartReceiveImages

void StartReceiveImages()
{
    uint16_t rowReceived = 0;
    uint16_t bytesInRowReceived = 0;
    uint16_t const bytesInARow = 720;

    while (true)
        {
            RefreshButtonState(&leftButton, NULL);
            RefreshButtonState(&rightButton, NULL);

            RefreshLEDState(false, LED_MAX_BRIGHTNESS);

            if (NRF24L01_DataReady())
            {
                NRF24L01_GetData(dataIn);

                if (!mem_cmp(startCommand, dataIn, 32))
                {
                    RefreshLEDState(true, LED_MAX_BRIGHTNESS);
                    Delay_ms(50);

                    _receivingImage = 1;
                    rowReceived = 0;
                    bytesInRowReceived = 0;

                    LCDInitializeDataSend();
                    continue;
                }

                if (_receivingImage)
                {
                    MemCopy(dataIn, rowData, 0, bytesInRowReceived, 32);
                    bytesInRowReceived += 32;

                    if (bytesInRowReceived >= bytesInARow)
                    {
                        LCDFillRow(rowData);
                        bytesInRowReceived = bytesInRowReceived - bytesInARow;
                        MemCopy(dataIn, rowData, bytesInRowReceived, 0, bytesInRowReceived);

                        rowReceived++;

                        if (rowReceived == 320)
                        {
                            RefreshLEDState(false, LED_MAX_BRIGHTNESS);

                            _receivingImage = 0;
                            rowReceived = 0;
                            bytesInRowReceived = 0;

                            LCDFinishDataSend();
                        }
                    }
                }
            }
        }
}
开发者ID:AntonLynnyk,项目名称:Embedded,代码行数:58,代码来源:main.c


示例3: MemCopy

HTREEITEM CTreeCtrl::FindItem(LPCSTR pText,BOOL bBackwardDirection,BOOL bPartial,HTREEITEM hItem,HTREEITEM hEnd) const
{
	TV_ITEMA ti;
	char szBuffer[1000];
	ti.mask=TVIF_TEXT;
	ti.hItem=hItem;
	ti.pszText=szBuffer;
	ti.cchTextMax=1000;

	LPSTR pTextMod;
	
	if (bPartial)
	{
		int iStrLen=istrlen(pText);
		pTextMod=new char[iStrLen+3];
		if (pText[0]!='*')
		{
			pTextMod[0]='*';
			MemCopy(pTextMod+1,pText,iStrLen++);
		}
		else
			MemCopy(pTextMod,pText,iStrLen);
		if (pTextMod[iStrLen-1]!='*')
			pTextMod[iStrLen++]='*';
		pTextMod[iStrLen]='\0';
		MakeLower(pTextMod);
	}
		
	while ((ti.hItem=bBackwardDirection?GetPrevItem(ti.hItem):GetNextItem(ti.hItem))!=NULL)
	{
		// Get next item
		if (ti.hItem==hEnd)
			return NULL;

		// Check text
		if (!GetItem(&ti))
			continue;

		

		if (bPartial)
		{
			MakeLower(szBuffer);
			if (ContainString(szBuffer,pTextMod))
			{
				delete[] pTextMod;
				return ti.hItem;
			}
		}
		else if (_stricmp(szBuffer,pText)==0)
			return ti.hItem;		
	}

	if (bPartial)
		delete[] pTextMod;
	return NULL;
}
开发者ID:joshball,项目名称:locate32-cogit.net,代码行数:57,代码来源:CommonControls.cpp


示例4: main

void main(void)
{
	InitSysCtrl();
// Copy time critical code and Flash setup code to RAM
// This includes the following ISR functions: epwm1_timer_isr(), epwm2_timer_isr()
// epwm3_timer_isr and and InitFlash();
// The  RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart
// symbols are created by the linker. Refer to the F28335.cmd file.

// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
	DINT;
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the DSP2833x_PieCtrl.c file.
	InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
	IER = 0x0000;
	IFR = 0x0000;
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example.  This is useful for debug purposes.
// The shell ISR routines are found in DSP2833x_DefaultIsr.c.
// This function is found in DSP2833x_PieVect.c.
	InitPieVectTable();
// Interrupts that are used in this example are re-mapped to
// ISR functions found within this file.
	EALLOW;  // This is needed to write to EALLOW protected registers
	PieVectTable.SEQ1INT = &PWM_AD_isr;
	PieVectTable.ECAN0INTA = &Skiip4_CAN_isr;
	EDIS;     // This is needed to disable write to EALLOW protected registers 
	
	InitFlash();
	MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
	MemCopy(&IQmathLoadStart, &IQmathLoadEnd, &IQmathRunStart);

	//ECan-A模块初始化
	InitECan();
	InitECan1();

	InitGpio();  // Skipped for this example 
	InitAdc();							// Initialize necessary ADC module, directly for SVPWM.
	InitEPwm();
  



	IER |= M_INT1; 
// Enable SEQ1_INT which is connected to PIE1.1:
    IER |= M_INT9;
// Enable eCAN0-A INT which is connected to PIE9.5:


	EINT;
} // end of main()
开发者ID:nuaaabb,项目名称:nuaabb,代码行数:57,代码来源:Main.c


示例5: MemSwap

inline void
MemSwap( T* a, T* b, T* temp, size_t numEntries )
{
    // temp := a
    MemCopy( temp, a, numEntries );
    // a := b
    MemCopy( a, b, numEntries );
    // b := temp
    MemCopy( b, temp, numEntries );
}
开发者ID:nooperpudd,项目名称:Elemental,代码行数:10,代码来源:impl.hpp


示例6: entry

const DistMatrix<T,STAR,STAR>&
DistMatrix<T,STAR,STAR>::operator=( const DistMatrix<T,STAR,VR>& A )
{
#ifndef RELEASE
    CallStackEntry entry("[* ,* ] = [* ,VR]");
    this->AssertNotLocked();
    this->AssertSameGrid( A.Grid() );
#endif
    const elem::Grid& g = this->Grid();
    this->ResizeTo( A.Height(), A.Width() );
    if( !this->Participating() )
        return *this;

    const Int p = g.Size();
    const Int height = this->Height();
    const Int width = this->Width();
    const Int localWidthOfA = A.LocalWidth();
    const Int maxLocalWidth = MaxLength(width,p);

    const Int portionSize = mpi::Pad( height*maxLocalWidth );
    T* buffer = this->auxMemory_.Require( (p+1)*portionSize );
    T* sendBuf = &buffer[0];
    T* recvBuf = &buffer[portionSize];

    // Pack
    const Int ALDim = A.LDim();
    const T* ABuf = A.LockedBuffer();
    PARALLEL_FOR
    for( Int jLoc=0; jLoc<localWidthOfA; ++jLoc )
        MemCopy( &sendBuf[jLoc*height], &ABuf[jLoc*ALDim], height );

    // Communicate
    mpi::AllGather
    ( sendBuf, portionSize,
      recvBuf, portionSize, g.VRComm() );

    // Unpack
    T* thisBuf = this->Buffer();
    const Int thisLDim = this->LDim();
    const Int rowAlignmentOfA = A.RowAlignment();
    OUTER_PARALLEL_FOR
    for( Int k=0; k<p; ++k )
    {
        const T* data = &recvBuf[k*portionSize];
        const Int rowShift = Shift_( k, rowAlignmentOfA, p );
        const Int localWidth = Length_( width, rowShift, p );
        INNER_PARALLEL_FOR
        for( Int jLoc=0; jLoc<localWidth; ++jLoc )
            MemCopy
            ( &thisBuf[(rowShift+jLoc*p)*thisLDim], 
              &data[jLoc*height], height );
    }
    this->auxMemory_.Release();
    return *this;
}
开发者ID:khalid-hasanov,项目名称:Elemental,代码行数:55,代码来源:star_star.cpp


示例7: WriteNewLineObject

/***************************************************************************
*
*   Function to put the string into the buffer
*
***************************************************************************/
SINT    WriteNewLineObject(MEMPTR lpMem, MEMPTR Obj)
{
    SINT    Res1, Res2;

    Res1 = lstrlen(NewLine);
    MemCopy(lpMem, NewLine, Res1);

    lpMem += Res1;
    Res2 = lstrlen(Obj);
    MemCopy(lpMem, Obj, Res2);
    return( Res1 + Res2 );
}
开发者ID:conioh,项目名称:os-design,代码行数:17,代码来源:csprof.c


示例8: AsnLexReadOctets

/*****************************************************************************
*
*   ByteStorePtr AsnLexReadOctets(aip, atp)
*   	expects Octets type next
*   	assumes none of it has already been read
*   	does not advance to next token
*   	atp points to the definition of this OCTET STRING
*
*****************************************************************************/
NLM_EXTERN ByteStorePtr AsnLexReadOctets (AsnIoPtr aip, AsnTypePtr atp)
{
	Int2 token, len;
	ByteStorePtr ssp = NULL;
	Byte tbuf[256]; /* was 101 - changed to handle occasional hand-edited ASN.1? */
	Int4 bytes, left, added;

	token = AsnLexWord(aip);      /* read the start */
	if (token != START_BITHEX)
	{
		AsnIoErrorMsg(aip, 45, AsnErrGetTypeName(atp->name), aip->linenumber);
		return NULL;
	}
	ssp = BSNew(0);
	if (ssp == NULL) return ssp;
	token = AsnLexWord(aip);   /* read the octet(s) */
	left = 0;
	while (token == IN_BITHEX)
	{
		len = (Int2)(aip->wordlen + left);
		MemCopy((tbuf + left), aip->word, (len - left));
		tbuf[len] = '\0';
		added = AsnTypeStringToHex(tbuf, len, tbuf, &left);
		if (added < 0)
		{
			AsnIoErrorMsg(aip, 46, AsnErrGetTypeName(atp->name), aip->linenumber);
			return NULL;
		}
		if (added)
		{
			bytes = BSWrite(ssp, tbuf, added);
			if (bytes != added)
			{
				ssp = BSFree(ssp);
				return ssp;
			}
		}
		if (left)   /* left a char */
		{
			MemCopy(tbuf, ((aip->word)+(aip->wordlen - left)),left);
		}

		token = AsnLexWord(aip);
	}
	
	if (token != OCTETS)
	{
		AsnIoErrorMsg(aip, 47, AsnErrGetTypeName(atp->name), aip->linenumber);
		return NULL;
	}

	return ssp;
}
开发者ID:fbtestrepo,项目名称:hw,代码行数:62,代码来源:asnlex.c


示例9: BlendFill

inline void BlendFill(
    NormalPixel                   color,
    GenericPixelPtr<DstPixelType> d_line,
    const unsigned char          *a_line,
    int                           a_pitch,
    int     w,
    int     h,
    bool    inverted,
    int     alpha_0,
    int     alpha_1 )
{
    size_t line_size = w * sizeof(DstPixelType);
    MemBlock d_cache( line_size );

    while ( h-- )
    {
        MemCopy( d_cache.GetPtr(), (DstPixelType*)d_line, line_size );

        DstPixelType *d_ptr = (DstPixelType*)d_cache.GetPtr();
        const unsigned char *a_ptr = a_line;

        if ( alpha_0>0 || alpha_1<256 ) 
        {
            if (!inverted)
                for ( int i=w; i--; ++a_ptr, ++d_ptr )
                {
                    BlendPixel( *d_ptr, color, *a_ptr *(alpha_1-alpha_0)/256+alpha_0 );
                }
            else
                for ( int i=w; i--; ++a_ptr, ++d_ptr )
                {
                    BlendPixel( *d_ptr, color, (255-*a_ptr) *(alpha_1-alpha_0)/256+alpha_0 );
                }
        }
        else if (!inverted)
            for ( int i=w; i--; ++a_ptr, ++d_ptr )
            {
                BlendPixel( *d_ptr, color, *a_ptr );
            }
        else
            for ( int i=w; i--; ++a_ptr, ++d_ptr )
            {
                BlendPixel( *d_ptr, color, 255-*a_ptr );
            }
        MemCopy( (DstPixelType*)d_line, d_cache.GetPtr(), line_size );

        d_line.Next();
        a_line += a_pitch;
    }
}
开发者ID:BackupTheBerlios,项目名称:utgs-svn,代码行数:50,代码来源:MemorySurface.cpp


示例10: buffer

    static void Func
    ( DistMatrix<T,STAR,MR>& A, T center, typename Base<T>::type radius )
    {
        const Grid& grid = A.Grid();
        const int m = A.Height();
        const int localWidth = A.LocalWidth();
        const int bufSize = m*localWidth;
        std::vector<T> buffer( bufSize );

        // Create random matrix on process row 0, then broadcast
        if( grid.Row() == 0 )
        {
            for( int j=0; j<localWidth; ++j )
                for( int i=0; i<m; ++i )
                    buffer[i+j*m] = center+radius*SampleUnitBall<T>();
        }
        mpi::Broadcast( &buffer[0], bufSize, 0, grid.ColComm() );

        // Unpack
        T* localBuffer = A.LocalBuffer();
        const int ldim = A.LocalLDim();
#ifdef HAVE_OPENMP
        #pragma omp parallel for
#endif
        for( int jLocal=0; jLocal<localWidth; ++jLocal )
        {
            const T* bufferCol = &buffer[jLocal*m];
            T* col = &localBuffer[jLocal*ldim];
            MemCopy( col, bufferCol, m );
        }
    }
开发者ID:jimgoo,项目名称:Elemental,代码行数:31,代码来源:Uniform.hpp


示例11: PrintNextImage

void PrintNextImage(volatile void *uselessParameter)
{
    _receivingImage = 0;

    if (previousFileIsValid)
    {
        uint16_t stringLength = strlen(fno.fname) + 1;
        MemCopy(fno.fname, previousFileName, 0, 0, stringLength);
    }

    FRESULT res;
    res = pf_readdir(&dir, &fno);

    if (res == FR_NO_FILE)
    {
        char *rootDir = " ";
        pf_opendir(&dir, rootDir);

        res = pf_readdir(&dir, &fno);
        if (res == FR_NO_FILE)
        {
            return;
        }
    }

    if (!CheckBMPImage(fno.fname))
    {
        previousFileIsValid = true;
        PrintImage(fno.fname);
    }
}
开发者ID:AntonLynnyk,项目名称:Embedded,代码行数:31,代码来源:main.c


示例12: allocstringW

LPWSTR allocstringW(UINT nID,TypeOfResourceHandle bType)
{
	LPWSTR szBuffer;
	szBuffer=new WCHAR[STR_LOADSTRINGBUFLEN];
	if (szBuffer==NULL)
	{
		SetHFCError(HFC_CANNOTALLOCATE);
		return NULL;
	}
	UINT nDataLen=::LoadString(nID,szBuffer,STR_LOADSTRINGBUFLEN,bType);
	if (nDataLen>=STR_LOADSTRINGBUFLEN-2)
	{
		for (DWORD i=2;nDataLen>=i*STR_LOADSTRINGBUFLEN-2;i++)
		{
			delete[] szBuffer;
			szBuffer=new WCHAR[i*STR_LOADSTRINGBUFLEN];
			nDataLen=::LoadString(nID,szBuffer,i*STR_LOADSTRINGBUFLEN,bType);
		}
	}

	WCHAR* pText=new WCHAR[nDataLen+1];
	MemCopy(pText,szBuffer,(nDataLen+1)*2);
	delete[] szBuffer;
	return pText;
}
开发者ID:joshball,项目名称:locate32-cogit.net,代码行数:25,代码来源:Strings.cpp


示例13: MergeIDATs

/* Collapse multiple IDAT chunks into single one. */
static void MergeIDATs(PngT *png) {
  if (png->idat.next) {
    uint32_t length, i;
    uint8_t *data;
    IdatT *idat;

    for (idat = &png->idat, length = 0; idat; idat = idat->next)
      length += idat->length;

    LOG("Merged chunk length: %d.", length);

    data = MemNew(length);

    for (idat = &png->idat, i = 0; idat;) {
      IdatT *next = idat->next;

      MemCopy(data + i, idat->data, idat->length);
      i += idat->length;

      MemUnref(idat->data);
      if (idat != &png->idat)
        MemUnref(idat);

      idat = next;
    }

    png->idat.data = data;
    png->idat.length = length;
    png->idat.next = NULL;
  }
}
开发者ID:cahirwpz,项目名称:demoscene,代码行数:32,代码来源:png.c


示例14: GapSetReconnectionAddress

extern void GapSetReconnectionAddress(uint8 *p_val)
{
    if(p_val == NULL)
    {
        MAKE_RECONNECTION_ADDRESS_INVALID();
    }

    else
    {
        /* Every byte of re-connection address is stored as a word in the
         * firmware buffer. So, first create a variable of type BD_ADDR_T
         * and copy the data from the firmware buffer to this variable.
         */
        BD_ADDR_T temp_reconnect_address;
        temp_reconnect_address.lap = p_val[0] | p_val[1] << 8 | 
                                                         (uint24)p_val[2] << 16;
        temp_reconnect_address.uap = p_val[3];
        temp_reconnect_address.nap = p_val[4] | p_val[5] << 8;
        MemCopy(&g_gap_data.reconnect_address, &temp_reconnect_address,
                                                        sizeof(BD_ADDR_T));        
    }
    
    /* Write re-connection address to NVM */
    Nvm_Write((uint16*)&g_gap_data.reconnect_address,
                          sizeof(BD_ADDR_T),
                          g_gap_data.nvm_offset + 
                          GAP_NVM_DEVICE_RECONNECTION_ADDRESS_OFFSET);

    /* The updated reconnection address needs to be in whitelist as the remote
     * host may connect using this address during re-connection.
     */
    AppUpdateWhiteList();
}
开发者ID:NemProjects,项目名称:CSR1010-MMA9550,代码行数:33,代码来源:gap_service.c


示例15: PrintStackSortNextItem

/*****************************************************************************
*
*   PrintStackSortNextItem(dest, src, index, indent, next)
*   	Copies src[index] item to next available slot in dest
*   	Also copies sorted list of any subcomponents
*   	returns index to next item (based on sort_key) at this indent level
*   	returns -1 when no more items
*
*****************************************************************************/
static void PrintStackSortNextItem (PrintStackPtr dest, PrintStackPtr src,
	Int2 index,	Int2 indent)
{
	Int2 tmp, max_key, min_key;
	PrintStackItemPtr from, to;


	if ((dest == NULL) || (src == NULL)) return;

	to = PrintStackItemNew(dest);                  /* copy the one */
	from = src->data + index;
	MemCopy(to, from, sizeof(PrintStackItem));
	min_key = from->pfip->sort_key;
	max_key = PrintFormatListGetMaxKey(src->pflp, min_key);

									/* any components to copy? */
	tmp = PrintStackGetLowest(src, (Int2)(index + 1), (Int2)(indent + 1), index, max_key, min_key);
	while (tmp >= 0)   /* copy/sort any components */
	{
		PrintStackSortNextItem(dest, src, tmp, (Int2)(indent + 1));
		tmp = PrintStackGetLowest(src, (Int2)(index + 1), (Int2)(indent+1), tmp, max_key, min_key);
	}

	return;
}
开发者ID:fast-project,项目名称:mpifast,代码行数:34,代码来源:prtutil.c


示例16: return

//
// Read functions
//
int ext2::ReadInode(ulong inode, Inode *theInode)
{
	if(inode < 2)
	{
		Panic::PrintMessage("Tried to get inode zero\n");
		return(-1);
	}
	
	ulong	groupNumber = inode / theSuperBlock.inodesPerGroup; // DivUp(inode, theSuperBlock.inodesPerGroup);
	ulong	blocksNeeded = DivUp(theSuperBlock.inodesPerGroup * sizeof(Inode), blockSize); // cal the blocks needed for all inodes
	uchar	*buff = new uchar[blocksNeeded * blockSize];
	Inode	*tmpInode = reinterpret_cast<Inode*>(buff);
	
/*	printf("INODE: %d\n", inode);
	printf("INODES PER GROUP: %d\n", theSuperBlock.inodesPerGroup);
	printf("GROUP NUMBER: %d\n", groupNumber);
	printf("INODE TABLE ADDR: %d\n", theGroupDescriptors[groupNumber].inodeTableAddress);
	printf("BLOCKS REQUESTED: %d\n", blocksNeeded);
	printf("INODE SIZE: %d\n", sizeof(Inode));
	*/
	
	// read the inode table for that group
	int ret = ReadBlocks(theGroupDescriptors[groupNumber].inodeTableAddress, blocksNeeded, buff);
	
	if(ret >= 0)	 // decrease inode because array index at zero and inodes at one
		MemCopy(theInode, &tmpInode[(inode-1) % theSuperBlock.inodesPerGroup], sizeof(Inode));
	
	delete [] buff;
	
	return(ret);
}
开发者ID:wspeirs,项目名称:Mooose,代码行数:34,代码来源:ext2.cpp


示例17: MemCopy

Bool System::EnumResolvedNetAddresses( NetAddress * outAddress, SocketProtocol * outProtocol )
{
    if ( m_pCurAddrInfo == NULL )
        return false;

    *outProtocol = HSocket::_BuildSocketProtocol( m_pCurAddrInfo->ai_socktype,
                                                  m_pCurAddrInfo->ai_family,
                                                  m_pCurAddrInfo->ai_protocol );

    if ( (*outProtocol) & 0x80000000 ) {
        NetAddressIPv6 * outIPv6 = (NetAddressIPv6*)outAddress;
        outIPv6->iType = NETADDRESS_IPv6;

        SOCKADDR_IN6 * pAddr = (SOCKADDR_IN6*)( m_pCurAddrInfo->ai_addr );
        outIPv6->dwFlowInfo = pAddr->sin6_flowinfo;
        outIPv6->dwScopeID = pAddr->sin6_scope_id;
        MemCopy( outIPv6->Addr.Bytes, pAddr->sin6_addr.s6_addr, 16 );
        outIPv6->wPort = pAddr->sin6_port;
    } else {
        NetAddressIPv4 * outIPv4 = (NetAddressIPv4*)outAddress;
        outIPv4->iType = NETADDRESS_IPv4;

        SOCKADDR_IN * pAddr = (SOCKADDR_IN*)( m_pCurAddrInfo->ai_addr );
        outIPv4->Addr.Value = pAddr->sin_addr.s_addr;
        outIPv4->wPort = pAddr->sin_port;
    }

    m_pCurAddrInfo = m_pCurAddrInfo->ai_next;
    return ( m_pCurAddrInfo != NULL );
}
开发者ID:Shikifuyin,项目名称:Scarab-Engine,代码行数:30,代码来源:System.cpp


示例18: CreateWatch

WatchID FileWatcherWin32::addWatch(const mxChar* directory)
{
	WatchID watchid = ++mLastWatchID;

	WatchStruct* watch = CreateWatch( directory, FILE_NOTIFY_CHANGE_LAST_WRITE
		| FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_FILE_NAME);

	if( !watch )
	{
		mxErrf( "CreateWatch() failed, directory: %s", mxTO_ANSI(directory) );
		return 0;
	}

	watch->mWatchid = watchid;
	watch->mWatcher = this;

	const size_t strLen = (mxStrLen(directory)) *sizeof(directory[0]);
	Assert( strLen < sizeof(watch->mDirName));

	watch->mDirName.SetNum(strLen + 1);
	MemCopy(watch->mDirName.ToChars(), directory, strLen );
	watch->mDirName[strLen] = 0;

	mWatches.Set(watchid, watch);

	return watchid;
}
开发者ID:S-V,项目名称:Lollipop,代码行数:27,代码来源:FileWatcher.cpp


示例19: allocstring

LPSTR allocstring(UINT nID,TypeOfResourceHandle bType)
{
	LPSTR szBuffer;
	szBuffer=new CHAR[STR_LOADSTRINGBUFLEN];
	if (szBuffer==NULL)
	{
		SetHFCError(HFC_CANNOTALLOCATE);
		return FALSE;
	}
	UINT nDataLen=::LoadStringA(GetResourceHandle(bType),nID,szBuffer,STR_LOADSTRINGBUFLEN);
	if (nDataLen>=STR_LOADSTRINGBUFLEN-2)
	{
		for (DWORD i=2;nDataLen>=i*STR_LOADSTRINGBUFLEN-2;i++)
		{
			delete[] szBuffer;
			szBuffer=new CHAR[i*STR_LOADSTRINGBUFLEN];
			nDataLen=::LoadStringA(GetResourceHandle(bType),nID,szBuffer,i*STR_LOADSTRINGBUFLEN);
		}
	}

	char* pText=new char[nDataLen+1];
	MemCopy(pText,szBuffer,nDataLen+1);
	delete[] szBuffer;
	return pText;
}
开发者ID:joshball,项目名称:locate32-cogit.net,代码行数:25,代码来源:Strings.cpp


示例20: SortEig

inline void
SortEig( Matrix<R>& w, Matrix<R>& Z )
{
#ifndef RELEASE
    PushCallStack("SortEig");
#endif
    const int n = Z.Height();
    const int k = Z.Width();

    // Initialize the pairs of indices and eigenvalues
    std::vector<internal::IndexValuePair<R> > pairs( k );
    for( int i=0; i<k; ++i )
    {
        pairs[i].index = i;
        pairs[i].value = w.Get(i,0);
    }

    // Sort the eigenvalues and simultaneously form the permutation
    std::sort
    ( pairs.begin(), pairs.end(), internal::IndexValuePair<R>::Compare );

    // Reorder the eigenvectors and eigenvalues using the new ordering
    Matrix<R> ZPerm( n, k );
    for( int j=0; j<k; ++j )
    {
        const int source = pairs[j].index;
        MemCopy( ZPerm.Buffer(0,j), Z.LockedBuffer(0,source), n );
        w.Set(j,0,pairs[j].value);
    }
    Z = ZPerm;
#ifndef RELEASE
    PopCallStack();
#endif
}
开发者ID:jimgoo,项目名称:Elemental,代码行数:34,代码来源:SortEig.hpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ MemCpy函数代码示例发布时间:2022-05-30
下一篇:
C++ MemAlloc函数代码示例发布时间: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