mirror of https://github.com/axmolengine/axmol.git
Move skipBOM function outside to prevent shadowing warning (#16585)
This commit is contained in:
parent
1d3a40f8be
commit
e8c3082229
|
@ -844,20 +844,25 @@ int LuaStack::luaLoadChunksFromZIP(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
void skipBOM(const char*& chunk, int& chunkSize)
|
||||
{
|
||||
// UTF-8 BOM? skip
|
||||
if (static_cast<unsigned char>(chunk[0]) == 0xEF &&
|
||||
static_cast<unsigned char>(chunk[1]) == 0xBB &&
|
||||
static_cast<unsigned char>(chunk[2]) == 0xBF)
|
||||
{
|
||||
chunk += 3;
|
||||
chunkSize -= 3;
|
||||
}
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
int LuaStack::luaLoadBuffer(lua_State *L, const char *chunk, int chunkSize, const char *chunkName)
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
auto skipBOM = [](const char*& chunk, int& chunkSize){
|
||||
// UTF-8 BOM? skip
|
||||
if (static_cast<unsigned char>(chunk[0]) == 0xEF &&
|
||||
static_cast<unsigned char>(chunk[1]) == 0xBB &&
|
||||
static_cast<unsigned char>(chunk[2]) == 0xBF)
|
||||
{
|
||||
chunk += 3;
|
||||
chunkSize -= 3;
|
||||
}
|
||||
};
|
||||
|
||||
if (_xxteaEnabled && strncmp(chunk, _xxteaSign, _xxteaSignLen) == 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue