Remove overzealous checks (#37493)

This commit is contained in:
Yu Watanabe
2025-05-17 01:37:18 +09:00
committed by GitHub
3 changed files with 11 additions and 19 deletions
+9 -17
View File
@@ -1977,7 +1977,8 @@ static int scan_background_color_response(
size_t *ret_processed) {
assert(context);
assert(buf || size == 0);
assert(buf);
assert(ret_processed);
for (size_t i = 0; i < size; i++) {
char c = buf[i];
@@ -2051,9 +2052,7 @@ static int scan_background_color_response(
case BACKGROUND_BLUE:
if (c == '\x07') {
if (context->blue_bits > 0) {
if (ret_processed)
*ret_processed = i + 1;
*ret_processed = i + 1;
return 1; /* success! */
}
@@ -2073,9 +2072,7 @@ static int scan_background_color_response(
case BACKGROUND_STRING_TERMINATOR:
if (c == '\\') {
if (ret_processed)
*ret_processed = i + 1;
*ret_processed = i + 1;
return 1; /* success! */
}
@@ -2092,9 +2089,7 @@ static int scan_background_color_response(
}
}
if (ret_processed)
*ret_processed = size;
*ret_processed = size;
return 0; /* all good, but not enough data yet */
}
@@ -2221,7 +2216,8 @@ static int scan_cursor_position_response(
size_t *ret_processed) {
assert(context);
assert(buf || size == 0);
assert(buf);
assert(ret_processed);
for (size_t i = 0; i < size; i++) {
char c = buf[i];
@@ -2254,9 +2250,7 @@ static int scan_cursor_position_response(
case CURSOR_COLUMN:
if (c == 'R') {
if (context->column > 0) {
if (ret_processed)
*ret_processed = i + 1;
*ret_processed = i + 1;
return 1; /* success! */
}
@@ -2279,9 +2273,7 @@ static int scan_cursor_position_response(
context->row = context->column = 0;
}
if (ret_processed)
*ret_processed = size;
*ret_processed = size;
return 0; /* all good, but not enough data yet */
}
+1 -1
View File
@@ -165,7 +165,7 @@ int pty_open_peer(int fd, int mode);
static inline bool osc_char_is_valid(char c) {
/* Checks whether the specified character is safe to be included inside an ANSI OSC sequence, as per
* ECMA-48 5th edition, section 8.3.89 */
return (unsigned char) c >= 32U && (unsigned char) c < 127;
return (unsigned char) c >= 32 && (unsigned char) c < 127;
}
static inline bool vtnr_is_valid(unsigned n) {
+1 -1
View File
@@ -755,7 +755,7 @@ static bool handle_format_specifier(FormatContext *ctx, SpecifierContext *sp) {
* otherwise warn about fetching smaller types. */
assert_cc(sizeof(int) == 4);
assert_cc(sizeof(wchar_t) <= sizeof(int));
assert_cc(sizeof(intmax_t) <= sizeof(long long));
assert_cc(sizeof(long long) == sizeof(intmax_t));
assert(ctx);
assert(sp);