mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-09 07:22:21 +08:00
Remove trailing whitespaces
Many tools strip trailing whitespaces by default, so after editing a file with
whitespace errors we end up with a bunch of unrelated hunks that need to be
reverted locally.
This could be fixed by configuring each tool to not do this (at least for the
barrier repo), or, simpler, we just sed the problem away and make barrier
whitespace-compliant.
sed commands run:
sed -i 's/[ \t]\+$//' **/*.(cpp|h) **/*CMakeLists.txt
Verified with git diff --ignore-space-change, this shows the empty diff.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* barrier -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015-2016 Symless Ltd.
|
||||
*
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file LICENSE that should have accompanied this file.
|
||||
*
|
||||
*
|
||||
* This package is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
@@ -133,7 +133,7 @@ std::unique_ptr<ISocketMultiplexerJob> SecureSocket::newJob()
|
||||
if (m_connected && !m_secureReady) {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
return TCPSocket::newJob();
|
||||
}
|
||||
|
||||
@@ -173,20 +173,20 @@ SecureSocket::doRead()
|
||||
else {
|
||||
return kRetry;
|
||||
}
|
||||
|
||||
|
||||
if (bytesRead > 0) {
|
||||
bool wasEmpty = (m_inputBuffer.getSize() == 0);
|
||||
|
||||
|
||||
// slurp up as much as possible
|
||||
do {
|
||||
m_inputBuffer.write(buffer, bytesRead);
|
||||
|
||||
|
||||
status = secureRead(buffer, sizeof(buffer), bytesRead);
|
||||
if (status < 0) {
|
||||
return kBreak;
|
||||
}
|
||||
} while (bytesRead > 0 || status > 0);
|
||||
|
||||
|
||||
// send input ready if input buffer was empty
|
||||
if (wasEmpty) {
|
||||
sendEvent(m_events->forIStream().inputReady());
|
||||
@@ -204,7 +204,7 @@ SecureSocket::doRead()
|
||||
m_readable = false;
|
||||
return kNew;
|
||||
}
|
||||
|
||||
|
||||
return kRetry;
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ SecureSocket::doWrite()
|
||||
memcpy(s_staticBuffer.get(), m_outputBuffer.peek(bufferSize), bufferSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (bufferSize == 0) {
|
||||
return kRetry;
|
||||
}
|
||||
@@ -251,7 +251,7 @@ SecureSocket::doWrite()
|
||||
s_retrySize = bufferSize;
|
||||
return kNew;
|
||||
}
|
||||
|
||||
|
||||
if (bytesWrote > 0) {
|
||||
discardWrittenData(bytesWrote);
|
||||
return kNew;
|
||||
@@ -266,12 +266,12 @@ SecureSocket::secureRead(void* buffer, int size, int& read)
|
||||
if (m_ssl->m_ssl != NULL) {
|
||||
LOG((CLOG_DEBUG2 "reading secure socket"));
|
||||
read = SSL_read(m_ssl->m_ssl, buffer, size);
|
||||
|
||||
|
||||
static int retry;
|
||||
|
||||
// Check result will cleanup the connection in the case of a fatal
|
||||
checkResult(read, retry);
|
||||
|
||||
|
||||
if (retry) {
|
||||
return 0;
|
||||
}
|
||||
@@ -293,7 +293,7 @@ SecureSocket::secureWrite(const void* buffer, int size, int& wrote)
|
||||
LOG((CLOG_DEBUG2 "writing secure socket:%p", this));
|
||||
|
||||
wrote = SSL_write(m_ssl->m_ssl, buffer, size);
|
||||
|
||||
|
||||
static int retry;
|
||||
|
||||
// Check result will cleanup the connection in the case of a fatal
|
||||
@@ -374,7 +374,7 @@ SecureSocket::initContext(bool server)
|
||||
SSL_library_init();
|
||||
|
||||
const SSL_METHOD* method;
|
||||
|
||||
|
||||
// load & register all cryptos, etc.
|
||||
OpenSSL_add_all_algorithms();
|
||||
|
||||
@@ -392,7 +392,7 @@ SecureSocket::initContext(bool server)
|
||||
else {
|
||||
method = SSLv23_client_method();
|
||||
}
|
||||
|
||||
|
||||
// create new context from method
|
||||
SSL_METHOD* m = const_cast<SSL_METHOD*>(method);
|
||||
m_ssl->m_context = SSL_CTX_new(m);
|
||||
@@ -423,10 +423,10 @@ SecureSocket::secureAccept(int socket)
|
||||
|
||||
// set connection socket to SSL state
|
||||
SSL_set_fd(m_ssl->m_ssl, socket);
|
||||
|
||||
|
||||
LOG((CLOG_DEBUG2 "accepting secure socket"));
|
||||
int r = SSL_accept(m_ssl->m_ssl);
|
||||
|
||||
|
||||
static int retry;
|
||||
|
||||
checkResult(r, retry);
|
||||
@@ -472,10 +472,10 @@ SecureSocket::secureConnect(int socket)
|
||||
|
||||
// attach the socket descriptor
|
||||
SSL_set_fd(m_ssl->m_ssl, socket);
|
||||
|
||||
|
||||
LOG((CLOG_DEBUG2 "connecting secure socket"));
|
||||
int r = SSL_connect(m_ssl->m_ssl);
|
||||
|
||||
|
||||
static int retry;
|
||||
|
||||
checkResult(r, retry);
|
||||
@@ -522,7 +522,7 @@ SecureSocket::showCertificate()
|
||||
{
|
||||
X509* cert;
|
||||
char* line;
|
||||
|
||||
|
||||
// get the server's certificate
|
||||
cert = SSL_get_peer_certificate(m_ssl->m_ssl);
|
||||
if (cert != NULL) {
|
||||
@@ -566,7 +566,7 @@ SecureSocket::checkResult(int status, int& retry)
|
||||
|
||||
case SSL_ERROR_WANT_WRITE:
|
||||
// Need to make sure the socket is known to be writable so the impending
|
||||
// select action actually triggers on a write. This isn't necessary for
|
||||
// select action actually triggers on a write. This isn't necessary for
|
||||
// m_readable because the socket logic is always readable
|
||||
m_writable = true;
|
||||
retry++;
|
||||
|
||||
Reference in New Issue
Block a user