list(APPEND common_srcs aix_errno.cc)
elseif(WIN32)
list(APPEND common_srcs win32/errno.cc)
+ list(APPEND common_srcs win32/wstring.cc)
endif()
if(WITH_EVENTTRACE)
--- /dev/null
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2022 Cloudbase Solutions
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+ */
+
+#include "wstring.h"
+
+#include <boost/locale/encoding_utf.hpp>
+
+using boost::locale::conv::utf_to_utf;
+
+std::wstring to_wstring(const std::string& str)
+{
+ return utf_to_utf<wchar_t>(str.c_str(), str.c_str() + str.size());
+}
+
+std::string to_string(const std::wstring& str)
+{
+ return utf_to_utf<char>(str.c_str(), str.c_str() + str.size());
+}
--- /dev/null
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2022 Cloudbase Solutions
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+ */
+
+#pragma once
+
+#include <string>
+
+std::wstring to_wstring(const std::string& str);
+std::string to_string(const std::wstring& wstr);
#include "common/dout.h"
#include "common/errno.h"
#include "common/version.h"
+#include "common/win32/wstring.h"
#include "global/global_init.h"
#include "common/ceph_argparse.h"
#include "common/config.h"
+#include "common/win32/wstring.h"
#include "global/global_init.h"
#include "utils.h"
-#include <boost/locale/encoding_utf.hpp>
-
-using boost::locale::conv::utf_to_utf;
-
-std::wstring to_wstring(const std::string& str)
-{
- return utf_to_utf<wchar_t>(str.c_str(), str.c_str() + str.size());
-}
-
-std::string to_string(const std::wstring& str)
-{
- return utf_to_utf<char>(str.c_str(), str.c_str() + str.size());
-}
-
void to_filetime(time_t t, LPFILETIME pft)
{
// Note that LONGLONG is a 64-bit value
#include "include/compat.h"
-std::wstring to_wstring(const std::string& str);
-std::string to_string(const std::wstring& str);
-
void to_filetime(time_t t, LPFILETIME pft);
void to_unix_time(FILETIME ft, time_t *t);
#include <sys/socket.h>
#include <unistd.h>
-#include <boost/locale/encoding_utf.hpp>
-
#include "wnbd_handler.h"
#include "rbd_wnbd.h"
#include "common/errno.h"
#include "common/version.h"
#include "common/win32/service.h"
+#include "common/win32/wstring.h"
#include "common/admin_socket_client.h"
#include "global/global_init.h"
#define dout_prefix *_dout << "rbd-wnbd: "
using namespace std;
-using boost::locale::conv::utf_to_utf;
-
-std::wstring to_wstring(const std::string& str)
-{
- return utf_to_utf<wchar_t>(str.c_str(), str.c_str() + str.size());
-}
-
-std::string to_string(const std::wstring& str)
-{
- return utf_to_utf<char>(str.c_str(), str.c_str() + str.size());
-}
bool is_process_running(DWORD pid)
{