[Spice-commits] server/glz-encoder.c server/red-parse-qxl.cpp server/red-qxl.cpp server/red-stream-device.cpp server/tests
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun May 9 06:00:52 UTC 2021
server/glz-encoder.c | 2 +-
server/red-parse-qxl.cpp | 10 +++++-----
server/red-qxl.cpp | 4 ++--
server/red-stream-device.cpp | 2 +-
server/tests/test-qxl-parsing.c | 2 +-
5 files changed, 10 insertions(+), 10 deletions(-)
New commits:
commit aefcd7d1c46eed7ab8be65c58d2fd5a3d929a41c
Author: Rosen Penev <rosenp at gmail.com>
Date: Mon Oct 5 03:17:18 2020 -0700
clang-tidy: use uppercase numeric literals
Found with readability-uppercase-literal-suffix
Avoids readability problems between lower case l and uppercase I.
Signed-off-by: Rosen Penev <rosenp at gmail.com>
Acked-by: Frediano Ziglio <freddy77 at gmail.com>
diff --git a/server/glz-encoder.c b/server/glz-encoder.c
index ee9d95ae..4309daea 100644
--- a/server/glz-encoder.c
+++ b/server/glz-encoder.c
@@ -82,7 +82,7 @@ static inline void encode_32(Encoder *encoder, unsigned int word)
static inline void encode_64(Encoder *encoder, uint64_t word)
{
encode_32(encoder, (uint32_t)(word >> 32));
- encode_32(encoder, (uint32_t)(word & 0xffffffffu));
+ encode_32(encoder, (uint32_t)(word & 0xffffffffU));
}
static inline void encode_copy_count(Encoder *encoder, uint8_t copy_count)
diff --git a/server/red-parse-qxl.cpp b/server/red-parse-qxl.cpp
index 979d1b8f..ec4b17e6 100644
--- a/server/red-parse-qxl.cpp
+++ b/server/red-parse-qxl.cpp
@@ -34,7 +34,7 @@
* This value should be big enough for all requests but limited
* to 32 bits. Even better if it fits on 31 bits to detect integer overflows.
*/
-#define MAX_DATA_CHUNK 0x7ffffffflu
+#define MAX_DATA_CHUNK 0x7fffffffLU
verify(MAX_DATA_CHUNK <= G_MAXINT32);
@@ -435,7 +435,7 @@ static bool bitmap_consistent(SpiceBitmap *bitmap)
bpp = MAP_BITMAP_FMT_TO_BITS_PER_PIXEL[bitmap->format];
- if (bitmap->stride < (((uint64_t) bitmap->x * bpp + 7u) / 8u)) {
+ if (bitmap->stride < (((uint64_t) bitmap->x * bpp + 7U) / 8U)) {
spice_warning("image stride too small for width: %d < ((%d * %d + 7) / 8) (%s=%d)",
bitmap->stride, bitmap->x, bpp,
bitmap_format_to_string(bitmap->format),
@@ -920,7 +920,7 @@ static SpiceString *red_get_string(RedMemSlotInfo *slots, int group_id,
while (start < end) {
spice_assert((QXLRasterGlyph*)(&start->data[0]) <= end);
glyphs++;
- glyph_size = start->height * ((start->width * bpp + 7u) / 8u);
+ glyph_size = start->height * ((start->width * bpp + 7U) / 8U);
red_size += sizeof(SpiceRasterGlyph *) + SPICE_ALIGN(sizeof(SpiceRasterGlyph) + glyph_size, 4);
/* do the test correctly, we know end - start->data[0] cannot
* overflow, don't use start->data[glyph_size] to test for
@@ -946,7 +946,7 @@ static SpiceString *red_get_string(RedMemSlotInfo *slots, int group_id,
glyph->height = start->height;
red_get_point_ptr(&glyph->render_pos, &start->render_pos);
red_get_point_ptr(&glyph->glyph_origin, &start->glyph_origin);
- glyph_size = glyph->height * ((glyph->width * bpp + 7u) / 8u);
+ glyph_size = glyph->height * ((glyph->width * bpp + 7U) / 8U);
/* see above for similar test */
spice_assert(glyph_size <= (char*) end - (char*) &start->data[0]);
memcpy(glyph->data, start->data, glyph_size);
@@ -1437,7 +1437,7 @@ bool red_validate_surface(uint32_t width, uint32_t height,
}
/* check stride is larger than required bytes */
- size = ((uint64_t) width * bpp + 7u) / 8u;
+ size = ((uint64_t) width * bpp + 7U) / 8U;
/* the uint32_t conversion is here to avoid problems with -2^31 value */
if (stride == G_MININT32 || size > (uint32_t) abs(stride)) {
return false;
diff --git a/server/red-qxl.cpp b/server/red-qxl.cpp
index fa09f31b..91948ee5 100644
--- a/server/red-qxl.cpp
+++ b/server/red-qxl.cpp
@@ -400,7 +400,7 @@ void spice_qxl_stop(QXLInstance *instance)
SPICE_GNUC_VISIBLE
void spice_qxl_set_max_monitors(QXLInstance *instance, unsigned int max_monitors)
{
- instance->st->max_monitors = MAX(1u, max_monitors);
+ instance->st->max_monitors = MAX(1U, max_monitors);
}
SpiceMsgDisplayGlScanoutUnix *red_qxl_get_gl_scanout(QXLInstance *qxl)
@@ -530,7 +530,7 @@ void spice_qxl_set_device_info(QXLInstance *instance,
}
instance->st->monitors_count = device_display_id_count;
- instance->st->max_monitors = MAX(1u, device_display_id_count);
+ instance->st->max_monitors = MAX(1U, device_display_id_count);
reds_send_device_display_info(red_qxl_get_server(instance->st));
}
diff --git a/server/red-stream-device.cpp b/server/red-stream-device.cpp
index fe53a3c8..65eb0d61 100644
--- a/server/red-stream-device.cpp
+++ b/server/red-stream-device.cpp
@@ -411,7 +411,7 @@ stream_msg_cursor_set_to_cursor_cmd(const StreamMsgCursorSet *msg, size_t msg_si
* Note that these computations can't overflow due to sizes checks
* above. */
size_t size_required = cursor->header.width * cursor->header.height;
- size_required = SPICE_ALIGN(size_required * cursor_bits, 8) / 8u;
+ size_required = SPICE_ALIGN(size_required * cursor_bits, 8) / 8U;
if (msg_size < sizeof(StreamMsgCursorSet) + size_required) {
g_free(cmd);
return nullptr;
diff --git a/server/tests/test-qxl-parsing.c b/server/tests/test-qxl-parsing.c
index 5b5806ec..ee234b61 100644
--- a/server/tests/test-qxl-parsing.c
+++ b/server/tests/test-qxl-parsing.c
@@ -59,7 +59,7 @@ create_chunk(size_t prefix, uint32_t size, QXLDataChunk* prev, int fill)
static void init_meminfo(RedMemSlotInfo *mem_info)
{
memslot_info_init(mem_info, 1 /* groups */, 1 /* slots */, 1, 1, 0);
- memslot_info_add_slot(mem_info, 0, 0, 0 /* delta */, 0 /* start */, ~0ul /* end */, 0 /* generation */);
+ memslot_info_add_slot(mem_info, 0, 0, 0 /* delta */, 0 /* start */, UINTPTR_MAX /* end */, 0 /* generation */);
}
static void init_qxl_surface(QXLSurfaceCmd *qxl)
More information about the Spice-commits
mailing list