comparison src/fileio.c @ 16764:ef00b6bc186b v8.1.1384

patch 8.1.1384: using "int" for alloc() often results in compiler warnings commit https://github.com/vim/vim/commit/964b3746b9c81e65887e2ac9a335f181db2bb592 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 24 18:54:09 2019 +0200 patch 8.1.1384: using "int" for alloc() often results in compiler warnings Problem: Using "int" for alloc() often results in compiler warnings. Solution: Use "size_t" and remove type casts. Remove alloc_check(), Vim only works with 32 bit ints anyway.
author Bram Moolenaar <Bram@vim.org>
date Fri, 24 May 2019 19:00:07 +0200
parents 8b92f3fea477
children d2deaaf21305
comparison
equal deleted inserted replaced
16763:fccf84413b53 16764:ef00b6bc186b
6201 * If there is no file name we must get the name of the current directory 6201 * If there is no file name we must get the name of the current directory
6202 * (we need the full path in case :cd is used). 6202 * (we need the full path in case :cd is used).
6203 */ 6203 */
6204 if (fname == NULL || *fname == NUL) 6204 if (fname == NULL || *fname == NUL)
6205 { 6205 {
6206 retval = alloc((unsigned)(MAXPATHL + extlen + 3)); 6206 retval = alloc(MAXPATHL + extlen + 3);
6207 if (retval == NULL) 6207 if (retval == NULL)
6208 return NULL; 6208 return NULL;
6209 if (mch_dirname(retval, MAXPATHL) == FAIL || 6209 if (mch_dirname(retval, MAXPATHL) == FAIL ||
6210 (fnamelen = (int)STRLEN(retval)) == 0) 6210 (fnamelen = (int)STRLEN(retval)) == 0)
6211 { 6211 {
6220 prepend_dot = FALSE; /* nothing to prepend a dot to */ 6220 prepend_dot = FALSE; /* nothing to prepend a dot to */
6221 } 6221 }
6222 else 6222 else
6223 { 6223 {
6224 fnamelen = (int)STRLEN(fname); 6224 fnamelen = (int)STRLEN(fname);
6225 retval = alloc((unsigned)(fnamelen + extlen + 3)); 6225 retval = alloc(fnamelen + extlen + 3);
6226 if (retval == NULL) 6226 if (retval == NULL)
6227 return NULL; 6227 return NULL;
6228 STRCPY(retval, fname); 6228 STRCPY(retval, fname);
6229 #ifdef VMS 6229 #ifdef VMS
6230 vms_remove_version(retval); /* we do not need versions here */ 6230 vms_remove_version(retval); /* we do not need versions here */
6892 path = home_replace_save(buf, buf->b_fname); 6892 path = home_replace_save(buf, buf->b_fname);
6893 if (path != NULL) 6893 if (path != NULL)
6894 { 6894 {
6895 if (!helpmesg) 6895 if (!helpmesg)
6896 mesg2 = ""; 6896 mesg2 = "";
6897 tbuf = (char *)alloc((unsigned)(STRLEN(path) + STRLEN(mesg) 6897 tbuf = (char *)alloc(STRLEN(path) + STRLEN(mesg)
6898 + STRLEN(mesg2) + 2)); 6898 + STRLEN(mesg2) + 2);
6899 sprintf(tbuf, mesg, path); 6899 sprintf(tbuf, mesg, path);
6900 #ifdef FEAT_EVAL 6900 #ifdef FEAT_EVAL
6901 /* Set warningmsg here, before the unimportant and output-specific 6901 /* Set warningmsg here, before the unimportant and output-specific
6902 * mesg2 has been appended. */ 6902 * mesg2 has been appended. */
6903 set_vim_var_string(VV_WARNINGMSG, (char_u *)tbuf, -1); 6903 set_vim_var_string(VV_WARNINGMSG, (char_u *)tbuf, -1);
7389 static void 7389 static void
7390 vim_settempdir(char_u *tempdir) 7390 vim_settempdir(char_u *tempdir)
7391 { 7391 {
7392 char_u *buf; 7392 char_u *buf;
7393 7393
7394 buf = alloc((unsigned)MAXPATHL + 2); 7394 buf = alloc(MAXPATHL + 2);
7395 if (buf != NULL) 7395 if (buf != NULL)
7396 { 7396 {
7397 if (vim_FullName(tempdir, buf, MAXPATHL, FALSE) == FAIL) 7397 if (vim_FullName(tempdir, buf, MAXPATHL, FALSE) == FAIL)
7398 STRCPY(buf, tempdir); 7398 STRCPY(buf, tempdir);
7399 add_pathsep(buf); 7399 add_pathsep(buf);