From bfe5a66b3e3014dc5322e6c4ba834e5984f25b86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Thu, 9 Feb 2017 19:31:19 -0800 Subject: [PATCH] Cleanup. --- examples/common/bgfx_utils.cpp | 10 +++++----- examples/common/entry/entry_nacl.cpp | 2 +- src/bgfx.cpp | 6 +++--- src/renderer_d3d11.cpp | 4 ++-- src/renderer_d3d12.cpp | 12 ++++++------ src/renderer_gl.cpp | 4 ++-- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/examples/common/bgfx_utils.cpp b/examples/common/bgfx_utils.cpp index 93ab316de..3af6dd25e 100644 --- a/examples/common/bgfx_utils.cpp +++ b/examples/common/bgfx_utils.cpp @@ -210,7 +210,7 @@ bgfx::TextureHandle loadTexture(bx::FileReaderI* _reader, const char* _filePath, uint8_t* out = NULL; static uint8_t pngMagic[] = { 0x89, 0x50, 0x4E, 0x47, 0x0d, 0x0a }; - if (0 == memcmp(data, pngMagic, sizeof(pngMagic) ) ) + if (0 == bx::memCmp(data, pngMagic, sizeof(pngMagic) ) ) { release = lodepng_free; @@ -329,22 +329,22 @@ bgfx::TextureHandle loadTexture(bx::FileReaderI* _reader, const char* _filePath, { const EXRChannelInfo& channel = exrHeader.channels[ii]; if (UINT8_MAX == idxR - && 0 == strcmp(channel.name, "R") ) + && 0 == bx::strncmp(channel.name, "R") ) { idxR = ii; } else if (UINT8_MAX == idxG - && 0 == strcmp(channel.name, "G") ) + && 0 == bx::strncmp(channel.name, "G") ) { idxG = ii; } else if (UINT8_MAX == idxB - && 0 == strcmp(channel.name, "B") ) + && 0 == bx::strncmp(channel.name, "B") ) { idxB = ii; } else if (UINT8_MAX == idxA - && 0 == strcmp(channel.name, "A") ) + && 0 == bx::strncmp(channel.name, "A") ) { idxA = ii; } diff --git a/examples/common/entry/entry_nacl.cpp b/examples/common/entry/entry_nacl.cpp index b3c877539..b51a96e34 100644 --- a/examples/common/entry/entry_nacl.cpp +++ b/examples/common/entry/entry_nacl.cpp @@ -188,7 +188,7 @@ using namespace entry; PP_EXPORT const void* PPP_GetInterface(const char* _name) { - if (0 == strcmp(_name, PPP_INSTANCE_INTERFACE) ) + if (0 == bx::strncmp(_name, PPP_INSTANCE_INTERFACE) ) { static PPP_Instance instanceInterface = { diff --git a/src/bgfx.cpp b/src/bgfx.cpp index d25e63bd4..cd60532a0 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -463,7 +463,7 @@ namespace bgfx { for (const EmbeddedShader* es = _es; NULL != es->name; ++es) { - if (0 == strcmp(_name, es->name) ) + if (0 == bx::strncmp(_name, es->name) ) { for (const EmbeddedShader::Data* esd = es->data; RendererType::Count != esd->type; ++esd) { @@ -808,7 +808,7 @@ namespace bgfx for (uint32_t ii = 0; ii < UniformType::Count; ++ii) { if (NULL != s_uniformTypeName[ii] - && 0 == strcmp(_name, s_uniformTypeName[ii]) ) + && 0 == bx::strncmp(_name, s_uniformTypeName[ii]) ) { return UniformType::Enum(ii); } @@ -842,7 +842,7 @@ namespace bgfx { for (uint32_t ii = 0; ii < PredefinedUniform::Count; ++ii) { - if (0 == strcmp(_name, s_predefinedName[ii]) ) + if (0 == bx::strncmp(_name, s_predefinedName[ii]) ) { return PredefinedUniform::Enum(ii); } diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 0495af745..c8bde54d8 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -2685,7 +2685,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); for (jj = 0; jj < num; ++jj) { curr = &vertexElements[jj]; - if (0 == strcmp(curr->SemanticName, "TEXCOORD") + if (0 == bx::strncmp(curr->SemanticName, "TEXCOORD") && curr->SemanticIndex == index) { break; @@ -2989,7 +2989,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { D3D11_SAMPLER_DESC sd; sampler->GetDesc(&sd); - if (0 != memcmp(_rgba, sd.BorderColor, 16) ) + if (0 != bx::memCmp(_rgba, sd.BorderColor, 16) ) { // Sampler will be released when updated sampler // is added to cache. diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index 6cfa978c7..42add2cad 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -2236,7 +2236,7 @@ data.NumQualityLevels = 0; for (jj = 0; jj < num; ++jj) { curr = &_vertexElements[jj]; - if (0 == strcmp(curr->SemanticName, "TEXCOORD") + if (0 == bx::strncmp(curr->SemanticName, "TEXCOORD") && curr->SemanticIndex == index) { break; @@ -2388,14 +2388,14 @@ data.NumQualityLevels = 0; dxbcHash(temp->data + 20, temp->size - 20, temp->data + 4); - patchShader = 0 == memcmp(program.m_fsh->m_code->data, temp->data, 16); + patchShader = 0 == bx::memCmp(program.m_fsh->m_code->data, temp->data, 16); BX_CHECK(patchShader, "DXBC fragment shader patching error (ShaderHandle: %d).", program.m_fsh - m_shaders); if (!patchShader) { for (uint32_t ii = 20; ii < temp->size; ii += 16) { - if (0 != memcmp(&program.m_fsh->m_code->data[ii], &temp->data[ii], 16) ) + if (0 != bx::memCmp(&program.m_fsh->m_code->data[ii], &temp->data[ii], 16) ) { // bx::debugPrintfData(&program.m_fsh->m_code->data[ii], temp->size-ii, ""); // bx::debugPrintfData(&temp->data[ii], temp->size-ii, ""); @@ -3579,7 +3579,7 @@ data.NumQualityLevels = 0; _commandList->SetGraphicsRootConstantBufferView(Rdt::CBV, cmd.cbv); } - if (0 != memcmp(m_current.vbv, cmd.vbv, sizeof(cmd.vbv) ) ) + if (0 != bx::memCmp(m_current.vbv, cmd.vbv, sizeof(cmd.vbv) ) ) { bx::memCopy(m_current.vbv, cmd.vbv, sizeof(cmd.vbv) ); _commandList->IASetVertexBuffers(0 @@ -3609,7 +3609,7 @@ data.NumQualityLevels = 0; _commandList->SetGraphicsRootConstantBufferView(Rdt::CBV, cmd.cbv); } - if (0 != memcmp(m_current.vbv, cmd.vbv, sizeof(cmd.vbv) ) ) + if (0 != bx::memCmp(m_current.vbv, cmd.vbv, sizeof(cmd.vbv) ) ) { bx::memCopy(m_current.vbv, cmd.vbv, sizeof(cmd.vbv) ); _commandList->IASetVertexBuffers(0 @@ -3618,7 +3618,7 @@ data.NumQualityLevels = 0; ); } - if (0 != memcmp(&m_current.ibv, &cmd.ibv, sizeof(cmd.ibv) ) ) + if (0 != bx::memCmp(&m_current.ibv, &cmd.ibv, sizeof(cmd.ibv) ) ) { bx::memCopy(&m_current.ibv, &cmd.ibv, sizeof(cmd.ibv) ); _commandList->IASetIndexBuffer(&cmd.ibv); diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index cb38ca040..fffa9beab 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -1354,7 +1354,7 @@ namespace bgfx { namespace gl ext += 3; } - if (0 == strcmp(ext, extension.m_name) ) + if (0 == bx::strncmp(ext, extension.m_name) ) { extension.m_supported = true; supported = true; @@ -1543,7 +1543,7 @@ namespace bgfx { namespace gl ; if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 31) - && 0 == strcmp(m_vendor, "Imagination Technologies") + && 0 == bx::strncmp(m_vendor, "Imagination Technologies") && NULL != strstr(m_version, "(SDK 3.5@3510720)") ) { // Skip initializing extensions that are broken in emulator.