Fix C++/CLI.
GitOrigin-RevId: fd48669cdc54fafa3475dbd1aa6ab7cd49055a23
This commit is contained in:
parent
e3d0534318
commit
1dd2e28551
@ -269,7 +269,7 @@ Client::Client() : impl_(make_unique<Impl>()) {
|
||||
init_openssl_threads();
|
||||
}
|
||||
|
||||
void Client::send(Request request) {
|
||||
void Client::send(Request &&request) {
|
||||
impl_->send(std::move(request));
|
||||
}
|
||||
|
||||
@ -277,7 +277,7 @@ Client::Response Client::receive(double timeout) {
|
||||
return impl_->receive(timeout);
|
||||
}
|
||||
|
||||
Client::Response Client::execute(Request request) {
|
||||
Client::Response Client::execute(Request &&request) {
|
||||
Response response;
|
||||
response.id = request.id;
|
||||
response.object = Td::static_request(std::move(request.function));
|
||||
|
@ -77,7 +77,7 @@ class Client final {
|
||||
* Sends request to TDLib. May be called from any thread.
|
||||
* \param[in] request Request to TDLib.
|
||||
*/
|
||||
void send(Request request);
|
||||
void send(Request &&request);
|
||||
|
||||
/**
|
||||
* A response to a request, or an incoming update from TDLib.
|
||||
@ -109,7 +109,7 @@ class Client final {
|
||||
* \param[in] request Request to the TDLib.
|
||||
* \return The request response.
|
||||
*/
|
||||
static Response execute(Request request);
|
||||
static Response execute(Request &&request);
|
||||
|
||||
/**
|
||||
* Destroys the client and TDLib instance.
|
||||
|
@ -17,8 +17,8 @@ using namespace CxCli;
|
||||
|
||||
public ref class Log sealed {
|
||||
public:
|
||||
static void SetFilePath(String^ filePath) {
|
||||
::td::Log::set_file_path(string_to_unmanaged(filePath));
|
||||
static bool SetFilePath(String^ filePath) {
|
||||
return ::td::Log::set_file_path(string_to_unmanaged(filePath));
|
||||
}
|
||||
|
||||
static void SetMaxFileSize(std::int64_t maxFileSize) {
|
||||
|
@ -74,8 +74,11 @@ inline std::int64_t Increment(volatile std::int64_t &value) {
|
||||
return InterlockedIncrement64(&value);
|
||||
}
|
||||
|
||||
inline std::string string_to_unmanaged(String^ string) {
|
||||
return td::from_wstring(string->Data(), string->Length()).ok();
|
||||
inline std::string string_to_unmanaged(String^ str) {
|
||||
if (!str) {
|
||||
return std::string();
|
||||
}
|
||||
return td::from_wstring(str->Data(), str->Length()).ok();
|
||||
}
|
||||
|
||||
inline String^ string_from_unmanaged(const std::string &from) {
|
||||
@ -117,8 +120,11 @@ inline std::int64_t Increment(std::int64_t %value) {
|
||||
return System::Threading::Interlocked::Increment(value);
|
||||
}
|
||||
|
||||
inline std::string string_to_unmanaged(String^ string) {
|
||||
return msclr::interop::marshal_as<std::string>(string);
|
||||
inline std::string string_to_unmanaged(String^ str) {
|
||||
if (!str) {
|
||||
return std::string();
|
||||
}
|
||||
return msclr::interop::marshal_as<std::string>(str);
|
||||
}
|
||||
|
||||
inline String^ string_from_unmanaged(const std::string &from) {
|
||||
|
Reference in New Issue
Block a user