Re: [Spice-devel] [PATCH 03/22] Reformat 'if' statments according to style guide
> On 28 Feb 2018, at 17:35, Christophe Fergeauwrote: > > s/statments/statements in the short log. Fixed > > On Wed, Feb 28, 2018 at 04:43:06PM +0100, Christophe de Dinechin wrote: >> From: Christophe de Dinechin >> >> 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 >> --- >> 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 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, ); >> -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 >> 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@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/spice-devel > ___ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/spice-devel ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH 03/22] Reformat 'if' statments according to style guide
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> > 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 > --- > 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 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, ); > -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 > 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@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/spice-devel signature.asc Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH 03/22] Reformat 'if' statments according to style guide
> > From: Christophe de Dinechin> > 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 Acked-by: Frediano Ziglio 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 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, ); > -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 > 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@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel