Skip to content

Commit ce34259

Browse files
authored
Merge pull request #757 from denizevrenci/clang-tidy_fixes
Clang-Tidy fixes
2 parents 4425f97 + 1584e93 commit ce34259

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppGenerator.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ private static void generateGroupClassHeader(
296296
indent + " return *m_positionPtr;\n" +
297297
indent + " }\n\n" +
298298

299+
indent + " // NOLINTNEXTLINE(readability-convert-member-functions-to-static)\n" +
299300
indent + " std::uint64_t sbeCheckPosition(const std::uint64_t position)\n" +
300301
indent + " {\n" +
301302
indent + " if (SBE_BOUNDS_CHECK_EXPECT((position > m_bufferLength), false))\n" +
@@ -668,7 +669,7 @@ private void generateVarDataDescriptors(
668669
sizeOfLengthField);
669670

670671
new Formatter(sb).format("\n" +
671-
indent + " %4$s %1$sLength() const\n" +
672+
indent + " SBE_NODISCARD %4$s %1$sLength() const\n" +
672673
indent + " {\n" +
673674
"%2$s" +
674675
indent + " %4$s length;\n" +
@@ -1524,7 +1525,7 @@ private void generateArrayProperty(
15241525
if (encodingToken.encoding().primitiveType() == PrimitiveType.CHAR)
15251526
{
15261527
new Formatter(sb).format("\n" +
1527-
indent + " std::string get%1$sAsString() const\n" +
1528+
indent + " SBE_NODISCARD std::string get%1$sAsString() const\n" +
15281529
indent + " {\n" +
15291530
indent + " const char *buffer = m_buffer + m_offset + %2$d;\n" +
15301531
indent + " size_t length = 0;\n\n" +
@@ -1542,7 +1543,7 @@ private void generateArrayProperty(
15421543

15431544
new Formatter(sb).format("\n" +
15441545
indent + " #if __cplusplus >= 201703L\n" +
1545-
indent + " std::string_view get%1$sAsStringView() const SBE_NOEXCEPT\n" +
1546+
indent + " SBE_NODISCARD std::string_view get%1$sAsStringView() const SBE_NOEXCEPT\n" +
15461547
indent + " {\n" +
15471548
indent + " const char *buffer = m_buffer + m_offset + %2$d;\n" +
15481549
indent + " size_t length = 0;\n\n" +
@@ -1609,9 +1610,9 @@ private void generateJsonEscapedStringGetter(
16091610
"%2$s" +
16101611
indent + " std::ostringstream oss;\n" +
16111612
indent + " std::string s = get%1$sAsString();\n\n" +
1612-
indent + " for (auto c = s.cbegin(); c != s.cend(); c++)\n" +
1613+
indent + " for (const auto c : s)\n" +
16131614
indent + " {\n" +
1614-
indent + " switch (*c)\n" +
1615+
indent + " switch (c)\n" +
16151616
indent + " {\n" +
16161617
indent + " case '\"': oss << \"\\\\\\\"\"; break;\n" +
16171618
indent + " case '\\\\': oss << \"\\\\\\\\\"; break;\n" +
@@ -1621,14 +1622,14 @@ private void generateJsonEscapedStringGetter(
16211622
indent + " case '\\r': oss << \"\\\\r\"; break;\n" +
16221623
indent + " case '\\t': oss << \"\\\\t\"; break;\n\n" +
16231624
indent + " default:\n" +
1624-
indent + " if ('\\x00' <= *c && *c <= '\\x1f')\n" +
1625+
indent + " if ('\\x00' <= c && c <= '\\x1f')\n" +
16251626
indent + " {\n" +
16261627
indent + " oss << \"\\\\u\"" + " << std::hex << std::setw(4)\n" +
1627-
indent + " << std::setfill('0') << (int)(*c);\n" +
1628+
indent + " << std::setfill('0') << (int)(c);\n" +
16281629
indent + " }\n" +
16291630
indent + " else\n" +
16301631
indent + " {\n" +
1631-
indent + " oss << *c;\n" +
1632+
indent + " oss << c;\n" +
16321633
indent + " }\n" +
16331634
indent + " }\n" +
16341635
indent + " }\n\n" +
@@ -1988,6 +1989,7 @@ private CharSequence generateMessageFlyweightCode(final String className, final
19881989
" return m_position;\n" +
19891990
" }\n\n" +
19901991

1992+
" // NOLINTNEXTLINE(readability-convert-member-functions-to-static)\n" +
19911993
" std::uint64_t sbeCheckPosition(const std::uint64_t position)\n" +
19921994
" {\n" +
19931995
" if (SBE_BOUNDS_CHECK_EXPECT((position > m_bufferLength), false))\n" +

0 commit comments

Comments
 (0)