summaryrefslogtreecommitdiff
path: root/src/misc2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-06-26 16:44:24 +0200
committerBram Moolenaar <Bram@vim.org>2016-06-26 16:44:24 +0200
commitf4fba6dcd508cb369ffa6916d9cb3fcf3d7ed548 (patch)
treeeadfcc55dff51f143e33a228f91c9c60302fbd20 /src/misc2.c
parentd388d2ac8bf8c770bf97dc406e99a20ba5104855 (diff)
downloadvim-git-f4fba6dcd508cb369ffa6916d9cb3fcf3d7ed548.tar.gz
patch 7.4.1955v7.4.1955
Problem: Using 32-bit Perl with 64-bit time_t causes memory corruption. (Christian Brabandt) Solution: Use time_T instead of time_t for global variables. (Ken Takata)
Diffstat (limited to 'src/misc2.c')
-rw-r--r--src/misc2.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/misc2.c b/src/misc2.c
index 67486aae3..1018e4b06 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -6070,12 +6070,12 @@ get4c(FILE *fd)
}
/*
- * Read 8 bytes from "fd" and turn them into a time_t, MSB first.
+ * Read 8 bytes from "fd" and turn them into a time_T, MSB first.
*/
- time_t
+ time_T
get8ctime(FILE *fd)
{
- time_t n = 0;
+ time_T n = 0;
int i;
for (i = 0; i < 8; ++i)
@@ -6137,11 +6137,11 @@ put_bytes(FILE *fd, long_u nr, int len)
#endif
/*
- * Write time_t to file "fd" in 8 bytes.
+ * Write time_T to file "fd" in 8 bytes.
* Returns FAIL when the write failed.
*/
int
-put_time(FILE *fd, time_t the_time)
+put_time(FILE *fd, time_T the_time)
{
char_u buf[8];
@@ -6150,26 +6150,26 @@ put_time(FILE *fd, time_t the_time)
}
/*
- * Write time_t to "buf[8]".
+ * Write time_T to "buf[8]".
*/
void
-time_to_bytes(time_t the_time, char_u *buf)
+time_to_bytes(time_T the_time, char_u *buf)
{
int c;
int i;
int bi = 0;
- time_t wtime = the_time;
+ time_T wtime = the_time;
- /* time_t can be up to 8 bytes in size, more than long_u, thus we
+ /* time_T can be up to 8 bytes in size, more than long_u, thus we
* can't use put_bytes() here.
* Another problem is that ">>" may do an arithmetic shift that keeps the
* sign. This happens for large values of wtime. A cast to long_u may
- * truncate if time_t is 8 bytes. So only use a cast when it is 4 bytes,
+ * truncate if time_T is 8 bytes. So only use a cast when it is 4 bytes,
* it's safe to assume that long_u is 4 bytes or more and when using 8
* bytes the top bit won't be set. */
for (i = 7; i >= 0; --i)
{
- if (i + 1 > (int)sizeof(time_t))
+ if (i + 1 > (int)sizeof(time_T))
/* ">>" doesn't work well when shifting more bits than avail */
buf[bi++] = 0;
else