From c9679731a59b7f0d9aa5cd865cd5d174839058f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sat, 22 Apr 2017 14:47:02 -0700 Subject: [PATCH] Renaming string functions. --- examples/common/camera.cpp | 12 ++-- examples/common/entry/entry.cpp | 6 +- examples/common/entry/entry_nacl.cpp | 2 +- src/bgfx.cpp | 10 +-- src/debug_renderdoc.cpp | 2 +- src/renderer_d3d11.cpp | 4 +- src/renderer_d3d12.cpp | 4 +- src/renderer_d3d9.cpp | 2 +- src/renderer_gl.cpp | 26 +++---- tools/geometryc/geometryc.cpp | 4 +- tools/shaderc/shaderc.cpp | 104 +++++++++++++-------------- tools/shaderc/shaderc_glsl.cpp | 34 ++++----- tools/shaderc/shaderc_hlsl.cpp | 2 +- tools/shaderc/shaderc_spirv.cpp | 4 +- tools/texturec/texturec.cpp | 4 +- tools/texturev/texturev.cpp | 4 +- 16 files changed, 112 insertions(+), 112 deletions(-) diff --git a/examples/common/camera.cpp b/examples/common/camera.cpp index a2a1c31dc..2b8f7050f 100644 --- a/examples/common/camera.cpp +++ b/examples/common/camera.cpp @@ -15,32 +15,32 @@ int cmdMove(CmdContext* /*_context*/, void* /*_userData*/, int _argc, char const { if (_argc > 1) { - if (0 == bx::strncmp(_argv[1], "forward") ) + if (0 == bx::strCmp(_argv[1], "forward") ) { cameraSetKeyState(CAMERA_KEY_FORWARD, true); return 0; } - else if (0 == bx::strncmp(_argv[1], "left") ) + else if (0 == bx::strCmp(_argv[1], "left") ) { cameraSetKeyState(CAMERA_KEY_LEFT, true); return 0; } - else if (0 == bx::strncmp(_argv[1], "right") ) + else if (0 == bx::strCmp(_argv[1], "right") ) { cameraSetKeyState(CAMERA_KEY_RIGHT, true); return 0; } - else if (0 == bx::strncmp(_argv[1], "backward") ) + else if (0 == bx::strCmp(_argv[1], "backward") ) { cameraSetKeyState(CAMERA_KEY_BACKWARD, true); return 0; } - else if (0 == bx::strncmp(_argv[1], "up") ) + else if (0 == bx::strCmp(_argv[1], "up") ) { cameraSetKeyState(CAMERA_KEY_UP, true); return 0; } - else if (0 == bx::strncmp(_argv[1], "down") ) + else if (0 == bx::strCmp(_argv[1], "down") ) { cameraSetKeyState(CAMERA_KEY_DOWN, true); return 0; diff --git a/examples/common/entry/entry.cpp b/examples/common/entry/entry.cpp index 97701343d..728a418ce 100644 --- a/examples/common/entry/entry.cpp +++ b/examples/common/entry/entry.cpp @@ -254,7 +254,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); bool setOrToggle(uint32_t& _flags, const char* _name, uint32_t _bit, int _first, int _argc, char const* const* _argv) { - if (0 == bx::strncmp(_argv[_first], _name) ) + if (0 == bx::strCmp(_argv[_first], _name) ) { int arg = _first+1; if (_argc > arg) @@ -310,7 +310,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); bgfx::setDebug(s_debug); return 0; } - else if (0 == bx::strncmp(_argv[1], "screenshot") ) + else if (0 == bx::strCmp(_argv[1], "screenshot") ) { bgfx::FrameBufferHandle fbh = BGFX_INVALID_HANDLE; @@ -330,7 +330,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); return 0; } - else if (0 == bx::strncmp(_argv[1], "fullscreen") ) + else if (0 == bx::strCmp(_argv[1], "fullscreen") ) { WindowHandle window = { 0 }; toggleFullscreen(window); diff --git a/examples/common/entry/entry_nacl.cpp b/examples/common/entry/entry_nacl.cpp index b51a96e34..6f6697e04 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 == bx::strncmp(_name, PPP_INSTANCE_INTERFACE) ) + if (0 == bx::strCmp(_name, PPP_INSTANCE_INTERFACE) ) { static PPP_Instance instanceInterface = { diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 9751cb4d9..f56f2e573 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -465,7 +465,7 @@ namespace bgfx { for (const EmbeddedShader* es = _es; NULL != es->name; ++es) { - if (0 == bx::strncmp(_name, es->name) ) + if (0 == bx::strCmp(_name, es->name) ) { for (const EmbeddedShader::Data* esd = es->data; RendererType::Count != esd->type; ++esd) { @@ -504,7 +504,7 @@ namespace bgfx static uint8_t parseAttrTo(char*& _ptr, char _to, uint8_t _default) { - const char* str = bx::strnchr(_ptr, _to); + const char* str = bx::strFind(_ptr, _to); if (NULL != str && 3 > str-_ptr) { @@ -529,7 +529,7 @@ namespace bgfx return _default; } - if (0 == bx::strncmp(ptr, "0m", 2) ) + if (0 == bx::strCmp(ptr, "0m", 2) ) { _ptr = ptr + 2; return _default; @@ -810,7 +810,7 @@ namespace bgfx for (uint32_t ii = 0; ii < UniformType::Count; ++ii) { if (NULL != s_uniformTypeName[ii] - && 0 == bx::strncmp(_name, s_uniformTypeName[ii]) ) + && 0 == bx::strCmp(_name, s_uniformTypeName[ii]) ) { return UniformType::Enum(ii); } @@ -844,7 +844,7 @@ namespace bgfx { for (uint32_t ii = 0; ii < PredefinedUniform::Count; ++ii) { - if (0 == bx::strncmp(_name, s_predefinedName[ii]) ) + if (0 == bx::strCmp(_name, s_predefinedName[ii]) ) { return PredefinedUniform::Enum(ii); } diff --git a/src/debug_renderdoc.cpp b/src/debug_renderdoc.cpp index a51206b81..d444cc0f4 100644 --- a/src/debug_renderdoc.cpp +++ b/src/debug_renderdoc.cpp @@ -43,7 +43,7 @@ namespace bgfx , BX_COUNTOF(moduleName) ); if (0 != result - && 0 == bx::strincmp(_name, moduleName) ) + && 0 == bx::strCmpI(_name, moduleName) ) { return true; } diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 0ff8d6999..3c8db6196 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -974,7 +974,7 @@ namespace bgfx { namespace d3d11 } if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) - && 0 != bx::strnstr(description, "PerfHUD") ) + && 0 != bx::strFind(description, "PerfHUD") ) { m_adapter = adapter; m_driverType = D3D_DRIVER_TYPE_REFERENCE; @@ -2740,7 +2740,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); for (jj = 0; jj < num; ++jj) { curr = &vertexElements[jj]; - if (0 == bx::strncmp(curr->SemanticName, "TEXCOORD") + if (0 == bx::strCmp(curr->SemanticName, "TEXCOORD") && curr->SemanticIndex == index) { break; diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index c7f7cca3a..268150f68 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -670,7 +670,7 @@ namespace bgfx { namespace d3d12 } if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) - && 0 != bx::strnstr(description, "PerfHUD") ) + && 0 != bx::strFind(description, "PerfHUD") ) { m_adapter = adapter; m_driverType = D3D_DRIVER_TYPE_REFERENCE; @@ -2280,7 +2280,7 @@ data.NumQualityLevels = 0; for (jj = 0; jj < num; ++jj) { curr = &_vertexElements[jj]; - if (0 == bx::strncmp(curr->SemanticName, "TEXCOORD") + if (0 == bx::strCmp(curr->SemanticName, "TEXCOORD") && curr->SemanticIndex == index) { break; diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index 4cfc8051c..a9bcc22b7 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -464,7 +464,7 @@ namespace bgfx { namespace d3d9 } if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) - && 0 != bx::strnstr(desc.Description, "PerfHUD") ) + && 0 != bx::strFind(desc.Description, "PerfHUD") ) { m_adapter = ii; m_deviceType = D3DDEVTYPE_REF; diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 85601049f..2e070a999 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -1061,7 +1061,7 @@ namespace bgfx { namespace gl while (pos < end) { uint32_t len; - const char* space = bx::strnchr(pos, ' '); + const char* space = bx::strFind(pos, ' '); if (NULL != space) { len = bx::uint32_min(sizeof(name), (uint32_t)(space - pos) ); @@ -1355,12 +1355,12 @@ namespace bgfx { namespace gl && extension.m_initialize) { const char* ext = _name; - if (0 == bx::strncmp(ext, "GL_", 3) ) // skip GL_ + if (0 == bx::strCmp(ext, "GL_", 3) ) // skip GL_ { ext += 3; } - if (0 == bx::strncmp(ext, extension.m_name) ) + if (0 == bx::strCmp(ext, extension.m_name) ) { extension.m_supported = true; supported = true; @@ -1485,7 +1485,7 @@ namespace bgfx { namespace gl for (uint32_t ii = 0; ii < BX_COUNTOF(s_vendorIds); ++ii) { const VendorId& vendorId = s_vendorIds[ii]; - if (0 == bx::strncmp(vendorId.name, m_vendor, bx::strLen(vendorId.name) ) ) + if (0 == bx::strCmp(vendorId.name, m_vendor, bx::strLen(vendorId.name) ) ) { g_caps.vendorId = vendorId.id; break; @@ -1561,8 +1561,8 @@ namespace bgfx { namespace gl ; if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 31) - && 0 == bx::strncmp(m_vendor, "Imagination Technologies") - && NULL != bx::strnstr(m_version, "(SDK 3.5@3510720)") ) + && 0 == bx::strCmp(m_vendor, "Imagination Technologies") + && NULL != bx::strFind(m_version, "(SDK 3.5@3510720)") ) { // Skip initializing extensions that are broken in emulator. s_extension[Extension::ARB_program_interface_query ].m_initialize = @@ -1582,7 +1582,7 @@ namespace bgfx { namespace gl while (pos < end) { uint32_t len; - const char* space = bx::strnchr(pos, ' '); + const char* space = bx::strFind(pos, ' '); if (NULL != space) { len = bx::uint32_min(sizeof(name), (uint32_t)(space - pos) ); @@ -4192,13 +4192,13 @@ namespace bgfx { namespace gl num = bx::uint32_max(num, 1); int offset = 0; - char* array = const_cast(bx::strnchr(name, '[') ); + char* array = const_cast(bx::strFind(name, '[') ); if (NULL != array) { BX_TRACE("--- %s", name); *array = '\0'; array++; - char* end = const_cast(bx::strnchr(array, ']') ); + char* end = const_cast(bx::strFind(array, ']') ); if (NULL != end) { // Some devices (Amazon Fire) might not return terminating brace. *end = '\0'; @@ -5572,10 +5572,10 @@ namespace bgfx { namespace gl if (insertFragDepth) { - const char* entry = bx::strnstr(temp, "void main ()"); + const char* entry = bx::strFind(temp, "void main ()"); if (NULL != entry) { - char* brace = const_cast(bx::strnstr(entry, "{") ); + char* brace = const_cast(bx::strFind(entry, "{") ); if (NULL != brace) { const char* end = bx::strmb(brace, '{', '}'); @@ -5673,7 +5673,7 @@ namespace bgfx { namespace gl { char tmpFragData[16]; bx::snprintf(tmpFragData, BX_COUNTOF(tmpFragData), "gl_FragData[%d]", ii); - fragData = bx::uint32_max(fragData, NULL == bx::strnstr(code, tmpFragData) ? 0 : ii+1); + fragData = bx::uint32_max(fragData, NULL == bx::strFind(code, tmpFragData) ? 0 : ii+1); } BGFX_FATAL(0 != fragData, Fatal::InvalidShader, "Unable to find and patch gl_FragData!"); @@ -5766,7 +5766,7 @@ namespace bgfx { namespace gl { char tmpFragData[16]; bx::snprintf(tmpFragData, BX_COUNTOF(tmpFragData), "gl_FragData[%d]", ii); - fragData = bx::uint32_max(fragData, NULL == bx::strnstr(code, tmpFragData) ? 0 : ii+1); + fragData = bx::uint32_max(fragData, NULL == bx::strFind(code, tmpFragData) ? 0 : ii+1); } BGFX_FATAL(0 != fragData, Fatal::InvalidShader, "Unable to find and patch gl_FragData!"); diff --git a/tools/geometryc/geometryc.cpp b/tools/geometryc/geometryc.cpp index 14275ba52..c60650a7b 100644 --- a/tools/geometryc/geometryc.cpp +++ b/tools/geometryc/geometryc.cpp @@ -525,12 +525,12 @@ int main(int _argc, const char* _argv[]) } const char* vertex = argv[edge+1]; - char* texcoord = const_cast(bx::strnchr(vertex, '/') ); + char* texcoord = const_cast(bx::strFind(vertex, '/') ); if (NULL != texcoord) { *texcoord++ = '\0'; - char* normal = const_cast(bx::strnchr(texcoord, '/') ); + char* normal = const_cast(bx::strFind(texcoord, '/') ); if (NULL != normal) { *normal++ = '\0'; diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index 0538fb96d..97c0b1638 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -141,11 +141,11 @@ namespace bgfx const char* interpolationDx11(const char* _glsl) { - if (0 == bx::strncmp(_glsl, "smooth") ) + if (0 == bx::strCmp(_glsl, "smooth") ) { return "linear"; } - else if (0 == bx::strncmp(_glsl, "flat") ) + else if (0 == bx::strCmp(_glsl, "flat") ) { return "nointerpolation"; } @@ -169,7 +169,7 @@ namespace bgfx for (uint32_t ii = 0; ii < UniformType::Count*2; ++ii) { if (NULL != s_uniformTypeName[ii] - && 0 == bx::strncmp(_name, s_uniformTypeName[ii]) ) + && 0 == bx::strCmp(_name, s_uniformTypeName[ii]) ) { return UniformType::Enum(ii/2); } @@ -382,7 +382,7 @@ namespace bgfx replace[len] = '\0'; BX_CHECK(len >= bx::strLen(_replace), ""); - for (const char* ptr = bx::strnstr(_str, _find); NULL != ptr; ptr = bx::strnstr(ptr + len, _find) ) + for (const char* ptr = bx::strFind(_str, _find); NULL != ptr; ptr = bx::strFind(ptr + len, _find) ) { bx::memCopy(const_cast(ptr), replace, len); } @@ -517,9 +517,9 @@ namespace bgfx { char* start = scratch(_includeDir); - for (char* split = const_cast(bx::strnchr(start, ';') ) + for (char* split = const_cast(bx::strFind(start, ';') ) ; NULL != split - ; split = const_cast(bx::strnchr(start, ';') ) + ; split = const_cast(bx::strFind(start, ';') ) ) { *split = '\0'; @@ -814,32 +814,32 @@ namespace bgfx const char* profile = cmdLine.findOption('p', "profile"); if (NULL != profile) { - if (0 == bx::strncmp(&profile[1], "s_4_0_level", 11) ) + if (0 == bx::strCmp(&profile[1], "s_4_0_level", 11) ) { hlsl = 2; } - else if (0 == bx::strncmp(&profile[1], "s_3", 3) ) + else if (0 == bx::strCmp(&profile[1], "s_3", 3) ) { hlsl = 3; d3d = 9; } - else if (0 == bx::strncmp(&profile[1], "s_4", 3) ) + else if (0 == bx::strCmp(&profile[1], "s_4", 3) ) { hlsl = 4; } - else if (0 == bx::strncmp(&profile[1], "s_5", 3) ) + else if (0 == bx::strCmp(&profile[1], "s_5", 3) ) { hlsl = 5; } - else if (0 == bx::strncmp(profile, "metal") ) + else if (0 == bx::strCmp(profile, "metal") ) { metal = 1; } - else if (0 == bx::strncmp(profile, "pssl") ) + else if (0 == bx::strCmp(profile, "pssl") ) { pssl = 1; } - else if (0 == bx::strncmp(profile, "spirv") ) + else if (0 == bx::strCmp(profile, "spirv") ) { spirv = 1; } @@ -912,7 +912,7 @@ namespace bgfx && '\0' != *defines) { defines = bx::strws(defines); - const char* eol = bx::strnchr(defines, ';'); + const char* eol = bx::strFind(defines, ';'); if (NULL == eol) { eol = defines + bx::strLen(defines); @@ -950,22 +950,22 @@ namespace bgfx , essl ? 1 : glsl ); - if (0 == bx::strincmp(platform, "android") ) + if (0 == bx::strCmpI(platform, "android") ) { preprocessor.setDefine("BX_PLATFORM_ANDROID=1"); preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1"); } - else if (0 == bx::strincmp(platform, "asm.js") ) + else if (0 == bx::strCmpI(platform, "asm.js") ) { preprocessor.setDefine("BX_PLATFORM_EMSCRIPTEN=1"); preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1"); } - else if (0 == bx::strincmp(platform, "ios") ) + else if (0 == bx::strCmpI(platform, "ios") ) { preprocessor.setDefine("BX_PLATFORM_IOS=1"); preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1"); } - else if (0 == bx::strincmp(platform, "linux") ) + else if (0 == bx::strCmpI(platform, "linux") ) { preprocessor.setDefine("BX_PLATFORM_LINUX=1"); if (0 != spirv) @@ -977,12 +977,12 @@ namespace bgfx preprocessor.setDefine(glslDefine); } } - else if (0 == bx::strincmp(platform, "nacl") ) + else if (0 == bx::strCmpI(platform, "nacl") ) { preprocessor.setDefine("BX_PLATFORM_NACL=1"); preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1"); } - else if (0 == bx::strincmp(platform, "osx") ) + else if (0 == bx::strCmpI(platform, "osx") ) { preprocessor.setDefine("BX_PLATFORM_OSX=1"); preprocessor.setDefine(glslDefine); @@ -990,19 +990,19 @@ namespace bgfx bx::snprintf(temp, sizeof(temp), "BGFX_SHADER_LANGUAGE_METAL=%d", metal); preprocessor.setDefine(temp); } - else if (0 == bx::strincmp(platform, "windows") ) + else if (0 == bx::strCmpI(platform, "windows") ) { preprocessor.setDefine("BX_PLATFORM_WINDOWS=1"); char temp[256]; bx::snprintf(temp, sizeof(temp), "BGFX_SHADER_LANGUAGE_HLSL=%d", hlsl); preprocessor.setDefine(temp); } - else if (0 == bx::strincmp(platform, "xbox360") ) + else if (0 == bx::strCmpI(platform, "xbox360") ) { preprocessor.setDefine("BX_PLATFORM_XBOX360=1"); preprocessor.setDefine("BGFX_SHADER_LANGUAGE_HLSL=3"); } - else if (0 == bx::strincmp(platform, "orbis") ) + else if (0 == bx::strCmpI(platform, "orbis") ) { preprocessor.setDefine("BX_PLATFORM_PS4=1"); preprocessor.setDefine("BGFX_SHADER_LANGUAGE_PSSL=1"); @@ -1060,7 +1060,7 @@ namespace bgfx && *parse != '\0') { parse = bx::strws(parse); - const char* eol = bx::strnchr(parse, ';'); + const char* eol = bx::strFind(parse, ';'); if (NULL == eol) { eol = bx::streol(parse); @@ -1072,18 +1072,18 @@ namespace bgfx const char* interpolation = NULL; const char* typen = parse; - if (0 == bx::strncmp(typen, "lowp", 4) - || 0 == bx::strncmp(typen, "mediump", 7) - || 0 == bx::strncmp(typen, "highp", 5) ) + if (0 == bx::strCmp(typen, "lowp", 4) + || 0 == bx::strCmp(typen, "mediump", 7) + || 0 == bx::strCmp(typen, "highp", 5) ) { precision = typen; typen = parse = bx::strws(bx::strword(parse) ); } - if (0 == bx::strncmp(typen, "flat", 4) - || 0 == bx::strncmp(typen, "smooth", 6) - || 0 == bx::strncmp(typen, "noperspective", 13) - || 0 == bx::strncmp(typen, "centroid", 8) ) + if (0 == bx::strCmp(typen, "flat", 4) + || 0 == bx::strCmp(typen, "smooth", 6) + || 0 == bx::strCmp(typen, "noperspective", 13) + || 0 == bx::strCmp(typen, "centroid", 8) ) { interpolation = typen; typen = parse = bx::strws(bx::strword(parse) ); @@ -1187,21 +1187,21 @@ namespace bgfx const char* nl = bx::strnl(eol); input = const_cast(nl); - if (0 == bx::strncmp(str, "input", 5) ) + if (0 == bx::strCmp(str, "input", 5) ) { str += 5; - const char* comment = bx::strnstr(str, "//"); + const char* comment = bx::strFind(str, "//"); eol = NULL != comment && comment < eol ? comment : eol; inputHash = parseInOut(shaderInputs, str, eol); } - else if (0 == bx::strncmp(str, "output", 6) ) + else if (0 == bx::strCmp(str, "output", 6) ) { str += 6; - const char* comment = bx::strnstr(str, "//"); + const char* comment = bx::strFind(str, "//"); eol = NULL != comment && comment < eol ? comment : eol; outputHash = parseInOut(shaderOutputs, str, eol); } - else if (0 == bx::strncmp(str, "raw", 3) ) + else if (0 == bx::strCmp(str, "raw", 3) ) { raw = true; str += 3; @@ -1271,7 +1271,7 @@ namespace bgfx } else if ('c' == shaderType) // Compute { - char* entry = const_cast(bx::strnstr(input, "void main()") ); + char* entry = const_cast(bx::strFind(input, "void main()") ); if (NULL == entry) { fprintf(stderr, "Shader entry point 'void main()' is not found.\n"); @@ -1310,10 +1310,10 @@ namespace bgfx uint32_t arg = 0; - const bool hasLocalInvocationID = NULL != bx::strnstr(input, "gl_LocalInvocationID"); - const bool hasLocalInvocationIndex = NULL != bx::strnstr(input, "gl_LocalInvocationIndex"); - const bool hasGlobalInvocationID = NULL != bx::strnstr(input, "gl_GlobalInvocationID"); - const bool hasWorkGroupID = NULL != bx::strnstr(input, "gl_WorkGroupID"); + const bool hasLocalInvocationID = NULL != bx::strFind(input, "gl_LocalInvocationID"); + const bool hasLocalInvocationIndex = NULL != bx::strFind(input, "gl_LocalInvocationIndex"); + const bool hasGlobalInvocationID = NULL != bx::strFind(input, "gl_GlobalInvocationID"); + const bool hasWorkGroupID = NULL != bx::strFind(input, "gl_WorkGroupID"); if (hasLocalInvocationID) { @@ -1458,7 +1458,7 @@ namespace bgfx } else // Vertex/Fragment { - char* entry = const_cast(bx::strnstr(input, "void main()") ); + char* entry = const_cast(bx::strFind(input, "void main()") ); if (NULL == entry) { fprintf(stderr, "Shader entry point 'void main()' is not found.\n"); @@ -1487,8 +1487,8 @@ namespace bgfx const Varying& var = varyingIt->second; const char* name = var.m_name.c_str(); - if (0 == bx::strncmp(name, "a_", 2) - || 0 == bx::strncmp(name, "i_", 2) ) + if (0 == bx::strCmp(name, "a_", 2) + || 0 == bx::strCmp(name, "i_", 2) ) { preprocessor.writef("attribute %s %s %s %s;\n" , var.m_precision.c_str() @@ -1558,17 +1558,17 @@ namespace bgfx if ('f' == shaderType) { - const char* insert = bx::strnstr(entry, "{"); + const char* insert = bx::strFind(entry, "{"); if (NULL != insert) { insert = strInsert(const_cast(insert+1), "\nvec4 bgfx_VoidFrag = vec4_splat(0.0);\n"); } - const bool hasFragColor = NULL != bx::strnstr(input, "gl_FragColor"); - const bool hasFragCoord = NULL != bx::strnstr(input, "gl_FragCoord") || hlsl > 3 || hlsl == 2; - const bool hasFragDepth = NULL != bx::strnstr(input, "gl_FragDepth"); - const bool hasFrontFacing = NULL != bx::strnstr(input, "gl_FrontFacing"); - const bool hasPrimitiveId = NULL != bx::strnstr(input, "gl_PrimitiveID"); + const bool hasFragColor = NULL != bx::strFind(input, "gl_FragColor"); + const bool hasFragCoord = NULL != bx::strFind(input, "gl_FragCoord") || hlsl > 3 || hlsl == 2; + const bool hasFragDepth = NULL != bx::strFind(input, "gl_FragDepth"); + const bool hasFrontFacing = NULL != bx::strFind(input, "gl_FrontFacing"); + const bool hasPrimitiveId = NULL != bx::strFind(input, "gl_PrimitiveID"); bool hasFragData[8] = {}; uint32_t numFragData = 0; @@ -1576,7 +1576,7 @@ namespace bgfx { char temp[32]; bx::snprintf(temp, BX_COUNTOF(temp), "gl_FragData[%d]", ii); - hasFragData[ii] = NULL != bx::strnstr(input, temp); + hasFragData[ii] = NULL != bx::strFind(input, temp); numFragData += hasFragData[ii]; } @@ -1698,7 +1698,7 @@ namespace bgfx } else if ('v' == shaderType) { - const char* brace = bx::strnstr(entry, "{"); + const char* brace = bx::strFind(entry, "{"); if (NULL != brace) { const char* end = bx::strmb(brace, '{', '}'); diff --git a/tools/shaderc/shaderc_glsl.cpp b/tools/shaderc/shaderc_glsl.cpp index ad3f9601a..50d7469e7 100644 --- a/tools/shaderc/shaderc_glsl.cpp +++ b/tools/shaderc/shaderc_glsl.cpp @@ -109,16 +109,16 @@ namespace bgfx { namespace glsl && *parse != '\0') { parse = bx::strws(parse); - const char* eol = bx::strnchr(parse, ';'); + const char* eol = bx::strFind(parse, ';'); if (NULL != eol) { const char* qualifier = parse; parse = bx::strws(bx::strword(parse) ); - if (0 == bx::strncmp(qualifier, "attribute", 9) - || 0 == bx::strncmp(qualifier, "varying", 7) - || 0 == bx::strncmp(qualifier, "in", 2) - || 0 == bx::strncmp(qualifier, "out", 3) + if (0 == bx::strCmp(qualifier, "attribute", 9) + || 0 == bx::strCmp(qualifier, "varying", 7) + || 0 == bx::strCmp(qualifier, "in", 2) + || 0 == bx::strCmp(qualifier, "out", 3) ) { // skip attributes and varyings. @@ -126,7 +126,7 @@ namespace bgfx { namespace glsl continue; } - if (0 != bx::strncmp(qualifier, "uniform", 7) ) + if (0 != bx::strCmp(qualifier, "uniform", 7) ) { // end if there is no uniform keyword. parse = NULL; @@ -136,9 +136,9 @@ namespace bgfx { namespace glsl const char* precision = NULL; const char* typen = parse; - if (0 == bx::strncmp(typen, "lowp", 4) - || 0 == bx::strncmp(typen, "mediump", 7) - || 0 == bx::strncmp(typen, "highp", 5) ) + if (0 == bx::strCmp(typen, "lowp", 4) + || 0 == bx::strCmp(typen, "mediump", 7) + || 0 == bx::strCmp(typen, "highp", 5) ) { precision = typen; typen = parse = bx::strws(bx::strword(parse) ); @@ -149,7 +149,7 @@ namespace bgfx { namespace glsl char uniformType[256]; parse = bx::strword(parse); - if (0 == bx::strncmp(typen, "sampler", 7) ) + if (0 == bx::strCmp(typen, "sampler", 7) ) { bx::strCopy(uniformType, BX_COUNTOF(uniformType), "int"); } @@ -162,13 +162,13 @@ namespace bgfx { namespace glsl char uniformName[256]; uint8_t num = 1; - const char* array = bx::strnstr(name, "[", int32_t(eol-parse) ); + const char* array = bx::strFind(name, "[", int32_t(eol-parse) ); if (NULL != array) { bx::strCopy(uniformName, int32_t(array-name+1), name); char arraySize[32]; - const char* end = bx::strnstr(array, "]", int32_t(eol-array) ); + const char* end = bx::strFind(array, "]", int32_t(eol-array) ); bx::strCopy(arraySize, int32_t(end-array), array+1); num = uint8_t(atoi(arraySize) ); } @@ -197,19 +197,19 @@ namespace bgfx { namespace glsl } else { - const char* parse = bx::strnstr(optimizedShader, "struct xlatMtlShaderUniform {"); + const char* parse = bx::strFind(optimizedShader, "struct xlatMtlShaderUniform {"); const char* end = parse; if (NULL != parse) { parse += bx::strLen("struct xlatMtlShaderUniform {"); - end = bx::strnstr(parse, "};"); + end = bx::strFind(parse, "};"); } while ( parse < end && *parse != '\0') { parse = bx::strws(parse); - const char* eol = bx::strnchr(parse, ';'); + const char* eol = bx::strFind(parse, ';'); if (NULL != eol) { const char* typen = parse; @@ -221,13 +221,13 @@ namespace bgfx { namespace glsl char uniformName[256]; uint8_t num = 1; - const char* array = bx::strnstr(name, "[", int32_t(eol-parse) ); + const char* array = bx::strFind(name, "[", int32_t(eol-parse) ); if (NULL != array) { bx::strCopy(uniformName, int32_t(array-name+1), name); char arraySize[32]; - const char* arrayEnd = bx::strnstr(array, "]", int32_t(eol-array) ); + const char* arrayEnd = bx::strFind(array, "]", int32_t(eol-array) ); bx::strCopy(arraySize, int32_t(arrayEnd-array), array+1); num = uint8_t(atoi(arraySize) ); } diff --git a/tools/shaderc/shaderc_hlsl.cpp b/tools/shaderc/shaderc_hlsl.cpp index 8f4e3934a..280625629 100644 --- a/tools/shaderc/shaderc_hlsl.cpp +++ b/tools/shaderc/shaderc_hlsl.cpp @@ -520,7 +520,7 @@ namespace bgfx { namespace hlsl , bindDesc.BindCount ); - const char * end = bx::strnstr(bindDesc.Name, "Sampler"); + const char * end = bx::strFind(bindDesc.Name, "Sampler"); if (NULL != end) { Uniform un; diff --git a/tools/shaderc/shaderc_spirv.cpp b/tools/shaderc/shaderc_spirv.cpp index 97a902958..7636608ac 100644 --- a/tools/shaderc/shaderc_spirv.cpp +++ b/tools/shaderc/shaderc_spirv.cpp @@ -495,7 +495,7 @@ namespace bgfx { namespace spirv const SpvReflection::Id& id = it->second; uint32_t num = uint32_t(id.members.size() ); if (0 < num - && 0 != bx::strncmp(id.var.name.c_str(), "gl_PerVertex") ) + && 0 != bx::strCmp(id.var.name.c_str(), "gl_PerVertex") ) { printf("%3d: %s %d %s\n" , it->first @@ -606,7 +606,7 @@ namespace bgfx { namespace spirv int32_t start = 0; int32_t end = INT32_MAX; - const char* err = bx::strnstr(log, "ERROR:"); + const char* err = bx::strFind(log, "ERROR:"); bool found = false; diff --git a/tools/texturec/texturec.cpp b/tools/texturec/texturec.cpp index 77c936e01..334cd34e6 100644 --- a/tools/texturec/texturec.cpp +++ b/tools/texturec/texturec.cpp @@ -402,7 +402,7 @@ int main(int _argc, const char* _argv[]) } const char* saveAs = cmdLine.findOption("as"); - saveAs = NULL == saveAs ? bx::stristr(outputFileName, ".ktx") : saveAs; + saveAs = NULL == saveAs ? bx::strFindI(outputFileName, ".ktx") : saveAs; if (NULL == saveAs) { help("Output file format must be specified."); @@ -472,7 +472,7 @@ int main(int _argc, const char* _argv[]) bx::CrtFileWriter writer; if (bx::open(&writer, outputFileName) ) { - if (NULL != bx::stristr(saveAs, "ktx") ) + if (NULL != bx::strFindI(saveAs, "ktx") ) { bimg::imageWriteKtx(&writer, *output, output->m_data, output->m_size); } diff --git a/tools/texturev/texturev.cpp b/tools/texturev/texturev.cpp index 182f56f5a..2b825b8b1 100644 --- a/tools/texturev/texturev.cpp +++ b/tools/texturev/texturev.cpp @@ -312,14 +312,14 @@ struct View { if (0 == (item->d_type & DT_DIR) ) { - const char* ext = bx::strnrchr(item->d_name, '.'); + const char* ext = bx::strRFind(item->d_name, '.'); if (NULL != ext) { ext += 1; bool supported = false; for (uint32_t ii = 0; ii < BX_COUNTOF(s_supportedExt); ++ii) { - if (0 == bx::strincmp(ext, s_supportedExt[ii]) ) + if (0 == bx::strCmpI(ext, s_supportedExt[ii]) ) { supported = true; break;