tinfoilboy/atomizes

return string in MessageMethodToString

IamLupo opened this issue · 0 comments

I get compile warning:

In file included from /home/iamlupo/BF2MC-Matchmaker/src/webserver/client.cpp:14:
/home/iamlupo/BF2MC-Matchmaker/third-party/atomizes/include/atomizes.hpp: In function ‘std::string atomizes::MessageMethodToString(const atomizes::MessageMethod&)’:
/home/iamlupo/BF2MC-Matchmaker/third-party/atomizes/include/atomizes.hpp:96:5: warning: control reaches end of non-void function [-Wreturn-type]
   96 |     }
      |

In atomizes.hpp at the bottom of this function it doesn't have a return case. Maybe patch it like this?

    /**
     * Converts a MessageMethod enum to a string for use in a request.
     */
    inline std::string MessageMethodToString(const MessageMethod& method)
    {
        switch (method)
        {
        case MessageMethod::NONE:
            return "NONE";
        case MessageMethod::GET:
            return "GET";
        case MessageMethod::HEAD:
            return "HEAD";
        case MessageMethod::POST:
            return "POST";
        case MessageMethod::PUT:
            return "PUT";
        case MessageMethod::DELETE:
            return "DELETE";
        case MessageMethod::CONNECT:
            return "CONNECT";
        case MessageMethod::TRACE:
            return "TRACE";
        case MessageMethod::PATCH:
            return "PATCH";
        }
      
        // Fix:
        return "NONE";
    }