Skip to content

Commit ae8e084

Browse files
committed
修复警告
1 parent 071f666 commit ae8e084

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

LuaParser/src/LuaFile.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ int LuaFile::GetOffsetFromPosition(int line, int character)
6868
{
6969
if (line < 0)
7070
{
71-
return _source.size() + 1;
71+
return static_cast<int>(_source.size()) + 1;
7272
}
7373

7474
std::size_t sizeLine = line;
7575

7676
if (sizeLine >= _lineOffsetVec.size())
7777
{
78-
return _source.size() + 1;
78+
return static_cast<int>(_source.size()) + 1;
7979
}
8080

8181
int lineStartOffset = _lineOffsetVec[line];
@@ -175,7 +175,7 @@ std::string_view LuaFile::GetFilename() const
175175

176176
void LuaFile::UpdateLineInfo(int startLine)
177177
{
178-
int totalLine = _lineOffsetVec.size() - 1;
178+
int totalLine = static_cast<int>(_lineOffsetVec.size()) - 1;
179179
std::size_t startOffset = 0;
180180
if (totalLine < startLine)
181181
{
@@ -192,7 +192,7 @@ void LuaFile::UpdateLineInfo(int startLine)
192192
{
193193
if (_source[startOffset] == '\n')
194194
{
195-
_lineOffsetVec.push_back(startOffset + 1);
195+
_lineOffsetVec.push_back(static_cast<int>(startOffset) + 1);
196196
}
197197
}
198198
}

Util/src/SymSpell/DamerauOSADistance.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class DamerauOSA : public IDistance
127127

128128
if (maxEditDistance < len2)
129129
{
130-
return Distance(string1, string2, len1, len2, start, maxEditDistance, _baseChar1Costs, _basePrevChar1Costs);
130+
return Distance(string1, string2, len1, len2, start, static_cast<int>(maxEditDistance), _baseChar1Costs, _basePrevChar1Costs);
131131
}
132132

133133
return Distance(string1, string2, len1, len2, start, _baseChar1Costs, _basePrevChar1Costs);
@@ -265,8 +265,8 @@ class DamerauOSA : public IDistance
265265
static int NullDistanceResults(std::string_view string1, std::string_view string2, std::size_t maxEditDistance)
266266
{
267267
if (string1.empty())
268-
return (string2.empty()) ? 0 : (string2.size() <= maxEditDistance) ? string2.size() : -1;
269-
return (string1.size() <= maxEditDistance) ? string1.size() : -1;
268+
return (string2.empty()) ? 0 : (string2.size() <= maxEditDistance) ? static_cast<int>(string2.size()) : -1;
269+
return (string1.size() <= maxEditDistance) ? static_cast<int>(string1.size()) : -1;
270270
}
271271

272272
private:

0 commit comments

Comments
 (0)