Просмотр исходного кода

Merge pull request #111 from viciious/fixwarnings

Fix gcc compilation warnings
Tom Mason 11 лет назад
Родитель
Сommit
8c4e668060

+ 6 - 0
Build/vc2010/RocketCore.vcxproj.filters

@@ -531,6 +531,9 @@
     <ClCompile Include="..\..\Source\Core\StringCache.cpp">
       <Filter>String Cache</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\Source\Core\ElementStyleCache.cpp">
+      <Filter>Element</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\Source\Core\precompiled.h">
@@ -969,6 +972,9 @@
       <Filter>String Cache</Filter>
     </ClInclude>
     <ClInclude Include="..\..\Include\Rocket\Core.h" />
+    <ClInclude Include="..\..\Source\Core\ElementStyleCache.h">
+      <Filter>Element</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\Include\Rocket\Core\Element.inl">

+ 1 - 1
Source/Core/DecoratorNone.cpp

@@ -38,7 +38,7 @@ DecoratorNone::~DecoratorNone()
 // Called on a decorator to generate any required per-element data for a newly decorated element.
 DecoratorDataHandle DecoratorNone::GenerateElementData(Element* ROCKET_UNUSED(element))
 {
-	return NULL;
+	return 0;
 }
 
 // Called to release element data generated by this decorator.

+ 1 - 1
Source/Core/ElementStyleCache.cpp

@@ -38,7 +38,7 @@ ElementStyleCache::ElementStyleCache(ElementStyle *style) : style(style),
 	padding_top(NULL), padding_bottom(NULL), padding_left(NULL), padding_right(NULL),
 	width(NULL), height(NULL),
 	local_width(NULL), local_height(NULL), have_local_width(false), have_local_height(false),
-	overflow_x(NULL), overflow_y(NULL),
+	overflow_x(-1), overflow_y(-1),
 	position(-1), float_(-1), display(-1), whitespace(-1),
 	line_height(NULL), text_align(-1), text_transform(-1), vertical_align(NULL)
 {

+ 5 - 5
Source/Core/Geometry.cpp

@@ -47,7 +47,7 @@ Geometry::Geometry(Element* _host_element)
 
 	fixed_texcoords = false;
 	compile_attempted = false;
-	compiled_geometry = NULL;
+	compiled_geometry = 0;
 }
 
 Geometry::Geometry(Context* _host_context)
@@ -61,7 +61,7 @@ Geometry::Geometry(Context* _host_context)
 
 	fixed_texcoords = false;
 	compile_attempted = false;
-	compiled_geometry = NULL;
+	compiled_geometry = 0;
 }
 
 Geometry::~Geometry()
@@ -128,7 +128,7 @@ void Geometry::Render(const Vector2f& translation)
 			}
 
 			compile_attempted = true;
-			compiled_geometry = render_interface->CompileGeometry(&vertices[0], (int) vertices.size(), &indices[0], (int) indices.size(), texture != NULL ? texture->GetHandle(GetRenderInterface()) : NULL);
+			compiled_geometry = render_interface->CompileGeometry(&vertices[0], (int) vertices.size(), &indices[0], (int) indices.size(), texture != NULL ? texture->GetHandle(GetRenderInterface()) : 0);
 
 			// If we managed to compile the geometry, we can clear the local copy of vertices and indices and
 			// immediately render the compiled version.
@@ -141,7 +141,7 @@ void Geometry::Render(const Vector2f& translation)
 
 		// Either we've attempted to compile before (and failed), or the compile we just attempted failed; either way,
 		// render the uncompiled version.
-		render_interface->RenderGeometry(&vertices[0], (int) vertices.size(), &indices[0], (int) indices.size(), texture != NULL ? texture->GetHandle(GetRenderInterface()) : NULL, translation);
+		render_interface->RenderGeometry(&vertices[0], (int) vertices.size(), &indices[0], (int) indices.size(), texture != NULL ? texture->GetHandle(GetRenderInterface()) : 0, translation);
 	}
 }
 
@@ -175,7 +175,7 @@ void Geometry::Release(bool clear_buffers)
 	if (compiled_geometry)
 	{
 		GetRenderInterface()->ReleaseCompiledGeometry(compiled_geometry);
-		compiled_geometry = NULL;
+		compiled_geometry = 0;
 	}
 
 	compile_attempted = false;

+ 1 - 1
Source/Core/RenderInterface.cpp

@@ -44,7 +44,7 @@ RenderInterface::~RenderInterface()
 // Called by Rocket when it wants to compile geometry it believes will be static for the forseeable future.
 CompiledGeometryHandle RenderInterface::CompileGeometry(Vertex* ROCKET_UNUSED(vertices), int ROCKET_UNUSED(num_vertices), int* ROCKET_UNUSED(indices), int ROCKET_UNUSED(num_indices), TextureHandle ROCKET_UNUSED(texture))
 {
-	return NULL;
+	return 0;
 }
 
 // Called by Rocket when it wants to render application-compiled geometry.

+ 2 - 2
Source/Core/StreamFile.cpp

@@ -35,7 +35,7 @@ namespace Core {
 
 StreamFile::StreamFile()
 {
-	file_handle = NULL;
+	file_handle = 0;
 	length = 0;
 }
 
@@ -74,7 +74,7 @@ void StreamFile::Close()
 	if (file_handle)
 	{
 		GetFileInterface()->Close(file_handle);
-		file_handle = NULL;
+		file_handle = 0;
 	}
 
 	length = 0;

+ 1 - 1
Source/Core/Texture.cpp

@@ -75,7 +75,7 @@ String Texture::GetSource() const
 TextureHandle Texture::GetHandle(RenderInterface* render_interface) const
 {
 	if (resource == NULL)
-		return NULL;
+		return 0;
 
 	return resource->GetHandle(render_interface);
 }

+ 2 - 2
Source/Debugger/Geometry.cpp

@@ -58,7 +58,7 @@ void Geometry::RenderOutline(const Core::Vector2f& origin, const Core::Vector2f&
 	Core::GeometryUtilities::GenerateQuad(vertices + 8, indices + 12, Core::Vector2f(0, 0), Core::Vector2f(width, dimensions.y), colour, 8);
 	Core::GeometryUtilities::GenerateQuad(vertices + 12, indices + 18, Core::Vector2f(dimensions.x - width, 0), Core::Vector2f(width, dimensions.y), colour, 12);
 
-	render_interface->RenderGeometry(vertices, 4 * 4, indices, 6 * 4, NULL, origin);
+	render_interface->RenderGeometry(vertices, 4 * 4, indices, 6 * 4, 0, origin);
 }
 
 // Renders a box.
@@ -74,7 +74,7 @@ void Geometry::RenderBox(const Core::Vector2f& origin, const Core::Vector2f& dim
 
 	Core::GeometryUtilities::GenerateQuad(vertices, indices, Core::Vector2f(0, 0), Core::Vector2f(dimensions.x, dimensions.y), colour, 0);
 
-	render_interface->RenderGeometry(vertices, 4, indices, 6, NULL, origin);
+	render_interface->RenderGeometry(vertices, 4, indices, 6, 0, origin);
 }
 
 // Renders a box with a hole in the middle.