mirror of
				https://github.com/Icinga/icinga2.git
				synced 2025-10-31 03:03:52 +01:00 
			
		
		
		
	
							parent
							
								
									7a4fa25a49
								
							
						
					
					
						commit
						c7b5e4c31e
					
				| @ -96,7 +96,6 @@ void CompatLogger::CheckResultHandler(const Checkable::Ptr& checkable, const Che | ||||
| 	long stateType_after = vars_after->Get("state_type"); | ||||
| 	long attempt_after = vars_after->Get("attempt"); | ||||
| 	bool reachable_after = vars_after->Get("reachable"); | ||||
| 	bool host_reachable_after = vars_after->Get("host_reachable"); | ||||
| 
 | ||||
| 	Dictionary::Ptr vars_before = cr->GetVarsBefore(); | ||||
| 
 | ||||
|  | ||||
| @ -42,6 +42,8 @@ public: | ||||
| 	 */ | ||||
| 	typedef std::vector<Value>::iterator Iterator; | ||||
| 
 | ||||
| 	typedef std::vector<Value>::size_type SizeType; | ||||
| 
 | ||||
| 	Value Get(unsigned int index) const; | ||||
| 	void Set(unsigned int index, const Value& value); | ||||
| 	void Add(const Value& value); | ||||
|  | ||||
| @ -43,6 +43,8 @@ public: | ||||
| 	 */ | ||||
| 	typedef std::map<String, Value>::iterator Iterator; | ||||
| 
 | ||||
| 	typedef std::map<String, Value>::size_type SizeType; | ||||
| 
 | ||||
| 	typedef std::pair<String, Value> Pair; | ||||
| 
 | ||||
| 	Value Get(const char *key) const; | ||||
|  | ||||
| @ -96,7 +96,7 @@ private: | ||||
| 	friend class boost::iterator_core_access; | ||||
| 
 | ||||
| 	DynamicType::Ptr m_Type; | ||||
| 	int m_Index; | ||||
| 	DynamicType::ObjectVector::size_type m_Index; | ||||
| 	mutable shared_ptr<T> m_Current; | ||||
| 
 | ||||
| 	void increment(void) | ||||
|  | ||||
| @ -80,7 +80,7 @@ private: | ||||
| 	static std::set<Logger::Ptr> m_Loggers; | ||||
| 	static bool m_ConsoleLogEnabled; | ||||
| 
 | ||||
| 	friend void Log(LogSeverity severity, const String& facility, | ||||
| 	friend I2_BASE_API void Log(LogSeverity severity, const String& facility, | ||||
| 	    const String& message); | ||||
| }; | ||||
| 
 | ||||
|  | ||||
| @ -90,7 +90,7 @@ Array::Ptr ScriptUtils::Intersection(const std::vector<Value>& arguments) | ||||
| 
 | ||||
| 	Array::Ptr arr1 = static_cast<Array::Ptr>(arguments[0])->ShallowClone(); | ||||
| 
 | ||||
| 	for (int i = 1; i < arguments.size(); i++) { | ||||
| 	for (std::vector<Value>::size_type i = 1; i < arguments.size(); i++) { | ||||
| 		std::sort(arr1->Begin(), arr1->End()); | ||||
| 
 | ||||
| 		Array::Ptr arr2 = static_cast<Array::Ptr>(arguments[i])->ShallowClone(); | ||||
| @ -133,7 +133,7 @@ void ScriptUtils::Log(const std::vector<Value>& arguments) | ||||
| 
 | ||||
| Array::Ptr ScriptUtils::Range(const std::vector<Value>& arguments) | ||||
| { | ||||
| 	int start, end, increment; | ||||
| 	double start, end, increment; | ||||
| 
 | ||||
| 	switch (arguments.size()) { | ||||
| 		case 1: | ||||
| @ -159,7 +159,7 @@ Array::Ptr ScriptUtils::Range(const std::vector<Value>& arguments) | ||||
| 	    (start > end && increment >= 0)) | ||||
| 		return result; | ||||
| 
 | ||||
| 	for (int i = start; i < end; i += increment) { | ||||
| 	for (double i = start; i < end; i += increment) { | ||||
| 		result->Add(i); | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
| @ -138,7 +138,7 @@ static Dictionary::Ptr DeserializeDictionary(const Dictionary::Ptr& input, bool | ||||
| 	ObjectLock olock(input); | ||||
| 
 | ||||
| 	BOOST_FOREACH(const Dictionary::Pair& kv, input) { | ||||
| 		result->Set(kv.first, Deserialize(kv.second, attributeTypes)); | ||||
| 		result->Set(kv.first, Deserialize(kv.second, safe_mode, attributeTypes)); | ||||
| 	} | ||||
| 
 | ||||
| 	return result; | ||||
|  | ||||
| @ -110,7 +110,7 @@ private: | ||||
| 	int m_ID; | ||||
| 	static int m_NextID; | ||||
| 
 | ||||
| 	int m_MaxThreads; | ||||
| 	unsigned int m_MaxThreads; | ||||
| 
 | ||||
| 	boost::thread_group m_ThreadGroup; | ||||
| 
 | ||||
|  | ||||
| @ -239,5 +239,5 @@ close_socket: | ||||
| 
 | ||||
| bool TlsStream::IsEof(void) const | ||||
| { | ||||
| 	return BIO_eof(m_BIO); | ||||
| 	return (BIO_eof(m_BIO) == 1); | ||||
| } | ||||
|  | ||||
| @ -54,12 +54,12 @@ Object::Ptr Type::Instantiate(void) const | ||||
| 
 | ||||
| bool Type::IsAbstract(void) const | ||||
| { | ||||
| 	return GetAttributes() & TAAbstract; | ||||
| 	return ((GetAttributes() & TAAbstract) != 0); | ||||
| } | ||||
| 
 | ||||
| bool Type::IsSafe(void) const | ||||
| { | ||||
| 	return GetAttributes() & TASafe; | ||||
| 	return ((GetAttributes() & TASafe) != 0); | ||||
| } | ||||
| 
 | ||||
| bool Type::IsAssignableFrom(const Type *other) const | ||||
|  | ||||
| @ -723,7 +723,7 @@ String Utility::NaturalJoin(const std::vector<String>& tokens) | ||||
| { | ||||
| 	String result; | ||||
| 
 | ||||
| 	for (int i = 0; i < tokens.size(); i++) { | ||||
| 	for (std::vector<String>::size_type i = 0; i < tokens.size(); i++) { | ||||
| 		result += tokens[i]; | ||||
| 
 | ||||
| 		if (tokens.size() > i + 1) { | ||||
| @ -960,13 +960,13 @@ int Utility::CompareVersion(const String& v1, const String& v2) | ||||
| 	boost::algorithm::split(tokensv1, v1, boost::is_any_of(".")); | ||||
| 	boost::algorithm::split(tokensv2, v2, boost::is_any_of(".")); | ||||
| 
 | ||||
| 	for (int i = 0; i < tokensv2.size() - tokensv1.size(); i++) | ||||
| 	for (std::vector<String>::size_type i = 0; i < tokensv2.size() - tokensv1.size(); i++) | ||||
| 		tokensv1.push_back("0"); | ||||
| 
 | ||||
| 	for (int i = 0; i < tokensv1.size() - tokensv2.size(); i++) | ||||
| 	for (std::vector<String>::size_type i = 0; i < tokensv1.size() - tokensv2.size(); i++) | ||||
| 		tokensv2.push_back("0"); | ||||
| 
 | ||||
| 	for (size_t i = 0; i < tokensv1.size(); i++) { | ||||
| 	for (std::vector<String>::size_type i = 0; i < tokensv1.size(); i++) { | ||||
| 		if (Convert::ToLong(tokensv2[i]) > Convert::ToLong(tokensv1[i])) | ||||
| 			return 1; | ||||
| 		else if (Convert::ToLong(tokensv2[i]) < Convert::ToLong(tokensv1[i])) | ||||
|  | ||||
| @ -152,7 +152,7 @@ bool Value::operator==(const Value& rhs) const | ||||
| 			if (arr1->GetLength() != arr2->GetLength()) | ||||
| 				return false; | ||||
| 
 | ||||
| 			for (int i = 0; i < arr1->GetLength(); i++) { | ||||
| 			for (Array::SizeType i = 0; i < arr1->GetLength(); i++) { | ||||
| 				if (arr1->Get(i) != arr2->Get(i)) | ||||
| 					return false; | ||||
| 			} | ||||
| @ -471,7 +471,7 @@ Value icinga::operator>>(int lhs, const Value& rhs) | ||||
| 	return Value(lhs) >> rhs; | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator<(const Value& lhs, const Value& rhs) | ||||
| bool icinga::operator<(const Value& lhs, const Value& rhs) | ||||
| { | ||||
| 	if (lhs.IsString() && rhs.IsString()) | ||||
| 		return static_cast<String>(lhs) < static_cast<String>(rhs); | ||||
| @ -483,27 +483,27 @@ Value icinga::operator<(const Value& lhs, const Value& rhs) | ||||
| 		BOOST_THROW_EXCEPTION(std::invalid_argument("Operator < cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'")); | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator<(const Value& lhs, double rhs) | ||||
| bool icinga::operator<(const Value& lhs, double rhs) | ||||
| { | ||||
| 	return lhs < Value(rhs); | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator<(double lhs, const Value& rhs) | ||||
| bool icinga::operator<(double lhs, const Value& rhs) | ||||
| { | ||||
| 	return Value(lhs) < rhs; | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator<(const Value& lhs, int rhs) | ||||
| bool icinga::operator<(const Value& lhs, int rhs) | ||||
| { | ||||
| 	return lhs < Value(rhs); | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator<(int lhs, const Value& rhs) | ||||
| bool icinga::operator<(int lhs, const Value& rhs) | ||||
| { | ||||
| 	return Value(lhs) < rhs; | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator>(const Value& lhs, const Value& rhs) | ||||
| bool icinga::operator>(const Value& lhs, const Value& rhs) | ||||
| { | ||||
| 	if (lhs.IsString() && rhs.IsString()) | ||||
| 		return static_cast<String>(lhs) > static_cast<String>(rhs); | ||||
| @ -515,27 +515,27 @@ Value icinga::operator>(const Value& lhs, const Value& rhs) | ||||
| 		BOOST_THROW_EXCEPTION(std::invalid_argument("Operator > cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'")); | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator>(const Value& lhs, double rhs) | ||||
| bool icinga::operator>(const Value& lhs, double rhs) | ||||
| { | ||||
| 	return lhs > Value(rhs); | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator>(double lhs, const Value& rhs) | ||||
| bool icinga::operator>(double lhs, const Value& rhs) | ||||
| { | ||||
| 	return Value(lhs) > rhs; | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator>(const Value& lhs, int rhs) | ||||
| bool icinga::operator>(const Value& lhs, int rhs) | ||||
| { | ||||
| 	return lhs > Value(rhs); | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator>(int lhs, const Value& rhs) | ||||
| bool icinga::operator>(int lhs, const Value& rhs) | ||||
| { | ||||
| 	return Value(lhs) > rhs; | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator<=(const Value& lhs, const Value& rhs) | ||||
| bool icinga::operator<=(const Value& lhs, const Value& rhs) | ||||
| { | ||||
| 	if (lhs.IsString() && rhs.IsString()) | ||||
| 		return static_cast<String>(lhs) <= static_cast<String>(rhs); | ||||
| @ -547,27 +547,27 @@ Value icinga::operator<=(const Value& lhs, const Value& rhs) | ||||
| 		BOOST_THROW_EXCEPTION(std::invalid_argument("Operator <= cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'")); | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator<=(const Value& lhs, double rhs) | ||||
| bool icinga::operator<=(const Value& lhs, double rhs) | ||||
| { | ||||
| 	return lhs <= Value(rhs); | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator<=(double lhs, const Value& rhs) | ||||
| bool icinga::operator<=(double lhs, const Value& rhs) | ||||
| { | ||||
| 	return Value(lhs) <= rhs; | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator<=(const Value& lhs, int rhs) | ||||
| bool icinga::operator<=(const Value& lhs, int rhs) | ||||
| { | ||||
| 	return lhs <= Value(rhs); | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator<=(int lhs, const Value& rhs) | ||||
| bool icinga::operator<=(int lhs, const Value& rhs) | ||||
| { | ||||
| 	return Value(lhs) <= rhs; | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator>=(const Value& lhs, const Value& rhs) | ||||
| bool icinga::operator>=(const Value& lhs, const Value& rhs) | ||||
| { | ||||
| 	if (lhs.IsString() && rhs.IsString()) | ||||
| 		return static_cast<String>(lhs) >= static_cast<String>(rhs); | ||||
| @ -579,22 +579,22 @@ Value icinga::operator>=(const Value& lhs, const Value& rhs) | ||||
| 		BOOST_THROW_EXCEPTION(std::invalid_argument("Operator >= cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'")); | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator>=(const Value& lhs, double rhs) | ||||
| bool icinga::operator>=(const Value& lhs, double rhs) | ||||
| { | ||||
| 	return lhs >= Value(rhs); | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator>=(double lhs, const Value& rhs) | ||||
| bool icinga::operator>=(double lhs, const Value& rhs) | ||||
| { | ||||
| 	return Value(lhs) >= rhs; | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator>=(const Value& lhs, int rhs) | ||||
| bool icinga::operator>=(const Value& lhs, int rhs) | ||||
| { | ||||
| 	return lhs >= Value(rhs); | ||||
| } | ||||
| 
 | ||||
| Value icinga::operator>=(int lhs, const Value& rhs) | ||||
| bool icinga::operator>=(int lhs, const Value& rhs) | ||||
| { | ||||
| 	return Value(lhs) >= rhs; | ||||
| } | ||||
|  | ||||
| @ -17,10 +17,10 @@ | ||||
|  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             * | ||||
|  ******************************************************************************/ | ||||
| 
 | ||||
| #include "base/application.h" | ||||
| #include "base/value.h" | ||||
| #include "base/array.h" | ||||
| #include "base/logger_fwd.h" | ||||
| #include "base/utility.h" | ||||
| #include "base/dictionary.h" | ||||
| #include "base/type.h" | ||||
| #include <cJSON.h> | ||||
| #include <boost/lexical_cast.hpp> | ||||
| 
 | ||||
|  | ||||
| @ -192,29 +192,29 @@ I2_BASE_API Value operator>>(double lhs, const Value& rhs); | ||||
| I2_BASE_API Value operator>>(const Value& lhs, int rhs); | ||||
| I2_BASE_API Value operator>>(int lhs, const Value& rhs); | ||||
| 
 | ||||
| I2_BASE_API Value operator<(const Value& lhs, const Value& rhs); | ||||
| I2_BASE_API Value operator<(const Value& lhs, double rhs); | ||||
| I2_BASE_API Value operator<(double lhs, const Value& rhs); | ||||
| I2_BASE_API Value operator<(const Value& lhs, int rhs); | ||||
| I2_BASE_API Value operator<(int lhs, const Value& rhs); | ||||
| I2_BASE_API bool operator<(const Value& lhs, const Value& rhs); | ||||
| I2_BASE_API bool operator<(const Value& lhs, double rhs); | ||||
| I2_BASE_API bool operator<(double lhs, const Value& rhs); | ||||
| I2_BASE_API bool operator<(const Value& lhs, int rhs); | ||||
| I2_BASE_API bool operator<(int lhs, const Value& rhs); | ||||
| 
 | ||||
| I2_BASE_API Value operator>(const Value& lhs, const Value& rhs); | ||||
| I2_BASE_API Value operator>(const Value& lhs, double rhs); | ||||
| I2_BASE_API Value operator>(double lhs, const Value& rhs); | ||||
| I2_BASE_API Value operator>(const Value& lhs, int rhs); | ||||
| I2_BASE_API Value operator>(int lhs, const Value& rhs); | ||||
| I2_BASE_API bool operator>(const Value& lhs, const Value& rhs); | ||||
| I2_BASE_API bool operator>(const Value& lhs, double rhs); | ||||
| I2_BASE_API bool operator>(double lhs, const Value& rhs); | ||||
| I2_BASE_API bool operator>(const Value& lhs, int rhs); | ||||
| I2_BASE_API bool operator>(int lhs, const Value& rhs); | ||||
| 
 | ||||
| I2_BASE_API Value operator<=(const Value& lhs, const Value& rhs); | ||||
| I2_BASE_API Value operator<=(const Value& lhs, double rhs); | ||||
| I2_BASE_API Value operator<=(double lhs, const Value& rhs); | ||||
| I2_BASE_API Value operator<=(const Value& lhs, int rhs); | ||||
| I2_BASE_API Value operator<=(int lhs, const Value& rhs); | ||||
| I2_BASE_API bool operator<=(const Value& lhs, const Value& rhs); | ||||
| I2_BASE_API bool operator<=(const Value& lhs, double rhs); | ||||
| I2_BASE_API bool operator<=(double lhs, const Value& rhs); | ||||
| I2_BASE_API bool operator<=(const Value& lhs, int rhs); | ||||
| I2_BASE_API bool operator<=(int lhs, const Value& rhs); | ||||
| 
 | ||||
| I2_BASE_API Value operator>=(const Value& lhs, const Value& rhs); | ||||
| I2_BASE_API Value operator>=(const Value& lhs, double rhs); | ||||
| I2_BASE_API Value operator>=(double lhs, const Value& rhs); | ||||
| I2_BASE_API Value operator>=(const Value& lhs, int rhs); | ||||
| I2_BASE_API Value operator>=(int lhs, const Value& rhs); | ||||
| I2_BASE_API bool operator>=(const Value& lhs, const Value& rhs); | ||||
| I2_BASE_API bool operator>=(const Value& lhs, double rhs); | ||||
| I2_BASE_API bool operator>=(double lhs, const Value& rhs); | ||||
| I2_BASE_API bool operator>=(const Value& lhs, int rhs); | ||||
| I2_BASE_API bool operator>=(int lhs, const Value& rhs); | ||||
| 
 | ||||
| I2_BASE_API std::ostream& operator<<(std::ostream& stream, const Value& value); | ||||
| I2_BASE_API std::istream& operator>>(std::istream& stream, Value& value); | ||||
|  | ||||
| @ -264,7 +264,7 @@ Value AExpression::OpFunctionCall(const AExpression *expr, const Dictionary::Ptr | ||||
| 	Array::Ptr arr = expr->EvaluateOperand2(locals); | ||||
| 	std::vector<Value> arguments; | ||||
| 	int index = 0; | ||||
| 	for (int index = 0; index < arr->GetLength(); index++) { | ||||
| 	for (Array::SizeType index = 0; index < arr->GetLength(); index++) { | ||||
| 		const AExpression::Ptr& aexpr = arr->Get(index); | ||||
| 		arguments.push_back(aexpr->Evaluate(locals)); | ||||
| 	} | ||||
| @ -279,7 +279,7 @@ Value AExpression::OpArray(const AExpression *expr, const Dictionary::Ptr& local | ||||
| 
 | ||||
| 	if (arr) { | ||||
| 		int index = 0; | ||||
| 		for (int index = 0; index < arr->GetLength(); index++) { | ||||
| 		for (Array::SizeType index = 0; index < arr->GetLength(); index++) { | ||||
| 			const AExpression::Ptr& aexpr = arr->Get(index); | ||||
| 			result->Add(aexpr->Evaluate(locals)); | ||||
| 		} | ||||
| @ -298,7 +298,7 @@ Value AExpression::OpDict(const AExpression *expr, const Dictionary::Ptr& locals | ||||
| 
 | ||||
| 	if (arr) { | ||||
| 		int index = 0; | ||||
| 		for (int index = 0; index < arr->GetLength(); index++) { | ||||
| 		for (Array::SizeType index = 0; index < arr->GetLength(); index++) { | ||||
| 			const AExpression::Ptr& aexpr = arr->Get(index); | ||||
| 			Dictionary::Ptr alocals = in_place ? locals : result; | ||||
| 			aexpr->Evaluate(alocals); | ||||
| @ -483,7 +483,7 @@ Value AExpression::FunctionWrapper(const std::vector<Value>& arguments, const Ar | ||||
| 	Dictionary::Ptr locals = make_shared<Dictionary>(); | ||||
| 	locals->Set("__parent", scope); | ||||
| 
 | ||||
| 	for (int i = 0; i < std::min(arguments.size(), funcargs->GetLength()); i++) | ||||
| 	for (std::vector<Value>::size_type i = 0; i < std::min(arguments.size(), funcargs->GetLength()); i++) | ||||
| 		locals->Set(funcargs->Get(i), arguments[i]); | ||||
| 
 | ||||
| 	expr->Evaluate(locals); | ||||
|  | ||||
| @ -58,10 +58,10 @@ static void lb_init(lex_buf *lb) | ||||
| 	lb->size = 0; | ||||
| } | ||||
| 
 | ||||
| static void lb_cleanup(lex_buf *lb) | ||||
| /*static void lb_cleanup(lex_buf *lb) | ||||
| { | ||||
| 	free(lb->buf); | ||||
| } | ||||
| }*/ | ||||
| 
 | ||||
| static void lb_append_char(lex_buf *lb, char new_char) | ||||
| { | ||||
|  | ||||
| @ -932,7 +932,7 @@ apply: | ||||
| 				std::vector<String> types = ApplyRule::GetTargetTypes(type); | ||||
| 				String typeNames; | ||||
| 
 | ||||
| 				for (int i = 0; i < types.size(); i++) { | ||||
| 				for (std::vector<String>::size_type i = 0; i < types.size(); i++) { | ||||
| 					if (typeNames != "") { | ||||
| 						if (i == types.size() - 1) | ||||
| 							typeNames += " or "; | ||||
|  | ||||
| @ -154,7 +154,7 @@ void ExternalCommandProcessor::Execute(double time, const String& command, const | ||||
| 		std::copy(arguments.begin(), arguments.begin() + argnum - 1, realArguments.begin()); | ||||
| 	 | ||||
| 		String last_argument; | ||||
| 		for (int i = argnum - 1; i < arguments.size(); i++) { | ||||
| 		for (std::vector<String>::size_type i = argnum - 1; i < arguments.size(); i++) { | ||||
| 			if (!last_argument.IsEmpty()) | ||||
| 				last_argument += ";"; | ||||
| 
 | ||||
|  | ||||
| @ -67,7 +67,6 @@ private: | ||||
| 	Stream::Ptr m_Stream; | ||||
| 	ConnectionRole m_Role; | ||||
| 	double m_Seen; | ||||
| 	bool m_Syncing; | ||||
| 
 | ||||
| 	bool ProcessMessage(void); | ||||
| 	void MessageThreadProc(void); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user