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

Port to windows #31

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/httpp/utils/SortedVectorKP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ struct case_insensitive
}
else if (left.size() == right.size())
{
#ifdef WIN32
# define strncasecmp(x, y, z) _strnicmp(x, y, z)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daedric what about introducing a utils header which includes this define or is it ok to have it multiple times all over the place?

#endif
return ::strncasecmp(left.data(), right.data(), left.size()) < 0;
#ifdef WIN32
# undef strncasecmp
#endif
}
else
{
Expand Down
5 changes: 4 additions & 1 deletion src/httpp/http/Protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,13 @@ Method method_from(const std::string& str)

Method method_from(const char* str)
{
#ifdef WIN32
#define my_strlen ::strlen
#else
#define my_strlen(str) \
(__extension__(__builtin_constant_p(str) ? __builtin_strlen(str) \
: ::strlen(str)))

#endif
#define fn(name, e) \
if (::strncmp(#name, str, my_strlen(#name)) == 0) \
return Method::e;
Expand Down
4 changes: 4 additions & 0 deletions src/httpp/http/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

#include "httpp/http/Utils.hpp"

#ifdef WIN32
#define strncasecmp(x,y,z) _strnicmp(x,y,z)
#endif

namespace HTTPP
{
namespace HTTP
Expand Down
4 changes: 4 additions & 0 deletions src/httpp/http/helper/ReadWholeRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

#include "httpp/http/Connection.hpp"

#ifdef WIN32
#define strncasecmp(x,y,z) _strnicmp(x,y,z)
#endif

namespace HTTPP
{
namespace HTTP
Expand Down