pritamzope/http_web_server

Error on compile fixed

Opened this issue · 5 comments

HttpService.cpp:482:20: error: no match for ‘operator!=’ (operand types are ‘const boost::system::error_code’ and ‘int’)
482 | if(ec != 0){
| ~~ ^~ ~
| | |
| | int
| const boost::system::error_code

Solution: requires the boost version of 0, const boost::system::error_code’ and ‘int which is success which is 0, i.e boost::system::errc::success

reference, https://stackoverflow.com/questions/21046742/using-boostsystemerror-code-in-c/21047089

The same error occurs in...

HttpAcceptor.cpp:41:15: error: no match for ‘operator==’ (operand types are ‘const boost::system::error_code’ and ‘int’)
41 | if(ec == 0){
| ~~ ^~ ~
| | |
| | int
| const boost::system::error_code

should read if(ec == boost::system::errc::success)

Removal of -std=c++11 from the Makefile at least in the http version
as it compiles without warning after the above fixes.

HttpService.cpp|158|warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]|

put braces around the if statement line 158 should read

        if(!m_IsResponseSent) {
          SendResponse();
          }

HttpService.cpp|248|warning: moving a local object in a return statement prevents copy elision

I cannot say to the effect but remove the moves, these edits have bad effects.

  //return std::move(program);
  return program;

HttpService.cpp|462|warning: moving a local object in a return statement prevents copy elision

//return std::move(response_status);
return response_status;

Reference https://rules.sonarsource.com/cpp/tag/bad-practice/RSPEC-5274

Has bad memory leaks segmentation faults any ideas on where they coming from?