Simplify code a bit
This commit is contained in:
parent
b81700144d
commit
ee47a10b37
3
glfw/xkb_glfw.c
vendored
3
glfw/xkb_glfw.c
vendored
@ -508,7 +508,8 @@ format_xkb_mods(_GLFWXKBData *xkb, const char* name, xkb_mod_mask_t mods) {
|
|||||||
char *p = buf, *s;
|
char *p = buf, *s;
|
||||||
#define pr(x) { \
|
#define pr(x) { \
|
||||||
int num_needed = -1; \
|
int num_needed = -1; \
|
||||||
if (sizeof(buf) > (unsigned long)((p - buf) + 1)) num_needed = snprintf(p, sizeof(buf) - (p - buf) - 1, "%s", x); \
|
ssize_t space_left = sizeof(buf) - (p - buf) - 1; \
|
||||||
|
if (space_left > 0) num_needed = snprintf(p, space_left, "%s", x); \
|
||||||
if (num_needed > 0) p += num_needed; \
|
if (num_needed > 0) p += num_needed; \
|
||||||
}
|
}
|
||||||
pr(name); pr(": ");
|
pr(name); pr(": ");
|
||||||
|
|||||||
@ -497,7 +497,7 @@ static inline bool
|
|||||||
render_color_bitmap(Face *self, int glyph_id, ProcessedBitmap *ans, unsigned int cell_width, unsigned int cell_height, unsigned int num_cells, unsigned int baseline) {
|
render_color_bitmap(Face *self, int glyph_id, ProcessedBitmap *ans, unsigned int cell_width, unsigned int cell_height, unsigned int num_cells, unsigned int baseline) {
|
||||||
(void)baseline;
|
(void)baseline;
|
||||||
unsigned short best = 0, diff = USHRT_MAX;
|
unsigned short best = 0, diff = USHRT_MAX;
|
||||||
for (short i = 0; i < (unsigned short)self->face->num_fixed_sizes; i++) {
|
for (short i = 0; i < (short)self->face->num_fixed_sizes; i++) {
|
||||||
unsigned short w = self->face->available_sizes[i].width;
|
unsigned short w = self->face->available_sizes[i].width;
|
||||||
unsigned short d = w > (unsigned short)cell_width ? w - (unsigned short)cell_width : (unsigned short)cell_width - w;
|
unsigned short d = w > (unsigned short)cell_width ? w - (unsigned short)cell_width : (unsigned short)cell_width - w;
|
||||||
if (d < diff) {
|
if (d < diff) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user