QList<Phonon::EffectParameter> Effect::parameters() const { QList<Phonon::EffectParameter> ret; ComPointer<IMediaParamInfo> paramInfo(m_filters[0], IID_IMediaParamInfo); if (!paramInfo) { return ret; } DWORD paramCount = 0; paramInfo->GetParamCount( ¶mCount); for(quint32 i = 0; i < paramCount; i++) { MP_PARAMINFO info; HRESULT hr = paramInfo->GetParamInfo(i, &info); Q_ASSERT(SUCCEEDED(hr)); WCHAR *name = 0; hr = paramInfo->GetParamText(i, &name); Q_ASSERT(SUCCEEDED(hr)); QVariant def, min, max; QVariantList values; switch(info.mpType) { case MPT_ENUM: { WCHAR *current = name; current += wcslen(current) + 1; //skip the name current += wcslen(current) + 1; //skip the unit for(; *current; current += wcslen(current) + 1) { values.append( QString::fromWCharArray(current) ); } } //FALLTHROUGH case MPT_INT: def = int(info.mpdNeutralValue); min = int(info.mpdMinValue); max = int(info.mpdMaxValue); break; case MPT_FLOAT: def = info.mpdNeutralValue; min = info.mpdMinValue; max = info.mpdMaxValue; break; case MPT_BOOL: def = bool(info.mpdNeutralValue); break; case MPT_MAX: //Reserved ms-help://MS.PSDKSVR2003R2.1033/directshow/htm/mp_typeenumeration.htm break; } Phonon::EffectParameter::Hints hint = info.mopCaps == MP_CAPS_CURVE_INVSQUARE ? Phonon::EffectParameter::LogarithmicHint : Phonon::EffectParameter::Hints(0); const QString n = QString::fromWCharArray(name); ret.append(Phonon::EffectParameter(i, n, hint, def, min, max, values)); ::CoTaskMemFree(name); //let's free the memory } return ret; }
void PolycrystalUserObjectBase::assignOpsToGrains() { mooseAssert(_is_master, "This routine should only be called on the master rank"); Moose::perf_log.push("assignOpsToGrains()", "PolycrystalICTools"); // Use a simple backtracking coloring algorithm if (_coloring_algorithm == "bt") { paramInfo("coloring_algorithm", "The backtracking algorithm has exponential complexity. If you are using very few " "order parameters, or you have several hundred grains or more, you should use one of " "the PETSc coloring algorithms such as \"jp\"."); if (!colorGraph(0)) paramError("op_num", "Unable to find a valid grain to op coloring, Make sure you have created enough " "variables to hold a valid polycrystal initial condition (no grains represented " "by the same variable should be allowed to touch, ~8 for 2D, ~25 for 3D)?"); } else // PETSc Coloring algorithms { #ifdef LIBMESH_HAVE_PETSC const std::string & ca_str = _coloring_algorithm; Real * am_data = _adjacency_matrix->get_values().data(); try { Moose::PetscSupport::colorAdjacencyMatrix( am_data, _feature_count, _vars.size(), _grain_to_op, ca_str.c_str()); } catch (std::runtime_error & e) { paramError("op_num", "Unable to find a valid grain to op coloring, Make sure you have created enough " "variables to hold a valid polycrystal initial condition (no grains represented " "by the same variable should be allowed to touch, ~8 for 2D, ~25 for 3D)?"); } #else mooseError("Selected coloring algorithm requires PETSc"); #endif } Moose::perf_log.pop("assignOpsToGrains()", "PolycrystalICTools"); }
int initCertMgmtACL( INOUT KERNEL_DATA *krnlDataPtr ) { int i; assert( isWritePtr( krnlDataPtr, sizeof( KERNEL_DATA ) ) ); /* Perform a consistency check on the cert management ACLs */ for( i = 0; certMgmtACLTbl[ i ].action != MECHANISM_NONE && \ i < FAILSAFE_ARRAYSIZE( certMgmtACLTbl, CERTMGMT_ACL ); i++ ) { const CERTMGMT_ACL *certMgmtACL = &certMgmtACLTbl[ i ]; /* Actions and permissions are consistent */ ENSURES( certMgmtACL->action > CRYPT_CERTACTION_NONE && \ certMgmtACL->action < CRYPT_CERTACTION_LAST ); ENSURES( certMgmtACL->access == ACTION_PERM_NONE || \ certMgmtACL->access == ACTION_PERM_NONE_EXTERNAL || \ certMgmtACL->access == ACTION_PERM_ALL ); /* If it's a no-access ACL, all mechanisms should be blocked */ if( certMgmtACL->access == ACTION_PERM_NONE ) { ENSURES( paramInfo( certMgmtACL, 0 ).valueType == PARAM_VALUE_NONE ); continue; } /* If it's an internal-only ACL, it always needs a request parameter */ if( certMgmtACL->access == ACTION_PERM_NONE_EXTERNAL ) { if( paramInfo( certMgmtACL, 1 ).valueType != PARAM_VALUE_OBJECT || \ ( paramInfo( certMgmtACL, 1 ).subTypeA & \ ~( ST_CERT_CERTREQ | ST_CERT_REQ_CERT | \ ST_CERT_REQ_REV | ST_CERT_CERT ) ) || \ paramInfo( certMgmtACL, 1 ).subTypeB != ST_NONE ) { DEBUG_DIAG(( "Certificate management ACLs inconsistent" )); retIntError(); } } /* If it requires a CA key parameter, it must be a private-key context with the key loaded and an attached CA certificate */ if( paramInfo( certMgmtACL, 0 ).valueType == PARAM_VALUE_OBJECT ) { ENSURES( paramInfo( certMgmtACL, 0 ).subTypeA == ST_CTX_PKC && \ paramInfo( certMgmtACL, 0 ).subTypeB == ST_NONE && \ paramInfo( certMgmtACL, 0 ).flags == ACL_FLAG_HIGH_STATE ); if( ( secParamInfo( certMgmtACL, 0 ).subTypeA & \ ~( ST_CERT_CERT | ST_CERT_CERTCHAIN ) ) || \ secParamInfo( certMgmtACL, 0 ).subTypeB != ST_NONE || \ secParamInfo( certMgmtACL, 0 ).flags != ACL_FLAG_HIGH_STATE ) { DEBUG_DIAG(( "Certificate management ACLs inconsistent" )); retIntError(); } continue; } ENSURES( paramInfo( certMgmtACL, 0 ).valueType == PARAM_VALUE_UNUSED ); } ENSURES( i < FAILSAFE_ARRAYSIZE( certMgmtACLTbl, CERTMGMT_ACL ) ); /* Set up the reference to the kernel data block */ krnlData = krnlDataPtr; return( CRYPT_OK ); }