aboutsummaryrefslogtreecommitdiff
path: root/works/life/computer-network-experiment/Common.h
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-06-07 20:42:28 +0800
committercrupest <crupest@outlook.com>2021-06-07 20:42:28 +0800
commit42f7fc1876cbe68569771b97a8935fbca7fa3ee4 (patch)
tree1b59d74002c30f9aa14fac4d27e7d97b5d2ddcbe /works/life/computer-network-experiment/Common.h
parent2bc323cfa5d317188da591413bce7f1230e383b4 (diff)
downloadcrupest-42f7fc1876cbe68569771b97a8935fbca7fa3ee4.tar.gz
crupest-42f7fc1876cbe68569771b97a8935fbca7fa3ee4.tar.bz2
crupest-42f7fc1876cbe68569771b97a8935fbca7fa3ee4.zip
import(life): ...
Diffstat (limited to 'works/life/computer-network-experiment/Common.h')
-rw-r--r--works/life/computer-network-experiment/Common.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/works/life/computer-network-experiment/Common.h b/works/life/computer-network-experiment/Common.h
index c3b6094..6886e38 100644
--- a/works/life/computer-network-experiment/Common.h
+++ b/works/life/computer-network-experiment/Common.h
@@ -17,6 +17,10 @@ inline auto &error_stream = std::wcerr;
inline String ConvertCharString(std::string_view s) {
return cru::ToUtf16WString(s);
}
+
+inline std::string ConvertCharStringBack(StringView s) {
+ return cru::ToUtf8(s);
+}
#else
using Char = char;
using String = std::string;
@@ -27,6 +31,7 @@ inline auto &error_stream = std::cerr;
#define CRUT(string_literal) string_literal
inline String ConvertCharString(std::string_view s) { return String(s); }
+inline std::string ConvertCharStringBack(StringView s) { return {s}; }
#endif
int Main();
@@ -34,10 +39,6 @@ int Main();
[[noreturn]] void PrintErrorMessageAndExit(StringView message,
bool print_last_error = true);
-#ifdef WIN32
-void InitWSA();
-#endif
-
int CloseSocket(int socket);
void BeforeExit();
@@ -45,4 +46,4 @@ void BeforeExit();
String ReadInputLine();
void SafeSend(int socket, std::string_view buffer);
-std::string SafeReadUntil(int socket, char c, std::string& rest);
+std::string SafeReadUntil(int socket, char c, std::string &rest);