Skip to content

GCC Compiler Warnings #3

@Sapd

Description

@Sapd

Hi,
cool & useful Code,
but some Compile Warnings on GCC via Linux with parameter -WALL

../MCQuery.cpp: In member function ‘void mcQuery::challengeReceiver(const boost::system::error_code&, size_t)’:
../MCQuery.cpp:96:68: warning: missing braces around initializer for ‘std::array<unsigned char, 5ul>::value_type [5] {aka unsigned char [5]}’ [-Wmissing-braces]
../MCQuery.cpp: In member function ‘void mcQuery::dataReceiver(const boost::system::error_code&, size_t)’:
../MCQuery.cpp:128:68: warning: missing braces around initializer for ‘std::array<unsigned char, 5ul>::value_type [5] {aka unsigned char [5]}’ [-Wmissing-braces]
../MCQuery.cpp: In member function ‘void mcQuerySimple::receiver(const boost::system::error_code&, size_t)’:
../MCQuery.cpp:291:44: warning: missing braces around initializer for ‘std::array<unsigned char, 2ul>::value_type [2] {aka unsigned char [2]}’ [-Wmissing-braces]
../MCQuery.cpp:296:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

There are just some braces missing, so here are the lines & the code which are fixed:
Line 96:

const array<uchar,5> expected = {{ 0x09, 0x01, 0x02, 0x03, 0x04 }};
Line 128:
const array<uchar,5> expected = {{ 0x00, 0x01, 0x02, 0x03, 0x04 }};
Line 291:
array<uchar,2> expected = {{ 0xFF, 0x00 }};

Also on Line 296, the compiler doesn't like the comparison between unsigned and signed. So:

for( unsigned int i=0; i<recvBuffer.size()/2; i++) {

Best regards, Sapd

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions