mirror of
https://github.com/tmux/tmux.git
synced 2025-01-05 23:38:48 +00:00
Make some data types consistent.
This commit is contained in:
parent
4589297e43
commit
bbfb44e9b2
35
format.c
35
format.c
@ -761,22 +761,46 @@ format_cb_history_bytes(struct format_tree *ft, struct format_entry *fe)
|
||||
struct window_pane *wp = ft->wp;
|
||||
struct grid *gd;
|
||||
struct grid_line *gl;
|
||||
unsigned long long size;
|
||||
size_t size = 0;
|
||||
u_int i;
|
||||
|
||||
if (wp == NULL)
|
||||
return;
|
||||
gd = wp->base.grid;
|
||||
|
||||
size = 0;
|
||||
for (i = 0; i < gd->hsize; i++) {
|
||||
for (i = 0; i < gd->hsize + gd->sy; i++) {
|
||||
gl = grid_get_line(gd, i);
|
||||
size += gl->cellsize * sizeof *gl->celldata;
|
||||
size += gl->extdsize * sizeof *gl->extddata;
|
||||
}
|
||||
size += gd->hsize * sizeof *gl;
|
||||
size += (gd->hsize + gd->sy) * sizeof *gl;
|
||||
|
||||
xasprintf(&fe->value, "%llu", size);
|
||||
xasprintf(&fe->value, "%zu", size);
|
||||
}
|
||||
|
||||
/* Callback for history_all_bytes. */
|
||||
static void
|
||||
format_cb_history_all_bytes(struct format_tree *ft, struct format_entry *fe)
|
||||
{
|
||||
struct window_pane *wp = ft->wp;
|
||||
struct grid *gd;
|
||||
struct grid_line *gl;
|
||||
u_int i, lines, cells = 0, extended_cells = 0;
|
||||
|
||||
if (wp == NULL)
|
||||
return;
|
||||
gd = wp->base.grid;
|
||||
|
||||
lines = gd->hsize + gd->sy;
|
||||
for (i = 0; i < lines; i++) {
|
||||
gl = grid_get_line(gd, i);
|
||||
cells += gl->cellsize;
|
||||
extended_cells += gl->extdsize;
|
||||
}
|
||||
|
||||
xasprintf(&fe->value, "%u,%zu,%u,%zu,%u,%zu", lines,
|
||||
lines * sizeof *gl, cells, cells * sizeof *gl->celldata,
|
||||
extended_cells, extended_cells * sizeof *gl->extddata);
|
||||
}
|
||||
|
||||
/* Callback for pane_tabs. */
|
||||
@ -2823,6 +2847,7 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp)
|
||||
format_add(ft, "history_size", "%u", gd->hsize);
|
||||
format_add(ft, "history_limit", "%u", gd->hlimit);
|
||||
format_add_cb(ft, "history_bytes", format_cb_history_bytes);
|
||||
format_add_cb(ft, "history_all_bytes", format_cb_history_all_bytes);
|
||||
|
||||
format_add(ft, "pane_written", "%zu", wp->written);
|
||||
format_add(ft, "pane_skipped", "%zu", wp->skipped);
|
||||
|
8
tmux.h
8
tmux.h
@ -673,7 +673,7 @@ struct grid_cell {
|
||||
|
||||
/* Grid extended cell entry. */
|
||||
struct grid_extd_entry {
|
||||
uint32_t data;
|
||||
u_int data;
|
||||
u_short attr;
|
||||
u_char flags;
|
||||
int fg;
|
||||
@ -2889,9 +2889,9 @@ u_int session_group_attached_count(struct session_group *);
|
||||
void session_renumber_windows(struct session *);
|
||||
|
||||
/* utf8.c */
|
||||
uint32_t utf8_set_big(char, u_int);
|
||||
uint32_t utf8_map_big(const struct utf8_data *);
|
||||
void utf8_get_big(uint32_t, struct utf8_data *);
|
||||
u_int utf8_set_big(char, u_int);
|
||||
u_int utf8_map_big(const struct utf8_data *);
|
||||
void utf8_get_big(u_int, struct utf8_data *);
|
||||
void utf8_set(struct utf8_data *, u_char);
|
||||
void utf8_copy(struct utf8_data *, const struct utf8_data *);
|
||||
enum utf8_state utf8_open(struct utf8_data *, u_char);
|
||||
|
10
utf8.c
10
utf8.c
@ -55,7 +55,7 @@ static u_int utf8_big_list_size;
|
||||
static u_int utf8_big_list_used;
|
||||
|
||||
union utf8_big_map {
|
||||
uint32_t value;
|
||||
u_int value;
|
||||
struct {
|
||||
u_char flags;
|
||||
#define UTF8_BIG_SIZE 0x1f
|
||||
@ -125,7 +125,7 @@ utf8_put_big_item(const char *data, size_t size, u_int *index)
|
||||
}
|
||||
|
||||
/* Get UTF-8 as index into buffer. */
|
||||
uint32_t
|
||||
u_int
|
||||
utf8_map_big(const struct utf8_data *ud)
|
||||
{
|
||||
union utf8_big_map m = { .value = 0 };
|
||||
@ -165,7 +165,7 @@ fail:
|
||||
|
||||
/* Get UTF-8 from index into buffer. */
|
||||
void
|
||||
utf8_get_big(uint32_t v, struct utf8_data *ud)
|
||||
utf8_get_big(u_int v, struct utf8_data *ud)
|
||||
{
|
||||
union utf8_big_map m = { .value = v };
|
||||
struct utf8_big_item *bi;
|
||||
@ -183,7 +183,7 @@ utf8_get_big(uint32_t v, struct utf8_data *ud)
|
||||
return;
|
||||
}
|
||||
|
||||
o = ((uint32_t)m.data[2] << 16)|((uint32_t)m.data[1] << 8)|m.data[0];
|
||||
o = ((u_int)m.data[2] << 16)|((u_int)m.data[1] << 8)|m.data[0];
|
||||
if (o >= utf8_big_list_used)
|
||||
memset(ud->data, ' ', ud->size);
|
||||
else {
|
||||
@ -193,7 +193,7 @@ utf8_get_big(uint32_t v, struct utf8_data *ud)
|
||||
}
|
||||
|
||||
/* Get big value for UTF-8 single character. */
|
||||
uint32_t
|
||||
u_int
|
||||
utf8_set_big(char c, u_int width)
|
||||
{
|
||||
union utf8_big_map m = { .flags = 1, .data[0] = c };
|
||||
|
Loading…
Reference in New Issue
Block a user