]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0296: Redundant and incorrect integer pointer casts in drawline.c v9.2.0296
authorzeertzjq <zeertzjq@outlook.com>
Sat, 4 Apr 2026 08:55:59 +0000 (08:55 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 4 Apr 2026 08:55:59 +0000 (08:55 +0000)
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>
src/drawline.c
src/ops.c
src/version.c

index b9b92a1e9e45b7f7331e5d5b8ca222ead1f1df3c..e4204425632120723f72a52701258dd873e84a31 100644 (file)
@@ -1418,8 +1418,7 @@ win_line(
                        wlv.fromcol = 0;
                    else
                    {
-                       getvvcol(wp, top, (colnr_T *)&wlv.fromcol,
-                                                               NULL, NULL, 0);
+                       getvvcol(wp, top, &wlv.fromcol, NULL, NULL, 0);
                        if (gchar_pos(top) == NUL)
                            wlv.tocol = wlv.fromcol + 1;
                    }
@@ -1437,12 +1436,10 @@ win_line(
                    {
                        pos = *bot;
                        if (*p_sel == 'e')
-                           getvvcol(wp, &pos, (colnr_T *)&wlv.tocol,
-                                                               NULL, NULL, 0);
+                           getvvcol(wp, &pos, &wlv.tocol, NULL, NULL, 0);
                        else
                        {
-                           getvvcol(wp, &pos, NULL, NULL,
-                                                    (colnr_T *)&wlv.tocol, 0);
+                           getvvcol(wp, &pos, NULL, NULL, &wlv.tocol, 0);
                            ++wlv.tocol;
                        }
                    }
@@ -1481,14 +1478,14 @@ win_line(
        {
            if (lnum == curwin->w_cursor.lnum)
                getvcol(curwin, &(curwin->w_cursor),
-                                      (colnr_T *)&wlv.fromcol, NULL, NULL, 0);
+                                               &wlv.fromcol, NULL, NULL, 0);
            else
                wlv.fromcol = 0;
            if (lnum == curwin->w_cursor.lnum + search_match_lines)
            {
                pos.lnum = lnum;
                pos.col = search_match_endcol;
-               getvcol(curwin, &pos, (colnr_T *)&wlv.tocol, NULL, NULL, 0);
+               getvcol(curwin, &pos, &wlv.tocol, NULL, NULL, 0);
            }
            else
                wlv.tocol = MAXCOL;
index 140cdc8c580b39bfa73f52dac56d9534a91b6b70..6ea50c912e3767c2c6554400a06b5c722d35214f 100644 (file)
--- a/src/ops.c
+++ b/src/ops.c
@@ -2620,7 +2620,7 @@ charwise_block_prep(
        startcol = start.col;
        if (virtual_op)
        {
-           getvcol(curwin, &start, &cs, NULL, &ce, false);
+           getvcol(curwin, &start, &cs, NULL, &ce, 0);
            if (ce != cs && start.coladd > 0)
            {
                // Part of a tab selected -- but don't
@@ -2639,7 +2639,7 @@ charwise_block_prep(
        endcol = end.col;
        if (virtual_op)
        {
-           getvcol(curwin, &end, &cs, NULL, &ce, false);
+           getvcol(curwin, &end, &cs, NULL, &ce, 0);
            if (p[endcol] == NUL || (cs + end.coladd < ce
                        // Don't add space for double-wide
                        // char; endcol will be on last byte
index f0f21363c625b12b2acea51c4cd6e679dbceb38a..49445781ee007b933b37de492d4b6b725bb4b1cd 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    296,
 /**/
     295,
 /**/