Erich Ritz wrote:

> First time poster here...
> 
> Updating from 7.4.827 to 7.4.843 gives me a new compiler warning:
> misc1.c(3988) : warning C4267: '-=' : conversion from 'size_t' to 'int', 
> possible loss of data
> 
> I'm using MSVC 2012, targeting 64-bit.  My compile commands are:
> nmake -f Make_mvc.mak CPU=AMD64 FEATURES=HUGE GUI=no  OLE=no  MBYTE=yes 
> IME=no  POSTSCRIPT=yes CPUNR=pentium4 WINVER=0x0500
> nmake -f Make_mvc.mak CPU=AMD64 FEATURES=HUGE GUI=yes OLE=yes MBYTE=yes 
> IME=yes POSTSCRIPT=yes CPUNR=pentium4 WINVER=0x0500
> 
> Because the maximum value of len is limited to the value of dstlen on lines 
> 3984 and 3985, we can safely cast to an int on line 3988 to silence the 
> warning:
> 
> diff --git a/src/misc1.c b/src/misc1.c
> index ee2da08..8b5ea64 100644
> --- a/src/misc1.c
> +++ b/src/misc1.c
> @@ -3985,7 +3985,7 @@ expand_env_esc(srcp, dst, dstlen, esc, one, startstr)
>                 len = dstlen;
>             vim_strncpy(dst, var, len);
>             dst += len;
> -           dstlen -= len;
> +           dstlen -= (int)len;
>             continue;
>         }
>  #endif
> 
> (Actually if dstlen were negative there would be a problem, but that
> would be a logic error for the caller since dstlen is supposed to
> represent a length.)

Thanks.  A typecast is usually the right solution for these warnings.

-- 
Why is "abbreviation" such a long word?

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui