Browse Source

Merge branch 'feature/warningfix-badcast-decoratorhandle' of https://github.com/dwimsey/libRocket

This merge fixes some warnings and a bad cast which can cause pyinvader compilation to fail under strict compilers.

Signed-off-by: David Wimsey <[email protected]>
David Wimsey 11 years ago
parent
commit
6b901d3e20

+ 3 - 0
Include/Rocket/Core/Decorator.h

@@ -85,6 +85,9 @@ public:
 	/// @param[in] element_data The handle to the data generated by the decorator for the element.
 	virtual void RenderElement(Element* element, DecoratorDataHandle element_data) = 0;
 
+	/// Value specifying an invalid or non-existent Decorator data handle.
+	static const DecoratorDataHandle INVALID_DECORATORDATAHANDLE = 0;
+
 protected:
 	/// Releases the decorator through its instancer.
 	virtual void OnReferenceDeactivate();

+ 1 - 1
Samples/invaders/src/DecoratorDefender.cpp

@@ -51,7 +51,7 @@ Rocket::Core::DecoratorDataHandle DecoratorDefender::GenerateElementData(Rocket:
 {
 	ROCKET_UNUSED(element);
 
-	return NULL;
+	return Rocket::Core::Decorator::INVALID_DECORATORDATAHANDLE;
 }
 
 // Called to release element data generated by this decorator.

+ 2 - 2
Samples/pyinvaders/src/DecoratorDefender.cpp

@@ -51,13 +51,13 @@ Rocket::Core::DecoratorDataHandle DecoratorDefender::GenerateElementData(Rocket:
 {
 	ROCKET_UNUSED(element);
 
-	return NULL;
+	return Rocket::Core::Decorator::INVALID_DECORATORDATAHANDLE;
 }
 
 // Called to release element data generated by this decorator.
 void DecoratorDefender::ReleaseElementData(Rocket::Core::DecoratorDataHandle ROCKET_UNUSED_PARAMETER(element_data))
 {
-		ROCKET_UNUSED(element_data);
+	ROCKET_UNUSED(element_data);
 }
 
 // Called to render the decorator on an element.

+ 1 - 1
Samples/pyinvaders/src/DecoratorStarfield.cpp

@@ -85,7 +85,7 @@ Rocket::Core::DecoratorDataHandle DecoratorStarfield::GenerateElementData(Rocket
 		star_field->last_update = Shell::GetElapsedTime();
 	}
 
-	return star_field;
+	return reinterpret_cast<Rocket::Core::DecoratorDataHandle>(star_field);
 }
 
 // Called to release element data generated by this decorator.

+ 1 - 1
Samples/tutorial/datagrid/src/DecoratorDefender.cpp

@@ -35,7 +35,7 @@ Rocket::Core::DecoratorDataHandle DecoratorDefender::GenerateElementData(Rocket:
 {
 	ROCKET_UNUSED(element);
 
-	return NULL;
+	return Rocket::Core::Decorator::INVALID_DECORATORDATAHANDLE;
 }
 
 // Called to release element data generated by this decorator.

+ 1 - 1
Samples/tutorial/datagrid_tree/src/DecoratorDefender.cpp

@@ -35,7 +35,7 @@ Rocket::Core::DecoratorDataHandle DecoratorDefender::GenerateElementData(Rocket:
 {
 	ROCKET_UNUSED(element);
 
-	return NULL;
+	return Rocket::Core::Decorator::INVALID_DECORATORDATAHANDLE;
 }
 
 // Called to release element data generated by this decorator.