[Spice-commits] 6 commits - common/canvas_utils.c common/lines.c common/log.c common/marshaller.c common/pixman_utils.c common/quic.c common/quic_rgb_tmpl.c common/quic_tmpl.c common/rop3.c python_modules/demarshal.py python_modules/marshal.py
Christophe Fergau
teuf at kemper.freedesktop.org
Thu Sep 18 04:15:59 PDT 2014
common/canvas_utils.c | 3 ++-
common/lines.c | 30 +++++++++++++++---------------
common/log.c | 4 ++--
common/marshaller.c | 2 +-
common/pixman_utils.c | 12 +++++++++++-
common/quic.c | 2 +-
common/quic_rgb_tmpl.c | 8 ++++----
common/quic_tmpl.c | 8 ++++----
common/rop3.c | 14 +++++++++-----
python_modules/demarshal.py | 12 ++++++------
python_modules/marshal.py | 8 ++++----
11 files changed, 59 insertions(+), 44 deletions(-)
New commits:
commit fbdd4e41c00e8f5a2d7397d69f4d4fac53d311c8
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date: Mon Sep 1 15:45:23 2014 +0200
common: Fix -Wmissing-field-initializers
diff --git a/common/lines.c b/common/lines.c
index 726a350..36b40a7 100644
--- a/common/lines.c
+++ b/common/lines.c
@@ -2978,7 +2978,7 @@ miWideDashSegment (GCPtr pGC,
double L, l;
double k;
PolyVertexRec vertices[4];
- PolyVertexRec saveRight = { 0 }, saveBottom;
+ PolyVertexRec saveRight = { 0, 0 }, saveBottom;
PolySlopeRec slopes[4];
PolyEdgeRec left[4], right[4];
LineFaceRec lcapFace, rcapFace;
commit 6f3918ce7c8aad3c3c7be117db730dcb3eafecda
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date: Mon Sep 1 15:45:22 2014 +0200
common: Fix -Wsign-compare
diff --git a/common/log.c b/common/log.c
index 5e2db4c..fc5c129 100644
--- a/common/log.c
+++ b/common/log.c
@@ -84,7 +84,7 @@ void spice_logv(const char *log_domain,
abort_level = getenv("SPICE_ABORT_LEVEL") ? atoi(getenv("SPICE_ABORT_LEVEL")) : SPICE_ABORT_LEVEL_DEFAULT;
}
- if (debug_level < log_level)
+ if (debug_level < (int) log_level)
return;
fprintf(stderr, "(%s:%d): ", getenv("_"), getpid());
@@ -104,7 +104,7 @@ void spice_logv(const char *log_domain,
fprintf(stderr, "\n");
- if (abort_level != -1 && abort_level >= log_level) {
+ if (abort_level != -1 && abort_level >= (int) log_level) {
spice_backtrace();
abort();
}
commit c8b4c5ec49f4dbf497d9ff92211cfeb9fbd2c4fb
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date: Tue Sep 2 14:12:30 2014 +0200
common: Fix -Wunused-parameter
diff --git a/common/canvas_utils.c b/common/canvas_utils.c
index 297b8ce..d52292b 100644
--- a/common/canvas_utils.c
+++ b/common/canvas_utils.c
@@ -32,7 +32,8 @@
static int gdi_handlers = 0;
#endif
-static void release_data(pixman_image_t *image, void *release_data)
+static void release_data(SPICE_GNUC_UNUSED pixman_image_t *image,
+ void *release_data)
{
PixmanData *data = (PixmanData *)release_data;
diff --git a/common/lines.c b/common/lines.c
index e345b95..726a350 100644
--- a/common/lines.c
+++ b/common/lines.c
@@ -1824,7 +1824,7 @@ miFillRectPolyHelper (GCPtr pGC, Boolean foreground, SpanDataPtr spanData, int x
}
static int
-miPolyBuildEdge (double x0, double y0, double k, /* x0 * dy - y0 * dx */
+miPolyBuildEdge (SPICE_GNUC_UNUSED double x0, double y0, double k, /* x0 * dy - y0 * dx */
int dx, int dy, int xi, int yi, int left, PolyEdgePtr edge)
{
int x, y, e;
@@ -1959,7 +1959,11 @@ miPolyBuildPoly (PolyVertexPtr vertices,
}
static void
-miLineOnePoint (GCPtr pGC, Boolean foreground, SpanDataPtr spanData, int x, int y)
+miLineOnePoint (GCPtr pGC,
+ Boolean foreground,
+ SPICE_GNUC_UNUSED SpanDataPtr spanData,
+ int x,
+ int y)
{
DDXPointRec pt;
int wid;
@@ -2490,9 +2494,14 @@ miLineArc (GCPtr pGC,
}
static void
-miLineProjectingCap (GCPtr pGC, Boolean foreground,
- SpanDataPtr spanData, LineFacePtr face, Boolean isLeft,
- double xorg, double yorg, Boolean isInt)
+miLineProjectingCap (GCPtr pGC,
+ Boolean foreground,
+ SpanDataPtr spanData,
+ LineFacePtr face,
+ Boolean isLeft,
+ SPICE_GNUC_UNUSED double xorg,
+ SPICE_GNUC_UNUSED double yorg,
+ Boolean isInt)
{
int xorgi = 0, yorgi = 0;
int lw;
diff --git a/common/marshaller.c b/common/marshaller.c
index 3d889a4..bd012d7 100644
--- a/common/marshaller.c
+++ b/common/marshaller.c
@@ -564,7 +564,7 @@ void *spice_marshaller_add_uint32(SpiceMarshaller *m, uint32_t v)
return (void *)ptr;
}
-void spice_marshaller_set_uint32(SpiceMarshaller *m, void *ref, uint32_t v)
+void spice_marshaller_set_uint32(SPICE_GNUC_UNUSED SpiceMarshaller *m, void *ref, uint32_t v)
{
write_uint32((uint8_t *)ref, v);
}
diff --git a/common/pixman_utils.c b/common/pixman_utils.c
index db7a67f..27ab155 100644
--- a/common/pixman_utils.c
+++ b/common/pixman_utils.c
@@ -28,9 +28,19 @@
#include <stdio.h>
#include "mem.h"
+/*
+ * src is used for most OPs, hidden within _equation attribute. For some
+ * operations (such as "clear" and "noop") src is not used and then we have
+ * to add SPICE_GNUC_UNUSED, that's just a __attribute__((__unused__)), to
+ * make GCC happy.
+ * Also, according to GCC documentation [0], the unused attribute "(...) means
+ * that the variable is meant to be possibly unused. GCC does not produce a
+ * warning for this variable.". So, we are safe adding it, even if src is used
+ * for most OPs.
+ */
#define SOLID_RASTER_OP(_name, _size, _type, _equation) \
static void \
-solid_rop_ ## _name ## _ ## _size (_type *ptr, int len, _type src) \
+solid_rop_ ## _name ## _ ## _size (_type *ptr, int len, SPICE_GNUC_UNUSED _type src) \
{ \
while (len--) { \
_type dst = *ptr; \
diff --git a/common/quic.c b/common/quic.c
index 90ea47b..16290d4 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -840,7 +840,7 @@ typedef uint16_t rgb16_pixel_t;
#endif
-static void fill_model_structures(Encoder *encoder, FamilyStat *family_stat,
+static void fill_model_structures(SPICE_GNUC_UNUSED Encoder *encoder, FamilyStat *family_stat,
unsigned int rep_first, unsigned int first_size,
unsigned int rep_next, unsigned int mul_size,
unsigned int levels, unsigned int ncounters,
diff --git a/common/quic_rgb_tmpl.c b/common/quic_rgb_tmpl.c
index 19cc348..f807a0c 100644
--- a/common/quic_rgb_tmpl.c
+++ b/common/quic_rgb_tmpl.c
@@ -223,7 +223,7 @@ static void FNAME(compress_row0_seg)(Encoder *encoder, int i,
const PIXEL * const cur_row,
const int end,
const unsigned int waitmask,
- const unsigned int bpc,
+ SPICE_GNUC_UNUSED const unsigned int bpc,
const unsigned int bpc_mask)
{
Channel * const channel_r = encoder->channels;
@@ -331,7 +331,7 @@ static void FNAME(compress_row_seg)(Encoder *encoder, int i,
const PIXEL * const cur_row,
const int end,
const unsigned int waitmask,
- const unsigned int bpc,
+ SPICE_GNUC_UNUSED const unsigned int bpc,
const unsigned int bpc_mask)
{
Channel * const channel_r = encoder->channels;
@@ -478,7 +478,7 @@ static void FNAME(uncompress_row0_seg)(Encoder *encoder, int i,
PIXEL * const cur_row,
const int end,
const unsigned int waitmask,
- const unsigned int bpc,
+ SPICE_GNUC_UNUSED const unsigned int bpc,
const unsigned int bpc_mask)
{
Channel * const channel_r = encoder->channels;
@@ -594,7 +594,7 @@ static void FNAME(uncompress_row_seg)(Encoder *encoder,
PIXEL * const cur_row,
int i,
const int end,
- const unsigned int bpc,
+ SPICE_GNUC_UNUSED const unsigned int bpc,
const unsigned int bpc_mask)
{
Channel * const channel_r = encoder->channels;
diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c
index b1ddbc4..e839346 100644
--- a/common/quic_tmpl.c
+++ b/common/quic_tmpl.c
@@ -152,7 +152,7 @@ static void FNAME(compress_row0_seg)(Encoder *encoder, Channel *channel, int i,
const PIXEL * const cur_row,
const int end,
const unsigned int waitmask,
- const unsigned int bpc,
+ SPICE_GNUC_UNUSED const unsigned int bpc,
const unsigned int bpc_mask)
{
BYTE * const decorelate_drow = channel->correlate_row;
@@ -243,7 +243,7 @@ static void FNAME(compress_row_seg)(Encoder *encoder, Channel *channel, int i,
const PIXEL * const cur_row,
const int end,
const unsigned int waitmask,
- const unsigned int bpc,
+ SPICE_GNUC_UNUSED const unsigned int bpc,
const unsigned int bpc_mask)
{
BYTE * const decorelate_drow = channel->correlate_row;
@@ -385,7 +385,7 @@ static void FNAME(uncompress_row0_seg)(Encoder *encoder, Channel *channel, int i
PIXEL * const cur_row,
const int end,
const unsigned int waitmask,
- const unsigned int bpc,
+ SPICE_GNUC_UNUSED const unsigned int bpc,
const unsigned int bpc_mask)
{
int stopidx;
@@ -486,7 +486,7 @@ static void FNAME(uncompress_row_seg)(Encoder *encoder, Channel *channel,
PIXEL * const cur_row,
int i,
const int end,
- const unsigned int bpc,
+ SPICE_GNUC_UNUSED const unsigned int bpc,
const unsigned int bpc_mask)
{
const unsigned int waitmask = bppmask[channel->state.wmidx];
diff --git a/common/rop3.c b/common/rop3.c
index d5b46db..97bfe0c 100644
--- a/common/rop3.c
+++ b/common/rop3.c
@@ -43,15 +43,19 @@ static rop3_test_handler_t rop3_test_handlers_32[ROP3_NUM_OPS];
static rop3_test_handler_t rop3_test_handlers_16[ROP3_NUM_OPS];
-static void default_rop3_with_pattern_handler(pixman_image_t *d, pixman_image_t *s,
- SpicePoint *src_pos, pixman_image_t *p,
- SpicePoint *pat_pos)
+static void default_rop3_with_pattern_handler(SPICE_GNUC_UNUSED pixman_image_t *d,
+ SPICE_GNUC_UNUSED pixman_image_t *s,
+ SPICE_GNUC_UNUSED SpicePoint *src_pos,
+ SPICE_GNUC_UNUSED pixman_image_t *p,
+ SPICE_GNUC_UNUSED SpicePoint *pat_pos)
{
spice_critical("not implemented");
}
-static void default_rop3_withe_color_handler(pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos,
- uint32_t rgb)
+static void default_rop3_withe_color_handler(SPICE_GNUC_UNUSED pixman_image_t *d,
+ SPICE_GNUC_UNUSED pixman_image_t *s,
+ SPICE_GNUC_UNUSED SpicePoint *src_pos,
+ SPICE_GNUC_UNUSED uint32_t rgb)
{
spice_critical("not implemented");
}
commit dde1c62a9166f337722785b7b4f38c8b2dbbd495
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date: Mon Sep 1 15:45:20 2014 +0200
common: Remove dead code
diff --git a/common/lines.c b/common/lines.c
index 4f404f1..e345b95 100644
--- a/common/lines.c
+++ b/common/lines.c
@@ -1835,15 +1835,6 @@ miPolyBuildEdge (double x0, double y0, double k, /* x0 * dy - y0 * dx */
dx = -dx;
k = -k;
}
-#ifdef NOTDEF
- {
- double realk, kerror;
- realk = x0 * dy - y0 * dx;
- kerror = Fabs (realk - k);
- if (kerror > .1)
- printf ("realk: %g k: %g\n", realk, k);
- }
-#endif
y = ICEIL (y0);
xady = ICEIL (k) + y * dx;
commit 840bcfe7a266604604a2b4a34ad68acba85ed0a7
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date: Wed Sep 3 15:14:54 2014 +0200
python: Fix -Wsign-compare
The return of the get_array_size() is used as a limit in a loop,
being compared with an unsigned index (indexes are always unsigned).
To avoid the -Wsign-compare warning, let's cast the return of the
get_array_size() to unsigned and make GCC happier.
diff --git a/python_modules/marshal.py b/python_modules/marshal.py
index 97d02e9..1eda1ba 100644
--- a/python_modules/marshal.py
+++ b/python_modules/marshal.py
@@ -162,11 +162,11 @@ def get_array_size(array, container_src):
rows_v = container_src.get_ref(rows)
# TODO: Handle multiplication overflow
if bpp == 8:
- return "(%s * %s)" % (width_v, rows_v)
+ return "(unsigned) (%s * %s)" % (width_v, rows_v)
elif bpp == 1:
- return "(((%s + 7) / 8 ) * %s)" % (width_v, rows_v)
+ return "(unsigned) (((%s + 7) / 8 ) * %s)" % (width_v, rows_v)
else:
- return "(((%s * %s + 7) / 8 ) * %s)" % (bpp, width_v, rows_v)
+ return "(unsigned) (((%s * %s + 7) / 8 ) * %s)" % (bpp, width_v, rows_v)
elif array.is_bytes_length():
return container_src.get_ref(array.size[2])
else:
commit 9385db68756f6b798e6342993d3acaf3304b363c
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date: Wed Sep 3 11:51:45 2014 +0200
python: Fix -Wunused-parameter
Although the most part of the parameters marked as unused are actually
being used for a few functions, a bunch of warnings can be seen when
the code is compiled with "-Wall -Wextra". As adding the unused attribute
means that the variable/parameter is meant to be *possibly* unused, we're
safe adding it in the generated code, even for used variables/parameters.
diff --git a/python_modules/demarshal.py b/python_modules/demarshal.py
index ead776d..109f5e6 100644
--- a/python_modules/demarshal.py
+++ b/python_modules/demarshal.py
@@ -199,7 +199,7 @@ def write_validate_struct_function(writer, struct):
writer.set_is_generated("validator", validate_function)
writer = writer.function_helper()
- scope = writer.function(validate_function, "static intptr_t", "uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor")
+ scope = writer.function(validate_function, "static intptr_t", "uint8_t *message_start, uint8_t *message_end, uint64_t offset, SPICE_GNUC_UNUSED int minor")
scope.variable_def("uint8_t *", "start = message_start + offset")
scope.variable_def("SPICE_GNUC_UNUSED uint8_t *", "pos")
scope.variable_def("size_t", "mem_size", "nw_size")
@@ -773,7 +773,7 @@ def write_parse_ptr_function(writer, target_type):
writer.set_is_generated("parser", parse_function)
writer = writer.function_helper()
- scope = writer.function(parse_function, "static uint8_t *", "uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor")
+ scope = writer.function(parse_function, "static uint8_t *", "uint8_t *message_start, SPICE_GNUC_UNUSED uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, SPICE_GNUC_UNUSED int minor")
scope.variable_def("uint8_t *", "in = message_start + this_ptr_info->offset")
scope.variable_def("uint8_t *", "end")
@@ -1011,7 +1011,7 @@ def write_nofree(writer):
if writer.is_generated("helper", "nofree"):
return
writer = writer.function_helper()
- scope = writer.function("nofree", "static void", "uint8_t *data")
+ scope = writer.function("nofree", "static void", "SPICE_GNUC_UNUSED uint8_t *data")
writer.end_block()
def write_msg_parser(writer, message):
@@ -1032,7 +1032,7 @@ def write_msg_parser(writer, message):
writer.ifdef(message.attributes["ifdef"][0])
parent_scope = writer.function(function_name,
"uint8_t *",
- "uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message", True)
+ "uint8_t *message_start, uint8_t *message_end, SPICE_GNUC_UNUSED int minor, size_t *size, message_destructor_t *free_message", True)
parent_scope.variable_def("SPICE_GNUC_UNUSED uint8_t *", "pos")
parent_scope.variable_def("uint8_t *", "start = message_start")
parent_scope.variable_def("uint8_t *", "data = NULL")
@@ -1134,7 +1134,7 @@ def write_channel_parser(writer, channel, server):
writer.ifdef(channel.attributes["ifdef"][0])
scope = writer.function(function_name,
"static uint8_t *",
- "uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message")
+ "uint8_t *message_start, uint8_t *message_end, uint16_t message_type, SPICE_GNUC_UNUSED int minor, size_t *size_out, message_destructor_t *free_message")
helpers = writer.function_helper()
@@ -1230,7 +1230,7 @@ def write_full_protocol_parser(writer, is_server):
function_name = "spice_parse_reply"
scope = writer.function(function_name + writer.public_prefix,
"uint8_t *",
- "uint8_t *message_start, uint8_t *message_end, uint32_t channel, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message")
+ "uint8_t *message_start, uint8_t *message_end, uint32_t channel, uint16_t message_type, SPICE_GNUC_UNUSED int minor, size_t *size_out, message_destructor_t *free_message")
scope.variable_def("spice_parse_channel_func_t", "func" )
if is_server:
diff --git a/python_modules/marshal.py b/python_modules/marshal.py
index ae5fe31..97d02e9 100644
--- a/python_modules/marshal.py
+++ b/python_modules/marshal.py
@@ -353,7 +353,7 @@ def write_message_marshaller(writer, message, is_server, private):
scope = writer.function(function_name,
"static void" if private else "void",
- "SpiceMarshaller *m, %s *msg" % message.c_type() + names_args)
+ "SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED %s *msg" % message.c_type() + names_args)
scope.variable_def("SPICE_GNUC_UNUSED SpiceMarshaller *", "m2")
for n in names:
More information about the Spice-commits
mailing list