Move skipBOM function outside to prevent shadowing warning (#16585)

This commit is contained in:
mogemimi 2016-09-20 15:52:15 +09:00 committed by minggo
parent 1d3a40f8be
commit e8c3082229
1 changed files with 16 additions and 11 deletions

View File

@ -844,11 +844,10 @@ int LuaStack::luaLoadChunksFromZIP(lua_State *L)
return 1;
}
int LuaStack::luaLoadBuffer(lua_State *L, const char *chunk, int chunkSize, const char *chunkName)
{
int r = 0;
namespace {
auto skipBOM = [](const char*& chunk, int& chunkSize){
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 &&
@ -857,7 +856,13 @@ int LuaStack::luaLoadBuffer(lua_State *L, const char *chunk, int chunkSize, cons
chunk += 3;
chunkSize -= 3;
}
};
}
} // end anonymous namespace
int LuaStack::luaLoadBuffer(lua_State *L, const char *chunk, int chunkSize, const char *chunkName)
{
int r = 0;
if (_xxteaEnabled && strncmp(chunk, _xxteaSign, _xxteaSignLen) == 0)
{