|
@@ -145,7 +145,7 @@ shared_ptr<Channel> getChannel(int id) {
|
|
|
|
|
|
template <typename F> int wrap(F func) {
|
|
|
try {
|
|
|
- return func();
|
|
|
+ return int(func());
|
|
|
|
|
|
} catch (const std::invalid_argument &e) {
|
|
|
PLOG_ERROR << e.what();
|
|
@@ -173,14 +173,15 @@ public:
|
|
|
|
|
|
void write(const plog::Record &record) override {
|
|
|
plog::Severity severity = record.getSeverity();
|
|
|
- std::string formatted = plog::FuncMessageFormatter::format(record);
|
|
|
+ auto formatted = plog::FuncMessageFormatter::format(record);
|
|
|
+ std::string str(formatted.begin(), formatted.end());
|
|
|
formatted.pop_back(); // remove newline
|
|
|
|
|
|
std::lock_guard lock(mutex);
|
|
|
if (callback)
|
|
|
- callback(static_cast<rtcLogLevel>(record.getSeverity()), formatted.c_str());
|
|
|
+ callback(static_cast<rtcLogLevel>(record.getSeverity()), str.c_str());
|
|
|
else
|
|
|
- std::cout << plog::severityToString(severity) << " " << formatted << std::endl;
|
|
|
+ std::cout << plog::severityToString(severity) << " " << str << std::endl;
|
|
|
}
|
|
|
|
|
|
private:
|
|
@@ -376,7 +377,7 @@ int rtcGetLocalAddress(int pc, char *buffer, int size) {
|
|
|
size = std::min(size_t(size - 1), addr->size());
|
|
|
std::copy(data, data + size, buffer);
|
|
|
buffer[size] = '\0';
|
|
|
- return size + 1;
|
|
|
+ return int(size + 1);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -396,7 +397,7 @@ int rtcGetRemoteAddress(int pc, char *buffer, int size) {
|
|
|
size = std::min(size_t(size - 1), addr->size());
|
|
|
std::copy(data, data + size, buffer);
|
|
|
buffer[size] = '\0';
|
|
|
- return size + 1;
|
|
|
+ return int(size + 1);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -416,7 +417,7 @@ int rtcGetDataChannelLabel(int dc, char *buffer, int size) {
|
|
|
size = std::min(size_t(size - 1), label.size());
|
|
|
std::copy(data, data + size, buffer);
|
|
|
buffer[size] = '\0';
|
|
|
- return size + 1;
|
|
|
+ return int(size + 1);
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -457,7 +458,7 @@ int rtcSetMessageCallback(int id, rtcMessageCallbackFunc cb) {
|
|
|
if (cb)
|
|
|
channel->onMessage(
|
|
|
[id, cb](const binary &b) {
|
|
|
- cb(reinterpret_cast<const char *>(b.data()), b.size(), getUserPointer(id));
|
|
|
+ cb(reinterpret_cast<const char *>(b.data()), int(b.size()), getUserPointer(id));
|
|
|
},
|
|
|
[id, cb](const string &s) { cb(s.c_str(), -1, getUserPointer(id)); });
|
|
|
else
|
|
@@ -478,7 +479,7 @@ int rtcSendMessage(int id, const char *data, int size) {
|
|
|
return size;
|
|
|
} else {
|
|
|
string str(data);
|
|
|
- int len = str.size();
|
|
|
+ int len = int(str.size());
|
|
|
channel->send(std::move(str));
|
|
|
return len;
|
|
|
}
|