sockpp: add version v0.8.3 and v1.0.0 (#3038)

* sockpp: add version v0.8.3 and v1.0.0

* sockpp: apply patch

* sockpp: update patch

* sockpp: update patch

* sockpp: update patch
pull/3043/head
Bai Miao 1 year ago committed by GitHub
parent ae45c38b42
commit 632c1f4bfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 56
      packages/s/sockpp/patches/0.8.1/strerror.patch
  2. 4
      packages/s/sockpp/xmake.lua

@ -1,53 +1,13 @@
diff --git a/src/exception.cpp b/src/exception.cpp
index 7cb010d..e9f1da1 100644
index 72aae7e..16d11ad 100644
--- a/src/exception.cpp
+++ b/src/exception.cpp
@@ -57,30 +57,30 @@ sys_error::sys_error(int err) : runtime_error(error_str(err)), errno_(err)
std::string sys_error::error_str(int err)
{
- char buf[1024];
- buf[0] = '\x0';
+ char buf[1024];
+ buf[0] = '\x0';
- #if defined(_WIN32)
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- buf, sizeof(buf), NULL);
+ #if defined(_WIN32)
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ buf, sizeof(buf), NULL);
@@ -66,7 +66,7 @@ string sys_error::error_str(int err)
buf, sizeof(buf), NULL);
#else
- #ifdef _GNU_SOURCE
#ifdef _GNU_SOURCE
- #if !defined(__GLIBC__)
- // use the XSI standard behavior.
- int e = strerror_r(err, buf, sizeof(buf));
- auto s = strerror(e);
- return s ? std::string(s) : std::string();
- #else
- // assume GNU exception
- auto s = strerror_r(err, buf, sizeof(buf));
- return s ? std::string(s) : std::string();
- #endif
+ #ifdef _GNU_SOURCE
+ #if defined(__GLIBC__) || (defined(__ANDROID_API__) && __ANDROID_API__ >= 23)
+ // assume GNU exception
+ auto s = strerror_r(err, buf, sizeof(buf));
+ return s ? std::string(s) : std::string();
+ #else
+ // use the XSI standard behavior.
+ int e = strerror_r(err, buf, sizeof(buf));
+ auto s = strerror(e);
+ return s ? std::string(s) : std::string();
+ #endif
#else
ignore_result(strerror_r(err, buf, sizeof(buf)));
#endif
#endif
- return std::string(buf);
+ return std::string(buf);
}
/////////////////////////////////////////////////////////////////////////////
+ #if (!defined(__GLIBC__) && !defined(__ANDROID_API__)) || (defined(__ANDROID_API__) && __ANDROID_API__ < 23)
// use the XSI standard behavior.
int e = strerror_r(err, buf, sizeof(buf));
auto s = strerror(e);

@ -7,8 +7,10 @@ package("sockpp")
"https://github.com/fpagliughi/sockpp.git")
add_versions("v0.8.1", "a8aedff8bd8c1da530b91be650352008fddabc9f1df0d19701d76cbc359c8651")
add_versions("v0.8.3", "dcacfae173ae4a1e535078d3023d338c3eb170193fe1b82bc04138e9c02470ef")
add_versions("v1.0.0", "818477fae6eb29b9daacef71a3d0c494de9e48f6fd267a7fc5a4c332db211bc5")
add_patches("0.8.1", path.join(os.scriptdir(), "patches", "0.8.1", "strerror.patch"), "8de819ba185c644254633d1de609e2c571c6c6f1aa7d2ac4329676ecf96fa556")
add_patches(">=0.8.1", path.join(os.scriptdir(), "patches", "0.8.1", "strerror.patch"), "161796afa58b838a504cbee14f3db8b1bba451b54acb3165503966cad527cafe")
if is_plat("windows", "mingw") then
add_syslinks("ws2_32")

Loading…
Cancel
Save