Browse Source

Converted static const String arrays to const char* arrays where applicable.
Removed unneeded W32Clock.cpp (old kNet file.)

Lasse Öörni 12 years ago
parent
commit
4e1e1f9ce6

+ 5 - 13
Engine/Core/Variant.cpp

@@ -36,7 +36,7 @@ const ResourceRefList Variant::emptyResourceRefList;
 const VariantMap Variant::emptyVariantMap;
 const VariantMap Variant::emptyVariantMap;
 const VariantVector Variant::emptyVariantVector;
 const VariantVector Variant::emptyVariantVector;
 
 
-static const String typeNames[] =
+static const char* typeNames[] =
 {
 {
     "None",
     "None",
     "Int",
     "Int",
@@ -56,7 +56,7 @@ static const String typeNames[] =
     "VariantMap",
     "VariantMap",
     "IntRect",
     "IntRect",
     "IntVector2",
     "IntVector2",
-    ""
+    0
 };
 };
 
 
 Variant& Variant::operator = (const Variant& rhs)
 Variant& Variant::operator = (const Variant& rhs)
@@ -280,7 +280,7 @@ void Variant::SetBuffer(const void* data, unsigned size)
         memcpy(&buffer[0], data, size);
         memcpy(&buffer[0], data, size);
 }
 }
 
 
-const String& Variant::GetTypeName() const
+String Variant::GetTypeName() const
 {
 {
     return typeNames[type_];
     return typeNames[type_];
 }
 }
@@ -629,7 +629,7 @@ template<> PODVector<unsigned char> Variant::Get<PODVector<unsigned char> >() co
     return GetBuffer();
     return GetBuffer();
 }
 }
 
 
-const String& Variant::GetTypeName(VariantType type)
+String Variant::GetTypeName(VariantType type)
 {
 {
     return typeNames[type];
     return typeNames[type];
 }
 }
@@ -641,15 +641,7 @@ VariantType Variant::GetTypeFromName(const String& typeName)
 
 
 VariantType Variant::GetTypeFromName(const char* typeName)
 VariantType Variant::GetTypeFromName(const char* typeName)
 {
 {
-    unsigned index = 0;
-    while (index < MAX_VAR_TYPES)
-    {
-        if (!typeNames[index].Compare(typeName, false))
-            return (VariantType)index;
-        ++index;
-    }
-
-    return VAR_NONE;
+    return (VariantType)GetStringListIndex(typeName, typeNames, VAR_NONE);
 }
 }
 
 
 }
 }

+ 2 - 2
Engine/Core/Variant.h

@@ -689,7 +689,7 @@ public:
     /// Return value's type.
     /// Return value's type.
     VariantType GetType() const { return type_; }
     VariantType GetType() const { return type_; }
     /// Return value's type name.
     /// Return value's type name.
-    const String& GetTypeName() const;
+    String GetTypeName() const;
     /// Convert value to string. Pointers are returned as null, and VariantBuffer or VariantMap are not supported and return empty.
     /// Convert value to string. Pointers are returned as null, and VariantBuffer or VariantMap are not supported and return empty.
     String ToString() const;
     String ToString() const;
     /// Return true when the variant value is considered zero according to its actual type.
     /// Return true when the variant value is considered zero according to its actual type.
@@ -698,7 +698,7 @@ public:
     bool IsEmpty() const { return GetType() == VAR_NONE; }
     bool IsEmpty() const { return GetType() == VAR_NONE; }
 
 
     /// Return name for variant type.
     /// Return name for variant type.
-    static const String& GetTypeName(VariantType type);
+    static String GetTypeName(VariantType type);
     /// Return variant type from type name.
     /// Return variant type from type name.
     static VariantType GetTypeFromName(const String& typeName);
     static VariantType GetTypeFromName(const String& typeName);
     /// Return variant type from type name.
     /// Return variant type from type name.

+ 1 - 1
Engine/Engine/CoreAPI.cpp

@@ -516,7 +516,7 @@ static void RegisterVariant(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Variant", "bool get_zero() const", asMETHOD(Variant, IsZero), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "bool get_zero() const", asMETHOD(Variant, IsZero), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "bool get_empty() const", asMETHOD(Variant, IsEmpty), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "bool get_empty() const", asMETHOD(Variant, IsEmpty), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "VariantType get_type() const", asMETHOD(Variant, GetType), asCALL_THISCALL);
     engine->RegisterObjectMethod("Variant", "VariantType get_type() const", asMETHOD(Variant, GetType), asCALL_THISCALL);
-    engine->RegisterObjectMethod("Variant", "const String& get_typeName() const", asMETHODPR(Variant, GetTypeName, () const, const String&), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Variant", "String get_typeName() const", asMETHODPR(Variant, GetTypeName, () const, String), asCALL_THISCALL);
 
 
     engine->RegisterObjectBehaviour("VariantMap", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructVariantMap), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectBehaviour("VariantMap", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructVariantMap), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectBehaviour("VariantMap", asBEHAVE_CONSTRUCT, "void f(const VariantMap&in)", asFUNCTION(ConstructVariantMapCopy), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectBehaviour("VariantMap", asBEHAVE_CONSTRUCT, "void f(const VariantMap&in)", asFUNCTION(ConstructVariantMapCopy), asCALL_CDECL_OBJLAST);

+ 3 - 1
Engine/Engine/Engine.cpp

@@ -70,6 +70,8 @@ typedef struct _CrtMemBlockHeader
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
+extern const char* logLevelPrefixes[];
+
 OBJECTTYPESTATIC(Engine);
 OBJECTTYPESTATIC(Engine);
 
 
 Engine::Engine(Context* context) :
 Engine::Engine(Context* context) :
@@ -545,7 +547,7 @@ VariantMap Engine::ParseParameters(const Vector<String>& arguments)
             else if (argument.Substring(0, 3) == "log")
             else if (argument.Substring(0, 3) == "log")
             {
             {
                 argument = argument.Substring(3);
                 argument = argument.Substring(3);
-                int logLevel = GetStringListIndex(argument, logLevelPrefixes, -1);
+                int logLevel = GetStringListIndex(argument.CString(), logLevelPrefixes, -1);
                 if (logLevel != -1)
                 if (logLevel != -1)
                     ret["LogLevel"] = logLevel;
                     ret["LogLevel"] = logLevel;
             }
             }

+ 6 - 6
Engine/Graphics/Direct3D9/D3D9Texture.cpp

@@ -36,23 +36,23 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-static const String addressModeNames[] =
+static const char* addressModeNames[] =
 {
 {
     "wrap",
     "wrap",
     "mirror",
     "mirror",
     "clamp",
     "clamp",
     "border",
     "border",
-    ""
+    0
 };
 };
 
 
-static const String filterModeNames[] =
+static const char* filterModeNames[] =
 {
 {
     "nearest",
     "nearest",
     "bilinear",
     "bilinear",
     "trilinear",
     "trilinear",
     "anisotropic",
     "anisotropic",
     "default",
     "default",
-    ""
+    0
 };
 };
 
 
 Texture::Texture(Context* context) :
 Texture::Texture(Context* context) :
@@ -236,7 +236,7 @@ void Texture::LoadParameters(const XMLElement& element)
             {
             {
                 TextureCoordinate coordIndex = (TextureCoordinate)(coord[0] - 'u');
                 TextureCoordinate coordIndex = (TextureCoordinate)(coord[0] - 'u');
                 String mode = paramElem.GetAttributeLower("mode");
                 String mode = paramElem.GetAttributeLower("mode");
-                SetAddressMode(coordIndex, (TextureAddressMode)GetStringListIndex(mode, addressModeNames, ADDRESS_WRAP));
+                SetAddressMode(coordIndex, (TextureAddressMode)GetStringListIndex(mode.CString(), addressModeNames, ADDRESS_WRAP));
             }
             }
         }
         }
         
         
@@ -246,7 +246,7 @@ void Texture::LoadParameters(const XMLElement& element)
         if (name == "filter")
         if (name == "filter")
         {
         {
             String mode = paramElem.GetAttributeLower("mode");
             String mode = paramElem.GetAttributeLower("mode");
-            SetFilterMode((TextureFilterMode)GetStringListIndex(mode, filterModeNames, FILTER_DEFAULT));
+            SetFilterMode((TextureFilterMode)GetStringListIndex(mode.CString(), filterModeNames, FILTER_DEFAULT));
         }
         }
         
         
         if (name == "mipmap")
         if (name == "mipmap")

+ 0 - 17
Engine/Graphics/Direct3D9/D3D9VertexBuffer.cpp

@@ -48,23 +48,6 @@ const unsigned VertexBuffer::elementSize[] =
     4 * sizeof(float) // Instancematrix3
     4 * sizeof(float) // Instancematrix3
 };
 };
 
 
-const String VertexBuffer::elementName[] =
-{
-    "Position",
-    "Normal",
-    "Color",
-    "Texcoord1",
-    "Texcoord2",
-    "Cubetexcoord1",
-    "Cubetexcoord2",
-    "Tangent"
-    "Blendweights",
-    "Blendindices",
-    "Instancematrix1",
-    "Instancematrix2",
-    "Instancematrix3"
-};
-
 OBJECTTYPESTATIC(VertexBuffer);
 OBJECTTYPESTATIC(VertexBuffer);
 
 
 VertexBuffer::VertexBuffer(Context* context) :
 VertexBuffer::VertexBuffer(Context* context) :

+ 0 - 2
Engine/Graphics/Direct3D9/D3D9VertexBuffer.h

@@ -86,8 +86,6 @@ public:
     
     
     /// Vertex element sizes.
     /// Vertex element sizes.
     static const unsigned elementSize[];
     static const unsigned elementSize[];
-    /// Vertex element names.
-    static const String elementName[];
     
     
 private:
 private:
     /// Update offsets of vertex elements.
     /// Update offsets of vertex elements.

+ 8 - 8
Engine/Graphics/Material.cpp

@@ -40,7 +40,7 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-const String textureUnitNames[] =
+static const char* textureUnitNames[] =
 {
 {
     "diffuse",
     "diffuse",
     "normal",
     "normal",
@@ -54,20 +54,20 @@ const String textureUnitNames[] =
     "indirection",
     "indirection",
     "depth",
     "depth",
     "light",
     "light",
-    ""
+    0
 };
 };
 
 
-static const String cullModeNames[] =
+static const char* cullModeNames[] =
 {
 {
     "none",
     "none",
     "ccw",
     "ccw",
     "cw",
     "cw",
-    ""
+    0
 };
 };
 
 
 TextureUnit ParseTextureUnitName(const String& name)
 TextureUnit ParseTextureUnitName(const String& name)
 {
 {
-    TextureUnit unit = (TextureUnit)GetStringListIndex(name, textureUnitNames, MAX_TEXTURE_UNITS);
+    TextureUnit unit = (TextureUnit)GetStringListIndex(name.CString(), textureUnitNames, MAX_TEXTURE_UNITS);
     if (name == "diff")
     if (name == "diff")
         unit = TU_DIFFUSE;
         unit = TU_DIFFUSE;
     else if (name == "albedo")
     else if (name == "albedo")
@@ -198,11 +198,11 @@ bool Material::Load(Deserializer& source)
     
     
     XMLElement cullElem = rootElem.GetChild("cull");
     XMLElement cullElem = rootElem.GetChild("cull");
     if (cullElem)
     if (cullElem)
-        SetCullMode((CullMode)GetStringListIndex(cullElem.GetAttribute("value"), cullModeNames, CULL_CCW));
+        SetCullMode((CullMode)GetStringListIndex(cullElem.GetAttribute("value").CString(), cullModeNames, CULL_CCW));
     
     
     XMLElement shadowCullElem = rootElem.GetChild("shadowcull");
     XMLElement shadowCullElem = rootElem.GetChild("shadowcull");
     if (shadowCullElem)
     if (shadowCullElem)
-        SetShadowCullMode((CullMode)GetStringListIndex(shadowCullElem.GetAttribute("value"), cullModeNames, CULL_CCW));
+        SetShadowCullMode((CullMode)GetStringListIndex(shadowCullElem.GetAttribute("value").CString(), cullModeNames, CULL_CCW));
     
     
     XMLElement depthBiasElem = rootElem.GetChild("depthbias");
     XMLElement depthBiasElem = rootElem.GetChild("depthbias");
     if (depthBiasElem)
     if (depthBiasElem)
@@ -425,7 +425,7 @@ const Vector4& Material::GetShaderParameter(const String& name) const
     return i != shaderParameters_.End() ? i->second_.value_ : Vector4::ZERO;
     return i != shaderParameters_.End() ? i->second_.value_ : Vector4::ZERO;
 }
 }
 
 
-const String& Material::GetTextureUnitName(TextureUnit unit)
+String Material::GetTextureUnitName(TextureUnit unit)
 {
 {
     return textureUnitNames[unit];
     return textureUnitNames[unit];
 }
 }

+ 1 - 1
Engine/Graphics/Material.h

@@ -140,7 +140,7 @@ public:
     bool GetSpecular() const { return specular_; }
     bool GetSpecular() const { return specular_; }
     
     
     /// Return name for texture unit.
     /// Return name for texture unit.
-    static const String& GetTextureUnitName(TextureUnit unit);
+    static String GetTextureUnitName(TextureUnit unit);
     
     
 private:
 private:
     /// Re-evaluate occlusion rendering.
     /// Re-evaluate occlusion rendering.

+ 6 - 6
Engine/Graphics/OpenGL/OGLTexture.cpp

@@ -50,23 +50,23 @@ GLenum glWrapModes[] =
     #endif
     #endif
 };
 };
 
 
-static const String addressModeNames[] =
+static const char* addressModeNames[] =
 {
 {
     "wrap",
     "wrap",
     "mirror",
     "mirror",
     "clamp",
     "clamp",
     "border",
     "border",
-    ""
+    0
 };
 };
 
 
-static const String filterModeNames[] =
+static const char* filterModeNames[] =
 {
 {
     "nearest",
     "nearest",
     "bilinear",
     "bilinear",
     "trilinear",
     "trilinear",
     "anisotropic",
     "anisotropic",
     "default",
     "default",
-    ""
+    0
 };
 };
 
 
 Texture::Texture(Context* context) :
 Texture::Texture(Context* context) :
@@ -396,7 +396,7 @@ void Texture::LoadParameters(const XMLElement& elem)
             {
             {
                 TextureCoordinate coordIndex = (TextureCoordinate)(coord[0] - 'u');
                 TextureCoordinate coordIndex = (TextureCoordinate)(coord[0] - 'u');
                 String mode = paramElem.GetAttributeLower("mode");
                 String mode = paramElem.GetAttributeLower("mode");
-                SetAddressMode(coordIndex, (TextureAddressMode)GetStringListIndex(mode, addressModeNames, ADDRESS_WRAP));
+                SetAddressMode(coordIndex, (TextureAddressMode)GetStringListIndex(mode.CString(), addressModeNames, ADDRESS_WRAP));
             }
             }
         }
         }
         
         
@@ -406,7 +406,7 @@ void Texture::LoadParameters(const XMLElement& elem)
         if (name == "filter")
         if (name == "filter")
         {
         {
             String mode = paramElem.GetAttributeLower("mode");
             String mode = paramElem.GetAttributeLower("mode");
-            SetFilterMode((TextureFilterMode)GetStringListIndex(mode, filterModeNames, FILTER_DEFAULT));
+            SetFilterMode((TextureFilterMode)GetStringListIndex(mode.CString(), filterModeNames, FILTER_DEFAULT));
         }
         }
         
         
         if (name == "mipmap")
         if (name == "mipmap")

+ 0 - 17
Engine/Graphics/OpenGL/OGLVertexBuffer.cpp

@@ -101,23 +101,6 @@ const unsigned VertexBuffer::elementNormalize[] =
     GL_FALSE // Instancematrix3
     GL_FALSE // Instancematrix3
 };
 };
 
 
-const String VertexBuffer::elementName[] =
-{
-    "Position",
-    "Normal",
-    "Color",
-    "Texcoord1",
-    "Texcoord2",
-    "Cubetexcoord1",
-    "Cubetexcoord2",
-    "Tangent"
-    "Blendweights",
-    "Blendindices",
-    "Instancematrix1",
-    "Instancematrix2",
-    "Instancematrix3"
-};
-
 OBJECTTYPESTATIC(VertexBuffer);
 OBJECTTYPESTATIC(VertexBuffer);
 
 
 VertexBuffer::VertexBuffer(Context* context) :
 VertexBuffer::VertexBuffer(Context* context) :

+ 1 - 3
Engine/Graphics/OpenGL/OGLVertexBuffer.h

@@ -88,9 +88,7 @@ public:
     static const unsigned elementComponents[];
     static const unsigned elementComponents[];
     /// Vertex element OpenGL normalization.
     /// Vertex element OpenGL normalization.
     static const unsigned elementNormalize[];
     static const unsigned elementNormalize[];
-    /// Vertex element names.
-    static const String elementName[];
-    
+
 private:
 private:
     /// Update offsets of vertex elements.
     /// Update offsets of vertex elements.
     void UpdateOffsets();
     void UpdateOffsets();

+ 6 - 6
Engine/Graphics/RenderPath.cpp

@@ -31,7 +31,7 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-static const String commandTypeNames[] =
+static const char* commandTypeNames[] =
 {
 {
     "none",
     "none",
     "clear",
     "clear",
@@ -39,14 +39,14 @@ static const String commandTypeNames[] =
     "quad",
     "quad",
     "forwardlights",
     "forwardlights",
     "lightvolumes",
     "lightvolumes",
-    ""
+    0
 };
 };
 
 
-static const String sortModeNames[] =
+static const char* sortModeNames[] =
 {
 {
     "fronttoback",
     "fronttoback",
     "backtofront",
     "backtofront",
-    ""
+    0
 };
 };
 
 
 TextureUnit ParseTextureUnitName(const String& name);
 TextureUnit ParseTextureUnitName(const String& name);
@@ -88,7 +88,7 @@ void RenderTargetInfo::Load(const XMLElement& element)
 
 
 void RenderPathCommand::Load(const XMLElement& element)
 void RenderPathCommand::Load(const XMLElement& element)
 {
 {
-    type_ = (RenderCommandType)GetStringListIndex(element.GetAttributeLower("type"), commandTypeNames, CMD_NONE);
+    type_ = (RenderCommandType)GetStringListIndex(element.GetAttributeLower("type").CString(), commandTypeNames, CMD_NONE);
     tag_ = element.GetAttribute("tag");
     tag_ = element.GetAttribute("tag");
     if (element.HasAttribute("enabled"))
     if (element.HasAttribute("enabled"))
         enabled_ = element.GetBool("enabled");
         enabled_ = element.GetBool("enabled");
@@ -119,7 +119,7 @@ void RenderPathCommand::Load(const XMLElement& element)
         
         
     case CMD_SCENEPASS:
     case CMD_SCENEPASS:
         pass_ = element.GetAttribute("pass");
         pass_ = element.GetAttribute("pass");
-        sortMode_ = (RenderCommandSortMode)GetStringListIndex(element.GetAttributeLower("sort"), sortModeNames, SORT_FRONTTOBACK);
+        sortMode_ = (RenderCommandSortMode)GetStringListIndex(element.GetAttributeLower("sort").CString(), sortModeNames, SORT_FRONTTOBACK);
         if (element.HasAttribute("marktostencil"))
         if (element.HasAttribute("marktostencil"))
             markToStencil_ = element.GetBool("marktostencil");
             markToStencil_ = element.GetBool("marktostencil");
         if (element.HasAttribute("vertexlights"))
         if (element.HasAttribute("vertexlights"))

+ 6 - 6
Engine/Graphics/Renderer.cpp

@@ -171,7 +171,7 @@ static const unsigned short spotLightIndexData[] =
     7, 6, 5
     7, 6, 5
 };
 };
 
 
-static const String shadowVariations[] =
+static const char* shadowVariations[] =
 {
 {
     // No specific hardware shadow compare variation on OpenGL, it is always supported
     // No specific hardware shadow compare variation on OpenGL, it is always supported
     #ifdef USE_OPENGL
     #ifdef USE_OPENGL
@@ -187,7 +187,7 @@ static const String shadowVariations[] =
     #endif
     #endif
 };
 };
 
 
-static const String geometryVSVariations[] =
+static const char* geometryVSVariations[] =
 {
 {
     "",
     "",
     "Skinned",
     "Skinned",
@@ -195,7 +195,7 @@ static const String geometryVSVariations[] =
     "Billboard"
     "Billboard"
 };
 };
 
 
-static const String lightVSVariations[] =
+static const char* lightVSVariations[] =
 {
 {
     "Dir",
     "Dir",
     "Spot",
     "Spot",
@@ -211,7 +211,7 @@ static const String lightVSVariations[] =
     "PointSpecShadow"
     "PointSpecShadow"
 };
 };
 
 
-static const String vertexLightVSVariations[] =
+static const char* vertexLightVSVariations[] =
 {
 {
     "",
     "",
     "1VL",
     "1VL",
@@ -222,7 +222,7 @@ static const String vertexLightVSVariations[] =
     "6VL"
     "6VL"
 };
 };
 
 
-static const String deferredLightVSVariations[] =
+static const char* deferredLightVSVariations[] =
 {
 {
     "",
     "",
     "Dir",
     "Dir",
@@ -230,7 +230,7 @@ static const String deferredLightVSVariations[] =
     "OrthoDir"
     "OrthoDir"
 };
 };
 
 
-static const String lightPSVariations[] = 
+static const char* lightPSVariations[] = 
 {
 {
     "Dir",
     "Dir",
     "Spot",
     "Spot",

+ 7 - 6
Engine/Graphics/Technique.cpp

@@ -47,7 +47,7 @@ const char* blendModeNames[] =
     0
     0
 };
 };
 
 
-static const String compareModeNames[] =
+static const char* compareModeNames[] =
 {
 {
     "always",
     "always",
     "equal",
     "equal",
@@ -56,15 +56,15 @@ static const String compareModeNames[] =
     "lessequal",
     "lessequal",
     "greater",
     "greater",
     "greaterequal",
     "greaterequal",
-    ""
+    0
 };
 };
 
 
-static const String lightingModeNames[] =
+static const char* lightingModeNames[] =
 {
 {
     "unlit",
     "unlit",
     "pervertex",
     "pervertex",
     "perpixel",
     "perpixel",
-    ""
+    0
 };
 };
 
 
 Pass::Pass(StringHash type) :
 Pass::Pass(StringHash type) :
@@ -181,7 +181,8 @@ bool Technique::Load(Deserializer& source)
             if (passElem.HasAttribute("lighting"))
             if (passElem.HasAttribute("lighting"))
             {
             {
                 String lighting = passElem.GetAttributeLower("lighting");
                 String lighting = passElem.GetAttributeLower("lighting");
-                newPass->SetLightingMode((PassLightingMode)GetStringListIndex(lighting, lightingModeNames, LIGHTING_UNLIT));
+                newPass->SetLightingMode((PassLightingMode)GetStringListIndex(lighting.CString(), lightingModeNames,
+                    LIGHTING_UNLIT));
             }
             }
             
             
             if (passElem.HasAttribute("blend"))
             if (passElem.HasAttribute("blend"))
@@ -196,7 +197,7 @@ bool Technique::Load(Deserializer& source)
                 if (depthTest == "false")
                 if (depthTest == "false")
                     newPass->SetDepthTestMode(CMP_ALWAYS);
                     newPass->SetDepthTestMode(CMP_ALWAYS);
                 else
                 else
-                    newPass->SetDepthTestMode((CompareMode)GetStringListIndex(depthTest, compareModeNames, CMP_LESS));
+                    newPass->SetDepthTestMode((CompareMode)GetStringListIndex(depthTest.CString(), compareModeNames, CMP_LESS));
             }
             }
             
             
             if (passElem.HasAttribute("depthwrite"))
             if (passElem.HasAttribute("depthwrite"))

+ 11 - 2
Engine/IO/Log.cpp

@@ -43,7 +43,13 @@ extern "C" void SDL_IOS_LogMessage(const char* message);
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-OBJECTTYPESTATIC(Log);
+const char* logLevelPrefixes[] =
+{
+    "DEBUG",
+    "INFO",
+    "WARNING",
+    "ERROR"
+};
 
 
 SharedPtr<File> Log::logFile_;
 SharedPtr<File> Log::logFile_;
 String Log::lastMessage_;
 String Log::lastMessage_;
@@ -58,6 +64,8 @@ bool Log::quiet_ = false;
 
 
 static PODVector<Log*> logInstances;
 static PODVector<Log*> logInstances;
 
 
+OBJECTTYPESTATIC(Log);
+
 Log::Log(Context* context) :
 Log::Log(Context* context) :
     Object(context)
     Object(context)
 {
 {
@@ -130,7 +138,8 @@ void Log::Write(int level, const String& message)
     {
     {
         MutexLock lock(GetStaticMutex());
         MutexLock lock(GetStaticMutex());
         
         
-        String formattedMessage = logLevelPrefixes[level] + ": " + message;
+        String formattedMessage = logLevelPrefixes[level];
+        formattedMessage += ": " + message;
         lastMessage_ = message;
         lastMessage_ = message;
         
         
         if (timeStamp_)
         if (timeStamp_)

+ 0 - 9
Engine/IO/Log.h

@@ -38,15 +38,6 @@ static const int LOG_ERROR = 3;
 /// Disable all log messages.
 /// Disable all log messages.
 static const int LOG_NONE = 4;
 static const int LOG_NONE = 4;
 
 
-static const String logLevelPrefixes[] =
-{
-    "DEBUG",
-    "INFO",
-    "WARNING",
-    "ERROR",
-    ""
-};
-
 class File;
 class File;
 
 
 /// Logging subsystem.
 /// Logging subsystem.

+ 4 - 4
Engine/Resource/ResourceCache.cpp

@@ -37,7 +37,7 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-static const String checkDirs[] = {
+static const char* checkDirs[] = {
     "Fonts",
     "Fonts",
     "Materials",
     "Materials",
     "Models",
     "Models",
@@ -53,7 +53,7 @@ static const String checkDirs[] = {
     "Techniques",
     "Techniques",
     "Textures",
     "Textures",
     "UI",
     "UI",
-    ""
+    0
 };
 };
 
 
 static const SharedPtr<Resource> noResource;
 static const SharedPtr<Resource> noResource;
@@ -548,7 +548,7 @@ String ResourceCache::GetPreferredResourceDir(const String& path) const
     if (!fileSystem)
     if (!fileSystem)
         return fixedPath;
         return fixedPath;
     
     
-    for (unsigned i = 0; !checkDirs[i].Empty(); ++i)
+    for (unsigned i = 0; checkDirs[i] != 0; ++i)
     {
     {
         if (fileSystem->DirExists(fixedPath + checkDirs[i]))
         if (fileSystem->DirExists(fixedPath + checkDirs[i]))
         {
         {
@@ -559,7 +559,7 @@ String ResourceCache::GetPreferredResourceDir(const String& path) const
     if (!pathHasKnownDirs)
     if (!pathHasKnownDirs)
     {
     {
         String parentPath = GetParentPath(fixedPath);
         String parentPath = GetParentPath(fixedPath);
-        for (unsigned i = 0; !checkDirs[i].Empty(); ++i)
+        for (unsigned i = 0; checkDirs[i] != 0; ++i)
         {
         {
             if (fileSystem->DirExists(parentPath + checkDirs[i]))
             if (fileSystem->DirExists(parentPath + checkDirs[i]))
             {
             {

+ 1 - 1
Engine/Script/ScriptInstance.cpp

@@ -42,7 +42,7 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-static const String methodDeclarations[] = {
+static const char* methodDeclarations[] = {
     "void Start()",
     "void Start()",
     "void Stop()",
     "void Stop()",
     "void DelayedStart()",
     "void DelayedStart()",

+ 0 - 138
ThirdParty/kNet/src/win32/W32Clock.cpp

@@ -1,138 +0,0 @@
-/* Copyright The kNet Project.
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License. */
-
-/** @file W32Clock.cpp
-	@brief */
-
-#include <cassert>
-
-#include "kNet/DebugMemoryLeakCheck.h"
-
-#include "kNet/Clock.h"
-#include "kNet/NetworkLogging.h"
-
-#define NOMINMAX
-#include <windows.h>
-
-namespace kNet
-{
-
-Clock impl;
-
-LARGE_INTEGER Clock::ddwTimerFrequency;
-tick_t Clock::appStartTime = 0xFFFFFFFF;
-
-void Clock::InitClockData()
-{
-	if (appStartTime != 0xFFFFFFFF)
-		return;
-
-	if (!QueryPerformanceFrequency(&ddwTimerFrequency))
-	{
-		LOG(LogError, "The system doesn't support high-resolution timers!");
-		ddwTimerFrequency.HighPart = (unsigned long)-1;
-		ddwTimerFrequency.LowPart = (unsigned long)-1;
-	}
-
-	if (ddwTimerFrequency.HighPart > 0)
-		LOG(LogError, "Warning: Clock::TicksPerSec will yield invalid timing data!");
-
-	if (appStartTime == 0)
-		appStartTime = GetTickCount();
-
-	///\todo Test here that the return values of QueryPerformanceCounter is nondecreasing.
-}
-
-Clock::Clock()
-{
-	InitClockData();
-}
-
-void Clock::Sleep(int milliseconds)
-{
-	::Sleep(milliseconds);
-}
-
-int Clock::Year()
-{
-	SYSTEMTIME s;
-	GetSystemTime(&s);
-	return s.wYear;
-}
-
-int Clock::Month()
-{
-	SYSTEMTIME s;
-	GetSystemTime(&s);
-	return s.wMonth;
-}
-
-int Clock::Day()
-{
-	SYSTEMTIME s;
-	GetSystemTime(&s);
-	return s.wDay;
-}
-
-int Clock::Hour()
-{
-	SYSTEMTIME s;
-	GetSystemTime(&s);
-	return s.wHour;
-}
-
-int Clock::Min()
-{
-	SYSTEMTIME s;
-	GetSystemTime(&s);
-	return s.wMinute;
-}
-
-int Clock::Sec()
-{
-	SYSTEMTIME s;
-	GetSystemTime(&s);
-	return s.wSecond;
-}
-
-unsigned long Clock::SystemTime()
-{
-	return GetTickCount();
-}
-
-unsigned long Clock::Time()
-{
-	return (unsigned long)(GetTickCount() - appStartTime);
-}
-
-tick_t Clock::Tick()
-{
-	LARGE_INTEGER ddwTimer;
-	QueryPerformanceCounter(&ddwTimer);
-	return ddwTimer.QuadPart;
-}
-
-unsigned long Clock::TickU32()
-{
-	LARGE_INTEGER ddwTimer;
-	QueryPerformanceCounter(&ddwTimer);
-	return ddwTimer.LowPart;
-}
-
-tick_t Clock::TicksPerSec()
-{
-	return ddwTimerFrequency.QuadPart;
-}
-
-} // ~kNet