Skip to content

Commit 18cd55d

Browse files
zeertzjqchrisbra
authored andcommitted
patch 9.2.0296: Redundant and incorrect integer pointer casts in drawline.c
Problem: Currently `colnr_T` and `int` and the same type, so casting `int *` to `colnr_T *` is redundant. Additionally, even if they are changed to different types in the future, these casts are incorrect as they won't work on big-endian platforms. Solution: Remove the casts. Also fix two cases of passing false instead of 0 to an integer argument (zeertzjq). related: #19672 closes: #19907 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 08bd911 commit 18cd55d

3 files changed

Lines changed: 9 additions & 10 deletions

File tree

src/drawline.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,8 +1418,7 @@ win_line(
14181418
wlv.fromcol = 0;
14191419
else
14201420
{
1421-
getvvcol(wp, top, (colnr_T *)&wlv.fromcol,
1422-
NULL, NULL, 0);
1421+
getvvcol(wp, top, &wlv.fromcol, NULL, NULL, 0);
14231422
if (gchar_pos(top) == NUL)
14241423
wlv.tocol = wlv.fromcol + 1;
14251424
}
@@ -1437,12 +1436,10 @@ win_line(
14371436
{
14381437
pos = *bot;
14391438
if (*p_sel == 'e')
1440-
getvvcol(wp, &pos, (colnr_T *)&wlv.tocol,
1441-
NULL, NULL, 0);
1439+
getvvcol(wp, &pos, &wlv.tocol, NULL, NULL, 0);
14421440
else
14431441
{
1444-
getvvcol(wp, &pos, NULL, NULL,
1445-
(colnr_T *)&wlv.tocol, 0);
1442+
getvvcol(wp, &pos, NULL, NULL, &wlv.tocol, 0);
14461443
++wlv.tocol;
14471444
}
14481445
}
@@ -1481,14 +1478,14 @@ win_line(
14811478
{
14821479
if (lnum == curwin->w_cursor.lnum)
14831480
getvcol(curwin, &(curwin->w_cursor),
1484-
(colnr_T *)&wlv.fromcol, NULL, NULL, 0);
1481+
&wlv.fromcol, NULL, NULL, 0);
14851482
else
14861483
wlv.fromcol = 0;
14871484
if (lnum == curwin->w_cursor.lnum + search_match_lines)
14881485
{
14891486
pos.lnum = lnum;
14901487
pos.col = search_match_endcol;
1491-
getvcol(curwin, &pos, (colnr_T *)&wlv.tocol, NULL, NULL, 0);
1488+
getvcol(curwin, &pos, &wlv.tocol, NULL, NULL, 0);
14921489
}
14931490
else
14941491
wlv.tocol = MAXCOL;

src/ops.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2620,7 +2620,7 @@ charwise_block_prep(
26202620
startcol = start.col;
26212621
if (virtual_op)
26222622
{
2623-
getvcol(curwin, &start, &cs, NULL, &ce, false);
2623+
getvcol(curwin, &start, &cs, NULL, &ce, 0);
26242624
if (ce != cs && start.coladd > 0)
26252625
{
26262626
// Part of a tab selected -- but don't
@@ -2639,7 +2639,7 @@ charwise_block_prep(
26392639
endcol = end.col;
26402640
if (virtual_op)
26412641
{
2642-
getvcol(curwin, &end, &cs, NULL, &ce, false);
2642+
getvcol(curwin, &end, &cs, NULL, &ce, 0);
26432643
if (p[endcol] == NUL || (cs + end.coladd < ce
26442644
// Don't add space for double-wide
26452645
// char; endcol will be on last byte

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ static char *(features[]) =
734734

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
296,
737739
/**/
738740
295,
739741
/**/

0 commit comments

Comments
 (0)