[Spice-devel] [PATCH v2 21/24] Reformat 'if' statments according to style guide
Christophe de Dinechin
christophe at dinechin.org
Wed Feb 21 17:46:33 UTC 2018
From: Christophe de Dinechin <dinechin at redhat.com>
Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
---
src/spice-streaming-agent.cpp | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
index 61a73ce..4aae2cb 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -46,6 +46,8 @@ namespace spice
namespace streaming_agent
{
+static bool quit_requested = false;
+
/* returns current time in micro-seconds */
static uint64_t get_time(void)
{
@@ -73,8 +75,9 @@ public:
: codecs()
{
streamfd = open(name, O_RDWR);
- if (streamfd < 0)
+ if (streamfd < 0) {
throw std::runtime_error("failed to open streaming device");
+ }
}
~Stream()
{
@@ -250,8 +253,9 @@ FrameLog::FrameLog(const char *filename, bool binary)
FrameLog::~FrameLog()
{
- if (log)
+ if (log) {
fclose(log);
+ }
}
void FrameLog::dump(const void *buffer, size_t length)
@@ -308,30 +312,32 @@ void X11CursorThread::cursor_changes()
Window rootwindow = DefaultRootWindow(display);
XFixesSelectCursorInput(display, rootwindow, XFixesDisplayCursorNotifyMask);
- while (true) {
+ while (!quit_requested) {
XEvent event;
XNextEvent(display, &event);
- if (event.type != event_base + 1)
+ if (event.type != event_base + 1) {
continue;
+ }
XFixesCursorImage *cursor = XFixesGetCursorImage(display);
- if (!cursor)
+ if (!cursor) {
continue;
+ }
- if (cursor->cursor_serial == last_serial)
+ if (cursor->cursor_serial == last_serial) {
continue;
+ }
last_serial = cursor->cursor_serial;
- if (!stream.send<X11CursorMessage>(cursor))
+ if (!stream.send<X11CursorMessage>(cursor)) {
syslog(LOG_WARNING, "FAILED to send cursor\n");
+ }
}
}
}} // namespace spice::streaming_agent
-static bool quit_requested = false;
-
int Stream::have_something_to_read(int timeout)
{
struct pollfd pollfd = {streamfd, POLLIN, 0};
@@ -516,8 +522,9 @@ void ConcreteAgent::CaptureLoop(Stream &stream, FrameLog &frame_log)
uint64_t time_last = 0;
std::unique_ptr<FrameCapture> capture(GetBestFrameCapture(stream.client_codecs()));
- if (!capture)
+ if (!capture) {
throw std::runtime_error("cannot find a suitable capture system");
+ }
while (!quit_requested && stream.streaming_requested()) {
if (++frame_count % 100 == 0) {
--
2.13.5 (Apple Git-94)
More information about the Spice-devel
mailing list