Re: [PATCH 03/22] Reformat 'if' statments according to style guide

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> From: Christophe de Dinechin <dinechin@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>

Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx>

Frediano

> ---
>  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) {
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]