Renaming string functions.

This commit is contained in:
Branimir Karadžić 2017-04-16 21:56:17 -07:00
parent 68ad150981
commit 6e9e862565
15 changed files with 66 additions and 66 deletions

View File

@ -119,9 +119,9 @@ static bgfx::ShaderHandle loadShader(bx::FileReaderI* _reader, const char* _name
break;
}
bx::strlncpy(filePath, BX_COUNTOF(filePath), shaderPath);
bx::strlncat(filePath, BX_COUNTOF(filePath), _name);
bx::strlncat(filePath, BX_COUNTOF(filePath), ".bin");
bx::strCopy(filePath, BX_COUNTOF(filePath), shaderPath);
bx::strCat(filePath, BX_COUNTOF(filePath), _name);
bx::strCat(filePath, BX_COUNTOF(filePath), ".bin");
return bgfx::createShader(loadMem(_reader, filePath) );
}

View File

@ -28,7 +28,7 @@ struct CmdContext
void add(const char* _name, ConsoleFn _fn, void* _userData)
{
uint32_t cmd = bx::hashMurmur2A(_name, (uint32_t)bx::strnlen(_name) );
uint32_t cmd = bx::hashMurmur2A(_name, (uint32_t)bx::strLen(_name) );
BX_CHECK(m_lookup.end() == m_lookup.find(cmd), "Command \"%s\" already exist.", _name);
Func fn = { _fn, _userData };
m_lookup.insert(stl::make_pair(cmd, fn) );
@ -46,7 +46,7 @@ struct CmdContext
if (argc > 0)
{
int err = -1;
uint32_t cmd = bx::hashMurmur2A(argv[0], (uint32_t)bx::strnlen(argv[0]) );
uint32_t cmd = bx::hashMurmur2A(argv[0], (uint32_t)bx::strLen(argv[0]) );
CmdLookup::iterator it = m_lookup.find(cmd);
if (it != m_lookup.end() )
{

View File

@ -251,7 +251,7 @@ void TextBuffer::appendText(FontHandle _fontHandle, const char* _string, const c
if (_end == NULL)
{
_end = _string + bx::strnlen(_string);
_end = _string + bx::strLen(_string);
}
BX_CHECK(_end >= _string);

View File

@ -118,10 +118,10 @@ namespace bgfx
BX_UNUSED(_filePath, _width, _height, _pitch, _data, _size, _yflip);
#if BX_CONFIG_CRT_FILE_READER_WRITER
const int32_t len = bx::strnlen(_filePath)+5;
const int32_t len = bx::strLen(_filePath)+5;
char* filePath = (char*)alloca(len);
bx::strlncpy(filePath, len, _filePath);
bx::strlncat(filePath, len, ".tga");
bx::strCopy(filePath, len, _filePath);
bx::strCat(filePath, len, ".tga");
bx::CrtFileWriter writer;
if (bx::open(&writer, filePath) )
@ -511,7 +511,7 @@ namespace bgfx
char tmp[4];
int32_t len = int32_t(str-_ptr);
bx::strlncpy(tmp, sizeof(tmp), _ptr, len);
bx::strCopy(tmp, sizeof(tmp), _ptr, len);
uint8_t attr = uint8_t(atoi(tmp) );
_ptr += len+1;
@ -1078,7 +1078,7 @@ namespace bgfx
void UniformBuffer::writeMarker(const char* _marker)
{
uint16_t num = (uint16_t)bx::strnlen(_marker)+1;
uint16_t num = (uint16_t)bx::strLen(_marker)+1;
uint32_t opcode = encodeOpcode(bgfx::UniformType::Count, 0, num, true);
write(opcode);
write(_marker, num);

View File

@ -3604,7 +3604,7 @@ namespace bgfx
cmdbuf.write(handle);
cmdbuf.write(uniform.m_type);
cmdbuf.write(uniform.m_num);
uint8_t len = (uint8_t)bx::strnlen(_name)+1;
uint8_t len = (uint8_t)bx::strLen(_name)+1;
cmdbuf.write(len);
cmdbuf.write(_name, len);
}
@ -3632,7 +3632,7 @@ namespace bgfx
cmdbuf.write(handle);
cmdbuf.write(_type);
cmdbuf.write(_num);
uint8_t len = (uint8_t)bx::strnlen(_name)+1;
uint8_t len = (uint8_t)bx::strLen(_name)+1;
cmdbuf.write(len);
cmdbuf.write(_name, len);
}
@ -3649,7 +3649,7 @@ namespace bgfx
BGFX_CHECK_HANDLE("getUniformInfo", m_uniformHandle, _handle);
UniformRef& uniform = m_uniformRef[_handle.idx];
bx::strlcpy(_info.name, uniform.m_name.getPtr(), sizeof(_info.name) );
bx::strCopy(_info.name, sizeof(_info.name), uniform.m_name.getPtr() );
_info.type = uniform.m_type;
_info.num = uniform.m_num;
}
@ -3730,7 +3730,7 @@ namespace bgfx
}
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::RequestScreenShot);
uint16_t len = (uint16_t)bx::strnlen(_filePath)+1;
uint16_t len = (uint16_t)bx::strLen(_filePath)+1;
cmdbuf.write(_handle);
cmdbuf.write(len);
cmdbuf.write(_filePath, len);
@ -3750,7 +3750,7 @@ namespace bgfx
{
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::UpdateViewName);
cmdbuf.write(_id);
uint16_t len = (uint16_t)bx::strnlen(_name)+1;
uint16_t len = (uint16_t)bx::strLen(_name)+1;
cmdbuf.write(len);
cmdbuf.write(_name, len);
}

View File

@ -2099,9 +2099,9 @@ BX_PRAGMA_DIAGNOSTIC_POP();
);
}
bx::strlcpy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED]
, _name
bx::strCopy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED]
, BX_COUNTOF(s_viewName[0]) - BGFX_CONFIG_MAX_VIEW_NAME_RESERVED
, _name
);
}

View File

@ -1211,9 +1211,9 @@ namespace bgfx { namespace d3d9
);
}
bx::strlcpy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED]
, _name
bx::strCopy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED]
, BX_COUNTOF(s_viewName[0]) - BGFX_CONFIG_MAX_VIEW_NAME_RESERVED
, _name
);
}

View File

@ -986,7 +986,7 @@ namespace bgfx { namespace gl
//
// If <length> is 0 then <marker> is assumed to be null-terminated.
uint32_t size = (0 == _length ? (uint32_t)bx::strnlen(_marker) : _length) + 1;
uint32_t size = (0 == _length ? (uint32_t)bx::strLen(_marker) : _length) + 1;
size *= sizeof(wchar_t);
wchar_t* name = (wchar_t*)alloca(size);
mbstowcs(name, _marker, size-2);
@ -1045,7 +1045,7 @@ namespace bgfx { namespace gl
glGetError(); // ignore error if glGetString returns NULL.
if (NULL != str)
{
return bx::hashMurmur2A(str, (uint32_t)bx::strnlen(str) );
return bx::hashMurmur2A(str, (uint32_t)bx::strLen(str) );
}
return 0;
@ -1057,7 +1057,7 @@ namespace bgfx { namespace gl
{
char name[1024];
const char* pos = _extensions;
const char* end = _extensions + bx::strnlen(_extensions);
const char* end = _extensions + bx::strLen(_extensions);
while (pos < end)
{
uint32_t len;
@ -1068,10 +1068,10 @@ namespace bgfx { namespace gl
}
else
{
len = bx::uint32_min(sizeof(name), (uint32_t)bx::strnlen(pos) );
len = bx::uint32_min(sizeof(name), (uint32_t)bx::strLen(pos) );
}
bx::strlncpy(name, BX_COUNTOF(name), pos, len);
bx::strCopy(name, BX_COUNTOF(name), pos, len);
name[len] = '\0';
BX_TRACE("\t%s", name);
@ -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::strnlen(vendorId.name) ) )
if (0 == bx::strncmp(vendorId.name, m_vendor, bx::strLen(vendorId.name) ) )
{
g_caps.vendorId = vendorId.id;
break;
@ -1577,7 +1577,7 @@ namespace bgfx { namespace gl
{
char name[1024];
const char* pos = extensions;
const char* end = extensions + bx::strnlen(extensions);
const char* end = extensions + bx::strLen(extensions);
uint32_t index = 0;
while (pos < end)
{
@ -1589,10 +1589,10 @@ namespace bgfx { namespace gl
}
else
{
len = bx::uint32_min(sizeof(name), (uint32_t)bx::strnlen(pos) );
len = bx::uint32_min(sizeof(name), (uint32_t)bx::strLen(pos) );
}
bx::strlncpy(name, BX_COUNTOF(name), pos, len);
bx::strCopy(name, BX_COUNTOF(name), pos, len);
name[len] = '\0';
updateExtension(name);
@ -2591,9 +2591,9 @@ namespace bgfx { namespace gl
void updateViewName(uint8_t _id, const char* _name) BX_OVERRIDE
{
bx::strlcpy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED]
, _name
bx::strCopy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED]
, BX_COUNTOF(s_viewName[0])-BGFX_CONFIG_MAX_VIEW_NAME_RESERVED
, _name
);
}
@ -5338,7 +5338,7 @@ namespace bgfx { namespace gl
void writeString(bx::WriterI* _writer, const char* _str)
{
bx::write(_writer, _str, (int32_t)bx::strnlen(_str) );
bx::write(_writer, _str, (int32_t)bx::strLen(_str) );
}
void writeStringf(bx::WriterI* _writer, const char* _format, ...)
@ -5355,8 +5355,8 @@ namespace bgfx { namespace gl
void strins(char* _str, const char* _insert)
{
size_t len = bx::strnlen(_insert);
bx::memMove(&_str[len], _str, bx::strnlen(_str)+1);
size_t len = bx::strLen(_insert);
bx::memMove(&_str[len], _str, bx::strLen(_str)+1);
bx::memCopy(_str, _insert, len);
}
@ -5426,7 +5426,7 @@ namespace bgfx { namespace gl
{
if (GL_COMPUTE_SHADER != m_type)
{
int32_t codeLen = (int32_t)bx::strnlen(code);
int32_t codeLen = (int32_t)bx::strLen(code);
int32_t tempLen = codeLen + (4<<10);
char* temp = (char*)alloca(tempLen);
bx::StaticMemoryBlockWriter writer(temp, tempLen);

View File

@ -950,9 +950,9 @@ namespace bgfx { namespace mtl
{
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
{
bx::strlcpy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED]
, _name
bx::strlncpy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED]
, BX_COUNTOF(s_viewName[0])-BGFX_CONFIG_MAX_VIEW_NAME_RESERVED
, _name
);
}
}

View File

@ -2100,9 +2100,9 @@ VK_IMPORT_DEVICE
void updateViewName(uint8_t _id, const char* _name) BX_OVERRIDE
{
bx::strlcpy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED]
, _name
bx::strCopy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED]
, BX_COUNTOF(s_viewName[0]) - BGFX_CONFIG_MAX_VIEW_NAME_RESERVED
, _name
);
}

View File

@ -15,7 +15,7 @@ namespace bgfx
bx::WriterI* writer = reinterpret_cast<bx::WriterI*>(_userData);
char temp[512];
toString(temp, sizeof(temp), _instruction);
bx::write(writer, temp, (int32_t)bx::strnlen(temp) );
bx::write(writer, temp, (int32_t)bx::strLen(temp) );
return true;
}
@ -24,7 +24,7 @@ namespace bgfx
bx::WriterI* writer = reinterpret_cast<bx::WriterI*>(_userData);
char temp[512];
toString(temp, sizeof(temp), _instruction);
bx::write(writer, temp, (int32_t)bx::strnlen(temp) );
bx::write(writer, temp, (int32_t)bx::strLen(temp) );
return true;
}
@ -33,7 +33,7 @@ namespace bgfx
bx::WriterI* writer = reinterpret_cast<bx::WriterI*>(_userData);
char temp[512];
toString(temp, sizeof(temp), _instruction);
bx::write(writer, temp, (int32_t)bx::strnlen(temp) );
bx::write(writer, temp, (int32_t)bx::strLen(temp) );
return true;
}

View File

@ -363,25 +363,25 @@ namespace bgfx
char* strInsert(char* _str, const char* _insert)
{
uint32_t len = bx::strnlen(_insert);
bx::memMove(&_str[len], _str, bx::strnlen(_str) );
uint32_t len = bx::strLen(_insert);
bx::memMove(&_str[len], _str, bx::strLen(_str) );
bx::memCopy(_str, _insert, len);
return _str + len;
}
void strReplace(char* _str, const char* _find, const char* _replace)
{
const int32_t len = bx::strnlen(_find);
const int32_t len = bx::strLen(_find);
char* replace = (char*)alloca(len+1);
bx::strlcpy(replace, _replace, len+1);
for (int32_t ii = bx::strnlen(replace); ii < len; ++ii)
bx::strCopy(replace, len+1, _replace);
for (int32_t ii = bx::strLen(replace); ii < len; ++ii)
{
replace[ii] = ' ';
}
replace[len] = '\0';
BX_CHECK(len >= bx::strnlen(_replace), "");
BX_CHECK(len >= bx::strLen(_replace), "");
for (const char* ptr = bx::strnstr(_str, _find); NULL != ptr; ptr = bx::strnstr(ptr + len, _find) )
{
bx::memCopy(const_cast<char*>(ptr), replace, len);
@ -548,7 +548,7 @@ namespace bgfx
m_input = m_default;
m_input += "\n\n";
int32_t len = bx::strnlen(_input)+1;
int32_t len = bx::strLen(_input)+1;
char* temp = new char[len];
bx::eolLF(temp, len, _input);
m_input += temp;
@ -610,7 +610,7 @@ namespace bgfx
{
char* result = &m_scratch[m_scratchPos];
strcpy(result, _str);
m_scratchPos += (uint32_t)strlen(_str)+1;
m_scratchPos += (uint32_t)bx::strLen(_str)+1;
return result;
}
@ -860,7 +860,7 @@ namespace bgfx
if (NULL == bin2c)
{
bin2c = bx::baseName(outFilePath);
uint32_t len = (uint32_t)strlen(bin2c);
uint32_t len = (uint32_t)bx::strLen(bin2c);
char* temp = (char*)alloca(len+1);
for (char *out = temp; *bin2c != '\0';)
{
@ -915,7 +915,7 @@ namespace bgfx
const char* eol = bx::strnchr(defines, ';');
if (NULL == eol)
{
eol = defines + strlen(defines);
eol = defines + bx::strLen(defines);
}
std::string define(defines, eol);
preprocessor.setDefine(define.c_str() );
@ -1250,7 +1250,7 @@ namespace bgfx
{
bx::write(writer, uint16_t(0) );
uint32_t shaderSize = (uint32_t)strlen(input);
uint32_t shaderSize = (uint32_t)bx::strLen(input);
bx::write(writer, shaderSize);
bx::write(writer, input, shaderSize);
bx::write(writer, uint8_t(0) );

View File

@ -74,7 +74,7 @@ namespace bgfx
LineReader(const char* _str)
: m_str(_str)
, m_pos(0)
, m_size((uint32_t)strlen(_str))
, m_size((uint32_t)bx::strLen(_str))
{
}

View File

@ -151,11 +151,11 @@ namespace bgfx { namespace glsl
if (0 == bx::strncmp(typen, "sampler", 7) )
{
bx::strlncpy(uniformType, BX_COUNTOF(uniformType), "int");
bx::strCopy(uniformType, BX_COUNTOF(uniformType), "int");
}
else
{
bx::strlcpy(uniformType, typen, int32_t(parse-typen+1) );
bx::strCopy(uniformType, int32_t(parse-typen+1), typen);
}
const char* name = parse = bx::strws(parse);
@ -165,16 +165,16 @@ namespace bgfx { namespace glsl
const char* array = bx::strnstr(name, "[", int32_t(eol-parse) );
if (NULL != array)
{
bx::strlcpy(uniformName, name, int32_t(array-name+1) );
bx::strCopy(uniformName, int32_t(array-name+1), name);
char arraySize[32];
const char* end = bx::strnstr(array, "]", int32_t(eol-array) );
bx::strlcpy(arraySize, array+1, int32_t(end-array) );
bx::strCopy(arraySize, int32_t(end-array), array+1);
num = uint8_t(atoi(arraySize) );
}
else
{
bx::strlcpy(uniformName, name, int32_t(eol-name+1) );
bx::strCopy(uniformName, int32_t(eol-name+1), name);
}
Uniform un;
@ -201,7 +201,7 @@ namespace bgfx { namespace glsl
const char* end = parse;
if (NULL != parse)
{
parse += bx::strnlen("struct xlatMtlShaderUniform {");
parse += bx::strLen("struct xlatMtlShaderUniform {");
end = bx::strnstr(parse, "};");
}
@ -216,7 +216,7 @@ namespace bgfx { namespace glsl
char uniformType[256];
parse = bx::strword(parse);
bx::strlcpy(uniformType, typen, int32_t(parse-typen+1) );
bx::strCopy(uniformType, int32_t(parse-typen+1), typen);
const char* name = parse = bx::strws(parse);
char uniformName[256];
@ -224,16 +224,16 @@ namespace bgfx { namespace glsl
const char* array = bx::strnstr(name, "[", int32_t(eol-parse) );
if (NULL != array)
{
bx::strlcpy(uniformName, name, int32_t(array-name+1) );
bx::strCopy(uniformName, int32_t(array-name+1), name);
char arraySize[32];
const char* arrayEnd = bx::strnstr(array, "]", int32_t(eol-array) );
bx::strlcpy(arraySize, array+1, int32_t(arrayEnd-array) );
bx::strCopy(arraySize, int32_t(arrayEnd-array), array+1);
num = uint8_t(atoi(arraySize) );
}
else
{
bx::strlcpy(uniformName, name, int32_t(eol-name+1) );
bx::strCopy(uniformName, int32_t(eol-name+1), name);
}
Uniform un;
@ -279,7 +279,7 @@ namespace bgfx { namespace glsl
);
}
uint32_t shaderSize = (uint32_t)strlen(optimizedShader);
uint32_t shaderSize = (uint32_t)bx::strLen(optimizedShader);
bx::write(_writer, shaderSize);
bx::write(_writer, optimizedShader, shaderSize);
uint8_t nul = 0;

View File

@ -666,7 +666,7 @@ namespace bgfx { namespace hlsl
if (_firstPass
&& unusedUniforms.size() > 0)
{
const size_t strLength = strlen("uniform");
const size_t strLength = bx::strLen("uniform");
// first time through, we just find unused uniforms and get rid of them
std::string output;