Optimized some code for display/vmware_vga
v2 cover Optimized some code for display/vmware_vga
Optimized some code for vmware_vga:
patch1 fixes a bad printf format specifier and patch2 replaces fprintf(stderr, "*\n") with error_report()
Alex Chen (2):
display/vmware_vga: Fix bad printf format specifiers display/vmware_vga: Replace fprintf(stderr, "*\n") with error_report()
hw/display/vmware_vga.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
Signature · 1 line
2.19.1
PATCH v2 1/2 display/vmware_vga: Fix bad printf format specifiers
We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int".
Reported-by Euler Robot <[email protected]>
Signed-off-by Alex Chen <[email protected]>
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
--- hw/display/vmware_vga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/display/vmware_vga.c +1 -1
@@ -534,7 +534,7 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s,#endif break ;default : -fprintf (stderr,"%s: unhandled bpp %d, using fallback cursor\n" , +fprintf (stderr,"%s: unhandled bpp %u, using fallback cursor\n" , __func__, c->bpp);cursor_put (qc); qc =cursor_builtin_left_ptr ();
Signature · 1 line
2.19.1
PATCH v2 2/2 display/vmware_vga: Replace fprintf(stderr, "*\n") with error_report()
In reply to Alex ChenReplace all fprintf(stderr...) calls in hw/display/vmware_vga.c witherror_report(). Remove the "\n" from strings passed to all modified calls, since error_report() appends one.
Signed-off-by Alex Chen <[email protected]>
--- hw/display/vmware_vga.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
hw/display/vmware_vga.c +12 -11
@@ -34,6 +34,7 @@#include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "qom/object.h" +#include "qemu/error-report.h" #undef VERBOSE#define HW_RECT_ACCEL
@@ -298,45 +299,45 @@ static inline bool vmsvga_verify_rect(DisplaySurface *surface, int x, int y, int w, int h) { if (x < 0) { - fprintf(stderr, "%s: x was < 0 (%d)\n", name, x); + error_report("%s: x was < 0 (%d)", name, x);return false; }if (x >SVGA_MAX_WIDTH ) { -fprintf (stderr,"%s: x was > %d (%d)\n" , name,SVGA_MAX_WIDTH , x); +error_report ("%s: x was > %d (%d)" , name,SVGA_MAX_WIDTH , x);return false; }if (w <0 ) { -fprintf (stderr,"%s: w was < 0 (%d)\n" , name, w); +error_report ("%s: w was < 0 (%d)" , name, w);return false; }if (w >SVGA_MAX_WIDTH ) { -fprintf (stderr,"%s: w was > %d (%d)\n" , name,SVGA_MAX_WIDTH , w); +error_report ("%s: w was > %d (%d)" , name,SVGA_MAX_WIDTH , w);return false; }if (x + w >surface_width (surface)) { -fprintf (stderr,"%s: width was > %d (x: %d, w: %d)\n" , +error_report ("%s: width was > %d (x: %d, w: %d)" , name,surface_width (surface), x, w);return false; }if (y <0 ) { -fprintf (stderr,"%s: y was < 0 (%d)\n" , name, y); +error_report ("%s: y was < 0 (%d)" , name, y);return false; }if (y >SVGA_MAX_HEIGHT ) { -fprintf (stderr,"%s: y was > %d (%d)\n" , name,SVGA_MAX_HEIGHT , y); +error_report ("%s: y was > %d (%d)" , name,SVGA_MAX_HEIGHT , y);return false; }if (h <0 ) { -fprintf (stderr,"%s: h was < 0 (%d)\n" , name, h); +error_report ("%s: h was < 0 (%d)" , name, h);return false; }if (h >SVGA_MAX_HEIGHT ) { -fprintf (stderr,"%s: h was > %d (%d)\n" , name,SVGA_MAX_HEIGHT , h); +error_report ("%s: h was > %d (%d)" , name,SVGA_MAX_HEIGHT , h);return false; }if (y + h >surface_height (surface)) { -fprintf (stderr,"%s: update height > %d (y: %d, h: %d)\n" , +error_report ("%s: update height > %d (y: %d, h: %d)" , name,surface_height (surface), y, h);return false; }
@@ -534,7 +535,7 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s,#endif break ;default : -fprintf (stderr,"%s: unhandled bpp %u, using fallback cursor\n" , +error_report ("%s: unhandled bpp %u, using fallback cursor" , __func__, c->bpp);cursor_put (qc); qc =cursor_builtin_left_ptr ();
Signature · 1 line
2.19.1