diff --git a/src/bin/miniview.c b/src/bin/miniview.c index f06f5cd8..7ff65eeb 100644 --- a/src/bin/miniview.c +++ b/src/bin/miniview.c @@ -502,7 +502,8 @@ _deferred_renderer(void *data) { Miniview *mv = data; Evas_Coord ox, oy, ow, oh; - int history_len, wret, pos; + int history_len, pos; + ssize_t wret; unsigned int *pixels, y; Termcell *cells; Termpty *ty; diff --git a/src/bin/termio.c b/src/bin/termio.c index 82b79723..31ddca4c 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -2037,7 +2037,8 @@ termio_selection_get(Evas_Object *obj, int c1x, int c1y, int c2x, int c2y, for (y = c1y; y <= c2y; y++) { Termcell *cells; - int w, last0, v, start_x, end_x; + ssize_t w; + int last0, v, start_x, end_x; w = 0; last0 = -1; @@ -2427,7 +2428,8 @@ termio_paste_selection(Evas_Object *obj, Elm_Sel_Type type) static void _sel_line(Termio *sd, int cy) { - int y, w = 0; + int y; + ssize_t w = 0; Termcell *cells; termpty_backlog_lock(); @@ -2772,7 +2774,8 @@ static void _sel_word(Termio *sd, int cx, int cy) { Termcell *cells; - int x, y, w = 0; + int x, y; + ssize_t w = 0; Eina_Bool done = EINA_FALSE; termpty_backlog_lock(); @@ -3183,7 +3186,7 @@ _selection_dbl_fix(Termio *sd { #if defined(SUPPORT_DBLWIDTH) int start_x, start_y, end_x, end_y; - int w = 0; + ssize_t w = 0; Termcell *cells; /* Only change the end position */ @@ -4489,7 +4492,8 @@ _smart_apply(Evas_Object *obj) Evas_Coord ox, oy, ow, oh; Eina_List *l, *ln; Termblock *blk; - int x, y, w, ch1 = 0, ch2 = 0, inv = 0, preedit_x = 0, preedit_y = 0; + int x, y, ch1 = 0, ch2 = 0, inv = 0, preedit_x = 0, preedit_y = 0; + ssize_t w; EINA_SAFETY_ON_NULL_RETURN(sd); evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); diff --git a/src/bin/termpty.c b/src/bin/termpty.c index 1ed4cff5..4422e828 100644 --- a/src/bin/termpty.c +++ b/src/bin/termpty.c @@ -711,28 +711,12 @@ add_new_ts: ssize_t termpty_row_length(Termpty *ty, int y) { - Termsave *ts; + ssize_t wret; + Termcell *cells = termpty_cellrow_get(ty, y, &wret); if (y >= 0) - { - Termcell *cells; - if (y >= ty->h) - { - ERR("invalid row given: %d while ty->h=%d", y, ty->h); - return 0; - } - cells = &(TERMPTY_SCREEN(ty, 0, y)); - return termpty_line_length(cells, ty->w); - } - if ((y < -(int)ty->backsize) || !ty->back) - { - ERR("invalid row given: %d; ty->back:%p ty->backsize:%zd", - y, ty->back, ty->backsize); - return 0; - } - ts = BACKLOG_ROW_GET(ty, y); - - return ts->cells ? ts->w : 0; + return termpty_line_length(cells, ty->w); + return cells ? wret : 0; } ssize_t @@ -800,7 +784,7 @@ termpty_backscroll_adjust(Termpty *ty, int *scroll) } static Termcell* -_termpty_cellrow_from_beacon_get(Termpty *ty, int requested_y, int *wret) +_termpty_cellrow_from_beacon_get(Termpty *ty, int requested_y, ssize_t *wret) { int backlog_y = ty->backlog_beacon.backlog_y; int screen_y = ty->backlog_beacon.screen_y; @@ -845,7 +829,7 @@ _termpty_cellrow_from_beacon_get(Termpty *ty, int requested_y, int *wret) } Termcell * -termpty_cellrow_get(Termpty *ty, int y_requested, int *wret) +termpty_cellrow_get(Termpty *ty, int y_requested, ssize_t *wret) { if (y_requested >= 0) { diff --git a/src/bin/termpty.h b/src/bin/termpty.h index 4abecad0..b76d7402 100644 --- a/src/bin/termpty.h +++ b/src/bin/termpty.h @@ -236,7 +236,7 @@ void termpty_free(Termpty *ty); void termpty_backlog_lock(void); void termpty_backlog_unlock(void); -Termcell *termpty_cellrow_get(Termpty *ty, int y, int *wret); +Termcell *termpty_cellrow_get(Termpty *ty, int y, ssize_t *wret); ssize_t termpty_row_length(Termpty *ty, int y); void termpty_write(Termpty *ty, const char *input, int len); void termpty_resize(Termpty *ty, int new_w, int new_h);