Remove the always true conditions

Unsigned integers are always greater than or equal to zero.
The else branch is always the opposite.
This commit is contained in:
pagedown
2022-01-01 21:27:01 +08:00
parent 59ea7485e4
commit 49fbeb9a56
3 changed files with 6 additions and 6 deletions

View File

@@ -92,7 +92,7 @@ get_load_flags(int hinting, int hintstyle, int base) {
int flags = base;
if (hinting) {
if (hintstyle >= 3) flags |= FT_LOAD_TARGET_NORMAL;
else if (0 < hintstyle && hintstyle < 3) flags |= FT_LOAD_TARGET_LIGHT;
else if (0 < hintstyle) flags |= FT_LOAD_TARGET_LIGHT;
} else flags |= FT_LOAD_NO_HINTING;
return flags;
}

View File

@@ -93,7 +93,7 @@ get_load_flags(int hinting, int hintstyle, int base) {
int flags = base;
if (hinting) {
if (hintstyle >= 3) flags |= FT_LOAD_TARGET_NORMAL;
else if (0 < hintstyle && hintstyle < 3) flags |= FT_LOAD_TARGET_LIGHT;
else if (0 < hintstyle) flags |= FT_LOAD_TARGET_LIGHT;
} else flags |= FT_LOAD_NO_HINTING;
return flags;
}

View File

@@ -1705,9 +1705,9 @@ screen_delete_lines(Screen *self, unsigned int count) {
void
screen_insert_characters(Screen *self, unsigned int count) {
const unsigned int top = 0, bottom = self->lines ? self->lines - 1 : 0;
const unsigned int bottom = self->lines ? self->lines - 1 : 0;
if (count == 0) count = 1;
if (top <= self->cursor->y && self->cursor->y <= bottom) {
if (self->cursor->y <= bottom) {
unsigned int x = self->cursor->x;
unsigned int num = MIN(self->columns - x, count);
linebuf_init_line(self->linebuf, self->cursor->y);
@@ -1732,9 +1732,9 @@ void
screen_delete_characters(Screen *self, unsigned int count) {
MOVE_OVERLAY_LINE_WITH_CURSOR;
// Delete characters, later characters are moved left
const unsigned int top = 0, bottom = self->lines ? self->lines - 1 : 0;
const unsigned int bottom = self->lines ? self->lines - 1 : 0;
if (count == 0) count = 1;
if (top <= self->cursor->y && self->cursor->y <= bottom) {
if (self->cursor->y <= bottom) {
unsigned int x = self->cursor->x;
unsigned int num = MIN(self->columns - x, count);
linebuf_init_line(self->linebuf, self->cursor->y);