Browse Source

Warning fixes.

Doug Binks 12 years ago
parent
commit
ed17fdbe68

+ 1 - 1
Include/Rocket/Core/Debug.h

@@ -107,6 +107,6 @@ template <> struct STATIC_ASSERTION_FAILURE<true>{};
 	
 }
 }
-#define ROCKET_STATIC_ASSERT(cond, msg) Rocket::Core::STATIC_ASSERTION_FAILURE<cond> msg
+#define ROCKET_STATIC_ASSERT(cond, msg) Rocket::Core::STATIC_ASSERTION_FAILURE<cond> msg; (void)&msg;
 
 #endif

+ 1 - 1
Include/Rocket/Core/StringBase.h

@@ -42,7 +42,7 @@ template< typename T >
 class StringBase
 {
 public:
-	typedef unsigned int size_type;
+	typedef size_t size_type;
 	static const size_type npos = (size_type)-1;
 
 	StringBase();

+ 1 - 1
Include/Rocket/Core/Variant.h

@@ -143,7 +143,7 @@ public:
 private:
 	
 #ifdef ROCKET_ARCH_64
-		static const int LOCAL_DATA_SIZE = 32; // Required for Strings
+		static const int LOCAL_DATA_SIZE = 40; // Required for Strings
 #else
 		static const int LOCAL_DATA_SIZE = 24;
 #endif

+ 1 - 1
Source/Controls/ElementDataGrid.cpp

@@ -279,7 +279,7 @@ void ElementDataGrid::GetInnerRML(Rocket::Core::String& content) const
 	// The only content we have is the columns, and inside them the header elements.
 	for (size_t i = 0; i < columns.size(); i++)
 	{
-		Core::Element* header_element = header->GetChild(i);		
+		Core::Element* header_element = header->GetChild((int)i);
 
 		Rocket::Core::String column_fields;
 		for (size_t j = 0; j < columns[i].fields.size(); j++)

+ 1 - 1
Source/Controls/ElementDataGridRow.cpp

@@ -571,7 +571,7 @@ void ElementDataGridRow::LoadChildren(float time_slice)
 			any_dirty_children = true;
 			if (data_query_offset == -1)
 			{
-				data_query_offset = i;
+				data_query_offset = (int)i;
 				data_query_limit = 1;
 			}
 			else

+ 3 - 3
Source/Controls/WidgetDropDown.cpp

@@ -293,7 +293,7 @@ void WidgetDropDown::ProcessEvent(Core::Event& event)
 				{
 					if (options[i].IsSelectable())
 					{
-						SetSelection(i);
+						SetSelection((int)i);
 						event.StopPropagation();
 
 						ShowSelectBox(false);
@@ -333,10 +333,10 @@ void WidgetDropDown::ProcessEvent(Core::Event& event)
 		switch (key_identifier)
 		{
 			case Core::Input::KI_UP:
-				SetSelection( (selected_option - 1 + options.size()) % options.size() );
+				SetSelection((selected_option - 1 + (int)options.size()) % (int)options.size());
 				break;
 			case Core::Input::KI_DOWN:		
-				SetSelection( (selected_option + 1) % options.size() );
+				SetSelection((selected_option + 1) % (int)options.size());
 				break;
 			default:
 				break;

+ 3 - 3
Source/Controls/WidgetTextInput.cpp

@@ -558,8 +558,8 @@ void WidgetTextInput::UpdateAbsoluteCursor()
 
 	for (int i = 0; i < cursor_line_index; i++)
 	{
-		absolute_cursor_index += lines[i].content.Length();
-		edit_index += lines[i].content.Length() + lines[i].extra_characters;
+		absolute_cursor_index += (int)lines[i].content.Length();
+		edit_index += (int)lines[i].content.Length() + lines[i].extra_characters;
 	}
 }
 
@@ -818,7 +818,7 @@ Rocket::Core::Vector2f WidgetTextInput::FormatText()
 
 			selection_vertices.resize(selection_vertices.size() + 4);
 			selection_indices.resize(selection_indices.size() + 6);
-			Core::GeometryUtilities::GenerateQuad(&selection_vertices[selection_vertices.size() - 4], &selection_indices[selection_indices.size() - 6], line_position, Rocket::Core::Vector2f((float) selection_width, (float) line_height), selection_colour, selection_vertices.size() - 4);
+			Core::GeometryUtilities::GenerateQuad(&selection_vertices[selection_vertices.size() - 4], &selection_indices[selection_indices.size() - 6], line_position, Rocket::Core::Vector2f((float)selection_width, (float)line_height), selection_colour, (int)selection_vertices.size() - 4);
 
 			line_position.x += selection_width;
 		}

+ 4 - 4
Source/Core/BaseXMLParser.cpp

@@ -137,7 +137,7 @@ void BaseXMLParser::ReadBody()
 			// Bail if we've hit the end of the XML data.
 			if (open_tag_depth == 0)
 			{
-				xml_source->Seek((read - buffer) - buffer_used, SEEK_CUR);
+				xml_source->Seek((long)((read - buffer) - buffer_used), SEEK_CUR);
 				break;
 			}
 		}
@@ -434,7 +434,7 @@ bool BaseXMLParser::PeekString(const unsigned char* string, bool consume)
 		// overflow buffer.
 		if ((peek_read - buffer) + i >= buffer_used)
 		{
-			int peek_offset = peek_read - read;
+			int peek_offset = (int)(peek_read - read);
 			FillBuffer();
 			peek_read = read + peek_offset;
 
@@ -442,7 +442,7 @@ bool BaseXMLParser::PeekString(const unsigned char* string, bool consume)
 			{
 				// Wierd, seems our buffer is too small, realloc it bigger.
 				buffer_size *= 2;
-				int read_offset = read - buffer;
+				int read_offset = (int)(read - buffer);
 				buffer = (unsigned char*) realloc(buffer, buffer_size);
 
 				// Restore the read pointers.
@@ -494,7 +494,7 @@ bool BaseXMLParser::FillBuffer()
 	
 	read = buffer;
 	size_t bytes_read = xml_source->Read(&buffer[bytes_remaining], bytes_free);
-	buffer_used = bytes_read + bytes_remaining;
+	buffer_used = (int)(bytes_read + bytes_remaining);
 
 	return bytes_read > 0;
 }

+ 1 - 1
Source/Core/ElementDecoration.cpp

@@ -199,7 +199,7 @@ bool ElementDecoration::IterateDecorators(int& index, PseudoClassList& pseudo_cl
 		// This is the one we're looking for.
 		name = index_iterator->first;
 
-		int relative_index = index - count;
+		int relative_index = index - (int)count;
 		pseudo_classes = decorator_index_list[relative_index].first;
 
 		const DecoratorHandle& decorator_handle = decorators[decorator_index_list[relative_index].second];

+ 6 - 6
Source/Core/ElementTextDefault.cpp

@@ -102,11 +102,11 @@ void ElementTextDefault::OnRender()
 	Vector2i clip_dimensions;
 	if (GetContext()->GetActiveClipRegion(clip_origin, clip_dimensions))
 	{
-		float clip_top = clip_origin.y;
-		float clip_left = clip_origin.x;
-		float clip_right = (clip_origin.x + clip_dimensions.x);
-		float clip_bottom = (clip_origin.y + clip_dimensions.y);
-		float line_height = GetFontFaceHandle()->GetLineHeight();
+		float clip_top = (float)clip_origin.y;
+		float clip_left = (float)clip_origin.x;
+		float clip_right = (float)(clip_origin.x + clip_dimensions.x);
+		float clip_bottom = (float)(clip_origin.y + clip_dimensions.y);
+		float line_height = (float)GetFontFaceHandle()->GetLineHeight();
 		
 		render = false;
 		for (size_t i = 0; i < lines.size(); ++i)
@@ -225,7 +225,7 @@ bool ElementTextDefault::GenerateLine(WString& line, int& line_length, float& li
 		// The token can fit on the end of the line, so add it onto the end and increment our width and length
 		// counters.
 		line += token;
-		line_length += (next_token_begin - token_begin);
+		line_length += (int)(next_token_begin - token_begin);
 		line_width += token_width;
 
 		// Break out of the loop if an endline was forced.

+ 1 - 1
Source/Core/EventDispatcher.cpp

@@ -131,7 +131,7 @@ bool EventDispatcher::DispatchEvent(Element* target_element, const String& name,
 	event->SetPhase(Event::PHASE_CAPTURE);
 	// Capture phase - root, to target (only events that have registered as capture events)
 	// Note: We walk elements in REVERSE as they're placed in the list from the elements parent to the root
-	for (int i = elements.size() - 1; i >= 0 && event->IsPropagating(); i--) 
+	for (int i = (int)elements.size() - 1; i >= 0 && event->IsPropagating(); i--) 
 	{
 		EventDispatcher* dispatcher = elements[i]->GetEventDispatcher();
 		event->SetCurrentElement(elements[i]);

+ 1 - 1
Source/Core/FileInterface.cpp

@@ -45,7 +45,7 @@ size_t FileInterface::Length(FileHandle file)
     size_t current_position = Tell(file);
     Seek( file, 0, SEEK_END);
     size_t length = Tell( file);
-    Seek( file, current_position, SEEK_SET);
+    Seek( file, (long)current_position, SEEK_SET);
     return length;
 }
 

+ 1 - 1
Source/Core/FontDatabase.cpp

@@ -288,7 +288,7 @@ void* FontDatabase::LoadFace(const String& file_name)
 	file_interface->Read(buffer, length, handle);
 	file_interface->Close(handle);
 
-	return LoadFace(buffer, length, file_name, true);
+	return LoadFace(buffer, (int)length, file_name, true);
 }
 
 // Loads a FreeType face from memory.

+ 1 - 1
Source/Core/FontFaceHandle.cpp

@@ -330,7 +330,7 @@ void FontFaceHandle::GenerateLine(Geometry* geometry, const Vector2f& position,
 
 	line_vertices.resize(line_vertices.size() + 4);
 	line_indices.resize(line_indices.size() + 6);
-	GeometryUtilities::GenerateQuad(&line_vertices[0] + (line_vertices.size() - 4), &line_indices[0] + (line_indices.size() - 6), Vector2f(position.x, position.y + offset), Vector2f((float) width, underline_thickness), colour, line_vertices.size() - 4);
+	GeometryUtilities::GenerateQuad(&line_vertices[0] + (line_vertices.size() - 4), &line_indices[0] + (line_indices.size() - 6), Vector2f(position.x, position.y + offset), Vector2f((float) width, underline_thickness), colour, (int)line_vertices.size() - 4);
 }
 
 // Returns the font face's raw charset (the charset range as a string).

+ 1 - 1
Source/Core/FontFaceLayer.h

@@ -88,7 +88,7 @@ public:
 
 		character_vertices.resize(character_vertices.size() + 4);
 		character_indices.resize(character_indices.size() + 6);
-		GeometryUtilities::GenerateQuad(&character_vertices[0] + (character_vertices.size() - 4), &character_indices[0] + (character_indices.size() - 6), Vector2f(position.x + character.origin.x, position.y + character.origin.y), character.dimensions, colour, character.texcoords[0], character.texcoords[1], character_vertices.size() - 4);
+		GeometryUtilities::GenerateQuad(&character_vertices[0] + (character_vertices.size() - 4), &character_indices[0] + (character_indices.size() - 6), Vector2f(position.x + character.origin.x, position.y + character.origin.y), character.dimensions, colour, character.texcoords[0], character.texcoords[1], (int)character_vertices.size() - 4);
 	}
 
 	/// Returns the effect used to generate the layer.

+ 1 - 1
Source/Core/PropertyDictionary.cpp

@@ -64,7 +64,7 @@ const Property* PropertyDictionary::GetProperty(const String& name) const
 // Returns the number of properties in the dictionary.
 int PropertyDictionary::GetNumProperties() const
 {
-	return properties.size();
+	return (int)properties.size();
 }
 
 // Returns the map of properties in the dictionary.

+ 1 - 1
Source/Core/PropertyParserColour.cpp

@@ -113,7 +113,7 @@ bool PropertyParserColour::ParseValue(Property& property, const String& value, c
 	{
 		StringList values;
 
-		int find = value.Find("(") + 1;
+		int find = (int)value.Find("(") + 1;
 		StringUtilities::ExpandString(values, value.Substring(find, value.RFind(")") - find), ',');
 
 		// Check if we're parsing an 'rgba' or 'rgb' colour declaration.

+ 2 - 2
Source/Core/Stream.cpp

@@ -70,7 +70,7 @@ size_t Stream::Peek(void* buffer, size_t bytes) const
 {
 	size_t pos = Tell();
 	size_t read = Read( buffer, bytes );
-	Seek( pos, SEEK_SET );
+	Seek( (long)pos, SEEK_SET );
 	return read;
 }
 
@@ -130,7 +130,7 @@ size_t Stream::PushBack(const void* buffer, size_t bytes)
 	size_t pos = Tell();
 	Seek(0, SEEK_END);
 	size_t wrote = Write(buffer, bytes);
-	Seek(pos, SEEK_SET);
+	Seek((long)pos, SEEK_SET);
 	return wrote;
 }
 

+ 2 - 2
Source/Core/String.cpp

@@ -64,7 +64,7 @@ StringBase<char>::StringBase(StringBase<char>::size_type max_size, const char* f
 	va_list argument_list;
 	va_start(argument_list, fmt);
 
-	RocketStringFormatString(*this, max_size, fmt, argument_list);
+	RocketStringFormatString(*this, (int)max_size, fmt, argument_list);
 
 	va_end(argument_list);
 }
@@ -75,7 +75,7 @@ int StringBase<char>::FormatString(StringBase<char>::size_type max_size, const c
 	va_list argument_list;
 	va_start(argument_list, fmt);
 
-	int length = RocketStringFormatString(*this, max_size, fmt, argument_list);
+	int length = RocketStringFormatString(*this, (int)max_size, fmt, argument_list);
 
 	va_end(argument_list);
 

+ 1 - 1
Source/Core/StyleSheetParser.cpp

@@ -95,7 +95,7 @@ bool StyleSheetParser::ParseProperties(PropertyDictionary& parsed_properties, co
 
 bool StyleSheetParser::ReadProperties(PropertyDictionary& properties)
 {
-	int rule_line_number = line_number;
+	int rule_line_number = (int)line_number;
 	String name;
 	String value;
 

+ 1 - 1
Source/Core/XMLParseTools.cpp

@@ -40,7 +40,7 @@ namespace Core {
 // NOTE: tag *MUST* be in lowercase
 const char* XMLParseTools::FindTag(const char* tag, const char* string, bool closing_tag)
 {
-	int length = strlen(tag);
+	int length = (int)strlen(tag);
 	const char* ptr = string;
 	bool found_closing = false;