Exemplo n.º 1
0
static int
nsslowcert_GetValidityFields(unsigned char *buf,int buf_length,
	SECItem *notBefore, SECItem *notAfter)
{
    unsigned char tagtype;
    notBefore->data = nsslowcert_dataStart(buf,buf_length,
						&notBefore->len,PR_FALSE, &tagtype);
    if (notBefore->data == NULL) return SECFailure;
    SetTimeType(notBefore, tagtype);
    buf_length -= (notBefore->data-buf) + notBefore->len;
    buf = notBefore->data + notBefore->len;
    notAfter->data = nsslowcert_dataStart(buf,buf_length,
						&notAfter->len,PR_FALSE, &tagtype);
    if (notAfter->data == NULL) return SECFailure;
    SetTimeType(notAfter, tagtype);
    return SECSuccess;
}
Exemplo n.º 2
0
std::string SzbaseWrapper::add_param( const std::string& param
									, const std::string& base
									, const std::string& formula
									, const std::string& token
									, const std::string& type
									, int prec
									, unsigned start_time)
	throw( szbase_invalid_name , szbase_formula_invalid_syntax, szbase_init_error )
{
	if( !SzbaseWrapper::is_initialized() )
		throw szbase_init_error("Szbase not initialized");

	std::wstring _param = convert_string( param );
	std::wstring _token = convert_string( token );
	std::wstring _formula = convert_string( formula );

	std::wstring new_param_name;
	if ( !create_param_name( _param , _token , new_param_name ) )
		throw szbase_invalid_name(param + " in not valid user defined param name");

	std::vector<std::wstring> strings;
	if( !extract_strings_from_formula( _formula , strings ) )
		throw szbase_formula_invalid_syntax("formula cannot be parsed");

	for( auto& param : strings )
	{
		std::wstring new_name;
		if ( !create_param_name_in_formula( param , _token , new_name ) )
				continue;

		auto i = _formula.find( param );
		assert( i != std::wstring::npos );	

		_formula.replace( i , param.size() , new_name );
	}

	TParam::FormulaType formula_type;
	if( type == "av" )
		formula_type = TParam::LUA_AV;
	else if( type == "va" )
		formula_type = TParam::LUA_VA;

	auto tparam = new TParam(NULL, NULL, L"", formula_type, TParam::P_LUA);
	tparam->SetName(new_param_name);
	tparam->SetPrec(prec);
	tparam->SetTimeType(TParam::NANOSECOND); ///XXX:
	tparam->SetLuaScript(SC::S2U(_formula).c_str());
	tparam->SetLuaStartDateTime(start_time);

	IPKContainer::GetObject()->AddExtraParam( convert_string ( base ) , tparam );

	return reinterpret_cast<const char*>(SC::S2U(new_param_name).c_str());
}
Exemplo n.º 3
0
void CWCalendarPageContainer::StoreUserInfo(UINT nIDContainerItem, int nChoice)
{
	static CALENDAR_TYPE TypeTable[] = {
		MONTHLY, WEEKLY, YEARLY
	};
	
	switch (nIDContainerItem) {
	case IDe_CALENDAR_CALENDAR_TYPE:
		SetTimeType(TypeTable[nChoice]);
		break;
	case IDe_CALENDAR_PICTURE_LOC:
		SetPictureStyle((CAL_PICTURE_STYLE)nChoice);
		break;
	default:
		break;
	}
}