strcmp repalced

This commit is contained in:
Mikulas Florek 2015-11-12 17:54:02 +01:00
parent 9d03fdc612
commit 4d37279542
25 changed files with 136 additions and 133 deletions

View file

@ -133,12 +133,12 @@ public:
}
}
if (strcmp(device->name(), "memory") == 0)
if (compareString(device->name(), "memory") == 0)
{
m_memory_device.m_devices[0] = device;
m_memory_device.m_devices[1] = nullptr;
}
else if (strcmp(device->name(), "disk") == 0)
else if (compareString(device->name(), "disk") == 0)
{
m_disk_device.m_devices[0] = device;
m_disk_device.m_devices[1] = nullptr;
@ -348,7 +348,7 @@ public:
{
for (int i = 0; i < m_devices.size(); ++i)
{
if (strcmp(m_devices[i]->name(), device) == 0)
if (compareString(m_devices[i]->name(), device) == 0)
return m_devices[i];
}

View file

@ -2,7 +2,7 @@
#include "lumix.h"
#include <new>
//#include <new>
namespace Lumix

View file

@ -114,7 +114,7 @@ bool hasExtension(const char* filename, const char* ext)
char tmp[20];
getExtension(tmp, sizeof(tmp), filename);
return strcmp(tmp, ext) == 0;
return compareString(tmp, ext) == 0;
}

View file

@ -11,6 +11,17 @@ static char makeLowercase(char c)
}
int compareString(const char* lhs, const char* rhs)
{
while(*lhs && *lhs == *rhs)
{
++lhs;
++rhs;
}
return *lhs - *rhs;
}
int stringLength(const char* str)
{
const char* c = str;

View file

@ -18,29 +18,23 @@ LUMIX_ENGINE_API bool toCString(int32 value, char* output, int length);
LUMIX_ENGINE_API bool toCString(int64 value, char* output, int length);
LUMIX_ENGINE_API bool toCString(uint64 value, char* output, int length);
LUMIX_ENGINE_API bool toCString(uint32 value, char* output, int length);
LUMIX_ENGINE_API bool
toCString(float value, char* output, int length, int after_point);
LUMIX_ENGINE_API const char*
reverseFind(const char* str, const char* from, char c);
LUMIX_ENGINE_API const char*
fromCString(const char* input, int length, int32* value);
LUMIX_ENGINE_API const char*
fromCString(const char* input, int length, int64* value);
LUMIX_ENGINE_API const char*
fromCString(const char* input, int length, uint32* value);
LUMIX_ENGINE_API bool
copyString(char* destination, int length, const char* source);
LUMIX_ENGINE_API bool
copyNString(char* destination, int length, const char* source, int source_len);
LUMIX_ENGINE_API bool
catString(char* destination, int length, const char* source);
LUMIX_ENGINE_API bool
catNString(char* destination, int length, const char* source, int source_len);
LUMIX_ENGINE_API bool
makeLowercase(char* destination, int length, const char* source);
LUMIX_ENGINE_API bool toCString(float value, char* output, int length, int after_point);
LUMIX_ENGINE_API const char* reverseFind(const char* str, const char* from, char c);
LUMIX_ENGINE_API const char* fromCString(const char* input, int length, int32* value);
LUMIX_ENGINE_API const char* fromCString(const char* input, int length, int64* value);
LUMIX_ENGINE_API const char* fromCString(const char* input, int length, uint32* value);
LUMIX_ENGINE_API bool copyString(char* destination, int length, const char* source);
LUMIX_ENGINE_API bool copyNString(char* destination,
int length,
const char* source,
int source_len);
LUMIX_ENGINE_API bool catString(char* destination, int length, const char* source);
LUMIX_ENGINE_API bool catNString(char* destination, int length, const char* source, int source_len);
LUMIX_ENGINE_API bool makeLowercase(char* destination, int length, const char* source);
LUMIX_ENGINE_API char* trimmed(char* str);
LUMIX_ENGINE_API bool startsWith(const char* str, const char* prefix);
LUMIX_ENGINE_API int stringLength(const char* str);
LUMIX_ENGINE_API int compareString(const char* lhs, const char* rhs);
LUMIX_ENGINE_API void copyMemory(void* dest, const void* src, size_t count);
@ -159,26 +153,26 @@ public:
bool operator!=(const base_string<T>& rhs) const
{
return this->strcmp(rhs.m_cstr) != 0;
return this->compareString(rhs.m_cstr) != 0;
}
bool operator!=(const T* rhs) const { return this->strcmp(rhs) != 0; }
bool operator!=(const T* rhs) const { return this->compareString(rhs) != 0; }
bool operator==(const base_string<T>& rhs) const
{
return this->strcmp(rhs.m_cstr) == 0;
return this->compareString(rhs.m_cstr) == 0;
}
bool operator==(const T* rhs) const { return this->strcmp(rhs) == 0; }
bool operator==(const T* rhs) const { return this->compareString(rhs) == 0; }
bool operator<(const base_string<T>& rhs) const
{
return this->strcmp(rhs.m_cstr) < 0;
return this->compareString(rhs.m_cstr) < 0;
}
bool operator>(const base_string<T>& rhs) const
{
return this->strcmp(rhs.m_cstr) > 0;
return this->compareString(rhs.m_cstr) > 0;
}
int rfind(T c) const
@ -356,7 +350,7 @@ private:
return (int32)(c - rhs);
}
int strcmp(const T* rhs) const
int compareString(const T* rhs) const
{
if (!m_cstr)
{

View file

@ -85,7 +85,7 @@ class PluginManagerImpl : public PluginManager
{
for (int i = 0; i < m_plugins.size(); ++i)
{
if (strcmp(m_plugins[i]->getName(), name) == 0)
if (compareString(m_plugins[i]->getName(), name) == 0)
{
return m_plugins[i];
}

View file

@ -88,11 +88,11 @@ void LuaScript::parseProperties()
token = getToken(token, property.name, sizeof(property.name));
char type[50];
token = getToken(token, type, sizeof(type));
if (strcmp(type, "entity") == 0)
if (compareString(type, "entity") == 0)
{
property.type = Property::ENTITY;
}
else if (strcmp(type, "float") == 0)
else if (compareString(type, "float") == 0)
{
property.type = Property::FLOAT;
}

View file

@ -1148,13 +1148,11 @@ struct PhysicsSceneImpl : public PhysicsScene
serializer.read(m_terrains[i]->m_y_scale);
if (m_terrains[i]->m_heightmap == nullptr ||
strcmp(tmp,
m_terrains[i]->m_heightmap->getPath().c_str()) != 0)
compareString(tmp, m_terrains[i]->m_heightmap->getPath().c_str()) != 0)
{
setHeightmap(i, tmp);
}
m_universe.addComponent(
m_terrains[i]->m_entity, HEIGHTFIELD_HASH, this, i);
m_universe.addComponent(m_terrains[i]->m_entity, HEIGHTFIELD_HASH, this, i);
}
}
}

View file

@ -92,19 +92,19 @@ bool FrameBuffer::RenderBuffer::isDepth() const
static bgfx::TextureFormat::Enum getFormat(const char* name)
{
if (strcmp(name, "depth32") == 0)
if (compareString(name, "depth32") == 0)
{
return bgfx::TextureFormat::D32;
}
else if (strcmp(name, "depth24") == 0)
else if (compareString(name, "depth24") == 0)
{
return bgfx::TextureFormat::D24;
}
else if (strcmp(name, "rgba8") == 0)
else if (compareString(name, "rgba8") == 0)
{
return bgfx::TextureFormat::RGBA8;
}
else if (strcmp(name, "r32f") == 0)
else if (compareString(name, "r32f") == 0)
{
return bgfx::TextureFormat::R32F;
}

View file

@ -267,23 +267,23 @@ void Material::deserializeUniforms(JsonSerializer& serializer)
while (!serializer.isObjectEnd())
{
serializer.deserializeLabel(label, 255);
if (strcmp(label, "name") == 0)
if (compareString(label, "name") == 0)
{
serializer.deserialize(uniform.m_name, Uniform::MAX_NAME_LENGTH, "");
uniform.m_name_hash = crc32(uniform.m_name);
}
else if (strcmp(label, "int_value") == 0)
else if (compareString(label, "int_value") == 0)
{
uniform_type = bgfx::UniformType::Int1;
uniform.m_type = Uniform::INT;
serializer.deserialize(uniform.m_int, 0);
}
else if (strcmp(label, "float_value") == 0)
else if (compareString(label, "float_value") == 0)
{
uniform.m_type = Uniform::FLOAT;
serializer.deserialize(uniform.m_float, 0);
}
else if (strcmp(label, "matrix_value") == 0)
else if (compareString(label, "matrix_value") == 0)
{
uniform_type = bgfx::UniformType::Mat4;
uniform.m_type = Uniform::MATRIX;
@ -295,7 +295,7 @@ void Material::deserializeUniforms(JsonSerializer& serializer)
}
serializer.deserializeArrayEnd();
}
else if (strcmp(label, "time") == 0)
else if (compareString(label, "time") == 0)
{
uniform.m_type = Uniform::TIME;
serializer.deserialize(uniform.m_float, 0);
@ -437,7 +437,7 @@ Texture* Material::getTextureByUniform(const char* uniform) const
for (int i = 0, c = m_shader->getTextureSlotCount(); i < c; ++i)
{
if (strcmp(m_shader->getTextureSlot(i).m_uniform, uniform) == 0)
if (compareString(m_shader->getTextureSlot(i).m_uniform, uniform) == 0)
{
return m_textures[i];
}
@ -457,7 +457,7 @@ bool Material::deserializeTexture(JsonSerializer& serializer, const char* materi
while (!serializer.isObjectEnd())
{
serializer.deserializeLabel(label, sizeof(label));
if (strcmp(label, "source") == 0)
if (compareString(label, "source") == 0)
{
serializer.deserialize(path, MAX_PATH_LENGTH, "");
if (path[0] != '\0')
@ -477,18 +477,18 @@ bool Material::deserializeTexture(JsonSerializer& serializer, const char* materi
addDependency(*m_textures[m_texture_count]);
}
}
else if (strcmp(label, "atlas_size") == 0)
else if (compareString(label, "atlas_size") == 0)
{
serializer.deserialize(atlas_size, -1);
}
else if (strcmp(label, "min_filter") == 0)
else if (compareString(label, "min_filter") == 0)
{
serializer.deserialize(label, sizeof(label), "");
if (strcmp(label, "point") == 0)
if (compareString(label, "point") == 0)
{
flags |= BGFX_TEXTURE_MIN_POINT;
}
else if (strcmp(label, "anisotropic") == 0)
else if (compareString(label, "anisotropic") == 0)
{
flags |= BGFX_TEXTURE_MIN_ANISOTROPIC;
}
@ -498,14 +498,14 @@ bool Material::deserializeTexture(JsonSerializer& serializer, const char* materi
<< "\" in material " << getPath().c_str();
}
}
else if (strcmp(label, "mag_filter") == 0)
else if (compareString(label, "mag_filter") == 0)
{
serializer.deserialize(label, sizeof(label), "");
if (strcmp(label, "point") == 0)
if (compareString(label, "point") == 0)
{
flags |= BGFX_TEXTURE_MAG_POINT;
}
else if (strcmp(label, "anisotropic") == 0)
else if (compareString(label, "anisotropic") == 0)
{
flags |= BGFX_TEXTURE_MAG_ANISOTROPIC;
}
@ -515,7 +515,7 @@ bool Material::deserializeTexture(JsonSerializer& serializer, const char* materi
<< "\" in material " << getPath().c_str();
}
}
else if (strcmp(label, "u_clamp") == 0)
else if (compareString(label, "u_clamp") == 0)
{
bool b;
serializer.deserialize(b, false);
@ -524,7 +524,7 @@ bool Material::deserializeTexture(JsonSerializer& serializer, const char* materi
flags |= BGFX_TEXTURE_U_CLAMP;
}
}
else if (strcmp(label, "v_clamp") == 0)
else if (compareString(label, "v_clamp") == 0)
{
bool b;
serializer.deserialize(b, false);
@ -533,7 +533,7 @@ bool Material::deserializeTexture(JsonSerializer& serializer, const char* materi
flags |= BGFX_TEXTURE_V_CLAMP;
}
}
else if (strcmp(label, "w_clamp") == 0)
else if (compareString(label, "w_clamp") == 0)
{
bool b;
serializer.deserialize(b, false);
@ -542,7 +542,7 @@ bool Material::deserializeTexture(JsonSerializer& serializer, const char* materi
flags |= BGFX_TEXTURE_W_CLAMP;
}
}
else if (strcmp(label, "keep_data") == 0)
else if (compareString(label, "keep_data") == 0)
{
serializer.deserialize(keep_data, false);
}
@ -598,24 +598,24 @@ bool Material::load(FS::IFile& file)
while (!serializer.isObjectEnd())
{
serializer.deserializeLabel(label, 255);
if (strcmp(label, "uniforms") == 0)
if (compareString(label, "uniforms") == 0)
{
deserializeUniforms(serializer);
}
else if (strcmp(label, "texture") == 0)
else if (compareString(label, "texture") == 0)
{
if (!deserializeTexture(serializer, material_dir))
{
return false;
}
}
else if (strcmp(label, "alpha_cutout") == 0)
else if (compareString(label, "alpha_cutout") == 0)
{
bool b;
serializer.deserialize(b, false);
enableAlphaCutout(b);
}
else if (strcmp(label, "alpha_blending") == 0)
else if (compareString(label, "alpha_blending") == 0)
{
if (serializer.isNextBoolean())
{
@ -633,21 +633,21 @@ bool Material::load(FS::IFile& file)
else
{
serializer.deserialize(label, 255, "alpha");
if (strcmp(label, "alpha") == 0)
if (compareString(label, "alpha") == 0)
{
m_render_states |= BGFX_STATE_BLEND_ALPHA;
}
else if (strcmp(label, "add") == 0)
else if (compareString(label, "add") == 0)
{
m_render_states |= BGFX_STATE_BLEND_ADD;
}
else if (strcmp(label, "disabled") == 0)
else if (compareString(label, "disabled") == 0)
{
m_render_states &= ~BGFX_STATE_BLEND_MASK;
}
}
}
else if (strcmp(label, "specular") == 0)
else if (compareString(label, "specular") == 0)
{
serializer.deserializeArrayBegin();
serializer.deserializeArrayItem(m_specular.x, 1.0f);
@ -655,28 +655,28 @@ bool Material::load(FS::IFile& file)
serializer.deserializeArrayItem(m_specular.z, 1.0f);
serializer.deserializeArrayEnd();
}
else if (strcmp(label, "shininess") == 0)
else if (compareString(label, "shininess") == 0)
{
serializer.deserialize(m_shininess, 4.0f);
}
else if (strcmp(label, "shadow_receiver") == 0)
else if (compareString(label, "shadow_receiver") == 0)
{
bool b;
serializer.deserialize(b, true);
enableShadowReceiving(b);
}
else if (strcmp(label, "shader") == 0)
else if (compareString(label, "shader") == 0)
{
serializer.deserialize(path, MAX_PATH_LENGTH, "");
setShader(static_cast<Shader*>(
m_resource_manager.get(ResourceManager::SHADER)->load(Path(path))));
}
else if (strcmp(label, "z_test") == 0)
else if (compareString(label, "z_test") == 0)
{
serializer.deserialize(b_value, true);
enableZTest(b_value);
}
else if (strcmp(label, "backface_culling") == 0)
else if (compareString(label, "backface_culling") == 0)
{
serializer.deserialize(b_value, true);
enableBackfaceCulling(b_value);

View file

@ -192,31 +192,31 @@ bool Model::parseVertexDef(FS::IFile& file, bgfx::VertexDecl* vertex_definition)
file.read(tmp, len);
tmp[len] = '\0';
if (strcmp(tmp, "in_position") == 0)
if (compareString(tmp, "in_position") == 0)
{
vertex_definition->add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float);
}
else if (strcmp(tmp, "in_colors") == 0)
else if (compareString(tmp, "in_colors") == 0)
{
vertex_definition->add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true, false);
}
else if (strcmp(tmp, "in_tex_coords") == 0)
else if (compareString(tmp, "in_tex_coords") == 0)
{
vertex_definition->add(bgfx::Attrib::TexCoord0, 2, bgfx::AttribType::Float);
}
else if (strcmp(tmp, "in_normal") == 0)
else if (compareString(tmp, "in_normal") == 0)
{
vertex_definition->add(bgfx::Attrib::Normal, 4, bgfx::AttribType::Uint8, true, true);
}
else if (strcmp(tmp, "in_tangents") == 0)
else if (compareString(tmp, "in_tangents") == 0)
{
vertex_definition->add(bgfx::Attrib::Tangent, 4, bgfx::AttribType::Uint8, true, true);
}
else if (strcmp(tmp, "in_weights") == 0)
else if (compareString(tmp, "in_weights") == 0)
{
vertex_definition->add(bgfx::Attrib::Weight, 4, bgfx::AttribType::Float);
}
else if (strcmp(tmp, "in_indices") == 0)
else if (compareString(tmp, "in_indices") == 0)
{
vertex_definition->add(bgfx::Attrib::Indices, 4, bgfx::AttribType::Int16, false, true);
}

View file

@ -587,7 +587,7 @@ struct PipelineInstanceImpl : public PipelineInstance
{
for (int i = 0, c = m_framebuffers.size(); i < c; ++i)
{
if (strcmp(m_framebuffers[i]->getName(), framebuffer_name) == 0)
if (compareString(m_framebuffers[i]->getName(), framebuffer_name) == 0)
{
return m_framebuffers[i];
}
@ -598,7 +598,7 @@ struct PipelineInstanceImpl : public PipelineInstance
void setCurrentFramebuffer(const char* framebuffer_name)
{
if (strcmp(framebuffer_name, "default") == 0)
if (compareString(framebuffer_name, "default") == 0)
{
m_current_framebuffer = m_default_framebuffer;
if (m_current_framebuffer)
@ -650,7 +650,7 @@ struct PipelineInstanceImpl : public PipelineInstance
FrameBuffer::Declaration& decl = m_source.m_framebuffers[i];
auto* fb = LUMIX_NEW(m_allocator, FrameBuffer)(decl);
m_framebuffers.push(fb);
if (strcmp(decl.m_name, "default") == 0) m_default_framebuffer = fb;
if (compareString(decl.m_name, "default") == 0) m_default_framebuffer = fb;
}
if (lua_getglobal(m_source.m_lua_state, "init") == LUA_TFUNCTION)
@ -1971,11 +1971,11 @@ void applyCamera(PipelineInstanceImpl* pipeline, const char* slot)
void clear(PipelineInstanceImpl* pipeline, const char* buffers, int color)
{
uint16 flags = 0;
if (strcmp(buffers, "all") == 0)
if (compareString(buffers, "all") == 0)
{
flags = BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH;
}
else if (strcmp(buffers, "depth") == 0)
else if (compareString(buffers, "depth") == 0)
{
flags = BGFX_CLEAR_DEPTH;
}

View file

@ -2507,7 +2507,7 @@ public:
for (int i = 0, c = m_cameras.size(); i < c; ++i)
{
if (!m_cameras[i].m_is_free &&
strcmp(m_cameras[i].m_slot, slot) == 0)
compareString(m_cameras[i].m_slot, slot) == 0)
{
return i;
}

View file

@ -266,7 +266,7 @@ struct RendererImpl : public Renderer
{
for (int i = 0; i < m_shader_defines.size(); ++i)
{
if (strcmp(m_shader_defines[i], define) == 0)
if (compareString(m_shader_defines[i], define) == 0)
{
return i;
}
@ -282,7 +282,7 @@ struct RendererImpl : public Renderer
{
for (int i = 0; i < m_passes.size(); ++i)
{
if (strcmp(m_passes[i], pass) == 0)
if (compareString(m_passes[i], pass) == 0)
{
return i;
}

View file

@ -299,7 +299,7 @@ static int indexOf(const ShaderCombinations::Passes& passes, const char* pass)
{
for (int i = 0; i < lengthOf(passes); ++i)
{
if (strcmp(passes[i], pass) == 0)
if (compareString(passes[i], pass) == 0)
{
return i;
}

View file

@ -293,7 +293,7 @@ void Texture::save()
char ext[5];
ext[0] = 0;
PathUtils::getExtension(ext, 5, getPath().c_str());
if (strcmp(ext, "raw") == 0 && m_BPP == 2)
if (compareString(ext, "raw") == 0 && m_BPP == 2)
{
FS::FileSystem& fs = m_resource_manager.getFileSystem();
FS::IFile* file = fs.open(fs.getDefaultDevice(),
@ -303,7 +303,7 @@ void Texture::save()
file->write(&m_data[0], m_data.size() * sizeof(m_data[0]));
fs.close(*file);
}
else if (strcmp(ext, "tga") == 0 && m_BPP == 4)
else if (compareString(ext, "tga") == 0 && m_BPP == 4)
{
saveTGA();
}
@ -507,11 +507,11 @@ bool Texture::load(FS::IFile& file)
const char* path = getPath().c_str();
size_t len = getPath().length();
bool loaded = false;
if (len > 3 && strcmp(path + len - 4, ".dds") == 0)
if (len > 3 && compareString(path + len - 4, ".dds") == 0)
{
loaded = loadDDS(file);
}
else if (len > 3 && strcmp(path + len - 4, ".raw") == 0)
else if (len > 3 && compareString(path + len - 4, ".raw") == 0)
{
loaded = loadRaw(file);
}

View file

@ -38,14 +38,14 @@ static Lumix::uint32 getResourceType(const char* path)
char ext[10];
Lumix::PathUtils::getExtension(ext, sizeof(ext), path);
if (strcmp(ext, "mat") == 0) return Lumix::ResourceManager::MATERIAL;
if (strcmp(ext, "msh") == 0) return Lumix::ResourceManager::MODEL;
if (strcmp(ext, "dds") == 0) return Lumix::ResourceManager::TEXTURE;
if (strcmp(ext, "raw") == 0) return Lumix::ResourceManager::TEXTURE;
if (strcmp(ext, "tga") == 0) return Lumix::ResourceManager::TEXTURE;
if (strcmp(ext, "shd") == 0) return Lumix::ResourceManager::SHADER;
if (strcmp(ext, "unv") == 0) return UNIVERSE_HASH;
if (strcmp(ext, "lua") == 0) return LUA_SCRIPT_HASH;
if (Lumix::compareString(ext, "mat") == 0) return Lumix::ResourceManager::MATERIAL;
if (Lumix::compareString(ext, "msh") == 0) return Lumix::ResourceManager::MODEL;
if (Lumix::compareString(ext, "dds") == 0) return Lumix::ResourceManager::TEXTURE;
if (Lumix::compareString(ext, "raw") == 0) return Lumix::ResourceManager::TEXTURE;
if (Lumix::compareString(ext, "tga") == 0) return Lumix::ResourceManager::TEXTURE;
if (Lumix::compareString(ext, "shd") == 0) return Lumix::ResourceManager::SHADER;
if (Lumix::compareString(ext, "unv") == 0) return UNIVERSE_HASH;
if (Lumix::compareString(ext, "lua") == 0) return LUA_SCRIPT_HASH;
return 0;
}
@ -234,7 +234,7 @@ void AssetBrowser::selectResource(const Lumix::Path& resource)
{
char ext[30];
Lumix::PathUtils::getExtension(ext, Lumix::lengthOf(ext), resource.c_str());
if (strcmp(ext, "unv") == 0) return;
if (Lumix::compareString(ext, "unv") == 0) return;
auto& manager = m_editor.getEngine().getResourceManager();
auto* resource_manager = manager.get(getResourceType(resource.c_str()));
@ -802,12 +802,12 @@ void AssetBrowser::addResource(const char* path, const char* filename)
Lumix::catString(fullpath, filename);
int index = -1;
if (strcmp(ext, "dds") == 0 || strcmp(ext, "tga") == 0 || strcmp(ext, "raw") == 0) index = TEXTURE;
if (strcmp(ext, "msh") == 0) index = MODEL;
if (strcmp(ext, "mat") == 0) index = MATERIAL;
if (strcmp(ext, "unv") == 0) index = UNIVERSE;
if (strcmp(ext, "shd") == 0) index = SHADER;
if (strcmp(ext, "lua") == 0) index = LUA_SCRIPT;
if (Lumix::compareString(ext, "dds") == 0 || Lumix::compareString(ext, "tga") == 0 || Lumix::compareString(ext, "raw") == 0) index = TEXTURE;
if (Lumix::compareString(ext, "msh") == 0) index = MODEL;
if (Lumix::compareString(ext, "mat") == 0) index = MATERIAL;
if (Lumix::compareString(ext, "unv") == 0) index = UNIVERSE;
if (Lumix::compareString(ext, "shd") == 0) index = SHADER;
if (Lumix::compareString(ext, "lua") == 0) index = LUA_SCRIPT;
if (Lumix::startsWith(path, "./render_tests") != 0 || Lumix::startsWith(path, "./unit_tests") != 0)
{

View file

@ -481,7 +481,7 @@ struct ConvertTask : public Lumix::MT::Task
: source_absolute;
if (m_dialog.m_convert_to_dds &&
strcmp(texture_info.m_extension, "dds") != 0)
Lumix::compareString(texture_info.m_extension, "dds") != 0)
{
PathBuilder dest(m_dialog.m_texture_output_dir[0] ? m_dialog.m_texture_output_dir
: m_dialog.m_output_dir);
@ -517,7 +517,7 @@ struct ConvertTask : public Lumix::MT::Task
PathBuilder dest(m_dialog.m_output_dir);
dest << "/" << texture_info.m_basename << "."
<< texture_info.m_extension;
if (strcmp(source, dest) != 0 && !Lumix::copyFile(source, dest))
if (Lumix::compareString(source, dest) != 0 && !Lumix::copyFile(source, dest))
{
m_dialog.setMessage(
StringBuilder<Lumix::MAX_PATH_LENGTH * 2 + 20>(
@ -1417,7 +1417,7 @@ static bool isImage(const char* path)
"jpg", "jpeg", "png", "tga", "bmp", "psd", "gif", "hdr", "pic", "pnm"};
for (auto image_ext : image_extensions)
{
if (strcmp(ext, image_ext) == 0)
if (Lumix::compareString(ext, image_ext) == 0)
{
return true;
}

View file

@ -69,19 +69,19 @@ void LogUI::push(Type type, const char* message)
void LogUI::onInfo(const char* system, const char* message)
{
push(strcmp(system, "bgfx") == 0 ? BGFX : Info, message);
push(Lumix::compareString(system, "bgfx") == 0 ? BGFX : Info, message);
}
void LogUI::onWarning(const char* system, const char* message)
{
push(strcmp(system, "bgfx") == 0 ? BGFX : Warning, message);
push(Lumix::compareString(system, "bgfx") == 0 ? BGFX : Warning, message);
}
void LogUI::onError(const char* system, const char* message)
{
push(strcmp(system, "bgfx") == 0 ? BGFX : Error, message);
push(Lumix::compareString(system, "bgfx") == 0 ? BGFX : Error, message);
}

View file

@ -420,7 +420,7 @@ public:
{
for (auto* a : m_actions)
{
if (strcmp(a->name, name) == 0) return *a;
if (Lumix::compareString(a->name, name) == 0) return *a;
}
ASSERT(false);
return *m_actions[0];

View file

@ -192,8 +192,8 @@ void ShaderCompiler::onFileChanged(const char* path)
{
char ext[10];
Lumix::PathUtils::getExtension(ext, sizeof(ext), path);
if (strcmp("sc", ext) != 0 && strcmp("shd", ext) != 0 &&
strcmp("sh", ext) != 0)
if (Lumix::compareString("sc", ext) != 0 && Lumix::compareString("shd", ext) != 0 &&
Lumix::compareString("sh", ext) != 0)
return;
char tmp[Lumix::MAX_PATH_LENGTH];
@ -413,8 +413,8 @@ void ShaderCompiler::processChangedFiles()
int len = Lumix::stringLength(changed_file_path);
if (len <= 6) return;
if (strcmp(changed_file_path + len - 6, "_fs.sc") == 0 ||
strcmp(changed_file_path + len - 6, "_vs.sc") == 0)
if (Lumix::compareString(changed_file_path + len - 6, "_fs.sc") == 0 ||
Lumix::compareString(changed_file_path + len - 6, "_vs.sc") == 0)
{
Lumix::copyString(
changed_file_path + len - 6, Lumix::lengthOf(changed_file_path) - len + 6, ".shd");

View file

@ -74,7 +74,7 @@ void UT_blob(const char* params)
LUMIX_EXPECT_EQ(i, i2);
LUMIX_EXPECT_EQ(ui, ui2);
LUMIX_EXPECT_EQ(f, f2);
LUMIX_EXPECT_EQ(strcmp(tmp, "test string"), 0);
LUMIX_EXPECT_EQ(Lumix::compareString(tmp, "test string"), 0);
LUMIX_EXPECT_EQ(memcmp(&s, &s2, sizeof(s)), 0);
input.rewind();
@ -90,7 +90,7 @@ void UT_blob(const char* params)
LUMIX_EXPECT_EQ(i, i2);
LUMIX_EXPECT_EQ(ui, ui2);
LUMIX_EXPECT_EQ(f, f2);
LUMIX_EXPECT_EQ(strcmp(tmp, "test string"), 0);
LUMIX_EXPECT_EQ(Lumix::compareString(tmp, "test string"), 0);
LUMIX_EXPECT_EQ(memcmp(&s, &s2, sizeof(s)), 0);
LUMIX_EXPECT_EQ(input.getSize(), blob.getSize());

View file

@ -29,7 +29,7 @@ void UT_command_line_parser(const char* params)
LUMIX_EXPECT_TRUE(parser.next());
LUMIX_EXPECT_TRUE(parser.currentEquals("custom.dll"));
parser.getCurrent(tmp, Lumix::lengthOf(tmp));
LUMIX_EXPECT_TRUE(strcmp(tmp, "custom.dll") == 0);
LUMIX_EXPECT_TRUE(Lumix::compareString(tmp, "custom.dll") == 0);
LUMIX_EXPECT_TRUE(parser.next());
LUMIX_EXPECT_TRUE(parser.currentEquals("-str"));
@ -37,7 +37,7 @@ void UT_command_line_parser(const char* params)
LUMIX_EXPECT_TRUE(parser.next());
LUMIX_EXPECT_TRUE(parser.currentEquals("\"test\""));
parser.getCurrent(tmp, Lumix::lengthOf(tmp));
LUMIX_EXPECT_TRUE(strcmp(tmp, "\"test\"") == 0);
LUMIX_EXPECT_TRUE(Lumix::compareString(tmp, "\"test\"") == 0);
LUMIX_EXPECT_TRUE(parser.next());
LUMIX_EXPECT_TRUE(parser.currentEquals("-str2"));
@ -45,7 +45,7 @@ void UT_command_line_parser(const char* params)
LUMIX_EXPECT_TRUE(parser.next());
LUMIX_EXPECT_TRUE(parser.currentEquals("\"test with spaces\""));
parser.getCurrent(tmp, Lumix::lengthOf(tmp));
LUMIX_EXPECT_TRUE(strcmp(tmp, "\"test with spaces\"") == 0);
LUMIX_EXPECT_TRUE(Lumix::compareString(tmp, "\"test with spaces\"") == 0);
LUMIX_EXPECT_FALSE(parser.next());
@ -67,7 +67,7 @@ void UT_command_line_parser(const char* params)
Lumix::CommandLineParser parser6(" \" \" ");
LUMIX_EXPECT_TRUE(parser6.next());
parser6.getCurrent(tmp, Lumix::lengthOf(tmp));
LUMIX_EXPECT_TRUE(strcmp(tmp, "\" \"") == 0);
LUMIX_EXPECT_TRUE(Lumix::compareString(tmp, "\" \"") == 0);
LUMIX_EXPECT_TRUE(parser6.currentEquals("\" \""));
LUMIX_EXPECT_FALSE(parser6.next());
}

View file

@ -74,7 +74,7 @@ void UT_json_serializer(const char* params)
char str[100];
serializer.deserialize("const_char", str, sizeof(str), "");
LUMIX_EXPECT_EQ(strcmp(str , "some string"), 0);
LUMIX_EXPECT_EQ(Lumix::compareString(str , "some string"), 0);
LUMIX_EXPECT_TRUE(serializer.isObjectEnd());
serializer.deserializeObjectEnd();

View file

@ -19,7 +19,7 @@ namespace Lumix
template<>
LUMIX_FORCE_INLINE void expectEq<const char*>(const char* p1, const char* p2, const char* file, uint32 line)
{
if(strcmp(p1, p2) != 0)
if(Lumix::compareString(p1, p2) != 0)
{
Manager::instance().handleFail(file, line);
}
@ -37,7 +37,7 @@ namespace Lumix
template<>
LUMIX_FORCE_INLINE void expectNe<const char*>(const char* p1, const char* p2, const char* file, uint32 line)
{
if(strcmp(p1, p2) == 0)
if(Lumix::compareString(p1, p2) == 0)
{
Manager::instance().handleFail(file, line);
}
@ -55,7 +55,7 @@ namespace Lumix
template<>
LUMIX_FORCE_INLINE void expectLt<const char*>(const char* p1, const char* p2, const char* file, uint32 line)
{
if(strcmp(p1, p2) >= 0)
if(Lumix::compareString(p1, p2) >= 0)
{
Manager::instance().handleFail(file, line);
}
@ -73,7 +73,7 @@ namespace Lumix
template<>
LUMIX_FORCE_INLINE void expectGt<const char*>(const char* p1, const char* p2, const char* file, uint32 line)
{
if(strcmp(p1, p2) <= 0)
if(Lumix::compareString(p1, p2) <= 0)
{
Manager::instance().handleFail(file, line);
}
@ -91,7 +91,7 @@ namespace Lumix
template<>
LUMIX_FORCE_INLINE void expectLe<const char*>(const char* p1, const char* p2, const char* file, uint32 line)
{
if(strcmp(p1, p2) > 0)
if(Lumix::compareString(p1, p2) > 0)
{
Manager::instance().handleFail(file, line);
}
@ -109,7 +109,7 @@ namespace Lumix
template<>
LUMIX_FORCE_INLINE void expectGe<const char*>(const char* p1, const char* p2, const char* file, uint32 line)
{
if(strcmp(p1, p2) < 0)
if(Lumix::compareString(p1, p2) < 0)
{
Manager::instance().handleFail(file, line);
}