mirror of
https://github.com/tmux/tmux.git
synced 2026-04-16 03:56:28 +00:00
Merge branch 'obsd-master'
This commit is contained in:
16
format.c
16
format.c
@@ -4207,6 +4207,8 @@ format_build_modifiers(struct format_expand_state *es, const char **s,
|
||||
/* Skip any separator character. */
|
||||
if (*cp == ';')
|
||||
cp++;
|
||||
if (*cp == '\0')
|
||||
break;
|
||||
|
||||
/* Check single character modifiers with no arguments. */
|
||||
if (strchr("labcdnwETSWPL!<>", cp[0]) != NULL &&
|
||||
@@ -4767,7 +4769,7 @@ format_replace_expression(struct format_modifier *mexp,
|
||||
|
||||
/* The third argument may be precision. */
|
||||
if (argc >= 3) {
|
||||
prec = strtonum(mexp->argv[2], INT_MIN, INT_MAX, &errstr);
|
||||
prec = strtonum(mexp->argv[2], INT_MIN + 1, INT_MAX, &errstr);
|
||||
if (errstr != NULL) {
|
||||
format_log(es, "expression precision %s: %s", errstr,
|
||||
mexp->argv[2]);
|
||||
@@ -4912,8 +4914,8 @@ format_replace(struct format_expand_state *es, const char *key, size_t keylen,
|
||||
case '=':
|
||||
if (fm->argc < 1)
|
||||
break;
|
||||
limit = strtonum(fm->argv[0], INT_MIN, INT_MAX,
|
||||
&errstr);
|
||||
limit = strtonum(fm->argv[0], INT_MIN + 1,
|
||||
INT_MAX, &errstr);
|
||||
if (errstr != NULL)
|
||||
limit = 0;
|
||||
if (fm->argc >= 2 && fm->argv[1] != NULL)
|
||||
@@ -4922,8 +4924,8 @@ format_replace(struct format_expand_state *es, const char *key, size_t keylen,
|
||||
case 'p':
|
||||
if (fm->argc < 1)
|
||||
break;
|
||||
width = strtonum(fm->argv[0], INT_MIN, INT_MAX,
|
||||
&errstr);
|
||||
width = strtonum(fm->argv[0], INT_MIN + 1,
|
||||
INT_MAX, &errstr);
|
||||
if (errstr != NULL)
|
||||
width = 0;
|
||||
break;
|
||||
@@ -5341,6 +5343,7 @@ done:
|
||||
if (marker != NULL && strcmp(new, value) != 0) {
|
||||
free(value);
|
||||
xasprintf(&value, "%s%s", new, marker);
|
||||
free(new);
|
||||
} else {
|
||||
free(value);
|
||||
value = new;
|
||||
@@ -5351,6 +5354,7 @@ done:
|
||||
if (marker != NULL && strcmp(new, value) != 0) {
|
||||
free(value);
|
||||
xasprintf(&value, "%s%s", marker, new);
|
||||
free(new);
|
||||
} else {
|
||||
free(value);
|
||||
value = new;
|
||||
@@ -5463,7 +5467,7 @@ format_expand1(struct format_expand_state *es, const char *fmt)
|
||||
buf[off++] = *fmt++;
|
||||
continue;
|
||||
}
|
||||
if (*fmt++ == '\0')
|
||||
if (*++fmt == '\0')
|
||||
break;
|
||||
|
||||
ch = (u_char)*fmt++;
|
||||
|
||||
Reference in New Issue
Block a user