comparison src/fileio.c @ 9391:4c40631238e4 v7.4.1977

commit https://github.com/vim/vim/commit/bde9810d6103ffe3a22a9330021cb21db1ed1792 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jul 1 20:03:42 2016 +0200 patch 7.4.1977 Problem: With 64 bit changes don't need three calls to sprintf(). Solution: Simplify the code, use vim_snprintf(). (Ken Takata)
author Christian Brabandt <cb@256bit.org>
date Fri, 01 Jul 2016 20:15:05 +0200
parents 32e34e574716
children 69ed2c9d34a6
comparison
equal deleted inserted replaced
9390:18d12e179a7e 9391:4c40631238e4
5229 p = IObuff + STRLEN(IObuff); 5229 p = IObuff + STRLEN(IObuff);
5230 5230
5231 if (insert_space) 5231 if (insert_space)
5232 *p++ = ' '; 5232 *p++ = ' ';
5233 if (shortmess(SHM_LINES)) 5233 if (shortmess(SHM_LINES))
5234 #ifdef LONG_LONG_OFF_T 5234 vim_snprintf((char *)p, IOSIZE - (p - IObuff),
5235 sprintf((char *)p, 5235 "%ldL, %lldC", lnum, (varnumber_T)nchars);
5236 "%ldL, %lldC", lnum, (long long)nchars);
5237 #elif defined(WIN3264)
5238 sprintf((char *)p,
5239 "%ldL, %I64dC", lnum, (__int64)nchars);
5240 #else
5241 sprintf((char *)p,
5242 /* Explicit typecast avoids warning on Mac OS X 10.6 */
5243 "%ldL, %ldC", lnum, (long)nchars);
5244 #endif
5245 else 5236 else
5246 { 5237 {
5247 if (lnum == 1) 5238 if (lnum == 1)
5248 STRCPY(p, _("1 line, ")); 5239 STRCPY(p, _("1 line, "));
5249 else 5240 else
5250 sprintf((char *)p, _("%ld lines, "), lnum); 5241 sprintf((char *)p, _("%ld lines, "), lnum);
5251 p += STRLEN(p); 5242 p += STRLEN(p);
5252 if (nchars == 1) 5243 if (nchars == 1)
5253 STRCPY(p, _("1 character")); 5244 STRCPY(p, _("1 character"));
5254 else 5245 else
5255 #ifdef LONG_LONG_OFF_T 5246 vim_snprintf((char *)p, IOSIZE - (p - IObuff),
5256 sprintf((char *)p, 5247 _("%lld characters"), (varnumber_T)nchars);
5257 _("%lld characters"), (long long)nchars);
5258 #elif defined(WIN3264)
5259 sprintf((char *)p,
5260 _("%I64d characters"), (__int64)nchars);
5261 #else
5262 sprintf((char *)p,
5263 /* Explicit typecast avoids warning on Mac OS X 10.6 */
5264 _("%ld characters"), (long)nchars);
5265 #endif
5266 } 5248 }
5267 } 5249 }
5268 5250
5269 /* 5251 /*
5270 * Append message for missing line separator to IObuff. 5252 * Append message for missing line separator to IObuff.