Re: [Spice-devel] [PATCH spice-streaming-agent] Remove usage of ERROR macro

2018-02-20 Thread Frediano Ziglio
> 
> > On 20 Feb 2018, at 13:13, Frediano Ziglio  wrote:
> > 
> > Use more simple syntax for throwing errors.
> > 
> > Signed-off-by: Frediano Ziglio 
> > ---
> > src/mjpeg-fallback.cpp | 8 +---
> > 1 file changed, 1 insertion(+), 7 deletions(-)
> > 
> > diff --git a/src/mjpeg-fallback.cpp b/src/mjpeg-fallback.cpp
> > index cf704c6..fd37167 100644
> > --- a/src/mjpeg-fallback.cpp
> > +++ b/src/mjpeg-fallback.cpp
> > @@ -19,12 +19,6 @@
> > 
> > using namespace spice::streaming_agent;
> > 
> > -#define ERROR(args) do { \
> > -std::ostringstream _s; \
> > -_s << args; \
> > -throw std::runtime_error(_s.str()); \
> > -} while(0)
> > -
> > static inline uint64_t get_time()
> > {
> > timespec now;
> > @@ -65,7 +59,7 @@ MjpegFrameCapture::MjpegFrameCapture(const MjpegSettings&
> > settings):
> > {
> > dpy = XOpenDisplay(NULL);
> > if (!dpy)
> > -ERROR("Unable to initialize X11");
> > +throw std::runtime_error("Unable to initialize X11”);
> 
> That reminds me of a question I had at some point… Do we need to address
> localization?
> 

We never speaks about so even if the answer is yes the priority
is for next century (very low).

> > }
> > 
> > MjpegFrameCapture::~MjpegFrameCapture()

Frediano
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-streaming-agent] Remove usage of ERROR macro

2018-02-20 Thread Christophe de Dinechin


> On 20 Feb 2018, at 13:13, Frediano Ziglio  wrote:
> 
> Use more simple syntax for throwing errors.
> 
> Signed-off-by: Frediano Ziglio 
> ---
> src/mjpeg-fallback.cpp | 8 +---
> 1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/src/mjpeg-fallback.cpp b/src/mjpeg-fallback.cpp
> index cf704c6..fd37167 100644
> --- a/src/mjpeg-fallback.cpp
> +++ b/src/mjpeg-fallback.cpp
> @@ -19,12 +19,6 @@
> 
> using namespace spice::streaming_agent;
> 
> -#define ERROR(args) do { \
> -std::ostringstream _s; \
> -_s << args; \
> -throw std::runtime_error(_s.str()); \
> -} while(0)
> -
> static inline uint64_t get_time()
> {
> timespec now;
> @@ -65,7 +59,7 @@ MjpegFrameCapture::MjpegFrameCapture(const MjpegSettings& 
> settings):
> {
> dpy = XOpenDisplay(NULL);
> if (!dpy)
> -ERROR("Unable to initialize X11");
> +throw std::runtime_error("Unable to initialize X11”);

That reminds me of a question I had at some point… Do we need to address 
localization?

> }
> 
> MjpegFrameCapture::~MjpegFrameCapture()
> -- 
> 2.14.3
> 
> ___
> 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 spice-streaming-agent] Remove usage of ERROR macro

2018-02-20 Thread Lukáš Hrázký
On Tue, 2018-02-20 at 12:13 +, Frediano Ziglio wrote:
> Use more simple syntax for throwing errors.
> 
> Signed-off-by: Frediano Ziglio 
> ---
>  src/mjpeg-fallback.cpp | 8 +---
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/src/mjpeg-fallback.cpp b/src/mjpeg-fallback.cpp
> index cf704c6..fd37167 100644
> --- a/src/mjpeg-fallback.cpp
> +++ b/src/mjpeg-fallback.cpp
> @@ -19,12 +19,6 @@
>  
>  using namespace spice::streaming_agent;
>  
> -#define ERROR(args) do { \
> -std::ostringstream _s; \
> -_s << args; \
> -throw std::runtime_error(_s.str()); \
> -} while(0)
> -
>  static inline uint64_t get_time()
>  {
>  timespec now;
> @@ -65,7 +59,7 @@ MjpegFrameCapture::MjpegFrameCapture(const MjpegSettings& 
> settings):
>  {
>  dpy = XOpenDisplay(NULL);
>  if (!dpy)
> -ERROR("Unable to initialize X11");
> +throw std::runtime_error("Unable to initialize X11");
>  }
>  
>  MjpegFrameCapture::~MjpegFrameCapture()

Acked-by: Lukáš Hrázký 
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-streaming-agent] Remove usage of ERROR macro

2018-02-20 Thread Frediano Ziglio
Use more simple syntax for throwing errors.

Signed-off-by: Frediano Ziglio 
---
 src/mjpeg-fallback.cpp | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/mjpeg-fallback.cpp b/src/mjpeg-fallback.cpp
index cf704c6..fd37167 100644
--- a/src/mjpeg-fallback.cpp
+++ b/src/mjpeg-fallback.cpp
@@ -19,12 +19,6 @@
 
 using namespace spice::streaming_agent;
 
-#define ERROR(args) do { \
-std::ostringstream _s; \
-_s << args; \
-throw std::runtime_error(_s.str()); \
-} while(0)
-
 static inline uint64_t get_time()
 {
 timespec now;
@@ -65,7 +59,7 @@ MjpegFrameCapture::MjpegFrameCapture(const MjpegSettings& 
settings):
 {
 dpy = XOpenDisplay(NULL);
 if (!dpy)
-ERROR("Unable to initialize X11");
+throw std::runtime_error("Unable to initialize X11");
 }
 
 MjpegFrameCapture::~MjpegFrameCapture()
-- 
2.14.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel