Skip to content

Commit f143e0c

Browse files
committed
适应macos毛病
1 parent 7d7ecdf commit f143e0c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

LuaParser/src/LuaTokenParser.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,13 @@ int LuaTokenParser::GetColumn(int offset)
169169

170170
int bytesLength = offset - lineStartOffset;
171171

172-
int utf8Length = ::utf8nlen(const_cast<const char*>(_source.data() + lineStartOffset),
173-
static_cast<std::size_t>(bytesLength));
174-
return utf8Length;
172+
#if __APPLE__
173+
// git action 编译时在macos下编译会报错,我不觉得有什么问题
174+
const char* macOsBug = const_cast<const char*>(_source.data() + lineStartOffset);
175+
return ::utf8nlen(macOsBug, static_cast<std::size_t>(bytesLength));
176+
#else
177+
return ::utf8nlen(_source.data() + lineStartOffset, static_cast<std::size_t>(bytesLength));
178+
#endif
175179
}
176180

177181
int LuaTokenParser::GetTotalLine()

0 commit comments

Comments
 (0)