mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-26 14:41:25 +00:00
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@gmail.com> Acked-by: Frediano Ziglio <freddy77@gmail.com>
This commit is contained in:
parent
9fb945c31b
commit
aefcd7d1c4
@ -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)
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user