XXX: the inline string_view constructors *should* be harmless on pre-C++17 platforms...

fix windows build
pull/323/head
Rick V 5 years ago
parent f941025d7c
commit 0f45e286ff
No known key found for this signature in database
GPG Key ID: C0EDC8723FDC3465

@ -97,14 +97,14 @@ namespace abyss
bool
ShouldProcessHeader(const llarp::string_view& name) const
{
return name == "content-length" || name == "content-type";
return name == llarp::string_view("content-length") || name == llarp::string_view("content-type");
}
/// return true if we get a 200 status code
bool
HandleStatusCode(string_view code) const
{
return code == "200";
return code == string_view("200");
}
bool

@ -103,7 +103,7 @@ namespace abyss
ShouldProcessHeader(const string_view& name) const
{
// TODO: header whitelist
return name == "content-type" || name == "content-length";
return name == string_view("content-type") || name == string_view("content-length");
}
bool
@ -143,7 +143,7 @@ namespace abyss
"text/plain",
"no content type provided");
}
else if(itr->second != "application/json")
else if(itr->second != string_view("application/json"))
{
return WriteResponseSimple(415, "Unsupported Media Type",
"text/plain",

@ -215,9 +215,17 @@ endif()
if(WITH_SHARED)
add_library(${SHARED_LIB} SHARED ${LIB_SRC})
if (WIN32)
target_link_libraries(${SHARED_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS} ${UTIL_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi Threads::Threads)
if(USE_LIBABYSS)
target_link_libraries(${SHARED_LIB} ${ABYSS_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS} ${UTIL_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi Threads::Threads)
else()
target_link_libraries(${SHARED_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS} ${UTIL_LIB} ${PLATFORM_LIB} ws2_32 iphlpapi Threads::Threads)
endif()
else()
target_link_libraries(${SHARED_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS} ${UTIL_LIB} libutp ${PLATFORM_LIB} Threads::Threads)
if(USE_LIBABYSS)
target_link_libraries(${SHARED_LIB} ${ABYSS_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS} ${UTIL_LIB} libutp ${PLATFORM_LIB} Threads::Threads)
else()
target_link_libraries(${SHARED_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS} ${UTIL_LIB} libutp ${PLATFORM_LIB} Threads::Threads)
endif()
install(TARGETS ${SHARED_LIB} LIBRARY DESTINATION lib)
endif()
add_log_tag(${SHARED_LIB})

@ -1,7 +1,5 @@
#include <util/bencode.h>
#include <util/logger.hpp>
#include <cstdlib>
bool
@ -75,7 +73,11 @@ bencode_write_bytestring(llarp_buffer_t* buff, const void* data, size_t sz)
bool
bencode_write_uint64(llarp_buffer_t* buff, uint64_t i)
{
if(!buff->writef("i%lu", i))
#ifndef __LP64__
if(!buff->writef("i%llu", i))
#else
if(!buff->write("i%lu", i))
#endif
{
return false;
}

@ -120,9 +120,14 @@ struct llarp_buffer_t
bool
write(InputIt begin, InputIt end);
#ifndef _WIN32
bool
writef(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
;
#else
bool writef(const char *fmt, ...) __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 2, 3)));
;
#endif
bool
put_uint16(uint16_t i);

Loading…
Cancel
Save