[Spice-devel] [PATCH 03/22] Reformat 'if' statments according to style guide
Christophe Fergeau
cfergeau at redhat.com
Wed Feb 28 16:35:29 UTC 2018
s/statments/statements in the short log.
On Wed, Feb 28, 2018 at 04:43:06PM +0100, Christophe de Dinechin wrote:
> From: Christophe de Dinechin <dinechin at redhat.com>
>
> This patch ensures that all 'if' statements have braces, according to
> style guide, so that when the follow-up patches introduce new 'if'
> statements, they don't make the code style locally inconsistent.
>
> Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
> ---
> src/spice-streaming-agent.cpp | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
> index aacfa68..18f2b1a 100644
> --- a/src/spice-streaming-agent.cpp
> +++ b/src/spice-streaming-agent.cpp
> @@ -297,9 +297,9 @@ static void
> send_cursor(unsigned width, unsigned height, int hotspot_x, int hotspot_y,
> std::function<void(uint32_t *)> fill_cursor)
> {
> - if (width >= STREAM_MSG_CURSOR_SET_MAX_WIDTH ||
> - height >= STREAM_MSG_CURSOR_SET_MAX_HEIGHT)
> + if (width >= STREAM_MSG_CURSOR_SET_MAX_WIDTH || height >= STREAM_MSG_CURSOR_SET_MAX_HEIGHT) {
> return;
> + }
>
> size_t cursor_size =
> sizeof(StreamDevHeader) + sizeof(StreamMsgCursorSet) +
> @@ -335,15 +335,18 @@ static void cursor_changes(Display *display, int event_base)
> while (1) {
> 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;
> auto fill_cursor = [cursor](uint32_t *pixels) {
> @@ -358,10 +361,11 @@ static void
> do_capture(const char *streamport, FILE *f_log)
> {
> streamfd = open(streamport, O_RDWR);
> - if (streamfd < 0)
> + if (streamfd < 0) {
> throw std::runtime_error("failed to open the streaming device (" +
> std::string(streamport) + "): "
> + strerror(errno));
> + }
>
> unsigned int frame_count = 0;
> while (!quit_requested) {
> @@ -380,8 +384,9 @@ do_capture(const char *streamport, FILE *f_log)
> uint64_t time_last = 0;
>
> std::unique_ptr<FrameCapture> capture(agent.GetBestFrameCapture(client_codecs));
> - if (!capture)
> + if (!capture) {
> throw std::runtime_error("cannot find a suitable capture system");
> + }
>
> while (!quit_requested && streaming_requested) {
> if (++frame_count % 100 == 0) {
> @@ -410,8 +415,9 @@ do_capture(const char *streamport, FILE *f_log)
>
> syslog(LOG_DEBUG, "wXh %uX%u codec=%u\n", width, height, codec);
>
> - if (spice_stream_send_format(width, height, codec) == EXIT_FAILURE)
> + if (spice_stream_send_format(width, height, codec) == EXIT_FAILURE) {
> throw std::runtime_error("FAILED to send format message");
> + }
> }
> if (f_log) {
> if (log_binary) {
> --
> 2.13.5 (Apple Git-94)
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180228/5fb0c516/attachment-0001.sig>
More information about the Spice-devel
mailing list