Exemplo n.º 1
0
void W32NetRes::Set( NETRESOURCEW* p )
{
	Clear();

	if ( !p ) { return; }

	int nameLen = p->lpLocalName ? wcslen( p->lpLocalName ) + 1 : 0;
	int remoteNameLen = p->lpRemoteName ? wcslen( p->lpRemoteName ) + 1 : 0;
	int commentLen = p->lpComment ? wcslen( p->lpComment ) + 1 : 0;
	int providerLen = p->lpProvider ? wcslen( p->lpProvider ) + 1 : 0;
	int size = sizeof( Node ) + ( nameLen + remoteNameLen + commentLen + providerLen ) * sizeof( wchar_t );
	data = new unsigned char[size];
	Node& node = *( ( Node* )data );
	node.size = size;
	node.rs = *p;
	int offset = sizeof( node );

#define QQQ(a, len)\
if (len>0) { node.rs.a = (wchar_t*)(data + offset); wcscpy(node.rs.a, p->a); }\
offset += len*sizeof(wchar_t);

	QQQ( lpLocalName, nameLen );
	QQQ( lpRemoteName, remoteNameLen );
	QQQ( lpComment, commentLen );
	QQQ( lpProvider, providerLen );
#undef QQQ
}
Exemplo n.º 2
0
unsigned char* W32NetRes::Copy( const unsigned char* a )
{
	if ( !a ) { return 0; }

	Node& src = *( ( Node* )a );

	unsigned char* b = new unsigned char [src.size];
	memcpy( b, a, src.size );

	Node& dest = *( ( Node* )b );
#define QQQ(x) if (dest.rs.x) { dest.rs.x = (wchar_t*)(( ((char*)src.rs.x)-((char*)a)) + (char*)b); }
	QQQ( lpLocalName );
	QQQ( lpRemoteName );
	QQQ( lpComment );
	QQQ( lpProvider );
#undef QQQ
	return b;
};
Exemplo n.º 3
0
double getF0(double U)
{
        double S, p[5]={0.}, trqq, qqq, eld;

        S = getS(U);
        p[0] = S * two3rd;
        p[3] =-S * third;

        trqq = trQQ(p);
        qqq = QQQ(p);
        eld = A_ldg * ( 0.5 * (1.0-third*U)*trqq - third*U*qqq + 0.25*U*trqq*trqq );

        return eld;
}