Skip to content

Commit 4103e79

Browse files
committed
解决部分警告
1 parent a4af2ae commit 4103e79

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

CodeService/src/FormatElement/AlignToFirstElement.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void AlignToFirstElement::Serialize(FormatContext& ctx, int position, FormatElem
2020
auto indentCount = ctx.GetCurrentIndent();
2121
if (writeCount > indentCount)
2222
{
23-
ctx.AddIndent(writeCount);
23+
ctx.AddIndent(static_cast<int>(writeCount));
2424
}
2525
else
2626
{
@@ -32,7 +32,7 @@ void AlignToFirstElement::Serialize(FormatContext& ctx, int position, FormatElem
3232
}
3333
else
3434
{
35-
ctx.AddIndent(indentCount);
35+
ctx.AddIndent(static_cast<int>(indentCount));
3636
}
3737
}
3838
}

CodeService/src/FormatElement/AlignmentElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ FormatElementType AlignmentElement::GetType()
1313

1414
void AlignmentElement::Serialize(FormatContext& ctx, int position, FormatElement& parent)
1515
{
16-
int blank = _alignmentPosition - ctx.GetCharacterCount();
16+
int blank = _alignmentPosition - static_cast<int>(ctx.GetCharacterCount());
1717
if (blank > 0)
1818
{
1919
ctx.PrintBlank(blank);

CodeService/src/FormatElement/FormatContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void FormatContext::Print(std::string_view text)
1313
auto& indentState = _indentStack.top();
1414
if (_characterCount < indentState.Indent)
1515
{
16-
PrintBlank(indentState.Indent - _characterCount);
16+
PrintBlank(indentState.Indent - static_cast<int>(_characterCount));
1717
}
1818
_os << text;
1919
_characterCount += text.size();

CodeService/src/FormatElement/FormatElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ std::shared_ptr<FormatElement> FormatElement::LastValidElement() const
5858

5959
void FormatElement::Serialize(FormatContext& ctx, int position, FormatElement& parent)
6060
{
61-
for (std::size_t i = 0; i != _children.size(); i++)
61+
for (int i = 0; i < static_cast<int>(_children.size()); i++)
6262
{
6363
_children[i]->Serialize(ctx, i, *this);
6464
}

CodeService/src/FormatElement/LongExpressionLayoutElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void LongExpressionLayoutElement::Serialize(FormatContext& ctx, int position, Fo
2222
void LongExpressionLayoutElement::SerializeSubExpression(FormatContext& ctx, FormatElement& parent)
2323
{
2424
auto& children = parent.GetChildren();
25-
for (std::size_t i = 0; i != children.size(); i++)
25+
for (int i = 0; i < static_cast<int>(children.size()); i++)
2626
{
2727
auto child = children[i];
2828

LuaParser/src/LuaAstNode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void LuaAstNode::AddLeafChild(std::shared_ptr<LuaAstNode> child)
9393
}
9494

9595
// 因为std::size_t 没法低于0
96-
for (int index = _children.size() - 1; index >= 0; index--)
96+
for (int index = static_cast<int>(_children.size()) - 1; index >= 0; index--)
9797
{
9898
auto& currentChild = _children[index];
9999
auto currentChildTextRange = currentChild->GetTextRange();
@@ -117,7 +117,7 @@ void LuaAstNode::AddLeafChild(std::shared_ptr<LuaAstNode> child)
117117

118118
void LuaAstNode::addChildAfter(int index, std::shared_ptr<LuaAstNode> child)
119119
{
120-
if (index == (_children.size() - 1))
120+
if (index == static_cast<int>(_children.size() - 1))
121121
{
122122
AddChild(child);
123123
}

LuaParser/src/LuaTokenParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ int LuaTokenParser::GetLine(int offset)
127127
return 0;
128128
}
129129

130-
int maxLine = _lineOffsetVec.size() - 1;
130+
int maxLine = static_cast<int>(_lineOffsetVec.size()) - 1;
131131
int targetLine = maxLine;
132132
int upperLine = maxLine;
133133
int lowestLine = 0;

0 commit comments

Comments
 (0)