Explorar el Código

Some slightly nasty casts to reduce warnings in header files on 64bit MSVC compile. The length of strings/containers is intentionally stored as 32bit even in a 64bit compile to ensure the script API stays unchanged.

Lasse Öörni hace 12 años
padre
commit
fed83fb1ca

+ 1 - 1
Engine/Container/Str.h

@@ -427,7 +427,7 @@ public:
         if (!str)
             return 0;
         #ifdef _MSC_VER
-        return strlen(str);
+        return (unsigned)strlen(str);
         #else
         const char* ptr = str;
         while (*ptr)

+ 2 - 2
Engine/Container/VectorBase.h

@@ -63,7 +63,7 @@ template <class T> struct RandomAccessIterator
     /// Subtract an offset from the pointer.
     RandomAccessIterator<T> operator - (int value) const { return RandomAccessIterator<T>(ptr_ - value); }
     /// Calculate offset to another iterator.
-    int operator - (const RandomAccessIterator& rhs) const { return ptr_ - rhs.ptr_; }
+    int operator - (const RandomAccessIterator& rhs) const { return (int)(ptr_ - rhs.ptr_); }
     /// Test for equality with another iterator.
     bool operator == (const RandomAccessIterator& rhs) const { return ptr_ == rhs.ptr_; }
     /// Test for inequality with another iterator.
@@ -125,7 +125,7 @@ template <class T> struct RandomAccessConstIterator
     /// Subtract an offset from the pointer.
     RandomAccessConstIterator<T> operator - (int value) const { return RandomAccessConstIterator<T>(ptr_ - value); }
     /// Calculate offset to another iterator.
-    int operator - (const RandomAccessConstIterator& rhs) const { return ptr_ - rhs.ptr_; }
+    int operator - (const RandomAccessConstIterator& rhs) const { return (int)(ptr_ - rhs.ptr_); }
     /// Test for equality with another iterator.
     bool operator == (const RandomAccessConstIterator& rhs) const { return ptr_ == rhs.ptr_; }
     /// Test for inequality with another iterator.

+ 3 - 3
Engine/Core/Attribute.h

@@ -74,7 +74,7 @@ struct AttributeInfo
     AttributeInfo(VariantType type, const char* name, size_t offset, const Variant& defaultValue, unsigned mode) :
         type_(type),
         name_(name),
-        offset_(offset),
+        offset_((unsigned)offset),
         enumNames_(0),
         defaultValue_(defaultValue),
         mode_(mode),
@@ -83,10 +83,10 @@ struct AttributeInfo
     }
     
     /// Construct offset enum attribute.
-    AttributeInfo(const char* name, unsigned offset, const char** enumNames, const Variant& defaultValue, unsigned mode) :
+    AttributeInfo(const char* name, size_t offset, const char** enumNames, const Variant& defaultValue, unsigned mode) :
         type_(VAR_INT),
         name_(name),
-        offset_(offset),
+        offset_((unsigned)offset),
         enumNames_(enumNames),
         defaultValue_(defaultValue),
         mode_(mode),

+ 1 - 1
Engine/IO/Serializer.cpp

@@ -151,7 +151,7 @@ bool Serializer::WriteString(const String& value)
 {
     const char* chars = value.CString();
     // Count length to the first zero, because ReadString() does the same
-    unsigned length = strlen(chars);
+    unsigned length = String::CStringLength(chars);
     return Write(chars, length + 1) == length + 1;
 }
 

+ 1 - 1
Engine/Resource/XMLElement.cpp

@@ -861,7 +861,7 @@ XPathResultSet& XPathResultSet::operator = (const XPathResultSet& rhs)
 XMLElement XPathResultSet::operator[](unsigned index) const
 {
     if (!resultSet_)
-        LOGERROR(ToString("Could not return result at index: %u. Most probably this is caused by the XPathResultSet is not stored in a lhs variable.", index));
+        LOGERROR(ToString("Could not return result at index: %u. Most probably this is caused by the XPathResultSet not being stored in a lhs variable.", index));
 
     return resultSet_ && index < Size() ? XMLElement(file_, this, &resultSet_->operator [](index), index) : XMLElement();
 }