To: [email protected]
Subject: patch 5.5b.1
Fcc: outbox
From: Bram Moolenaar <[email protected]>
------------

Patch 5.5b.1
Problem:    SASC complains about dead assignments and implicit type casts.
Solution:   Removed the dead assignments.  Added explicit type casts.
Files:      src/buffer.c, src/edit.c, src/eval.c, src/ex_cmds.c,
           src/ex_getln.c, src/fileio.c, src/getchar.c, src/memline.c,
           src/menu.c, src/misc1.c, src/normal.c, src/ops.c, src/quickfix.c,
           src/screen.c


*** ../vim-5.5b/src/buffer.c    Sun Sep 12 17:15:47 1999
--- src/buffer.c        Mon Sep 13 11:35:14 1999
***************
*** 1933,1941 ****
     void
 maketitle()
 {
!     char_u    *t_name = NULL;
     char_u    *t_str = NULL;
!     char_u    *i_name = NULL;
     char_u    *i_str = NULL;
     int               maxlen = 0;
     int               len;
--- 1933,1941 ----
     void
 maketitle()
 {
!     char_u    *t_name;
     char_u    *t_str = NULL;
!     char_u    *i_name;
     char_u    *i_str = NULL;
     int               maxlen = 0;
     int               len;
*** ../vim-5.5b/src/edit.c      Sun Sep 12 17:15:47 1999
--- src/edit.c  Mon Sep 13 17:43:37 1999
***************
*** 3401,3407 ****
               for (p = saved_text; *p != NUL; p++)
                   ins_char(*p);
               vim_free(saved_text);
-               saved_text = NULL;
           }
           else
           {
--- 3401,3406 ----
***************
*** 4388,4394 ****
            (char_u)AIN  /*y*/, (char_u)ZADI /*z*/};

       if (c == 'N' || c == 'M' || c == 'P' || c == 'C' || c == 'Z')
!           return map[tolower(c) - 'a'] - 1 + p_aleph; /* '-1'='sofit' */
       else if (c == 'x')
           return 'X';
       else if (c == 'q')
--- 4387,4393 ----
            (char_u)AIN  /*y*/, (char_u)ZADI /*z*/};

       if (c == 'N' || c == 'M' || c == 'P' || c == 'C' || c == 'Z')
!           return (int)(map[tolower(c) - 'a'] - 1 + p_aleph);/* '-1'='sofit' */
       else if (c == 'x')
           return 'X';
       else if (c == 'q')
***************
*** 4400,4406 ****
       else if (c == 252)
           return ' ';  /* \"u --> ' '      -- / --           */
       else if ('a' <= c && c <= 'z')
!           return map[c - 'a'] + p_aleph;
       else
           return c;
     }
--- 4399,4405 ----
       else if (c == 252)
           return ' ';  /* \"u --> ' '      -- / --           */
       else if ('a' <= c && c <= 'z')
!           return (int)(map[c - 'a'] + p_aleph);
       else
           return c;
     }
***************
*** 4428,4434 ****
                    }
       }

!       return c - 'a' + p_aleph;
     }
 }
 #endif
--- 4427,4433 ----
                    }
       }

!       return (int)(c - 'a' + p_aleph);
     }
 }
 #endif
*** ../vim-5.5b/src/eval.c      Sun Sep 12 17:15:48 1999
--- src/eval.c  Mon Sep 13 11:58:16 1999
***************
*** 3368,3374 ****
 #ifndef BYTE_OFFSET
     retvar->var_val.var_number = -1;
 #else
!     linenr_t  lnum = 0;

     lnum = get_var_number(&argvars[0]);
     if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1)
--- 3368,3374 ----
 #ifndef BYTE_OFFSET
     retvar->var_val.var_number = -1;
 #else
!     linenr_t  lnum;

     lnum = get_var_number(&argvars[0]);
     if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1)
*** ../vim-5.5b/src/ex_cmds.c   Sun Sep 12 17:15:54 1999
--- src/ex_cmds.c       Mon Sep 13 18:29:04 1999
***************
*** 45,51 ****
     char      buf2[20];
     char_u    buf3[3];
 #ifdef MULTI_BYTE
!     int               c2 = NUL;
 #endif

     c = gchar_cursor();
--- 45,51 ----
     char      buf2[20];
     char_u    buf3[3];
 #ifdef MULTI_BYTE
!     int               c2;
 #endif

     c = gchar_cursor();
*** ../vim-5.5b/src/ex_getln.c  Sun Sep 12 17:15:50 1999
--- src/ex_getln.c      Mon Sep 13 13:01:11 1999
***************
*** 542,548 ****
               /* if interrupted while completing, behave like it failed */
               if (got_int)
               {
-                   res = FAIL;
                   (void)vpeekc();     /* remove <C-C> from input stream */
                   got_int = FALSE;    /* don't abandon the command line */
                   (void)ExpandOne(NULL, NULL, 0, WILD_FREE);
--- 542,547 ----
***************
*** 3286,3292 ****
     int           histype;
     int           idx;
 {
!     int           i, j = 0;

     i = calc_hist_idx(histype, idx);
     if (i < 0)
--- 3285,3291 ----
     int           histype;
     int           idx;
 {
!     int           i, j;

     i = calc_hist_idx(histype, idx);
     if (i < 0)
*** ../vim-5.5b/src/fileio.c    Sun Sep 12 17:15:51 1999
--- src/fileio.c        Mon Sep 13 13:23:39 1999
***************
*** 153,159 ****
--- 153,163 ----
     int               error = FALSE;          /* errors encountered */
     int               ff_error = EOL_UNKNOWN; /* file format with errors */
     long      linerest;               /* remaining chars in line */
+ #ifdef UNIX
     int               perm = 0;
+ #else
+     int               perm;
+ #endif
     int               fileformat;             /* end-of-line format */
     struct stat       st;
     int               file_readonly;
*** ../vim-5.5b/src/getchar.c   Sun Sep 12 17:15:51 1999
--- src/getchar.c       Mon Sep 13 13:32:42 1999
***************
*** 2560,2566 ****
 {
     struct mapblock   *mp;
     int                       hash;
!     int                       count = 0;
     int                       round;
     char_u            *p;

--- 2560,2566 ----
 {
     struct mapblock   *mp;
     int                       hash;
!     int                       count;
     int                       round;
     char_u            *p;

*** ../vim-5.5b/src/memline.c   Sun Sep 12 17:16:01 1999
--- src/memline.c       Mon Sep 13 14:08:55 1999
***************
*** 3944,3950 ****
               buf->b_ml.ml_usedchunks = -1;
               return;
           }
-           curchnk = buf->b_ml.ml_chunksize + curix;
       }

       if (buf->b_ml.ml_chunksize[curix].mlcs_numlines >= MLCS_MAXL)
--- 3944,3949 ----
*** ../vim-5.5b/src/menu.c      Sun Sep 12 17:15:57 1999
--- src/menu.c  Mon Sep 13 14:11:55 1999
***************
*** 246,253 ****
     char_u    *next_name;
     int               i;
     int               c;
-     int               idx;
 #ifdef USE_GUI
     int               new_idx;
 #endif
     int               pri_idx = 0;
--- 246,253 ----
     char_u    *next_name;
     int               i;
     int               c;
 #ifdef USE_GUI
+     int               idx;
     int               new_idx;
 #endif
     int               pri_idx = 0;
***************
*** 270,277 ****

       /* See if it's already there */
       lower_pri = menup;
-       idx = 0;
 #ifdef USE_GUI
       new_idx = 0;
 #endif
       menu = *menup;
--- 270,277 ----

       /* See if it's already there */
       lower_pri = menup;
 #ifdef USE_GUI
+       idx = 0;
       new_idx = 0;
 #endif
       menu = *menup;
***************
*** 303,309 ****
--- 303,311 ----
            * Ignore menus that are not in the menubar (PopUp and Toolbar) */
           if (parent != NULL || menubar_menu(menu->name))
           {
+ #ifdef USE_GUI
               ++idx;
+ #endif
               if (menu->priority <= pri_tab[pri_idx])
               {
                   lower_pri = menup;
***************
*** 1533,1539 ****
 execute_menu(path_name)
     char_u    *path_name;
 {
!     VimMenu   *menu = NULL;
     char_u    *name;
     char_u    *saved_name;
     char_u    *p;
--- 1535,1541 ----
 execute_menu(path_name)
     char_u    *path_name;
 {
!     VimMenu   *menu;
     char_u    *name;
     char_u    *saved_name;
     char_u    *p;
*** ../vim-5.5b/src/misc1.c     Sun Sep 12 17:15:52 1999
--- src/misc1.c Mon Sep 13 14:14:06 1999
***************
*** 1133,1139 ****
            * (but the amount does not need to match, there might be a mix of
            * TABs and spaces).
            */
-           j = 0;
           if (vim_iswhite(string[0]))
           {
               if (i == 0 || !vim_iswhite(line[i - 1]))
--- 1133,1138 ----
***************
*** 3587,3593 ****
           ++p;
       }
     }
!     return (p - line);
 }

 /*
--- 3586,3592 ----
           ++p;
       }
     }
!     return (int)(p - line);
 }

 /*
*** ../vim-5.5b/src/normal.c    Sun Sep 12 17:16:01 1999
--- src/normal.c        Mon Sep 13 14:53:54 1999
***************
*** 3050,3056 ****
     int               old_VIsual_active = VIsual_active;
     colnr_t   tgt_leftcol = curwin->w_leftcol;
     long      topline;
-     int               win_nr = 0;
     long      y;

     /*
--- 3050,3055 ----
***************
*** 3102,3109 ****
           }
           update = 1;
       }
-
-       ++win_nr;
     }

     /*
--- 3101,3106 ----
*** ../vim-5.5b/src/ops.c       Sun Sep 12 17:16:02 1999
--- src/ops.c   Mon Sep 13 14:52:42 1999
***************
*** 323,337 ****
 {
     int                       left = (oap->op_type == OP_LSHIFT);
     int                       oldstate = State;
!     int                       total = 0, split = 0;
     char_u            *newp, *oldp, *midp, *ptr;
     int                       oldcol = curwin->w_cursor.col;
     int                       p_sw = (int)curbuf->b_p_sw;
     int                       p_ts = (int)curbuf->b_p_ts;
     struct block_def  bd;
     int                       internal = 0;
!     int                       incr = 0;
!     colnr_t           vcol = 0, col = 0, ws_vcol = 0;
     int                       i = 0, j = 0;

 #ifdef RIGHTLEFT
--- 323,337 ----
 {
     int                       left = (oap->op_type == OP_LSHIFT);
     int                       oldstate = State;
!     int                       total, split;
     char_u            *newp, *oldp, *midp, *ptr;
     int                       oldcol = curwin->w_cursor.col;
     int                       p_sw = (int)curbuf->b_p_sw;
     int                       p_ts = (int)curbuf->b_p_ts;
     struct block_def  bd;
     int                       internal = 0;
!     int                       incr;
!     colnr_t           vcol, col = 0, ws_vcol;
     int                       i = 0, j = 0;

 #ifdef RIGHTLEFT
***************
*** 409,415 ****
       }
       /* if 'expandtab' is not set, use TABs */

!       if ((split = bd.startspaces + internal) > 0)
       {
           if (!curbuf->b_p_et)
           {
--- 409,416 ----
       }
       /* if 'expandtab' is not set, use TABs */

!       split = bd.startspaces + internal;
!       if (split > 0)
       {
           if (!curbuf->b_p_et)
           {
***************
*** 476,486 ****
 {
     /* int            p_ts = (int)curbuf->b_p_ts; */
     /* incr = lbr_chartabsize(ptr, (colnr_t)vcol); */
!     int               p_ts = 0;
     int               count = 0;      /* extra spaces to replace a cut TAB */
     int               spaces = 0;     /* non-zero if cutting a TAB */
!     colnr_t   offset = 0;     /* pointer along new line */
!     int               s_len = 0;      /* STRLEN(s) */
     char_u    *newp, *oldp;   /* new, old lines */
     linenr_t  lnum;           /* loop var */
     int               oldstate = State;
--- 477,487 ----
 {
     /* int            p_ts = (int)curbuf->b_p_ts; */
     /* incr = lbr_chartabsize(ptr, (colnr_t)vcol); */
!     int               p_ts;
     int               count = 0;      /* extra spaces to replace a cut TAB */
     int               spaces = 0;     /* non-zero if cutting a TAB */
!     colnr_t   offset;         /* pointer along new line */
!     int               s_len;          /* STRLEN(s) */
     char_u    *newp, *oldp;   /* new, old lines */
     linenr_t  lnum;           /* loop var */
     int               oldstate = State;
***************
*** 1911,1919 ****
     OPARG     *oap;
 {
     colnr_t           l;
!     int                       retval=TRUE;
 #ifdef VISUALEXTRA
!     long              offset = 0;
     linenr_t          linenr;
     long              ins_len, pre_textlen = 0;
     char_u            *firstline;
--- 1912,1920 ----
     OPARG     *oap;
 {
     colnr_t           l;
!     int                       retval;
 #ifdef VISUALEXTRA
!     long              offset;
     linenr_t          linenr;
     long              ins_len, pre_textlen = 0;
     char_u            *firstline;
*** ../vim-5.5b/src/quickfix.c  Sun Sep 12 17:15:44 1999
--- src/quickfix.c      Mon Sep 13 15:20:43 1999
***************
*** 110,116 ****
     char_u        *fmtstr = NULL;
     int                   col = 0;
     int                   type = 0;
!     int                   valid = 0;
     long          lnum = 0L;
     int                   enr = 0;
     FILE          *fd;
--- 110,116 ----
     char_u        *fmtstr = NULL;
     int                   col = 0;
     int                   type = 0;
!     int                   valid;
     long          lnum = 0L;
     int                   enr = 0;
     FILE          *fd;
***************
*** 642,648 ****
           if (mch_getperm(ptr) < 0)
           {
               vim_free(ptr);
-               ptr = NULL;
               directory = qf_guess_filepath(fname);
               if (directory)
                   ptr = concat_fnames(directory, fname, TRUE);
--- 642,647 ----
***************
*** 767,773 ****
 qf_clean_dir_stack(stackptr)
     struct dir_stack_t        **stackptr;
 {
!     struct dir_stack_t  *ds_ptr = NULL;

     while ((ds_ptr = *stackptr) != NULL)
     {
--- 766,772 ----
 qf_clean_dir_stack(stackptr)
     struct dir_stack_t        **stackptr;
 {
!     struct dir_stack_t  *ds_ptr;

     while ((ds_ptr = *stackptr) != NULL)
     {
***************
*** 875,881 ****
     old_qf_ptr = qf_ptr;
     qf_index = qf_lists[qf_curlist].qf_index;
     old_qf_index = qf_index;
-     old_qf_fnum = qf_ptr->qf_fnum;
     if (dir == FORWARD || dir == FORWARD_FILE)            /* next valid entry */
     {
       while (errornr--)
--- 874,879 ----
*** ../vim-5.5b/src/screen.c    Sun Sep 12 17:15:45 1999
--- src/screen.c        Mon Sep 13 15:45:44 1999
***************
*** 314,320 ****
     WIN                   *wp;
     static int            did_intro = FALSE;
 #ifdef EXTRA_SEARCH
!     int                   did_one = FALSE;
 #endif

     if (!screen_valid(TRUE))
--- 314,320 ----
     WIN                   *wp;
     static int            did_intro = FALSE;
 #ifdef EXTRA_SEARCH
!     int                   did_one;
 #endif

     if (!screen_valid(TRUE))
***************
*** 2549,2555 ****
     char_u    *p;
     char_u    *s;
     char_u    *t;
!     char_u    *linecont = NULL;
     WIN               *o_curwin;
     BUF               *o_curbuf;
     int               empty_line;
--- 2549,2555 ----
     char_u    *p;
     char_u    *s;
     char_u    *t;
!     char_u    *linecont;
     WIN               *o_curwin;
     BUF               *o_curbuf;
     int               empty_line;
***************
*** 2692,2698 ****
       minwid = 0;
       maxwid = 50;
       zeropad = FALSE;
-       base = 'D';
       l = 1;
       if (*s == '0')
       {
--- 2692,2697 ----
***************
*** 3091,3097 ****
       hl->userhl = 0;
     }

!     return num;
 }
 #endif /* STATUSLINE */

--- 3090,3096 ----
       hl->userhl = 0;
     }

!     return (int)num;
 }
 #endif /* STATUSLINE */

*** ../vim-5.5b/src/version.c   Sun Sep 12 17:15:45 1999
--- src/version.c       Mon Sep 13 21:24:06 1999
***************
*** 420,420 ****
--- 420,421 ----
 {   /* Add new patch number below this line */
+     1,

--
hundred-and-one symptoms of being an internet addict:
20. When looking at a pageful of someone else's links, you notice all of them
   are already highlighted in purple.

--/-/---- Bram Moolenaar ---- [email protected] ---- [email protected] ---\-\--
 \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /