summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/auto/configure333
-rw-r--r--src/config.h.in11
-rw-r--r--src/configure.in50
-rw-r--r--src/fileio.c28
-rw-r--r--src/memline.c2
-rw-r--r--src/netbeans.c8
-rw-r--r--src/os_win32.h1
-rw-r--r--src/proto/fileio.pro2
-rw-r--r--src/structs.h2
-rw-r--r--src/vim.h10
10 files changed, 332 insertions, 115 deletions
diff --git a/src/auto/configure b/src/auto/configure
index 77dea5de99..b87825f4dc 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -2012,6 +2012,184 @@ $as_echo "$ac_res" >&6; }
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
} # ac_fn_c_find_uintX_t
+
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid; break
+else
+ as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_lo=$ac_mid; break
+else
+ as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid
+else
+ as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (($2) < 0)
+ {
+ long int i = longval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%ld", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%lu", i);
+ }
+ /* Do not output a trailing newline, as this causes \r\n confusion
+ on some platforms. */
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+ ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+ fi
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_compute_int
cat >auto/config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
@@ -11195,92 +11373,143 @@ $as_echo "not usable" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
$as_echo_n "checking size of int... " >&6; }
if test "${ac_cv_sizeof_int+set}" = set; then :
$as_echo_n "(cached) " >&6
else
- if test "$cross_compiling" = yes; then :
- as_fn_error "failed to compile test program" "$LINENO" 5
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then :
-#include <stdio.h>
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#endif
-main()
-{
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%d\n", (int)sizeof(int));
- exit(0);
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- ac_cv_sizeof_int=`cat conftestval`
else
- as_fn_error "failed to determine sizeof(int)" "$LINENO" 5
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
+ if test "$ac_cv_type_int" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (int)
+See \`config.log' for more details." "$LINENO" 5; }; }
+ else
+ ac_cv_sizeof_int=0
+ fi
fi
fi
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
$as_echo "$ac_cv_sizeof_int" >&6; }
+
+
+
cat >>confdefs.h <<_ACEOF
#define SIZEOF_INT $ac_cv_sizeof_int
_ACEOF
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if test "${ac_cv_sizeof_long+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_long" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (long)
+See \`config.log' for more details." "$LINENO" 5; }; }
+ else
+ ac_cv_sizeof_long=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5
$as_echo_n "checking size of time_t... " >&6; }
if test "${ac_cv_sizeof_time_t+set}" = set; then :
$as_echo_n "(cached) " >&6
else
- if test "$cross_compiling" = yes; then :
- as_fn_error "failed to compile test program" "$LINENO" 5
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" "$ac_includes_default"; then :
-#include <stdio.h>
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#endif
-#include <time.h>
-main()
-{
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%d\n", (int)sizeof(time_t));
- exit(0);
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- ac_cv_sizeof_time_t=`cat conftestval`
else
- as_fn_error "failed to determine sizeof(time_t)" "$LINENO" 5
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
+ if test "$ac_cv_type_time_t" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (time_t)
+See \`config.log' for more details." "$LINENO" 5; }; }
+ else
+ ac_cv_sizeof_time_t=0
+ fi
fi
fi
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_time_t" >&5
$as_echo "$ac_cv_sizeof_time_t" >&6; }
+
+
+
cat >>confdefs.h <<_ACEOF
#define SIZEOF_TIME_T $ac_cv_sizeof_time_t
_ACEOF
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5
+$as_echo_n "checking size of off_t... " >&6; }
+if test "${ac_cv_sizeof_off_t+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_off_t" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (off_t)
+See \`config.log' for more details." "$LINENO" 5; }; }
+ else
+ ac_cv_sizeof_off_t=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_off_t" >&5
+$as_echo "$ac_cv_sizeof_off_t" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_OFF_T $ac_cv_sizeof_off_t
+_ACEOF
+
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking uint32_t is 32 bits" >&5
$as_echo_n "checking uint32_t is 32 bits... " >&6; }
if test "$cross_compiling" = yes; then :
diff --git a/src/config.h.in b/src/config.h.in
index 1099531513..f6c4561aee 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -39,6 +39,12 @@
/* Defined to the size of an int */
#undef SIZEOF_INT
+/* Defined to the size of a long */
+#undef SIZEOF_LONG
+
+/* Defined to the size of off_t */
+#undef SIZEOF_OFF_T
+
/* Defined to the size of time_t */
#undef SIZEOF_TIME_T
@@ -251,12 +257,13 @@
#undef HAVE_SYS_SYSINFO_H
#undef HAVE_SYS_SYSTEMINFO_H
#undef HAVE_SYS_TIME_H
+#undef HAVE_SYS_TYPES_H
#undef HAVE_SYS_UTSNAME_H
-#undef HAVE_WCHAR_H
-#undef HAVE_WCTYPE_H
#undef HAVE_TERMCAP_H
#undef HAVE_TERMIOS_H
#undef HAVE_TERMIO_H
+#undef HAVE_WCHAR_H
+#undef HAVE_WCTYPE_H
#undef HAVE_UNISTD_H
#undef HAVE_UTIL_DEBUG_H
#undef HAVE_UTIL_MSGI18N_H
diff --git a/src/configure.in b/src/configure.in
index 35ecde3b82..b98af27d1b 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -2964,52 +2964,10 @@ AC_TRY_COMPILE(
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
AC_MSG_RESULT(not usable))
-dnl Our own version of AC_CHECK_SIZEOF(int); fixes a bug when sizeof() can't
-dnl be printed with "%d", and avoids a warning for cross-compiling.
-
-AC_MSG_CHECKING(size of int)
-AC_CACHE_VAL(ac_cv_sizeof_int,
- [AC_TRY_RUN([
-#include <stdio.h>
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#endif
-main()
-{
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%d\n", (int)sizeof(int));
- exit(0);
-}],
- ac_cv_sizeof_int=`cat conftestval`,
- AC_MSG_ERROR([failed to determine sizeof(int)]),
- AC_MSG_ERROR([failed to compile test program]))])
-AC_MSG_RESULT($ac_cv_sizeof_int)
-AC_DEFINE_UNQUOTED(SIZEOF_INT, $ac_cv_sizeof_int)
-
-dnl Figure out sizeof(time_t) so that it can be used in #ifdef.
-AC_MSG_CHECKING(size of time_t)
-AC_CACHE_VAL(ac_cv_sizeof_time_t,
- [AC_TRY_RUN([
-#include <stdio.h>
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#endif
-#include <time.h>
-main()
-{
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%d\n", (int)sizeof(time_t));
- exit(0);
-}],
- ac_cv_sizeof_time_t=`cat conftestval`,
- AC_MSG_ERROR([failed to determine sizeof(time_t)]),
- AC_MSG_ERROR([failed to compile test program]))])
-AC_MSG_RESULT($ac_cv_sizeof_time_t)
-AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
+AC_CHECK_SIZEOF([int])
+AC_CHECK_SIZEOF([long])
+AC_CHECK_SIZEOF([time_t])
+AC_CHECK_SIZEOF([off_t])
dnl Make sure that uint32_t is really 32 bits unsigned.
AC_MSG_CHECKING([uint32_t is 32 bits])
diff --git a/src/fileio.c b/src/fileio.c
index ff21783ffe..2685101170 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -59,7 +59,7 @@ static void check_marks_read __ARGS((void));
#endif
#ifdef FEAT_CRYPT
static int get_crypt_method __ARGS((char *ptr, int len));
-static char_u *check_for_cryptkey __ARGS((char_u *cryptkey, char_u *ptr, long *sizep, long *filesizep, int newfile, int *did_ask));
+static char_u *check_for_cryptkey __ARGS((char_u *cryptkey, char_u *ptr, long *sizep, off_t *filesizep, int newfile, int *did_ask));
#endif
#ifdef UNIX
static void set_file_time __ARGS((char_u *fname, time_t atime, time_t mtime));
@@ -247,7 +247,7 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
colnr_T len;
long size = 0;
char_u *p;
- long filesize = 0;
+ off_t filesize = 0;
int skip_read = FALSE;
#ifdef FEAT_CRYPT
char_u *cryptkey = NULL;
@@ -2866,7 +2866,7 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, did_ask)
char_u *cryptkey; /* previous encryption key or NULL */
char_u *ptr; /* pointer to read bytes */
long *sizep; /* length of read bytes */
- long *filesizep; /* nr of bytes used from file */
+ off_t *filesizep; /* nr of bytes used from file */
int newfile; /* editing a new buffer */
int *did_ask; /* flag: whether already asked for key */
{
@@ -5222,7 +5222,7 @@ msg_add_fileformat(eol_type)
msg_add_lines(insert_space, lnum, nchars)
int insert_space;
long lnum;
- long nchars;
+ off_t nchars;
{
char_u *p;
@@ -5231,7 +5231,13 @@ msg_add_lines(insert_space, lnum, nchars)
if (insert_space)
*p++ = ' ';
if (shortmess(SHM_LINES))
- sprintf((char *)p, "%ldL, %ldC", lnum, nchars);
+ sprintf((char *)p,
+#ifdef LONG_LONG_OFF_T
+ "%ldL, %lldC",
+#else
+ "%ldL, %ldC",
+#endif
+ lnum, nchars);
else
{
if (lnum == 1)
@@ -5242,7 +5248,13 @@ msg_add_lines(insert_space, lnum, nchars)
if (nchars == 1)
STRCPY(p, _("1 character"));
else
- sprintf((char *)p, _("%ld characters"), nchars);
+ sprintf((char *)p,
+#ifdef LONG_LONG_OFF_T
+ _("%lld characters"),
+#else
+ _("%ld characters"),
+#endif
+ nchars);
}
}
@@ -6813,7 +6825,7 @@ buf_check_timestamp(buf, focus)
#if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG)
int can_reload = FALSE;
#endif
- size_t orig_size = buf->b_orig_size;
+ off_t orig_size = buf->b_orig_size;
int orig_mode = buf->b_orig_mode;
#ifdef FEAT_GUI
int save_mouse_correct = need_mouse_correct;
@@ -7213,7 +7225,7 @@ buf_store_time(buf, st, fname)
char_u *fname UNUSED;
{
buf->b_mtime = (long)st->st_mtime;
- buf->b_orig_size = (size_t)st->st_size;
+ buf->b_orig_size = st->st_size;
#ifdef HAVE_ST_MODE
buf->b_orig_mode = (int)st->st_mode;
#else
diff --git a/src/memline.c b/src/memline.c
index 6f0143cc3e..d9043dce63 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -1983,7 +1983,7 @@ ml_sync_all(check_file, check_char)
*/
if (mch_stat((char *)buf->b_ffname, &st) == -1
|| st.st_mtime != buf->b_mtime_read
- || (size_t)st.st_size != buf->b_orig_size)
+ || st.st_size != buf->b_orig_size)
{
ml_preserve(buf, FALSE);
did_check_timestamps = FALSE;
diff --git a/src/netbeans.c b/src/netbeans.c
index bd83f6489d..ff191d7d2a 100644
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -939,7 +939,7 @@ static void addsigntype __ARGS((nbbuf_T *, int localsigntype, char_u *typeName,
char_u *tooltip, char_u *glyphfile,
char_u *fg, char_u *bg));
static void print_read_msg __ARGS((nbbuf_T *buf));
-static void print_save_msg __ARGS((nbbuf_T *buf, long nchars));
+static void print_save_msg __ARGS((nbbuf_T *buf, off_t nchars));
static int curPCtype = -1;
@@ -3837,7 +3837,7 @@ print_read_msg(buf)
nbbuf_T *buf;
{
int lnum = buf->bufp->b_ml.ml_line_count;
- long nchars = (long)buf->bufp->b_orig_size;
+ off_t nchars = buf->bufp->b_orig_size;
char_u c;
msg_add_fname(buf->bufp, buf->bufp->b_ffname);
@@ -3873,7 +3873,7 @@ print_read_msg(buf)
static void
print_save_msg(buf, nchars)
nbbuf_T *buf;
- long nchars;
+ off_t nchars;
{
char_u c;
char_u *p;
@@ -3885,7 +3885,7 @@ print_save_msg(buf, nchars)
c = FALSE;
msg_add_lines(c, buf->bufp->b_ml.ml_line_count,
- (long)buf->bufp->b_orig_size);
+ buf->bufp->b_orig_size);
vim_free(keep_msg);
keep_msg = NULL;
diff --git a/src/os_win32.h b/src/os_win32.h
index b57ee23886..527d8c7b30 100644
--- a/src/os_win32.h
+++ b/src/os_win32.h
@@ -93,6 +93,7 @@
#include <stdlib.h>
#include <time.h>
+#include <sys/types.h>
#ifndef STRICT
# define STRICT
diff --git a/src/proto/fileio.pro b/src/proto/fileio.pro
index 32e3045523..75285dfef3 100644
--- a/src/proto/fileio.pro
+++ b/src/proto/fileio.pro
@@ -9,7 +9,7 @@ char_u *read_string_decrypt __ARGS((buf_T *buf, FILE *fd, int len));
int check_file_readonly __ARGS((char_u *fname, int perm));
int buf_write __ARGS((buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, linenr_T end, exarg_T *eap, int append, int forceit, int reset_changed, int filtering));
void msg_add_fname __ARGS((buf_T *buf, char_u *fname));
-void msg_add_lines __ARGS((int insert_space, long lnum, long nchars));
+void msg_add_lines __ARGS((int insert_space, long lnum, off_t nchars));
char_u *shorten_fname1 __ARGS((char_u *full_path));
char_u *shorten_fname __ARGS((char_u *full_path, char_u *dir_name));
void shorten_fnames __ARGS((int force));
diff --git a/src/structs.h b/src/structs.h
index 2ec02f3db7..927aa06db4 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -1200,7 +1200,7 @@ struct file_buffer
long b_mtime; /* last change time of original file */
long b_mtime_read; /* last change time when reading */
- size_t b_orig_size; /* size of original file in bytes */
+ off_t b_orig_size; /* size of original file in bytes */
int b_orig_mode; /* mode of original file */
pos_T b_namedm[NMARKS]; /* current named marks (mark.c) */
diff --git a/src/vim.h b/src/vim.h
index 8ae68562ce..a5d7364385 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -411,6 +411,16 @@ typedef long __w64 long_i;
#define PRINTF_DECIMAL_LONG_U SCANF_DECIMAL_LONG_U
/*
+ * Only systems which use configure will have SIZEOF_OFF_T and SIZEOF_LONG
+ * defined, which is ok since those are the same systems which can have
+ * varying sizes for off_t. The other systems will continue to use "%ld" to
+ * print off_t since off_t is simply a typedef to long for them.
+ */
+#if defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T > SIZEOF_LONG)
+# define LONG_LONG_OFF_T
+#endif
+
+/*
* The characters and attributes cached for the screen.
*/
typedef char_u schar_T;