Mercurial > vim
comparison src/fileio.c @ 2241:60da25e3aab7 vim73
Correct use of long instead of off_t for file size. (James Vega)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Mon, 31 May 2010 21:59:46 +0200 |
parents | 732cb7b31956 |
children | 03a5f2897db3 |
comparison
equal
deleted
inserted
replaced
2240:6b4879aea261 | 2241:60da25e3aab7 |
---|---|
57 #ifdef FEAT_VIMINFO | 57 #ifdef FEAT_VIMINFO |
58 static void check_marks_read __ARGS((void)); | 58 static void check_marks_read __ARGS((void)); |
59 #endif | 59 #endif |
60 #ifdef FEAT_CRYPT | 60 #ifdef FEAT_CRYPT |
61 static int get_crypt_method __ARGS((char *ptr, int len)); | 61 static int get_crypt_method __ARGS((char *ptr, int len)); |
62 static char_u *check_for_cryptkey __ARGS((char_u *cryptkey, char_u *ptr, long *sizep, long *filesizep, int newfile, int *did_ask)); | 62 static char_u *check_for_cryptkey __ARGS((char_u *cryptkey, char_u *ptr, long *sizep, off_t *filesizep, int newfile, int *did_ask)); |
63 #endif | 63 #endif |
64 #ifdef UNIX | 64 #ifdef UNIX |
65 static void set_file_time __ARGS((char_u *fname, time_t atime, time_t mtime)); | 65 static void set_file_time __ARGS((char_u *fname, time_t atime, time_t mtime)); |
66 #endif | 66 #endif |
67 static int set_rw_fname __ARGS((char_u *fname, char_u *sfname)); | 67 static int set_rw_fname __ARGS((char_u *fname, char_u *sfname)); |
245 char_u *line_start = NULL; /* init to shut up gcc */ | 245 char_u *line_start = NULL; /* init to shut up gcc */ |
246 int wasempty; /* buffer was empty before reading */ | 246 int wasempty; /* buffer was empty before reading */ |
247 colnr_T len; | 247 colnr_T len; |
248 long size = 0; | 248 long size = 0; |
249 char_u *p; | 249 char_u *p; |
250 long filesize = 0; | 250 off_t filesize = 0; |
251 int skip_read = FALSE; | 251 int skip_read = FALSE; |
252 #ifdef FEAT_CRYPT | 252 #ifdef FEAT_CRYPT |
253 char_u *cryptkey = NULL; | 253 char_u *cryptkey = NULL; |
254 int did_ask_for_key = FALSE; | 254 int did_ask_for_key = FALSE; |
255 #endif | 255 #endif |
2864 static char_u * | 2864 static char_u * |
2865 check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, did_ask) | 2865 check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, did_ask) |
2866 char_u *cryptkey; /* previous encryption key or NULL */ | 2866 char_u *cryptkey; /* previous encryption key or NULL */ |
2867 char_u *ptr; /* pointer to read bytes */ | 2867 char_u *ptr; /* pointer to read bytes */ |
2868 long *sizep; /* length of read bytes */ | 2868 long *sizep; /* length of read bytes */ |
2869 long *filesizep; /* nr of bytes used from file */ | 2869 off_t *filesizep; /* nr of bytes used from file */ |
2870 int newfile; /* editing a new buffer */ | 2870 int newfile; /* editing a new buffer */ |
2871 int *did_ask; /* flag: whether already asked for key */ | 2871 int *did_ask; /* flag: whether already asked for key */ |
2872 { | 2872 { |
2873 int method = get_crypt_method((char *)ptr, *sizep); | 2873 int method = get_crypt_method((char *)ptr, *sizep); |
2874 | 2874 |
5220 */ | 5220 */ |
5221 void | 5221 void |
5222 msg_add_lines(insert_space, lnum, nchars) | 5222 msg_add_lines(insert_space, lnum, nchars) |
5223 int insert_space; | 5223 int insert_space; |
5224 long lnum; | 5224 long lnum; |
5225 long nchars; | 5225 off_t nchars; |
5226 { | 5226 { |
5227 char_u *p; | 5227 char_u *p; |
5228 | 5228 |
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 sprintf((char *)p, "%ldL, %ldC", lnum, nchars); | 5234 sprintf((char *)p, |
5235 #ifdef LONG_LONG_OFF_T | |
5236 "%ldL, %lldC", | |
5237 #else | |
5238 "%ldL, %ldC", | |
5239 #endif | |
5240 lnum, nchars); | |
5235 else | 5241 else |
5236 { | 5242 { |
5237 if (lnum == 1) | 5243 if (lnum == 1) |
5238 STRCPY(p, _("1 line, ")); | 5244 STRCPY(p, _("1 line, ")); |
5239 else | 5245 else |
5240 sprintf((char *)p, _("%ld lines, "), lnum); | 5246 sprintf((char *)p, _("%ld lines, "), lnum); |
5241 p += STRLEN(p); | 5247 p += STRLEN(p); |
5242 if (nchars == 1) | 5248 if (nchars == 1) |
5243 STRCPY(p, _("1 character")); | 5249 STRCPY(p, _("1 character")); |
5244 else | 5250 else |
5245 sprintf((char *)p, _("%ld characters"), nchars); | 5251 sprintf((char *)p, |
5252 #ifdef LONG_LONG_OFF_T | |
5253 _("%lld characters"), | |
5254 #else | |
5255 _("%ld characters"), | |
5256 #endif | |
5257 nchars); | |
5246 } | 5258 } |
5247 } | 5259 } |
5248 | 5260 |
5249 /* | 5261 /* |
5250 * Append message for missing line separator to IObuff. | 5262 * Append message for missing line separator to IObuff. |
6811 int helpmesg = FALSE; | 6823 int helpmesg = FALSE; |
6812 int reload = FALSE; | 6824 int reload = FALSE; |
6813 #if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG) | 6825 #if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG) |
6814 int can_reload = FALSE; | 6826 int can_reload = FALSE; |
6815 #endif | 6827 #endif |
6816 size_t orig_size = buf->b_orig_size; | 6828 off_t orig_size = buf->b_orig_size; |
6817 int orig_mode = buf->b_orig_mode; | 6829 int orig_mode = buf->b_orig_mode; |
6818 #ifdef FEAT_GUI | 6830 #ifdef FEAT_GUI |
6819 int save_mouse_correct = need_mouse_correct; | 6831 int save_mouse_correct = need_mouse_correct; |
6820 #endif | 6832 #endif |
6821 #ifdef FEAT_AUTOCMD | 6833 #ifdef FEAT_AUTOCMD |
7211 buf_T *buf; | 7223 buf_T *buf; |
7212 struct stat *st; | 7224 struct stat *st; |
7213 char_u *fname UNUSED; | 7225 char_u *fname UNUSED; |
7214 { | 7226 { |
7215 buf->b_mtime = (long)st->st_mtime; | 7227 buf->b_mtime = (long)st->st_mtime; |
7216 buf->b_orig_size = (size_t)st->st_size; | 7228 buf->b_orig_size = st->st_size; |
7217 #ifdef HAVE_ST_MODE | 7229 #ifdef HAVE_ST_MODE |
7218 buf->b_orig_mode = (int)st->st_mode; | 7230 buf->b_orig_mode = (int)st->st_mode; |
7219 #else | 7231 #else |
7220 buf->b_orig_mode = mch_getperm(fname); | 7232 buf->b_orig_mode = mch_getperm(fname); |
7221 #endif | 7233 #endif |