björn wrote:
> $ gcc --version
> i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5659)
>
> All I can say is that if you want to print an off_t value on OS X 10.6
> then "%lld" must be used or that warning pops up.
>
> Since those two lines in fileio.c are the only places where an off_t
> is printed I may just go ahead and add some MacVim-specific #ifdefs to
> get rid of the warning in the MacVim code, unless some other solution
> presents itself. I might also try some Apple-specific mailing list to
> see if I can get any answers there about this warning.
How about putting a cast to long as follows? If LONG_LONG_OFF_T
is undefined, then casting off_t to long does not lose precision
and should fix the compilation warning:
diff -r 0e27866cea99 src/fileio.c
--- a/src/fileio.c Tue Jun 08 23:17:01 2010 +0200
+++ b/src/fileio.c Wed Jun 09 23:09:11 2010 +0200
@@ -5225,12 +5225,11 @@
if (shortmess(SHM_LINES))
sprintf((char *)p,
#ifdef LONG_LONG_OFF_T
- "%ldL, %lldC",
-#else
- "%ldL, %ldC",
-#endif
- lnum, nchars);
- else
+ "%ldL, %lldC", lnum, nchars);
+#else
+ "%ldL, %ldC", lnum, (long)nchars);
+#endif
+ else
{
if (lnum == 1)
STRCPY(p, _("1 line, "));
@@ -5242,11 +5241,10 @@
else
sprintf((char *)p,
#ifdef LONG_LONG_OFF_T
- _("%lld characters"),
-#else
- _("%ld characters"),
-#endif
- nchars);
+ _("%lld characters"), nchars);
+#else
+ _("%ld characters"), (long)nchars);
+#endif
}
}
--
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