Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return string in MessageMethodToString #4

Open
IamLupo opened this issue Sep 16, 2023 · 0 comments
Open

return string in MessageMethodToString #4

IamLupo opened this issue Sep 16, 2023 · 0 comments

Comments

@IamLupo
Copy link

IamLupo commented Sep 16, 2023

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";
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant