Merge pull request #6045 from symless/v1.9-pvs-studio
PVS Studio related bugfixes for v1.9
This commit is contained in:
commit
0953ac069b
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
DataDownloader::DataDownloader(QObject* parent) :
|
DataDownloader::DataDownloader(QObject* parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
|
m_pReply(nullptr),
|
||||||
m_IsFinished(false)
|
m_IsFinished(false)
|
||||||
{
|
{
|
||||||
connect(&m_NetworkManager, SIGNAL(finished(QNetworkReply*)),
|
connect(&m_NetworkManager, SIGNAL(finished(QNetworkReply*)),
|
||||||
|
|
|
@ -38,7 +38,7 @@ ScreenSetupView::ScreenSetupView(QWidget* parent) :
|
||||||
verticalHeader()->hide();
|
verticalHeader()->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSetupView::setModel(ScreenSetupModel* model)
|
void ScreenSetupView::setModel(QAbstractItemModel* model)
|
||||||
{
|
{
|
||||||
QTableView::setModel(model);
|
QTableView::setModel(model);
|
||||||
setTableSize();
|
setTableSize();
|
||||||
|
|
|
@ -39,7 +39,7 @@ class ScreenSetupView : public QTableView
|
||||||
ScreenSetupView(QWidget* parent);
|
ScreenSetupView(QWidget* parent);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setModel(ScreenSetupModel* model);
|
void setModel(QAbstractItemModel* model) override;
|
||||||
ScreenSetupModel* model() const;
|
ScreenSetupModel* model() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -25,7 +25,7 @@ ZeroconfServer::ZeroconfServer(QObject* parent) :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeroconfServer::incomingConnection(int socketDescriptor)
|
void ZeroconfServer::incomingConnection(qintptr socketDescriptor)
|
||||||
{
|
{
|
||||||
ZeroconfThread* thread = new ZeroconfThread(socketDescriptor, this);
|
ZeroconfThread* thread = new ZeroconfThread(socketDescriptor, this);
|
||||||
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||||
|
|
|
@ -30,7 +30,7 @@ public:
|
||||||
ZeroconfServer(QObject* parent = 0);
|
ZeroconfServer(QObject* parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void incomingConnection(int socketDescriptor);
|
void incomingConnection(qintptr socketDescriptor) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList fortunes;
|
QStringList fortunes;
|
||||||
|
|
|
@ -42,7 +42,7 @@ int
|
||||||
IArchString::convStringWCToMB(char* dst,
|
IArchString::convStringWCToMB(char* dst,
|
||||||
const wchar_t* src, UInt32 n, bool* errors)
|
const wchar_t* src, UInt32 n, bool* errors)
|
||||||
{
|
{
|
||||||
int len = 0;
|
ptrdiff_t len = 0;
|
||||||
|
|
||||||
bool dummyErrors;
|
bool dummyErrors;
|
||||||
if (errors == NULL) {
|
if (errors == NULL) {
|
||||||
|
@ -58,14 +58,14 @@ IArchString::convStringWCToMB(char* dst,
|
||||||
if (dst == NULL) {
|
if (dst == NULL) {
|
||||||
char dummy[MB_LEN_MAX];
|
char dummy[MB_LEN_MAX];
|
||||||
for (const wchar_t* scan = src; n > 0; ++scan, --n) {
|
for (const wchar_t* scan = src; n > 0; ++scan, --n) {
|
||||||
int mblen = wctomb(dummy, *scan);
|
ptrdiff_t mblen = wctomb(dummy, *scan);
|
||||||
if (mblen == -1) {
|
if (mblen == -1) {
|
||||||
*errors = true;
|
*errors = true;
|
||||||
mblen = 1;
|
mblen = 1;
|
||||||
}
|
}
|
||||||
len += mblen;
|
len += mblen;
|
||||||
}
|
}
|
||||||
int mblen = wctomb(dummy, L'\0');
|
ptrdiff_t mblen = wctomb(dummy, L'\0');
|
||||||
if (mblen != -1) {
|
if (mblen != -1) {
|
||||||
len += mblen - 1;
|
len += mblen - 1;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ IArchString::convStringWCToMB(char* dst,
|
||||||
else {
|
else {
|
||||||
char* dst0 = dst;
|
char* dst0 = dst;
|
||||||
for (const wchar_t* scan = src; n > 0; ++scan, --n) {
|
for (const wchar_t* scan = src; n > 0; ++scan, --n) {
|
||||||
int mblen = wctomb(dst, *scan);
|
ptrdiff_t mblen = wctomb(dst, *scan);
|
||||||
if (mblen == -1) {
|
if (mblen == -1) {
|
||||||
*errors = true;
|
*errors = true;
|
||||||
*dst++ = '?';
|
*dst++ = '?';
|
||||||
|
@ -82,12 +82,12 @@ IArchString::convStringWCToMB(char* dst,
|
||||||
dst += mblen;
|
dst += mblen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int mblen = wctomb(dst, L'\0');
|
ptrdiff_t mblen = wctomb(dst, L'\0');
|
||||||
if (mblen != -1) {
|
if (mblen != -1) {
|
||||||
// don't include nul terminator
|
// don't include nul terminator
|
||||||
dst += mblen - 1;
|
dst += mblen - 1;
|
||||||
}
|
}
|
||||||
len = (int)(dst - dst0);
|
len = dst - dst0;
|
||||||
}
|
}
|
||||||
ARCH->unlockMutex(s_mutex);
|
ARCH->unlockMutex(s_mutex);
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ int
|
||||||
IArchString::convStringMBToWC(wchar_t* dst,
|
IArchString::convStringMBToWC(wchar_t* dst,
|
||||||
const char* src, UInt32 n, bool* errors)
|
const char* src, UInt32 n, bool* errors)
|
||||||
{
|
{
|
||||||
int len = 0;
|
ptrdiff_t len = 0;
|
||||||
wchar_t dummy;
|
wchar_t dummy;
|
||||||
|
|
||||||
bool dummyErrors;
|
bool dummyErrors;
|
||||||
|
@ -114,7 +114,7 @@ IArchString::convStringMBToWC(wchar_t* dst,
|
||||||
|
|
||||||
if (dst == NULL) {
|
if (dst == NULL) {
|
||||||
for (const char* scan = src; n > 0; ) {
|
for (const char* scan = src; n > 0; ) {
|
||||||
int mblen = mbtowc(&dummy, scan, n);
|
ptrdiff_t mblen = mbtowc(&dummy, scan, n);
|
||||||
switch (mblen) {
|
switch (mblen) {
|
||||||
case -2:
|
case -2:
|
||||||
// incomplete last character. convert to unknown character.
|
// incomplete last character. convert to unknown character.
|
||||||
|
@ -150,7 +150,7 @@ IArchString::convStringMBToWC(wchar_t* dst,
|
||||||
else {
|
else {
|
||||||
wchar_t* dst0 = dst;
|
wchar_t* dst0 = dst;
|
||||||
for (const char* scan = src; n > 0; ++dst) {
|
for (const char* scan = src; n > 0; ++dst) {
|
||||||
int mblen = mbtowc(dst, scan, n);
|
ptrdiff_t mblen = mbtowc(dst, scan, n);
|
||||||
switch (mblen) {
|
switch (mblen) {
|
||||||
case -2:
|
case -2:
|
||||||
// incomplete character. convert to unknown character.
|
// incomplete character. convert to unknown character.
|
||||||
|
@ -181,7 +181,7 @@ IArchString::convStringMBToWC(wchar_t* dst,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
len = (int)(dst - dst0);
|
len = dst - dst0;
|
||||||
}
|
}
|
||||||
ARCH->unlockMutex(s_mutex);
|
ARCH->unlockMutex(s_mutex);
|
||||||
|
|
||||||
|
|
|
@ -311,7 +311,7 @@ ArchNetworkWinsock::listenOnSocket(ArchSocket s)
|
||||||
}
|
}
|
||||||
|
|
||||||
ArchSocket
|
ArchSocket
|
||||||
ArchNetworkWinsock::acceptSocket(ArchSocket s, ArchNetAddress* addr)
|
ArchNetworkWinsock::acceptSocket(ArchSocket s, ArchNetAddress* const addr)
|
||||||
{
|
{
|
||||||
assert(s != NULL);
|
assert(s != NULL);
|
||||||
|
|
||||||
|
@ -325,7 +325,9 @@ ArchNetworkWinsock::acceptSocket(ArchSocket s, ArchNetAddress* addr)
|
||||||
int err = getsockerror_winsock();
|
int err = getsockerror_winsock();
|
||||||
delete socket;
|
delete socket;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
if (addr) {
|
||||||
*addr = NULL;
|
*addr = NULL;
|
||||||
|
}
|
||||||
if (err == WSAEWOULDBLOCK) {
|
if (err == WSAEWOULDBLOCK) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -339,7 +341,9 @@ ArchNetworkWinsock::acceptSocket(ArchSocket s, ArchNetAddress* addr)
|
||||||
close_winsock(fd);
|
close_winsock(fd);
|
||||||
delete socket;
|
delete socket;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
if (addr) {
|
||||||
*addr = NULL;
|
*addr = NULL;
|
||||||
|
}
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,10 +39,14 @@ static const UINT kFirstReceiverID = WM_USER + 14;
|
||||||
ArchTaskBarWindows* ArchTaskBarWindows::s_instance = NULL;
|
ArchTaskBarWindows* ArchTaskBarWindows::s_instance = NULL;
|
||||||
|
|
||||||
ArchTaskBarWindows::ArchTaskBarWindows() :
|
ArchTaskBarWindows::ArchTaskBarWindows() :
|
||||||
m_nextID(kFirstReceiverID),
|
m_mutex(NULL),
|
||||||
m_thread(NULL),
|
|
||||||
m_condVar(NULL),
|
m_condVar(NULL),
|
||||||
m_mutex(NULL)
|
m_ready(false),
|
||||||
|
m_result(0),
|
||||||
|
m_thread(NULL),
|
||||||
|
m_hwnd(NULL),
|
||||||
|
m_taskBarRestart(0),
|
||||||
|
m_nextID(kFirstReceiverID)
|
||||||
{
|
{
|
||||||
// save the singleton instance
|
// save the singleton instance
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cerrno>
|
||||||
|
|
||||||
namespace synergy {
|
namespace synergy {
|
||||||
namespace string {
|
namespace string {
|
||||||
|
@ -50,8 +51,8 @@ vformat(const char* fmt, va_list args)
|
||||||
// find highest indexed substitution and the locations of substitutions
|
// find highest indexed substitution and the locations of substitutions
|
||||||
std::vector<size_t> pos;
|
std::vector<size_t> pos;
|
||||||
std::vector<size_t> width;
|
std::vector<size_t> width;
|
||||||
std::vector<int> index;
|
std::vector<size_t> index;
|
||||||
int maxIndex = 0;
|
size_t maxIndex = 0;
|
||||||
for (const char* scan = fmt; *scan != '\0'; ++scan) {
|
for (const char* scan = fmt; *scan != '\0'; ++scan) {
|
||||||
if (*scan == '%') {
|
if (*scan == '%') {
|
||||||
++scan;
|
++scan;
|
||||||
|
@ -61,21 +62,22 @@ vformat(const char* fmt, va_list args)
|
||||||
else if (*scan == '%') {
|
else if (*scan == '%') {
|
||||||
// literal
|
// literal
|
||||||
index.push_back(0);
|
index.push_back(0);
|
||||||
pos.push_back(static_cast<int>(scan - 1 - fmt));
|
pos.push_back(static_cast<size_t>((scan - 1) - fmt));
|
||||||
width.push_back(2);
|
width.push_back(2);
|
||||||
}
|
}
|
||||||
else if (*scan == '{') {
|
else if (*scan == '{') {
|
||||||
// get argument index
|
// get argument index
|
||||||
char* end;
|
char* end;
|
||||||
int i = static_cast<int>(strtol(scan + 1, &end, 10));
|
errno = 0;
|
||||||
if (*end != '}') {
|
long i = strtol(scan + 1, &end, 10);
|
||||||
|
if (errno || (i < 0) || (*end != '}')) {
|
||||||
// invalid index -- ignore
|
// invalid index -- ignore
|
||||||
scan = end - 1;
|
scan = end - 1; // BUG if there are digits?
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
index.push_back(i);
|
index.push_back(i);
|
||||||
pos.push_back(static_cast<int>(scan - 1 - fmt));
|
pos.push_back(static_cast<size_t>((scan - 1) - fmt));
|
||||||
width.push_back(static_cast<int>(end - scan + 2));
|
width.push_back(static_cast<size_t>((end - scan) + 2));
|
||||||
if (i > maxIndex) {
|
if (i > maxIndex) {
|
||||||
maxIndex = i;
|
maxIndex = i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ IpcLogOutputter::IpcLogOutputter(IpcServer& ipcServer, EIpcClientType clientType
|
||||||
m_running(false),
|
m_running(false),
|
||||||
m_notifyCond(ARCH->newCondVar()),
|
m_notifyCond(ARCH->newCondVar()),
|
||||||
m_notifyMutex(ARCH->newMutex()),
|
m_notifyMutex(ARCH->newMutex()),
|
||||||
|
m_bufferThreadId(0),
|
||||||
m_bufferWaiting(false),
|
m_bufferWaiting(false),
|
||||||
m_bufferMaxSize(kBufferMaxSize),
|
m_bufferMaxSize(kBufferMaxSize),
|
||||||
m_bufferRateWriteLimit(kBufferRateWriteLimit),
|
m_bufferRateWriteLimit(kBufferRateWriteLimit),
|
||||||
|
|
|
@ -114,7 +114,6 @@ private:
|
||||||
double m_bufferRateTimeLimit;
|
double m_bufferRateTimeLimit;
|
||||||
UInt16 m_bufferWriteCount;
|
UInt16 m_bufferWriteCount;
|
||||||
double m_bufferRateStart;
|
double m_bufferRateStart;
|
||||||
bool m_useThread;
|
|
||||||
EIpcClientType m_clientType;
|
EIpcClientType m_clientType;
|
||||||
ArchMutex m_runningMutex;
|
ArchMutex m_runningMutex;
|
||||||
};
|
};
|
||||||
|
|
|
@ -80,7 +80,7 @@ IpcServer::~IpcServer()
|
||||||
for (it = m_clients.begin(); it != m_clients.end(); it++) {
|
for (it = m_clients.begin(); it != m_clients.end(); it++) {
|
||||||
deleteClient(*it);
|
deleteClient(*it);
|
||||||
}
|
}
|
||||||
m_clients.empty();
|
m_clients.clear();
|
||||||
ARCH->unlockMutex(m_clientsMutex);
|
ARCH->unlockMutex(m_clientsMutex);
|
||||||
ARCH->closeMutex(m_clientsMutex);
|
ARCH->closeMutex(m_clientsMutex);
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ SecureSocket::SecureSocket(
|
||||||
IEventQueue* events,
|
IEventQueue* events,
|
||||||
SocketMultiplexer* socketMultiplexer) :
|
SocketMultiplexer* socketMultiplexer) :
|
||||||
TCPSocket(events, socketMultiplexer),
|
TCPSocket(events, socketMultiplexer),
|
||||||
|
m_ssl(nullptr),
|
||||||
m_secureReady(false),
|
m_secureReady(false),
|
||||||
m_fatal(false)
|
m_fatal(false)
|
||||||
{
|
{
|
||||||
|
@ -67,6 +68,7 @@ SecureSocket::SecureSocket(
|
||||||
SocketMultiplexer* socketMultiplexer,
|
SocketMultiplexer* socketMultiplexer,
|
||||||
ArchSocket socket) :
|
ArchSocket socket) :
|
||||||
TCPSocket(events, socketMultiplexer, socket),
|
TCPSocket(events, socketMultiplexer, socket),
|
||||||
|
m_ssl(nullptr),
|
||||||
m_secureReady(false),
|
m_secureReady(false),
|
||||||
m_fatal(false)
|
m_fatal(false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -330,7 +330,7 @@ TCPSocket::doRead()
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
size_t bytesRead = 0;
|
size_t bytesRead = 0;
|
||||||
|
|
||||||
bytesRead = (int) ARCH->readSocket(m_socket, buffer, sizeof(buffer));
|
bytesRead = ARCH->readSocket(m_socket, buffer, sizeof(buffer));
|
||||||
|
|
||||||
if (bytesRead > 0) {
|
if (bytesRead > 0) {
|
||||||
bool wasEmpty = (m_inputBuffer.getSize() == 0);
|
bool wasEmpty = (m_inputBuffer.getSize() == 0);
|
||||||
|
|
|
@ -88,7 +88,11 @@ MSWindowsClipboard::empty()
|
||||||
|
|
||||||
// mark clipboard as being owned by synergy
|
// mark clipboard as being owned by synergy
|
||||||
HGLOBAL data = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, 1);
|
HGLOBAL data = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, 1);
|
||||||
SetClipboardData(getOwnershipFormat(), data);
|
if (NULL == SetClipboardData(getOwnershipFormat(), data)) {
|
||||||
|
LOG((CLOG_DEBUG "failed to set clipboard data"));
|
||||||
|
GlobalFree(data);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -427,7 +427,7 @@ void
|
||||||
MSWindowsDesks::destroyClass(ATOM windowClass) const
|
MSWindowsDesks::destroyClass(ATOM windowClass) const
|
||||||
{
|
{
|
||||||
if (windowClass != 0) {
|
if (windowClass != 0) {
|
||||||
UnregisterClass(reinterpret_cast<LPCTSTR>(windowClass),
|
UnregisterClass(MAKEINTATOM(windowClass),
|
||||||
MSWindowsScreen::getWindowInstance());
|
MSWindowsScreen::getWindowInstance());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -437,7 +437,7 @@ MSWindowsDesks::createWindow(ATOM windowClass, const char* name) const
|
||||||
{
|
{
|
||||||
HWND window = CreateWindowEx(WS_EX_TRANSPARENT |
|
HWND window = CreateWindowEx(WS_EX_TRANSPARENT |
|
||||||
WS_EX_TOOLWINDOW,
|
WS_EX_TOOLWINDOW,
|
||||||
reinterpret_cast<LPCTSTR>(windowClass),
|
MAKEINTATOM(windowClass),
|
||||||
name,
|
name,
|
||||||
WS_POPUP,
|
WS_POPUP,
|
||||||
0, 0, 1, 1,
|
0, 0, 1, 1,
|
||||||
|
|
|
@ -858,7 +858,7 @@ void
|
||||||
MSWindowsScreen::destroyClass(ATOM windowClass) const
|
MSWindowsScreen::destroyClass(ATOM windowClass) const
|
||||||
{
|
{
|
||||||
if (windowClass != 0) {
|
if (windowClass != 0) {
|
||||||
UnregisterClass(reinterpret_cast<LPCTSTR>(windowClass), s_windowInstance);
|
UnregisterClass(MAKEINTATOM(windowClass), s_windowInstance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -868,7 +868,7 @@ MSWindowsScreen::createWindow(ATOM windowClass, const char* name) const
|
||||||
HWND window = CreateWindowEx(WS_EX_TOPMOST |
|
HWND window = CreateWindowEx(WS_EX_TOPMOST |
|
||||||
WS_EX_TRANSPARENT |
|
WS_EX_TRANSPARENT |
|
||||||
WS_EX_TOOLWINDOW,
|
WS_EX_TOOLWINDOW,
|
||||||
reinterpret_cast<LPCTSTR>(windowClass),
|
MAKEINTATOM(windowClass),
|
||||||
name,
|
name,
|
||||||
WS_POPUP,
|
WS_POPUP,
|
||||||
0, 0, 1, 1,
|
0, 0, 1, 1,
|
||||||
|
@ -889,7 +889,7 @@ MSWindowsScreen::createDropWindow(ATOM windowClass, const char* name) const
|
||||||
WS_EX_TOPMOST |
|
WS_EX_TOPMOST |
|
||||||
WS_EX_TRANSPARENT |
|
WS_EX_TRANSPARENT |
|
||||||
WS_EX_ACCEPTFILES,
|
WS_EX_ACCEPTFILES,
|
||||||
reinterpret_cast<LPCTSTR>(m_class),
|
MAKEINTATOM(m_class),
|
||||||
name,
|
name,
|
||||||
WS_POPUP,
|
WS_POPUP,
|
||||||
0, 0, m_dropWindowSize, m_dropWindowSize,
|
0, 0, m_dropWindowSize, m_dropWindowSize,
|
||||||
|
@ -1129,7 +1129,7 @@ MSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam)
|
||||||
KeyModifierMask oldState = pollActiveModifiers();
|
KeyModifierMask oldState = pollActiveModifiers();
|
||||||
|
|
||||||
// check for autorepeat
|
// check for autorepeat
|
||||||
if (m_keyState->testAutoRepeat(down, (lParam & 0x40000000u) == 1, button)) {
|
if (m_keyState->testAutoRepeat(down, (lParam & 0x40000000u), button)) {
|
||||||
lParam |= 0x40000000u;
|
lParam |= 0x40000000u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,9 @@ MSWindowsScreenSaver::MSWindowsScreenSaver() :
|
||||||
m_process(NULL),
|
m_process(NULL),
|
||||||
m_watch(NULL),
|
m_watch(NULL),
|
||||||
m_threadID(0),
|
m_threadID(0),
|
||||||
|
m_msg(0),
|
||||||
|
m_wParam(0),
|
||||||
|
m_lParam(0),
|
||||||
m_active(false)
|
m_active(false)
|
||||||
{
|
{
|
||||||
// check if screen saver is enabled
|
// check if screen saver is enabled
|
||||||
|
|
|
@ -187,7 +187,7 @@ MSWindowsSession::getActiveDesktopName()
|
||||||
CloseDesktop(hd);
|
CloseDesktop(hd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception error) {
|
catch (std::exception& error) {
|
||||||
LOG((CLOG_ERR "failed to get active desktop name: %s", error.what()));
|
LOG((CLOG_ERR "failed to get active desktop name: %s", error.what()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,31 +29,14 @@
|
||||||
String
|
String
|
||||||
MSWindowsUtil::getString(HINSTANCE instance, DWORD id)
|
MSWindowsUtil::getString(HINSTANCE instance, DWORD id)
|
||||||
{
|
{
|
||||||
char buffer[1024];
|
char* msg = NULL;
|
||||||
int size = static_cast<int>(sizeof(buffer) / sizeof(buffer[0]));
|
int n = LoadString(instance, id, reinterpret_cast<LPSTR>(&msg), 0);
|
||||||
char* msg = buffer;
|
|
||||||
|
|
||||||
// load string
|
if (n <= 0) {
|
||||||
int n = LoadString(instance, id, msg, size);
|
return String();
|
||||||
msg[n] = '\0';
|
|
||||||
if (n < size) {
|
|
||||||
return msg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// not enough buffer space. keep trying larger buffers until
|
return String (msg, n);
|
||||||
// we get the whole string.
|
|
||||||
msg = NULL;
|
|
||||||
do {
|
|
||||||
size <<= 1;
|
|
||||||
delete[] msg;
|
|
||||||
char* msg = new char[size];
|
|
||||||
n = LoadString(instance, id, msg, size);
|
|
||||||
} while (n == size);
|
|
||||||
msg[n] = '\0';
|
|
||||||
|
|
||||||
String result(msg);
|
|
||||||
delete[] msg;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String
|
String
|
||||||
|
|
|
@ -62,9 +62,11 @@ App::App(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver, A
|
||||||
m_suspended(false),
|
m_suspended(false),
|
||||||
m_events(events),
|
m_events(events),
|
||||||
m_args(args),
|
m_args(args),
|
||||||
|
m_fileLog(nullptr),
|
||||||
m_createTaskBarReceiver(createTaskBarReceiver),
|
m_createTaskBarReceiver(createTaskBarReceiver),
|
||||||
m_appUtil(events),
|
m_appUtil(events),
|
||||||
m_ipcClient(nullptr)
|
m_ipcClient(nullptr),
|
||||||
|
m_socketMultiplexer(nullptr)
|
||||||
{
|
{
|
||||||
assert(s_instance == nullptr);
|
assert(s_instance == nullptr);
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "synergy/Chunk.h"
|
#include "synergy/Chunk.h"
|
||||||
#include "base/String.h"
|
#include "base/String.h"
|
||||||
|
|
||||||
Chunk::Chunk(size_t size)
|
Chunk::Chunk(size_t size): m_dataSize(0)
|
||||||
{
|
{
|
||||||
m_chunk = new char[size];
|
m_chunk = new char[size];
|
||||||
memset(m_chunk, 0, size);
|
memset(m_chunk, 0, size);
|
||||||
|
|
Loading…
Reference in New Issue